From 4a6083836a5af12bf8c87a6ff41e5bcdbcc058a9 Mon Sep 17 00:00:00 2001 From: Nikolaj Bjorner Date: Tue, 13 Apr 2021 18:17:10 -0700 Subject: [PATCH] call it data instead of c_ptr for approaching C++11 std::vector convention. --- examples/tptp/tptp5.h | 2 +- src/ackermannization/ackr_model_converter.cpp | 6 +- .../lackr_model_constructor.cpp | 10 +- src/api/api_array.cpp | 12 +- src/api/api_ast.cpp | 6 +- src/api/api_datalog.cpp | 2 +- src/api/api_datatype.cpp | 14 +- src/api/api_model.cpp | 2 +- src/api/api_opt.cpp | 4 +- src/api/api_pb.cpp | 6 +- src/api/api_quant.cpp | 20 +- src/api/api_rcf.cpp | 4 +- src/api/api_seq.cpp | 4 +- src/api/api_tactic.cpp | 2 +- src/api/z3_replayer.cpp | 10 +- src/ast/arith_decl_plugin.cpp | 8 +- src/ast/arith_decl_plugin.h | 2 +- src/ast/array_decl_plugin.cpp | 10 +- src/ast/array_decl_plugin.h | 10 +- src/ast/ast.cpp | 58 ++-- src/ast/ast.h | 34 +-- src/ast/ast_pp_util.cpp | 2 +- src/ast/ast_smt2_pp.cpp | 18 +- src/ast/ast_translation.cpp | 14 +- src/ast/ast_util.cpp | 4 +- src/ast/ast_util.h | 10 +- src/ast/bv_decl_plugin.h | 2 +- src/ast/datatype_decl_plugin.cpp | 16 +- src/ast/dl_decl_plugin.cpp | 8 +- src/ast/euf/euf_egraph.cpp | 2 +- src/ast/expr2polynomial.cpp | 8 +- src/ast/expr_abstract.cpp | 6 +- src/ast/expr_abstract.h | 4 +- src/ast/expr_functors.cpp | 2 +- src/ast/expr_functors.h | 2 +- src/ast/format.h | 2 +- src/ast/fpa/bv2fpa_converter.cpp | 10 +- src/ast/fpa/fpa2bv_converter.cpp | 4 +- src/ast/fpa/fpa2bv_rewriter.cpp | 2 +- src/ast/macros/macro_finder.cpp | 2 +- src/ast/macros/macro_manager.cpp | 6 +- src/ast/macros/macro_util.cpp | 16 +- src/ast/macros/quasi_macros.cpp | 10 +- src/ast/normal_forms/defined_names.cpp | 18 +- src/ast/normal_forms/nnf.cpp | 38 +-- src/ast/normal_forms/pull_quant.cpp | 16 +- src/ast/pattern/expr_pattern_match.h | 4 +- src/ast/pattern/pattern_inference.cpp | 10 +- src/ast/pb_decl_plugin.cpp | 14 +- src/ast/pb_decl_plugin.h | 4 +- src/ast/proofs/proof_checker.cpp | 16 +- src/ast/proofs/proof_utils.cpp | 30 +- src/ast/proofs/proof_utils.h | 6 +- src/ast/recfun_decl_plugin.cpp | 6 +- src/ast/recfun_decl_plugin.h | 8 +- src/ast/recurse_expr_def.h | 4 +- src/ast/rewriter/arith_rewriter.cpp | 46 +-- src/ast/rewriter/array_rewriter.cpp | 44 +-- src/ast/rewriter/ast_counter.h | 2 +- src/ast/rewriter/bit2int.cpp | 2 +- .../bit_blaster/bit_blaster_rewriter.cpp | 16 +- .../bit_blaster/bit_blaster_tpl_def.h | 108 +++---- src/ast/rewriter/bool_rewriter.cpp | 14 +- src/ast/rewriter/bool_rewriter.h | 4 +- src/ast/rewriter/bv_bounds.cpp | 4 +- src/ast/rewriter/bv_elim.cpp | 12 +- src/ast/rewriter/bv_rewriter.cpp | 56 ++-- src/ast/rewriter/datatype_rewriter.cpp | 4 +- src/ast/rewriter/der.cpp | 14 +- src/ast/rewriter/distribute_forall.cpp | 4 +- src/ast/rewriter/elim_bounds.cpp | 2 +- src/ast/rewriter/enum2bv_rewriter.cpp | 4 +- src/ast/rewriter/expr_safe_replace.cpp | 2 +- src/ast/rewriter/factor_rewriter.cpp | 12 +- src/ast/rewriter/func_decl_replace.cpp | 4 +- src/ast/rewriter/inj_axiom.cpp | 8 +- src/ast/rewriter/pb2bv_rewriter.cpp | 18 +- src/ast/rewriter/pb_rewriter.cpp | 18 +- src/ast/rewriter/poly_rewriter_def.h | 60 ++-- src/ast/rewriter/quant_hoist.cpp | 10 +- src/ast/rewriter/rewriter.cpp | 4 +- src/ast/rewriter/rewriter_def.h | 14 +- src/ast/rewriter/seq_axioms.cpp | 2 +- src/ast/rewriter/seq_eq_solver.cpp | 6 +- src/ast/rewriter/seq_eq_solver.h | 2 +- src/ast/rewriter/seq_rewriter.cpp | 82 +++--- src/ast/rewriter/seq_rewriter.h | 4 +- src/ast/rewriter/seq_skolem.cpp | 2 +- src/ast/rewriter/seq_skolem.h | 2 +- src/ast/rewriter/th_rewriter.cpp | 8 +- src/ast/rewriter/var_subst.cpp | 16 +- src/ast/rewriter/var_subst.h | 10 +- src/ast/seq_decl_plugin.h | 2 +- src/ast/substitution/substitution.cpp | 4 +- src/ast/substitution/substitution_tree.cpp | 2 +- src/cmd_context/basic_cmds.cpp | 10 +- src/cmd_context/cmd_context.cpp | 8 +- src/cmd_context/extra_cmds/dbg_cmds.cpp | 4 +- src/cmd_context/pdecl.cpp | 36 +-- src/cmd_context/pdecl.h | 2 +- src/cmd_context/tactic_cmds.cpp | 16 +- src/math/automata/symbolic_automata_def.h | 2 +- src/math/grobner/grobner.cpp | 22 +- src/math/grobner/grobner.h | 2 +- src/math/grobner/pdd_simplifier.cpp | 6 +- src/math/hilbert/heap_trie.h | 6 +- src/math/hilbert/hilbert_basis.cpp | 2 +- src/math/lp/emonics.h | 4 +- src/math/lp/nex.h | 4 +- src/math/lp/nra_solver.cpp | 8 +- src/math/polynomial/algebraic_numbers.cpp | 60 ++-- src/math/polynomial/polynomial.cpp | 42 +-- src/math/polynomial/polynomial.h | 4 +- src/math/polynomial/rpolynomial.cpp | 6 +- src/math/polynomial/sexpr2upolynomial.cpp | 8 +- src/math/polynomial/upolynomial.cpp | 108 +++---- src/math/polynomial/upolynomial.h | 60 ++-- .../polynomial/upolynomial_factorization.cpp | 94 +++--- .../upolynomial_factorization_int.h | 8 +- src/math/realclosure/realclosure.cpp | 278 +++++++++--------- src/math/realclosure/realclosure.h | 2 +- src/math/simplex/model_based_opt.cpp | 4 +- src/math/subpaving/subpaving.cpp | 8 +- src/math/subpaving/subpaving_t_def.h | 2 +- src/math/subpaving/tactic/expr2subpaving.cpp | 4 +- .../subpaving/tactic/subpaving_tactic.cpp | 2 +- src/model/array_factory.cpp | 10 +- src/model/func_interp.cpp | 10 +- src/model/func_interp.h | 2 +- src/model/model.cpp | 12 +- src/model/model2expr.cpp | 10 +- src/model/model_evaluator.cpp | 18 +- src/model/model_implicant.cpp | 8 +- src/model/model_smt2_pp.cpp | 2 +- src/muz/base/bind_variables.cpp | 6 +- src/muz/base/dl_boogie_proof.cpp | 4 +- src/muz/base/dl_context.cpp | 14 +- src/muz/base/dl_context.h | 4 +- src/muz/base/dl_engine_base.h | 4 +- src/muz/base/dl_rule.cpp | 38 +-- src/muz/base/dl_rule_set.cpp | 4 +- src/muz/base/dl_rule_set.h | 4 +- src/muz/base/dl_util.cpp | 10 +- src/muz/base/dl_util.h | 20 +- src/muz/base/hnf.cpp | 16 +- src/muz/bmc/dl_bmc_engine.cpp | 80 ++--- src/muz/clp/clp_context.cpp | 2 +- src/muz/ddnf/ddnf.cpp | 12 +- src/muz/fp/datalog_parser.cpp | 6 +- src/muz/fp/dl_cmds.cpp | 6 +- src/muz/fp/horn_tactic.cpp | 6 +- src/muz/rel/aig_exporter.cpp | 10 +- src/muz/rel/check_relation.cpp | 42 +-- src/muz/rel/dl_base.cpp | 6 +- src/muz/rel/dl_base.h | 4 +- src/muz/rel/dl_bound_relation.cpp | 8 +- src/muz/rel/dl_compiler.cpp | 28 +- src/muz/rel/dl_external_relation.cpp | 16 +- src/muz/rel/dl_finite_product_relation.cpp | 46 +-- src/muz/rel/dl_instruction.cpp | 10 +- src/muz/rel/dl_interval_relation.cpp | 8 +- src/muz/rel/dl_lazy_table.cpp | 18 +- src/muz/rel/dl_mk_explanations.cpp | 14 +- src/muz/rel/dl_mk_similarity_compressor.cpp | 10 +- src/muz/rel/dl_mk_simple_joins.cpp | 8 +- src/muz/rel/dl_product_relation.cpp | 28 +- src/muz/rel/dl_product_relation.h | 4 +- src/muz/rel/dl_relation_manager.cpp | 18 +- src/muz/rel/dl_relation_manager.h | 36 +-- src/muz/rel/dl_sieve_relation.cpp | 18 +- src/muz/rel/dl_sieve_relation.h | 4 +- src/muz/rel/dl_sparse_table.cpp | 28 +- src/muz/rel/dl_sparse_table.h | 4 +- src/muz/rel/dl_table.cpp | 4 +- src/muz/rel/doc.cpp | 2 +- src/muz/rel/karr_relation.cpp | 10 +- src/muz/rel/rel_context.cpp | 2 +- src/muz/rel/tbv.cpp | 2 +- src/muz/rel/udoc_relation.cpp | 16 +- src/muz/spacer/spacer_antiunify.cpp | 2 +- src/muz/spacer/spacer_context.cpp | 40 +-- src/muz/spacer/spacer_context.h | 2 +- src/muz/spacer/spacer_farkas_learner.cpp | 2 +- src/muz/spacer/spacer_iuc_solver.cpp | 2 +- src/muz/spacer/spacer_iuc_solver.h | 2 +- src/muz/spacer/spacer_legacy_mev.cpp | 8 +- src/muz/spacer/spacer_manager.h | 2 +- src/muz/spacer/spacer_mev_array.cpp | 4 +- src/muz/spacer/spacer_pdr.cpp | 2 +- src/muz/spacer/spacer_proof_utils.cpp | 16 +- src/muz/spacer/spacer_prop_solver.cpp | 8 +- src/muz/spacer/spacer_qe_project.cpp | 32 +- src/muz/spacer/spacer_quant_generalizer.cpp | 6 +- src/muz/spacer/spacer_sat_answer.cpp | 4 +- src/muz/spacer/spacer_util.cpp | 4 +- src/muz/tab/tab_context.cpp | 46 +-- src/muz/transforms/dl_mk_array_blast.cpp | 10 +- src/muz/transforms/dl_mk_array_eq_rewrite.cpp | 4 +- .../transforms/dl_mk_array_instantiation.cpp | 12 +- src/muz/transforms/dl_mk_backwards.cpp | 2 +- src/muz/transforms/dl_mk_bit_blast.cpp | 4 +- src/muz/transforms/dl_mk_coalesce.cpp | 10 +- src/muz/transforms/dl_mk_coi_filter.cpp | 4 +- src/muz/transforms/dl_mk_elim_term_ite.cpp | 4 +- src/muz/transforms/dl_mk_filter_rules.cpp | 8 +- .../dl_mk_interp_tail_simplifier.cpp | 12 +- src/muz/transforms/dl_mk_karr_invariants.cpp | 8 +- src/muz/transforms/dl_mk_loop_counter.cpp | 12 +- src/muz/transforms/dl_mk_magic_sets.cpp | 14 +- src/muz/transforms/dl_mk_magic_sets.h | 2 +- src/muz/transforms/dl_mk_magic_symbolic.cpp | 4 +- .../dl_mk_quantifier_abstraction.cpp | 22 +- .../dl_mk_quantifier_instantiation.cpp | 8 +- src/muz/transforms/dl_mk_rule_inliner.cpp | 2 +- src/muz/transforms/dl_mk_scale.cpp | 10 +- .../dl_mk_separate_negated_tails.cpp | 6 +- src/muz/transforms/dl_mk_slice.cpp | 16 +- .../transforms/dl_mk_subsumption_checker.cpp | 4 +- src/muz/transforms/dl_mk_synchronize.cpp | 10 +- .../transforms/dl_mk_unbound_compressor.cpp | 8 +- src/nlsat/nlsat_clause.h | 2 +- src/nlsat/nlsat_explain.cpp | 24 +- src/nlsat/nlsat_interval_set.cpp | 6 +- src/nlsat/nlsat_scoped_literal_vector.h | 4 +- src/nlsat/nlsat_solver.cpp | 82 +++--- src/nlsat/tactic/goal2nlsat.cpp | 4 +- src/opt/maxres.cpp | 28 +- src/opt/maxsmt.cpp | 8 +- src/opt/opt_context.cpp | 24 +- src/opt/opt_lns.cpp | 2 +- src/opt/opt_parse.cpp | 10 +- src/opt/opt_solver.cpp | 2 +- src/opt/optsmt.cpp | 2 +- src/opt/pb_sls.cpp | 2 +- src/opt/sortmax.cpp | 2 +- src/parsers/smt2/smt2parser.cpp | 74 ++--- src/parsers/util/scanner.cpp | 4 +- src/parsers/util/simple_parser.cpp | 2 +- src/qe/mbp/mbp_arith.cpp | 2 +- src/qe/mbp/mbp_arrays.cpp | 26 +- src/qe/mbp/mbp_datatypes.cpp | 2 +- src/qe/mbp/mbp_term_graph.cpp | 12 +- src/qe/nlarith_util.cpp | 32 +- src/qe/nlqsat.cpp | 20 +- src/qe/qe.cpp | 48 +-- src/qe/qe_arith_plugin.cpp | 54 ++-- src/qe/qe_array_plugin.cpp | 10 +- src/qe/qe_datatype_plugin.cpp | 8 +- src/qe/qe_lite.cpp | 60 ++-- src/qe/qe_mbi.cpp | 2 +- src/qe/qsat.cpp | 8 +- src/sat/dimacs.cpp | 8 +- src/sat/sat_aig_cuts.cpp | 4 +- src/sat/sat_anf_simplifier.cpp | 2 +- src/sat/sat_big.cpp | 6 +- src/sat/sat_cut_simplifier.cpp | 12 +- src/sat/sat_ddfw.cpp | 4 +- src/sat/sat_ddfw.h | 4 +- src/sat/sat_drat.cpp | 8 +- src/sat/sat_elim_vars.cpp | 4 +- src/sat/sat_local_search.cpp | 4 +- src/sat/sat_model_converter.cpp | 2 +- src/sat/sat_mus.cpp | 6 +- src/sat/sat_parallel.cpp | 4 +- src/sat/sat_parallel.h | 2 +- src/sat/sat_prob.cpp | 2 +- src/sat/sat_prob.h | 4 +- src/sat/sat_simplifier.cpp | 4 +- src/sat/sat_solver.cpp | 24 +- src/sat/sat_solver.h | 4 +- src/sat/sat_solver/inc_sat_solver.cpp | 16 +- src/sat/sat_types.h | 2 +- src/sat/smt/arith_internalize.cpp | 6 +- src/sat/smt/arith_solver.cpp | 6 +- src/sat/smt/array_axioms.cpp | 10 +- src/sat/smt/array_diagnostics.cpp | 4 +- src/sat/smt/array_model.cpp | 2 +- src/sat/smt/bv_internalize.cpp | 20 +- src/sat/smt/bv_solver.cpp | 2 +- src/sat/smt/euf_internalize.cpp | 10 +- src/sat/smt/euf_model.cpp | 6 +- src/sat/smt/euf_solver.h | 2 +- src/sat/smt/pb_internalize.cpp | 4 +- src/sat/smt/pb_solver.cpp | 42 +-- src/sat/smt/q_eval.cpp | 2 +- src/sat/smt/q_mam.cpp | 8 +- src/sat/smt/q_model_fixer.cpp | 2 +- src/sat/smt/q_queue.cpp | 4 +- src/sat/smt/sat_dual_solver.cpp | 6 +- src/sat/smt/sat_th.cpp | 12 +- src/sat/smt/sat_th.h | 2 +- src/sat/tactic/goal2sat.cpp | 8 +- src/sat/tactic/sat_tactic.cpp | 2 +- src/shell/dimacs_frontend.cpp | 4 +- src/shell/drat_frontend.cpp | 12 +- src/smt/arith_eq_adapter.cpp | 8 +- src/smt/arith_eq_solver.cpp | 2 +- src/smt/diff_logic.h | 2 +- src/smt/dyn_ack.cpp | 6 +- src/smt/expr_context_simplifier.cpp | 4 +- src/smt/fingerprints.cpp | 2 +- src/smt/mam.cpp | 12 +- src/smt/proto_model/proto_model.cpp | 4 +- src/smt/qi_queue.cpp | 8 +- src/smt/seq_eq_solver.cpp | 32 +- src/smt/seq_ne_solver.cpp | 2 +- src/smt/smt_checker.cpp | 2 +- src/smt/smt_clause.cpp | 2 +- src/smt/smt_clause_proof.cpp | 2 +- src/smt/smt_conflict_resolution.cpp | 10 +- src/smt/smt_conflict_resolution.h | 4 +- src/smt/smt_consequences.cpp | 6 +- src/smt/smt_context.cpp | 22 +- src/smt/smt_context.h | 16 +- src/smt/smt_context_pp.cpp | 12 +- src/smt/smt_farkas_util.cpp | 2 +- src/smt/smt_implied_equalities.cpp | 2 +- src/smt/smt_induction.cpp | 6 +- src/smt/smt_internalizer.cpp | 16 +- src/smt/smt_justification.cpp | 22 +- src/smt/smt_kernel.h | 4 +- src/smt/smt_model_checker.cpp | 14 +- src/smt/smt_model_finder.cpp | 4 +- src/smt/smt_model_generator.cpp | 4 +- src/smt/smt_parallel.cpp | 4 +- src/smt/smt_quick_checker.cpp | 12 +- src/smt/smt_setup.cpp | 6 +- src/smt/smt_solver.cpp | 6 +- src/smt/tactic/ctx_solver_simplify_tactic.cpp | 6 +- src/smt/tactic/smt_tactic_core.cpp | 6 +- src/smt/theory_arith.h | 4 +- src/smt/theory_arith_aux.h | 6 +- src/smt/theory_arith_core.h | 24 +- src/smt/theory_arith_eq.h | 4 +- src/smt/theory_arith_int.h | 18 +- src/smt/theory_arith_nl.h | 16 +- src/smt/theory_arith_pp.h | 2 +- src/smt/theory_array.cpp | 6 +- src/smt/theory_array_bapa.cpp | 4 +- src/smt/theory_array_base.cpp | 28 +- src/smt/theory_array_base.h | 2 +- src/smt/theory_array_full.cpp | 20 +- src/smt/theory_bv.cpp | 32 +- src/smt/theory_char.cpp | 14 +- src/smt/theory_datatype.cpp | 18 +- src/smt/theory_dense_diff_logic_def.h | 14 +- src/smt/theory_diff_logic_def.h | 22 +- src/smt/theory_lra.cpp | 50 ++-- src/smt/theory_pb.cpp | 46 +-- src/smt/theory_seq.cpp | 32 +- src/smt/theory_seq.h | 6 +- src/smt/theory_special_relations.cpp | 4 +- src/smt/theory_str.cpp | 28 +- src/smt/theory_str_mc.cpp | 4 +- src/smt/theory_str_regex.cpp | 2 +- src/smt/theory_utvpi_def.h | 4 +- src/smt/theory_wmaxsat.cpp | 8 +- src/smt/user_propagator.cpp | 4 +- src/solver/assertions/asserted_formulas.cpp | 6 +- src/solver/check_sat_result.cpp | 2 +- src/solver/mus.cpp | 6 +- src/solver/parallel_tactic.cpp | 2 +- src/solver/solver.h | 6 +- src/solver/solver2tactic.cpp | 4 +- src/solver/solver_na2as.cpp | 8 +- src/solver/solver_pool.cpp | 2 +- src/solver/tactic2solver.cpp | 2 +- src/tactic/aig/aig.cpp | 14 +- src/tactic/arith/bv2int_rewriter.h | 2 +- src/tactic/arith/bv2real_rewriter.h | 2 +- src/tactic/arith/factor_tactic.cpp | 12 +- src/tactic/arith/fm_tactic.cpp | 28 +- src/tactic/arith/lia2card_tactic.cpp | 8 +- src/tactic/arith/lia2pb_tactic.cpp | 2 +- src/tactic/arith/linear_equation.cpp | 4 +- src/tactic/arith/pb2bv_tactic.cpp | 12 +- src/tactic/arith/propagate_ineqs_tactic.cpp | 6 +- src/tactic/arith/purify_arith_tactic.cpp | 2 +- src/tactic/arith/recover_01_tactic.cpp | 2 +- src/tactic/bv/bit_blaster_model_converter.cpp | 4 +- src/tactic/bv/bv1_blaster_tactic.cpp | 18 +- src/tactic/bv/bvarray2uf_rewriter.cpp | 2 +- src/tactic/bv/elim_small_bv_tactic.cpp | 8 +- src/tactic/converter.h | 2 +- src/tactic/core/blast_term_ite_tactic.cpp | 4 +- src/tactic/core/cofactor_elim_term_ite.cpp | 2 +- src/tactic/core/ctx_simplify_tactic.cpp | 6 +- src/tactic/core/distribute_forall_tactic.cpp | 4 +- src/tactic/core/dom_simplify_tactic.cpp | 2 +- src/tactic/core/elim_uncnstr_tactic.cpp | 12 +- src/tactic/core/occf_tactic.cpp | 2 +- src/tactic/core/pb_preprocess_tactic.cpp | 8 +- src/tactic/core/reduce_args_tactic.cpp | 8 +- src/tactic/core/reduce_invertible_tactic.cpp | 2 +- src/tactic/core/solve_eqs_tactic.cpp | 6 +- src/tactic/core/split_clause_tactic.cpp | 6 +- src/tactic/core/symmetry_reduce_tactic.cpp | 4 +- src/tactic/core/tseitin_cnf_tactic.cpp | 22 +- src/tactic/dependency_converter.cpp | 2 +- src/tactic/fd_solver/smtfd_solver.cpp | 22 +- src/tactic/fpa/fpa2bv_model_converter.cpp | 2 +- src/tactic/generic_model_converter.cpp | 4 +- src/tactic/goal.cpp | 2 +- src/tactic/horn_subsume_model_converter.cpp | 6 +- src/tactic/model_converter.cpp | 2 +- src/tactic/proof_converter.cpp | 4 +- src/tactic/sls/sls_evaluator.h | 2 +- src/tactic/tactical.cpp | 10 +- src/tactic/ufbv/ufbv_rewriter.cpp | 4 +- src/tactic/ufbv/ufbv_rewriter_tactic.cpp | 2 +- src/test/bits.cpp | 16 +- src/test/cnf_backbones.cpp | 8 +- src/test/dl_query.cpp | 8 +- src/test/doc.cpp | 12 +- src/test/fuzzing/expr_delta.cpp | 4 +- src/test/fuzzing/expr_rand.cpp | 2 +- src/test/hilbert_basis.cpp | 14 +- src/test/horn_subsume_model_converter.cpp | 6 +- src/test/karr.cpp | 2 +- src/test/model2expr.cpp | 12 +- src/test/nlsat.cpp | 36 +-- src/test/pb2bv.cpp | 26 +- src/test/pdd_solver.cpp | 6 +- src/test/polynomial.cpp | 14 +- src/test/qe_arith.cpp | 20 +- src/test/quant_solve.cpp | 4 +- src/test/rcf.cpp | 4 +- src/test/sat_local_search.cpp | 2 +- src/test/sat_user_scope.cpp | 4 +- src/test/simplex.cpp | 2 +- src/test/smt_context.cpp | 2 +- src/test/sorting_network.cpp | 16 +- src/test/substitution.cpp | 2 +- src/test/theory_pb.cpp | 6 +- src/test/udoc_relation.cpp | 26 +- src/test/upolynomial.cpp | 122 ++++---- src/test/var_subst.cpp | 6 +- src/util/array.h | 6 +- src/util/buffer.h | 6 +- src/util/container_util.h | 2 +- src/util/hash.h | 32 +- src/util/mpff.cpp | 68 ++--- src/util/mpff.h | 2 +- src/util/mpfx.cpp | 18 +- src/util/mpfx.h | 2 +- src/util/mpn.cpp | 22 +- src/util/numeral_buffer.h | 4 +- src/util/params.cpp | 2 +- src/util/ref_buffer.h | 12 +- src/util/ref_pair_vector.h | 4 +- src/util/ref_vector.h | 6 +- src/util/sexpr.cpp | 2 +- src/util/sorting_network.h | 52 ++-- src/util/statistics.cpp | 2 +- src/util/vector.h | 8 +- src/util/warning.cpp | 4 +- 456 files changed, 2802 insertions(+), 2802 deletions(-) diff --git a/examples/tptp/tptp5.h b/examples/tptp/tptp5.h index 948664243..90fbc5142 100644 --- a/examples/tptp/tptp5.h +++ b/examples/tptp/tptp5.h @@ -27,7 +27,7 @@ public: m_names.push_back(symbol(name)); } unsigned size() const { return m_fmls.size(); } - expr*const* c_ptr() const { return m_fmls.c_ptr(); } + expr*const* data() const { return m_fmls.data(); } expr* operator[](unsigned i) { return m_fmls[i].get(); } symbol const& name(unsigned i) { return m_names[i]; } void set_has_conjecture() { diff --git a/src/ackermannization/ackr_model_converter.cpp b/src/ackermannization/ackr_model_converter.cpp index ba3086395..cd877986d 100644 --- a/src/ackermannization/ackr_model_converter.cpp +++ b/src/ackermannization/ackr_model_converter.cpp @@ -150,7 +150,7 @@ void ackr_model_converter::add_entry(model_evaluator & evaluator, args.push_back(evaluator(info->abstract(arg))); } args.push_back(value); - e = autil.mk_store(args.size(), args.c_ptr()); + e = autil.mk_store(args.size(), args.data()); } array_interpretations.insert(A, e); } @@ -175,14 +175,14 @@ void ackr_model_converter::add_entry(model_evaluator & evaluator, for (expr* arg : *term) { args.push_back(evaluator(info->abstract(arg))); } - if (fi->get_entry(args.c_ptr()) == nullptr) { + if (fi->get_entry(args.data()) == nullptr) { TRACE("ackermannize", tout << mk_ismt2_pp(declaration, m) << " args: " << std::endl; for (expr* arg : args) { tout << mk_ismt2_pp(arg, m) << std::endl; } tout << " -> " << mk_ismt2_pp(value, m) << "\n"; ); - fi->insert_new_entry(args.c_ptr(), value); + fi->insert_new_entry(args.data(), value); } else { TRACE("ackermannize", tout << "entry already present\n";); diff --git a/src/ackermannization/lackr_model_constructor.cpp b/src/ackermannization/lackr_model_constructor.cpp index 73caa579a..f9450771d 100644 --- a/src/ackermannization/lackr_model_constructor.cpp +++ b/src/ackermannization/lackr_model_constructor.cpp @@ -62,7 +62,7 @@ public: for (unsigned i = 0; i < m_abstr_model->get_num_uninterpreted_sorts(); i++) { sort * const s = m_abstr_model->get_uninterpreted_sort(i); ptr_vector u = m_abstr_model->get_universe(s); - destination->register_usort(s, u.size(), u.c_ptr()); + destination->register_usort(s, u.size(), u.data()); } for (unsigned i = 0; i < m_abstr_model->get_num_functions(); i++) { @@ -213,7 +213,7 @@ private: } // handle functions if (m_ackr_helper.is_uninterp_fn(a)) { // handle uninterpreted - app_ref key(m.mk_app(a->get_decl(), values.c_ptr()), m); + app_ref key(m.mk_app(a->get_decl(), values.data()), m); if (!make_value_uninterpreted_function(a, key.get(), result)) { return false; } @@ -314,7 +314,7 @@ private: func_decl * const fd = a->get_decl(); const family_id fid = fd->get_family_id(); expr_ref term(m); - term = m.mk_app(a->get_decl(), num, values.c_ptr()); + term = m.mk_app(a->get_decl(), num, values.data()); m_evaluator->operator() (term, result); TRACE("model_constructor", tout << "eval(\n" << mk_ismt2_pp(term.get(), m, 2) << "\n->" @@ -329,11 +329,11 @@ private: if (s_fid == m_bv_rw.get_fid()) m_bv_rw.mk_eq_core(values.get(0), values.get(1), result); } else { - m_b_rw.mk_app_core(fd, num, values.c_ptr(), result); + m_b_rw.mk_app_core(fd, num, values.data(), result); } } else { if (fid == m_bv_rw.get_fid()) { - m_bv_rw.mk_app_core(fd, num, values.c_ptr(), result); + m_bv_rw.mk_app_core(fd, num, values.data(), result); } else { UNREACHABLE(); diff --git a/src/api/api_array.cpp b/src/api/api_array.cpp index 016fcd336..c1ea4729e 100644 --- a/src/api/api_array.cpp +++ b/src/api/api_array.cpp @@ -41,7 +41,7 @@ extern "C" { vector params; for (unsigned i = 0; i < n; ++i) params.push_back(parameter(to_sort(domain[i]))); params.push_back(parameter(to_sort(range))); - sort * ty = mk_c(c)->m().mk_sort(mk_c(c)->get_array_fid(), ARRAY_SORT, params.size(), params.c_ptr()); + sort * ty = mk_c(c)->m().mk_sort(mk_c(c)->get_array_fid(), ARRAY_SORT, params.size(), params.data()); mk_c(c)->save_ast_trail(ty); RETURN_Z3(of_sort(ty)); Z3_CATCH_RETURN(nullptr); @@ -94,8 +94,8 @@ extern "C" { args.push_back(to_expr(idxs[i])); domain.push_back(to_expr(idxs[i])->get_sort()); } - func_decl * d = m.mk_func_decl(mk_c(c)->get_array_fid(), OP_SELECT, 2, a_ty->get_parameters(), domain.size(), domain.c_ptr()); - app * r = m.mk_app(d, args.size(), args.c_ptr()); + func_decl * d = m.mk_func_decl(mk_c(c)->get_array_fid(), OP_SELECT, 2, a_ty->get_parameters(), domain.size(), domain.data()); + app * r = m.mk_app(d, args.size(), args.data()); mk_c(c)->save_ast_trail(r); check_sorts(c, r); RETURN_Z3(of_ast(r)); @@ -154,8 +154,8 @@ extern "C" { } args.push_back(_v); domain.push_back(v_ty); - func_decl * d = m.mk_func_decl(mk_c(c)->get_array_fid(), OP_STORE, 2, a_ty->get_parameters(), domain.size(), domain.c_ptr()); - app * r = m.mk_app(d, args.size(), args.c_ptr()); + func_decl * d = m.mk_func_decl(mk_c(c)->get_array_fid(), OP_STORE, 2, a_ty->get_parameters(), domain.size(), domain.data()); + app * r = m.mk_app(d, args.size(), args.data()); mk_c(c)->save_ast_trail(r); check_sorts(c, r); RETURN_Z3(of_ast(r)); @@ -180,7 +180,7 @@ extern "C" { domain.push_back(_args[i]->get_sort()); } parameter param(_f); - func_decl * d = m.mk_func_decl(mk_c(c)->get_array_fid(), OP_ARRAY_MAP, 1, ¶m, n, domain.c_ptr()); + func_decl * d = m.mk_func_decl(mk_c(c)->get_array_fid(), OP_ARRAY_MAP, 1, ¶m, n, domain.data()); app* r = m.mk_app(d, n, _args); mk_c(c)->save_ast_trail(r); check_sorts(c, r); diff --git a/src/api/api_ast.cpp b/src/api/api_ast.cpp index 15bf13911..ef9d26889 100644 --- a/src/api/api_ast.cpp +++ b/src/api/api_ast.cpp @@ -148,7 +148,7 @@ extern "C" { return; } } - expr_abstract(m, 0, n, _args.c_ptr(), to_expr(body), abs_body); + expr_abstract(m, 0, n, _args.data(), to_expr(body), abs_body); recfun::promise_def pd = p.get_promise_def(d); if (!pd.get_def()) { SET_ERROR_CODE(Z3_INVALID_ARG, nullptr); @@ -159,7 +159,7 @@ extern "C" { return; } recfun_replace replace(m); - p.set_definition(replace, pd, n, _vars.c_ptr(), abs_body); + p.set_definition(replace, pd, n, _vars.data(), abs_body); Z3_CATCH; } @@ -172,7 +172,7 @@ extern "C" { arg_list.push_back(to_expr(args[i])); } func_decl* _d = reinterpret_cast(d); - app* a = mk_c(c)->m().mk_app(_d, num_args, arg_list.c_ptr()); + app* a = mk_c(c)->m().mk_app(_d, num_args, arg_list.data()); mk_c(c)->save_ast_trail(a); check_sorts(c, a); RETURN_Z3(of_ast(a)); diff --git a/src/api/api_datalog.cpp b/src/api/api_datalog.cpp index 224e86b89..3a6e8e56f 100644 --- a/src/api/api_datalog.cpp +++ b/src/api/api_datalog.cpp @@ -449,7 +449,7 @@ extern "C" { for (unsigned i = 0; i < num_relations; ++i) { kinds.push_back(to_symbol(relation_kinds[i])); } - to_fixedpoint_ref(d)->ctx().set_predicate_representation(to_func_decl(f), num_relations, kinds.c_ptr()); + to_fixedpoint_ref(d)->ctx().set_predicate_representation(to_func_decl(f), num_relations, kinds.data()); Z3_CATCH; } diff --git a/src/api/api_datatype.cpp b/src/api/api_datatype.cpp index c84c2b38f..673ceb3c1 100644 --- a/src/api/api_datatype.cpp +++ b/src/api/api_datatype.cpp @@ -48,7 +48,7 @@ extern "C" { acc.push_back(mk_accessor_decl(m, to_symbol(field_names[i]), type_ref(to_sort(field_sorts[i])))); } - constructor_decl* constrs[1] = { mk_constructor_decl(to_symbol(name), recognizer, acc.size(), acc.c_ptr()) }; + constructor_decl* constrs[1] = { mk_constructor_decl(to_symbol(name), recognizer, acc.size(), acc.data()) }; { datatype_decl * dt = mk_datatype_decl(dt_util, to_symbol(name), 0, nullptr, 1, constrs); @@ -113,7 +113,7 @@ extern "C" { { - datatype_decl * dt = mk_datatype_decl(dt_util, to_symbol(name), 0, nullptr, n, constrs.c_ptr()); + datatype_decl * dt = mk_datatype_decl(dt_util, to_symbol(name), 0, nullptr, n, constrs.data()); bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &dt, 0, nullptr, sorts); del_datatype_decl(dt); @@ -302,9 +302,9 @@ extern "C" { acc.push_back(mk_accessor_decl(m, cn->m_field_names[j], type_ref(cn->m_sort_refs[j]))); } } - constrs.push_back(mk_constructor_decl(cn->m_name, cn->m_tester, acc.size(), acc.c_ptr())); + constrs.push_back(mk_constructor_decl(cn->m_name, cn->m_tester, acc.size(), acc.data())); } - return mk_datatype_decl(dt_util, to_symbol(name), 0, nullptr, num_constructors, constrs.c_ptr()); + return mk_datatype_decl(dt_util, to_symbol(name), 0, nullptr, num_constructors, constrs.data()); } Z3_sort Z3_API Z3_mk_datatype(Z3_context c, @@ -380,11 +380,11 @@ extern "C" { ptr_vector datas; for (unsigned i = 0; i < num_sorts; ++i) { constructor_list* cl = reinterpret_cast(constructor_lists[i]); - datas.push_back(mk_datatype_decl(c, sort_names[i], cl->size(), reinterpret_cast(cl->c_ptr()))); + datas.push_back(mk_datatype_decl(c, sort_names[i], cl->size(), reinterpret_cast(cl->data()))); } sort_ref_vector _sorts(m); - bool ok = mk_c(c)->get_dt_plugin()->mk_datatypes(datas.size(), datas.c_ptr(), 0, nullptr, _sorts); - del_datatype_decls(datas.size(), datas.c_ptr()); + bool ok = mk_c(c)->get_dt_plugin()->mk_datatypes(datas.size(), datas.data(), 0, nullptr, _sorts); + del_datatype_decls(datas.size(), datas.data()); if (!ok) { SET_ERROR_CODE(Z3_INVALID_ARG, nullptr); diff --git a/src/api/api_model.cpp b/src/api/api_model.cpp index 61d0931a2..f22873f7b 100644 --- a/src/api/api_model.cpp +++ b/src/api/api_model.cpp @@ -367,7 +367,7 @@ extern "C" { return; } // check sorts of value - expr* const* _args = (expr* const*) to_ast_vector_ref(args).c_ptr(); + expr* const* _args = (expr* const*) to_ast_vector_ref(args).data(); _fi->insert_entry(_args, _value); Z3_CATCH; } diff --git a/src/api/api_opt.cpp b/src/api/api_opt.cpp index 7b5ba7467..c0314ae79 100644 --- a/src/api/api_opt.cpp +++ b/src/api/api_opt.cpp @@ -280,7 +280,7 @@ extern "C" { to_optimize_ptr(o)->get_lower(idx, es); Z3_ast_vector_ref * v = alloc(Z3_ast_vector_ref, *mk_c(c), mk_c(c)->m()); mk_c(c)->save_object(v); - v->m_ast_vector.append(es.size(), (ast*const*)es.c_ptr()); + v->m_ast_vector.append(es.size(), (ast*const*)es.data()); RETURN_Z3(of_ast_vector(v)); Z3_CATCH_RETURN(nullptr); } @@ -294,7 +294,7 @@ extern "C" { to_optimize_ptr(o)->get_upper(idx, es); Z3_ast_vector_ref * v = alloc(Z3_ast_vector_ref, *mk_c(c), mk_c(c)->m()); mk_c(c)->save_object(v); - v->m_ast_vector.append(es.size(), (ast*const*)es.c_ptr()); + v->m_ast_vector.append(es.size(), (ast*const*)es.data()); RETURN_Z3(of_ast_vector(v)); Z3_CATCH_RETURN(nullptr); } diff --git a/src/api/api_pb.cpp b/src/api/api_pb.cpp index bc0fc1948..a51a7c069 100644 --- a/src/api/api_pb.cpp +++ b/src/api/api_pb.cpp @@ -62,7 +62,7 @@ extern "C" { for (unsigned i = 0; i < num_args; ++i) { coeffs.push_back(rational(_coeffs[i])); } - ast* a = util.mk_le(num_args, coeffs.c_ptr(), to_exprs(num_args, args), rational(k)); + ast* a = util.mk_le(num_args, coeffs.data(), to_exprs(num_args, args), rational(k)); mk_c(c)->save_ast_trail(a); check_sorts(c, a); RETURN_Z3(of_ast(a)); @@ -80,7 +80,7 @@ extern "C" { for (unsigned i = 0; i < num_args; ++i) { coeffs.push_back(rational(_coeffs[i])); } - ast* a = util.mk_ge(num_args, coeffs.c_ptr(), to_exprs(num_args, args), rational(k)); + ast* a = util.mk_ge(num_args, coeffs.data(), to_exprs(num_args, args), rational(k)); mk_c(c)->save_ast_trail(a); check_sorts(c, a); RETURN_Z3(of_ast(a)); @@ -98,7 +98,7 @@ extern "C" { for (unsigned i = 0; i < num_args; ++i) { coeffs.push_back(rational(_coeffs[i])); } - ast* a = util.mk_eq(num_args, coeffs.c_ptr(), to_exprs(num_args, args), rational(k)); + ast* a = util.mk_eq(num_args, coeffs.data(), to_exprs(num_args, args), rational(k)); mk_c(c)->save_ast_trail(a); check_sorts(c, a); RETURN_Z3(of_ast(a)); diff --git a/src/api/api_quant.cpp b/src/api/api_quant.cpp index 77fd5db6c..ce58f0181 100644 --- a/src/api/api_quant.cpp +++ b/src/api/api_quant.cpp @@ -88,7 +88,7 @@ extern "C" { if (num_decls > 0) { result = mk_c(c)->m().mk_quantifier( is_forall ? forall_k : exists_k, - names.size(), ts, names.c_ptr(), to_expr(body), + names.size(), ts, names.data(), to_expr(body), weight, qid, to_symbol(skolem_id), @@ -160,7 +160,7 @@ extern "C" { for (unsigned i = 0; i < num_decls; ++i) { names.push_back(to_symbol(decl_names[i])); } - result = mk_c(c)->m().mk_lambda(names.size(), ts, names.c_ptr(), to_expr(body)); + result = mk_c(c)->m().mk_lambda(names.size(), ts, names.data(), to_expr(body)); mk_c(c)->save_ast_trail(result.get()); return of_ast(result.get()); Z3_CATCH_RETURN(nullptr); @@ -188,9 +188,9 @@ extern "C" { _vars.push_back(a->get_sort()); } expr_ref result(mk_c(c)->m()); - expr_abstract(mk_c(c)->m(), 0, num_decls, _args.c_ptr(), to_expr(body), result); + expr_abstract(mk_c(c)->m(), 0, num_decls, _args.data(), to_expr(body), result); - result = mk_c(c)->m().mk_lambda(_vars.size(), _vars.c_ptr(), _names.c_ptr(), result); + result = mk_c(c)->m().mk_lambda(_vars.size(), _vars.data(), _names.data(), result); mk_c(c)->save_ast_trail(result.get()); return of_ast(result.get()); Z3_CATCH_RETURN(nullptr); @@ -246,7 +246,7 @@ extern "C" { expr_ref result(mk_c(c)->m()); app* pat = to_pattern(patterns[i]); SASSERT(mk_c(c)->m().is_pattern(pat)); - expr_abstract(mk_c(c)->m(), 0, num_bound, bound_asts.c_ptr(), pat, result); + expr_abstract(mk_c(c)->m(), 0, num_bound, bound_asts.data(), pat, result); SASSERT(result.get()->get_kind() == AST_APP); pinned.push_back(result.get()); SASSERT(mk_c(c)->m().is_pattern(result.get())); @@ -260,20 +260,20 @@ extern "C" { RETURN_Z3(nullptr); } app* pat = to_app(to_expr(no_patterns[i])); - expr_abstract(mk_c(c)->m(), 0, num_bound, bound_asts.c_ptr(), pat, result); + expr_abstract(mk_c(c)->m(), 0, num_bound, bound_asts.data(), pat, result); SASSERT(result.get()->get_kind() == AST_APP); pinned.push_back(result.get()); _no_patterns.push_back(of_ast(result.get())); } expr_ref abs_body(mk_c(c)->m()); - expr_abstract(mk_c(c)->m(), 0, num_bound, bound_asts.c_ptr(), to_expr(body), abs_body); + expr_abstract(mk_c(c)->m(), 0, num_bound, bound_asts.data(), to_expr(body), abs_body); Z3_ast result = mk_quantifier_ex_core(c, is_forall, weight, quantifier_id, skolem_id, - num_patterns, _patterns.c_ptr(), - num_no_patterns, _no_patterns.c_ptr(), - names.size(), types.c_ptr(), names.c_ptr(), + num_patterns, _patterns.data(), + num_no_patterns, _no_patterns.data(), + names.size(), types.data(), names.data(), of_ast(abs_body.get())); RETURN_Z3(result); Z3_CATCH_RETURN(nullptr); diff --git a/src/api/api_rcf.cpp b/src/api/api_rcf.cpp index 840f6d3a8..7c168dc62 100644 --- a/src/api/api_rcf.cpp +++ b/src/api/api_rcf.cpp @@ -34,7 +34,7 @@ static void reset_rcf_cancel(Z3_context c) { } static Z3_rcf_num from_rcnumeral(rcnumeral a) { - return reinterpret_cast(a.c_ptr()); + return reinterpret_cast(a.data()); } static rcnumeral to_rcnumeral(Z3_rcf_num a) { @@ -128,7 +128,7 @@ extern "C" { } av.shrink(rz); rcnumeral_vector rs; - rcfm(c).isolate_roots(av.size(), av.c_ptr(), rs); + rcfm(c).isolate_roots(av.size(), av.data(), rs); unsigned num_roots = rs.size(); for (unsigned i = 0; i < num_roots; i++) { roots[i] = from_rcnumeral(rs[i]); diff --git a/src/api/api_seq.cpp b/src/api/api_seq.cpp index 462c2da2e..39e5b80cc 100644 --- a/src/api/api_seq.cpp +++ b/src/api/api_seq.cpp @@ -62,7 +62,7 @@ extern "C" { RESET_ERROR_CODE(); unsigned_vector chs; for (unsigned i = 0; i < sz; ++i) chs.push_back((unsigned char)str[i]); - zstring s(sz, chs.c_ptr()); + zstring s(sz, chs.data()); app* a = mk_c(c)->sutil().str.mk_string(s); mk_c(c)->save_ast_trail(a); RETURN_Z3(of_ast(a)); @@ -188,7 +188,7 @@ extern "C" { } } *length = buffer.size(); - return buffer.c_ptr(); + return buffer.data(); Z3_CATCH_RETURN(""); } diff --git a/src/api/api_tactic.cpp b/src/api/api_tactic.cpp index adaa1f8e1..45073cdb1 100644 --- a/src/api/api_tactic.cpp +++ b/src/api/api_tactic.cpp @@ -136,7 +136,7 @@ extern "C" { for (unsigned i = 0; i < num; i++) { _ts.push_back(to_tactic_ref(ts[i])); } - tactic * new_t = par(num, _ts.c_ptr()); + tactic * new_t = par(num, _ts.data()); RETURN_TACTIC(new_t); Z3_CATCH_RETURN(nullptr); } diff --git a/src/api/z3_replayer.cpp b/src/api/z3_replayer.cpp index 3f7e17cc0..398290b9e 100644 --- a/src/api/z3_replayer.cpp +++ b/src/api/z3_replayer.cpp @@ -628,25 +628,25 @@ struct z3_replayer::imp { unsigned * get_uint_array(unsigned pos) const { check_arg(pos, UINT_ARRAY); unsigned idx = static_cast(m_args[pos].m_uint); - return m_unsigned_arrays[idx].c_ptr(); + return m_unsigned_arrays[idx].data(); } int * get_int_array(unsigned pos) const { check_arg(pos, INT_ARRAY); unsigned idx = static_cast(m_args[pos].m_uint); - return m_int_arrays[idx].c_ptr(); + return m_int_arrays[idx].data(); } bool * get_bool_array(unsigned pos) const { check_arg(pos, UINT_ARRAY); unsigned idx = static_cast(m_args[pos].m_uint); - return reinterpret_cast(m_unsigned_arrays[idx].c_ptr()); + return reinterpret_cast(m_unsigned_arrays[idx].data()); } Z3_symbol * get_symbol_array(unsigned pos) const { check_arg(pos, SYMBOL_ARRAY); unsigned idx = static_cast(m_args[pos].m_uint); - return m_sym_arrays[idx].c_ptr(); + return m_sym_arrays[idx].data(); } void ** get_obj_array(unsigned pos) const { @@ -655,7 +655,7 @@ struct z3_replayer::imp { ptr_vector const & v = m_obj_arrays[idx]; 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.c_ptr(); + return v.data(); } int * get_int_addr(unsigned pos) { diff --git a/src/ast/arith_decl_plugin.cpp b/src/ast/arith_decl_plugin.cpp index 393680897..68f37e3c5 100644 --- a/src/ast/arith_decl_plugin.cpp +++ b/src/ast/arith_decl_plugin.cpp @@ -336,8 +336,8 @@ void arith_decl_plugin::finalize() { DEC_REF(m_neg_root_decl); DEC_REF(m_u_asin_decl); DEC_REF(m_u_acos_decl); - m_manager->dec_array_ref(m_small_ints.size(), m_small_ints.c_ptr()); - m_manager->dec_array_ref(m_small_reals.size(), m_small_reals.c_ptr()); + m_manager->dec_array_ref(m_small_ints.size(), m_small_ints.data()); + m_manager->dec_array_ref(m_small_reals.size(), m_small_reals.data()); } sort * arith_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters) { @@ -762,7 +762,7 @@ algebraic_numbers::anum const & arith_util::to_irrational_algebraic_numeral(expr } expr_ref arith_util::mk_mul_simplify(expr_ref_vector const& args) { - return mk_mul_simplify(args.size(), args.c_ptr()); + return mk_mul_simplify(args.size(), args.data()); } expr_ref arith_util::mk_mul_simplify(unsigned sz, expr* const* args) { @@ -783,7 +783,7 @@ expr_ref arith_util::mk_mul_simplify(unsigned sz, expr* const* args) { } expr_ref arith_util::mk_add_simplify(expr_ref_vector const& args) { - return mk_add_simplify(args.size(), args.c_ptr()); + return mk_add_simplify(args.size(), args.data()); } expr_ref arith_util::mk_add_simplify(unsigned sz, expr* const* args) { diff --git a/src/ast/arith_decl_plugin.h b/src/ast/arith_decl_plugin.h index e61d4a716..a3f7e5a01 100644 --- a/src/ast/arith_decl_plugin.h +++ b/src/ast/arith_decl_plugin.h @@ -432,7 +432,7 @@ public: app * mk_add(unsigned num_args, expr * const * args) const { return num_args == 1 && is_app(args[0]) ? to_app(args[0]) : m_manager.mk_app(arith_family_id, OP_ADD, num_args, args); } app * mk_add(expr * arg1, expr * arg2) const { return m_manager.mk_app(arith_family_id, OP_ADD, arg1, arg2); } app * mk_add(expr * arg1, expr * arg2, expr* arg3) const { return m_manager.mk_app(arith_family_id, OP_ADD, arg1, arg2, arg3); } - app * mk_add(expr_ref_vector const& args) const { return mk_add(args.size(), args.c_ptr()); } + app * mk_add(expr_ref_vector const& args) const { return mk_add(args.size(), args.data()); } app * mk_sub(expr * arg1, expr * arg2) const { return m_manager.mk_app(arith_family_id, OP_SUB, arg1, arg2); } app * mk_sub(unsigned num_args, expr * const * args) const { return m_manager.mk_app(arith_family_id, OP_SUB, num_args, args); } diff --git a/src/ast/array_decl_plugin.cpp b/src/ast/array_decl_plugin.cpp index a2c2886e0..0757902f5 100644 --- a/src/ast/array_decl_plugin.cpp +++ b/src/ast/array_decl_plugin.cpp @@ -193,7 +193,7 @@ func_decl * array_decl_plugin::mk_map(func_decl* f, unsigned arity, sort* const* parameters.push_back(domain[0]->get_parameter(i)); } parameters.push_back(parameter(f->get_range())); - sort* range = mk_sort(ARRAY_SORT, parameters.size(), parameters.c_ptr()); + sort* range = mk_sort(ARRAY_SORT, parameters.size(), parameters.data()); parameter param(f); func_decl_info info(m_family_id, OP_ARRAY_MAP, 1, ¶m); // @@ -265,7 +265,7 @@ func_decl* array_decl_plugin::mk_select(unsigned arity, sort * const * domain) { new_domain.push_back(to_sort(parameters[i].get_ast())); } SASSERT(new_domain.size() == arity); - return m_manager->mk_func_decl(m_select_sym, arity, new_domain.c_ptr(), get_array_range(domain[0]), + return m_manager->mk_func_decl(m_select_sym, arity, new_domain.data(), get_array_range(domain[0]), func_decl_info(m_family_id, OP_SELECT)); } @@ -309,7 +309,7 @@ func_decl * array_decl_plugin::mk_store(unsigned arity, sort * const * domain) { new_domain.push_back(to_sort(parameters[i].get_ast())); } SASSERT(new_domain.size() == arity); - return m_manager->mk_func_decl(m_store_sym, arity, new_domain.c_ptr(), domain[0], + return m_manager->mk_func_decl(m_store_sym, arity, new_domain.data(), domain[0], func_decl_info(m_family_id, OP_STORE)); } @@ -481,7 +481,7 @@ func_decl * array_decl_plugin::mk_as_array(func_decl * f) { parameters.push_back(parameter(f->get_domain(i))); } parameters.push_back(parameter(f->get_range())); - sort * s = mk_sort(ARRAY_SORT, parameters.size(), parameters.c_ptr()); + sort * s = mk_sort(ARRAY_SORT, parameters.size(), parameters.data()); parameter param(f); func_decl_info info(m_family_id, OP_AS_ARRAY, 1, ¶m); return m_manager->mk_const_decl(m_as_array_sym, s, info); @@ -679,7 +679,7 @@ sort * array_util::mk_array_sort(unsigned arity, sort* const* domain, sort* rang params.push_back(parameter(domain[i])); } params.push_back(parameter(range)); - return m_manager.mk_sort(m_fid, ARRAY_SORT, params.size(), params.c_ptr()); + return m_manager.mk_sort(m_fid, ARRAY_SORT, params.size(), params.data()); } func_decl* array_util::mk_array_ext(sort *domain, unsigned i) { diff --git a/src/ast/array_decl_plugin.h b/src/ast/array_decl_plugin.h index 2f24bd507..f986eb46a 100644 --- a/src/ast/array_decl_plugin.h +++ b/src/ast/array_decl_plugin.h @@ -187,11 +187,11 @@ public: } app * mk_store(expr_ref_vector const& args) const { - return mk_store(args.size(), args.c_ptr()); + return mk_store(args.size(), args.data()); } app * mk_store(ptr_vector const& args) const { - return mk_store(args.size(), args.c_ptr()); + return mk_store(args.size(), args.data()); } app * mk_select(unsigned num_args, expr * const * args) const { @@ -199,15 +199,15 @@ public: } app * mk_select(ptr_vector const& args) const { - return mk_select(args.size(), args.c_ptr()); + return mk_select(args.size(), args.data()); } app * mk_select(ptr_buffer const& args) const { - return mk_select(args.size(), args.c_ptr()); + return mk_select(args.size(), args.data()); } app * mk_select(expr_ref_vector const& args) const { - return mk_select(args.size(), args.c_ptr()); + return mk_select(args.size(), args.data()); } app * mk_map(func_decl * f, unsigned num_args, expr * const * args) { diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp index fb370334d..96744bc9b 100644 --- a/src/ast/ast.cpp +++ b/src/ast/ast.cpp @@ -187,7 +187,7 @@ decl_info::decl_info(family_id family_id, decl_kind k, unsigned num_parameters, decl_info::decl_info(decl_info const& other) : m_family_id(other.m_family_id), m_kind(other.m_kind), - m_parameters(other.m_parameters.size(), other.m_parameters.c_ptr()), + m_parameters(other.m_parameters.size(), other.m_parameters.data()), m_private_parameters(other.m_private_parameters) { } @@ -691,7 +691,7 @@ func_decl * decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, para for (unsigned i = 0; i < num_args; i++) { sorts.push_back(args[i]->get_sort()); } - return mk_func_decl(k, num_parameters, parameters, num_args, sorts.c_ptr(), range); + return mk_func_decl(k, num_parameters, parameters, num_args, sorts.data(), range); } // ----------------------------------- @@ -741,7 +741,7 @@ func_decl * basic_decl_plugin::mk_bool_op_decl(char const * name, basic_op_kind info.set_commutative(comm); info.set_idempotent(idempotent); info.set_chainable(chainable); - func_decl * d = m_manager->mk_func_decl(symbol(name), num_args, domain.c_ptr(), m_bool_sort, info); + func_decl * d = m_manager->mk_func_decl(symbol(name), num_args, domain.data(), m_bool_sort, info); m_manager->inc_ref(d); return d; } @@ -763,7 +763,7 @@ func_decl * basic_decl_plugin::mk_proof_decl( domain.push_back(m_proof_sort); domain.push_back(m_bool_sort); func_decl_info info(m_family_id, k, num_parameters, params); - return m_manager->mk_func_decl(symbol(name), num_parents+1, domain.c_ptr(), m_proof_sort, info); + return m_manager->mk_func_decl(symbol(name), num_parents+1, domain.data(), m_proof_sort, info); } func_decl * basic_decl_plugin::mk_proof_decl(char const * name, basic_op_kind k, unsigned num_parents, bool inc_ref) { @@ -771,7 +771,7 @@ func_decl * basic_decl_plugin::mk_proof_decl(char const * name, basic_op_kind k, for (unsigned i = 0; i < num_parents; i++) domain.push_back(m_proof_sort); domain.push_back(m_bool_sort); - func_decl * d = m_manager->mk_func_decl(symbol(name), num_parents+1, domain.c_ptr(), m_proof_sort, func_decl_info(m_family_id, k)); + func_decl * d = m_manager->mk_func_decl(symbol(name), num_parents+1, domain.data(), m_proof_sort, func_decl_info(m_family_id, k)); if (inc_ref) m_manager->inc_ref(d); return d; } @@ -780,7 +780,7 @@ func_decl * basic_decl_plugin::mk_compressed_proof_decl(char const * name, basic ptr_buffer domain; for (unsigned i = 0; i < num_parents; i++) domain.push_back(m_proof_sort); - func_decl * d = m_manager->mk_func_decl(symbol(name), num_parents, domain.c_ptr(), m_proof_sort, func_decl_info(m_family_id, k)); + func_decl * d = m_manager->mk_func_decl(symbol(name), num_parents, domain.data(), m_proof_sort, func_decl_info(m_family_id, k)); m_manager->inc_ref(d); return d; } @@ -1101,7 +1101,7 @@ func_decl * basic_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters sort* srt = join(arity, domain); for (unsigned j = 0; j < arity; ++j) sorts.push_back(srt); - domain = sorts.c_ptr(); + domain = sorts.data(); } } return m_manager->mk_func_decl(symbol("distinct"), arity, domain, m_bool_sort, info); @@ -1140,7 +1140,7 @@ func_decl * basic_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters case PR_BIND: { ptr_buffer sorts; for (unsigned i = 0; i < num_args; ++i) sorts.push_back(args[i]->get_sort()); - return mk_func_decl(k, num_parameters, parameters, num_args, sorts.c_ptr(), range); + return mk_func_decl(k, num_parameters, parameters, num_args, sorts.data(), range); } default: break; @@ -2008,7 +2008,7 @@ sort * ast_manager::substitute(sort* s, unsigned n, sort * const * src, sort * c if (!change) { return s; } - decl_info dinfo(s->get_family_id(), s->get_decl_kind(), ps.size(), ps.c_ptr(), s->private_parameters()); + decl_info dinfo(s->get_family_id(), s->get_decl_kind(), ps.size(), ps.data(), s->private_parameters()); sort_info sinfo(dinfo, s->get_num_elements()); return mk_sort(s->get_name(), &sinfo); } @@ -2172,9 +2172,9 @@ app * ast_manager::mk_app_core(func_decl * decl, unsigned num_args, expr * const sort * d = decl->is_associative() ? decl->get_domain(0) : decl->get_domain(i); new_args.push_back(coerce_to(args[i], d)); } - check_args(decl, num_args, new_args.c_ptr()); + check_args(decl, num_args, new_args.data()); SASSERT(new_args.size() == num_args); - new_node = new (mem)app(decl, num_args, new_args.c_ptr()); + new_node = new (mem)app(decl, num_args, new_args.data()); r = register_node(new_node); } else { @@ -2276,7 +2276,7 @@ app * ast_manager::mk_app(func_decl * decl, unsigned num_args, expr * const * ar for (unsigned i = 1; i < num_args; i++) { new_args.push_back(mk_app_core(decl, args[i-1], args[i])); } - r = mk_and(new_args.size(), new_args.c_ptr()); + r = mk_and(new_args.size(), new_args.data()); } } if (r == nullptr) { @@ -2349,7 +2349,7 @@ app * ast_manager::mk_label(bool pos, unsigned num_names, symbol const * names, p.push_back(parameter(static_cast(pos))); for (unsigned i = 0; i < num_names; i++) p.push_back(parameter(names[i])); - return mk_app(label_family_id, OP_LABEL, p.size(), p.c_ptr(), 1, &n); + return mk_app(label_family_id, OP_LABEL, p.size(), p.data(), 1, &n); } app * ast_manager::mk_label(bool pos, symbol const & name, expr * n) { @@ -2372,7 +2372,7 @@ app * ast_manager::mk_label_lit(unsigned num_names, symbol const * names) { buffer p; for (unsigned i = 0; i < num_names; i++) p.push_back(parameter(names[i])); - return mk_app(label_family_id, OP_LABEL_LIT, p.size(), p.c_ptr(), 0, nullptr); + return mk_app(label_family_id, OP_LABEL_LIT, p.size(), p.data(), 0, nullptr); } app * ast_manager::mk_label_lit(symbol const & name) { @@ -2630,7 +2630,7 @@ app * ast_manager::mk_distinct_expanded(unsigned num_args, expr * const * args) new_args.push_back(mk_not(mk_eq(a1, a2))); } } - app * r = mk_and(new_args.size(), new_args.c_ptr()); + app * r = mk_and(new_args.size(), new_args.data()); TRACE("distinct", tout << "expanded distinct:\n" << mk_pp(r, *this) << "\n";); return r; } @@ -2883,7 +2883,7 @@ proof * ast_manager::mk_transitivity(unsigned num_proofs, proof * const * proofs ptr_buffer args; args.append(num_proofs, (expr**) proofs); args.push_back(mk_eq(n1,n2)); - return mk_app(basic_family_id, PR_TRANSITIVITY_STAR, args.size(), args.c_ptr()); + return mk_app(basic_family_id, PR_TRANSITIVITY_STAR, args.size(), args.data()); } proof * ast_manager::mk_monotonicity(func_decl * R, app * f1, app * f2, unsigned num_proofs, proof * const * proofs) { @@ -2892,7 +2892,7 @@ proof * ast_manager::mk_monotonicity(func_decl * R, app * f1, app * f2, unsigned ptr_buffer args; args.append(num_proofs, (expr**) proofs); args.push_back(mk_app(R, f1, f2)); - proof* p = mk_app(basic_family_id, PR_MONOTONICITY, args.size(), args.c_ptr()); + proof* p = mk_app(basic_family_id, PR_MONOTONICITY, args.size(), args.data()); return p; } @@ -2954,7 +2954,7 @@ proof * ast_manager::mk_rewrite_star(expr * s, expr * t, unsigned num_proofs, pr ptr_buffer args; args.append(num_proofs, (expr**) proofs); args.push_back(mk_eq(s, t)); - return mk_app(basic_family_id, PR_REWRITE_STAR, args.size(), args.c_ptr()); + return mk_app(basic_family_id, PR_REWRITE_STAR, args.size(), args.data()); } proof * ast_manager::mk_pull_quant(expr * e, quantifier * q) { @@ -2989,7 +2989,7 @@ proof * ast_manager::mk_quant_inst(expr * not_q_or_i, unsigned num_bind, expr* c params.push_back(parameter(binding[i])); SASSERT(params.back().is_ast()); } - return mk_app(basic_family_id, PR_QUANT_INST, num_bind, params.c_ptr(), 1, & not_q_or_i); + return mk_app(basic_family_id, PR_QUANT_INST, num_bind, params.data(), 1, & not_q_or_i); } bool ast_manager::is_quant_inst(expr const* e, expr*& not_q_or_i, ptr_vector& binding) const { @@ -3082,13 +3082,13 @@ proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * pro fact = new_lits[0]; break; default: - fact = mk_or(new_lits.size(), new_lits.c_ptr()); + fact = mk_or(new_lits.size(), new_lits.data()); break; } args.push_back(fact); } - proof * pr = mk_app(basic_family_id, PR_UNIT_RESOLUTION, args.size(), args.c_ptr()); + 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);); return pr; } @@ -3140,7 +3140,7 @@ proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * pro SASSERT(num_matches != cls_sz || is_false(new_fact)); } #endif - proof * pr = mk_app(basic_family_id, PR_UNIT_RESOLUTION, args.size(), args.c_ptr()); + 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);); return pr; } @@ -3168,7 +3168,7 @@ proof * ast_manager::mk_apply_defs(expr * n, expr * def, unsigned num_proofs, pr ptr_buffer args; args.append(num_proofs, (expr**) proofs); args.push_back(mk_oeq(n, def)); - return mk_app(basic_family_id, PR_APPLY_DEF, args.size(), args.c_ptr()); + return mk_app(basic_family_id, PR_APPLY_DEF, args.size(), args.data()); } proof * ast_manager::mk_iff_oeq(proof * p) { @@ -3202,7 +3202,7 @@ proof * ast_manager::mk_nnf_pos(expr * s, expr * t, unsigned num_proofs, proof * ptr_buffer args; args.append(num_proofs, (expr**) proofs); args.push_back(mk_oeq(s, t)); - return mk_app(basic_family_id, PR_NNF_POS, args.size(), args.c_ptr()); + return mk_app(basic_family_id, PR_NNF_POS, args.size(), args.data()); } proof * ast_manager::mk_nnf_neg(expr * s, expr * t, unsigned num_proofs, proof * const * proofs) { @@ -3212,7 +3212,7 @@ proof * ast_manager::mk_nnf_neg(expr * s, expr * t, unsigned num_proofs, proof * ptr_buffer args; args.append(num_proofs, (expr**) proofs); args.push_back(mk_oeq(mk_not(s), t)); - return mk_app(basic_family_id, PR_NNF_NEG, args.size(), args.c_ptr()); + return mk_app(basic_family_id, PR_NNF_NEG, args.size(), args.data()); } proof * ast_manager::mk_skolemization(expr * q, expr * e) { @@ -3255,7 +3255,7 @@ proof* ast_manager::mk_clause_trail_elem(proof *pr, expr* e, decl_kind k) { ptr_buffer args; if (pr) args.push_back(pr); args.push_back(e); - return mk_app(basic_family_id, k, 0, nullptr, args.size(), args.c_ptr()); + return mk_app(basic_family_id, k, 0, nullptr, args.size(), args.data()); } proof * ast_manager::mk_assumption_add(proof* pr, expr* e) { @@ -3281,7 +3281,7 @@ proof * ast_manager::mk_redundant_del(expr* e) { proof * ast_manager::mk_clause_trail(unsigned n, proof* const* ps) { ptr_buffer args; args.append(n, (expr**) ps); - return mk_app(basic_family_id, PR_CLAUSE_TRAIL, 0, nullptr, args.size(), args.c_ptr()); + return mk_app(basic_family_id, PR_CLAUSE_TRAIL, 0, nullptr, args.size(), args.data()); } proof * ast_manager::mk_th_lemma( @@ -3301,7 +3301,7 @@ proof * ast_manager::mk_th_lemma( } args.append(num_proofs, (expr**) proofs); args.push_back(fact); - return mk_app(basic_family_id, PR_TH_LEMMA, num_params+1, parameters.c_ptr(), args.size(), args.c_ptr()); + return mk_app(basic_family_id, PR_TH_LEMMA, num_params+1, parameters.data(), args.size(), args.data()); } proof* ast_manager::mk_hyper_resolve(unsigned num_premises, proof* const* premises, expr* concl, @@ -3337,7 +3337,7 @@ proof* ast_manager::mk_hyper_resolve(unsigned num_premises, proof* const* premis } sorts.push_back(mk_bool_sort()); args.push_back(concl); - app* result = mk_app(basic_family_id, PR_HYPER_RESOLVE, params.size(), params.c_ptr(), args.size(), args.c_ptr()); + app* result = mk_app(basic_family_id, PR_HYPER_RESOLVE, params.size(), params.data(), args.size(), args.data()); SASSERT(result->get_family_id() == basic_family_id); SASSERT(result->get_decl_kind() == PR_HYPER_RESOLVE); return result; diff --git a/src/ast/ast.h b/src/ast/ast.h index 41f21d716..70e079605 100644 --- a/src/ast/ast.h +++ b/src/ast/ast.h @@ -1829,27 +1829,27 @@ public: app * mk_app(func_decl * decl, unsigned num_args, expr * const * args); app* mk_app(func_decl* decl, ref_vector const& args) { - return mk_app(decl, args.size(), args.c_ptr()); + return mk_app(decl, args.size(), args.data()); } app* mk_app(func_decl* decl, ref_buffer const& args) { - return mk_app(decl, args.size(), args.c_ptr()); + return mk_app(decl, args.size(), args.data()); } app* mk_app(func_decl* decl, ref_vector const& args) { - return mk_app(decl, args.size(), (expr*const*)args.c_ptr()); + return mk_app(decl, args.size(), (expr*const*)args.data()); } app * mk_app(func_decl * decl, ptr_vector const& args) { - return mk_app(decl, args.size(), args.c_ptr()); + return mk_app(decl, args.size(), args.data()); } app * mk_app(func_decl * decl, ptr_buffer const& args) { - return mk_app(decl, args.size(), args.c_ptr()); + return mk_app(decl, args.size(), args.data()); } app * mk_app(func_decl * decl, ptr_vector const& args) { - return mk_app(decl, args.size(), (expr*const*)args.c_ptr()); + return mk_app(decl, args.size(), (expr*const*)args.data()); } app * mk_app(func_decl * decl, expr * const * args) { @@ -2138,9 +2138,9 @@ public: app * mk_xor(expr * lhs, expr * rhs) { return mk_app(basic_family_id, OP_XOR, lhs, rhs); } app * mk_ite(expr * c, expr * t, expr * e) { return mk_app(basic_family_id, OP_ITE, c, t, e); } app * mk_xor(unsigned num_args, expr * const * args) { return mk_app(basic_family_id, OP_XOR, num_args, args); } - app * mk_xor(ptr_buffer const& args) { return mk_xor(args.size(), args.c_ptr()); } - app * mk_xor(ptr_vector const& args) { return mk_xor(args.size(), args.c_ptr()); } - app * mk_xor(ref_buffer const& args) { return mk_xor(args.size(), args.c_ptr()); } + app * mk_xor(ptr_buffer const& args) { return mk_xor(args.size(), args.data()); } + app * mk_xor(ptr_vector const& args) { return mk_xor(args.size(), args.data()); } + app * mk_xor(ref_buffer const& args) { return mk_xor(args.size(), args.data()); } app * mk_or(unsigned num_args, expr * const * args) { return mk_app(basic_family_id, OP_OR, num_args, args); } app * mk_and(unsigned num_args, expr * const * args) { return mk_app(basic_family_id, OP_AND, num_args, args); } app * mk_or(expr * arg1, expr * arg2) { return mk_app(basic_family_id, OP_OR, arg1, arg2); } @@ -2149,14 +2149,14 @@ public: app * mk_or(expr* a, expr* b, expr* c, expr* d) { expr* args[4] = { a, b, c, d }; return mk_app(basic_family_id, OP_OR, 4, args); } app * mk_and(expr * arg1, expr * arg2, expr * arg3) { return mk_app(basic_family_id, OP_AND, arg1, arg2, arg3); } - app * mk_and(ref_vector const& args) { return mk_and(args.size(), args.c_ptr()); } - app * mk_and(ptr_vector const& args) { return mk_and(args.size(), args.c_ptr()); } - app * mk_and(ref_buffer const& args) { return mk_and(args.size(), args.c_ptr()); } - app * mk_and(ptr_buffer const& args) { return mk_and(args.size(), args.c_ptr()); } - app * mk_or(ref_vector const& args) { return mk_or(args.size(), args.c_ptr()); } - app * mk_or(ptr_vector const& args) { return mk_or(args.size(), args.c_ptr()); } - app * mk_or(ref_buffer const& args) { return mk_or(args.size(), args.c_ptr()); } - app * mk_or(ptr_buffer const& args) { return mk_or(args.size(), args.c_ptr()); } + app * mk_and(ref_vector const& args) { return mk_and(args.size(), args.data()); } + app * mk_and(ptr_vector const& args) { return mk_and(args.size(), args.data()); } + app * mk_and(ref_buffer const& args) { return mk_and(args.size(), args.data()); } + app * mk_and(ptr_buffer const& args) { return mk_and(args.size(), args.data()); } + app * mk_or(ref_vector const& args) { return mk_or(args.size(), args.data()); } + app * mk_or(ptr_vector const& args) { return mk_or(args.size(), args.data()); } + app * mk_or(ref_buffer const& args) { return mk_or(args.size(), args.data()); } + app * mk_or(ptr_buffer const& args) { return mk_or(args.size(), args.data()); } app * mk_implies(expr * arg1, expr * arg2) { return mk_app(basic_family_id, OP_IMPLIES, arg1, arg2); } app * mk_not(expr * n) { return mk_app(basic_family_id, OP_NOT, n); } app * mk_distinct(unsigned num_args, expr * const * args); diff --git a/src/ast/ast_pp_util.cpp b/src/ast/ast_pp_util.cpp index 4b551ca6b..2f2dad0d1 100644 --- a/src/ast/ast_pp_util.cpp +++ b/src/ast/ast_pp_util.cpp @@ -33,7 +33,7 @@ void ast_pp_util::collect(unsigned n, expr* const* es) { } void ast_pp_util::collect(expr_ref_vector const& es) { - collect(es.size(), es.c_ptr()); + collect(es.size(), es.data()); } void ast_pp_util::display_decls(std::ostream& out) { diff --git a/src/ast/ast_smt2_pp.cpp b/src/ast/ast_smt2_pp.cpp index e5b8d055b..9854195a4 100644 --- a/src/ast/ast_smt2_pp.cpp +++ b/src/ast/ast_smt2_pp.cpp @@ -747,8 +747,8 @@ class smt2_printer { buffer labels; bool is_pos; format * f = nullptr; - format ** it = m_format_stack.c_ptr() + fr.m_spos; - format ** end = m_format_stack.c_ptr() + m_format_stack.size(); + format ** it = m_format_stack.data() + fr.m_spos; + format ** end = m_format_stack.data() + m_format_stack.size(); if (m().is_label(t, is_pos, labels)) { SASSERT(it + 1 == end); f = pp_labels(is_pos, labels, *it); @@ -829,7 +829,7 @@ class smt2_printer { buf.push_back(mk_indent(m(), SMALL_INDENT, mk_compose(m(), mk_line_break(m()), f))); for (unsigned i = 0; i < num_op; i++) buf.push_back(mk_string(m(), ")")); - return mk_compose(m(), buf.size(), buf.c_ptr()); + return mk_compose(m(), buf.size(), buf.data()); } format * pp_let(format * f) { @@ -958,14 +958,14 @@ class smt2_printer { ptr_buffer buf; buf.push_back(f_body); if (q->get_num_patterns() > 0) { - format ** it = m_format_stack.c_ptr() + fr.m_spos; + format ** it = m_format_stack.data() + fr.m_spos; format ** end = it + q->get_num_patterns(); for (; it != end; ++it) { buf.push_back(pp_attribute(":pattern ", *it)); } } if (q->get_num_no_patterns() > 0) { - format ** it = m_format_stack.c_ptr() + fr.m_spos + q->get_num_patterns(); + format ** it = m_format_stack.data() + fr.m_spos + q->get_num_patterns(); format ** end = it + q->get_num_no_patterns(); for (; it != end; ++it) { buf.push_back(pp_attribute(":no-pattern ", *it)); @@ -1223,7 +1223,7 @@ void mk_smt2_format(unsigned sz, expr * const* es, smt2_pp_environment & env, pa pr(es[i], num_vars, var_prefix, fr, var_names); fmts.push_back(std::move(fr)); } - r = mk_seq(m, fmts.c_ptr(), fmts.c_ptr() + fmts.size(), f2f()); + r = mk_seq(m, fmts.data(), fmts.data() + fmts.size(), f2f()); } std::ostream & ast_smt2_pp(std::ostream & out, expr * n, smt2_pp_environment & env, params_ref const & p, unsigned indent, @@ -1375,19 +1375,19 @@ std::ostream& operator<<(std::ostream& out, sort_ref const& e) { std::ostream& operator<<(std::ostream& out, expr_ref_vector const& e) { smt2_pp_environment_dbg env(e.get_manager()); params_ref p; - return ast_smt2_pp(out, e.size(), e.c_ptr(), env, p, 0, 0, nullptr); + return ast_smt2_pp(out, e.size(), e.data(), env, p, 0, 0, nullptr); } std::ostream& operator<<(std::ostream& out, var_ref_vector const& e) { smt2_pp_environment_dbg env(e.get_manager()); params_ref p; - return ast_smt2_pp(out, e.size(), (expr*const*)e.c_ptr(), env, p, 0, 0, nullptr); + return ast_smt2_pp(out, e.size(), (expr*const*)e.data(), env, p, 0, 0, nullptr); } std::ostream& operator<<(std::ostream& out, app_ref_vector const& e) { smt2_pp_environment_dbg env(e.get_manager()); params_ref p; - return ast_smt2_pp(out, e.size(), (expr*const*)e.c_ptr(), env, p, 0, 0, nullptr); + return ast_smt2_pp(out, e.size(), (expr*const*)e.data(), env, p, 0, 0, nullptr); } std::ostream& operator<<(std::ostream& out, func_decl_ref_vector const& e) { diff --git a/src/ast/ast_translation.cpp b/src/ast/ast_translation.cpp index 7fc5f48f7..c4e32a303 100644 --- a/src/ast/ast_translation.cpp +++ b/src/ast/ast_translation.cpp @@ -130,7 +130,7 @@ void ast_translation::mk_sort(sort * s, frame & fr) { si->get_decl_kind(), si->get_num_elements(), si->get_num_parameters(), - ps.c_ptr(), + ps.data(), s->private_parameters())); } m_result_stack.shrink(fr.m_rpos); @@ -144,7 +144,7 @@ void ast_translation::mk_func_decl(func_decl * f, frame & fr) { func_decl_info * fi = f->get_info(); SASSERT(fr.m_cpos <= m_extra_children_stack.size()); unsigned num_extra = m_extra_children_stack.size() - fr.m_cpos; - sort ** new_domain = reinterpret_cast(m_result_stack.c_ptr() + fr.m_rpos + num_extra); + sort ** new_domain = reinterpret_cast(m_result_stack.data() + fr.m_rpos + num_extra); sort * new_range = static_cast(m_result_stack.back()); func_decl * new_f; if (fi == nullptr) { @@ -159,7 +159,7 @@ void ast_translation::mk_func_decl(func_decl * f, frame & fr) { func_decl_info new_fi(fi->get_family_id(), fi->get_decl_kind(), fi->get_num_parameters(), - ps.c_ptr()); + ps.data()); new_fi.set_left_associative(fi->is_left_associative()); new_fi.set_right_associative(fi->is_right_associative()); @@ -251,7 +251,7 @@ ast * ast_translation::process(ast const * _n) { goto loop; } func_decl * new_f = to_func_decl(m_result_stack[fr.m_rpos]); - expr ** new_args = reinterpret_cast(m_result_stack.c_ptr() + fr.m_rpos + 1); + expr ** new_args = reinterpret_cast(m_result_stack.data() + fr.m_rpos + 1); expr * new_app = m_to_manager.mk_app(new_f, num, new_args); m_result_stack.shrink(fr.m_rpos); m_result_stack.push_back(new_app); @@ -273,10 +273,10 @@ ast * ast_translation::process(ast const * _n) { goto loop; } symbol const * dnames = to_quantifier(n)->get_decl_names(); - sort ** dsorts = reinterpret_cast(m_result_stack.c_ptr() + fr.m_rpos); + sort ** dsorts = reinterpret_cast(m_result_stack.data() + fr.m_rpos); expr * body = static_cast(m_result_stack[fr.m_rpos + num_decls]); unsigned num_pats = to_quantifier(n)->get_num_patterns(); - expr ** pats = reinterpret_cast(m_result_stack.c_ptr() + fr.m_rpos + num_decls + 1); + expr ** pats = reinterpret_cast(m_result_stack.data() + fr.m_rpos + num_decls + 1); unsigned num_no_pats = to_quantifier(n)->get_num_no_patterns(); expr ** no_pats = pats + num_pats; quantifier * new_q = m_to_manager.mk_quantifier(to_quantifier(n)->get_kind(), @@ -349,5 +349,5 @@ expr_dependency * expr_dependency_translation::operator()(expr_dependency * d) { for (unsigned i = 0; i < sz; i++) { m_buffer[i] = m_translation(m_buffer[i]); } - return m_translation.to().mk_join(sz, m_buffer.c_ptr()); + return m_translation.to().mk_join(sz, m_buffer.data()); } diff --git a/src/ast/ast_util.cpp b/src/ast/ast_util.cpp index 2eb664531..7148b427e 100644 --- a/src/ast/ast_util.cpp +++ b/src/ast/ast_util.cpp @@ -236,7 +236,7 @@ expr * expand_distinct(ast_manager & m, unsigned num_args, expr * const * args) for (unsigned j = i + 1; j < num_args; j++) new_diseqs.push_back(m.mk_not(m.mk_eq(args[i], args[j]))); } - return mk_and(m, new_diseqs.size(), new_diseqs.c_ptr()); + return mk_and(m, new_diseqs.size(), new_diseqs.data()); } expr* mk_distinct(ast_manager& m, unsigned num_args, expr * const * args) { @@ -253,7 +253,7 @@ expr* mk_distinct(ast_manager& m, unsigned num_args, expr * const * args) { expr_ref mk_distinct(expr_ref_vector const& args) { ast_manager& m = args.get_manager(); - return expr_ref(mk_distinct(m, args.size(), args.c_ptr()), m); + return expr_ref(mk_distinct(m, args.size(), args.data()), m); } diff --git a/src/ast/ast_util.h b/src/ast/ast_util.h index c7553fc9c..1c56b64b3 100644 --- a/src/ast/ast_util.h +++ b/src/ast/ast_util.h @@ -28,7 +28,7 @@ void remove_duplicates(C & v) { unsigned sz = v.size(); unsigned j = 0; for (unsigned i = 0; i < sz; i++) { - typename C::data curr = v.get(i); + auto curr = v.get(i); if (!visited.is_marked(curr)) { visited.mark(curr); if (i != j) @@ -102,8 +102,8 @@ expr * get_clause_literal(ast_manager & m, expr * cls, unsigned idx); expr * mk_and(ast_manager & m, unsigned num_args, expr * const * args); app * mk_and(ast_manager & m, unsigned num_args, app * const * args); inline expr * mk_and(ast_manager & m, expr* a, expr* b) { expr* args[2] = { a, b }; return mk_and(m, 2, args); } -inline app_ref mk_and(app_ref_vector const& args) { return app_ref(mk_and(args.get_manager(), args.size(), args.c_ptr()), args.get_manager()); } -inline expr_ref mk_and(expr_ref_vector const& args) { return expr_ref(mk_and(args.get_manager(), args.size(), args.c_ptr()), args.get_manager()); } +inline app_ref mk_and(app_ref_vector const& args) { return app_ref(mk_and(args.get_manager(), args.size(), args.data()), args.get_manager()); } +inline expr_ref mk_and(expr_ref_vector const& args) { return expr_ref(mk_and(args.get_manager(), args.size(), args.data()), args.get_manager()); } inline app_ref operator&(expr_ref& a, expr* b) { return app_ref(a.m().mk_and(a, b), a.m()); } inline app_ref operator&(app_ref& a, expr* b) { return app_ref(a.m().mk_and(a, b), a.m()); } @@ -124,8 +124,8 @@ app_ref operator+(expr_ref& a, expr_ref& b); expr * mk_or(ast_manager & m, unsigned num_args, expr * const * args); app * mk_or(ast_manager & m, unsigned num_args, app * const * args); inline expr * mk_or(ast_manager & m, expr* a, expr* b) { expr* args[2] = { a, b }; return mk_or(m, 2, args); } -inline app_ref mk_or(app_ref_vector const& args) { return app_ref(mk_or(args.get_manager(), args.size(), args.c_ptr()), args.get_manager()); } -inline expr_ref mk_or(expr_ref_vector const& args) { return expr_ref(mk_or(args.get_manager(), args.size(), args.c_ptr()), args.get_manager()); } +inline app_ref mk_or(app_ref_vector const& args) { return app_ref(mk_or(args.get_manager(), args.size(), args.data()), args.get_manager()); } +inline expr_ref mk_or(expr_ref_vector const& args) { return expr_ref(mk_or(args.get_manager(), args.size(), args.data()), args.get_manager()); } /** Return a if arg = (not a) diff --git a/src/ast/bv_decl_plugin.h b/src/ast/bv_decl_plugin.h index be8c3f55c..fc091f1f4 100644 --- a/src/ast/bv_decl_plugin.h +++ b/src/ast/bv_decl_plugin.h @@ -410,7 +410,7 @@ public: return m_manager.mk_app(get_fid(), OP_EXTRACT, 2, params, 1, &n); } app * mk_concat(unsigned num, expr * const * args) { return m_manager.mk_app(get_fid(), OP_CONCAT, num, args); } - app * mk_concat(expr_ref_vector const& es) { return m_manager.mk_app(get_fid(), OP_CONCAT, es.size(), es.c_ptr()); } + app * mk_concat(expr_ref_vector const& es) { return m_manager.mk_app(get_fid(), OP_CONCAT, es.size(), es.data()); } app * mk_bv_or(unsigned num, expr * const * args) { return m_manager.mk_app(get_fid(), OP_BOR, num, args); } app * mk_bv_and(unsigned num, expr * const * args) { return m_manager.mk_app(get_fid(), OP_BAND, num, args); } app * mk_bv_xor(unsigned num, expr * const * args) { return m_manager.mk_app(get_fid(), OP_BXOR, num, args); } diff --git a/src/ast/datatype_decl_plugin.cpp b/src/ast/datatype_decl_plugin.cpp index 4f3f726d2..152256c69 100644 --- a/src/ast/datatype_decl_plugin.cpp +++ b/src/ast/datatype_decl_plugin.cpp @@ -38,7 +38,7 @@ namespace datatype { unsigned n = ps.size(); SASSERT(m_range); SASSERT(n == get_def().params().size()); - sort_ref range(m.substitute(m_range, n, get_def().params().c_ptr(), ps.c_ptr()), m); + sort_ref range(m.substitute(m_range, n, get_def().params().data(), ps.data()), m); sort_ref src(get_def().instantiate(ps)); sort* srcs[1] = { src.get() }; parameter pas[2] = { parameter(name()), parameter(get_constructor().name()) }; @@ -70,7 +70,7 @@ namespace datatype { } sort_ref range = get_def().instantiate(ps); parameter pas[1] = { parameter(name()) }; - return func_decl_ref(m.mk_func_decl(u().get_family_id(), OP_DT_CONSTRUCTOR, 1, pas, domain.size(), domain.c_ptr(), range), m); + return func_decl_ref(m.mk_func_decl(u().get_family_id(), OP_DT_CONSTRUCTOR, 1, pas, domain.size(), domain.data(), range), m); } func_decl_ref constructor::instantiate(sort* dt) const { @@ -94,12 +94,12 @@ namespace datatype { vector ps; ps.push_back(parameter(m_name)); for (sort * s : m_params) ps.push_back(parameter(s)); - m_sort = m.mk_sort(u().get_family_id(), DATATYPE_SORT, ps.size(), ps.c_ptr()); + m_sort = m.mk_sort(u().get_family_id(), DATATYPE_SORT, ps.size(), ps.data()); } if (sorts.empty()) { return m_sort; } - return sort_ref(m.substitute(m_sort, sorts.size(), m_params.c_ptr(), sorts.c_ptr()), m); + return sort_ref(m.substitute(m_sort, sorts.size(), m_params.data(), sorts.data()), m); } def* def::translate(ast_translation& tr, util& u) { @@ -108,7 +108,7 @@ namespace datatype { for (sort* p : m_params) { ps.push_back(to_sort(tr(p))); } - def* result = alloc(def, tr.to(), u, m_name, m_class_id, ps.size(), ps.c_ptr()); + def* result = alloc(def, tr.to(), u, m_name, m_class_id, ps.size(), ps.data()); for (constructor* c : *this) { result->add(c->translate(tr)); } @@ -449,10 +449,10 @@ namespace datatype { } } } - if (!u().is_well_founded(sorts.size(), sorts.c_ptr())) { + if (!u().is_well_founded(sorts.size(), sorts.data())) { m_manager->raise_exception("datatype is not well-founded"); } - if (!u().is_covariant(sorts.size(), sorts.c_ptr())) { + if (!u().is_covariant(sorts.size(), sorts.data())) { m_manager->raise_exception("datatype is not co-variant"); } @@ -1372,7 +1372,7 @@ namespace datatype { type_ref t(e.second); accd.push_back(mk_accessor_decl(m, e.first, t)); } - auto* tuple = mk_constructor_decl(name, test, accd.size(), accd.c_ptr()); + auto* tuple = mk_constructor_decl(name, test, accd.size(), accd.data()); auto* dt = mk_datatype_decl(*this, name, 0, nullptr, 1, &tuple); sort_ref_vector sorts(m); VERIFY(plugin().mk_datatypes(1, &dt, 0, nullptr, sorts)); diff --git a/src/ast/dl_decl_plugin.cpp b/src/ast/dl_decl_plugin.cpp index d133e78b6..1291e72e2 100644 --- a/src/ast/dl_decl_plugin.cpp +++ b/src/ast/dl_decl_plugin.cpp @@ -244,7 +244,7 @@ namespace datalog { ps.push_back(parameter(sorts[j])); } SASSERT(ps.size() + num_params == sorts.size()); - sort* r2 = m.mk_sort(m_family_id, DL_RELATION_SORT, ps.size(), ps.c_ptr()); + sort* r2 = m.mk_sort(m_family_id, DL_RELATION_SORT, ps.size(), ps.data()); func_decl_info info(m_family_id, OP_RA_PROJECT, num_params, params); return m.mk_func_decl(m_project_sym, 1, &r, r2, info); } @@ -353,7 +353,7 @@ namespace datalog { for (unsigned i = 0; i < sorts.size(); ++i) { params2.push_back(parameter(sorts[i])); } - sort* rng = m_manager->mk_sort(m_family_id, DL_RELATION_SORT, params2.size(), params2.c_ptr()); + sort* rng = m_manager->mk_sort(m_family_id, DL_RELATION_SORT, params2.size(), params2.data()); func_decl_info info(m_family_id, OP_RA_RENAME, num_params, params); return m_manager->mk_func_decl(m_rename_sym, 1, &r, rng, info); } @@ -396,7 +396,7 @@ namespace datalog { } } sort* args[2] = { r1, r2 }; - sort* rng = m_manager->mk_sort(m_family_id, DL_RELATION_SORT, params2.size(), params2.c_ptr()); + sort* rng = m_manager->mk_sort(m_family_id, DL_RELATION_SORT, params2.size(), params2.data()); func_decl_info info(m_family_id, OP_RA_JOIN, num_params, params); return m_manager->mk_func_decl(m_join_sym, 2, args, rng, info); } @@ -768,7 +768,7 @@ namespace datalog { for (unsigned i = 0; i < num_args; ++i) { sorts.push_back(args[i]->get_sort()); } - func_decl* f = m.mk_func_decl(name, num_args, sorts.c_ptr(), mk_rule_sort()); + func_decl* f = m.mk_func_decl(name, num_args, sorts.data(), mk_rule_sort()); return m.mk_app(f, num_args, args); } diff --git a/src/ast/euf/euf_egraph.cpp b/src/ast/euf/euf_egraph.cpp index a61a0a219..c9396717a 100644 --- a/src/ast/euf/euf_egraph.cpp +++ b/src/ast/euf/euf_egraph.cpp @@ -776,7 +776,7 @@ namespace euf { for (unsigned j = 0; j < n1->num_args(); ++j) args.push_back(old_expr2new_enode[n1->get_arg(j)->get_expr_id()]); expr* e2 = tr(e1); - enode* n2 = mk(e2, n1->generation(), args.size(), args.c_ptr()); + enode* n2 = mk(e2, n1->generation(), args.size(), args.data()); old_expr2new_enode.setx(e1->get_id(), n2, nullptr); n2->set_value(n2->value()); n2->m_bool_var = n1->m_bool_var; diff --git a/src/ast/expr2polynomial.cpp b/src/ast/expr2polynomial.cpp index 25ece60ab..a69d5b436 100644 --- a/src/ast/expr2polynomial.cpp +++ b/src/ast/expr2polynomial.cpp @@ -236,12 +236,12 @@ struct expr2polynomial::imp { polynomial::polynomial * const * polynomial_args(unsigned num_args) { SASSERT(m_presult_stack.size() >= num_args); - return m_presult_stack.c_ptr() + m_presult_stack.size() - num_args; + return m_presult_stack.data() + m_presult_stack.size() - num_args; } polynomial::numeral const * denominator_args(unsigned num_args) { SASSERT(m_dresult_stack.size() >= num_args); - return m_dresult_stack.c_ptr() + m_dresult_stack.size() - num_args; + return m_dresult_stack.data() + m_dresult_stack.size() - num_args; } template @@ -442,7 +442,7 @@ struct expr2polynomial::imp { args.push_back(margs[0]); } else { - args.push_back(m_autil.mk_mul(margs.size(), margs.c_ptr())); + args.push_back(m_autil.mk_mul(margs.size(), margs.data())); } } @@ -453,7 +453,7 @@ struct expr2polynomial::imp { r = args[0]; } else { - r = m_autil.mk_add(args.size(), args.c_ptr()); + r = m_autil.mk_add(args.size(), args.data()); } } diff --git a/src/ast/expr_abstract.cpp b/src/ast/expr_abstract.cpp index 801c570c2..48dcb9d37 100644 --- a/src/ast/expr_abstract.cpp +++ b/src/ast/expr_abstract.cpp @@ -68,7 +68,7 @@ void expr_abstractor::operator()(unsigned base, unsigned num_bound, expr* const* } if (all_visited) { if (changed) { - b = m.mk_app(a->get_decl(), m_args.size(), m_args.c_ptr()); + b = m.mk_app(a->get_decl(), m_args.size(), m_args.data()); m_pinned.push_back(b); } else { b = curr; @@ -89,7 +89,7 @@ void expr_abstractor::operator()(unsigned base, unsigned num_bound, expr* const* patterns.push_back(result1.get()); } result1 = expr_abstract(m, new_base, num_bound, bound, q->get_expr()); - b = m.update_quantifier(q, patterns.size(), patterns.c_ptr(), result1.get()); + b = m.update_quantifier(q, patterns.size(), patterns.data(), result1.get()); m_pinned.push_back(b); m_map.insert(curr, b); m_stack.pop_back(); @@ -125,7 +125,7 @@ expr_ref mk_quantifier(quantifier_kind k, ast_manager& m, unsigned num_bound, ap sorts.push_back(bound[i]->get_sort()); names.push_back(bound[i]->get_decl()->get_name()); } - result = m.mk_quantifier(k, num_bound, sorts.c_ptr(), names.c_ptr(), result); + result = m.mk_quantifier(k, num_bound, sorts.data(), names.data(), result); } TRACE("expr_abstract", tout << expr_ref(n, m) << "\n"; diff --git a/src/ast/expr_abstract.h b/src/ast/expr_abstract.h index 5ab8a8df6..747fbc9a4 100644 --- a/src/ast/expr_abstract.h +++ b/src/ast/expr_abstract.h @@ -33,8 +33,8 @@ public: void expr_abstract(ast_manager& m, unsigned base, unsigned num_bound, expr* const* bound, expr* n, expr_ref& result); inline expr_ref expr_abstract(ast_manager& m, unsigned base, unsigned num_bound, expr* const* bound, expr* n) { expr_ref r(m); expr_abstract(m, base, num_bound, bound, n, r); return r; } -inline expr_ref expr_abstract(expr_ref_vector const& bound, expr* n) { return expr_abstract(bound.m(), 0, bound.size(), bound.c_ptr(), n); } -inline expr_ref expr_abstract(app_ref_vector const& bound, expr* n) { return expr_abstract(bound.m(), 0, bound.size(), (expr*const*)bound.c_ptr(), n); } +inline expr_ref expr_abstract(expr_ref_vector const& bound, expr* n) { return expr_abstract(bound.m(), 0, bound.size(), bound.data(), n); } +inline expr_ref expr_abstract(app_ref_vector const& bound, expr* n) { return expr_abstract(bound.m(), 0, bound.size(), (expr*const*)bound.data(), n); } expr_ref mk_forall(ast_manager& m, unsigned num_bound, app* const* bound, expr* n); expr_ref mk_exists(ast_manager& m, unsigned num_bound, app* const* bound, expr* n); inline expr_ref mk_forall(ast_manager& m, app* b, expr* n) { return mk_forall(m, 1, &b, n); } diff --git a/src/ast/expr_functors.cpp b/src/ast/expr_functors.cpp index 6a2138106..2473692fd 100644 --- a/src/ast/expr_functors.cpp +++ b/src/ast/expr_functors.cpp @@ -124,7 +124,7 @@ void map_proc::reconstruct(app* a) { } } if (is_new) { - expr* b = m.mk_app(a->get_decl(), m_args.size(), m_args.c_ptr()); + expr* b = m.mk_app(a->get_decl(), m_args.size(), m_args.data()); m_map.insert(a, b, nullptr); } else { diff --git a/src/ast/expr_functors.h b/src/ast/expr_functors.h index 2cd4dd1bc..4e87fb39e 100644 --- a/src/ast/expr_functors.h +++ b/src/ast/expr_functors.h @@ -91,7 +91,7 @@ public: } bool operator()(expr_ref_vector const& v) { - return (*this)(v.size(), v.c_ptr()); + return (*this)(v.size(), v.data()); } bool operator()(unsigned size, expr* const* es); diff --git a/src/ast/format.h b/src/ast/format.h index edbf269f9..2714d54b7 100644 --- a/src/ast/format.h +++ b/src/ast/format.h @@ -77,7 +77,7 @@ namespace format_ns { children.push_back(curr); } } - return mk_compose(m, children.size(), children.c_ptr()); + return mk_compose(m, children.size(), children.data()); } /** diff --git a/src/ast/fpa/bv2fpa_converter.cpp b/src/ast/fpa/bv2fpa_converter.cpp index 719b769c8..764344f1d 100644 --- a/src/ast/fpa/bv2fpa_converter.cpp +++ b/src/ast/fpa/bv2fpa_converter.cpp @@ -219,7 +219,7 @@ expr_ref bv2fpa_converter::rebuild_floats(model_core * mc, sort * s, expr * e) { for (expr* arg : *a) { new_args.push_back(rebuild_floats(mc, arg->get_sort(), arg)); } - result = m.mk_app(a->get_decl(), new_args.size(), new_args.c_ptr()); + result = m.mk_app(a->get_decl(), new_args.size(), new_args.data()); } else if (is_var(e)) { result = e; @@ -247,7 +247,7 @@ bv2fpa_converter::array_model bv2fpa_converter::convert_array_func_interp(model_ bv_f = arr_util.get_as_array_func_decl(to_app(as_arr_mdl)); - am.new_float_fd = m.mk_fresh_func_decl(arity, array_domain.c_ptr(), rng); + am.new_float_fd = m.mk_fresh_func_decl(arity, array_domain.data(), rng); am.new_float_fi = convert_func_interp(mc, am.new_float_fd, bv_f); am.bv_fd = bv_f; am.result = arr_util.mk_as_array(am.new_float_fd); @@ -295,12 +295,12 @@ func_interp * bv2fpa_converter::convert_func_interp(model_core * mc, func_decl * for (unsigned i = 0; i < new_args.size(); i++) tout << " " << mk_ismt2_pp(new_args[i], m); tout << ") = " << mk_ismt2_pp(ft_fres, m) << std::endl;); - func_entry * fe = result->get_entry(new_args.c_ptr()); + func_entry * fe = result->get_entry(new_args.data()); if (fe == nullptr) { // Avoid over-specification of a partially interpreted theory function if (f->get_family_id() != m_fpa_util.get_family_id() || - m_fpa_util.is_considered_uninterpreted(f, new_args.size(), new_args.c_ptr())) - result->insert_new_entry(new_args.c_ptr(), ft_fres); + m_fpa_util.is_considered_uninterpreted(f, new_args.size(), new_args.data())) + result->insert_new_entry(new_args.data(), ft_fres); } else { // The BV model may have multiple equivalent entries using different diff --git a/src/ast/fpa/fpa2bv_converter.cpp b/src/ast/fpa/fpa2bv_converter.cpp index 698f825c9..a654e6070 100644 --- a/src/ast/fpa/fpa2bv_converter.cpp +++ b/src/ast/fpa/fpa2bv_converter.cpp @@ -264,9 +264,9 @@ expr_ref fpa2bv_converter::extra_quantify(expr * e) expr_ref res(m); var_subst vsubst(m); - res = vsubst.operator()(e, nv, subst_map.c_ptr()); + res = vsubst.operator()(e, nv, subst_map.data()); TRACE("fpa2bv", tout << "subst'd = " << mk_ismt2_pp(res, m) << std::endl; ); - res = m.mk_forall(nv, new_decl_sorts.c_ptr(), new_decl_names.c_ptr(), res); + res = m.mk_forall(nv, new_decl_sorts.data(), new_decl_names.data(), res); return res; } diff --git a/src/ast/fpa/fpa2bv_rewriter.cpp b/src/ast/fpa/fpa2bv_rewriter.cpp index 24a2be2d1..df9505354 100644 --- a/src/ast/fpa/fpa2bv_rewriter.cpp +++ b/src/ast/fpa/fpa2bv_rewriter.cpp @@ -225,7 +225,7 @@ bool fpa2bv_rewriter_cfg::reduce_quantifier( new_decl_names.push_back(n); } } - result = m().mk_quantifier(old_q->get_kind(), new_decl_sorts.size(), new_decl_sorts.c_ptr(), new_decl_names.c_ptr(), + result = m().mk_quantifier(old_q->get_kind(), new_decl_sorts.size(), new_decl_sorts.data(), new_decl_names.data(), new_body, old_q->get_weight(), old_q->get_qid(), old_q->get_skid(), old_q->get_num_patterns(), new_patterns, old_q->get_num_no_patterns(), new_no_patterns); result_pr = nullptr; diff --git a/src/ast/macros/macro_finder.cpp b/src/ast/macros/macro_finder.cpp index a3d260228..ec2c166c9 100644 --- a/src/ast/macros/macro_finder.cpp +++ b/src/ast/macros/macro_finder.cpp @@ -384,7 +384,7 @@ void macro_finder::operator()(unsigned n, justified_expr const* fmls, vector old_fmls; _new_fmls.swap(old_fmls); SASSERT(_new_fmls.empty()); - if (!expand_macros(old_fmls.size(), old_fmls.c_ptr(), _new_fmls)) + if (!expand_macros(old_fmls.size(), old_fmls.data(), _new_fmls)) break; } } diff --git a/src/ast/macros/macro_manager.cpp b/src/ast/macros/macro_manager.cpp index 04b3b648a..6a1f4f160 100644 --- a/src/ast/macros/macro_manager.cpp +++ b/src/ast/macros/macro_manager.cpp @@ -315,12 +315,12 @@ struct macro_manager::macro_expander_cfg : public default_rewriter_cfg { subst_args[nidx] = n->get_arg(i); } var_subst s(m); - expr_ref rr = s(def, num, subst_args.c_ptr()); + expr_ref rr = s(def, num, subst_args.data()); m_trail.push_back(rr); r = rr; if (m.proofs_enabled()) { - expr_ref instance = s(q->get_expr(), num, subst_args.c_ptr()); - proof * qi_pr = m.mk_quant_inst(m.mk_or(m.mk_not(q), instance), num, subst_args.c_ptr()); + expr_ref instance = s(q->get_expr(), num, subst_args.data()); + proof * qi_pr = m.mk_quant_inst(m.mk_or(m.mk_not(q), instance), num, subst_args.data()); proof * q_pr = mm.m_decl2macro_pr.find(d); proof * prs[2] = { qi_pr, q_pr }; p = m.mk_unit_resolution(2, prs); diff --git a/src/ast/macros/macro_util.cpp b/src/ast/macros/macro_util.cpp index 6ab75453e..e439ae3e0 100644 --- a/src/ast/macros/macro_util.cpp +++ b/src/ast/macros/macro_util.cpp @@ -289,7 +289,7 @@ bool macro_util::is_arith_macro(expr * n, unsigned num_decls, app_ref & head, ex return false; head = to_app(h); expr_ref tmp(m_manager); - tmp = m_arith.mk_add(args.size(), args.c_ptr()); + tmp = m_arith.mk_add(args.size(), args.data()); if (inv) mk_sub(tmp, rhs, def); else @@ -454,8 +454,8 @@ void macro_util::quasi_macro_head_to_macro_head(app * qhead, unsigned & num_decl new_args.push_back(new_var); new_conds.push_back(new_cond); } - bool_rewriter(m_manager).mk_and(new_conds.size(), new_conds.c_ptr(), cond); - head = m_manager.mk_app(qhead->get_decl(), new_args.size(), new_args.c_ptr()); + bool_rewriter(m_manager).mk_and(new_conds.size(), new_conds.data(), cond); + head = m_manager.mk_app(qhead->get_decl(), new_args.size(), new_args.data()); num_decls = next_var_idx; } @@ -515,7 +515,7 @@ void macro_util::normalize_expr(app * head, unsigned num_decls, expr * t, expr_r if (var_mapping[i] != 0) tout << "#" << i << " -> " << mk_ll_pp(var_mapping[i], m_manager); }); - norm_t = subst(t, var_mapping.size(), var_mapping.c_ptr()); + norm_t = subst(t, var_mapping.size(), var_mapping.data()); } else { norm_t = t; @@ -613,7 +613,7 @@ void hint_to_macro_head(ast_manager & m, app * head, unsigned & num_decls, app_r next_var_idx++; new_args.push_back(new_var); } - new_head = m.mk_app(head->get_decl(), new_args.size(), new_args.c_ptr()); + new_head = m.mk_app(head->get_decl(), new_args.size(), new_args.data()); num_decls = next_var_idx; } @@ -759,7 +759,7 @@ void macro_util::get_rest_clause_as_cond(expr * except_lit, expr_ref & extra_con } if (neg_other_lits.empty()) return; - bool_rewriter(m_manager).mk_and(neg_other_lits.size(), neg_other_lits.c_ptr(), extra_cond); + bool_rewriter(m_manager).mk_and(neg_other_lits.size(), neg_other_lits.data(), extra_cond); } void macro_util::collect_poly_args(expr * n, expr * exception, ptr_buffer & args) { @@ -820,7 +820,7 @@ void macro_util::collect_arith_macro_candidates(expr * lhs, expr * rhs, expr * a if (_is_arith_macro || _is_poly_hint) { collect_poly_args(lhs, arg, args); expr_ref rest(m_manager); - mk_add(args.size(), args.c_ptr(), arg->get_sort(), rest); + mk_add(args.size(), args.data(), arg->get_sort(), rest); expr_ref def(m_manager); mk_sub(rhs, rest, def); // If is_poly_hint, rhs may contain variables that do not occur in to_app(arg). @@ -841,7 +841,7 @@ void macro_util::collect_arith_macro_candidates(expr * lhs, expr * rhs, expr * a if (_is_arith_macro || _is_poly_hint) { collect_poly_args(lhs, arg, args); expr_ref rest(m_manager); - mk_add(args.size(), args.c_ptr(), arg->get_sort(), rest); + mk_add(args.size(), args.data(), arg->get_sort(), rest); expr_ref def(m_manager); mk_sub(rest, rhs, def); // If is_poly_hint, rhs may contain variables that do not occur in to_app(neg_arg). diff --git a/src/ast/macros/quasi_macros.cpp b/src/ast/macros/quasi_macros.cpp index 1bc20d1b9..f34336d84 100644 --- a/src/ast/macros/quasi_macros.cpp +++ b/src/ast/macros/quasi_macros.cpp @@ -236,18 +236,18 @@ bool quasi_macros::quasi_macro_to_macro(quantifier * q, app * a, expr * t, quant // Macro := Forall m_new_vars . appl = ITE( m_new_eqs, t, f_else) - app_ref appl(m.mk_app(f, m_new_vars.size(), m_new_vars.c_ptr()), m); + app_ref appl(m.mk_app(f, m_new_vars.size(), m_new_vars.data()), m); func_decl * fd = m.mk_fresh_func_decl(f->get_name(), symbol("else"), f->get_arity(), f->get_domain(), f->get_range()); - expr_ref f_else(m.mk_app(fd, m_new_vars.size(), m_new_vars.c_ptr()), m); - expr_ref ite(m.mk_ite(m.mk_and(m_new_eqs.size(), m_new_eqs.c_ptr()), t, f_else), m); + expr_ref f_else(m.mk_app(fd, m_new_vars.size(), m_new_vars.data()), m); + expr_ref ite(m.mk_ite(m.mk_and(m_new_eqs.size(), m_new_eqs.data()), t, f_else), m); expr_ref eq(m.mk_eq(appl, ite), m); macro = m.mk_quantifier(forall_k, new_var_names_rev.size(), - new_qsorts_rev.c_ptr(), new_var_names_rev.c_ptr(), eq); + new_qsorts_rev.data(), new_var_names_rev.data(), eq); return true; } @@ -344,7 +344,7 @@ void quasi_macros::apply_macros(expr_ref_vector & exprs, proof_ref_vector & prs, bool quasi_macros::operator()(expr_ref_vector & exprs, proof_ref_vector & prs, expr_dependency_ref_vector & deps) { unsigned n = exprs.size(); - if (find_macros(n, exprs.c_ptr())) { + if (find_macros(n, exprs.data())) { apply_macros(exprs, prs, deps); return true; } diff --git a/src/ast/normal_forms/defined_names.cpp b/src/ast/normal_forms/defined_names.cpp index 3156e94fa..5aef5c075 100644 --- a/src/ast/normal_forms/defined_names.cpp +++ b/src/ast/normal_forms/defined_names.cpp @@ -120,8 +120,8 @@ app * defined_names::impl::gen_name(expr * e, sort_ref_buffer & var_sorts, buffe } sort * range = e->get_sort(); - func_decl * new_skolem_decl = m.mk_fresh_func_decl(m_z3name, symbol::null, domain.size(), domain.c_ptr(), range); - app * n = m.mk_app(new_skolem_decl, new_args.size(), new_args.c_ptr()); + func_decl * new_skolem_decl = m.mk_fresh_func_decl(m_z3name, symbol::null, domain.size(), domain.data(), range); + app * n = m.mk_app(new_skolem_decl, new_args.size(), new_args.data()); if (is_lambda(e)) { m.add_lambda_def(new_skolem_decl, to_quantifier(e)); } @@ -159,8 +159,8 @@ void defined_names::impl::bound_vars(sort_ref_buffer const & sorts, bufferget_expr(), n3), to_app(n3), defs, m.lambda_def_qid()); @@ -234,7 +234,7 @@ void defined_names::impl::mk_definition(expr * e, app * n, sort_ref_buffer & var else { bound_vars(var_sorts, var_names, MK_EQ(e, n), n, defs); } - new_def = mk_and(m, defs.size(), defs.c_ptr()); + new_def = mk_and(m, defs.size(), defs.data()); } @@ -266,8 +266,8 @@ bool defined_names::impl::mk_name(expr * e, expr_ref & new_def, proof_ref & new_ TRACE("mk_definition_bug", tout << "name: " << mk_ismt2_pp(n, m) << "\n";); // variables are in reverse order in quantifiers - std::reverse(var_sorts.c_ptr(), var_sorts.c_ptr() + var_sorts.size()); - std::reverse(var_names.c_ptr(), var_names.c_ptr() + var_names.size()); + std::reverse(var_sorts.data(), var_sorts.data() + var_sorts.size()); + std::reverse(var_names.data(), var_names.data() + var_names.size()); mk_definition(e, n, var_sorts, var_names, new_def); diff --git a/src/ast/normal_forms/nnf.cpp b/src/ast/normal_forms/nnf.cpp index 5090318d9..19b776aba 100644 --- a/src/ast/normal_forms/nnf.cpp +++ b/src/ast/normal_forms/nnf.cpp @@ -102,8 +102,8 @@ class skolemizer { for (unsigned i = num_decls; i > 0; ) { --i; sort * r = q->get_decl_sort(i); - func_decl * sk_decl = m.mk_fresh_func_decl(q->get_decl_name(i), q->get_skid(), sorts.size(), sorts.c_ptr(), r); - app * sk = m.mk_app(sk_decl, args.size(), args.c_ptr()); + func_decl * sk_decl = m.mk_fresh_func_decl(q->get_decl_name(i), q->get_skid(), sorts.size(), sorts.data(), r); + app * sk = m.mk_app(sk_decl, args.size(), args.data()); substitution.push_back(sk); } // @@ -121,7 +121,7 @@ class skolemizer { // (VAR num_decls) ... (VAR num_decls+sz-1) // are in positions num_decls .. num_decls+sz-1 // - std::reverse(substitution.c_ptr(), substitution.c_ptr() + substitution.size()); + std::reverse(substitution.data(), substitution.data() + substitution.size()); // // (VAR 0) should be in the last position of substitution. // @@ -464,14 +464,14 @@ struct nnf::imp { } app * r; if (m.is_and(t) == fr.m_pol) - r = m.mk_and(t->get_num_args(), m_result_stack.c_ptr() + fr.m_spos); + r = m.mk_and(t->get_num_args(), m_result_stack.data() + fr.m_spos); else - r = m.mk_or(t->get_num_args(), m_result_stack.c_ptr() + fr.m_spos); + r = m.mk_or(t->get_num_args(), m_result_stack.data() + fr.m_spos); m_result_stack.shrink(fr.m_spos); m_result_stack.push_back(r); if (proofs_enabled()) { - proof * pr = mk_proof(fr.m_pol, t->get_num_args(), m_result_pr_stack.c_ptr() + fr.m_spos, t, r); + proof * pr = mk_proof(fr.m_pol, t->get_num_args(), m_result_pr_stack.data() + fr.m_spos, t, r); m_result_pr_stack.shrink(fr.m_spos); m_result_pr_stack.push_back(pr); SASSERT(m_result_stack.size() == m_result_pr_stack.size()); @@ -516,14 +516,14 @@ struct nnf::imp { app * r; if (fr.m_pol) - r = m.mk_or(2, m_result_stack.c_ptr() + fr.m_spos); + r = m.mk_or(2, m_result_stack.data() + fr.m_spos); else - r = m.mk_and(2, m_result_stack.c_ptr() + fr.m_spos); + r = m.mk_and(2, m_result_stack.data() + fr.m_spos); m_result_stack.shrink(fr.m_spos); m_result_stack.push_back(r); if (proofs_enabled()) { - proof * pr = mk_proof(fr.m_pol, 2, m_result_pr_stack.c_ptr() + fr.m_spos, t, r); + proof * pr = mk_proof(fr.m_pol, 2, m_result_pr_stack.data() + fr.m_spos, t, r); m_result_pr_stack.shrink(fr.m_spos); m_result_pr_stack.push_back(pr); SASSERT(m_result_stack.size() == m_result_pr_stack.size()); @@ -554,7 +554,7 @@ struct nnf::imp { break; } - expr * const * rs = m_result_stack.c_ptr() + fr.m_spos; + expr * const * rs = m_result_stack.data() + fr.m_spos; expr * _cond = rs[0]; expr * _not_cond = rs[1]; expr * _then = rs[2]; @@ -564,7 +564,7 @@ struct nnf::imp { m_result_stack.shrink(fr.m_spos); m_result_stack.push_back(r); if (proofs_enabled()) { - proof * pr = mk_proof(fr.m_pol, 4, m_result_pr_stack.c_ptr() + fr.m_spos, t, r); + proof * pr = mk_proof(fr.m_pol, 4, m_result_pr_stack.data() + fr.m_spos, t, r); m_result_pr_stack.shrink(fr.m_spos); m_result_pr_stack.push_back(pr); SASSERT(m_result_stack.size() == m_result_pr_stack.size()); @@ -598,7 +598,7 @@ struct nnf::imp { break; } - expr * const * rs = m_result_stack.c_ptr() + fr.m_spos; + expr * const * rs = m_result_stack.data() + fr.m_spos; expr * lhs = rs[0]; expr * not_lhs = rs[1]; expr * rhs = rs[2]; @@ -612,7 +612,7 @@ struct nnf::imp { m_result_stack.shrink(fr.m_spos); m_result_stack.push_back(r); if (proofs_enabled()) { - proof * pr = mk_proof(fr.m_pol, 4, m_result_pr_stack.c_ptr() + fr.m_spos, t, r); + proof * pr = mk_proof(fr.m_pol, 4, m_result_pr_stack.data() + fr.m_spos, t, r); m_result_pr_stack.shrink(fr.m_spos); m_result_pr_stack.push_back(pr); SASSERT(m_result_stack.size() == m_result_pr_stack.size()); @@ -675,11 +675,11 @@ struct nnf::imp { expr_ref r(m); proof_ref pr(m); if (fr.m_pol == pos) { - expr * lbl_lit = m.mk_label_lit(names.size(), names.c_ptr()); + expr * lbl_lit = m.mk_label_lit(names.size(), names.data()); r = m.mk_and(arg, lbl_lit); if (proofs_enabled()) { expr_ref aux(m); - aux = m.mk_label(true, names.size(), names.c_ptr(), arg); + aux = m.mk_label(true, names.size(), names.data(), arg); pr = m.mk_transitivity(mk_proof(fr.m_pol, 1, &arg_pr, t, to_app(aux)), m.mk_iff_oeq(m.mk_rewrite(aux, r))); } @@ -786,7 +786,7 @@ struct nnf::imp { quantifier * new_q = nullptr; proof * new_q_pr = nullptr; if (fr.m_pol) { - new_q = m.update_quantifier(q, new_patterns.size(), new_patterns.c_ptr(), new_expr); + new_q = m.update_quantifier(q, new_patterns.size(), new_patterns.data(), new_expr); if (proofs_enabled()) { new_expr_pr = m.mk_bind_proof(q, new_expr_pr); new_q_pr = m.mk_nnf_pos(q, new_q, 1, &new_expr_pr); @@ -794,7 +794,7 @@ struct nnf::imp { } else { quantifier_kind k = is_forall(q)? exists_k : forall_k; - new_q = m.update_quantifier(q, k, new_patterns.size(), new_patterns.c_ptr(), new_expr); + new_q = m.update_quantifier(q, k, new_patterns.size(), new_patterns.data(), new_expr); if (proofs_enabled()) { new_expr_pr = m.mk_bind_proof(q, new_expr_pr); new_q_pr = m.mk_nnf_neg(q, new_q, 1, &new_expr_pr); @@ -898,8 +898,8 @@ struct nnf::imp { new_def_proofs.push_back(new_pr); } } - std::reverse(new_defs.c_ptr() + old_sz1, new_defs.c_ptr() + new_defs.size()); - std::reverse(new_def_proofs.c_ptr() + old_sz2, new_def_proofs.c_ptr() + new_def_proofs.size()); + std::reverse(new_defs.data() + old_sz1, new_defs.data() + new_defs.size()); + std::reverse(new_def_proofs.data() + old_sz2, new_def_proofs.data() + new_def_proofs.size()); } }; diff --git a/src/ast/normal_forms/pull_quant.cpp b/src/ast/normal_forms/pull_quant.cpp index 3b10d5820..390d6f63b 100644 --- a/src/ast/normal_forms/pull_quant.cpp +++ b/src/ast/normal_forms/pull_quant.cpp @@ -150,9 +150,9 @@ struct pull_quant::imp { std::reverse(var_names.begin(), var_names.end()); result = m.mk_quantifier(forall_children ? forall_k : exists_k, var_sorts.size(), - var_sorts.c_ptr(), - var_names.c_ptr(), - m.mk_app(d, new_adjusted_children.size(), new_adjusted_children.c_ptr()), + var_sorts.data(), + var_names.data(), + m.mk_app(d, new_adjusted_children.size(), new_adjusted_children.data()), w, qid); return true; @@ -184,8 +184,8 @@ struct pull_quant::imp { // Remark: patterns are ignored. // See comment in reduce1_app result = m.mk_forall(var_sorts.size(), - var_sorts.c_ptr(), - var_names.c_ptr(), + var_sorts.data(), + var_names.data(), nested_q->get_expr(), std::min(q->get_weight(), nested_q->get_weight()), q->get_qid()); @@ -225,10 +225,10 @@ struct pull_quant::imp { if (new_arg != arg) proofs.push_back(m.mk_pull_quant(arg, to_quantifier(new_arg))); } - pull_quant1(to_app(n)->get_decl(), new_args.size(), new_args.c_ptr(), r); + pull_quant1(to_app(n)->get_decl(), new_args.size(), new_args.data(), r); if (m.proofs_enabled()) { - app * r1 = m.mk_app(to_app(n)->get_decl(), new_args.size(), new_args.c_ptr()); - proof * p1 = proofs.empty() ? nullptr : m.mk_congruence(to_app(n), r1, proofs.size(), proofs.c_ptr()); + app * r1 = m.mk_app(to_app(n)->get_decl(), new_args.size(), new_args.data()); + proof * p1 = proofs.empty() ? nullptr : m.mk_congruence(to_app(n), r1, proofs.size(), proofs.data()); proof * p2 = r1 == r ? nullptr : m.mk_pull_quant(r1, to_quantifier(r)); pr = m.mk_transitivity(p1, p2); } diff --git a/src/ast/pattern/expr_pattern_match.h b/src/ast/pattern/expr_pattern_match.h index 272610d4e..2fd0b4b73 100644 --- a/src/ast/pattern/expr_pattern_match.h +++ b/src/ast/pattern/expr_pattern_match.h @@ -96,10 +96,10 @@ class expr_pattern_match { args.push_back(arg); } if (m_manager.is_pattern(n)) { - result = m_manager.mk_pattern(num_args, reinterpret_cast(args.c_ptr())); + result = m_manager.mk_pattern(num_args, reinterpret_cast(args.data())); } else { - result = m_manager.mk_app(decl, num_args, args.c_ptr()); + result = m_manager.mk_app(decl, num_args, args.data()); } m_pinned.push_back(result); m_memoize.insert(n, result); diff --git a/src/ast/pattern/pattern_inference.cpp b/src/ast/pattern/pattern_inference.cpp index 03e4300b5..09f583df4 100644 --- a/src/ast/pattern/pattern_inference.cpp +++ b/src/ast/pattern/pattern_inference.cpp @@ -232,7 +232,7 @@ void pattern_inference_cfg::collect::save_candidate(expr * n, unsigned delta) { app * new_node = nullptr; if (changed) - new_node = m.mk_app(decl, buffer.size(), buffer.c_ptr()); + new_node = m.mk_app(decl, buffer.size(), buffer.data()); else new_node = to_app(n); save(n, delta, alloc(info, m, new_node, free_vars, size)); @@ -442,7 +442,7 @@ void pattern_inference_cfg::candidates2multi_patterns(unsigned max_num_patterns, for (unsigned j = 0; j < m_pre_patterns.size(); j++) { pre_pattern * curr = m_pre_patterns[j]; if (curr->m_free_vars.num_elems() == m_num_bindings) { - app * new_pattern = m.mk_pattern(curr->m_exprs.size(), curr->m_exprs.c_ptr()); + app * new_pattern = m.mk_pattern(curr->m_exprs.size(), curr->m_exprs.data()); result.push_back(new_pattern); if (result.size() >= max_num_patterns) return; @@ -601,7 +601,7 @@ bool pattern_inference_cfg::reduce_quantifier( } else { quantifier_ref tmp(m); - tmp = m.update_quantifier(q, new_patterns.size(), (expr**) new_patterns.c_ptr(), q->get_expr()); + 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";); } @@ -670,7 +670,7 @@ bool pattern_inference_cfg::reduce_quantifier( } } - quantifier_ref new_q(m.update_quantifier(q, new_patterns.size(), (expr**) new_patterns.c_ptr(), new_body), m); + quantifier_ref new_q(m.update_quantifier(q, new_patterns.size(), (expr**) new_patterns.data(), new_body), m); if (weight != q->get_weight()) new_q = m.update_quantifier_weight(new_q, weight); if (m.proofs_enabled()) { @@ -692,7 +692,7 @@ bool pattern_inference_cfg::reduce_quantifier( auto str = q->get_qid().str(); warning_msg("pulled nested quantifier to be able to find an usable pattern (quantifier id: %s)", str.c_str()); } - new_q = m.update_quantifier(result2, new_patterns.size(), (expr**) new_patterns.c_ptr(), result2->get_expr()); + new_q = m.update_quantifier(result2, new_patterns.size(), (expr**) new_patterns.data(), result2->get_expr()); 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())))); } diff --git a/src/ast/pb_decl_plugin.cpp b/src/ast/pb_decl_plugin.cpp index cb25ecad6..71722c7d0 100644 --- a/src/ast/pb_decl_plugin.cpp +++ b/src/ast/pb_decl_plugin.cpp @@ -82,7 +82,7 @@ func_decl * pb_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, p m.raise_exception("functions 'pble/pbge/pbeq' expect arity+1 integer parameters"); } } - func_decl_info info(m_family_id, k, num_parameters, params.c_ptr()); + func_decl_info info(m_family_id, k, num_parameters, params.data()); return m.mk_func_decl(sym, arity, domain, m.mk_bool_sort(), info); } default: @@ -136,9 +136,9 @@ app * pb_util::mk_le(unsigned num_args, rational const * coeffs, expr * const * } if (all_ones && k.is_unsigned() && floor(m_k).is_int32()) { m_params[0] = parameter(floor(m_k).get_int32()); - return m.mk_app(m_fid, OP_AT_MOST_K, 1, m_params.c_ptr(), num_args, args, m.mk_bool_sort()); + return m.mk_app(m_fid, OP_AT_MOST_K, 1, m_params.data(), num_args, args, m.mk_bool_sort()); } - return m.mk_app(m_fid, OP_PB_LE, m_params.size(), m_params.c_ptr(), num_args, args, m.mk_bool_sort()); + return m.mk_app(m_fid, OP_PB_LE, m_params.size(), m_params.data(), num_args, args, m.mk_bool_sort()); } app * pb_util::mk_ge(unsigned num_args, rational const * coeffs, expr * const * args, rational const& k) { @@ -152,9 +152,9 @@ app * pb_util::mk_ge(unsigned num_args, rational const * coeffs, expr * const * } if (all_ones && k.is_unsigned()) { m_params[0] = parameter(ceil(m_k).get_unsigned()); - return m.mk_app(m_fid, OP_AT_LEAST_K, 1, m_params.c_ptr(), num_args, args, m.mk_bool_sort()); + return m.mk_app(m_fid, OP_AT_LEAST_K, 1, m_params.data(), num_args, args, m.mk_bool_sort()); } - return m.mk_app(m_fid, OP_PB_GE, m_params.size(), m_params.c_ptr(), num_args, args, m.mk_bool_sort()); + return m.mk_app(m_fid, OP_PB_GE, m_params.size(), m_params.data(), num_args, args, m.mk_bool_sort()); } app * pb_util::mk_eq(unsigned num_args, rational const * coeffs, expr * const * args, rational const& k) { @@ -170,7 +170,7 @@ app * pb_util::mk_eq(unsigned num_args, rational const * coeffs, expr * const * for (unsigned i = 0; i < num_args; ++i) { m_params.push_back(parameter(m_coeffs[i])); } - return m.mk_app(m_fid, OP_PB_EQ, m_params.size(), m_params.c_ptr(), num_args, args, m.mk_bool_sort()); + return m.mk_app(m_fid, OP_PB_EQ, m_params.size(), m_params.data(), num_args, args, m.mk_bool_sort()); } // ax + by < k @@ -190,7 +190,7 @@ app * pb_util::mk_lt(unsigned num_args, rational const * _coeffs, expr * const * for (unsigned i = 0; i < num_args; ++i) { m_k += m_coeffs[i]; } - return mk_ge(num_args, m_coeffs.c_ptr(), args.c_ptr(), m_k); + return mk_ge(num_args, m_coeffs.data(), args.data(), m_k); } diff --git a/src/ast/pb_decl_plugin.h b/src/ast/pb_decl_plugin.h index 33f2f11cc..372e7b06f 100644 --- a/src/ast/pb_decl_plugin.h +++ b/src/ast/pb_decl_plugin.h @@ -90,8 +90,8 @@ public: family_id get_family_id() const { return m_fid; } app * mk_at_most_k(unsigned num_args, expr * const * args, unsigned k); app * mk_at_least_k(unsigned num_args, expr * const * args, unsigned k); - app * mk_at_most_k(expr_ref_vector const& args, unsigned k) { return mk_at_most_k(args.size(), args.c_ptr(), k); } - app * mk_at_least_k(expr_ref_vector const& args, unsigned k) { return mk_at_least_k(args.size(), args.c_ptr(), k); } + app * mk_at_most_k(expr_ref_vector const& args, unsigned k) { return mk_at_most_k(args.size(), args.data(), k); } + app * mk_at_least_k(expr_ref_vector const& args, unsigned k) { return mk_at_least_k(args.size(), args.data(), k); } app * mk_le(unsigned num_args, rational const * coeffs, expr * const * args, rational const& k); app * mk_ge(unsigned num_args, rational const * coeffs, expr * const * args, rational const& k); app * mk_eq(unsigned num_args, rational const * coeffs, expr * const * args, rational const& k); diff --git a/src/ast/proofs/proof_checker.cpp b/src/ast/proofs/proof_checker.cpp index e89dfa27f..86ef1793c 100644 --- a/src/ast/proofs/proof_checker.cpp +++ b/src/ast/proofs/proof_checker.cpp @@ -431,7 +431,7 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) { } } expr_ref rewrite_cond(m); - rewrite_cond = m.mk_or(rewrite_eq.size(), rewrite_eq.c_ptr()); + rewrite_cond = m.mk_or(rewrite_eq.size(), rewrite_eq.data()); side_conditions.push_back(rewrite_cond.get()); return true; } @@ -788,7 +788,7 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) { // SASSERT(to_quantifier(premise)->get_num_decls() == sub.size()); premise = to_quantifier(premise)->get_expr(); } - premise = vs(premise, sub.size(), sub.c_ptr()); + premise = vs(premise, sub.size(), sub.data()); } fmls.push_back(premise.get()); TRACE("proof_checker", @@ -819,7 +819,7 @@ bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) { fmls[i] = premise1; } fmls[0] = premise0; - premise0 = m.mk_or(fmls.size(), fmls.c_ptr()); + premise0 = m.mk_or(fmls.size(), fmls.data()); if (is_forall(conclusion)) { quantifier* q = to_quantifier(conclusion); premise0 = m.mk_iff(premise0, q->get_expr()); @@ -861,7 +861,7 @@ void proof_checker::set_false(expr_ref& e, unsigned position, expr_ref& lit) { args.append(a->get_num_args(), a->get_args()); lit = args[position].get(); args[position] = m.mk_false(); - e = m.mk_or(args.size(), args.c_ptr()); + e = m.mk_or(args.size(), args.data()); } else if (m.is_implies(e, body, head)) { expr* const* heads = &head; @@ -880,14 +880,14 @@ void proof_checker::set_false(expr_ref& e, unsigned position, expr_ref& lit) { args.append(num_heads, heads); lit = args[position].get(); args[position] = m.mk_false(); - e = m.mk_implies(body, m.mk_or(args.size(), args.c_ptr())); + e = m.mk_implies(body, m.mk_or(args.size(), args.data())); } else { position -= num_heads; args.append(num_bodies, bodies); lit = m.mk_not(args[position].get()); args[position] = m.mk_true(); - e = m.mk_implies(m.mk_and(args.size(), args.c_ptr()), head); + e = m.mk_implies(m.mk_and(args.size(), args.data()), head); } } else if (position == 0) { @@ -1112,7 +1112,7 @@ void proof_checker::get_hypotheses(proof* p, expr_ref_vector& ante) { } } if (all_found) { - h = mk_hyp(hyps.size(), hyps.c_ptr()); + h = mk_hyp(hyps.size(), hyps.data()); m_pinned.push_back(h); m_hypotheses.insert(p, h); stack.pop_back(); @@ -1241,7 +1241,7 @@ void proof_checker::dump_proof(proof const* pr) { SASSERT(m.has_fact(a)); antecedents.push_back(m.get_fact(a)); } - dump_proof(antecedents.size(), antecedents.c_ptr(), consequent); + dump_proof(antecedents.size(), antecedents.data(), consequent); } void proof_checker::dump_proof(unsigned num_antecedents, expr * const * antecedents, expr * consequent) { diff --git a/src/ast/proofs/proof_utils.cpp b/src/ast/proofs/proof_utils.cpp index ba00914ca..bcc1aed27 100644 --- a/src/ast/proofs/proof_utils.cpp +++ b/src/ast/proofs/proof_utils.cpp @@ -192,13 +192,13 @@ class reduce_hypotheses { compute_mark1(res); } else if (m.is_unit_resolution(p)) { // unit: reduce units; reduce the first premise; rebuild unit resolution - res = mk_unit_resolution_core(args.size(), args.c_ptr()); + res = mk_unit_resolution_core(args.size(), args.data()); compute_mark1(res); } else { // other: reduce all premises; reapply if (m.has_fact(p)) { args.push_back(to_app(m.get_fact(p))); } SASSERT(p->get_decl()->get_arity() == args.size()); - res = m.mk_app(p->get_decl(), args.size(), (expr * const*)args.c_ptr()); + res = m.mk_app(p->get_decl(), args.size(), (expr * const*)args.data()); compute_mark1(res); } @@ -238,7 +238,7 @@ class reduce_hypotheses { if (args.empty()) { return pf; } - lemma = mk_or(m, args.size(), args.c_ptr()); + lemma = mk_or(m, args.size(), args.data()); proof* res = m.mk_lemma(pf, lemma); m_pinned.push_back(res); @@ -280,10 +280,10 @@ class reduce_hypotheses { SASSERT(new_fact_cls.size() + pf_args.size() - 1 == cls.size()); expr_ref new_fact(m); - new_fact = mk_or(m, new_fact_cls.size(), new_fact_cls.c_ptr()); + new_fact = mk_or(m, new_fact_cls.size(), new_fact_cls.data()); // create new proof step - proof *res = m.mk_unit_resolution(pf_args.size(), pf_args.c_ptr(), new_fact); + proof *res = m.mk_unit_resolution(pf_args.size(), pf_args.data(), new_fact); m_pinned.push_back(res); return res; } @@ -556,7 +556,7 @@ public: clause = m_literals[0]; } else { - clause = m.mk_or(m_literals.size(), m_literals.c_ptr()); + clause = m.mk_or(m_literals.size(), m_literals.data()); } tmp = m.mk_lemma(tmp, clause); m_refs.push_back(tmp); @@ -642,7 +642,7 @@ public: if (m.is_complement(clause, m.get_fact(parents[i].get()))) { parents[1] = parents[i].get(); parents.resize(2); - result = m.mk_unit_resolution(parents.size(), parents.c_ptr()); + result = m.mk_unit_resolution(parents.size(), parents.data()); m_refs.push_back(result); add_hypotheses(result); found = true; @@ -679,7 +679,7 @@ public: result = parents[0].get(); } else { - result = m.mk_unit_resolution(parents.size(), parents.c_ptr()); + result = m.mk_unit_resolution(parents.size(), parents.data()); m_refs.push_back(result); add_hypotheses(result); } @@ -709,7 +709,7 @@ public: args.push_back(m.get_fact(p)); } if (change) { - tmp = m.mk_app(p->get_decl(), args.size(), args.c_ptr()); + tmp = m.mk_app(p->get_decl(), args.size(), args.data()); m_refs.push_back(tmp); } else { @@ -886,7 +886,7 @@ static void permute_unit_resolution(expr_ref_vector& refs, obj_map // AG: This can lead to merging of the units with other terms in interpolation, // AG: but without farkas coefficients this does not make sense prNew = m.mk_th_lemma(tid, m.get_fact(pr), - premises.size(), premises.c_ptr(), num_params-1, params+1); + premises.size(), premises.data(), num_params-1, params+1); } else { ptr_vector args; @@ -896,7 +896,7 @@ static void permute_unit_resolution(expr_ref_vector& refs, obj_map if (m.has_fact(pr)) { args.push_back(m.get_fact(pr)); } - prNew = m.mk_app(pr->get_decl(), args.size(), args.c_ptr()); + prNew = m.mk_app(pr->get_decl(), args.size(), args.data()); } cache.insert(pr, prNew); @@ -938,7 +938,7 @@ private: } instantiate(sub, conclusion); return - m.mk_hyper_resolve(premises.size(), premises.c_ptr(), conclusion, + m.mk_hyper_resolve(premises.size(), premises.data(), conclusion, positions, substs); } @@ -967,12 +967,12 @@ private: substs.push_back(sub); conclusion = m.get_fact(p); instantiate(sub, conclusion); - return m.mk_hyper_resolve(premises.size(), premises.c_ptr(), conclusion, positions, substs); + return m.mk_hyper_resolve(premises.size(), premises.data(), conclusion, positions, substs); } void compose(expr_ref_vector& sub, expr_ref_vector const& s0) { for (unsigned i = 0; i < sub.size(); ++i) { - sub[i] = var_subst(m, false)(sub[i].get(), s0.size(), s0.c_ptr()); + sub[i] = var_subst(m, false)(sub[i].get(), s0.size(), s0.data()); } } @@ -990,7 +990,7 @@ private: tout << sub.size() << "\n";); return; } - fml = var_subst(m, false)(q->get_expr(), sub.size(), sub.c_ptr()); + fml = var_subst(m, false)(q->get_expr(), sub.size(), sub.data()); } }; diff --git a/src/ast/proofs/proof_utils.h b/src/ast/proofs/proof_utils.h index 2e55be210..2e3406e10 100644 --- a/src/ast/proofs/proof_utils.h +++ b/src/ast/proofs/proof_utils.h @@ -99,7 +99,7 @@ public: ++j; } SASSERT(j >= 1); - res = j > 1 ? m.mk_or(j, args.c_ptr()) : args.get(0); + res = j > 1 ? m.mk_or(j, args.data()) : args.get(0); } void mk_app(func_decl *decl, expr_ref_vector &args, expr_ref &res) @@ -115,7 +115,7 @@ public: // we don't want (= (not a) (not b)) to be reduced to (= a b) { res = m.mk_eq(args.get(0), args.get(1)); } else - { brwr.mk_app(decl, args.size(), args.c_ptr(), res); } + { brwr.mk_app(decl, args.size(), args.data(), res); } } void operator()(ast_manager &m, proof *pr, proof_ref &res) @@ -202,7 +202,7 @@ public: } else { // rebuild unit resolution - newp = m.mk_unit_resolution(parents.size(), parents.c_ptr()); + newp = m.mk_unit_resolution(parents.size(), parents.data()); // XXX the old and new facts should be // equivalent. The test here is much // stronger. It might need to be relaxed. diff --git a/src/ast/recfun_decl_plugin.cpp b/src/ast/recfun_decl_plugin.cpp index 43455437f..fe9f84598 100644 --- a/src/ast/recfun_decl_plugin.cpp +++ b/src/ast/recfun_decl_plugin.cpp @@ -47,7 +47,7 @@ namespace recfun { m_def(d) { parameter p(case_index); func_decl_info info(fid, OP_FUN_CASE_PRED, 1, &p); - m_pred = m.mk_func_decl(symbol(name.c_str()), arg_sorts.size(), arg_sorts.c_ptr(), m.mk_bool_sort(), info); + m_pred = m.mk_func_decl(symbol(name.c_str()), arg_sorts.size(), arg_sorts.data(), m.mk_bool_sort(), info); } def::def(ast_manager &m, family_id fid, symbol const & s, @@ -505,9 +505,9 @@ namespace recfun { } symbol fresh_name("fold-rec-" + std::to_string(m().mk_fresh_id())); - auto pd = mk_def(fresh_name, n, domain.c_ptr(), max_expr->get_sort()); + auto pd = mk_def(fresh_name, n, domain.data(), max_expr->get_sort()); func_decl* f = pd.get_def()->get_decl(); - expr_ref new_body(m().mk_app(f, n, args.c_ptr()), m()); + expr_ref new_body(m().mk_app(f, n, args.data()), m()); set_definition(subst, pd, n, vars, max_expr); subst.reset(); subst.insert(max_expr, new_body); diff --git a/src/ast/recfun_decl_plugin.h b/src/ast/recfun_decl_plugin.h index 83abc7620..5a2ec9c71 100644 --- a/src/ast/recfun_decl_plugin.h +++ b/src/ast/recfun_decl_plugin.h @@ -77,12 +77,12 @@ namespace recfun { app_ref apply_case_predicate(expr_ref_vector const & args) const { ast_manager& m = m_pred.get_manager(); - return app_ref(m.mk_app(m_pred, args.size(), args.c_ptr()), m); + return app_ref(m.mk_app(m_pred, args.size(), args.data()), m); } def * get_def() const { return m_def; } expr_ref_vector const & get_guards() const { return m_guards; } - expr * get_guards_c_ptr() const { return *m_guards.c_ptr(); } + expr * get_guards_c_ptr() const { return *m_guards.data(); } expr * get_guard(unsigned i) const { return m_guards[i]; } expr * get_rhs() const { return m_rhs; } unsigned num_guards() const { return m_guards.size(); } @@ -256,11 +256,11 @@ namespace recfun { } app* mk_fun_defined(def const & d, ptr_vector const & args) { - return mk_fun_defined(d, args.size(), args.c_ptr()); + return mk_fun_defined(d, args.size(), args.data()); } app* mk_fun_defined(def const & d, expr_ref_vector const & args) { - return mk_fun_defined(d, args.size(), args.c_ptr()); + return mk_fun_defined(d, args.size(), args.data()); } func_decl_ref_vector get_rec_funs() { diff --git a/src/ast/recurse_expr_def.h b/src/ast/recurse_expr_def.h index 3a12cd31a..8c5ebac87 100644 --- a/src/ast/recurse_expr_def.h +++ b/src/ast/recurse_expr_def.h @@ -64,7 +64,7 @@ void recurse_expr::process(expr * n num = to_app(n)->get_num_args(); for (unsigned j = 0; j < num; j++) m_results1.push_back(get_cached(to_app(n)->get_arg(j))); - cache_result(n, this->Visitor::visit(to_app(n), m_results1.c_ptr())); + cache_result(n, this->Visitor::visit(to_app(n), m_results1.data())); break; case AST_VAR: cache_result(n, this->Visitor::visit(to_var(n))); @@ -82,7 +82,7 @@ void recurse_expr::process(expr * n num = to_quantifier(n)->get_num_no_patterns(); for (unsigned j = 0; j < num; j++) m_results2.push_back(get_cached(to_quantifier(n)->get_no_pattern(j))); - cache_result(n, this->Visitor::visit(to_quantifier(n), get_cached(to_quantifier(n)->get_expr()), m_results1.c_ptr(), m_results2.c_ptr())); + cache_result(n, this->Visitor::visit(to_quantifier(n), get_cached(to_quantifier(n)->get_expr()), m_results1.data(), m_results2.data())); } break; default: diff --git a/src/ast/rewriter/arith_rewriter.cpp b/src/ast/rewriter/arith_rewriter.cpp index 8741d7965..52ca18350 100644 --- a/src/ast/rewriter/arith_rewriter.cpp +++ b/src/ast/rewriter/arith_rewriter.cpp @@ -168,7 +168,7 @@ bool arith_rewriter::div_polynomial(expr * t, numeral const & g, const_treatment switch (new_args.size()) { case 0: result = m_util.mk_numeral(numeral(0), true); return true; case 1: result = new_args[0]; return true; - default: result = m_util.mk_add(new_args.size(), new_args.c_ptr()); return true; + default: result = m_util.mk_add(new_args.size(), new_args.data()); return true; } } @@ -405,7 +405,7 @@ bool arith_rewriter::elim_to_real_mon(expr * monomial, expr_ref & new_monomial) return false; new_vars.push_back(new_var); } - new_monomial = m_util.mk_mul(new_vars.size(), new_vars.c_ptr()); + new_monomial = m_util.mk_mul(new_vars.size(), new_vars.data()); return true; } else { @@ -422,7 +422,7 @@ bool arith_rewriter::elim_to_real_pol(expr * p, expr_ref & new_p) { return false; new_monomials.push_back(new_monomial); } - new_p = m_util.mk_add(new_monomials.size(), new_monomials.c_ptr()); + new_p = m_util.mk_add(new_monomials.size(), new_monomials.data()); return true; } else { @@ -496,7 +496,7 @@ expr * arith_rewriter::reduce_power(expr * arg, bool is_eq) { if (new_args.size() == 1) return new_args[0]; else - return m_util.mk_mul(new_args.size(), new_args.c_ptr()); + return m_util.mk_mul(new_args.size(), new_args.data()); } br_status arith_rewriter::reduce_power(expr * arg1, expr * arg2, op_kind kind, expr_ref & result) { @@ -724,7 +724,7 @@ expr_ref arith_rewriter::neg_monomial(expr* e) const { return expr_ref(args.back(), m()); } else { - return expr_ref(m_util.mk_mul(args.size(), args.c_ptr()), m()); + return expr_ref(m_util.mk_mul(args.size(), args.data()), m()); } } @@ -745,7 +745,7 @@ bool arith_rewriter::is_neg_poly(expr* t, expr_ref& neg) const { for (expr* e1 : *to_app(t)) { args1.push_back(neg_monomial(e1)); } - neg = m_util.mk_add(args1.size(), args1.c_ptr()); + neg = m_util.mk_add(args1.size(), args1.data()); return true; } return false; @@ -810,9 +810,9 @@ br_status arith_rewriter::mk_add_core(unsigned num_args, expr * const * args, ex } new_args.push_back(m_util.mk_numeral(am, r, false)); - br_status st = poly_rewriter::mk_add_core(new_args.size(), new_args.c_ptr(), result); + br_status st = poly_rewriter::mk_add_core(new_args.size(), new_args.data(), result); if (st == BR_FAILED) { - result = m().mk_app(get_fid(), OP_ADD, new_args.size(), new_args.c_ptr()); + result = m().mk_app(get_fid(), OP_ADD, new_args.size(), new_args.data()); return BR_DONE; } return st; @@ -859,9 +859,9 @@ br_status arith_rewriter::mk_mul_core(unsigned num_args, expr * const * args, ex } new_args.push_back(m_util.mk_numeral(am, r, false)); - br_status st = poly_rewriter::mk_mul_core(new_args.size(), new_args.c_ptr(), result); + br_status st = poly_rewriter::mk_mul_core(new_args.size(), new_args.data(), result); if (st == BR_FAILED) { - result = m().mk_app(get_fid(), OP_MUL, new_args.size(), new_args.c_ptr()); + result = m().mk_app(get_fid(), OP_MUL, new_args.size(), new_args.data()); return BR_DONE; } return st; @@ -1031,7 +1031,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.c_ptr()), arg2); + 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";); return BR_REWRITE3; @@ -1083,8 +1083,8 @@ bool arith_rewriter::divides(expr* num, expr* den, expr_ref& result) { break; } } - num = m_util.mk_mul(args1.size(), args1.c_ptr()); - den = m_util.mk_mul(args2.size(), args2.c_ptr()); + num = m_util.mk_mul(args1.size(), args1.data()); + den = m_util.mk_mul(args2.size(), args2.data()); result = m_util.mk_idiv(num, den); return true; } @@ -1099,8 +1099,8 @@ expr_ref arith_rewriter::remove_divisor(expr* arg, expr* num, expr* den) { remove_divisor(arg, args1); remove_divisor(arg, args2); expr_ref zero(m_util.mk_int(0), m()); - num = args1.empty() ? m_util.mk_int(1) : m_util.mk_mul(args1.size(), args1.c_ptr()); - den = args2.empty() ? m_util.mk_int(1) : m_util.mk_mul(args2.size(), args2.c_ptr()); + num = args1.empty() ? m_util.mk_int(1) : m_util.mk_mul(args1.size(), args1.data()); + den = args2.empty() ? m_util.mk_int(1) : m_util.mk_mul(args2.size(), args2.data()); expr_ref d(m_util.mk_idiv(num, den), m()); expr_ref nd(m_util.mk_idiv(m_util.mk_uminus(num), m_util.mk_uminus(den)), m()); return expr_ref(m().mk_ite(m().mk_eq(zero, arg), @@ -1194,7 +1194,7 @@ br_status arith_rewriter::mk_mod_core(expr * arg1, expr * arg2, expr_ref & resul if (!change) { return BR_FAILED; // did not find any target for applying simplification } - result = m_util.mk_mod(m().mk_app(to_app(arg1)->get_decl(), args.size(), args.c_ptr()), arg2); + 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";); return BR_REWRITE3; } @@ -1355,7 +1355,7 @@ br_status arith_rewriter::mk_power_core(expr * arg1, expr * arg2, expr_ref & res for (unsigned i = 0; i < k; i++) { args.push_back(arg1); } - result = ensure_real(m_util.mk_mul(args.size(), args.c_ptr())); + result = ensure_real(m_util.mk_mul(args.size(), args.data())); return BR_REWRITE2; } @@ -1468,17 +1468,17 @@ br_status arith_rewriter::mk_to_int_core(expr * arg, expr_ref & result) { return BR_FAILED; if (real_args.empty()) { - result = m().mk_app(get_fid(), to_app(arg)->get_decl()->get_decl_kind(), int_args.size(), int_args.c_ptr()); + result = m().mk_app(get_fid(), to_app(arg)->get_decl()->get_decl_kind(), int_args.size(), int_args.data()); return BR_REWRITE1; } if (!int_args.empty() && m_util.is_add(arg)) { decl_kind k = to_app(arg)->get_decl()->get_decl_kind(); - expr_ref t1(m().mk_app(get_fid(), k, int_args.size(), int_args.c_ptr()), m()); - expr_ref t2(m().mk_app(get_fid(), k, real_args.size(), real_args.c_ptr()), m()); + expr_ref t1(m().mk_app(get_fid(), k, int_args.size(), int_args.data()), m()); + expr_ref t2(m().mk_app(get_fid(), k, real_args.size(), real_args.data()), m()); int_args.reset(); int_args.push_back(t1); int_args.push_back(m_util.mk_to_int(t2)); - result = m().mk_app(get_fid(), k, int_args.size(), int_args.c_ptr()); + result = m().mk_app(get_fid(), k, int_args.size(), int_args.data()); return BR_REWRITE3; } } @@ -1498,9 +1498,9 @@ br_status arith_rewriter::mk_to_real_core(expr * arg, expr_ref & result) { for (expr* e : *to_app(arg)) new_args.push_back(m_util.mk_to_real(e)); if (m_util.is_add(arg)) - result = m().mk_app(get_fid(), OP_ADD, new_args.size(), new_args.c_ptr()); + result = m().mk_app(get_fid(), OP_ADD, new_args.size(), new_args.data()); else - result = m().mk_app(get_fid(), OP_MUL, new_args.size(), new_args.c_ptr()); + result = m().mk_app(get_fid(), OP_MUL, new_args.size(), new_args.data()); return BR_REWRITE2; } } diff --git a/src/ast/rewriter/array_rewriter.cpp b/src/ast/rewriter/array_rewriter.cpp index a85f8a430..c29bd91d7 100644 --- a/src/ast/rewriter/array_rewriter.cpp +++ b/src/ast/rewriter/array_rewriter.cpp @@ -113,7 +113,7 @@ br_status array_rewriter::mk_store_core(unsigned num_args, expr * const * args, new_args.push_back(to_app(args[0])->get_arg(0)); new_args.append(num_args-1, args+1); SASSERT(new_args.size() == num_args); - result = m().mk_app(get_fid(), OP_STORE, num_args, new_args.c_ptr()); + result = m().mk_app(get_fid(), OP_STORE, num_args, new_args.data()); return BR_DONE; } case l_false: @@ -126,11 +126,11 @@ br_status array_rewriter::mk_store_core(unsigned num_args, expr * const * args, ptr_buffer new_args; new_args.push_back(to_app(args[0])->get_arg(0)); new_args.append(num_args-1, args+1); - expr * nested_store = m().mk_app(get_fid(), OP_STORE, num_args, new_args.c_ptr()); + expr * nested_store = m().mk_app(get_fid(), OP_STORE, num_args, new_args.data()); new_args.reset(); new_args.push_back(nested_store); new_args.append(num_args - 1, to_app(args[0])->get_args() + 1); - result = m().mk_app(get_fid(), OP_STORE, num_args, new_args.c_ptr()); + result = m().mk_app(get_fid(), OP_STORE, num_args, new_args.data()); return BR_REWRITE2; } break; @@ -176,7 +176,7 @@ br_status array_rewriter::mk_select_core(unsigned num_args, expr * const * args, ptr_buffer new_args; new_args.push_back(to_app(args[0])->get_arg(0)); new_args.append(num_args-1, args+1); - result = m().mk_app(get_fid(), OP_SELECT, num_args, new_args.c_ptr()); + result = m().mk_app(get_fid(), OP_SELECT, num_args, new_args.data()); return BR_REWRITE1; } default: @@ -185,7 +185,7 @@ br_status array_rewriter::mk_select_core(unsigned num_args, expr * const * args, ptr_buffer new_args; new_args.push_back(to_app(args[0])->get_arg(0)); new_args.append(num_args-1, args+1); - expr * sel_a_j = m().mk_app(get_fid(), OP_SELECT, num_args, new_args.c_ptr()); + expr * sel_a_j = m().mk_app(get_fid(), OP_SELECT, num_args, new_args.data()); expr * v = to_app(args[0])->get_arg(num_args); ptr_buffer eqs; unsigned num_indices = num_args-1; @@ -223,7 +223,7 @@ br_status array_rewriter::mk_select_core(unsigned num_args, expr * const * args, sh(args[i], num_args-1, result); _args.push_back(result); } - result = subst(q->get_expr(), _args.size(), _args.c_ptr()); + result = subst(q->get_expr(), _args.size(), _args.data()); inv_var_shifter invsh(m()); invsh(result, _args.size(), result); return BR_REWRITE_FULL; @@ -238,9 +238,9 @@ br_status array_rewriter::mk_select_core(unsigned num_args, expr * const * args, ptr_vector args1; args1.push_back(arg); args1.append(num_args-1, args + 1); - args0.push_back(m_util.mk_select(args1.size(), args1.c_ptr())); + args0.push_back(m_util.mk_select(args1.size(), args1.data())); } - result = m().mk_app(f0, args0.size(), args0.c_ptr()); + result = m().mk_app(f0, args0.size(), args0.data()); return BR_REWRITE2; } @@ -259,7 +259,7 @@ br_status array_rewriter::mk_select_core(unsigned num_args, expr * const * args, args1.append(num_args-1, args + 1); args2.push_back(el); args2.append(num_args-1, args + 1); - result = m().mk_ite(c, m_util.mk_select(num_args, args1.c_ptr()), m_util.mk_select(num_args, args2.c_ptr())); + result = m().mk_ite(c, m_util.mk_select(num_args, args1.data()), m_util.mk_select(num_args, args2.data())); return BR_REWRITE2; } @@ -271,7 +271,7 @@ sort_ref array_rewriter::get_map_array_sort(func_decl* f, unsigned num_args, exp unsigned sz = get_array_arity(s0); ptr_vector domain; for (unsigned i = 0; i < sz; ++i) domain.push_back(get_array_domain(s0, i)); - return sort_ref(m_util.mk_array_sort(sz, domain.c_ptr(), f->get_range()), m()); + return sort_ref(m_util.mk_array_sort(sz, domain.data(), f->get_range()), m()); } br_status array_rewriter::mk_map_core(func_decl * f, unsigned num_args, expr * const * args, expr_ref & result) { @@ -317,13 +317,13 @@ br_status array_rewriter::mk_map_core(func_decl * f, unsigned num_args, expr * c } if (store_expr) { ptr_buffer new_args; - new_args.push_back(m_util.mk_map(f, arrays.size(), arrays.c_ptr())); + new_args.push_back(m_util.mk_map(f, arrays.size(), arrays.data())); new_args.append(num_indices, store_expr->get_args() + 1); - new_args.push_back(m().mk_app(f, values.size(), values.c_ptr())); - result = m().mk_app(get_fid(), OP_STORE, new_args.size(), new_args.c_ptr()); + new_args.push_back(m().mk_app(f, values.size(), values.data())); + result = m().mk_app(get_fid(), OP_STORE, new_args.size(), new_args.data()); } else { - expr_ref value(m().mk_app(f, values.size(), values.c_ptr()), m()); + expr_ref value(m().mk_app(f, values.size(), values.data()), m()); sort_ref s = get_map_array_sort(f, num_args, args); result = m_util.mk_const_array(s, value); } @@ -358,10 +358,10 @@ br_status array_rewriter::mk_map_core(func_decl * f, unsigned num_args, expr * c for (unsigned i = 0; i < n; ++i) { sel.push_back(m().mk_var(n - i - 1, lam->get_decl_sort(i))); } - args1.push_back(m_util.mk_select(sel.size(), sel.c_ptr())); + args1.push_back(m_util.mk_select(sel.size(), sel.data())); } } - result = m().mk_app(f, args1.size(), args1.c_ptr()); + result = m().mk_app(f, args1.size(), args1.data()); result = m().update_quantifier(lam, result); return BR_REWRITE3; } @@ -423,7 +423,7 @@ br_status array_rewriter::mk_map_core(func_decl * f, unsigned num_args, expr * c gs.shrink(k); if (and_change) { std::sort(gs.begin(), gs.end(), [](expr* a, expr* b) { return a->get_id() < b->get_id(); }); - expr* arg = m_util.mk_map_assoc(f, gs.size(), gs.c_ptr()); + expr* arg = m_util.mk_map_assoc(f, gs.size(), gs.data()); es[j] = m_util.mk_map(m().mk_not_decl(), 1, &arg); } } @@ -432,7 +432,7 @@ br_status array_rewriter::mk_map_core(func_decl * f, unsigned num_args, expr * c } if (change) { std::sort(es.begin(), es.end(), [](expr* a, expr* b) { return a->get_id() < b->get_id(); }); - result = m_util.mk_map_assoc(f, es.size(), es.c_ptr()); + result = m_util.mk_map_assoc(f, es.size(), es.data()); return BR_REWRITE2; } } @@ -466,7 +466,7 @@ br_status array_rewriter::mk_map_core(func_decl * f, unsigned num_args, expr * c } } if (change) { - result = m_util.mk_map_assoc(f, es.size(), es.c_ptr()); + result = m_util.mk_map_assoc(f, es.size(), es.data()); return BR_REWRITE1; } } @@ -545,9 +545,9 @@ void array_rewriter::mk_eq(expr* e, expr* lhs, expr* rhs, expr_ref_vector& fmls) args.reset(); args.push_back(lhs); args.append(args0); - mk_select(args.size(), args.c_ptr(), tmp1); + mk_select(args.size(), args.data(), tmp1); args[0] = rhs; - mk_select(args.size(), args.c_ptr(), tmp2); + mk_select(args.size(), args.data(), tmp2); fmls.push_back(m().mk_eq(tmp1, tmp2)); e = a; } @@ -686,7 +686,7 @@ expr_ref array_rewriter::expand_store(expr* s) { sh(st->get_arg(args.size()), arity, tmp); result = m().mk_ite(mk_and(eqs), tmp, result); } - result = m().mk_lambda(sorts.size(), sorts.c_ptr(), names.c_ptr(), result); + result = m().mk_lambda(sorts.size(), sorts.data(), names.data(), result); return result; } diff --git a/src/ast/rewriter/ast_counter.h b/src/ast/rewriter/ast_counter.h index 6da17047f..7f796098f 100644 --- a/src/ast/rewriter/ast_counter.h +++ b/src/ast/rewriter/ast_counter.h @@ -51,7 +51,7 @@ public: */ counter & count(unsigned sz, const unsigned * els, int delta = 1); counter & count(const unsigned_vector & els, int delta = 1) { - return count(els.size(), els.c_ptr(), delta); + return count(els.size(), els.data(), delta); } void collect_positive(uint_set & acc) const; diff --git a/src/ast/rewriter/bit2int.cpp b/src/ast/rewriter/bit2int.cpp index 8214f139f..cb845d2ba 100644 --- a/src/ast/rewriter/bit2int.cpp +++ b/src/ast/rewriter/bit2int.cpp @@ -244,7 +244,7 @@ void bit2int::visit(app* n) { m_args.push_back(get_cached(arg)); } - expr* const* args = m_args.c_ptr(); + expr* const* args = m_args.data(); bool has_b2i = m_arith_util.is_le(n) || m_arith_util.is_ge(n) || m_arith_util.is_gt(n) || diff --git a/src/ast/rewriter/bit_blaster/bit_blaster_rewriter.cpp b/src/ast/rewriter/bit_blaster/bit_blaster_rewriter.cpp index 1cc6b7461..1f220d639 100644 --- a/src/ast/rewriter/bit_blaster/bit_blaster_rewriter.cpp +++ b/src/ast/rewriter/bit_blaster/bit_blaster_rewriter.cpp @@ -209,7 +209,7 @@ struct blaster_rewriter_cfg : public default_rewriter_cfg { template app * mk_mkbv(V const & bits) { - return m().mk_app(butil().get_family_id(), OP_MKBV, bits.size(), bits.c_ptr()); + return m().mk_app(butil().get_family_id(), OP_MKBV, bits.size(), bits.data()); } void mk_const(func_decl * f, expr_ref & result) { @@ -241,7 +241,7 @@ void OP(expr * arg, expr_ref & result) { \ m_in1.reset(); \ get_bits(arg, m_in1); \ m_out.reset(); \ - m_blaster.BB_OP(m_in1.size(), m_in1.c_ptr(), m_out); \ + m_blaster.BB_OP(m_in1.size(), m_in1.data(), m_out); \ result = mk_mkbv(m_out); \ } @@ -255,7 +255,7 @@ void OP(expr * arg1, expr * arg2, expr_ref & result) { \ get_bits(arg1, m_in1); \ get_bits(arg2, m_in2); \ m_out.reset(); \ - m_blaster.BB_OP(m_in1.size(), m_in1.c_ptr(), m_in2.c_ptr(), m_out); \ + m_blaster.BB_OP(m_in1.size(), m_in1.data(), m_in2.data(), m_out); \ result = mk_mkbv(m_out); \ } @@ -294,7 +294,7 @@ void OP(expr * arg1, expr * arg2, expr_ref & result) { m_in1.reset(); m_in2.reset(); \ get_bits(arg1, m_in1); \ get_bits(arg2, m_in2); \ - m_blaster.BB_OP(m_in1.size(), m_in1.c_ptr(), m_in2.c_ptr(), result); \ + m_blaster.BB_OP(m_in1.size(), m_in1.data(), m_in2.data(), result); \ } MK_BIN_PRED_REDUCE(reduce_eq, mk_eq); @@ -309,7 +309,7 @@ void OP(expr * arg, unsigned n, expr_ref & result) { \ m_in1.reset(); \ get_bits(arg, m_in1); \ m_out.reset(); \ - m_blaster.BB_OP(m_in1.size(), m_in1.c_ptr(), n, m_out); \ + m_blaster.BB_OP(m_in1.size(), m_in1.data(), n, m_out); \ result = mk_mkbv(m_out); \ } @@ -321,7 +321,7 @@ MK_PARAMETRIC_UNARY_REDUCE(reduce_sign_extend, mk_sign_extend); get_bits(arg2, m_in1); get_bits(arg3, m_in2); m_out.reset(); - m_blaster.mk_multiplexer(arg1, m_in1.size(), m_in1.c_ptr(), m_in2.c_ptr(), m_out); + m_blaster.mk_multiplexer(arg1, m_in1.size(), m_in1.data(), m_in2.data(), m_out); result = mk_mkbv(m_out); } @@ -332,7 +332,7 @@ MK_PARAMETRIC_UNARY_REDUCE(reduce_sign_extend, mk_sign_extend); i--; m_in1.reset(); get_bits(args[i], m_in1); - m_out.append(m_in1.size(), m_in1.c_ptr()); + m_out.append(m_in1.size(), m_in1.data()); } result = mk_mkbv(m_out); } @@ -657,7 +657,7 @@ MK_PARAMETRIC_UNARY_REDUCE(reduce_sign_extend, mk_sign_extend); new_decl_names.push_back(n); } } - result = m().mk_quantifier(old_q->get_kind(), new_decl_sorts.size(), new_decl_sorts.c_ptr(), new_decl_names.c_ptr(), + result = m().mk_quantifier(old_q->get_kind(), new_decl_sorts.size(), new_decl_sorts.data(), new_decl_names.data(), new_body, old_q->get_weight(), old_q->get_qid(), old_q->get_skid(), old_q->get_num_patterns(), new_patterns, old_q->get_num_no_patterns(), new_no_patterns); result_pr = nullptr; 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 43cae35f0..aee8a12cf 100644 --- a/src/ast/rewriter/bit_blaster/bit_blaster_tpl_def.h +++ b/src/ast/rewriter/bit_blaster/bit_blaster_tpl_def.h @@ -325,7 +325,7 @@ void bit_blaster_tpl::mk_multiplier(unsigned sz, expr * const * a_bits, exp expr_ref_vector & carry_bits = pps[save_inx+1]; SASSERT(sum_bits.empty() && carry_bits.empty()); carry_bits.push_back(zero); - mk_carry_save_adder(pp1.size(), pp1.c_ptr(), pp2.c_ptr(), pp3.c_ptr(), sum_bits, carry_bits); + mk_carry_save_adder(pp1.size(), pp1.data(), pp2.data(), pp3.data(), sum_bits, carry_bits); carry_bits.pop_back(); save_inx += 2; } @@ -345,7 +345,7 @@ void bit_blaster_tpl::mk_multiplier(unsigned sz, expr * const * a_bits, exp SASSERT(pps.size() == 2); // Now there are only two numbers to add, we can use a ripple carry adder here. - mk_adder(sz, pps[0].c_ptr(), pps[1].c_ptr(), out_bits); + mk_adder(sz, pps[0].data(), pps[1].data(), out_bits); } } @@ -368,7 +368,7 @@ void bit_blaster_tpl::mk_umul_no_overflow(unsigned sz, expr * const * a_bit // mk_multiplier will simplify output taking into account that // the most significant bits of ext_a_bits and ext_b_bits are zero. // - mk_multiplier(1 + sz, ext_a_bits.c_ptr(), ext_b_bits.c_ptr(), mult_cout); + mk_multiplier(1 + sz, ext_a_bits.data(), ext_b_bits.data(), mult_cout); expr_ref overflow1(m()), overflow2(m()), overflow(m()); // // ignore bits [0, sz-1] of mult_cout @@ -403,7 +403,7 @@ void bit_blaster_tpl::mk_smul_no_overflow_core(unsigned sz, expr * const * SASSERT(ext_a_bits.size() == 1 + sz); SASSERT(ext_b_bits.size() == 1 + sz); expr_ref_vector mult_cout(m()); - mk_multiplier(1 + sz, ext_a_bits.c_ptr(), ext_b_bits.c_ptr(), mult_cout); + mk_multiplier(1 + sz, ext_a_bits.data(), ext_b_bits.data(), mult_cout); expr_ref overflow1(m()), overflow2(m()), overflow(m()); // @@ -478,7 +478,7 @@ void bit_blaster_tpl::mk_udiv_urem(unsigned sz, expr * const * a_bits, expr // generate p - b expr_ref q(m()); t.reset(); - mk_subtracter(sz, p.c_ptr(), b_bits, t, q); + mk_subtracter(sz, p.data(), b_bits, t, q); q_bits.set(sz - i - 1, q); // update p @@ -549,7 +549,7 @@ void bit_blaster_tpl::mk_abs(unsigned sz, expr * const * a_bits, expr_ref_v else { expr_ref_vector neg_a_bits(m()); mk_neg(sz, a_bits, neg_a_bits); - mk_multiplexer(a_msb, sz, neg_a_bits.c_ptr(), a_bits, out_bits); + mk_multiplexer(a_msb, sz, neg_a_bits.data(), a_bits, out_bits); } } @@ -584,7 +584,7 @@ void bit_blaster_tpl::mk_sdiv_srem_smod(unsigned sz, expr * const * a_bits, } if (!m().is_false(a_msb) && !m().is_true(b_msb)) { - mk_udiv_urem(sz, neg_a_bits.c_ptr(), b_bits, np_q, np_r); + mk_udiv_urem(sz, neg_a_bits.data(), b_bits, np_q, np_r); } else { np_q.resize(sz, m().mk_false()); @@ -592,7 +592,7 @@ void bit_blaster_tpl::mk_sdiv_srem_smod(unsigned sz, expr * const * a_bits, } if (!m().is_true(a_msb) && !m().is_false(b_msb)) { - mk_udiv_urem(sz, a_bits, neg_b_bits.c_ptr(), pn_q, pn_r); + mk_udiv_urem(sz, a_bits, neg_b_bits.data(), pn_q, pn_r); } else { pn_q.resize(sz, m().mk_false()); @@ -600,7 +600,7 @@ void bit_blaster_tpl::mk_sdiv_srem_smod(unsigned sz, expr * const * a_bits, } if (!m().is_false(a_msb) && !m().is_false(b_msb)) { - mk_udiv_urem(sz, neg_a_bits.c_ptr(), neg_b_bits.c_ptr(), nn_q, nn_r); + mk_udiv_urem(sz, neg_a_bits.data(), neg_b_bits.data(), nn_q, nn_r); } else { nn_q.resize(sz, m().mk_false()); @@ -615,19 +615,19 @@ void bit_blaster_tpl::mk_sdiv_srem_smod(unsigned sz, expr * const * a_bits, expr_ref_vector & nn_out = nn_q; if (!m().is_false(a_msb) && !m().is_true(b_msb)) - mk_neg(sz, np_q.c_ptr(), np_out); + mk_neg(sz, np_q.data(), np_out); else np_out.resize(sz, m().mk_false()); if (!m().is_true(a_msb) && !m().is_false(b_msb)) - mk_neg(sz, pn_q.c_ptr(), pn_out); + mk_neg(sz, pn_q.data(), pn_out); else pn_out.resize(sz, m().mk_false()); #define MK_MULTIPLEXER() \ - mk_multiplexer(b_msb, sz, nn_out.c_ptr(), np_out.c_ptr(), ite1); \ - mk_multiplexer(b_msb, sz, pn_out.c_ptr(), pp_out.c_ptr(), ite2); \ - mk_multiplexer(a_msb, sz, ite1.c_ptr(), ite2.c_ptr(), out_bits) + mk_multiplexer(b_msb, sz, nn_out.data(), np_out.data(), ite1); \ + mk_multiplexer(b_msb, sz, pn_out.data(), pp_out.data(), ite2); \ + mk_multiplexer(a_msb, sz, ite1.data(), ite2.data(), out_bits) MK_MULTIPLEXER(); } @@ -638,12 +638,12 @@ void bit_blaster_tpl::mk_sdiv_srem_smod(unsigned sz, expr * const * a_bits, expr_ref_vector nn_out(m()); if (!m().is_false(a_msb) && !m().is_true(b_msb)) - mk_neg(sz, np_r.c_ptr(), np_out); + mk_neg(sz, np_r.data(), np_out); else np_out.resize(sz, m().mk_false()); if (!m().is_false(a_msb) && !m().is_false(b_msb)) - mk_neg(sz, nn_r.c_ptr(), nn_out); + mk_neg(sz, nn_r.data(), nn_out); else nn_out.resize(sz, m().mk_false()); MK_MULTIPLEXER(); @@ -657,18 +657,18 @@ void bit_blaster_tpl::mk_sdiv_srem_smod(unsigned sz, expr * const * a_bits, if (!m().is_false(a_msb) && !m().is_true(b_msb)) { expr_ref cout(m()); - mk_subtracter(sz, b_bits, np_r.c_ptr(), np_out, cout); + mk_subtracter(sz, b_bits, np_r.data(), np_out, cout); } else np_out.resize(sz, m().mk_false()); if (!m().is_true(a_msb) && !m().is_false(b_msb)) - mk_adder(sz, b_bits, pn_r.c_ptr(), pn_out); + mk_adder(sz, b_bits, pn_r.data(), pn_out); else pn_out.resize(sz, m().mk_false()); if (!m().is_false(a_msb) && !m().is_false(b_msb)) - mk_neg(sz, nn_r.c_ptr(), nn_out); + mk_neg(sz, nn_r.data(), nn_out); else nn_out.resize(sz, m().mk_false()); @@ -687,22 +687,22 @@ void bit_blaster_tpl::mk_sdiv(unsigned sz, expr * const * a_bits, expr * co expr_ref_vector neg_b_bits(m()); mk_neg(sz, b_bits, neg_b_bits); expr_ref_vector tmp(m()); - mk_udiv(sz, a_bits, neg_b_bits.c_ptr(), tmp); - mk_neg(sz, tmp.c_ptr(), out_bits); + mk_udiv(sz, a_bits, neg_b_bits.data(), tmp); + mk_neg(sz, tmp.data(), out_bits); } else if (m().is_true(a_msb) && m().is_false(b_msb)) { expr_ref_vector neg_a_bits(m()); mk_neg(sz, a_bits, neg_a_bits); expr_ref_vector tmp(m()); - mk_udiv(sz, neg_a_bits.c_ptr(), b_bits, tmp); - mk_neg(sz, tmp.c_ptr(), out_bits); + mk_udiv(sz, neg_a_bits.data(), b_bits, tmp); + mk_neg(sz, tmp.data(), out_bits); } else if (m().is_true(a_msb) && m().is_true(b_msb)) { expr_ref_vector neg_a_bits(m()); mk_neg(sz, a_bits, neg_a_bits); expr_ref_vector neg_b_bits(m()); mk_neg(sz, b_bits, neg_b_bits); - mk_udiv(sz, neg_a_bits.c_ptr(), neg_b_bits.c_ptr(), out_bits); + mk_udiv(sz, neg_a_bits.data(), neg_b_bits.data(), out_bits); } else { #if 0 @@ -715,12 +715,12 @@ void bit_blaster_tpl::mk_sdiv(unsigned sz, expr * const * a_bits, expr * co mk_abs(sz, a_bits, abs_a_bits); mk_abs(sz, b_bits, abs_b_bits); expr_ref_vector udiv_bits(m()); - mk_udiv(sz, abs_a_bits.c_ptr(), abs_b_bits.c_ptr(), udiv_bits); + mk_udiv(sz, abs_a_bits.data(), abs_b_bits.data(), udiv_bits); expr_ref_vector neg_udiv_bits(m()); - mk_neg(sz, udiv_bits.c_ptr(), neg_udiv_bits); + mk_neg(sz, udiv_bits.data(), neg_udiv_bits); expr_ref c(m()); mk_iff(a_msb, b_msb, c); - mk_multiplexer(c, sz, udiv_bits.c_ptr(), neg_udiv_bits.c_ptr(), out_bits); + mk_multiplexer(c, sz, udiv_bits.data(), neg_udiv_bits.data(), out_bits); #endif } } @@ -735,14 +735,14 @@ void bit_blaster_tpl::mk_srem(unsigned sz, expr * const * a_bits, expr * co else if (m().is_false(a_msb) && m().is_true(b_msb)) { expr_ref_vector neg_b_bits(m()); mk_neg(sz, b_bits, neg_b_bits); - mk_urem(sz, a_bits, neg_b_bits.c_ptr(), out_bits); + mk_urem(sz, a_bits, neg_b_bits.data(), out_bits); } else if (m().is_true(a_msb) && m().is_false(b_msb)) { expr_ref_vector neg_a_bits(m()); mk_neg(sz, a_bits, neg_a_bits); expr_ref_vector tmp(m()); - mk_urem(sz, neg_a_bits.c_ptr(), b_bits, tmp); - mk_neg(sz, tmp.c_ptr(), out_bits); + mk_urem(sz, neg_a_bits.data(), b_bits, tmp); + mk_neg(sz, tmp.data(), out_bits); } else if (m().is_true(a_msb) && m().is_true(b_msb)) { expr_ref_vector neg_a_bits(m()); @@ -750,8 +750,8 @@ void bit_blaster_tpl::mk_srem(unsigned sz, expr * const * a_bits, expr * co expr_ref_vector neg_b_bits(m()); mk_neg(sz, b_bits, neg_b_bits); expr_ref_vector tmp(m()); - mk_urem(sz, neg_a_bits.c_ptr(), neg_b_bits.c_ptr(), tmp); - mk_neg(sz, tmp.c_ptr(), out_bits); + mk_urem(sz, neg_a_bits.data(), neg_b_bits.data(), tmp); + mk_neg(sz, tmp.data(), out_bits); } else { #if 0 @@ -767,14 +767,14 @@ void bit_blaster_tpl::mk_srem(unsigned sz, expr * const * a_bits, expr * co numeral n_b; unsigned shift; // a urem 2^n -> a & ((2^n)-1) - if (is_numeral(sz, abs_b_bits.c_ptr(), n_b) && n_b.is_power_of_two(shift)) { - mk_zero_extend(shift, abs_a_bits.c_ptr(), sz - shift, urem_bits); + if (is_numeral(sz, abs_b_bits.data(), n_b) && n_b.is_power_of_two(shift)) { + mk_zero_extend(shift, abs_a_bits.data(), sz - shift, urem_bits); } else { - mk_urem(sz, abs_a_bits.c_ptr(), abs_b_bits.c_ptr(), urem_bits); + mk_urem(sz, abs_a_bits.data(), abs_b_bits.data(), urem_bits); } expr_ref_vector neg_urem_bits(m()); - mk_neg(sz, urem_bits.c_ptr(), neg_urem_bits); - mk_multiplexer(a_msb, sz, neg_urem_bits.c_ptr(), urem_bits.c_ptr(), out_bits); + mk_neg(sz, urem_bits.data(), neg_urem_bits); + mk_multiplexer(a_msb, sz, neg_urem_bits.data(), urem_bits.data(), out_bits); #endif } } @@ -816,17 +816,17 @@ void bit_blaster_tpl::mk_smod(unsigned sz, expr * const * a_bits, expr * co mk_abs(sz, a_bits, abs_a_bits); mk_abs(sz, b_bits, abs_b_bits); expr_ref_vector u_bits(m()); - mk_urem(sz, abs_a_bits.c_ptr(), abs_b_bits.c_ptr(), u_bits); + mk_urem(sz, abs_a_bits.data(), abs_b_bits.data(), u_bits); expr_ref_vector neg_u_bits(m()); - mk_neg(sz, u_bits.c_ptr(), neg_u_bits); + mk_neg(sz, u_bits.data(), neg_u_bits); expr_ref_vector neg_u_add_b(m()); - mk_adder(sz, neg_u_bits.c_ptr(), b_bits, neg_u_add_b); + mk_adder(sz, neg_u_bits.data(), b_bits, neg_u_add_b); expr_ref_vector u_add_b(m()); - mk_adder(sz, u_bits.c_ptr(), b_bits, u_add_b); + mk_adder(sz, u_bits.data(), b_bits, u_add_b); expr_ref_vector zero(m()); num2bits(numeral(0), sz, zero); expr_ref u_eq_0(m()); - mk_eq(sz, u_bits.c_ptr(), zero.c_ptr(), u_eq_0); + mk_eq(sz, u_bits.data(), zero.data(), u_eq_0); expr_ref_vector & pp_bits = u_bits; // pos & pos case expr_ref_vector & pn_bits = u_add_b; // pos & neg case @@ -836,10 +836,10 @@ void bit_blaster_tpl::mk_smod(unsigned sz, expr * const * a_bits, expr * co expr_ref_vector ite1(m()); expr_ref_vector ite2(m()); expr_ref_vector body(m()); - mk_multiplexer(b_msb, sz, nn_bits.c_ptr(), np_bits.c_ptr(), ite1); - mk_multiplexer(b_msb, sz, pn_bits.c_ptr(), pp_bits.c_ptr(), ite2); - mk_multiplexer(a_msb, sz, ite1.c_ptr(), ite2.c_ptr(), body); - mk_multiplexer(u_eq_0, sz, u_bits.c_ptr(), body.c_ptr(), out_bits); + mk_multiplexer(b_msb, sz, nn_bits.data(), np_bits.data(), ite1); + mk_multiplexer(b_msb, sz, pn_bits.data(), pp_bits.data(), ite2); + mk_multiplexer(a_msb, sz, ite1.data(), ite2.data(), body); + mk_multiplexer(u_eq_0, sz, u_bits.data(), body.data(), out_bits); } @@ -850,7 +850,7 @@ void bit_blaster_tpl::mk_eq(unsigned sz, expr * const * a_bits, expr * cons mk_iff(a_bits[i], b_bits[i], out); out_bits.push_back(out); } - mk_and(out_bits.size(), out_bits.c_ptr(), out); + mk_and(out_bits.size(), out_bits.data(), out); } template @@ -910,7 +910,7 @@ void bit_blaster_tpl::mk_is_eq(unsigned sz, expr * const * a_bits, unsigned } n = n / 2; } - mk_and(out_bits.size(), out_bits.c_ptr(), out); + mk_and(out_bits.size(), out_bits.data(), out); } /** @@ -1078,8 +1078,8 @@ void bit_blaster_tpl::mk_ext_rotate_left_right(unsigned sz, expr * const * expr_ref_vector eqs(m()); numeral sz_numeral(sz); num2bits(sz_numeral, sz, sz_bits); - mk_urem(sz, b_bits, sz_bits.c_ptr(), masked_b_bits); - mk_eqs(sz, masked_b_bits.c_ptr(), eqs); + mk_urem(sz, b_bits, sz_bits.data(), masked_b_bits); + mk_eqs(sz, masked_b_bits.data(), eqs); for (unsigned i = 0; i < sz; i++) { checkpoint(); expr_ref out(m()); @@ -1237,8 +1237,8 @@ void bit_blaster_tpl::mk_const_case_multiplier(bool is_a, unsigned i, unsig else { numeral n_a, n_b; SASSERT(i == sz && !is_a); - VERIFY(is_numeral(sz, a_bits.c_ptr(), n_a)); - VERIFY(is_numeral(sz, b_bits.c_ptr(), n_b)); + VERIFY(is_numeral(sz, a_bits.data(), n_a)); + VERIFY(is_numeral(sz, b_bits.data(), n_b)); n_a *= n_b; num2bits(n_a, sz, out_bits); } @@ -1274,12 +1274,12 @@ bool bit_blaster_tpl::mk_const_multiplier(unsigned sz, expr * const * a_bit tmp.reset(); if (now && !last) { - mk_adder(sz - i, out_bits.c_ptr() + i, minus_b_bits.c_ptr(), tmp); + mk_adder(sz - i, out_bits.data() + i, minus_b_bits.data(), tmp); for (unsigned j = 0; j < (sz - i); j++) out_bits.set(i+j, tmp.get(j)); // do not use [], it does not work on Linux. } else if (!now && last) { - mk_adder(sz - i, out_bits.c_ptr() + i, b_bits, tmp); + mk_adder(sz - i, out_bits.data() + i, b_bits, tmp); for (unsigned j = 0; j < (sz - i); j++) out_bits.set(i+j, tmp.get(j)); // do not use [], it does not work on Linux. } diff --git a/src/ast/rewriter/bool_rewriter.cpp b/src/ast/rewriter/bool_rewriter.cpp index dc512aa56..b60310476 100644 --- a/src/ast/rewriter/bool_rewriter.cpp +++ b/src/ast/rewriter/bool_rewriter.cpp @@ -80,7 +80,7 @@ void bool_rewriter::mk_and_as_or(unsigned num_args, expr * const * args, expr_re new_args.push_back(tmp); } expr_ref tmp(m()); - mk_or(new_args.size(), new_args.c_ptr(), tmp); + mk_or(new_args.size(), new_args.data(), tmp); mk_not(tmp, result); } @@ -173,7 +173,7 @@ br_status bool_rewriter::mk_flat_and_core(unsigned num_args, expr * const * args flat_args.push_back(arg); } } - if (mk_nflat_and_core(flat_args.size(), flat_args.c_ptr(), result) == BR_FAILED) + if (mk_nflat_and_core(flat_args.size(), flat_args.data(), result) == BR_FAILED) result = m().mk_and(flat_args); return BR_DONE; } @@ -245,13 +245,13 @@ br_status bool_rewriter::mk_nflat_or_core(unsigned num_args, expr * const * args return BR_DONE; default: if (m_local_ctx && m_local_ctx_cost <= m_local_ctx_limit) { - if (local_ctx_simp(sz, buffer.c_ptr(), result)) + if (local_ctx_simp(sz, buffer.data(), result)) return BR_DONE; } if (s) { ast_lt lt; std::sort(buffer.begin(), buffer.end(), lt); - result = m().mk_or(sz, buffer.c_ptr()); + result = m().mk_or(sz, buffer.data()); return BR_DONE; } return BR_FAILED; @@ -285,7 +285,7 @@ br_status bool_rewriter::mk_flat_or_core(unsigned num_args, expr * const * args, prev = arg; } } - if (mk_nflat_or_core(flat_args.size(), flat_args.c_ptr(), result) == BR_FAILED) { + if (mk_nflat_or_core(flat_args.size(), flat_args.data(), result) == BR_FAILED) { if (!ordered) { ast_lt lt; std::sort(flat_args.begin(), flat_args.end(), lt); @@ -595,7 +595,7 @@ bool bool_rewriter::local_ctx_simp(unsigned num_args, expr * const * args, expr_ return false; // didn't simplify } // preserve the original order... - std::reverse(new_args.c_ptr(), new_args.c_ptr() + new_args.size()); + std::reverse(new_args.data(), new_args.data() + new_args.size()); modified = false; forward = true; } @@ -604,7 +604,7 @@ bool bool_rewriter::local_ctx_simp(unsigned num_args, expr * const * args, expr_ old_args.reset(); old_args.swap(new_args); SASSERT(new_args.empty()); - args = old_args.c_ptr(); + args = old_args.data(); num_args = old_args.size(); } } diff --git a/src/ast/rewriter/bool_rewriter.h b/src/ast/rewriter/bool_rewriter.h index 268f4f04c..621858d31 100644 --- a/src/ast/rewriter/bool_rewriter.h +++ b/src/ast/rewriter/bool_rewriter.h @@ -161,12 +161,12 @@ public: } expr_ref mk_or(expr_ref_vector const& args) { expr_ref result(m()); - mk_or(args.size(), args.c_ptr(), result); + mk_or(args.size(), args.data(), result); return result; } expr_ref mk_and(expr_ref_vector const& args) { expr_ref result(m()); - mk_and(args.size(), args.c_ptr(), result); + mk_and(args.size(), args.data(), result); return result; } diff --git a/src/ast/rewriter/bv_bounds.cpp b/src/ast/rewriter/bv_bounds.cpp index 989d96d25..c2ee35f71 100644 --- a/src/ast/rewriter/bv_bounds.cpp +++ b/src/ast/rewriter/bv_bounds.cpp @@ -323,8 +323,8 @@ br_status bv_bounds::rewrite(unsigned limit, func_decl * f, unsigned num, expr * switch (nargs.size()) { case 0: result = negated ? m_m.mk_false() : m_m.mk_true(); return BR_DONE; case 1: result = nargs.get(0); return BR_DONE; - default: result = negated ? m_m.mk_or(nargs.size(), nargs.c_ptr()) - : m_m.mk_and(nargs.size(), nargs.c_ptr()); + default: result = negated ? m_m.mk_or(nargs.size(), nargs.data()) + : m_m.mk_and(nargs.size(), nargs.data()); return BR_DONE; } } diff --git a/src/ast/rewriter/bv_elim.cpp b/src/ast/rewriter/bv_elim.cpp index 898bc39f2..811e3ab6b 100644 --- a/src/ast/rewriter/bv_elim.cpp +++ b/src/ast/rewriter/bv_elim.cpp @@ -58,7 +58,7 @@ bool bv_elim_cfg::reduce_quantifier(quantifier * q, _sorts.push_back(m.mk_bool_sort()); _names.push_back(symbol(new_name.str())); } - bv = m.mk_app(bfid, OP_MKBV, 0, nullptr, args.size(), args.c_ptr()); + bv = m.mk_app(bfid, OP_MKBV, 0, nullptr, args.size(), args.data()); _subst_map.push_back(bv.get()); } else { @@ -84,7 +84,7 @@ bool bv_elim_cfg::reduce_quantifier(quantifier * q, subst_map.push_back(_subst_map[i]); } - expr* const* sub = subst_map.c_ptr(); + expr* const* sub = subst_map.data(); unsigned sub_size = subst_map.size(); new_body = subst(old_body, sub_size, sub); @@ -98,14 +98,14 @@ bool bv_elim_cfg::reduce_quantifier(quantifier * q, result = m.mk_quantifier(forall_k, names.size(), - sorts.c_ptr(), - names.c_ptr(), + sorts.data(), + names.data(), new_body.get(), q->get_weight(), q->get_qid(), q->get_skid(), - pats.size(), pats.c_ptr(), - no_pats.size(), no_pats.c_ptr()); + pats.size(), pats.data(), + no_pats.size(), no_pats.data()); result_pr = m.mk_rewrite(q, result); return true; } diff --git a/src/ast/rewriter/bv_rewriter.cpp b/src/ast/rewriter/bv_rewriter.cpp index 1543ab1a2..6caef9a93 100644 --- a/src/ast/rewriter/bv_rewriter.cpp +++ b/src/ast/rewriter/bv_rewriter.cpp @@ -374,7 +374,7 @@ br_status bv_rewriter::rw_leq_concats(bool is_signed, expr * _a, expr * _b, expr ptr_buffer new_args; new_args.push_back(mk_numeral(af, af_sz - sz_min)); for (unsigned i = 1; i < numa; ++i) new_args.push_back(a->get_arg(i)); - new_a = concat(new_args.size(), new_args.c_ptr()); + new_a = concat(new_args.size(), new_args.data()); } else { new_a = concat(numa - 1, a->get_args() + 1); } @@ -382,7 +382,7 @@ br_status bv_rewriter::rw_leq_concats(bool is_signed, expr * _a, expr * _b, expr ptr_buffer new_args; new_args.push_back(mk_numeral(bf, bf_sz - sz_min)); for (unsigned i = 1; i < numb; ++i) new_args.push_back(b->get_arg(i)); - new_b = concat(new_args.size(), new_args.c_ptr()); + new_b = concat(new_args.size(), new_args.data()); } else { new_b = concat(numb - 1, b->get_args() + 1); } @@ -659,7 +659,7 @@ unsigned bv_rewriter::propagate_extract(unsigned high, expr * arg, expr_ref & re new_concat_args.push_back(new_first); for (unsigned j = 1; j < conc_num; ++j) new_concat_args.push_back(to_app(curr)->get_arg(j)); - new_arg = m_util.mk_concat(new_concat_args.size(), new_concat_args.c_ptr()); + new_arg = m_util.mk_concat(new_concat_args.size(), new_concat_args.data()); } else { // remove first element of concat expr * const * const old_conc_args = to_app(curr)->get_args(); @@ -675,7 +675,7 @@ unsigned bv_rewriter::propagate_extract(unsigned high, expr * arg, expr_ref & re } if (new_arg) new_args.push_back(new_arg); } - result = m().mk_app(get_fid(), a->get_decl()->get_decl_kind(), new_args.size(), new_args.c_ptr()); + result = m().mk_app(get_fid(), a->get_decl()->get_decl_kind(), new_args.size(), new_args.data()); SASSERT(m_util.is_bv(result)); return removable; } @@ -755,11 +755,11 @@ br_status bv_rewriter::mk_extract(unsigned high, unsigned low, expr * arg, expr_ } if (idx == low) { new_args.push_back(curr); - result = m_util.mk_concat(new_args.size(), new_args.c_ptr()); + result = m_util.mk_concat(new_args.size(), new_args.data()); return used_extract ? BR_REWRITE2 : BR_DONE; } new_args.push_back(m_mk_extract(curr_sz - 1, low - idx, curr)); - result = m_util.mk_concat(new_args.size(), new_args.c_ptr()); + result = m_util.mk_concat(new_args.size(), new_args.data()); return BR_REWRITE2; } UNREACHABLE(); @@ -779,7 +779,7 @@ br_status bv_rewriter::mk_extract(unsigned high, unsigned low, expr * arg, expr_ expr * curr = to_app(arg)->get_arg(i); new_args.push_back(m_mk_extract(high, low, curr)); } - result = m().mk_app(get_fid(), to_app(arg)->get_decl()->get_decl_kind(), new_args.size(), new_args.c_ptr()); + result = m().mk_app(get_fid(), to_app(arg)->get_decl()->get_decl_kind(), new_args.size(), new_args.data()); return BR_REWRITE2; } @@ -1415,19 +1415,19 @@ br_status bv_rewriter::mk_bv2int(expr * arg, expr_ref & result) { args[i] = std::move(tmp); sz += get_bv_size(to_app(arg)->get_arg(i)); } - result = m_autil.mk_add(args.size(), args.c_ptr()); + result = m_autil.mk_add(args.size(), args.data()); return BR_REWRITE2; } if (is_mul_no_overflow(arg)) { expr_ref_vector args(m()); for (expr* x : *to_app(arg)) args.push_back(m_util.mk_bv2int(x)); - result = m_autil.mk_mul(args.size(), args.c_ptr()); + result = m_autil.mk_mul(args.size(), args.data()); return BR_REWRITE2; } if (is_add_no_overflow(arg)) { expr_ref_vector args(m()); for (expr* x : *to_app(arg)) args.push_back(m_util.mk_bv2int(x)); - result = m_autil.mk_add(args.size(), args.c_ptr()); + result = m_autil.mk_add(args.size(), args.data()); return BR_REWRITE2; } @@ -1528,7 +1528,7 @@ br_status bv_rewriter::mk_concat(unsigned num_args, expr * const * args, expr_re result = new_args.back(); return fused_extract ? BR_REWRITE1 : BR_DONE; } - result = m_util.mk_concat(new_args.size(), new_args.c_ptr()); + result = m_util.mk_concat(new_args.size(), new_args.data()); if (fused_extract) return BR_REWRITE2; else if (expanded) @@ -1574,7 +1574,7 @@ br_status bv_rewriter::mk_sign_extend(unsigned n, expr * arg, expr_ref & result) for (unsigned i = 0; i < n; i++) args.push_back(sign); args.push_back(arg); - result = m_util.mk_concat(args.size(), args.c_ptr()); + result = m_util.mk_concat(args.size(), args.data()); return BR_REWRITE2; } @@ -1589,7 +1589,7 @@ br_status bv_rewriter::mk_repeat(unsigned n, expr * arg, expr_ref & result) { ptr_buffer args; for (unsigned i = 0; i < n; i++) args.push_back(arg); - result = m_util.mk_concat(args.size(), args.c_ptr()); + result = m_util.mk_concat(args.size(), args.data()); return BR_REWRITE1; } @@ -1617,7 +1617,7 @@ br_status bv_rewriter::mk_bv_or(unsigned num, expr * const * args, expr_ref & re if (flat_args.size() != num) { flattened = true; num = flat_args.size(); - args = flat_args.c_ptr(); + args = flat_args.data(); } } @@ -1696,7 +1696,7 @@ br_status bv_rewriter::mk_bv_or(unsigned num, expr * const * args, expr_ref & re if (j != high) non_zero_args.push_back(m_mk_extract(high, j+1, concat1)); } - result = m_util.mk_concat(non_zero_args.size(), non_zero_args.c_ptr()); + result = m_util.mk_concat(non_zero_args.size(), non_zero_args.data()); return BR_REWRITE2; } } @@ -1732,7 +1732,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.c_ptr()); + result = m_util.mk_concat(exs.size(), exs.data()); TRACE("mask_bug", tout << "(assert (distinct (bvor (_ bv" << old_v1 << " " << sz << ")\n" << mk_ismt2_pp(t, m()) << ")\n"; tout << mk_ismt2_pp(result, m()) << "))\n";); @@ -1757,10 +1757,10 @@ br_status bv_rewriter::mk_bv_or(unsigned num, expr * const * args, expr_ref & re default: if (m_bv_sort_ac) std::sort(new_args.begin(), new_args.end(), ast_to_lt()); - if (distribute_concat(OP_BOR, new_args.size(), new_args.c_ptr(), result)) { + if (distribute_concat(OP_BOR, new_args.size(), new_args.data(), result)) { return BR_REWRITE3; } - result = m_util.mk_bv_or(new_args.size(), new_args.c_ptr()); + result = m_util.mk_bv_or(new_args.size(), new_args.data()); return BR_DONE; } } @@ -1789,7 +1789,7 @@ br_status bv_rewriter::mk_bv_xor(unsigned num, expr * const * args, expr_ref & r if (flat_args.size() != num) { flattened = true; num = flat_args.size(); - args = flat_args.c_ptr(); + args = flat_args.data(); } } @@ -1877,11 +1877,11 @@ br_status bv_rewriter::mk_bv_xor(unsigned num, expr * const * args, expr_ref & r low = i; } } - std::reverse(exs.c_ptr(), exs.c_ptr() + exs.size()); + std::reverse(exs.data(), exs.data() + exs.size()); if (exs.size() == 1) result = exs[0]; else - result = m_util.mk_concat(exs.size(), exs.c_ptr()); + result = m_util.mk_concat(exs.size(), exs.data()); return BR_REWRITE3; } @@ -1933,10 +1933,10 @@ br_status bv_rewriter::mk_bv_xor(unsigned num, expr * const * args, expr_ref & r default: if (m_bv_sort_ac) std::sort(new_args.begin(), new_args.end(), ast_to_lt()); - if (distribute_concat(OP_BXOR, new_args.size(), new_args.c_ptr(), result)) { + if (distribute_concat(OP_BXOR, new_args.size(), new_args.data(), result)) { return BR_REWRITE3; } - result = m_util.mk_bv_xor(new_args.size(), new_args.c_ptr()); + result = m_util.mk_bv_xor(new_args.size(), new_args.data()); return BR_DONE; } } @@ -1953,8 +1953,8 @@ bool bv_rewriter::distribute_concat(decl_kind k, unsigned n, expr* const* args, args1.push_back(m_mk_extract(sz2 - 1, sz2 - sz1, args[j])); args2.push_back(m_mk_extract(sz2 - sz1 - 1, 0, args[j])); } - expr* arg1 = m().mk_app(get_fid(), k, args1.size(), args1.c_ptr()); - expr* arg2 = m().mk_app(get_fid(), k, args2.size(), args2.c_ptr()); + expr* arg1 = m().mk_app(get_fid(), k, args1.size(), args1.data()); + expr* arg2 = m().mk_app(get_fid(), k, args2.size(), args2.data()); result = m_util.mk_concat(arg1, arg2); return true; } @@ -1981,7 +1981,7 @@ br_status bv_rewriter::mk_bv_not(expr * arg, expr_ref & result) { for (expr* a : *to_app(arg)) { new_args.push_back(m_util.mk_bv_not(a)); } - result = m_util.mk_concat(new_args.size(), new_args.c_ptr()); + result = m_util.mk_concat(new_args.size(), new_args.data()); return BR_REWRITE2; } @@ -2017,7 +2017,7 @@ br_status bv_rewriter::mk_bv_and(unsigned num, expr * const * args, expr_ref & r new_args.push_back(m_util.mk_bv_not(args[i])); } SASSERT(num == new_args.size()); - result = m_util.mk_bv_not(m_util.mk_bv_or(new_args.size(), new_args.c_ptr())); + result = m_util.mk_bv_not(m_util.mk_bv_or(new_args.size(), new_args.data())); return BR_REWRITE3; } @@ -2026,7 +2026,7 @@ br_status bv_rewriter::mk_bv_nand(unsigned num, expr * const * args, expr_ref & for (unsigned i = 0; i < num; i++) { new_args.push_back(m_util.mk_bv_not(args[i])); } - result = m_util.mk_bv_or(new_args.size(), new_args.c_ptr()); + result = m_util.mk_bv_or(new_args.size(), new_args.data()); return BR_REWRITE2; } diff --git a/src/ast/rewriter/datatype_rewriter.cpp b/src/ast/rewriter/datatype_rewriter.cpp index 4196a5051..97818ce82 100644 --- a/src/ast/rewriter/datatype_rewriter.cpp +++ b/src/ast/rewriter/datatype_rewriter.cpp @@ -88,7 +88,7 @@ br_status datatype_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr new_args.push_back(a->get_arg(i)); } } - result = m().mk_app(c_decl, num, new_args.c_ptr()); + result = m().mk_app(c_decl, num, new_args.data()); return BR_DONE; } default: @@ -137,6 +137,6 @@ br_status datatype_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & resul for (unsigned i = 0; i < num; ++i) { eqs.push_back(m().mk_eq(to_app(lhs)->get_arg(i), to_app(rhs)->get_arg(i))); } - result = m().mk_and(eqs.size(), eqs.c_ptr()); + result = m().mk_and(eqs.size(), eqs.data()); return BR_REWRITE2; } diff --git a/src/ast/rewriter/der.cpp b/src/ast/rewriter/der.cpp index fdc75e652..e2c4ecf2a 100644 --- a/src/ast/rewriter/der.cpp +++ b/src/ast/rewriter/der.cpp @@ -319,7 +319,7 @@ void der::create_substitution(unsigned sz) { expr_ref cur(m_map.get(m_order[i]), m); // do all the previous substitutions before inserting - expr_ref r = m_subst(cur, m_subst_map.size(), m_subst_map.c_ptr()); + expr_ref r = m_subst(cur, m_subst_map.size(), m_subst_map.data()); unsigned inx = sz - m_order[i]- 1; SASSERT(m_subst_map[inx]==0); @@ -343,22 +343,22 @@ void der::apply_substitution(quantifier * q, expr_ref & r) { unsigned sz = m_new_args.size(); expr_ref t(m); - t = (sz == 1) ? m_new_args[0] : m.mk_or(sz, m_new_args.c_ptr()); - expr_ref new_e = m_subst(t, m_subst_map.size(), m_subst_map.c_ptr()); + t = (sz == 1) ? m_new_args[0] : m.mk_or(sz, m_new_args.data()); + expr_ref new_e = m_subst(t, m_subst_map.size(), m_subst_map.data()); // don't forget to update the quantifier patterns expr_ref_buffer new_patterns(m); expr_ref_buffer new_no_patterns(m); for (unsigned j = 0; j < q->get_num_patterns(); j++) { - new_patterns.push_back(m_subst(q->get_pattern(j), m_subst_map.size(), m_subst_map.c_ptr())); + new_patterns.push_back(m_subst(q->get_pattern(j), m_subst_map.size(), m_subst_map.data())); } for (unsigned j = 0; j < q->get_num_no_patterns(); j++) { - new_no_patterns.push_back(m_subst(q->get_no_pattern(j), m_subst_map.size(), m_subst_map.c_ptr())); + new_no_patterns.push_back(m_subst(q->get_no_pattern(j), m_subst_map.size(), m_subst_map.data())); } - r = m.update_quantifier(q, new_patterns.size(), new_patterns.c_ptr(), - new_no_patterns.size(), new_no_patterns.c_ptr(), new_e); + r = m.update_quantifier(q, new_patterns.size(), new_patterns.data(), + new_no_patterns.size(), new_no_patterns.data(), new_e); } diff --git a/src/ast/rewriter/distribute_forall.cpp b/src/ast/rewriter/distribute_forall.cpp index c621579cb..6a6056227 100644 --- a/src/ast/rewriter/distribute_forall.cpp +++ b/src/ast/rewriter/distribute_forall.cpp @@ -92,7 +92,7 @@ void distribute_forall::reduce1_app(app * a) { } if (reduced) { - na = m_manager.mk_app(a->get_decl(), num_args, m_new_args.c_ptr()); + na = m_manager.mk_app(a->get_decl(), num_args, m_new_args.data()); } cache_result(a, na); @@ -131,7 +131,7 @@ void distribute_forall::reduce1_quantifier(quantifier * q) { expr_ref result(m_manager); // m_bsimp.mk_and actually constructs a (not (or ...)) formula, // it will also apply basic simplifications. - br.mk_and(new_args.size(), new_args.c_ptr(), result); + br.mk_and(new_args.size(), new_args.data(), result); cache_result(q, result); } else { diff --git a/src/ast/rewriter/elim_bounds.cpp b/src/ast/rewriter/elim_bounds.cpp index 02d3217cf..de23537ad 100644 --- a/src/ast/rewriter/elim_bounds.cpp +++ b/src/ast/rewriter/elim_bounds.cpp @@ -189,7 +189,7 @@ bool elim_bounds_cfg::reduce_quantifier(quantifier * q, new_body = atoms[0]; break; default: - new_body = m.mk_or(atoms.size(), atoms.c_ptr()); + new_body = m.mk_or(atoms.size(), atoms.data()); break; } quantifier_ref new_q(m); diff --git a/src/ast/rewriter/enum2bv_rewriter.cpp b/src/ast/rewriter/enum2bv_rewriter.cpp index 74fbff1c9..a8171c230 100644 --- a/src/ast/rewriter/enum2bv_rewriter.cpp +++ b/src/ast/rewriter/enum2bv_rewriter.cpp @@ -94,7 +94,7 @@ struct enum2bv_rewriter::imp { return BR_DONE; } else if (m.is_distinct(f) && reduce_args(num, args, _args)) { - result = m.mk_distinct(_args.size(), _args.c_ptr()); + result = m.mk_distinct(_args.size(), _args.data()); return BR_DONE; } else if (m_dt.is_recognizer(f) && reduce_arg(args[0], a0)) { @@ -229,7 +229,7 @@ struct enum2bv_rewriter::imp { break; } } - result = m.mk_quantifier(q->get_kind(), q->get_num_decls(), m_sorts.c_ptr(), q->get_decl_names(), new_body_ref, + result = m.mk_quantifier(q->get_kind(), q->get_num_decls(), m_sorts.data(), q->get_decl_names(), new_body_ref, q->get_weight(), q->get_qid(), q->get_skid(), q->get_num_patterns(), new_patterns, q->get_num_no_patterns(), new_no_patterns); diff --git a/src/ast/rewriter/expr_safe_replace.cpp b/src/ast/rewriter/expr_safe_replace.cpp index 8f9321dbf..c4b940522 100644 --- a/src/ast/rewriter/expr_safe_replace.cpp +++ b/src/ast/rewriter/expr_safe_replace.cpp @@ -159,7 +159,7 @@ void expr_safe_replace::operator()(expr* e, expr_ref& res) { } replace(q->get_expr(), new_body); } - b = m.update_quantifier(q, pats.size(), pats.c_ptr(), nopats.size(), nopats.c_ptr(), new_body); + b = m.update_quantifier(q, pats.size(), pats.data(), nopats.size(), nopats.data(), new_body); m_refs.push_back(b); cached = b; m_todo.pop_back(); diff --git a/src/ast/rewriter/factor_rewriter.cpp b/src/ast/rewriter/factor_rewriter.cpp index fe93d6253..8fbce55f6 100644 --- a/src/ast/rewriter/factor_rewriter.cpp +++ b/src/ast/rewriter/factor_rewriter.cpp @@ -62,7 +62,7 @@ br_status factor_rewriter::mk_eq(expr * arg1, expr * arg2, expr_ref & result) { expr* e = it->m_key; eqs.push_back(m().mk_eq(e, a().mk_numeral(rational(0), e->get_sort()))); } - result = m().mk_or(eqs.size(), eqs.c_ptr()); + result = m().mk_or(eqs.size(), eqs.data()); return BR_DONE; } @@ -86,7 +86,7 @@ br_status factor_rewriter::mk_le(expr * arg1, expr * arg2, expr_ref & result) { expr_ref_vector eqs(m()); mk_is_negative(neg, eqs); eqs.push_back(neg); - result = m().mk_or(eqs.size(), eqs.c_ptr()); + result = m().mk_or(eqs.size(), eqs.data()); TRACE("factor_rewriter", tout << mk_pp(arg1, m()) << " <= " << mk_pp(arg2, m()) << "\n"; tout << mk_pp(result.get(), m()) << "\n";); @@ -115,7 +115,7 @@ br_status factor_rewriter::mk_lt(expr * arg1, expr * arg2, expr_ref & result) { eqs[i] = m().mk_not(eqs[i].get()); } eqs.push_back(neg); - result = m().mk_and(eqs.size(), eqs.c_ptr()); + result = m().mk_and(eqs.size(), eqs.data()); TRACE("factor_rewriter", tout << mk_pp(result.get(), m()) << "\n";); return BR_DONE; } @@ -254,7 +254,7 @@ bool factor_rewriter::extract_factors() { SASSERT(!m_muls.empty()); if (m_muls.size() == 1) { if (m_muls[0].size() > 1) { - m_factors.append(m_muls[0].size(), m_muls[0].c_ptr()); + m_factors.append(m_muls[0].size(), m_muls[0].data()); if (!m_adds[0].second) { bool found_numeral = false; sort* s = m_muls[0][0]->get_sort(); @@ -311,7 +311,7 @@ bool factor_rewriter::extract_factors() { e = m_muls[i][0]; break; default: - e = a().mk_mul(m_muls[i].size(), m_muls[i].c_ptr()); + e = a().mk_mul(m_muls[i].size(), m_muls[i].data()); break; } if (!m_adds[i].second) { @@ -326,7 +326,7 @@ bool factor_rewriter::extract_factors() { m_factors.push_back(trail[0].get()); break; default: - m_factors.push_back(a().mk_add(trail.size(), trail.c_ptr())); + m_factors.push_back(a().mk_add(trail.size(), trail.data())); break; } TRACE("factor_rewriter", diff --git a/src/ast/rewriter/func_decl_replace.cpp b/src/ast/rewriter/func_decl_replace.cpp index 3fbdb2470..512a831af 100644 --- a/src/ast/rewriter/func_decl_replace.cpp +++ b/src/ast/rewriter/func_decl_replace.cpp @@ -51,7 +51,7 @@ expr_ref func_decl_replace::operator()(expr* e) { } if (m_args.size() == n) { if (arg_differs) { - b = m.mk_app(c->get_decl(), m_args.size(), m_args.c_ptr()); + b = m.mk_app(c->get_decl(), m_args.size(), m_args.data()); m_refs.push_back(b); SASSERT(a->get_sort() == b->get_sort()); } else { @@ -59,7 +59,7 @@ expr_ref func_decl_replace::operator()(expr* e) { } func_decl* f = nullptr; if (m_subst.find(c->get_decl(), f)) { - b = m.mk_app(f, m_args.size(), m_args.c_ptr()); + b = m.mk_app(f, m_args.size(), m_args.data()); m_refs.push_back(b); } m_cache.insert(a, b); diff --git a/src/ast/rewriter/inj_axiom.cpp b/src/ast/rewriter/inj_axiom.cpp index d24315d88..bdf784230 100644 --- a/src/ast/rewriter/inj_axiom.cpp +++ b/src/ast/rewriter/inj_axiom.cpp @@ -107,7 +107,7 @@ bool simplify_inj_axiom(ast_manager & m, quantifier * q, expr_ref & result) { } } SASSERT(var != 0); - app * f = m.mk_app(decl, f_args.size(), f_args.c_ptr()); + app * f = m.mk_app(decl, f_args.size(), f_args.data()); ptr_vector domain; inv_vars.push_back(f); @@ -115,9 +115,9 @@ bool simplify_inj_axiom(ast_manager & m, quantifier * q, expr_ref & result) { domain.push_back(inv_vars[i]->get_sort()); } sort * d = decl->get_domain(idx); - func_decl * inv_decl = m.mk_fresh_func_decl("inj", domain.size(), domain.c_ptr(), d); + func_decl * inv_decl = m.mk_fresh_func_decl("inj", domain.size(), domain.data(), d); - expr * proj = m.mk_app(inv_decl, inv_vars.size(), inv_vars.c_ptr()); + expr * proj = m.mk_app(inv_decl, inv_vars.size(), inv_vars.data()); expr * eq = m.mk_eq(proj, var); expr * p = m.mk_pattern(f); @@ -125,7 +125,7 @@ bool simplify_inj_axiom(ast_manager & m, quantifier * q, expr_ref & result) { // Remark: the sort of the var 0 must be in the last position. std::reverse(decls.begin(), decls.end()); - result = m.mk_forall(decls.size(), decls.c_ptr(), names.c_ptr(), eq, + 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";); SASSERT(is_well_sorted(m, result)); diff --git a/src/ast/rewriter/pb2bv_rewriter.cpp b/src/ast/rewriter/pb2bv_rewriter.cpp index ee3f8f8b6..5e4e2aa28 100644 --- a/src/ast/rewriter/pb2bv_rewriter.cpp +++ b/src/ast/rewriter/pb2bv_rewriter.cpp @@ -156,7 +156,7 @@ struct pb2bv_rewriter::imp { //sort_args(); gcd_reduce(m_coeffs, k); unsigned sz = m_args.size(); - expr * const* args = m_args.c_ptr(); + expr * const* args = m_args.data(); TRACE("pb", for (unsigned i = 0; i < sz; ++i) { tout << m_coeffs[i] << "*" << mk_pp(args[i], m) << " "; @@ -277,7 +277,7 @@ struct pb2bv_rewriter::imp { rational bound; flip(sz, args, args1, _k, bound); if (bound.get_unsigned() < k) { - return mk_ge_tot(sz, args1.c_ptr(), bound, result); + return mk_ge_tot(sz, args1.data(), bound, result); } if (k > 20) { return false; @@ -295,7 +295,7 @@ struct pb2bv_rewriter::imp { rational bound; flip(sz, args, args1, _k, bound); if (bound.get_unsigned() < k) { - return mk_le_tot(sz, args1.c_ptr(), bound, result); + return mk_le_tot(sz, args1.data(), bound, result); } if (k > 20) { return false; @@ -519,7 +519,7 @@ struct pb2bv_rewriter::imp { tout << "\n"; ); ptr_vector out; - m_sort.sorting(carry.size(), carry.c_ptr(), out); + m_sort.sorting(carry.size(), carry.data(), out); expr_ref gt = mod_ge(out, B, d_i + 1); expr_ref ge = mod_ge(out, B, d_i); @@ -557,13 +557,13 @@ struct pb2bv_rewriter::imp { } switch (is_le) { case l_true: - result = m_sort.le(k.get_unsigned(), coeffs.size(), coeffs.c_ptr(), m_args.c_ptr()); + result = m_sort.le(k.get_unsigned(), coeffs.size(), coeffs.data(), m_args.data()); break; case l_false: - result = m_sort.ge(k.get_unsigned(), coeffs.size(), coeffs.c_ptr(), m_args.c_ptr()); + result = m_sort.ge(k.get_unsigned(), coeffs.size(), coeffs.data(), m_args.data()); break; case l_undef: - result = m_sort.eq(k.get_unsigned(), coeffs.size(), coeffs.c_ptr(), m_args.c_ptr()); + result = m_sort.eq(k.get_unsigned(), coeffs.size(), coeffs.data(), m_args.data()); break; } return result; @@ -588,7 +588,7 @@ struct pb2bv_rewriter::imp { expr_ref mk_seg_le(rational const& k) { sort_args(); unsigned sz = m_args.size(); - expr* const* args = m_args.c_ptr(); + expr* const* args = m_args.data(); // Create sorted entries. vector> outs; @@ -661,7 +661,7 @@ struct pb2bv_rewriter::imp { args1.push_back(mk_not(args[i])); bound += m_coeffs[i]; } - return mk_ge(sz, args1.c_ptr(), bound, result); + return mk_ge(sz, args1.data(), bound, result); } bool mk_eq(unsigned sz, expr * const* args, rational const& k, expr_ref& result) { diff --git a/src/ast/rewriter/pb_rewriter.cpp b/src/ast/rewriter/pb_rewriter.cpp index d24c38e10..2f06710ff 100644 --- a/src/ast/rewriter/pb_rewriter.cpp +++ b/src/ast/rewriter/pb_rewriter.cpp @@ -96,7 +96,7 @@ expr_ref pb_rewriter::translate_pb2lia(obj_map& vars, expr* fml) { tmp = a.mk_numeral(rational(0), true); } else { - tmp = a.mk_add(es.size(), es.c_ptr()); + tmp = a.mk_add(es.size(), es.data()); } if (util.is_at_most_k(fml)) { result = a.mk_le(tmp, a.mk_numeral(util.get_k(fml), false)); @@ -113,7 +113,7 @@ expr_ref pb_rewriter::translate_pb2lia(obj_map& vars, expr* fml) { tmp = a.mk_numeral(rational(0), true); } else { - tmp = a.mk_add(es.size(), es.c_ptr()); + tmp = a.mk_add(es.size(), es.data()); } rational k = util.get_k(fml); if (util.is_le(fml)) { @@ -172,7 +172,7 @@ expr_ref pb_rewriter::mk_validate_rewrite(app_ref& e1, app_ref& e2) { expr_ref fml2 = translate_pb2lia(vars, e2); tmp = m.mk_not(m.mk_eq(fml1, fml2)); fmls.push_back(tmp); - tmp = m.mk_and(fmls.size(), fmls.c_ptr()); + tmp = m.mk_and(fmls.size(), fmls.data()); return tmp; } @@ -267,23 +267,23 @@ br_status pb_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * cons result = k.is_zero()?m.mk_true():m.mk_false(); } else if (k.is_zero()) { - result = mk_not(m, mk_or(m, sz, m_args.c_ptr())); + result = mk_not(m, mk_or(m, sz, m_args.data())); } else if (k.is_one() && all_unit && m_args.size() == 1) { result = m_args.back(); } else if (slack == k) { - result = mk_and(m, sz, m_args.c_ptr()); + result = mk_and(m, sz, m_args.data()); } else { - result = m_util.mk_eq(sz, m_coeffs.c_ptr(), m_args.c_ptr(), k); + result = m_util.mk_eq(sz, m_coeffs.data(), m_args.data(), k); } } else if (all_unit && k.is_one() && sz < 10) { - result = mk_or(m, sz, m_args.c_ptr()); + result = mk_or(m, sz, m_args.data()); } else if (all_unit && k == rational(sz)) { - result = mk_and(m, sz, m_args.c_ptr()); + result = mk_and(m, sz, m_args.data()); } else { expr_ref_vector conj(m), disj(m); @@ -309,7 +309,7 @@ br_status pb_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * cons m_coeffs.shrink(j); sz = j; if (sz > 0) { - disj.push_back(m_util.mk_ge(sz, m_coeffs.c_ptr(), m_args.c_ptr(), k)); + disj.push_back(m_util.mk_ge(sz, m_coeffs.data(), m_args.data(), k)); } if (!disj.empty()) { conj.push_back(mk_or(disj)); diff --git a/src/ast/rewriter/poly_rewriter_def.h b/src/ast/rewriter/poly_rewriter_def.h index 0f2c2fc79..b9ac64749 100644 --- a/src/ast/rewriter/poly_rewriter_def.h +++ b/src/ast/rewriter/poly_rewriter_def.h @@ -116,9 +116,9 @@ expr * poly_rewriter::mk_mul_app(unsigned num_args, expr * const * args) else { numeral a; if (new_args.size() > 2 && is_numeral(new_args.get(0), a)) { - return mk_mul_app(a, mk_mul_app(new_args.size() - 1, new_args.c_ptr() + 1)); + return mk_mul_app(a, mk_mul_app(new_args.size() - 1, new_args.data() + 1)); } - return m().mk_app(get_fid(), mul_decl_kind(), new_args.size(), new_args.c_ptr()); + return m().mk_app(get_fid(), mul_decl_kind(), new_args.size(), new_args.data()); } } else { @@ -185,7 +185,7 @@ br_status poly_rewriter::mk_flat_mul_core(unsigned num_args, expr * cons flat_args.push_back(args[j]); } } - br_status st = mk_nflat_mul_core(flat_args.size(), flat_args.c_ptr(), result); + br_status st = mk_nflat_mul_core(flat_args.size(), flat_args.data(), result); TRACE("poly_rewriter", tout << "flat mul:\n"; for (unsigned i = 0; i < num_args; i++) tout << mk_bounded_pp(args[i], m()) << "\n"; @@ -194,7 +194,7 @@ br_status poly_rewriter::mk_flat_mul_core(unsigned num_args, expr * cons tout << st << "\n"; ); if (st == BR_FAILED) { - result = mk_mul_app(flat_args.size(), flat_args.c_ptr()); + result = mk_mul_app(flat_args.size(), flat_args.data()); return BR_DONE; } return st; @@ -290,7 +290,7 @@ br_status poly_rewriter::mk_nflat_mul_core(unsigned num_args, expr * con for (unsigned i = 0; i < num; i++) { 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.c_ptr()); + result = mk_add_app(new_add_args.size(), new_add_args.data()); TRACE("mul_bug", tout << "result: " << mk_bounded_pp(result, m(),5) << "\n";); return BR_REWRITE2; } @@ -303,7 +303,7 @@ br_status poly_rewriter::mk_nflat_mul_core(unsigned num_args, expr * con m_args.push_back(args[i]); } } - result = mk_mul_app(c, mk_mul_app(m_args.size(), m_args.c_ptr())); + result = mk_mul_app(c, mk_mul_app(m_args.size(), m_args.data())); return BR_REWRITE2; } @@ -344,7 +344,7 @@ br_status poly_rewriter::mk_nflat_mul_core(unsigned num_args, expr * con tout << "\n";); } SASSERT(new_args.size() >= 2); - result = mk_mul_app(new_args.size(), new_args.c_ptr()); + result = mk_mul_app(new_args.size(), new_args.data()); result = mk_mul_app(c, result); TRACE("poly_rewriter", for (unsigned i = 0; i < num_args; ++i) @@ -387,10 +387,10 @@ br_status poly_rewriter::mk_nflat_mul_core(unsigned num_args, expr * con expr * arg = v[it[i]]; m_args.push_back(arg); } - sum.push_back(mk_mul_app(m_args.size(), m_args.c_ptr())); + sum.push_back(mk_mul_app(m_args.size(), m_args.data())); } - while (product_iterator_next(szs.size(), szs.c_ptr(), it.c_ptr())); - result = mk_add_app(sum.size(), sum.c_ptr()); + while (product_iterator_next(szs.size(), szs.data(), it.data())); + result = mk_add_app(sum.size(), sum.data()); return BR_REWRITE2; } @@ -417,9 +417,9 @@ br_status poly_rewriter::mk_flat_add_core(unsigned num_args, expr * cons flat_args.push_back(arg); } } - br_status st = mk_nflat_add_core(flat_args.size(), flat_args.c_ptr(), result); + br_status st = mk_nflat_add_core(flat_args.size(), flat_args.data(), result); if (st == BR_FAILED) { - result = mk_add_app(flat_args.size(), flat_args.c_ptr()); + result = mk_add_app(flat_args.size(), flat_args.data()); return BR_DONE; } return st; @@ -616,11 +616,11 @@ 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";); if (c.is_zero()) - std::sort(new_args.c_ptr(), new_args.c_ptr() + new_args.size(), mon_lt(*this)); + std::sort(new_args.data(), new_args.data() + new_args.size(), mon_lt(*this)); else - std::sort(new_args.c_ptr() + 1, new_args.c_ptr() + new_args.size(), mon_lt(*this)); + std::sort(new_args.data() + 1, new_args.data() + new_args.size(), mon_lt(*this)); } - result = mk_add_app(new_args.size(), new_args.c_ptr()); + result = mk_add_app(new_args.size(), new_args.data()); TRACE("rewriter", tout << result << "\n";); if (hoist_multiplication(result)) { return BR_REWRITE_FULL; @@ -649,11 +649,11 @@ br_status poly_rewriter::mk_nflat_add_core(unsigned num_args, expr * con } if (!ordered) { if (c.is_zero()) - std::sort(new_args.c_ptr(), new_args.c_ptr() + new_args.size(), lt); + std::sort(new_args.data(), new_args.data() + new_args.size(), lt); else - std::sort(new_args.c_ptr() + 1, new_args.c_ptr() + new_args.size(), lt); + std::sort(new_args.data() + 1, new_args.data() + new_args.size(), lt); } - result = mk_add_app(new_args.size(), new_args.c_ptr()); + result = mk_add_app(new_args.size(), new_args.data()); if (hoist_multiplication(result)) { return BR_REWRITE_FULL; } @@ -697,7 +697,7 @@ br_status poly_rewriter::mk_sub(unsigned num_args, expr * const * args, expr * aux_args[2] = { minus_one, args[i] }; new_args.push_back(mk_mul_app(2, aux_args)); } - result = mk_add_app(new_args.size(), new_args.c_ptr()); + result = mk_add_app(new_args.size(), new_args.data()); return BR_REWRITE2; } @@ -878,8 +878,8 @@ br_status poly_rewriter::cancel_monomials(expr * lhs, expr * rhs, bool m const unsigned rhs_offset = insert_c_rhs ? 0 : 1; new_rhs_monomials[0] = insert_c_rhs ? mk_numeral(c) : nullptr; 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.c_ptr() + lhs_offset); - rhs_result = mk_add_app(new_rhs_monomials.size() - rhs_offset, new_rhs_monomials.c_ptr() + rhs_offset); + 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";); return BR_DONE; } @@ -938,7 +938,7 @@ bool poly_rewriter::hoist_multiplication(expr_ref& som) { return false; } - som = mk_add_app(adds.size(), adds.c_ptr()); + som = mk_add_app(adds.size(), adds.data()); return true; @@ -968,13 +968,13 @@ expr* poly_rewriter::merge_muls(expr* x, expr* y) { SASSERT(k > 0); SASSERT(m1.size() >= k); SASSERT(m2.size() >= k); - expr* args[2] = { mk_mul_app(m1.size()-k, m1.c_ptr()+k), - mk_mul_app(m2.size()-k, m2.c_ptr()+k) }; + expr* args[2] = { mk_mul_app(m1.size()-k, m1.data()+k), + mk_mul_app(m2.size()-k, m2.data()+k) }; if (k == m1.size()) { m1.push_back(0); } m1[k] = mk_add_app(2, args); - return mk_mul_app(k+1, m1.c_ptr()); + return mk_mul_app(k+1, m1.data()); } template @@ -999,7 +999,7 @@ bool poly_rewriter::hoist_ite(expr_ref& e) { bs.push_back(apply_hoist(a, g, shared)); if (is_nontrivial_gcd(g)) { bs.push_back(mk_numeral(g)); - bs[0] = mk_mul_app(2, bs.c_ptr()); + bs[0] = mk_mul_app(2, bs.data()); bs.pop_back(); } else { @@ -1007,7 +1007,7 @@ bool poly_rewriter::hoist_ite(expr_ref& e) { bs.push_back(s); } } - expr* a2 = mk_add_app(bs.size(), bs.c_ptr()); + expr* a2 = mk_add_app(bs.size(), bs.data()); if (a != a2) { adds[i] = a2; pinned.push_back(a2); @@ -1017,7 +1017,7 @@ bool poly_rewriter::hoist_ite(expr_ref& e) { ++i; } if (!pinned.empty()) { - e = mk_add_app(adds.size(), adds.c_ptr()); + e = mk_add_app(adds.size(), adds.data()); return true; } return false; @@ -1080,7 +1080,7 @@ expr* poly_rewriter::apply_hoist(expr* a, numeral const& g, obj_hashtabl } } adds.shrink(i); - return mk_add_app(adds.size(), adds.c_ptr()); + return mk_add_app(adds.size(), adds.data()); } @@ -1139,6 +1139,6 @@ bool poly_rewriter::is_var_plus_ground(expr * n, bool & inv, var * & v, if (v == nullptr) return false; // did not find variable SASSERT(!args.empty()); - mk_add(args.size(), args.c_ptr(), t); + mk_add(args.size(), args.data(), t); return true; } diff --git a/src/ast/rewriter/quant_hoist.cpp b/src/ast/rewriter/quant_hoist.cpp index 127b18a45..c200ccc49 100644 --- a/src/ast/rewriter/quant_hoist.cpp +++ b/src/ast/rewriter/quant_hoist.cpp @@ -78,7 +78,7 @@ public: : m.mk_const (sym, s); vars.push_back(a); } - expr * const * exprs = (expr* const*) (vars.c_ptr() + vars.size()- nd); + expr * const * exprs = (expr* const*) (vars.data() + vars.size()- nd); result = instantiate(m, q, exprs); } @@ -215,10 +215,10 @@ private: args.push_back(tmp); } if (rewrite_ok) { - m_rewriter.mk_and(args.size(), args.c_ptr(), result); + m_rewriter.mk_and(args.size(), args.data(), result); } else { - result = m.mk_and (args.size (), args.c_ptr ()); + result = m.mk_and (args.size (), args.data ()); } } else if (m.is_or(fml)) { @@ -228,10 +228,10 @@ private: args.push_back(tmp); } if (rewrite_ok) { - m_rewriter.mk_or(args.size(), args.c_ptr(), result); + m_rewriter.mk_or(args.size(), args.data(), result); } else { - result = m.mk_or (args.size (), args.c_ptr ()); + result = m.mk_or (args.size (), args.data ()); } } else if (m.is_not(fml)) { diff --git a/src/ast/rewriter/rewriter.cpp b/src/ast/rewriter/rewriter.cpp index 4c9933998..3b25b9409 100644 --- a/src/ast/rewriter/rewriter.cpp +++ b/src/ast/rewriter/rewriter.cpp @@ -275,7 +275,7 @@ void var_shifter_core::process_app(app * t, frame & fr) { SASSERT(fr.m_spos + num_args == m_result_stack.size()); expr * new_t; if (fr.m_new_child) { - expr * const * new_args = m_result_stack.c_ptr() + fr.m_spos; + expr * const * new_args = m_result_stack.data() + fr.m_spos; new_t = m().mk_app(t->get_decl(), num_args, new_args); } else { @@ -305,7 +305,7 @@ void var_shifter_core::process_quantifier(quantifier * q, frame & fr) { SASSERT(fr.m_spos + num_children == m_result_stack.size()); expr * new_q; if (fr.m_new_child) { - expr * const * it = m_result_stack.c_ptr() + fr.m_spos; + expr * const * it = m_result_stack.data() + fr.m_spos; expr * new_expr = *it; ++it; expr * const * new_pats = it; diff --git a/src/ast/rewriter/rewriter_def.h b/src/ast/rewriter/rewriter_def.h index 154fb6c1c..7cf62eb83 100644 --- a/src/ast/rewriter/rewriter_def.h +++ b/src/ast/rewriter/rewriter_def.h @@ -284,7 +284,7 @@ void rewriter_tpl::process_app(app * t, frame & fr) { } unsigned new_num_args = result_stack().size() - fr.m_spos; - expr * const * new_args = result_stack().c_ptr() + fr.m_spos; + expr * const * new_args = result_stack().data() + fr.m_spos; app_ref new_t(m()); if (ProofGen) { elim_reflex_prs(fr.m_spos); @@ -295,7 +295,7 @@ void rewriter_tpl::process_app(app * t, frame & fr) { } else { new_t = m().mk_app(f, new_num_args, new_args); - m_pr = m().mk_congruence(t, new_t, num_prs, result_pr_stack().c_ptr() + fr.m_spos); + m_pr = m().mk_congruence(t, new_t, num_prs, result_pr_stack().data() + fr.m_spos); SASSERT(rewrites_from(t, m_pr)); SASSERT(rewrites_to(new_t, m_pr)); } @@ -537,7 +537,7 @@ void rewriter_tpl::process_quantifier(quantifier * q, frame & fr) { } } SASSERT(fr.m_spos + num_children == result_stack().size()); - expr * const * it = result_stack().c_ptr() + fr.m_spos; + expr * const * it = result_stack().data() + fr.m_spos; expr * new_body = *it; unsigned num_pats = q->get_num_patterns(); unsigned num_no_pats = q->get_num_no_patterns(); @@ -561,7 +561,7 @@ void rewriter_tpl::process_quantifier(quantifier * q, frame & fr) { num_no_pats = j; } if (ProofGen) { - quantifier_ref new_q(m().update_quantifier(q, num_pats, new_pats.c_ptr(), num_no_pats, new_no_pats.c_ptr(), new_body), m()); + quantifier_ref new_q(m().update_quantifier(q, num_pats, new_pats.data(), num_no_pats, new_no_pats.data(), new_body), m()); m_pr = nullptr; if (q != new_q) { m_pr = result_pr_stack().get(fr.m_spos); @@ -575,7 +575,7 @@ void rewriter_tpl::process_quantifier(quantifier * q, frame & fr) { } m_r = new_q; proof_ref pr2(m()); - if (m_cfg.reduce_quantifier(new_q, new_body, new_pats.c_ptr(), new_no_pats.c_ptr(), m_r, pr2)) { + 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";); @@ -584,9 +584,9 @@ void rewriter_tpl::process_quantifier(quantifier * q, frame & fr) { } else { 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.c_ptr(), new_no_pats.c_ptr(), m_r, m_pr)) { + 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.c_ptr(), num_no_pats, new_no_pats.c_ptr(), new_body); + 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";); diff --git a/src/ast/rewriter/seq_axioms.cpp b/src/ast/rewriter/seq_axioms.cpp index 9cd927935..e786de3aa 100644 --- a/src/ast/rewriter/seq_axioms.cpp +++ b/src/ast/rewriter/seq_axioms.cpp @@ -109,7 +109,7 @@ namespace seq { if (m_trail.size() != 4000) return; unsigned new_size = 2000; - expr_ref_vector new_trail(m, new_size, m_trail.c_ptr() + new_size); + expr_ref_vector new_trail(m, new_size, m_trail.data() + new_size); m_purified.reset(); for (unsigned i = 0; i < new_size; i += 2) m_purified.insert(new_trail.get(i), new_trail.get(i + 1)); diff --git a/src/ast/rewriter/seq_eq_solver.cpp b/src/ast/rewriter/seq_eq_solver.cpp index b779d3f4b..223372da1 100644 --- a/src/ast/rewriter/seq_eq_solver.cpp +++ b/src/ast/rewriter/seq_eq_solver.cpp @@ -304,7 +304,7 @@ namespace seq { expr_ref eq_length(m.mk_eq(a.mk_int(lenX), seq.str.mk_length(X)), m); expr* val = ctx.expr2rep(eq_length); if (!m.is_false(val)) { - expr_ref Y(seq.str.mk_concat(lenX.get_unsigned(), units.c_ptr(), X->get_sort()), m); + expr_ref Y(seq.str.mk_concat(lenX.get_unsigned(), units.data(), X->get_sort()), m); expr_ref eq = m_ax.sk().mk_eq(X, Y); add_consequence(~eq_length, eq); return true; @@ -369,12 +369,12 @@ namespace seq { void eq_solver::set_prefix(expr_ref& x, expr_ref_vector const& xs, unsigned sz) const { SASSERT(0 < xs.size() && sz <= xs.size()); - x = seq.str.mk_concat(sz, xs.c_ptr(), xs[0]->get_sort()); + x = seq.str.mk_concat(sz, xs.data(), xs[0]->get_sort()); } void eq_solver::set_suffix(expr_ref& x, expr_ref_vector const& xs, unsigned sz) const { SASSERT(0 < xs.size() && sz <= xs.size()); - x = seq.str.mk_concat(sz, xs.c_ptr() + xs.size() - sz, xs[0]->get_sort()); + x = seq.str.mk_concat(sz, xs.data() + xs.size() - sz, xs[0]->get_sort()); } unsigned eq_solver::count_units_l2r(expr_ref_vector const& es, unsigned offset) const { diff --git a/src/ast/rewriter/seq_eq_solver.h b/src/ast/rewriter/seq_eq_solver.h index c4d98d0a3..e014bb8e1 100644 --- a/src/ast/rewriter/seq_eq_solver.h +++ b/src/ast/rewriter/seq_eq_solver.h @@ -102,7 +102,7 @@ namespace seq { void set_extract(V& dst, expr_ref_vector const& xs, unsigned offset, unsigned sz) const { SASSERT(offset + sz <= xs.size()); dst.reset(); - dst.append(sz, xs.c_ptr() + offset); + dst.append(sz, xs.data() + offset); } void set_conflict(); diff --git a/src/ast/rewriter/seq_rewriter.cpp b/src/ast/rewriter/seq_rewriter.cpp index 15b44de5b..4f71fdfe7 100644 --- a/src/ast/rewriter/seq_rewriter.cpp +++ b/src/ast/rewriter/seq_rewriter.cpp @@ -828,7 +828,7 @@ br_status seq_rewriter::mk_seq_length(expr* a, expr_ref& result) { if (len != 0) { es.push_back(m_autil.mk_int(len)); } - result = m_autil.mk_add(es.size(), es.c_ptr()); + result = m_autil.mk_add(es.size(), es.data()); return BR_REWRITE2; } expr* x = nullptr, *y = nullptr, *z = nullptr; @@ -993,7 +993,7 @@ bool seq_rewriter::extract_pop_suffix(expr_ref_vector const& as, expr* b, expr* len_a1 += len_a2; } if (i < as.size()) { - expr* a = str().mk_concat(i, as.c_ptr(), as[0]->get_sort()); + expr* a = str().mk_concat(i, as.data(), as[0]->get_sort()); result = str().mk_substr(a, b, c); return true; } @@ -1021,7 +1021,7 @@ bool seq_rewriter::extract_push_offset(expr_ref_vector const& as, expr* b, expr* } if (i != 0) { expr_ref t1(m()); - t1 = str().mk_concat(as.size() - i, as.c_ptr() + i, as[0]->get_sort()); + 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";); @@ -1051,16 +1051,16 @@ bool seq_rewriter::extract_push_length(expr_ref_vector& as, expr* b, expr* c, ex } } if (i == as.size()) { - result = str().mk_concat(as.size(), as.c_ptr(), as[0]->get_sort()); + result = str().mk_concat(as.size(), as.data(), as[0]->get_sort()); return true; } else if (i != 0) { expr_ref t1(m()), t2(m()); - t1 = str().mk_concat(as.size() - i, as.c_ptr() + i, as[0]->get_sort()); + t1 = str().mk_concat(as.size() - i, as.data() + i, as[0]->get_sort()); t2 = mk_len(pos, lens); result = str().mk_substr(t1, b, t2); as[i] = result; - result = str().mk_concat(i + 1, as.c_ptr(), as[0]->get_sort()); + result = str().mk_concat(i + 1, as.data(), as[0]->get_sort()); TRACE("seq", tout << result << "\n";); return true; } @@ -1191,7 +1191,7 @@ br_status seq_rewriter::mk_seq_extract(expr* a, expr* b, expr* c, expr_ref& resu result = str().mk_empty(a->get_sort()); for (unsigned i = 1; i <= as.size(); ++i) { result = m().mk_ite(m_autil.mk_ge(c, m_autil.mk_int(i)), - str().mk_concat(i, as.c_ptr(), a->get_sort()), + str().mk_concat(i, as.data(), a->get_sort()), result); } return BR_REWRITE_FULL; @@ -1212,11 +1212,11 @@ br_status seq_rewriter::mk_seq_extract(expr* a, expr* b, expr* c, expr_ref& resu unsigned i = offset; for (; i < as.size() && str().is_unit(as.get(i)) && i - offset < _len; ++i); if (i - offset == _len) { - result = str().mk_concat(_len, as.c_ptr() + offset, a->get_sort()); + result = str().mk_concat(_len, as.data() + offset, a->get_sort()); return BR_DONE; } if (i == as.size()) { - result = str().mk_concat(as.size() - offset, as.c_ptr() + offset, as[0]->get_sort()); + result = str().mk_concat(as.size() - offset, as.data() + offset, as[0]->get_sort()); return BR_DONE; } } @@ -1225,7 +1225,7 @@ br_status seq_rewriter::mk_seq_extract(expr* a, expr* b, expr* c, expr_ref& resu } expr_ref position(m()); position = m_autil.mk_sub(b, m_autil.mk_int(offset)); - result = str().mk_concat(as.size() - offset, as.c_ptr() + offset, as[0]->get_sort()); + result = str().mk_concat(as.size() - offset, as.data() + offset, as[0]->get_sort()); result = str().mk_substr(result, position, c); return BR_REWRITE3; } @@ -1361,7 +1361,7 @@ br_status seq_rewriter::mk_seq_contains(expr* a, expr* b, expr_ref& result) { } if (offs > 0 || sz < as.size()) { SASSERT(sz > offs); - result = str().mk_contains(str().mk_concat(sz-offs, as.c_ptr()+offs, a->get_sort()), b); + result = str().mk_contains(str().mk_concat(sz-offs, as.data()+offs, a->get_sort()), b); return BR_REWRITE2; } @@ -1496,7 +1496,7 @@ br_status seq_rewriter::mk_seq_at(expr* a, expr* b, expr_ref& result) { for (expr* rhs : lens) { pos = m_autil.mk_add(pos, str().mk_length(rhs)); } - result = str().mk_concat(m_lhs.size() - i , m_lhs.c_ptr() + i, sort_a); + result = str().mk_concat(m_lhs.size() - i , m_lhs.data() + i, sort_a); result = str().mk_at(result, pos); return BR_REWRITE2; } @@ -1658,7 +1658,7 @@ br_status seq_rewriter::mk_seq_index(expr* a, expr* b, expr* c, expr_ref& result } if (i > 0) { expr_ref a1(m()); - a1 = str().mk_concat(as.size() - i, as.c_ptr() + i, sort_a); + a1 = str().mk_concat(as.size() - i, as.data() + i, sort_a); result = str().mk_index(a1, b, m_autil.mk_int(r)); result = m().mk_ite(m_autil.mk_ge(result, zero()), m_autil.mk_add(m_autil.mk_int(i), result), minus_one()); return BR_REWRITE_FULL; @@ -1676,7 +1676,7 @@ br_status seq_rewriter::mk_seq_index(expr* a, expr* b, expr* c, expr_ref& result } if (i > 0) { result = str().mk_index( - str().mk_concat(as.size() - i, as.c_ptr() + i, sort_a), b, c); + str().mk_concat(as.size() - i, as.data() + i, sort_a), b, c); result = m().mk_ite(m_autil.mk_ge(result, zero()), m_autil.mk_add(m_autil.mk_int(i), result), minus_one()); return BR_REWRITE_FULL; } @@ -1698,7 +1698,7 @@ br_status seq_rewriter::mk_seq_index(expr* a, expr* b, expr* c, expr_ref& result break; } if (is_zero && !as.empty() && str().is_unit(as.get(0))) { - expr_ref a1(str().mk_concat(as.size() - 1, as.c_ptr() + 1, as[0]->get_sort()), m()); + expr_ref a1(str().mk_concat(as.size() - 1, as.data() + 1, as[0]->get_sort()), m()); expr_ref b1(str().mk_index(a1, b, c), m()); result = m().mk_ite(str().mk_prefix(b, a), zero(), m().mk_ite(m_autil.mk_ge(b1, zero()), m_autil.mk_add(one(), b1), minus_one())); @@ -1797,7 +1797,7 @@ br_status seq_rewriter::mk_seq_replace(expr* a, expr* b, expr* c, expr_ref& resu // a := b + rest if (m_lhs.get(0) == b) { m_lhs[0] = c; - result = str().mk_concat(m_lhs.size(), m_lhs.c_ptr(), sort_a); + result = str().mk_concat(m_lhs.size(), m_lhs.data(), sort_a); return BR_REWRITE1; } @@ -1805,7 +1805,7 @@ br_status seq_rewriter::mk_seq_replace(expr* a, expr* b, expr* c, expr_ref& resu if (str().is_string(b, s2) && str().is_string(c, s3) && str().is_string(m_lhs.get(0), s1) && s1.contains(s2) ) { m_lhs[0] = str().mk_string(s1.replace(s2, s3)); - result = str().mk_concat(m_lhs.size(), m_lhs.c_ptr(), sort_a); + result = str().mk_concat(m_lhs.size(), m_lhs.data(), sort_a); return BR_REWRITE1; } m_lhs.reset(); @@ -1839,16 +1839,16 @@ br_status seq_rewriter::mk_seq_replace(expr* a, expr* b, expr* c, expr_ref& resu if (cmp == l_false && str().is_unit(m_lhs.get(i))) continue; if (cmp == l_true && m_lhs.size() < i + m_rhs.size()) { - expr_ref a1(str().mk_concat(i, m_lhs.c_ptr(), sort_a), m()); - expr_ref a2(str().mk_concat(m_lhs.size()-i, m_lhs.c_ptr()+i, sort_a), m()); + expr_ref a1(str().mk_concat(i, m_lhs.data(), sort_a), m()); + expr_ref a2(str().mk_concat(m_lhs.size()-i, m_lhs.data()+i, sort_a), m()); result = m().mk_ite(m().mk_eq(a2, b), str().mk_concat(a1, c), a); return BR_REWRITE_FULL; } if (cmp == l_true) { expr_ref_vector es(m()); - es.append(i, m_lhs.c_ptr()); + es.append(i, m_lhs.data()); es.push_back(c); - es.append(m_lhs.size()-i-m_rhs.size(), m_lhs.c_ptr()+i+m_rhs.size()); + es.append(m_lhs.size()-i-m_rhs.size(), m_lhs.data()+i+m_rhs.size()); result = str().mk_concat(es, sort_a); return BR_REWRITE_FULL; } @@ -1856,8 +1856,8 @@ br_status seq_rewriter::mk_seq_replace(expr* a, expr* b, expr* c, expr_ref& resu } if (i > 0) { - expr_ref a1(str().mk_concat(i, m_lhs.c_ptr(), sort_a), m()); - expr_ref a2(str().mk_concat(m_lhs.size()-i, m_lhs.c_ptr()+i, sort_a), m()); + expr_ref a1(str().mk_concat(i, m_lhs.data(), sort_a), m()); + expr_ref a2(str().mk_concat(m_lhs.size()-i, m_lhs.data()+i, sort_a), m()); result = str().mk_concat(a1, str().mk_replace(a2, b, c)); return BR_REWRITE_FULL; } @@ -1941,8 +1941,8 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) { SASSERT(as.size() > 1); s2 = s2.extract(s1.length(), s2.length()-s1.length()); bs[0] = str().mk_string(s2); - result = str().mk_prefix(str().mk_concat(as.size()-1, as.c_ptr()+1, sort_a), - str().mk_concat(bs.size(), bs.c_ptr(), sort_a)); + 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";); return BR_REWRITE_FULL; } @@ -1964,8 +1964,8 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) { SASSERT(bs.size() > 1); s1 = s1.extract(s2.length(), s1.length() - s2.length()); as[0] = str().mk_string(s1); - result = str().mk_prefix(str().mk_concat(as.size(), as.c_ptr(), sort_a), - str().mk_concat(bs.size()-1, bs.c_ptr()+1, sort_a)); + 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";); return BR_REWRITE_FULL; } @@ -2011,8 +2011,8 @@ br_status seq_rewriter::mk_seq_prefix(expr* a, expr* b, expr_ref& result) { } if (i > 0) { SASSERT(i < as.size() && i < bs.size()); - a = str().mk_concat(as.size() - i, as.c_ptr() + i, sort_a); - b = str().mk_concat(bs.size() - i, bs.c_ptr() + i, sort_a); + a = str().mk_concat(as.size() - i, as.data() + i, sort_a); + 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";); @@ -2091,8 +2091,8 @@ br_status seq_rewriter::mk_seq_suffix(expr* a, expr* b, expr_ref& result) { if (i > 1) { SASSERT(i <= sza && i <= szb); - a = str().mk_concat(sza - i + 1, as.c_ptr(), sort_a); - b = str().mk_concat(szb - i + 1, bs.c_ptr(), sort_a); + a = str().mk_concat(sza - i + 1, as.data(), sort_a); + 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";); @@ -2294,7 +2294,7 @@ br_status seq_rewriter::mk_str_stoi(expr* a, expr_ref& result) { // if tail < 0 then tail else // if stoi(head) >= 0 and then stoi(head)*10+tail else -1 expr_ref tail(str().mk_stoi(as.back()), m()); - expr_ref head(str().mk_concat(as.size() - 1, as.c_ptr(), a->get_sort()), m()); + expr_ref head(str().mk_concat(as.size() - 1, as.data(), a->get_sort()), m()); expr_ref stoi_head(str().mk_stoi(head), m()); result = m().mk_ite(m_autil.mk_ge(stoi_head, m_autil.mk_int(0)), m_autil.mk_add(m_autil.mk_mul(m_autil.mk_int(10), stoi_head), tail), @@ -2309,7 +2309,7 @@ br_status seq_rewriter::mk_str_stoi(expr* a, expr_ref& result) { return BR_REWRITE_FULL; } if (str().is_unit(as.get(0), u) && m_util.is_const_char(u, ch) && '0' == ch) { - result = str().mk_concat(as.size() - 1, as.c_ptr() + 1, as[0]->get_sort()); + result = str().mk_concat(as.size() - 1, as.data() + 1, as[0]->get_sort()); result = m().mk_ite(str().mk_is_empty(result), m_autil.mk_int(0), str().mk_stoi(result)); @@ -4686,20 +4686,20 @@ bool seq_rewriter::reduce_contains(expr* a, expr* b, expr_ref_vector& disj) { for (unsigned j = 0; j < sz; ++j) { es.push_back(str().mk_unit(str().mk_char(s, j))); } - es.append(m_lhs.size() - i, m_lhs.c_ptr() + i); + es.append(m_lhs.size() - i, m_lhs.data() + i); for (unsigned j = 0; j < sz; ++j) { - disj.push_back(str().mk_prefix(b, str().mk_concat(es.size() - j, es.c_ptr() + j, sort_a))); + disj.push_back(str().mk_prefix(b, str().mk_concat(es.size() - j, es.data() + j, sort_a))); } continue; } if (str().is_unit(e)) { - disj.push_back(str().mk_prefix(b, str().mk_concat(m_lhs.size() - i, m_lhs.c_ptr() + i, sort_a))); + disj.push_back(str().mk_prefix(b, str().mk_concat(m_lhs.size() - i, m_lhs.data() + i, sort_a))); continue; } if (str().is_string(b, s)) { expr* all = re().mk_full_seq(re().mk_re(b->get_sort())); - disj.push_back(re().mk_in_re(str().mk_concat(m_lhs.size() - i, m_lhs.c_ptr() + i, sort_a), + disj.push_back(re().mk_in_re(str().mk_concat(m_lhs.size() - i, m_lhs.data() + i, sort_a), re().mk_concat(all, re().mk_concat(re().mk_to_re(b), all)))); return true; } @@ -4707,7 +4707,7 @@ bool seq_rewriter::reduce_contains(expr* a, expr* b, expr_ref_vector& disj) { if (i == 0) { return false; } - disj.push_back(str().mk_contains(str().mk_concat(m_lhs.size() - i, m_lhs.c_ptr() + i, sort_a), b)); + disj.push_back(str().mk_contains(str().mk_concat(m_lhs.size() - i, m_lhs.data() + i, sort_a), b)); return true; } disj.push_back(str().mk_is_empty(b)); @@ -4882,7 +4882,7 @@ bool seq_rewriter::reduce_itos(expr_ref_vector& ls, expr_ref_vector& rs, zstring s; if (ls.size() == 1 && str().is_itos(ls.get(0), n) && - is_string(rs.size(), rs.c_ptr(), s)) { + is_string(rs.size(), rs.data(), s)) { std::string s1 = s.encode(); rational r(s1.c_str()); if (s1 == r.to_string()) { @@ -4938,14 +4938,14 @@ bool seq_rewriter::reduce_by_length(expr_ref_vector& ls, expr_ref_vector& rs, if (bounded2 && len2 < len1) return false; if (bounded1 && len1 == len2 && len1 > 0) { - if (!set_empty(rs.size(), rs.c_ptr(), false, eqs)) + if (!set_empty(rs.size(), rs.data(), false, eqs)) return false; eqs.push_back(concat_non_empty(ls), concat_non_empty(rs)); ls.reset(); rs.reset(); } else if (bounded2 && len1 == len2 && len1 > 0) { - if (!set_empty(ls.size(), ls.c_ptr(), false, eqs)) + if (!set_empty(ls.size(), ls.data(), false, eqs)) return false; eqs.push_back(concat_non_empty(ls), concat_non_empty(rs)); ls.reset(); diff --git a/src/ast/rewriter/seq_rewriter.h b/src/ast/rewriter/seq_rewriter.h index 4d37482e3..60e4cf031 100644 --- a/src/ast/rewriter/seq_rewriter.h +++ b/src/ast/rewriter/seq_rewriter.h @@ -165,7 +165,7 @@ class seq_rewriter { length_comparison compare_lengths(expr_ref_vector const& as, expr_ref_vector const& bs) { - return compare_lengths(as.size(), as.c_ptr(), bs.size(), bs.c_ptr()); + return compare_lengths(as.size(), as.data(), bs.size(), bs.data()); } length_comparison compare_lengths(unsigned sza, expr* const* as, unsigned szb, expr* const* bs); @@ -333,7 +333,7 @@ public: br_status mk_le_core(expr* lhs, expr* rhs, expr_ref& result); br_status mk_bool_app(func_decl* f, unsigned n, expr* const* args, expr_ref& result); - expr_ref mk_app(func_decl* f, expr_ref_vector const& args) { return mk_app(f, args.size(), args.c_ptr()); } + expr_ref mk_app(func_decl* f, expr_ref_vector const& args) { return mk_app(f, args.size(), args.data()); } expr_ref mk_app(func_decl* f, unsigned n, expr* const* args) { expr_ref result(m()); if (f->get_family_id() != u().get_family_id() || diff --git a/src/ast/rewriter/seq_skolem.cpp b/src/ast/rewriter/seq_skolem.cpp index 56c169ef6..c76efda57 100644 --- a/src/ast/rewriter/seq_skolem.cpp +++ b/src/ast/rewriter/seq_skolem.cpp @@ -198,6 +198,6 @@ expr_ref skolem::mk_step(expr* s, expr* idx, expr* re, unsigned i, unsigned j, e args.push_back(a.mk_int(i)); args.push_back(a.mk_int(j)); args.push_back(t); - return expr_ref(seq.mk_skolem(m_aut_step, args.size(), args.c_ptr(), m.mk_bool_sort()), m); + return expr_ref(seq.mk_skolem(m_aut_step, args.size(), args.data(), m.mk_bool_sort()), m); } diff --git a/src/ast/rewriter/seq_skolem.h b/src/ast/rewriter/seq_skolem.h index f7b1b46e4..56baf8def 100644 --- a/src/ast/rewriter/seq_skolem.h +++ b/src/ast/rewriter/seq_skolem.h @@ -70,7 +70,7 @@ namespace seq { } return mk("seq.align.m", e1, e2, e3, e4); } - expr_ref mk_accept(expr_ref_vector const& args) { return expr_ref(seq.mk_skolem(m_accept, args.size(), args.c_ptr(), m.mk_bool_sort()), m); } + expr_ref mk_accept(expr_ref_vector const& args) { return expr_ref(seq.mk_skolem(m_accept, args.size(), args.data(), m.mk_bool_sort()), m); } expr_ref mk_accept(expr* s, expr* i, expr* r) { return mk(m_accept, s, i, r, nullptr, m.mk_bool_sort()); } expr_ref mk_is_non_empty(expr* r, expr* u, expr* n) { return mk(m_is_non_empty, r, u, n, m.mk_bool_sort(), false); } expr_ref mk_is_empty(expr* r, expr* u, expr* n) { return mk(m_is_empty, r, u, n, m.mk_bool_sort(), false); } diff --git a/src/ast/rewriter/th_rewriter.cpp b/src/ast/rewriter/th_rewriter.cpp index 1892d4c9c..99f26234a 100644 --- a/src/ast/rewriter/th_rewriter.cpp +++ b/src/ast/rewriter/th_rewriter.cpp @@ -511,7 +511,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg { if (args.size() == 1) c = args[0]; else - c = m_a_util.mk_add(args.size(), args.c_ptr()); + c = m_a_util.mk_add(args.size(), args.data()); return true; } @@ -722,8 +722,8 @@ struct th_rewriter_cfg : public default_rewriter_cfg { q1 = m().mk_quantifier(old_q->get_kind(), sorts.size(), - sorts.c_ptr(), - names.c_ptr(), + sorts.data(), + names.data(), nested_q->get_expr(), std::min(old_q->get_weight(), nested_q->get_weight()), old_q->get_qid(), @@ -757,7 +757,7 @@ struct th_rewriter_cfg : public default_rewriter_cfg { apply_subst(new_patterns_buf); q1 = m().update_quantifier(old_q, - new_patterns_buf.size(), new_patterns_buf.c_ptr(), new_no_patterns_buf.size(), new_no_patterns_buf.c_ptr(), + 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";); diff --git a/src/ast/rewriter/var_subst.cpp b/src/ast/rewriter/var_subst.cpp index 3f70791b9..13dd4f459 100644 --- a/src/ast/rewriter/var_subst.cpp +++ b/src/ast/rewriter/var_subst.cpp @@ -134,11 +134,11 @@ expr_ref unused_vars_eliminator::operator()(quantifier* q) { // (VAR 0) should be in the last position of var_mapping. // ... // (VAR (var_mapping.size() - 1)) should be in the first position. - std::reverse(var_mapping.c_ptr(), var_mapping.c_ptr() + var_mapping.size()); + std::reverse(var_mapping.data(), var_mapping.data() + var_mapping.size()); expr_ref new_expr(m); - new_expr = m_subst(q->get_expr(), var_mapping.size(), var_mapping.c_ptr()); + new_expr = m_subst(q->get_expr(), var_mapping.size(), var_mapping.data()); if (num_removed == num_decls) { result = new_expr; @@ -149,24 +149,24 @@ expr_ref unused_vars_eliminator::operator()(quantifier* q) { expr_ref_buffer new_no_patterns(m); for (unsigned i = 0; i < num_patterns; i++) { - new_patterns.push_back(m_subst(q->get_pattern(i), var_mapping.size(), var_mapping.c_ptr())); + new_patterns.push_back(m_subst(q->get_pattern(i), var_mapping.size(), var_mapping.data())); } for (unsigned i = 0; i < num_no_patterns; i++) { - new_no_patterns.push_back(m_subst(q->get_no_pattern(i), var_mapping.size(), var_mapping.c_ptr())); + new_no_patterns.push_back(m_subst(q->get_no_pattern(i), var_mapping.size(), var_mapping.data())); } result = m.mk_quantifier(q->get_kind(), used_decl_sorts.size(), - used_decl_sorts.c_ptr(), - used_decl_names.c_ptr(), + used_decl_sorts.data(), + used_decl_names.data(), new_expr, q->get_weight(), q->get_qid(), q->get_skid(), num_patterns, - new_patterns.c_ptr(), + new_patterns.data(), num_no_patterns, - new_no_patterns.c_ptr()); + new_no_patterns.data()); to_quantifier(result)->set_no_unused_vars(); SASSERT(is_well_sorted(m, result)); return result; diff --git a/src/ast/rewriter/var_subst.h b/src/ast/rewriter/var_subst.h index 13fe8bd8c..84318c9b5 100644 --- a/src/ast/rewriter/var_subst.h +++ b/src/ast/rewriter/var_subst.h @@ -48,10 +48,10 @@ public: Otherwise, (VAR 0) is stored in the first position, (VAR 1) in the second, and so on. */ expr_ref operator()(expr * n, unsigned num_args, expr * const * args); - inline expr_ref operator()(expr * n, expr_ref_vector const& args) { return (*this)(n, args.size(), args.c_ptr()); } - inline expr_ref operator()(expr * n, var_ref_vector const& args) { return (*this)(n, args.size(), (expr*const*)args.c_ptr()); } - inline expr_ref operator()(expr * n, app_ref_vector const& args) { return (*this)(n, args.size(), (expr*const*)args.c_ptr()); } - inline expr_ref operator()(expr * n, ptr_vector const& args) { return (*this)(n, args.size(), args.c_ptr()); } + inline expr_ref operator()(expr * n, expr_ref_vector const& args) { return (*this)(n, args.size(), args.data()); } + inline expr_ref operator()(expr * n, var_ref_vector const& args) { return (*this)(n, args.size(), (expr*const*)args.data()); } + inline expr_ref operator()(expr * n, app_ref_vector const& args) { return (*this)(n, args.size(), (expr*const*)args.data()); } + inline expr_ref operator()(expr * n, ptr_vector const& args) { return (*this)(n, args.size(), args.data()); } void reset() { m_reducer.reset(); } }; @@ -104,7 +104,7 @@ public: bool contains(unsigned idx) const { return idx < m_sorts.size() && m_sorts[idx] != 0; } void set_default_sort(sort* s); void reverse() { m_sorts.reverse(); } - sort*const* c_ptr() const { return m_sorts.c_ptr(); } + sort*const* data() const { return m_sorts.data(); } }; diff --git a/src/ast/seq_decl_plugin.h b/src/ast/seq_decl_plugin.h index f985f9de8..16b8e76db 100644 --- a/src/ast/seq_decl_plugin.h +++ b/src/ast/seq_decl_plugin.h @@ -281,7 +281,7 @@ public: if (n == 0) return mk_empty(s); if (n == 1) return es[0]; return m.mk_app(m_fid, OP_SEQ_CONCAT, n, es); } - expr* mk_concat(expr_ref_vector const& es, sort* s) const { return mk_concat(es.size(), es.c_ptr(), s); } + expr* mk_concat(expr_ref_vector const& es, sort* s) const { return mk_concat(es.size(), es.data(), s); } app* mk_length(expr* a) const { return m.mk_app(m_fid, OP_SEQ_LENGTH, 1, &a); } app* mk_at(expr* s, expr* i) const { expr* es[2] = { s, i }; return m.mk_app(m_fid, OP_SEQ_AT, 2, es); } app* mk_nth(expr* s, expr* i) const { expr* es[2] = { s, i }; return m.mk_app(m_fid, OP_SEQ_NTH, 2, es); } diff --git a/src/ast/substitution/substitution.cpp b/src/ast/substitution/substitution.cpp index 065a89fd9..dc5e35bc4 100644 --- a/src/ast/substitution/substitution.cpp +++ b/src/ast/substitution/substitution.cpp @@ -159,7 +159,7 @@ void substitution::apply(unsigned num_actual_offsets, unsigned const * deltas, e << " --> " << mk_pp(e, m_manager) << "\n";); } else { - expr * new_expr = m_manager.mk_app(to_app(e)->get_decl(), new_args.size(), new_args.c_ptr()); + 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() @@ -203,7 +203,7 @@ void substitution::apply(unsigned num_actual_offsets, unsigned const * deltas, e no_pats.push_back(std::move(er)); } subst.apply(num_actual_offsets, deltas, body, s1, t1, er); - er = m_manager.update_quantifier(q, pats.size(), pats.c_ptr(), no_pats.size(), no_pats.c_ptr(), er); + er = m_manager.update_quantifier(q, pats.size(), pats.data(), no_pats.size(), no_pats.data(), er); m_todo.pop_back(); m_apply_cache.insert(n, er); m_new_exprs.push_back(std::move(er)); diff --git a/src/ast/substitution/substitution_tree.cpp b/src/ast/substitution/substitution_tree.cpp index 438434f5b..c0c3e5205 100644 --- a/src/ast/substitution/substitution_tree.cpp +++ b/src/ast/substitution/substitution_tree.cpp @@ -90,7 +90,7 @@ void substitution_tree::linearize(svector & result) { sort * s = get_reg_value(oreg)->get_sort(); new_args.push_back(m_manager.mk_var(oreg, s)); } - new_app = m_manager.mk_app(to_app(n)->get_decl(), new_args.size(), new_args.c_ptr()); + new_app = m_manager.mk_app(to_app(n)->get_decl(), new_args.size(), new_args.data()); new_args.reset(); } push(result, subst(ireg, new_app)); diff --git a/src/cmd_context/basic_cmds.cpp b/src/cmd_context/basic_cmds.cpp index 6a803d3e3..23915f7fe 100644 --- a/src/cmd_context/basic_cmds.cpp +++ b/src/cmd_context/basic_cmds.cpp @@ -798,15 +798,15 @@ public: unsigned arity = m_f->get_arity(); for (unsigned i = 0; i < arity; i++) { array_sort_args.push_back(m_f->get_domain(i)); - domain.push_back(array_sort->instantiate(ctx.pm(), array_sort_args.size(), array_sort_args.c_ptr())); + domain.push_back(array_sort->instantiate(ctx.pm(), array_sort_args.size(), array_sort_args.data())); array_sort_args.pop_back(); } sort_ref range(ctx.m()); array_sort_args.push_back(m_f->get_range()); - range = array_sort->instantiate(ctx.pm(), array_sort_args.size(), array_sort_args.c_ptr()); + range = array_sort->instantiate(ctx.pm(), array_sort_args.size(), array_sort_args.data()); parameter p[1] = { parameter(m_f) }; func_decl_ref new_map(ctx.m()); - new_map = ctx.m().mk_func_decl(get_array_fid(ctx), OP_ARRAY_MAP, 1, p, domain.size(), domain.c_ptr(), range.get()); + new_map = ctx.m().mk_func_decl(get_array_fid(ctx), OP_ARRAY_MAP, 1, p, domain.size(), domain.data(), range.get()); if (new_map == 0) throw cmd_exception("invalid array map operator"); ctx.insert(m_name, new_map); @@ -836,8 +836,8 @@ public: void execute(cmd_context & ctx) override { ast_manager& m = ctx.m(); expr_ref_vector assumptions(m), variables(m), consequences(m); - assumptions.append(m_assumptions.size(), m_assumptions.c_ptr()); - variables.append(m_variables.size(), m_variables.c_ptr()); + assumptions.append(m_assumptions.size(), m_assumptions.data()); + variables.append(m_variables.size(), m_variables.data()); ctx.get_consequences(assumptions, variables, consequences); ctx.regular_stream() << consequences << "\n"; } diff --git a/src/cmd_context/cmd_context.cpp b/src/cmd_context/cmd_context.cpp index 85d1fea0e..ac0287312 100644 --- a/src/cmd_context/cmd_context.cpp +++ b/src/cmd_context/cmd_context.cpp @@ -252,7 +252,7 @@ func_decl * func_decls::find(ast_manager & m, unsigned num_args, expr * const * return nullptr; sorts.push_back(args[i]->get_sort()); } - return find(m, num_args, sorts.c_ptr(), range); + return find(m, num_args, sorts.data(), range); } unsigned func_decls::get_num_entries() const { @@ -982,7 +982,7 @@ void cmd_context::insert_rec_fun(func_decl* f, expr_ref_vector const& binding, s recfun::promise_def d = p.get_promise_def(f); recfun_replace replace(m()); - p.set_definition(replace, d, vars.size(), vars.c_ptr(), rhs); + p.set_definition(replace, d, vars.size(), vars.data(), rhs); } func_decl * cmd_context::find_func_decl(symbol const & s) const { @@ -1060,7 +1060,7 @@ func_decl * cmd_context::find_func_decl(symbol const & s, unsigned num_indices, buffer ps; for (unsigned i = 0; i < num_indices; i++) ps.push_back(parameter(indices[i])); - f = m().mk_func_decl(fid, k, num_indices, ps.c_ptr(), arity, domain, range); + f = m().mk_func_decl(fid, k, num_indices, ps.data(), arity, domain, range); } if (f == nullptr) throw cmd_exception("invalid function declaration reference, invalid builtin reference ", s); @@ -1873,7 +1873,7 @@ void cmd_context::complete_model(model_ref& md) const { SASSERT(!v->has_var_params()); IF_VERBOSE(12, verbose_stream() << "(model.completion " << k << ")\n"; ); ptr_vector param_sorts(v->get_num_params(), m().mk_bool_sort()); - sort * srt = v->instantiate(*m_pmanager, param_sorts.size(), param_sorts.c_ptr()); + sort * srt = v->instantiate(*m_pmanager, param_sorts.size(), param_sorts.data()); if (!md->has_uninterpreted_sort(srt)) { expr * singleton = m().get_some_value(srt); md->register_usort(srt, 1, &singleton); diff --git a/src/cmd_context/extra_cmds/dbg_cmds.cpp b/src/cmd_context/extra_cmds/dbg_cmds.cpp index fad351e64..5b648741c 100644 --- a/src/cmd_context/extra_cmds/dbg_cmds.cpp +++ b/src/cmd_context/extra_cmds/dbg_cmds.cpp @@ -123,7 +123,7 @@ public: } void execute(cmd_context & ctx) override { beta_reducer p(ctx.m()); - expr_ref r = p(m_source, m_subst.size(), m_subst.c_ptr()); + expr_ref r = p(m_source, m_subst.size(), m_subst.data()); store_expr_ref(ctx, m_target, r.get()); } }; @@ -304,7 +304,7 @@ public: } void execute(cmd_context & ctx) override { - expr_ref r = instantiate(ctx.m(), m_q, m_args.c_ptr()); + expr_ref r = instantiate(ctx.m(), m_q, m_args.data()); ctx.display(ctx.regular_stream(), r); ctx.regular_stream() << std::endl; } diff --git a/src/cmd_context/pdecl.cpp b/src/cmd_context/pdecl.cpp index fb5b7b9f5..e34c7e38a 100644 --- a/src/cmd_context/pdecl.cpp +++ b/src/cmd_context/pdecl.cpp @@ -203,7 +203,7 @@ class psort_app : public psort { void finalize(pdecl_manager & m) override { m.lazy_dec_ref(m_decl); - m.lazy_dec_ref(m_args.size(), m_args.c_ptr()); + m.lazy_dec_ref(m_args.size(), m_args.data()); psort::finalize(m); } @@ -227,7 +227,7 @@ class psort_app : public psort { sort * a = m_args[i]->instantiate(m, n, s); args_i.push_back(a); } - r = m_decl->instantiate(m, args_i.size(), args_i.c_ptr()); + r = m_decl->instantiate(m, args_i.size(), args_i.data()); cache(m, s, r); return r; } @@ -321,7 +321,7 @@ sort * psort_user_decl::instantiate(pdecl_manager & m, unsigned n, sort * const buffer ps; for (unsigned i = 0; i < n; i++) ps.push_back(parameter(s[i])); - r = m.m().mk_uninterpreted_sort(m_name, ps.size(), ps.c_ptr()); + r = m.m().mk_uninterpreted_sort(m_name, ps.size(), ps.data()); } else { r = m_def->instantiate(m, n, s); @@ -388,7 +388,7 @@ sort * psort_builtin_decl::instantiate(pdecl_manager & m, unsigned n, sort * con buffer params; for (unsigned i = 0; i < n; i++) params.push_back(parameter(s[i])); - sort * r = m.m().mk_sort(m_fid, m_kind, n, params.c_ptr()); + sort * r = m.m().mk_sort(m_fid, m_kind, n, params.data()); m.save_info(r, this, n, s); return r; } @@ -404,7 +404,7 @@ sort * psort_builtin_decl::instantiate(pdecl_manager & m, unsigned n, unsigned c buffer params; for (unsigned i = 0; i < n; i++) params.push_back(parameter(s[i])); - sort * r = m.m().mk_sort(m_fid, m_kind, n, params.c_ptr()); + sort * r = m.m().mk_sort(m_fid, m_kind, n, params.data()); m.save_info(r, this, n, s); return r; } @@ -488,7 +488,7 @@ pconstructor_decl::pconstructor_decl(unsigned id, unsigned num_params, pdecl_man } void pconstructor_decl::finalize(pdecl_manager & m) { - m.lazy_dec_ref(m_accessors.size(), m_accessors.c_ptr()); + m.lazy_dec_ref(m_accessors.size(), m_accessors.data()); } bool pconstructor_decl::has_missing_refs(symbol & missing) const { @@ -511,7 +511,7 @@ constructor_decl * pconstructor_decl::instantiate_decl(pdecl_manager & m, unsign ptr_buffer as; for (paccessor_decl* a : m_accessors) as.push_back(a->instantiate_decl(m, n, s)); - return mk_constructor_decl(m_name, m_recogniser_name, as.size(), as.c_ptr()); + return mk_constructor_decl(m_name, m_recogniser_name, as.size(), as.data()); } void pconstructor_decl::display(std::ostream & out, pdatatype_decl const * const * dts) const { @@ -532,7 +532,7 @@ pdatatype_decl::pdatatype_decl(unsigned id, unsigned num_params, pdecl_manager & } void pdatatype_decl::finalize(pdecl_manager & m) { - m.lazy_dec_ref(m_constructors.size(), m_constructors.c_ptr()); + m.lazy_dec_ref(m_constructors.size(), m_constructors.data()); psort_decl::finalize(m); } @@ -573,12 +573,12 @@ datatype_decl * pdatatype_decl::instantiate_decl(pdecl_manager & m, unsigned n, cs.push_back(c->instantiate_decl(m, n, s)); } datatype_util util(m.m()); - return mk_datatype_decl(util, m_name, m_num_params, s, cs.size(), cs.c_ptr()); + return mk_datatype_decl(util, m_name, m_num_params, s, cs.size(), cs.data()); } struct datatype_decl_buffer { ptr_buffer m_buffer; - ~datatype_decl_buffer() { del_datatype_decls(m_buffer.size(), m_buffer.c_ptr()); } + ~datatype_decl_buffer() { del_datatype_decls(m_buffer.size(), m_buffer.data()); } }; @@ -603,7 +603,7 @@ sort * pdatatype_decl::instantiate(pdecl_manager & m, unsigned n, sort * const * for (unsigned j = 0; j < util.get_datatype_num_parameter_sorts(rng); ++j) { ps.push_back(util.get_datatype_parameter_sort(acc->get_range(), j)); } - m.instantiate_datatype(p, p->get_name(), ps.size(), ps.c_ptr()); + m.instantiate_datatype(p, p->get_name(), ps.size(), ps.data()); break; } } @@ -641,10 +641,10 @@ bool pdatatype_decl::commit(pdecl_manager& m) { ps.push_back(m.m().mk_uninterpreted_sort(symbol(i), 0, nullptr)); } datatype_decl_buffer dts; - dts.m_buffer.push_back(instantiate_decl(m, ps.size(), ps.c_ptr())); + dts.m_buffer.push_back(instantiate_decl(m, ps.size(), ps.data())); datatype_decl * d_ptr = dts.m_buffer[0]; sort_ref_vector sorts(m.m()); - bool is_ok = m.get_dt_plugin()->mk_datatypes(1, &d_ptr, m_num_params, ps.c_ptr(), sorts); + bool is_ok = m.get_dt_plugin()->mk_datatypes(1, &d_ptr, m_num_params, ps.data(), sorts); if (is_ok && m_num_params == 0) { m.notify_new_dt(sorts.get(0), this); } @@ -665,7 +665,7 @@ pdatatypes_decl::pdatatypes_decl(unsigned id, unsigned num_params, pdecl_manager } void pdatatypes_decl::finalize(pdecl_manager & m) { - m.lazy_dec_ref(m_datatypes.size(), m_datatypes.c_ptr()); + m.lazy_dec_ref(m_datatypes.size(), m_datatypes.data()); } bool pdatatypes_decl::fix_missing_refs(symbol & missing) { @@ -694,7 +694,7 @@ sort* pdecl_manager::instantiate_datatype(psort_decl* p, symbol const& name, uns for (unsigned i = 0; i < n; i++) ps.push_back(parameter(s[i])); datatype_util util(m.m()); - r = m.m().mk_sort(util.get_family_id(), DATATYPE_SORT, ps.size(), ps.c_ptr()); + r = m.m().mk_sort(util.get_family_id(), DATATYPE_SORT, ps.size(), ps.data()); p->cache(m, s, r); m.save_info(r, p, n, s); notify_datatype(r, p, n, s); @@ -746,10 +746,10 @@ bool pdatatypes_decl::commit(pdecl_manager& m) { for (unsigned i = 0; i < d->get_num_params(); ++i) { ps.push_back(m.m().mk_uninterpreted_sort(symbol(i), 0, nullptr)); } - dts.m_buffer.push_back(d->instantiate_decl(m, ps.size(), ps.c_ptr())); + dts.m_buffer.push_back(d->instantiate_decl(m, ps.size(), ps.data())); } sort_ref_vector sorts(m.m()); - bool is_ok = m.get_dt_plugin()->mk_datatypes(m_datatypes.size(), dts.m_buffer.c_ptr(), 0, nullptr, sorts); + bool is_ok = m.get_dt_plugin()->mk_datatypes(m_datatypes.size(), dts.m_buffer.data(), 0, nullptr, sorts); if (is_ok) { for (unsigned i = 0; i < m_datatypes.size(); ++i) { pdatatype_decl* d = m_datatypes[i]; @@ -790,7 +790,7 @@ struct pdecl_manager::app_sort_info : public pdecl_manager::sort_info { void finalize(pdecl_manager & m) override { sort_info::finalize(m); - m.m().dec_array_ref(m_args.size(), m_args.c_ptr()); + m.m().dec_array_ref(m_args.size(), m_args.data()); } void display(std::ostream & out, pdecl_manager const & m) const override { diff --git a/src/cmd_context/pdecl.h b/src/cmd_context/pdecl.h index f2fce00c1..e5b630902 100644 --- a/src/cmd_context/pdecl.h +++ b/src/cmd_context/pdecl.h @@ -257,7 +257,7 @@ class pdatatypes_decl : public pdecl { bool instantiate(pdecl_manager & m, sort * const * s); ~pdatatypes_decl() override {} public: - pdatatype_decl const * const * children() const { return m_datatypes.c_ptr(); } + pdatatype_decl const * const * children() const { return m_datatypes.data(); } pdatatype_decl * const * begin() const { return m_datatypes.begin(); } pdatatype_decl * const * end() const { return m_datatypes.end(); } // commit declaration diff --git a/src/cmd_context/tactic_cmds.cpp b/src/cmd_context/tactic_cmds.cpp index acbeef07e..bf9da152f 100644 --- a/src/cmd_context/tactic_cmds.cpp +++ b/src/cmd_context/tactic_cmds.cpp @@ -242,7 +242,7 @@ public: if (ctx.produce_unsat_cores()) { ptr_vector core_elems; m.linearize(core, core_elems); - result->m_core.append(core_elems.size(), core_elems.c_ptr()); + result->m_core.append(core_elems.size(), core_elems.data()); if (p.get_bool("print_unsat_core", false)) { ctx.regular_stream() << "(unsat-core"; for (expr * e : core_elems) { @@ -359,7 +359,7 @@ public: for (unsigned i = 0; i < sz; i++) { assertions.push_back(fg->form(i)); } - ctx.display_smt2_benchmark(ctx.regular_stream(), assertions.size(), assertions.c_ptr()); + ctx.display_smt2_benchmark(ctx.regular_stream(), assertions.size(), assertions.data()); } else { // create a big OR @@ -371,10 +371,10 @@ public: if (formulas.size() == 1) or_args.push_back(formulas[0]); else - or_args.push_back(m.mk_and(formulas.size(), formulas.c_ptr())); + or_args.push_back(m.mk_and(formulas.size(), formulas.data())); } expr_ref assertion_ref(m); - assertion_ref = m.mk_or(or_args.size(), or_args.c_ptr()); + assertion_ref = m.mk_or(or_args.size(), or_args.data()); expr * assertions[1] = { assertion_ref.get() }; ctx.display_smt2_benchmark(ctx.regular_stream(), 1, assertions); } @@ -412,7 +412,7 @@ static tactic * mk_and_then(cmd_context & ctx, sexpr * n) { tactic_ref_buffer args; for (unsigned i = 1; i < num_children; i++) args.push_back(sexpr2tactic(ctx, n->get_child(i))); - return and_then(args.size(), args.c_ptr()); + return and_then(args.size(), args.data()); } static tactic * mk_or_else(cmd_context & ctx, sexpr * n) { @@ -425,7 +425,7 @@ static tactic * mk_or_else(cmd_context & ctx, sexpr * n) { tactic_ref_buffer args; for (unsigned i = 1; i < num_children; i++) args.push_back(sexpr2tactic(ctx, n->get_child(i))); - return or_else(args.size(), args.c_ptr()); + return or_else(args.size(), args.data()); } static tactic * mk_par(cmd_context & ctx, sexpr * n) { @@ -438,7 +438,7 @@ static tactic * mk_par(cmd_context & ctx, sexpr * n) { tactic_ref_buffer args; for (unsigned i = 1; i < num_children; i++) args.push_back(sexpr2tactic(ctx, n->get_child(i))); - return par(args.size(), args.c_ptr()); + return par(args.size(), args.data()); } static tactic * mk_par_then(cmd_context & ctx, sexpr * n) { @@ -451,7 +451,7 @@ static tactic * mk_par_then(cmd_context & ctx, sexpr * n) { tactic_ref_buffer args; for (unsigned i = 1; i < num_children; i++) args.push_back(sexpr2tactic(ctx, n->get_child(i))); - return par_and_then(args.size(), args.c_ptr()); + return par_and_then(args.size(), args.data()); } static tactic * mk_try_for(cmd_context & ctx, sexpr * n) { diff --git a/src/math/automata/symbolic_automata_def.h b/src/math/automata/symbolic_automata_def.h index 678420b7b..7c71e329d 100644 --- a/src/math/automata/symbolic_automata_def.h +++ b/src/math/automata/symbolic_automata_def.h @@ -40,7 +40,7 @@ typename symbolic_automata::automaton_t* symbolic_automata::mk_total for (unsigned j = 0; j < mvs.size(); ++j) { vs.push_back(mvs[j].t()); } - ref_t cond(m_ba.mk_not(m_ba.mk_or(vs.size(), vs.c_ptr())), m); + ref_t cond(m_ba.mk_not(m_ba.mk_or(vs.size(), vs.data())), m); lbool is_sat = m_ba.is_sat(cond); if (is_sat == l_undef) { return nullptr; diff --git a/src/math/grobner/grobner.cpp b/src/math/grobner/grobner.cpp index 5e547f806..a0947ea42 100644 --- a/src/math/grobner/grobner.cpp +++ b/src/math/grobner/grobner.cpp @@ -175,7 +175,7 @@ void grobner::display_monomials(std::ostream & out, unsigned num_monomials, mono } void grobner::display_equation(std::ostream & out, equation const & eq) const { - display_monomials(out, eq.m_monomials.size(), eq.m_monomials.c_ptr()); + display_monomials(out, eq.m_monomials.size(), eq.m_monomials.data()); out << " = 0\n"; } @@ -383,7 +383,7 @@ void grobner::assert_eq(expr * eq, v_dependency * ex) { new_c = m_util.mk_numeral(c, is_int); monomials.push_back(new_c); } - assert_eq_0(monomials.size(), monomials.c_ptr(), ex); + assert_eq_0(monomials.size(), monomials.data(), ex); } void grobner::assert_monomial_tautology(expr * m) { @@ -424,7 +424,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.c_ptr()); 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) @@ -456,7 +456,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.c_ptr()); tout << "\n";); + TRACE("grobner", tout << "after merging monomials:\n"; display_monomials(tout, monomials.size(), monomials.data()); tout << "\n";); } /** @@ -527,7 +527,7 @@ bool grobner::is_subset(monomial const * m1, monomial const * m2, ptr_vector= sz2) @@ -565,8 +565,8 @@ void grobner::mul_append(unsigned start_idx, equation const * source, rational c monomial * new_m = alloc(monomial); new_m->m_coeff = m->m_coeff; new_m->m_coeff *= coeff; - new_m->m_vars.append(m->m_vars.size(), m->m_vars.c_ptr()); - new_m->m_vars.append(vars.size(), vars.c_ptr()); + new_m->m_vars.append(m->m_vars.size(), m->m_vars.data()); + new_m->m_vars.append(vars.size(), vars.data()); for (expr* e : new_m->m_vars) m_manager.inc_ref(e); std::stable_sort(new_m->m_vars.begin(), new_m->m_vars.end(), m_var_lt); @@ -652,7 +652,7 @@ grobner::equation * grobner::simplify(equation const * source, equation * target } if (simplified) { target->m_monomials.shrink(j); - target->m_monomials.append(new_monomials.size(), new_monomials.c_ptr()); + target->m_monomials.append(new_monomials.size(), new_monomials.data()); simplify(target); } } @@ -857,8 +857,8 @@ void grobner::superpose(equation * eq1, equation * eq2) { 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); - tout << "rest1: "; display_vars(tout, rest1.size(), rest1.c_ptr()); tout << "\n"; - tout << "rest2: "; display_vars(tout, rest2.size(), rest2.c_ptr()); tout << "\n";); + 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; new_monomials.reset(); mul_append(1, eq1, eq2->m_monomials[0]->m_coeff, rest2, new_monomials); @@ -866,7 +866,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.c_ptr()); 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++; diff --git a/src/math/grobner/grobner.h b/src/math/grobner/grobner.h index f550bdd9d..311b7a3f0 100644 --- a/src/math/grobner/grobner.h +++ b/src/math/grobner/grobner.h @@ -67,7 +67,7 @@ public: public: unsigned get_num_monomials() const { return m_monomials.size(); } monomial const * get_monomial(unsigned idx) const { return m_monomials[idx]; } - monomial * const * get_monomials() const { return m_monomials.c_ptr(); } + monomial * const * get_monomials() const { return m_monomials.data(); } v_dependency * get_dependency() const { return m_dep; } unsigned hash() const { return m_bidx; } bool is_linear_combination() const { return m_lc; } diff --git a/src/math/grobner/pdd_simplifier.cpp b/src/math/grobner/pdd_simplifier.cpp index c107c8dec..fe6d45d30 100644 --- a/src/math/grobner/pdd_simplifier.cpp +++ b/src/math/grobner/pdd_simplifier.cpp @@ -502,7 +502,7 @@ namespace dd { unsigned_vector& vars; hash(unsigned_vector& vars):vars(vars) {} bool operator()(mon const& m) const { - return unsigned_ptr_hash(vars.c_ptr() + m.offset, m.sz, 1); + return unsigned_ptr_hash(vars.data() + m.offset, m.sz, 1); }; }; struct eq { @@ -539,7 +539,7 @@ namespace dd { for (pdd const& p : eqs) { for (auto const& m : p) { if (m.vars.size() <= 1) continue; - insert_mon(m.vars.size(), m.vars.c_ptr()); + insert_mon(m.vars.size(), m.vars.data()); } } @@ -572,7 +572,7 @@ namespace dd { } unsigned n = m.vars.size(); mon mm(n, vars.size()); - vars.append(n, m.vars.c_ptr()); + vars.append(n, m.vars.data()); VERIFY(mon2idx.find(mm, mm)); vars.shrink(vars.size() - n); row.set(mm.index); diff --git a/src/math/hilbert/heap_trie.h b/src/math/hilbert/heap_trie.h index b297ab0b9..8b9f60f73 100644 --- a/src/math/hilbert/heap_trie.h +++ b/src/math/hilbert/heap_trie.h @@ -225,7 +225,7 @@ public: void insert(Key const* keys, Value const& val) { ++m_stats.m_num_inserts; - insert(m_root, num_keys(), keys, m_keys.c_ptr(), val); + insert(m_root, num_keys(), keys, m_keys.data(), val); #if 0 if (m_stats.m_num_inserts == (1 << m_do_reshuffle)) { m_do_reshuffle++; @@ -364,7 +364,7 @@ public: } } Key const* keys() { - return m_keys.c_ptr(); + return m_keys.data(); } Value const& value() const { @@ -532,7 +532,7 @@ private: } verbose_stream() << " |-> " << it.value() << "\n";); - insert(new_root, num_keys(), it.keys(), sorted_keys.c_ptr(), it.value()); + insert(new_root, num_keys(), it.keys(), sorted_keys.data(), it.value()); } del_node(m_root); m_root = new_root; diff --git a/src/math/hilbert/hilbert_basis.cpp b/src/math/hilbert/hilbert_basis.cpp index d6d4366db..586027103 100644 --- a/src/math/hilbert/hilbert_basis.cpp +++ b/src/math/hilbert/hilbert_basis.cpp @@ -773,7 +773,7 @@ unsigned hilbert_basis::get_num_vars() const { } hilbert_basis::values hilbert_basis::vec(offset_t offs) const { - return values(m_ineqs.size(), m_store.c_ptr() + offs.m_offset); + return values(m_ineqs.size(), m_store.data() + offs.m_offset); } void hilbert_basis::init_basis() { diff --git a/src/math/lp/emonics.h b/src/math/lp/emonics.h index a72aa0fde..0d0c20fcb 100644 --- a/src/math/lp/emonics.h +++ b/src/math/lp/emonics.h @@ -61,7 +61,7 @@ class emonics { unsigned operator()(lpvar v) const { auto const& vec = v != UINT_MAX? em.m_monics[em.m_var2index[v]].rvars() : em.m_find_key; - return string_hash(reinterpret_cast(vec.c_ptr()), sizeof(lpvar)*vec.size(), 10); + return string_hash(reinterpret_cast(vec.data()), sizeof(lpvar)*vec.size(), 10); } }; @@ -155,7 +155,7 @@ public: \brief create a monic from an equality v := vs */ void add(lpvar v, unsigned sz, lpvar const* vs); - void add(lpvar v, svector const& vs) { add(v, vs.size(), vs.c_ptr()); } + void add(lpvar v, svector const& vs) { add(v, vs.size(), vs.data()); } void add(lpvar v, lpvar x, lpvar y) { lpvar vs[2] = { x, y }; add(v, 2, vs); } void add(lpvar v, lpvar x, lpvar y, lpvar z) { lpvar vs[3] = { x, y, z }; add(v, 3, vs); } diff --git a/src/math/lp/nex.h b/src/math/lp/nex.h index 0d57c571c..26759cb33 100644 --- a/src/math/lp/nex.h +++ b/src/math/lp/nex.h @@ -345,8 +345,8 @@ public: return degree; } nex const* operator[](unsigned j) const { return m_children[j]; } - const nex * const* begin() const { return m_children.c_ptr(); } - const nex * const* end() const { return m_children.c_ptr() + m_children.size(); } + const nex * const* begin() const { return m_children.data(); } + const nex * const* end() const { return m_children.data() + m_children.size(); } #ifdef Z3DEBUG void sort() override { diff --git a/src/math/lp/nra_solver.cpp b/src/math/lp/nra_solver.cpp index 79a7fc060..31c8d2f11 100644 --- a/src/math/lp/nra_solver.cpp +++ b/src/math/lp/nra_solver.cpp @@ -120,13 +120,13 @@ struct solver::imp { for (auto v : m.vars()) { vars.push_back(lp2nl(v)); } - polynomial::monomial_ref m1(pm.mk_monomial(vars.size(), vars.c_ptr()), pm); + polynomial::monomial_ref m1(pm.mk_monomial(vars.size(), vars.data()), pm); polynomial::monomial_ref m2(pm.mk_monomial(lp2nl(m.var()), 1), pm); polynomial::monomial * mls[2] = { m1, m2 }; polynomial::scoped_numeral_vector coeffs(pm.m()); coeffs.push_back(mpz(1)); coeffs.push_back(mpz(-1)); - polynomial::polynomial_ref p(pm.mk_polynomial(2, coeffs.c_ptr(), mls), pm); + polynomial::polynomial_ref p(pm.mk_polynomial(2, coeffs.data(), mls), pm); polynomial::polynomial* ps[1] = { p }; bool even[1] = { false }; nlsat::literal lit = m_nlsat->mk_ineq_literal(nlsat::atom::kind::EQ, 1, ps, even); @@ -151,7 +151,7 @@ struct solver::imp { coeffs.push_back(den * kv.first); } rhs *= den; - polynomial::polynomial_ref p(pm.mk_linear(sz, coeffs.c_ptr(), vars.c_ptr(), -rhs), pm); + polynomial::polynomial_ref p(pm.mk_linear(sz, coeffs.data(), vars.data(), -rhs), pm); polynomial::polynomial* ps[1] = { p }; bool is_even[1] = { false }; nlsat::literal lit; @@ -216,7 +216,7 @@ struct solver::imp { } coeffs.push_back(-den); polynomial::manager& pm = m_nlsat->pm(); - polynomial::polynomial_ref p(pm.mk_linear(coeffs.size(), coeffs.c_ptr(), vars.c_ptr(), rational(0)), pm); + polynomial::polynomial_ref p(pm.mk_linear(coeffs.size(), coeffs.data(), vars.data(), rational(0)), pm); polynomial::polynomial* ps[1] = { p }; bool is_even[1] = { false }; nlsat::literal lit = m_nlsat->mk_ineq_literal(nlsat::atom::kind::EQ, 1, ps, is_even); diff --git a/src/math/polynomial/algebraic_numbers.cpp b/src/math/polynomial/algebraic_numbers.cpp index b4763555f..06fbe228e 100644 --- a/src/math/polynomial/algebraic_numbers.cpp +++ b/src/math/polynomial/algebraic_numbers.cpp @@ -554,8 +554,8 @@ namespace algebraic_numbers { else { scoped_upoly & up_sqf = m_isolate_tmp3; up_sqf.reset(); - upm().square_free(up.size(), up.c_ptr(), up_sqf); - TRACE("algebraic", upm().display(tout, up_sqf.size(), up_sqf.c_ptr()); tout << "\n";); + upm().square_free(up.size(), up.data(), up_sqf); + TRACE("algebraic", upm().display(tout, up_sqf.size(), up_sqf.data()); tout << "\n";); r.push_back(up_sqf, 1); return false; } @@ -610,10 +610,10 @@ namespace algebraic_numbers { factors & fs = m_isolate_factors; fs.reset(); bool full_fact; - if (upm().has_zero_roots(up.size(), up.c_ptr())) { + if (upm().has_zero_roots(up.size(), up.data())) { roots.push_back(numeral()); scoped_upoly & nz_up = m_isolate_tmp2; - upm().remove_zero_roots(up.size(), up.c_ptr(), nz_up); + upm().remove_zero_roots(up.size(), up.data(), nz_up); full_fact = factor(nz_up, fs); } else { @@ -640,7 +640,7 @@ namespace algebraic_numbers { continue; } SASSERT(m_isolate_roots.empty() && m_isolate_lowers.empty() && m_isolate_uppers.empty()); - upm().sqf_isolate_roots(f.size(), f.c_ptr(), bqm(), m_isolate_roots, m_isolate_lowers, m_isolate_uppers); + 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";); @@ -654,13 +654,13 @@ namespace algebraic_numbers { for (unsigned i = 0; i < sz; i++) { mpbq & lower = m_isolate_lowers[i]; mpbq & upper = m_isolate_uppers[i]; - if (!upm().isolating2refinable(f.size(), f.c_ptr(), bqm(), lower, upper)) { + if (!upm().isolating2refinable(f.size(), f.data(), bqm(), lower, upper)) { // found rational root... it is stored in lower to_mpq(qm(), lower, r); roots.push_back(numeral(mk_basic_cell(r))); } else { - algebraic_cell * c = mk_algebraic_cell(f.size(), f.c_ptr(), lower, upper, full_fact); + algebraic_cell * c = mk_algebraic_cell(f.size(), f.data(), lower, upper, full_fact); roots.push_back(numeral(c)); } } @@ -990,7 +990,7 @@ namespace algebraic_numbers { 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";); if (bqim().contains_zero(r_i)) { - if (upm().has_zero_roots(p.size(), p.c_ptr())) { + 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); @@ -1012,15 +1012,15 @@ namespace algebraic_numbers { // make sure 0 is not a root of p scoped_upoly & nz_p = m_add_tmp; - if (upm().has_zero_roots(p.size(), p.c_ptr())) { + if (upm().has_zero_roots(p.size(), p.data())) { // remove zero root - upm().remove_zero_roots(p.size(), p.c_ptr(), nz_p); + upm().remove_zero_roots(p.size(), p.data(), nz_p); } else { p.swap(nz_p); } - if (!upm().isolating2refinable(nz_p.size(), nz_p.c_ptr(), bqm(), r_i.lower(), r_i.upper())) { + if (!upm().isolating2refinable(nz_p.size(), nz_p.data(), bqm(), r_i.lower(), r_i.upper())) { // found actual root scoped_mpq r(qm()); to_mpq(qm(), r_i.lower(), r); @@ -1028,7 +1028,7 @@ namespace algebraic_numbers { } else { TRACE("algebraic", tout << "set_core...\n";); - set(c, nz_p.size(), nz_p.c_ptr(), r_i.lower(), r_i.upper(), minimal); + set(c, nz_p.size(), nz_p.data(), r_i.lower(), r_i.upper(), minimal); } } @@ -1064,7 +1064,7 @@ namespace algebraic_numbers { for (unsigned i = 0; i < num_fs; i++) { 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].c_ptr(), *seq); + upm().sturm_seq(fs[i].size(), fs[i].data(), *seq); seqs.push_back(seq); } SASSERT(seqs.size() == num_fs); @@ -1114,7 +1114,7 @@ namespace algebraic_numbers { 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].c_ptr(), f); + upm().set(fs[target_i].size(), fs[target_i].data(), f); set_core(c, f, r_i, *(seqs[target_i]), target_lV, target_uV, full_fact); return; } @@ -1144,7 +1144,7 @@ namespace algebraic_numbers { scoped_ptr_vector seqs; for (unsigned i = 0; i < num_fs; i++) { typename upolynomial::scoped_upolynomial_sequence * seq = alloc(typename upolynomial::scoped_upolynomial_sequence, upm()); - upm().sturm_seq(fs[i].size(), fs[i].c_ptr(), *seq); + upm().sturm_seq(fs[i].size(), fs[i].data(), *seq); seqs.push_back(seq); } SASSERT(seqs.size() == num_fs); @@ -1188,7 +1188,7 @@ namespace algebraic_numbers { if (num_rem == 1 && target_i != UINT_MAX) { // found isolating interval saved_a.restore_if_too_small(); - upm().set(fs[target_i].size(), fs[target_i].c_ptr(), f); + upm().set(fs[target_i].size(), fs[target_i].data(), f); set_core(b, f, r_i, *(seqs[target_i]), target_lV, target_uV, full_fact); return; } @@ -1363,10 +1363,10 @@ 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.c_ptr()); 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.c_ptr(), lower, upper, false); + set(b, p.size(), p.data(), lower, upper, false); } void root(numeral & a, unsigned k, numeral & b) { @@ -1466,15 +1466,15 @@ namespace algebraic_numbers { qm().add(il, nbv, il); qm().add(iu, nbv, iu); // (il, iu) is an isolating refinable (rational) interval for the new polynomial. - upm().convert_q2bq_interval(m_add_tmp.size(), m_add_tmp.c_ptr(), il, iu, bqm(), l, u); + upm().convert_q2bq_interval(m_add_tmp.size(), m_add_tmp.data(), il, iu, bqm(), l, u); } TRACE("algebraic", - upm().display(tout, m_add_tmp.size(), m_add_tmp.c_ptr()); + 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.c_ptr(), l) << "\n"; - tout << "u_sign: " << upm().eval_sign_at(m_add_tmp.size(), m_add_tmp.c_ptr(), u) << "\n"; + tout << "l_sign: " << upm().eval_sign_at(m_add_tmp.size(), m_add_tmp.data(), l) << "\n"; + tout << "u_sign: " << upm().eval_sign_at(m_add_tmp.size(), m_add_tmp.data(), u) << "\n"; ); - set(c, m_add_tmp.size(), m_add_tmp.c_ptr(), l, u, a->m_minimal /* minimality is preserved */); + set(c, m_add_tmp.size(), m_add_tmp.data(), l, u, a->m_minimal /* minimality is preserved */); normalize(c); } @@ -1550,7 +1550,7 @@ namespace algebraic_numbers { qm().inv(nbv); scoped_upoly & mulp = m_add_tmp; upm().set(a->m_p_sz, a->m_p, mulp); - upm().compose_p_q_x(mulp.size(), mulp.c_ptr(), nbv); + upm().compose_p_q_x(mulp.size(), mulp.data(), nbv); mpbqi const & i = a->m_interval; scoped_mpbq l(bqm()); scoped_mpbq u(bqm()); @@ -1576,15 +1576,15 @@ namespace algebraic_numbers { if (is_neg) qm().swap(il, iu); // (il, iu) is an isolating refinable (rational) interval for the new polynomial. - upm().convert_q2bq_interval(mulp.size(), mulp.c_ptr(), il, iu, bqm(), l, u); + upm().convert_q2bq_interval(mulp.size(), mulp.data(), il, iu, bqm(), l, u); } TRACE("algebraic", - upm().display(tout, mulp.size(), mulp.c_ptr()); + upm().display(tout, mulp.size(), mulp.data()); tout << ", l: " << l << ", u: " << u << "\n"; - tout << "l_sign: " << upm().eval_sign_at(mulp.size(), mulp.c_ptr(), l) << "\n"; - tout << "u_sign: " << upm().eval_sign_at(mulp.size(), mulp.c_ptr(), u) << "\n"; + tout << "l_sign: " << upm().eval_sign_at(mulp.size(), mulp.data(), l) << "\n"; + tout << "u_sign: " << upm().eval_sign_at(mulp.size(), mulp.data(), u) << "\n"; ); - set(c, mulp.size(), mulp.c_ptr(), l, u, a->m_minimal /* minimality is preserved */); + set(c, mulp.size(), mulp.data(), l, u, a->m_minimal /* minimality is preserved */); normalize(c); } @@ -2223,7 +2223,7 @@ namespace algebraic_numbers { SASSERT(pm().is_univariate(R)); scoped_upoly & _R = m_eval_sign_tmp; upm().to_numeral_vector(R, _R); - unsigned k = upm().nonzero_root_lower_bound(_R.size(), _R.c_ptr()); + unsigned k = upm().nonzero_root_lower_bound(_R.size(), _R.data()); TRACE("anum_eval_sign", tout << "R: " << R << "\nk: " << k << "\nri: "<< ri << "\n";); scoped_mpbq mL(bqm()), L(bqm()); bqm().set(mL, -1); diff --git a/src/math/polynomial/polynomial.cpp b/src/math/polynomial/polynomial.cpp index 71e04d694..96e92f8ac 100644 --- a/src/math/polynomial/polynomial.cpp +++ b/src/math/polynomial/polynomial.cpp @@ -917,7 +917,7 @@ namespace polynomial { else m_powers_tmp.push_back(power(x, 1)); } - return mk_monomial(m_powers_tmp.size(), m_powers_tmp.c_ptr()); + return mk_monomial(m_powers_tmp.size(), m_powers_tmp.data()); } monomial * mul(unsigned sz1, power const * pws1, unsigned sz2, power const * pws2) { @@ -1335,8 +1335,8 @@ namespace polynomial { buckets[i].reset(); } SASSERT(p.size() == end - start); - apply_permutation(p.size(), m_as + start, p.c_ptr()); - apply_permutation_core(p.size(), m_ms + start, p.c_ptr()); // p is not needed anymore after this command + apply_permutation(p.size(), m_as + start, p.data()); + apply_permutation_core(p.size(), m_ms + start, p.data()); // p is not needed anymore after this command i = start; while (i < end) { monomial * m = m_ms[i]; @@ -1878,7 +1878,7 @@ namespace polynomial { if (sz == 0) return false; scoped_numeral g(m); - m.gcd(as.size(), as.c_ptr(), g); + m.gcd(as.size(), as.data(), g); if (m.is_one(g)) return false; SASSERT(m.is_pos(g)); @@ -2152,7 +2152,7 @@ namespace polynomial { polynomial * mk(bool normalize = false) { remove_zeros(normalize); - polynomial * p = m_owner->mk_polynomial_core(m_tmp_as.size(), m_tmp_as.c_ptr(), m_tmp_ms.c_ptr()); + polynomial * p = m_owner->mk_polynomial_core(m_tmp_as.size(), m_tmp_as.data(), m_tmp_ms.data()); m_tmp_as.reset(); m_tmp_ms.reset(); return p; @@ -2312,7 +2312,7 @@ namespace polynomial { } polynomial * mk() { - polynomial * new_p = m_owner->mk_polynomial_core(m_tmp_as.size(), m_tmp_as.c_ptr(), m_tmp_ms.c_ptr()); + polynomial * new_p = m_owner->mk_polynomial_core(m_tmp_as.size(), m_tmp_as.data(), m_tmp_ms.data()); m_tmp_as.reset(); m_tmp_ms.reset(); return new_p; @@ -2614,7 +2614,7 @@ namespace polynomial { polynomial * mk_polynomial(unsigned sz, rational const * as, monomial * const * ms) { rational2numeral(sz, as); - polynomial * p = mk_polynomial(sz, m_rat2numeral.c_ptr(), ms); + polynomial * p = mk_polynomial(sz, m_rat2numeral.data(), ms); reset_tmp_as2(); return p; } @@ -2636,7 +2636,7 @@ namespace polynomial { polynomial * mk_univariate(var x, unsigned n, rational const * as) { SASSERT(is_valid(x)); rational2numeral(n+1, as); - polynomial * p = mk_univariate(x, n, m_rat2numeral.c_ptr()); + polynomial * p = mk_univariate(x, n, m_rat2numeral.data()); reset_tmp_as2(); return p; } @@ -2656,7 +2656,7 @@ namespace polynomial { swap(m_tmp_linear_as.back(), c); m_tmp_linear_ms.push_back(mk_unit()); } - polynomial * p = mk_polynomial(m_tmp_linear_as.size(), m_tmp_linear_as.c_ptr(), m_tmp_linear_ms.c_ptr()); + polynomial * p = mk_polynomial(m_tmp_linear_as.size(), m_tmp_linear_as.data(), m_tmp_linear_ms.data()); for (auto& a : m_tmp_linear_as) { m_manager.del(a); } @@ -2670,7 +2670,7 @@ namespace polynomial { rational2numeral(sz, as); numeral tmp_c; m_manager.set(tmp_c, c.to_mpq().numerator()); - polynomial * p = mk_linear(sz, m_rat2numeral.c_ptr(), xs, tmp_c); + polynomial * p = mk_linear(sz, m_rat2numeral.data(), xs, tmp_c); SASSERT(m_manager.is_zero(tmp_c)); reset_tmp_as2(); return p; @@ -3202,7 +3202,7 @@ namespace polynomial { tout << m.to_string(cs[i]) << " "; } tout << "\n";); - solver.add(i, cs.c_ptr(), m_outputs[output_idx]); + solver.add(i, cs.data(), m_outputs[output_idx]); } TRACE("sparse_interpolator", tout << "find coefficients of:\n"; @@ -3211,7 +3211,7 @@ namespace polynomial { } tout << "system of equations:\n"; solver.display(tout);); - if (!solver.solve(new_as.c_ptr())) + if (!solver.solve(new_as.data())) return false; for (unsigned i = 0; i < num_pws; i++) { if (!m.is_zero(new_as[i])) { @@ -3220,7 +3220,7 @@ namespace polynomial { } } } - r = m_skeleton->pm.mk_polynomial(as.size(), as.c_ptr(), mons.c_ptr()); + r = m_skeleton->pm.mk_polynomial(as.size(), as.data(), mons.data()); return true; } }; @@ -4737,7 +4737,7 @@ namespace polynomial { push_power(pws, y, n - k); push_power(pws, x, k); } - monomial * new_m = mk_monomial(pws.size(), pws.c_ptr()); + monomial * new_m = mk_monomial(pws.size(), pws.data()); m_cheap_som_buffer.add(p->a(i), new_m); } return m_cheap_som_buffer.mk(); @@ -5668,7 +5668,7 @@ namespace polynomial { h1 = exact_div(h1, hs0); S.push_back(h1); if (is_zero(G2)) { - std::reverse(S.c_ptr(), S.c_ptr() + S.size()); + std::reverse(S.data(), S.data() + S.size()); return; } } @@ -5855,7 +5855,7 @@ namespace polynomial { psc_chain_optimized_core(Q, P, x, S); if (S.empty()) S.push_back(mk_zero()); - std::reverse(S.c_ptr(), S.c_ptr() + S.size()); + std::reverse(S.data(), S.data() + S.size()); } void psc_chain_classic_core(polynomial const * P, polynomial const * Q, var x, polynomial_ref_vector & S) { @@ -5935,7 +5935,7 @@ namespace polynomial { psc_chain_classic_core(Q, P, x, S); if (S.empty()) S.push_back(mk_zero()); - std::reverse(S.c_ptr(), S.c_ptr() + S.size()); + std::reverse(S.data(), S.data() + S.size()); } void psc_chain(polynomial const * A, polynomial const * B, var x, polynomial_ref_vector & S) { @@ -6253,7 +6253,7 @@ namespace polynomial { unsigned num_vars() const { return m_xs.size(); } - var const * vars() const { return m_xs.c_ptr(); } + var const * vars() const { return m_xs.data(); } }; struct scoped_var_max_degree { @@ -6752,7 +6752,7 @@ namespace polynomial { for (unsigned i = 0; i < num_factors; i++) { numeral_vector const & f1 = fs[i]; unsigned k1 = fs.get_degree(i); - f = to_polynomial(f1.size(), f1.c_ptr(), x); + f = to_polynomial(f1.size(), f1.data(), x); TRACE("factor_bug", tout << "uni-factor:\n"; upm().display(tout, f1); tout << "\n"; tout << "factor:\n" << f << "\n";); @@ -6878,7 +6878,7 @@ namespace polynomial { coeffs.push_back(numeral()); m_manager.set(coeffs.back(), p[i]); } - return mk_univariate(x, sz-1, coeffs.c_ptr()); + return mk_univariate(x, sz-1, coeffs.data()); } polynomial * mk_glex_monic(polynomial const * p) { @@ -7510,7 +7510,7 @@ polynomial::polynomial * convert(polynomial::manager & sm, polynomial::polynomia } } } - return tm.mk_polynomial(as.size(), as.c_ptr(), ms.c_ptr()); + return tm.mk_polynomial(as.size(), as.data(), ms.data()); } std::ostream & operator<<(std::ostream & out, polynomial_ref_vector const & seq) { diff --git a/src/math/polynomial/polynomial.h b/src/math/polynomial/polynomial.h index 6a1a87cd9..20c9b6b40 100644 --- a/src/math/polynomial/polynomial.h +++ b/src/math/polynomial/polynomial.h @@ -981,7 +981,7 @@ namespace polynomial { */ polynomial * to_polynomial(unsigned sz, numeral const * p, var x); polynomial * to_polynomial(numeral_vector const & p, var x) { - return to_polynomial(p.size(), p.c_ptr(), x); + return to_polynomial(p.size(), p.data(), x); } /** @@ -1003,7 +1003,7 @@ namespace polynomial { void translate(polynomial const * p, unsigned xs_sz, var const * xs, numeral const * vs, polynomial_ref & r); void translate(polynomial const * p, var_vector const & xs, numeral_vector const & vs, polynomial_ref & r) { SASSERT(xs.size() == vs.size()); - translate(p, xs.size(), xs.c_ptr(), vs.c_ptr(), r); + translate(p, xs.size(), xs.data(), vs.data(), r); } /** diff --git a/src/math/polynomial/rpolynomial.cpp b/src/math/polynomial/rpolynomial.cpp index 90db9c832..0afd22a75 100644 --- a/src/math/polynomial/rpolynomial.cpp +++ b/src/math/polynomial/rpolynomial.cpp @@ -318,7 +318,7 @@ namespace rpolynomial { numeral * new_arg = mk_numeral(); m_manager.set(*new_arg, 1); new_args.push_back(to_poly_or_num(new_arg)); - return mk_poly(new_args.size(), new_args.c_ptr(), x); + return mk_poly(new_args.size(), new_args.data(), x); } poly_or_num * unpack(polynomial const * p) { @@ -361,7 +361,7 @@ namespace rpolynomial { for (unsigned i = 0; i < sz; i++) { new_args.push_back(mul_core(c, _p->arg(i))); } - return mk_poly_core(new_args.size(), new_args.c_ptr(), _p->max_var()); + return mk_poly_core(new_args.size(), new_args.data(), _p->max_var()); } } @@ -401,7 +401,7 @@ namespace rpolynomial { new_args.push_back(add_core(c, _p->arg(0))); for (unsigned i = 1; i < sz; i++) new_args.push_back(_p->arg(1)); - return mk_poly_core(new_args.size(), new_args.c_ptr(), _p->max_var()); + return mk_poly_core(new_args.size(), new_args.data(), _p->max_var()); } } diff --git a/src/math/polynomial/sexpr2upolynomial.cpp b/src/math/polynomial/sexpr2upolynomial.cpp index 790fefeb8..25c85a0ab 100644 --- a/src/math/polynomial/sexpr2upolynomial.cpp +++ b/src/math/polynomial/sexpr2upolynomial.cpp @@ -45,7 +45,7 @@ void sexpr2upolynomial(upolynomial::manager & m, sexpr const * s, upolynomial::n for (unsigned i = 2; i < num; i++) { m.reset(arg); sexpr2upolynomial(m, s->get_child(i), arg, depth+1); - m.add(arg.size(), arg.c_ptr(), p.size(), p.c_ptr(), p); + m.add(arg.size(), arg.data(), p.size(), p.data(), p); } } else if (op == "-") { @@ -60,7 +60,7 @@ void sexpr2upolynomial(upolynomial::manager & m, sexpr const * s, upolynomial::n for (unsigned i = 2; i < num; i++) { m.reset(arg); sexpr2upolynomial(m, s->get_child(i), arg, depth+1); - m.sub(p.size(), p.c_ptr(), arg.size(), arg.c_ptr(), p); + m.sub(p.size(), p.data(), arg.size(), arg.data(), p); } } else if (op == "*") { @@ -71,7 +71,7 @@ void sexpr2upolynomial(upolynomial::manager & m, sexpr const * s, upolynomial::n for (unsigned i = 2; i < num; i++) { m.reset(arg); sexpr2upolynomial(m, s->get_child(i), arg, depth+1); - m.mul(arg.size(), arg.c_ptr(), p.size(), p.c_ptr(), p); + m.mul(arg.size(), arg.data(), p.size(), p.data(), p); } } else if (op == "^") { @@ -82,7 +82,7 @@ void sexpr2upolynomial(upolynomial::manager & m, sexpr const * s, upolynomial::n if (!arg2->is_numeral() || !arg2->get_numeral().is_unsigned()) throw sexpr2upolynomial_exception("invalid univariate polynomial, exponent must be an unsigned integer", arg2); unsigned k = arg2->get_numeral().get_unsigned(); - m.pw(p.size(), p.c_ptr(), k, p); + m.pw(p.size(), p.data(), k, p); } else { throw sexpr2upolynomial_exception("invalid univariate polynomial, '+', '-', '^' or '*' expected", s); diff --git a/src/math/polynomial/upolynomial.cpp b/src/math/polynomial/upolynomial.cpp index 6d6a3f09b..fd4010453 100644 --- a/src/math/polynomial/upolynomial.cpp +++ b/src/math/polynomial/upolynomial.cpp @@ -56,7 +56,7 @@ namespace upolynomial { SASSERT(degree > 0); m_factors.push_back(numeral_vector()); m_degrees.push_back(degree); - m_upm.set(p.size(), p.c_ptr(), m_factors.back()); + m_upm.set(p.size(), p.data(), m_factors.back()); m_total_factors += degree; m_total_degree += m_upm.degree(p)*degree; } @@ -84,11 +84,11 @@ namespace upolynomial { for (unsigned i = 0; i < m_factors.size(); ++ i) { if (m_degrees[i] > 1) { numeral_vector power; - m_upm.pw(m_factors[i].size(), m_factors[i].c_ptr(), m_degrees[i], power); - m_upm.mul(out.size(), out.c_ptr(), power.size(), power.c_ptr(), out); + m_upm.pw(m_factors[i].size(), m_factors[i].data(), m_degrees[i], power); + m_upm.mul(out.size(), out.data(), power.size(), power.data(), out); m_upm.reset(power); } else { - m_upm.mul(out.size(), out.c_ptr(), m_factors[i].size(), m_factors[i].c_ptr(), out); + m_upm.mul(out.size(), out.data(), m_factors[i].size(), m_factors[i].data(), out); } } } @@ -188,7 +188,7 @@ namespace upolynomial { // Copy elements from p to buffer. void core_manager::set(unsigned sz, numeral const * p, numeral_vector & buffer) { - if (p != nullptr && buffer.c_ptr() == p) { + if (p != nullptr && buffer.data() == p) { SASSERT(buffer.size() == sz); return; } @@ -395,7 +395,7 @@ namespace upolynomial { // Divide coefficients of p by their GCD void core_manager::normalize(numeral_vector & p) { - normalize(p.size(), p.c_ptr()); + normalize(p.size(), p.data()); } void core_manager::div(unsigned sz, numeral * p, numeral const & b) { @@ -423,7 +423,7 @@ namespace upolynomial { reset(p); return; } - mul(p.size(), p.c_ptr(), b); + mul(p.size(), p.data(), b); } // Pseudo division @@ -568,7 +568,7 @@ namespace upolynomial { rem(sz1, p1, sz2, p2, d, buffer); // We don't need to flip the sign if d is odd and leading coefficient of p2 is negative if (d % 2 == 0 || (sz2 > 0 && m().is_pos(p2[sz2-1]))) - neg(buffer.size(), buffer.c_ptr()); + neg(buffer.size(), buffer.data()); } @@ -619,7 +619,7 @@ 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.c_ptr() << ", _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) { @@ -750,8 +750,8 @@ namespace upolynomial { TRACE("mgcd", tout << "trying prime: " << p << "\n";); { scoped_set_zp setZp(*this, p); - set(pp_u.size(), pp_u.c_ptr(), u_Zp); - set(pp_v.size(), pp_v.c_ptr(), v_Zp); + 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";); continue; // bad prime @@ -760,9 +760,9 @@ namespace upolynomial { TRACE("mgcd", tout << "bad prime, leading coefficient vanished\n";); continue; // bad prime } - euclid_gcd(u_Zp.size(), u_Zp.c_ptr(), v_Zp.size(), v_Zp.c_ptr(), q); + euclid_gcd(u_Zp.size(), u_Zp.data(), v_Zp.size(), v_Zp.data(), q); // normalize so that lc_g is leading coefficient of q - mk_monic(q.size(), q.c_ptr()); + mk_monic(q.size(), q.data()); scoped_numeral c(m()); m().set(c, lc_g); mul(q, c); @@ -776,13 +776,13 @@ namespace upolynomial { return; } if (i == 0) { - set(q.size(), q.c_ptr(), C); + set(q.size(), q.data(), C); m().set(bound, p); } 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";); - set(q.size(), q.c_ptr(), C); + set(q.size(), q.data(), C); m().set(bound, p); } else { @@ -829,7 +829,7 @@ namespace upolynomial { set(sz1, p1, A); set(sz2, p2, B); TRACE("upolynomial", tout << "sz1: " << sz1 << ", p1: " << p1 << ", sz2: " << sz2 << ", p2: " << p2 << "\nB.size(): " << B.size() << - ", B.c_ptr(): " << B.c_ptr() << "\n";); + ", B.c_ptr(): " << B.data() << "\n";); while (m_limit.inc()) { TRACE("upolynomial", tout << "A: "; display(tout, A); tout <<"\nB: "; display(tout, B); tout << "\n";); if (B.empty()) { @@ -837,7 +837,7 @@ namespace upolynomial { buffer.swap(A); // to be consistent, if in a field, we make gcd monic if (is_field) { - mk_monic(buffer.size(), buffer.c_ptr()); + mk_monic(buffer.size(), buffer.data()); } else { flip_sign_if_lm_neg(buffer); @@ -846,7 +846,7 @@ namespace upolynomial { display(tout, buffer); tout << "\n";); return; } - rem(A.size(), A.c_ptr(), B.size(), B.c_ptr(), R); + rem(A.size(), A.data(), B.size(), B.data(), R); normalize(R); A.swap(B); B.swap(R); @@ -906,7 +906,7 @@ namespace upolynomial { buffer.swap(A); // to be consistent, if in a field, we make gcd monic if (field()) { - mk_monic(buffer.size(), buffer.c_ptr()); + mk_monic(buffer.size(), buffer.data()); } else { flip_sign_if_lm_neg(buffer); @@ -915,7 +915,7 @@ namespace upolynomial { display(tout, buffer); tout << "\n";); return; } - rem(A.size(), A.c_ptr(), B.size(), B.c_ptr(), d, R); + rem(A.size(), A.data(), B.size(), B.data(), d, R); unsigned pseudo_div_d = A.size() - B.size(); if (d < pseudo_div_d + 1) { // I used a standard subresultant implementation. @@ -967,13 +967,13 @@ namespace upolynomial { numeral_vector & p_prime = m_sqf_tmp1; numeral_vector & g = m_sqf_tmp2; derivative(sz, p, p_prime); - gcd(sz, p, p_prime.size(), p_prime.c_ptr(), g); + gcd(sz, p, p_prime.size(), p_prime.data(), g); // subresultant_gcd(sz, p, p_prime.size(), p_prime.c_ptr(), g); if (g.size() <= 1) { set(sz, p, buffer); } else { - div(sz, p, g.size(), g.c_ptr(), buffer); + div(sz, p, g.size(), g.data(), buffer); normalize(buffer); } } @@ -985,7 +985,7 @@ namespace upolynomial { numeral_vector & p_prime = m_sqf_tmp1; numeral_vector & g = m_sqf_tmp2; derivative(sz, p, p_prime); - gcd(sz, p, p_prime.size(), p_prime.c_ptr(), g); + gcd(sz, p, p_prime.size(), p_prime.data(), g); return g.size() <= 1; } @@ -1006,7 +1006,7 @@ namespace upolynomial { numeral_vector & result = m_pw_tmp; set(sz, p, result); for (unsigned i = 1; i < k; i++) - mul(m_pw_tmp.size(), m_pw_tmp.c_ptr(), sz, p, m_pw_tmp); + mul(m_pw_tmp.size(), m_pw_tmp.data(), sz, p, m_pw_tmp); r.swap(result); #if 0 unsigned mask = 1; @@ -1057,7 +1057,7 @@ namespace upolynomial { reset(U); U.push_back(numeral()); m().set(U.back(), 1); // D <- A set(szA, A, D); - mk_monic(szA, D.c_ptr()); + mk_monic(szA, D.data()); // V1 <- 0 reset(V1); // V3 <- B @@ -1069,30 +1069,30 @@ namespace upolynomial { numeral_vector & AU = V1; numeral_vector & D_AU = V3; // V <- (D - AU)/B - mul(szA, A, U.size(), U.c_ptr(), AU); - sub(D.size(), D.c_ptr(), AU.size(), AU.c_ptr(), D_AU); - div(D_AU.size(), D_AU.c_ptr(), szB, B, V); + mul(szA, A, U.size(), U.data(), AU); + sub(D.size(), D.data(), AU.size(), AU.data(), D_AU); + div(D_AU.size(), D_AU.data(), szB, B, V); DEBUG_CODE({ scoped_numeral_vector BV(m()); scoped_numeral_vector expected_D(m()); - mul(szB, B, V.size(), V.c_ptr(), BV); - add(AU.size(), AU.c_ptr(), BV.size(), BV.c_ptr(), expected_D); + mul(szB, B, V.size(), V.data(), BV); + add(AU.size(), AU.data(), BV.size(), BV.data(), expected_D); SASSERT(eq(expected_D, D)); }); // if D is not monic, make it monic scoped_numeral lc_inv(m()), lc(m()); - mk_monic(D.size(), D.c_ptr(), lc, lc_inv); + mk_monic(D.size(), D.data(), lc, lc_inv); mul(U, lc_inv); mul(V, lc_inv); return; } // D = QV3 + R - div_rem(D.size(), D.c_ptr(), V3.size(), V3.c_ptr(), Q, R); + div_rem(D.size(), D.data(), V3.size(), V3.data(), Q, R); // T <- U - V1Q - mul(V1.size(), V1.c_ptr(), Q.size(), Q.c_ptr(), V1Q); - sub(U.size(), U.c_ptr(), V1Q.size(), V1Q.c_ptr(), T); + mul(V1.size(), V1.data(), Q.size(), Q.data(), V1Q); + sub(U.size(), U.data(), V1Q.size(), V1Q.data(), T); // U <- V1 U.swap(V1); // D <- V3 @@ -1413,21 +1413,21 @@ namespace upolynomial { 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.c_ptr(), 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";); - unsigned result = descartes_bound_0_1(p_aux.size(), p_aux.c_ptr()); + unsigned result = descartes_bound_0_1(p_aux.size(), p_aux.data()); return result; } else if (bqm.is_nonpos(b)) { // Basic idea: apply descartes_bound_a_b to p(-x) with intervals (-b, -a) numeral_vector & p_aux = m_dbab_tmp2; set(sz, p, p_aux); - p_minus_x(p_aux.size(), p_aux.c_ptr()); + p_minus_x(p_aux.size(), p_aux.data()); scoped_mpbq mb(bqm); scoped_mpbq ma(bqm); bqm.set(mb, b); bqm.neg(mb); bqm.set(ma, a); bqm.neg(ma); - unsigned result = descartes_bound_a_b(p_aux.size(), p_aux.c_ptr(), bqm, mb, ma); + unsigned result = descartes_bound_a_b(p_aux.size(), p_aux.data(), bqm, mb, ma); return result; } else if (!has_zero_roots(sz, p)) { @@ -2118,7 +2118,7 @@ namespace upolynomial { // left child set(sz, p, p_aux); - compose_2n_p_x_div_2(p_aux.size(), p_aux.c_ptr()); + compose_2n_p_x_div_2(p_aux.size(), p_aux.data()); normalize(p_aux); for (unsigned i = 0; i < sz; i++) { p_stack.push_back(numeral()); @@ -2215,7 +2215,7 @@ namespace upolynomial { 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.c_ptr(), p_stack, frame_stack); + push_child_frames(q.size(), q.data(), p_stack, frame_stack); } else { push_child_frames(sz, p, p_stack, frame_stack); @@ -2253,7 +2253,7 @@ namespace upolynomial { 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.c_ptr(), p_stack, frame_stack); + push_child_frames(q.size(), q.data(), p_stack, frame_stack); } else { push_child_frames(sz, p, p_stack, frame_stack); @@ -2291,14 +2291,14 @@ namespace upolynomial { scoped_numeral_vector aux_p(m()); set(sz, p, aux_p); pos_k = std::max(neg_k, pos_k); - compose_p_2k_x(sz, aux_p.c_ptr(), pos_k); + compose_p_2k_x(sz, aux_p.data(), pos_k); // 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";); unsigned old_roots_sz = roots.size(); unsigned old_lowers_sz = lowers.size(); - drs_isolate_0_1_roots(sz, aux_p.c_ptr(), bqm, roots, lowers, uppers); + drs_isolate_0_1_roots(sz, aux_p.data(), bqm, roots, lowers, uppers); SASSERT(lowers.size() == uppers.size()); adjust_pos(bqm, roots, old_roots_sz, pos_k); adjust_pos(bqm, lowers, old_lowers_sz, pos_k); @@ -2330,7 +2330,7 @@ namespace upolynomial { TRACE("upolynomial", scoped_numeral U(m()); - root_upper_bound(p1.size(), p1.c_ptr(), U); + root_upper_bound(p1.size(), p1.data(), U); unsigned U_k = m().log2(U) + 1; tout << "Cauchy U: 2^" << U_k << "\n"; tout << "Knuth pos U: 2^" << knuth_positive_root_upper_bound(sz, p) << "\n"; @@ -2345,7 +2345,7 @@ namespace upolynomial { unsigned pos_k = m().log2(U) + 1; unsigned neg_k = pos_k; #endif - drs_isolate_roots(p1.size(), p1.c_ptr(), neg_k, pos_k, bqm, roots, lowers, uppers); + drs_isolate_roots(p1.size(), p1.data(), neg_k, pos_k, bqm, roots, lowers, uppers); } // Frame for root isolation in sturm_isolate_roots. @@ -2477,7 +2477,7 @@ namespace upolynomial { unsigned pos_k = m().log2(U) + 1; unsigned neg_k = pos_k; #endif - sturm_isolate_roots_core(p1.size(), p1.c_ptr(), neg_k, pos_k, bqm, roots, lowers, uppers); + sturm_isolate_roots_core(p1.size(), p1.data(), neg_k, pos_k, bqm, roots, lowers, uppers); } // Isolate roots of a square free polynomial that does not have zero roots @@ -2496,8 +2496,8 @@ namespace upolynomial { 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";); - SASSERT(!has_zero_roots(nz_p.size(), nz_p.c_ptr())); - sqf_nz_isolate_roots(nz_p.size(), nz_p.c_ptr(), bqm, roots, lowers, uppers); + SASSERT(!has_zero_roots(nz_p.size(), nz_p.data())); + sqf_nz_isolate_roots(nz_p.size(), nz_p.data(), bqm, roots, lowers, uppers); } else { sqf_nz_isolate_roots(sz, p, bqm, roots, lowers, uppers); @@ -2510,7 +2510,7 @@ namespace upolynomial { 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";); - sqf_isolate_roots(sqf_p.size(), sqf_p.c_ptr(), bqm, roots, lowers, uppers); + sqf_isolate_roots(sqf_p.size(), sqf_p.data(), bqm, roots, lowers, uppers); } // Keep expanding the Sturm sequence starting at seq @@ -2522,7 +2522,7 @@ namespace upolynomial { if (is_zero(r)) return; normalize(r); - seq.push(r.size(), r.c_ptr()); + seq.push(r.size(), r.data()); } } @@ -2538,7 +2538,7 @@ namespace upolynomial { scoped_numeral_vector p_prime(m()); seq.push(m(), sz, p); derivative(sz, p, p_prime); - seq.push(p_prime.size(), p_prime.c_ptr()); + seq.push(p_prime.size(), p_prime.data()); sturm_seq_core(seq); } @@ -2547,8 +2547,8 @@ namespace upolynomial { scoped_numeral_vector p1p2(m()); seq.push(m(), sz1, p1); derivative(sz1, p1, p1p2); - mul(p1p2.size(), p1p2.c_ptr(), sz2, p2, p1p2); - seq.push(p1p2.size(), p1p2.c_ptr()); + mul(p1p2.size(), p1p2.data(), sz2, p2, p1p2); + seq.push(p1p2.size(), p1p2.data()); sturm_seq_core(seq); } @@ -2563,7 +2563,7 @@ namespace upolynomial { unsigned sz = seq.size(); derivative(seq.size(sz-1), seq.coeffs(sz-1), p_prime); normalize(p_prime); - seq.push(p_prime.size(), p_prime.c_ptr()); + seq.push(p_prime.size(), p_prime.data()); } } diff --git a/src/math/polynomial/upolynomial.h b/src/math/polynomial/upolynomial.h index ad59bc00b..faa0e5e09 100644 --- a/src/math/polynomial/upolynomial.h +++ b/src/math/polynomial/upolynomial.h @@ -116,7 +116,7 @@ namespace upolynomial { numeral_vector m_sqf_tmp2; numeral_vector m_pw_tmp; - static bool is_alias(numeral const * p, numeral_vector & buffer) { return buffer.c_ptr() != nullptr && buffer.c_ptr() == p; } + static bool is_alias(numeral const * p, numeral_vector & buffer) { return buffer.data() != nullptr && buffer.data() == p; } void neg_core(unsigned sz1, numeral const * p1, numeral_vector & buffer); void add_core(unsigned sz1, numeral const * p1, unsigned sz2, numeral const * p2, numeral_vector & buffer); void sub_core(unsigned sz1, numeral const * p1, unsigned sz2, numeral const * p2, numeral_vector & buffer); @@ -192,7 +192,7 @@ namespace upolynomial { \brief Copy p to buffer. */ void set(unsigned sz, numeral const * p, numeral_vector & buffer); - void set(numeral_vector & target, numeral_vector const & source) { set(source.size(), source.c_ptr(), target); } + void set(numeral_vector & target, numeral_vector const & source) { set(source.size(), source.data(), target); } /** \brief Copy p to buffer. @@ -206,42 +206,42 @@ namespace upolynomial { */ void get_primitive_and_content(unsigned f_sz, numeral const * f, numeral_vector & pp, numeral & cont); void get_primitive_and_content(numeral_vector const & f, numeral_vector & pp, numeral & cont) { - get_primitive_and_content(f.size(), f.c_ptr(), pp, cont); + get_primitive_and_content(f.size(), f.data(), pp, cont); } void get_primitive(numeral_vector const & f, numeral_vector & pp) { scoped_numeral cont(m()); - get_primitive_and_content(f.size(), f.c_ptr(), pp, cont); + get_primitive_and_content(f.size(), f.data(), pp, cont); } /** \brief p := -p */ void neg(unsigned sz, numeral * p); - void neg(numeral_vector & p) { neg(p.size(), p.c_ptr()); } + void neg(numeral_vector & p) { neg(p.size(), p.data()); } /** \brief buffer := -p */ void neg(unsigned sz, numeral const * p, numeral_vector & buffer); - void neg(numeral_vector const & p, numeral_vector & p_neg) { neg(p.size(), p.c_ptr(), p_neg); } + void neg(numeral_vector const & p, numeral_vector & p_neg) { neg(p.size(), p.data(), p_neg); } /** \brief buffer := p1 + p2 */ void add(unsigned sz1, numeral const * p1, unsigned sz2, numeral const * p2, numeral_vector & buffer); - void add(numeral_vector const & a, numeral_vector const & b, numeral_vector & c) { add(a.size(), a.c_ptr(), b.size(), b.c_ptr(), c); } + void add(numeral_vector const & a, numeral_vector const & b, numeral_vector & c) { add(a.size(), a.data(), b.size(), b.data(), c); } /** \brief buffer := p1 - p2 */ void sub(unsigned sz1, numeral const * p1, unsigned sz2, numeral const * p2, numeral_vector & buffer); - void sub(numeral_vector const & a, numeral_vector const & b, numeral_vector & c) { sub(a.size(), a.c_ptr(), b.size(), b.c_ptr(), c); } + void sub(numeral_vector const & a, numeral_vector const & b, numeral_vector & c) { sub(a.size(), a.data(), b.size(), b.data(), c); } /** \brief buffer := p1 * p2 */ void mul(unsigned sz1, numeral const * p1, unsigned sz2, numeral const * p2, numeral_vector & buffer); - void mul(numeral_vector const & a, numeral_vector const & b, numeral_vector & c) { mul(a.size(), a.c_ptr(), b.size(), b.c_ptr(), c); } + void mul(numeral_vector const & a, numeral_vector const & b, numeral_vector & c) { mul(a.size(), a.data(), b.size(), b.data(), c); } /** \brief r := p^k @@ -252,7 +252,7 @@ namespace upolynomial { \brief buffer := dp/dx */ void derivative(unsigned sz1, numeral const * p, numeral_vector & buffer); - void derivative(numeral_vector const & p, numeral_vector & d_p) { derivative(p.size(), p.c_ptr(), d_p); } + void derivative(numeral_vector const & p, numeral_vector & d_p) { derivative(p.size(), p.data(), d_p); } /** \brief Divide coefficients of p by their GCD @@ -269,7 +269,7 @@ namespace upolynomial { This method assumes that every coefficient of p is a multiple of b, and b != 0. */ void div(unsigned sz, numeral * p, numeral const & b); - void div(numeral_vector & p, numeral const & b) { div(p.size(), p.c_ptr(), b); } + void div(numeral_vector & p, numeral const & b) { div(p.size(), p.data(), b); } /** \brief Multiply the coefficients of p by b. @@ -312,7 +312,7 @@ namespace upolynomial { } void div_rem(numeral_vector const & p1, numeral_vector const & p2, numeral_vector & q, numeral_vector & r) { - div_rem(p1.size(), p1.c_ptr(), p2.size(), p2.c_ptr(), q, r); + div_rem(p1.size(), p1.data(), p2.size(), p2.data(), q, r); } /** @@ -343,14 +343,14 @@ namespace upolynomial { \brief Return true if p2 divides p1. */ bool divides(unsigned sz1, numeral const * p1, unsigned sz2, numeral const * p2); - bool divides(numeral_vector const & p1, numeral_vector const & p2) { return divides(p1.size(), p1.c_ptr(), p2.size(), p2.c_ptr()); } + bool divides(numeral_vector const & p1, numeral_vector const & p2) { return divides(p1.size(), p1.data(), p2.size(), p2.data()); } /** \brief Return true if p2 divides p1, and store the quotient in q. */ bool exact_div(unsigned sz1, numeral const * p1, unsigned sz2, numeral const * p2, numeral_vector & q); bool exact_div(numeral_vector const & p1, numeral_vector const & p2, numeral_vector & q) { - return exact_div(p1.size(), p1.c_ptr(), p2.size(), p2.c_ptr(), q); + return exact_div(p1.size(), p1.data(), p2.size(), p2.data(), q); } /** @@ -360,7 +360,7 @@ namespace upolynomial { void mk_monic(unsigned sz, numeral * p, numeral & lc, numeral & lc_inv); void mk_monic(unsigned sz, numeral * p, numeral & lc) { numeral lc_inv; mk_monic(sz, p, lc, lc_inv); m().del(lc_inv); } void mk_monic(unsigned sz, numeral * p) { numeral lc, lc_inv; mk_monic(sz, p, lc, lc_inv); m().del(lc); m().del(lc_inv); } - void mk_monic(numeral_vector & p) { mk_monic(p.size(), p.c_ptr()); } + void mk_monic(numeral_vector & p) { mk_monic(p.size(), p.data()); } /** \brief g := gcd(p1, p2) @@ -370,10 +370,10 @@ namespace upolynomial { void euclid_gcd(unsigned sz1, numeral const * p1, unsigned sz2, numeral const * p2, numeral_vector & g); void subresultant_gcd(unsigned sz1, numeral const * p1, unsigned sz2, numeral const * p2, numeral_vector & g); void gcd(numeral_vector const & p1, numeral_vector const & p2, numeral_vector & g) { - gcd(p1.size(), p1.c_ptr(), p2.size(), p2.c_ptr(), g); + gcd(p1.size(), p1.data(), p2.size(), p2.data(), g); } void subresultant_gcd(numeral_vector const & p1, numeral_vector const & p2, numeral_vector & g) { - subresultant_gcd(p1.size(), p1.c_ptr(), p2.size(), p2.c_ptr(), g); + subresultant_gcd(p1.size(), p1.data(), p2.size(), p2.data(), g); } /** @@ -390,7 +390,7 @@ namespace upolynomial { \brief Return true if p is a square-free polynomial. */ bool is_square_free(numeral_vector const & p) { - return is_square_free(p.size(), p.c_ptr()); + return is_square_free(p.size(), p.data()); } /** @@ -453,20 +453,20 @@ namespace upolynomial { */ void ext_gcd(unsigned szA, numeral const * A, unsigned szB, numeral const * B, numeral_vector & U, numeral_vector & V, numeral_vector & D); void ext_gcd(numeral_vector const & A, numeral_vector const & B, numeral_vector & U, numeral_vector & V, numeral_vector & D) { - ext_gcd(A.size(), A.c_ptr(), B.size(), B.c_ptr(), U, V, D); + ext_gcd(A.size(), A.data(), B.size(), B.data(), U, V, D); } bool eq(unsigned sz1, numeral const * p1, unsigned sz2, numeral const * p2); - bool eq(numeral_vector const & p1, numeral_vector const & p2) { return eq(p1.size(), p1.c_ptr(), p2.size(), p2.c_ptr()); } + bool eq(numeral_vector const & p1, numeral_vector const & p2) { return eq(p1.size(), p1.data(), p2.size(), p2.data()); } std::ostream& display(std::ostream & out, unsigned sz, numeral const * p, char const * var_name = "x", bool use_star = false) const; - std::ostream& display(std::ostream & out, numeral_vector const & p, char const * var_name = "x") const { return display(out, p.size(), p.c_ptr(), var_name); } + std::ostream& display(std::ostream & out, numeral_vector const & p, char const * var_name = "x") const { return display(out, p.size(), p.data(), var_name); } std::ostream& display_star(std::ostream & out, unsigned sz, numeral const * p) { return display(out, sz, p, "x", true); } - std::ostream& display_star(std::ostream & out, numeral_vector const & p) { return display_star(out, p.size(), p.c_ptr()); } + std::ostream& display_star(std::ostream & out, numeral_vector const & p) { return display_star(out, p.size(), p.data()); } std::ostream& display_smt2(std::ostream & out, unsigned sz, numeral const * p, char const * var_name = "x") const; std::ostream& display_smt2(std::ostream & out, numeral_vector const & p, char const * var_name = "x") const { - return display_smt2(out, p.size(), p.c_ptr(), var_name); + return display_smt2(out, p.size(), p.data(), var_name); } }; @@ -531,7 +531,7 @@ namespace upolynomial { /** \brief Return the vector of coefficients for the i-th polynomial in the sequence. */ - numeral const * coeffs(unsigned i) const { return m_seq_coeffs.c_ptr() + m_begins[i]; } + numeral const * coeffs(unsigned i) const { return m_seq_coeffs.data() + m_begins[i]; } /** \brief Return the size of the i-th polynomial in the sequence. @@ -643,33 +643,33 @@ namespace upolynomial { \brief p(x) := p(x+1) */ void translate(unsigned sz, numeral * p); - void translate(unsigned sz, numeral const * p, numeral_vector & buffer) { set(sz, p, buffer); translate(sz, buffer.c_ptr()); } + void translate(unsigned sz, numeral const * p, numeral_vector & buffer) { set(sz, p, buffer); translate(sz, buffer.data()); } /** \brief p(x) := p(x+2^k) */ void translate_k(unsigned sz, numeral * p, unsigned k); - void translate_k(unsigned sz, numeral const * p, unsigned k, numeral_vector & buffer) { set(sz, p, buffer); translate_k(sz, buffer.c_ptr(), k); } + void translate_k(unsigned sz, numeral const * p, unsigned k, numeral_vector & buffer) { set(sz, p, buffer); translate_k(sz, buffer.data(), k); } /** \brief p(x) := p(x+c) */ void translate_z(unsigned sz, numeral * p, numeral const & c); - void translate_z(unsigned sz, numeral const * p, numeral const & c, numeral_vector & buffer) { set(sz, p, buffer); translate_z(sz, buffer.c_ptr(), c); } + void translate_z(unsigned sz, numeral const * p, numeral const & c, numeral_vector & buffer) { set(sz, p, buffer); translate_z(sz, buffer.data(), c); } /** \brief p(x) := p(x+b) where b = c/2^k buffer := (2^k)^n * p(x + c/(2^k)) */ void translate_bq(unsigned sz, numeral * p, mpbq const & b); - void translate_bq(unsigned sz, numeral const * p, mpbq const & b, numeral_vector & buffer) { set(sz, p, buffer); translate_bq(sz, buffer.c_ptr(), b); } + void translate_bq(unsigned sz, numeral const * p, mpbq const & b, numeral_vector & buffer) { set(sz, p, buffer); translate_bq(sz, buffer.data(), b); } /** \brief p(x) := p(x+b) where b = c/d buffer := d^n * p(x + c/d) */ void translate_q(unsigned sz, numeral * p, mpq const & b); - void translate_q(unsigned sz, numeral const * p, mpq const & b, numeral_vector & buffer) { set(sz, p, buffer); translate_q(sz, buffer.c_ptr(), b); } + void translate_q(unsigned sz, numeral const * p, mpq const & b, numeral_vector & buffer) { set(sz, p, buffer); translate_q(sz, buffer.data(), b); } /** \brief p(x) := 2^n*p(x/2) where n = sz-1 @@ -905,7 +905,7 @@ namespace upolynomial { This can happen when limits (e.g., on the search space size) are set in params. */ bool factor(unsigned sz, numeral const * p, factors & r, factor_params const & params = factor_params()); - bool factor(numeral_vector const & p, factors & r, factor_params const & params = factor_params()) { return factor(p.size(), p.c_ptr(), r, params); } + bool factor(numeral_vector const & p, factors & r, factor_params const & params = factor_params()) { return factor(p.size(), p.data(), r, params); } std::ostream& display(std::ostream & out, unsigned sz, numeral const * p, char const * var_name = "x", bool use_star = false) const { return core_manager::display(out, sz, p, var_name); diff --git a/src/math/polynomial/upolynomial_factorization.cpp b/src/math/polynomial/upolynomial_factorization.cpp index 45cc3f86d..fad8a85e4 100644 --- a/src/math/polynomial/upolynomial_factorization.cpp +++ b/src/math/polynomial/upolynomial_factorization.cpp @@ -261,9 +261,9 @@ void zp_square_free_factor(zp_manager & upm, numeral_vector const & f, zp_factor // trim and get the make it monic if not already SASSERT(f.size() > 1); scoped_numeral_vector T_0(nm); - upm.set(f.size(), f.c_ptr(), T_0); + upm.set(f.size(), f.data(), T_0); scoped_numeral constant(nm); - upm.mk_monic(T_0.size(), T_0.c_ptr(), constant); + upm.mk_monic(T_0.size(), T_0.data(), constant); sq_free_factors.set_constant(constant); TRACE("polynomial::factorization::bughunt", tout << "Initial factors: " << sq_free_factors << endl; @@ -285,21 +285,21 @@ void zp_square_free_factor(zp_manager & upm, numeral_vector const & f, zp_factor TRACE("polynomial::factorization::bughunt", tout << "k = 0" << endl;); // T_0_d = T_0' - upm.derivative(T_0.size(), T_0.c_ptr(), T_0_d); + upm.derivative(T_0.size(), T_0.data(), T_0_d); 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.c_ptr(), T_0_d.size(), T_0_d.c_ptr(), T); + upm.gcd(T_0.size(), T_0.data(), T_0_d.size(), T_0_d.data(), T); 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.c_ptr(), T.size(), T.c_ptr(), V); + upm.div(T_0.size(), T_0.data(), T.size(), T.data(), V); TRACE("polynomial::factorization::bughunt", tout << "V = T_0.quo_rem(T)[0]" << endl; tout << "V == "; upm.display(tout, V); tout << endl; @@ -310,7 +310,7 @@ void zp_square_free_factor(zp_manager & upm, numeral_vector const & f, zp_factor if ((++k) % p == 0) { ++ k; // T = T/V - upm.div(T.size(), T.c_ptr(), V.size(), V.c_ptr(), T); + upm.div(T.size(), T.data(), V.size(), V.data(), T); TRACE("polynomial::factorization::bughunt", tout << "T = T.quo_rem(V)[0]" << endl; tout << "T == "; upm.display(tout, T); tout << endl; @@ -320,14 +320,14 @@ void zp_square_free_factor(zp_manager & upm, numeral_vector const & f, zp_factor // [compute A_ek] // W = gcd(T, V) - upm.gcd(T.size(), T.c_ptr(), V.size(), V.c_ptr(), W); + upm.gcd(T.size(), T.data(), V.size(), V.data(), W); 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.c_ptr(), W.size(), W.c_ptr(), A_ek); + upm.div(V.size(), V.data(), W.size(), W.data(), A_ek); TRACE("polynomial::factorization::bughunt", tout << "A_ek = V.quo_rem(W)[0]" << endl; tout << "A_ek == "; upm.display(tout, A_ek); tout << endl; @@ -341,7 +341,7 @@ void zp_square_free_factor(zp_manager & upm, numeral_vector const & f, zp_factor ); // T = T/V - upm.div(T.size(), T.c_ptr(), V.size(), V.c_ptr(), T); + upm.div(T.size(), T.data(), V.size(), V.data(), T); TRACE("polynomial::factorization::bughunt", tout << "T = T.quo_rem(V)[0]" << endl; tout << "T == "; upm.display(tout, T); tout << endl; @@ -471,13 +471,13 @@ bool zp_factor_square_free_berlekamp(zp_manager & upm, numeral_vector const & f, zpm.dec(v_k[0]); // get the gcd - upm.gcd(v_k.size(), v_k.c_ptr(), current_factor.size(), current_factor.c_ptr(), gcd); + upm.gcd(v_k.size(), v_k.data(), current_factor.size(), current_factor.data(), gcd); // if the gcd is 1, or the gcd is f, we just ignore it if (gcd.size() != 1 && gcd.size() != current_factor.size()) { // get the divisor also (no need to normalize the div, both are monic) - upm.div(current_factor.size(), current_factor.c_ptr(), gcd.size(), gcd.c_ptr(), div); + upm.div(current_factor.size(), current_factor.data(), gcd.size(), gcd.data(), div); TRACE("polynomial::factorization::bughunt", tout << "current_factor = "; upm.display(tout, current_factor); tout << endl; @@ -529,8 +529,8 @@ bool check_hansel_lift(z_manager & upm, numeral_vector const & C, // test1: check that C = A_lifted * B_lifted (mod b*r) scoped_mpz_vector test1(nm); - upm.mul(A_lifted.size(), A_lifted.c_ptr(), B_lifted.size(), B_lifted.c_ptr(), test1); - upm.sub(C.size(), C.c_ptr(), test1.size(), test1.c_ptr(), test1); + upm.mul(A_lifted.size(), A_lifted.data(), B_lifted.size(), B_lifted.data(), test1); + upm.sub(C.size(), C.data(), test1.size(), test1.data(), test1); to_zp_manager(br_upm, test1); if (!test1.empty()) { TRACE("polynomial::factorization::bughunt", @@ -607,8 +607,8 @@ void hensel_lift(z_manager & upm, numeral const & a, numeral const & b, numeral // by (2) C = AB (mod b), hence (C - AB) is divisible by b // define thus let f = (C - AB)/b in Z_r scoped_numeral_vector f(upm.m()); - upm.mul(A.size(), A.c_ptr(), B.size(), B.c_ptr(), f); - upm.sub(C.size(), C.c_ptr(), f.size(), f.c_ptr(), f); + upm.mul(A.size(), A.data(), B.size(), B.data(), f); + upm.sub(C.size(), C.data(), f.size(), f.data(), f); upm.div(f, b); to_zp_manager(r_upm, f); TRACE("polynomial::factorization", @@ -637,29 +637,29 @@ void hensel_lift(z_manager & upm, numeral const & a, numeral const & b, numeral TRACE("polynomial::factorization::bughunt", tout << "V == "; upm.display(tout, V); tout << endl; ); - r_upm.mul(V.size(), V.c_ptr(), f.size(), f.c_ptr(), Vf); + r_upm.mul(V.size(), V.data(), f.size(), f.data(), Vf); TRACE("polynomial::factorization::bughunt", tout << "Vf = V*f" << endl; tout << "Vf == "; upm.display(tout, Vf); tout << endl; ); - r_upm.div_rem(Vf.size(), Vf.c_ptr(), A.size(), A.c_ptr(), t, S); + r_upm.div_rem(Vf.size(), Vf.data(), A.size(), A.data(), t, S); 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.c_ptr(), f.size(), f.c_ptr(), T); // T = fU + r_upm.mul(U.size(), U.data(), f.size(), f.data(), T); // T = fU TRACE("polynomial::factorization::bughunt", tout << "T == U*f" << endl; tout << "T == "; upm.display(tout, T); tout << endl; ); - r_upm.mul(B.size(), B.c_ptr(), t.size(), t.c_ptr(), tmp); // tmp = Bt + r_upm.mul(B.size(), B.data(), t.size(), t.data(), tmp); // tmp = Bt TRACE("polynomial::factorization::bughunt", tout << "tmp = B*t" << endl; tout << "tmp == "; upm.display(tout, tmp); tout << endl; ); - r_upm.add(T.size(), T.c_ptr(), tmp.size(), tmp.c_ptr(), T); // T = Uf + Bt + r_upm.add(T.size(), T.data(), tmp.size(), tmp.data(), T); // T = Uf + Bt TRACE("polynomial::factorization::bughunt", tout << "T = B*tmp" << endl; tout << "T == "; upm.display(tout, T); tout << endl; @@ -668,8 +668,8 @@ void hensel_lift(z_manager & upm, numeral const & a, numeral const & b, numeral // set the result, A1 = A + b*S, B1 = B + b*T (now we compute in Z[x]) upm.mul(S, b); upm.mul(T, b); - upm.add(A.size(), A.c_ptr(), S.size(), S.c_ptr(), A_lifted); - upm.add(B.size(), B.c_ptr(), T.size(), T.c_ptr(), B_lifted); + upm.add(A.size(), A.data(), S.size(), S.data(), A_lifted); + upm.add(B.size(), B.data(), T.size(), T.data(), B_lifted); CASSERT("polynomial::factorizatio::bughunt", check_hansel_lift(upm, C, a, b, r, A, B, A_lifted, B_lifted)); } @@ -680,10 +680,10 @@ bool check_quadratic_hensel(zp_manager & zpe_upm, numeral_vector const & U, nume // compute UA+BV expecting to get 1 (in Z_pe[x]) scoped_mpz_vector tmp1(nm); scoped_mpz_vector tmp2(nm); - zpe_upm.mul(U.size(), U.c_ptr(), A.size(), A.c_ptr(), tmp1); - zpe_upm.mul(V.size(), V.c_ptr(), B.size(), B.c_ptr(), tmp2); + zpe_upm.mul(U.size(), U.data(), A.size(), A.data(), tmp1); + zpe_upm.mul(V.size(), V.data(), B.size(), B.data(), tmp2); scoped_mpz_vector one(nm); - zpe_upm.add(tmp1.size(), tmp1.c_ptr(), tmp2.size(), tmp2.c_ptr(), one); + 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", tout << "sage: R. = Zmod(" << nm.to_string(zpe_upm.m().p()) << ")['x']" << endl; @@ -724,7 +724,7 @@ void hensel_lift_quadratic(z_manager& upm, numeral_vector const & C, // get the U, V, such that A*U + B*V = 1 (mod p) scoped_mpz_vector U(nm), V(nm), D(nm); - zp_upm.ext_gcd(A.size(), A.c_ptr(), B.size(), B.c_ptr(), U, V, D); + zp_upm.ext_gcd(A.size(), A.data(), B.size(), B.data(), U, V, D); SASSERT(D.size() == 1 && zp_upm.m().is_one(D[0])); // we start lifting from (a = p, b = p, r = p) @@ -762,10 +762,10 @@ void hensel_lift_quadratic(z_manager& upm, numeral_vector const & C, scoped_mpz_vector tmp1(nm), g(nm); g.push_back(numeral()); nm.set(g.back(), 1); // g = 1 - upm.mul(A_lifted.size(), A_lifted.c_ptr(), U.size(), U.c_ptr(), tmp1); // tmp1 = AU - upm.sub(g.size(), g.c_ptr(), tmp1.size(), tmp1.c_ptr(), g); // g = 1 - UA - upm.mul(B_lifted.size(), B_lifted.c_ptr(), V.size(), V.c_ptr(), tmp1); // tmp1 = BV - upm.sub(g.size(), g.c_ptr(), tmp1.size(), tmp1.c_ptr(), g); // g = 1 - UA - VB + upm.mul(A_lifted.size(), A_lifted.data(), U.size(), U.data(), tmp1); // tmp1 = AU + upm.sub(g.size(), g.data(), tmp1.size(), tmp1.data(), g); // g = 1 - UA + upm.mul(B_lifted.size(), B_lifted.data(), V.size(), V.data(), tmp1); // tmp1 = BV + 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", @@ -775,17 +775,17 @@ void hensel_lift_quadratic(z_manager& upm, numeral_vector const & C, // compute the S, T scoped_mpz_vector S(nm), T(nm), t(nm), tmp2(nm); - zpe_upm.mul(g.size(), g.c_ptr(), V.size(), V.c_ptr(), tmp1); // tmp1 = gV - zpe_upm.div_rem(tmp1.size(), tmp1.c_ptr(), A.size(), A.c_ptr(), t, T); // T = gV - tA, deg(T) < deg(A) - zpe_upm.mul(g.size(), g.c_ptr(), U.size(), U.c_ptr(), tmp1); // tmp1 = gU - zpe_upm.mul(t.size(), t.c_ptr(), B.size(), B.c_ptr(), tmp2); // tmp2 = tB - zpe_upm.add(tmp1.size(), tmp1.c_ptr(), tmp2.size(), tmp2.c_ptr(), S); + zpe_upm.mul(g.size(), g.data(), V.size(), V.data(), tmp1); // tmp1 = gV + zpe_upm.div_rem(tmp1.size(), tmp1.data(), A.size(), A.data(), t, T); // T = gV - tA, deg(T) < deg(A) + zpe_upm.mul(g.size(), g.data(), U.size(), U.data(), tmp1); // tmp1 = gU + zpe_upm.mul(t.size(), t.data(), B.size(), B.data(), tmp2); // tmp2 = tB + zpe_upm.add(tmp1.size(), tmp1.data(), tmp2.size(), tmp2.data(), S); // now update U = U + a*S and V = V + a*T - upm.mul(S.size(), S.c_ptr(), pe); - upm.mul(T.size(), T.c_ptr(), pe); - upm.add(U.size(), U.c_ptr(), S.size(), S.c_ptr(), U); - upm.add(V.size(), V.c_ptr(), T.size(), T.c_ptr(), V); // deg(V) < deg(A), deg(T) < deg(A) => deg(V') < deg(A) + upm.mul(S.size(), S.data(), pe); + upm.mul(T.size(), T.data(), pe); + upm.add(U.size(), U.data(), S.size(), S.data(), U); + upm.add(V.size(), V.data(), T.size(), T.data(), V); // deg(V) < deg(A), deg(T) < deg(A) => deg(V') < deg(A) // we go quadratic zpe_upm.m().set_p_sq(); @@ -891,7 +891,7 @@ void hensel_lift(z_manager & upm, numeral_vector const & f, zp_factors const & z scoped_mpz_vector A(nm), B(nm), C(nm), f_parts(nm); // these will all be in Z_p // copy of f, that we'll be cutting parts of - upm.set(f.size(), f.c_ptr(), f_parts); + upm.set(f.size(), f.data(), f_parts); // F_k are factors mod Z_p, A_k the factors mod p^e // the invariant we keep is that: @@ -902,7 +902,7 @@ void hensel_lift(z_manager & upm, numeral_vector const & f, zp_factors const & z SASSERT(zp_fs.get_degree(i) == 1); // p was chosen so that f is square-free // F_i = A (mod Z_p) - zp_upm.set(zp_fs[i].size(), zp_fs[i].c_ptr(), A); + zp_upm.set(zp_fs[i].size(), zp_fs[i].data(), A); TRACE("polynomial::factorization::bughunt", tout << "A = "; upm.display(tout, A); tout << endl; ); @@ -923,7 +923,7 @@ void hensel_lift(z_manager & upm, numeral_vector const & f, zp_factors const & z ); // we take B to be what's left from C and A - zp_upm.div(C.size(), C.c_ptr(), A.size(), A.c_ptr(), B); + zp_upm.div(C.size(), C.data(), A.size(), A.data(), B); TRACE("polynomial::factorization::bughunt", tout << "B = "; upm.display(tout, B); tout << endl; ); @@ -944,7 +944,7 @@ void hensel_lift(z_manager & upm, numeral_vector const & f, zp_factors const & z } // take the lifted A out of f_parts - zpe_upm.div(f_parts.size(), f_parts.c_ptr(), A.size(), A.c_ptr(), f_parts); + zpe_upm.div(f_parts.size(), f_parts.data(), A.size(), A.data(), f_parts); // add the lifted factor (kills A) zpe_fs.push_back_swap(A, 1); @@ -1029,12 +1029,12 @@ bool factor_square_free(z_manager & upm, numeral_vector const & f, factors & fs, // This method assumes f is primitive. Thus, the content of f must be one DEBUG_CODE({ scoped_numeral f_cont(nm); - nm.gcd(f.size(), f.c_ptr(), f_cont); + nm.gcd(f.size(), f.data(), f_cont); SASSERT(f.size() == 0 || nm.is_one(f_cont)); }); scoped_numeral_vector f_pp(nm); - upm.set(f.size(), f.c_ptr(), f_pp); + upm.set(f.size(), f.data(), f_pp); // make sure the leading coefficient is positive if (!f_pp.empty() && nm.is_neg(f_pp[f_pp.size() - 1])) { @@ -1103,11 +1103,11 @@ bool factor_square_free(z_manager & upm, numeral_vector const & f, factors & fs, tout << "sage: f_pp_zp = "; zp_upm.display(tout, f_pp_zp, "x_p"); tout << endl; ); - if (!zp_upm.is_square_free(f_pp_zp.size(), f_pp_zp.c_ptr())) + if (!zp_upm.is_square_free(f_pp_zp.size(), f_pp_zp.data())) continue; // we make it monic - zp_upm.mk_monic(f_pp_zp.size(), f_pp_zp.c_ptr()); + zp_upm.mk_monic(f_pp_zp.size(), f_pp_zp.data()); // found a candidate, factorize in Z_p and add back the constant zp_factors current_fs(zp_upm); diff --git a/src/math/polynomial/upolynomial_factorization_int.h b/src/math/polynomial/upolynomial_factorization_int.h index 53848b2b1..e3e4793a5 100644 --- a/src/math/polynomial/upolynomial_factorization_int.h +++ b/src/math/polynomial/upolynomial_factorization_int.h @@ -345,9 +345,9 @@ namespace upolynomial { void left(numeral_vector & out) const { SASSERT(m_current_size > 0); zp_manager & upm = m_factors.upm(); - upm.set(m_factors[m_current[0]].size(), m_factors[m_current[0]].c_ptr(), out); + upm.set(m_factors[m_current[0]].size(), m_factors[m_current[0]].data(), out); for (int i = 1; i < m_current_size; ++ i) { - upm.mul(out.size(), out.c_ptr(), m_factors[m_current[i]].size(), m_factors[m_current[i]].c_ptr(), out); + upm.mul(out.size(), out.data(), m_factors[m_current[i]].size(), m_factors[m_current[i]].data(), out); } } @@ -401,9 +401,9 @@ namespace upolynomial { if (selection_i >= m_current.size() || (int) current < m_current[selection_i]) { SASSERT(m_factors.get_degree(current) == 1); if (out.empty()) { - upm.set(m_factors[current].size(), m_factors[current].c_ptr(), out); + upm.set(m_factors[current].size(), m_factors[current].data(), out); } else { - upm.mul(out.size(), out.c_ptr(), m_factors[current].size(), m_factors[current].c_ptr(), out); + upm.mul(out.size(), out.data(), m_factors[current].size(), m_factors[current].data(), out); } current ++; } else { diff --git a/src/math/realclosure/realclosure.cpp b/src/math/realclosure/realclosure.cpp index c43fca4d4..471c419ac 100644 --- a/src/math/realclosure/realclosure.cpp +++ b/src/math/realclosure/realclosure.cpp @@ -431,7 +431,7 @@ namespace realclosure { \brief Return the vector of coefficients for the i-th polynomial in the sequence. */ value * const * coeffs(unsigned i) const { - return m_seq_coeffs.c_ptr() + m_begins[i]; + return m_seq_coeffs.data() + m_begins[i]; } /** @@ -462,7 +462,7 @@ namespace realclosure { scoped_sign_conditions(imp & m):m_imp(m) {} ~scoped_sign_conditions() { - m_imp.del_sign_conditions(m_scs.size(), m_scs.c_ptr()); + m_imp.del_sign_conditions(m_scs.size(), m_scs.data()); } sign_condition * & operator[](unsigned idx) { return m_scs[idx]; } @@ -476,10 +476,10 @@ namespace realclosure { void copy_from(scoped_sign_conditions & scs) { SASSERT(this != &scs); release(); - m_scs.append(scs.m_scs.size(), scs.m_scs.c_ptr()); + m_scs.append(scs.m_scs.size(), scs.m_scs.data()); scs.release(); } - sign_condition * const * c_ptr() { return m_scs.c_ptr(); } + sign_condition * const * data() { return m_scs.data(); } }; struct scoped_inc_depth { @@ -748,7 +748,7 @@ namespace realclosure { That is, after the call p is the 0 polynomial. */ void reset_p(polynomial & p) { - dec_ref(p.size(), p.c_ptr()); + dec_ref(p.size(), p.data()); p.finalize(allocator()); } @@ -800,7 +800,7 @@ namespace realclosure { void del_sign_det(sign_det * sd) { mm().del(sd->M_s); - del_sign_conditions(sd->m_sign_conditions.size(), sd->m_sign_conditions.c_ptr()); + del_sign_conditions(sd->m_sign_conditions.size(), sd->m_sign_conditions.data()); sd->m_sign_conditions.finalize(allocator()); finalize(sd->m_prs); sd->m_taqrs.finalize(allocator()); @@ -1555,7 +1555,7 @@ namespace realclosure { bool pos_root_lower_bound(unsigned n, value * const * p, int & N) { value_ref_buffer q(*this); reverse(n, p, q); - if (pos_root_upper_bound(n, q.c_ptr(), N)) { + if (pos_root_upper_bound(n, q.data(), N)) { N = -N; return true; } @@ -1570,7 +1570,7 @@ namespace realclosure { bool neg_root_upper_bound(unsigned n, value * const * p, int & N) { value_ref_buffer q(*this); reverse(n, p, q); - if (neg_root_lower_bound(n, q.c_ptr(), N)) { + if (neg_root_lower_bound(n, q.data(), N)) { N = -N; return true; } @@ -1590,7 +1590,7 @@ namespace realclosure { SASSERT(!is_zero(p[n-1])); value_ref_buffer p_prime(*this); derivative(n, p, p_prime); - ds.push(p_prime.size(), p_prime.c_ptr()); + ds.push(p_prime.size(), p_prime.data()); SASSERT(n >= 3); for (unsigned i = 0; i < n - 2; i++) { SASSERT(ds.size() > 0); @@ -1598,7 +1598,7 @@ namespace realclosure { n = ds.size(prev); p = ds.coeffs(prev); derivative(n, p, p_prime); - ds.push(p_prime.size(), p_prime.c_ptr()); + ds.push(p_prime.size(), p_prime.data()); } } @@ -1645,7 +1645,7 @@ namespace realclosure { // Expensive case // q2 <- q^2 mul(q_sz, q, q_sz, q, q2); - int taq_p_q2 = TaQ(p_sz, p, q2.size(), q2.c_ptr(), interval); + int taq_p_q2 = TaQ(p_sz, p, q2.size(), q2.data(), interval); SASSERT(0 <= taq_p_q2 && taq_p_q2 <= num_roots); // taq_p_q2 == q_gt_0 + q_lt_0 SASSERT((taq_p_q2 + taq_p_q) % 2 == 0); @@ -1719,15 +1719,15 @@ namespace realclosure { // Add prs * q value_ref_buffer prq(*this); mul(prs.size(i), prs.coeffs(i), q_sz, q, prq); - new_taqrs.push_back(TaQ(p_sz, p, prq.size(), prq.c_ptr(), interval)); - new_prs.push(prq.size(), prq.c_ptr()); + new_taqrs.push_back(TaQ(p_sz, p, prq.size(), prq.data(), interval)); + new_prs.push(prq.size(), prq.data()); // If use_q2, // Add prs * q^2 if (use_q2) { value_ref_buffer prq2(*this); mul(prs.size(i), prs.coeffs(i), q2_sz, q2, prq2); - new_taqrs.push_back(TaQ(p_sz, p, prq2.size(), prq2.c_ptr(), interval)); - new_prs.push(prq2.size(), prq2.c_ptr()); + new_taqrs.push_back(TaQ(p_sz, p, prq2.size(), prq2.data(), interval)); + new_prs.push(prq2.size(), prq2.data()); } } SASSERT(new_prs.size() == new_taqrs.size()); @@ -1795,9 +1795,9 @@ namespace realclosure { sign_det * r = new (allocator()) sign_det(); r->M_s.swap(M_s); set_array_p(r->m_prs, prs); - r->m_taqrs.set(allocator(), taqrs.size(), taqrs.c_ptr()); + r->m_taqrs.set(allocator(), taqrs.size(), taqrs.data()); set_array_p(r->m_qs, qs); - r->m_sign_conditions.set(allocator(), scs.size(), scs.c_ptr()); + r->m_sign_conditions.set(allocator(), scs.size(), scs.data()); scs.release(); return r; } @@ -2019,7 +2019,7 @@ namespace realclosure { } bool use_q2 = M.n() == 3; mm().tensor_product(M_s, M, new_M_s); - expand_taqrs(taqrs, prs, p_sz, p, q_sz, q, use_q2, q2.size(), q2.c_ptr(), iso_interval, + expand_taqrs(taqrs, prs, p_sz, p, q_sz, q, use_q2, q2.size(), q2.data(), iso_interval, // ---> new_taqrs, new_prs); SASSERT(new_M_s.n() == new_M_s.m()); // it is a square matrix @@ -2029,7 +2029,7 @@ namespace realclosure { sc_cardinalities.resize(new_taqrs.size(), 0); // Solve // new_M_s * sc_cardinalities = new_taqrs - VERIFY(mm().solve(new_M_s, sc_cardinalities.c_ptr(), new_taqrs.c_ptr())); + 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";); // 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); }); @@ -2037,7 +2037,7 @@ namespace realclosure { // That is, // If !use_q2, then There is an i s.t. sc_cardinalities[2*i] > 0 && sc_cardinalities[2*i] > 0 // If use_q2, then There is an i s.t. AtLeastTwo(sc_cardinalities[3*i] > 0, sc_cardinalities[3*i+1] > 0, sc_cardinalities[3*i+2] > 0) - if (!keep_new_sc_assignment(sc_cardinalities.size(), sc_cardinalities.c_ptr(), use_q2)) { + if (!keep_new_sc_assignment(sc_cardinalities.size(), sc_cardinalities.data(), use_q2)) { // skip q since it did not reduced the cardinality of the existing sign conditions. continue; } @@ -2068,10 +2068,10 @@ namespace realclosure { scs.copy_from(new_scs); SASSERT(new_scs.empty()); // Update M_s - mm().filter_cols(new_M_s, cols_to_keep.size(), cols_to_keep.c_ptr(), M_s); + mm().filter_cols(new_M_s, cols_to_keep.size(), cols_to_keep.data(), M_s); SASSERT(M_s.n() == cols_to_keep.size()); new_row_idxs.resize(cols_to_keep.size(), 0); - unsigned new_num_rows = mm().linear_independent_rows(M_s, new_row_idxs.c_ptr(), M_s); + unsigned new_num_rows = mm().linear_independent_rows(M_s, new_row_idxs.data(), M_s); SASSERT(new_num_rows == cols_to_keep.size()); // Update taqrs and prs prs.reset(); @@ -2387,7 +2387,7 @@ namespace realclosure { } value_ref_buffer sqf(*this); square_free(n, p, sqf); - nz_sqf_isolate_roots(sqf.size(), sqf.c_ptr(), roots); + nz_sqf_isolate_roots(sqf.size(), sqf.data(), roots); } /** @@ -2401,7 +2401,7 @@ namespace realclosure { value_ref d(*this); value_ref_buffer norm_p(*this); clean_denominators(n, p, norm_p, d); - nz_cd_isolate_roots(norm_p.size(), norm_p.c_ptr(), roots); + nz_cd_isolate_roots(norm_p.size(), norm_p.data(), roots); } else { nz_cd_isolate_roots(n, p, roots); @@ -2429,7 +2429,7 @@ namespace realclosure { ptr_buffer nz_p; for (; i < n; i++) nz_p.push_back(p[i].m_value); - nz_isolate_roots(nz_p.size(), nz_p.c_ptr(), roots); + nz_isolate_roots(nz_p.size(), nz_p.data(), roots); if (nz_p.size() < n) { // zero is a root roots.push_back(numeral()); @@ -2675,8 +2675,8 @@ namespace realclosure { \brief r <- p1 + p2 */ void add(unsigned sz1, value * const * p1, unsigned sz2, value * const * p2, value_ref_buffer & r) { - SASSERT(p1 != r.c_ptr()); - SASSERT(p2 != r.c_ptr()); + SASSERT(p1 != r.data()); + SASSERT(p2 != r.data()); r.reset(); value_ref a_i(*this); unsigned min = std::min(sz1, sz2); @@ -2697,7 +2697,7 @@ namespace realclosure { \brief r <- p + a */ void add(unsigned sz, value * const * p, value * a, value_ref_buffer & r) { - SASSERT(p != r.c_ptr()); + SASSERT(p != r.data()); SASSERT(sz > 0); r.reset(); value_ref a_0(*this); @@ -2711,8 +2711,8 @@ namespace realclosure { \brief r <- p1 - p2 */ void sub(unsigned sz1, value * const * p1, unsigned sz2, value * const * p2, value_ref_buffer & r) { - SASSERT(p1 != r.c_ptr()); - SASSERT(p2 != r.c_ptr()); + SASSERT(p1 != r.data()); + SASSERT(p2 != r.data()); r.reset(); value_ref a_i(*this); unsigned min = std::min(sz1, sz2); @@ -2735,7 +2735,7 @@ namespace realclosure { \brief r <- p - a */ void sub(unsigned sz, value * const * p, value * a, value_ref_buffer & r) { - SASSERT(p != r.c_ptr()); + SASSERT(p != r.data()); SASSERT(sz > 0); r.reset(); value_ref a_0(*this); @@ -2749,7 +2749,7 @@ namespace realclosure { \brief r <- a * p */ void mul(value * a, unsigned sz, value * const * p, value_ref_buffer & r) { - SASSERT(p != r.c_ptr()); + SASSERT(p != r.data()); r.reset(); if (a == nullptr) return; @@ -2764,8 +2764,8 @@ namespace realclosure { \brief r <- p1 * p2 */ void mul(unsigned sz1, value * const * p1, unsigned sz2, value * const * p2, value_ref_buffer & r) { - SASSERT(p1 != r.c_ptr()); - SASSERT(p2 != r.c_ptr()); + SASSERT(p1 != r.data()); + SASSERT(p2 != r.data()); r.reset(); unsigned sz = sz1*sz2; r.resize(sz); @@ -2877,8 +2877,8 @@ namespace realclosure { \brief r <- rem(p1, p2) */ void rem(unsigned sz1, value * const * p1, unsigned sz2, value * const * p2, value_ref_buffer & r) { - SASSERT(p1 != r.c_ptr()); - SASSERT(p2 != r.c_ptr()); + SASSERT(p1 != r.data()); + SASSERT(p2 != r.data()); TRACE("rcf_rem", tout << "rem\n"; display_poly(tout, sz1, p1); tout << "\n"; @@ -2898,7 +2898,7 @@ namespace realclosure { checkpoint(); sz1 = r.size(); if (sz1 < sz2) { - TRACE("rcf_rem", tout << "rem result\n"; display_poly(tout, r.size(), r.c_ptr()); tout << "\n";); + TRACE("rcf_rem", tout << "rem result\n"; display_poly(tout, r.size(), r.data()); tout << "\n";); return; } unsigned m_n = sz1 - sz2; @@ -2921,8 +2921,8 @@ namespace realclosure { That is, if has_clean_denominators(p1) and has_clean_denominators(p2) then has_clean_denominators(r). */ void prem(unsigned sz1, value * const * p1, unsigned sz2, value * const * p2, unsigned & d, value_ref_buffer & r) { - SASSERT(p1 != r.c_ptr()); - SASSERT(p2 != r.c_ptr()); + SASSERT(p1 != r.data()); + SASSERT(p2 != r.data()); TRACE("rcf_prem", tout << "prem\n"; display_poly(tout, sz1, p1); tout << "\n"; @@ -2943,7 +2943,7 @@ namespace realclosure { checkpoint(); sz1 = r.size(); if (sz1 < sz2) { - TRACE("rcf_prem", tout << "prem result\n"; display_poly(tout, r.size(), r.c_ptr()); tout << "\n";); + TRACE("rcf_prem", tout << "prem result\n"; display_poly(tout, r.size(), r.data()); tout << "\n";); return; } unsigned m_n = sz1 - sz2; @@ -2979,7 +2979,7 @@ namespace realclosure { \brief r <- -p */ void neg(unsigned sz, value * const * p, value_ref_buffer & r) { - SASSERT(p != r.c_ptr()); + SASSERT(p != r.data()); r.reset(); value_ref a_i(*this); for (unsigned i = 0; i < sz; i++) { @@ -3019,8 +3019,8 @@ namespace realclosure { Signed remainder */ void srem(unsigned sz1, value * const * p1, unsigned sz2, value * const * p2, value_ref_buffer & r) { - SASSERT(p1 != r.c_ptr()); - SASSERT(p2 != r.c_ptr()); + SASSERT(p1 != r.data()); + SASSERT(p2 != r.data()); rem(sz1, p1, sz2, p2, r); neg(r); } @@ -3030,8 +3030,8 @@ namespace realclosure { Signed pseudo remainder */ void sprem(unsigned sz1, value * const * p1, unsigned sz2, value * const * p2, value_ref_buffer & r) { - SASSERT(p1 != r.c_ptr()); - SASSERT(p2 != r.c_ptr()); + SASSERT(p1 != r.data()); + SASSERT(p2 != r.data()); unsigned d; prem(sz1, p1, sz2, p2, d, r); // We should not flip the sign if d is odd and leading coefficient of p2 is negative. @@ -3094,7 +3094,7 @@ namespace realclosure { bool struct_eq(value * a, value * b) */ bool struct_eq(polynomial const & p_a, polynomial const & p_b) const { - return struct_eq(p_a.size(), p_a.c_ptr(), p_b.size(), p_b.c_ptr()); + return struct_eq(p_a.size(), p_a.data(), p_b.size(), p_b.data()); } // --------------------------------- @@ -3135,7 +3135,7 @@ namespace realclosure { \brief See comment at has_clean_denominators(value * a) */ bool has_clean_denominators(polynomial const & p) const { - return has_clean_denominators(p.size(), p.c_ptr()); + return has_clean_denominators(p.size(), p.data()); } /** @@ -3170,8 +3170,8 @@ namespace realclosure { } value_ref x(*this); x = mk_rational_function_value(rf_a->ext()); - mk_polynomial_value(p_num.size(), p_num.c_ptr(), x, p); - mk_polynomial_value(p_den.size(), p_den.c_ptr(), x, q); + mk_polynomial_value(p_num.size(), p_num.data(), x, p); + mk_polynomial_value(p_den.size(), p_den.data(), x, q); if (!struct_eq(d_den, d_num)) { mul(p, d_den, p); mul(q, d_num, q); @@ -3299,7 +3299,7 @@ namespace realclosure { } void clean_denominators_core(polynomial const & p, value_ref_buffer & norm_p, value_ref & d) { - clean_denominators_core(p.size(), p.c_ptr(), norm_p, d); + clean_denominators_core(p.size(), p.data(), norm_p, d); } void clean_denominators(value * a, value_ref & p, value_ref & q) { @@ -3323,7 +3323,7 @@ namespace realclosure { } void clean_denominators(polynomial const & p, value_ref_buffer & norm_p, value_ref & d) { - clean_denominators(p.size(), p.c_ptr(), norm_p, d); + clean_denominators(p.size(), p.data(), norm_p, d); } void clean_denominators(numeral const & a, numeral & p, numeral & q) { @@ -3394,7 +3394,7 @@ namespace realclosure { \brief See comment in gcd_int_coeffs(value * a, mpz & g) */ bool gcd_int_coeffs(polynomial const & p, mpz & g) { - return gcd_int_coeffs(p.size(), p.c_ptr(), g); + return gcd_int_coeffs(p.size(), p.data(), g); } /** @@ -3402,7 +3402,7 @@ namespace realclosure { */ void normalize_int_coeffs(value_ref_buffer & p) { scoped_mpz g(qm()); - if (gcd_int_coeffs(p.size(), p.c_ptr(), g) && !qm().is_one(g)) { + if (gcd_int_coeffs(p.size(), p.data(), g) && !qm().is_one(g)) { SASSERT(qm().is_pos(g)); value_ref a(*this); for (unsigned i = 0; i < p.size(); i++) { @@ -3449,7 +3449,7 @@ namespace realclosure { new_ais.push_back(nullptr); } } - rational_function_value * r = mk_rational_function_value_core(rf->ext(), new_ais.size(), new_ais.c_ptr(), 1, &m_one); + rational_function_value * r = mk_rational_function_value_core(rf->ext(), new_ais.size(), new_ais.data(), 1, &m_one); set_interval(r->m_interval, rf->m_interval); a = r; // divide upper and lower by b @@ -3513,16 +3513,16 @@ namespace realclosure { B.append(sz2, p2); while (true) { TRACE("rcf_gcd", - tout << "A: "; display_poly(tout, A.size(), A.c_ptr()); tout << "\n"; - tout << "B: "; display_poly(tout, B.size(), B.c_ptr()); tout << "\n";); + 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", - tout << "gcd result: "; display_poly(tout, r.size(), r.c_ptr()); tout << "\n";); + tout << "gcd result: "; display_poly(tout, r.size(), r.data()); tout << "\n";); return; } - rem(A.size(), A.c_ptr(), B.size(), B.c_ptr(), R); + rem(A.size(), A.data(), B.size(), B.data(), R); A = B; B = R; } @@ -3542,8 +3542,8 @@ namespace realclosure { 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.c_ptr()); - SASSERT(p2 != r.c_ptr()); + SASSERT(p1 != r.data()); + SASSERT(p2 != r.data()); if (sz1 == 0) { r.append(sz2, p2); flip_sign_if_lc_neg(r); @@ -3560,17 +3560,17 @@ namespace realclosure { B.append(sz2, p2); while (true) { TRACE("rcf_gcd", - tout << "A: "; display_poly(tout, A.size(), A.c_ptr()); tout << "\n"; - tout << "B: "; display_poly(tout, B.size(), B.c_ptr()); tout << "\n";); + 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", - tout << "gcd result: "; display_poly(tout, r.size(), r.c_ptr()); tout << "\n";); + tout << "gcd result: "; display_poly(tout, r.size(), r.data()); tout << "\n";); return; } - prem(A.size(), A.c_ptr(), B.size(), B.c_ptr(), R); + prem(A.size(), A.data(), B.size(), B.data(), R); normalize_int_coeffs(R); A = B; B = R; @@ -3615,14 +3615,14 @@ namespace realclosure { value_ref_buffer g(*this); derivative(sz, p, p_prime); if (m_use_prem) - prem_gcd(sz, p, p_prime.size(), p_prime.c_ptr(), g); + prem_gcd(sz, p, p_prime.size(), p_prime.data(), g); else - gcd(sz, p, p_prime.size(), p_prime.c_ptr(), g); + gcd(sz, p, p_prime.size(), p_prime.data(), g); if (g.size() <= 1) { r.append(sz, p); } else { - div(sz, p, g.size(), g.c_ptr(), r); + div(sz, p, g.size(), g.data(), r); if (m_use_prem) normalize_int_coeffs(r); } @@ -3654,10 +3654,10 @@ namespace realclosure { } TRACE("rcf_sturm_seq", tout << "sturm_seq_core [" << m_exec_depth << "], new polynomial\n"; - display_poly(tout, r.size(), r.c_ptr()); tout << "\n";); + display_poly(tout, r.size(), r.data()); tout << "\n";); if (r.empty()) return; - seq.push(r.size(), r.c_ptr()); + seq.push(r.size(), r.data()); } } @@ -3679,7 +3679,7 @@ namespace realclosure { value_ref_buffer p_prime(*this); seq.push(sz, p); derivative(sz, p, p_prime); - seq.push(p_prime.size(), p_prime.c_ptr()); + seq.push(p_prime.size(), p_prime.data()); sturm_seq_core(seq); } @@ -3692,8 +3692,8 @@ namespace realclosure { value_ref_buffer p1_prime_p2(*this); seq.push(sz1, p1); derivative(sz1, p1, p1_prime); - mul(p1_prime.size(), p1_prime.c_ptr(), sz2, p2, p1_prime_p2); - seq.push(p1_prime_p2.size(), p1_prime_p2.c_ptr()); + mul(p1_prime.size(), p1_prime.data(), sz2, p2, p1_prime_p2); + seq.push(p1_prime_p2.size(), p1_prime_p2.data()); sturm_seq_core(seq); } @@ -4097,7 +4097,7 @@ namespace realclosure { \brief Refine the interval for each coefficient of in the polynomial p. */ bool refine_coeffs_interval(polynomial const & p, unsigned prec) { - return refine_coeffs_interval(p.size(), p.c_ptr(), prec); + return refine_coeffs_interval(p.size(), p.data(), prec); } /** @@ -4262,7 +4262,7 @@ namespace realclosure { scoped_mpbq m(bqm()); bqm().add(a_i.lower(), a_i.upper(), m); bqm().div2(m); - int mid_sign = eval_sign_at(a->p().size(), a->p().c_ptr(), m); + int mid_sign = eval_sign_at(a->p().size(), a->p().data(), m); if (mid_sign == 0) { // found the actual root // set interval [m, m] @@ -4274,7 +4274,7 @@ namespace realclosure { SASSERT(mid_sign == 1 || mid_sign == -1); if (lower_sign == INT_MIN) { // initialize lower_sign - lower_sign = eval_sign_at(a->p().size(), a->p().c_ptr(), a_i.lower()); + lower_sign = eval_sign_at(a->p().size(), a->p().data(), a_i.lower()); } SASSERT(lower_sign == 1 || lower_sign == -1); if (mid_sign == lower_sign) { @@ -4522,7 +4522,7 @@ namespace realclosure { That is, q(x) does not depend on infinitesimal values. */ bool depends_on_infinitesimals(polynomial const & q, algebraic * x) { - return x->depends_on_infinitesimals() || depends_on_infinitesimals(q.size(), q.c_ptr()); + return x->depends_on_infinitesimals() || depends_on_infinitesimals(q.size(), q.data()); } /** @@ -4577,7 +4577,7 @@ namespace realclosure { int num_roots = x->num_roots_inside_interval(); SASSERT(x->sdt() != 0 || num_roots == 1); polynomial const & p = x->p(); - int taq_p_q = TaQ(p.size(), p.c_ptr(), q.size(), q.c_ptr(), x->iso_interval()); + int taq_p_q = TaQ(p.size(), p.data(), q.size(), q.data(), x->iso_interval()); if (num_roots == 1 && taq_p_q == 0) return false; // q(x) is zero if (taq_p_q == num_roots) { @@ -4603,7 +4603,7 @@ namespace realclosure { SASSERT(x->sdt() != 0); int q_eq_0, q_gt_0, q_lt_0; value_ref_buffer q2(*this); - count_signs_at_zeros_core(taq_p_q, p.size(), p.c_ptr(), q.size(), q.c_ptr(), x->iso_interval(), num_roots, q_eq_0, q_gt_0, q_lt_0, q2); + count_signs_at_zeros_core(taq_p_q, p.size(), p.data(), q.size(), q.data(), x->iso_interval(), num_roots, q_eq_0, q_gt_0, q_lt_0, q2); if (q_eq_0 > 0 && q_gt_0 == 0 && q_lt_0 == 0) { // q(x) is zero return false; @@ -4646,19 +4646,19 @@ namespace realclosure { // Add TaQ(p, prs[i] * 1; x->iso_interval()) new_taqrs.push_back(taqrs[i]); // Add TaQ(p, prs[i] * q; x->iso_interval()) - mul(prs[i].size(), prs[i].c_ptr(), q.size(), q.c_ptr(), prq); - new_taqrs.push_back(TaQ(p.size(), p.c_ptr(), prq.size(), prq.c_ptr(), x->iso_interval())); + mul(prs[i].size(), prs[i].data(), q.size(), q.data(), prq); + new_taqrs.push_back(TaQ(p.size(), p.data(), prq.size(), prq.data(), x->iso_interval())); if (use_q2) { // Add TaQ(p, prs[i] * q^2; x->iso_interval()) - mul(prs[i].size(), prs[i].c_ptr(), q2.size(), q2.c_ptr(), prq); - new_taqrs.push_back(TaQ(p.size(), p.c_ptr(), prq.size(), prq.c_ptr(), x->iso_interval())); + mul(prs[i].size(), prs[i].data(), q2.size(), q2.data(), prq); + new_taqrs.push_back(TaQ(p.size(), p.data(), prq.size(), prq.data(), x->iso_interval())); } } int_buffer sc_cardinalities; sc_cardinalities.resize(new_taqrs.size(), 0); // Solve // new_M_s * sc_cardinalities = new_taqrs - VERIFY(mm().solve(new_M_s, sc_cardinalities.c_ptr(), new_taqrs.c_ptr())); + VERIFY(mm().solve(new_M_s, sc_cardinalities.data(), new_taqrs.data())); DEBUG_CODE({ // check if sc_cardinalities has the expected structure // - contains only 0 or 1 @@ -4852,15 +4852,15 @@ namespace realclosure { value_ref_buffer tmp2(*this); div(sz1, p1, lc, tmp1); div(sz2, p2, lc, tmp2); - normalize_num_monic_den(tmp1.size(), tmp1.c_ptr(), tmp2.size(), tmp2.c_ptr(), new_p1, new_p2); + normalize_num_monic_den(tmp1.size(), tmp1.data(), tmp2.size(), tmp2.data(), new_p1, new_p2); } } TRACE("normalize_fraction_bug", display_poly(tout, sz1, p1); tout << "\n"; display_poly(tout, sz2, p2); tout << "\n"; tout << "====>\n"; - display_poly(tout, new_p1.size(), new_p1.c_ptr()); tout << "\n"; - display_poly(tout, new_p2.size(), new_p2.c_ptr()); tout << "\n";); + display_poly(tout, new_p1.size(), new_p1.data()); tout << "\n"; + display_poly(tout, new_p2.size(), new_p2.data()); tout << "\n";); } /** @@ -4888,8 +4888,8 @@ namespace realclosure { new_p2.append(sz2, p2); } else { - div(sz1, p1, g.size(), g.c_ptr(), new_p1); - div(sz2, p2, g.size(), g.c_ptr(), new_p2); + div(sz1, p1, g.size(), g.data(), new_p1); + div(sz2, p2, g.size(), g.data(), new_p2); SASSERT(is_monic(new_p2)); } } @@ -4908,7 +4908,7 @@ namespace realclosure { void normalize_algebraic(algebraic * x, unsigned sz1, value * const * p1, value_ref_buffer & new_p1) { polynomial const & p = x->p(); if (!m_lazy_algebraic_normalization || !m_in_aux_values || is_monic(p)) { - rem(sz1, p1, p.size(), p.c_ptr(), new_p1); + rem(sz1, p1, p.size(), p.data(), new_p1); } else { new_p1.reset(); @@ -4954,9 +4954,9 @@ namespace realclosure { polynomial const & one = a->den(); SASSERT(an.size() > 1); value_ref_buffer new_num(*this); - add(an.size(), an.c_ptr(), b, new_num); + add(an.size(), an.data(), b, new_num); SASSERT(new_num.size() == an.size()); - mk_add_value(a, b, new_num.size(), new_num.c_ptr(), one.size(), one.c_ptr(), r); + mk_add_value(a, b, new_num.size(), new_num.data(), one.size(), one.data(), r); } /** @@ -4973,17 +4973,17 @@ namespace realclosure { SASSERT(!a->ext()->is_algebraic()); polynomial const & ad = a->den(); // b_ad <- b * ad - mul(b, ad.size(), ad.c_ptr(), b_ad); + mul(b, ad.size(), ad.data(), b_ad); // num <- a + b * ad - add(an.size(), an.c_ptr(), b_ad.size(), b_ad.c_ptr(), num); + add(an.size(), an.data(), b_ad.size(), b_ad.data(), num); if (num.empty()) r = nullptr; else { value_ref_buffer new_num(*this); value_ref_buffer new_den(*this); - normalize_fraction(num.size(), num.c_ptr(), ad.size(), ad.c_ptr(), new_num, new_den); + normalize_fraction(num.size(), num.data(), ad.size(), ad.data(), new_num, new_den); SASSERT(!new_num.empty()); - mk_add_value(a, b, new_num.size(), new_num.c_ptr(), new_den.size(), new_den.c_ptr(), r); + mk_add_value(a, b, new_num.size(), new_num.data(), new_den.size(), new_den.data(), r); } } } @@ -4999,7 +4999,7 @@ namespace realclosure { polynomial const & one = a->den(); polynomial const & bn = b->num(); value_ref_buffer new_num(*this); - add(an.size(), an.c_ptr(), bn.size(), bn.c_ptr(), new_num); + add(an.size(), an.data(), bn.size(), bn.data(), new_num); if (new_num.empty()) r = nullptr; else { @@ -5008,7 +5008,7 @@ namespace realclosure { // That is, their degrees are < degree of the polynomial defining x. // Moreover, when we add polynomials, the degree can only decrease. // So, degree of new_num must be < degree of x's defining polynomial. - mk_add_value(a, b, new_num.size(), new_num.c_ptr(), one.size(), one.c_ptr(), r); + mk_add_value(a, b, new_num.size(), new_num.data(), one.size(), one.data(), r); } } @@ -5028,21 +5028,21 @@ namespace realclosure { polynomial const & bd = b->den(); value_ref_buffer an_bd(*this); value_ref_buffer bn_ad(*this); - mul(an.size(), an.c_ptr(), bd.size(), bd.c_ptr(), an_bd); - mul(bn.size(), bn.c_ptr(), ad.size(), ad.c_ptr(), bn_ad); + mul(an.size(), an.data(), bd.size(), bd.data(), an_bd); + mul(bn.size(), bn.data(), ad.size(), ad.data(), bn_ad); value_ref_buffer num(*this); - add(an_bd.size(), an_bd.c_ptr(), bn_ad.size(), bn_ad.c_ptr(), num); + add(an_bd.size(), an_bd.data(), bn_ad.size(), bn_ad.data(), num); if (num.empty()) { r = nullptr; } else { value_ref_buffer den(*this); - mul(ad.size(), ad.c_ptr(), bd.size(), bd.c_ptr(), den); + mul(ad.size(), ad.data(), bd.size(), bd.data(), den); value_ref_buffer new_num(*this); value_ref_buffer new_den(*this); - normalize_fraction(num.size(), num.c_ptr(), den.size(), den.c_ptr(), new_num, new_den); + normalize_fraction(num.size(), num.data(), den.size(), den.data(), new_num, new_den); SASSERT(!new_num.empty()); - mk_add_value(a, b, new_num.size(), new_num.c_ptr(), new_den.size(), new_den.c_ptr(), r); + mk_add_value(a, b, new_num.size(), new_num.data(), new_den.size(), new_den.data(), r); } } } @@ -5107,10 +5107,10 @@ namespace realclosure { polynomial const & an = a->num(); polynomial const & ad = a->den(); value_ref_buffer new_num(*this); - neg(an.size(), an.c_ptr(), new_num); + neg(an.size(), an.data(), new_num); scoped_mpbqi ri(bqim()); bqim().neg(interval(a), ri); - r = mk_rational_function_value_core(a->ext(), new_num.size(), new_num.c_ptr(), ad.size(), ad.c_ptr()); + r = mk_rational_function_value_core(a->ext(), new_num.size(), new_num.data(), ad.size(), ad.data()); swap(r->interval(), ri); SASSERT(!contains_zero(r->interval())); } @@ -5169,9 +5169,9 @@ namespace realclosure { polynomial const & one = a->den(); SASSERT(an.size() > 1); value_ref_buffer new_num(*this); - mul(b, an.size(), an.c_ptr(), new_num); + mul(b, an.size(), an.data(), new_num); SASSERT(new_num.size() == an.size()); - mk_mul_value(a, b, new_num.size(), new_num.c_ptr(), one.size(), one.c_ptr(), r); + mk_mul_value(a, b, new_num.size(), new_num.data(), one.size(), one.data(), r); } /** @@ -5187,13 +5187,13 @@ namespace realclosure { polynomial const & ad = a->den(); value_ref_buffer num(*this); // num <- b * an - mul(b, an.size(), an.c_ptr(), num); + mul(b, an.size(), an.data(), num); SASSERT(num.size() == an.size()); value_ref_buffer new_num(*this); value_ref_buffer new_den(*this); - normalize_fraction(num.size(), num.c_ptr(), ad.size(), ad.c_ptr(), new_num, new_den); + normalize_fraction(num.size(), num.data(), ad.size(), ad.data(), new_num, new_den); SASSERT(!new_num.empty()); - mk_mul_value(a, b, new_num.size(), new_num.c_ptr(), new_den.size(), new_den.c_ptr(), r); + mk_mul_value(a, b, new_num.size(), new_num.data(), new_den.size(), new_den.data(), r); } } @@ -5208,17 +5208,17 @@ namespace realclosure { polynomial const & one = a->den(); polynomial const & bn = b->num(); value_ref_buffer new_num(*this); - mul(an.size(), an.c_ptr(), bn.size(), bn.c_ptr(), new_num); + mul(an.size(), an.data(), bn.size(), bn.data(), new_num); SASSERT(!new_num.empty()); extension * x = a->ext(); if (x->is_algebraic()) { value_ref_buffer new_num2(*this); - normalize_algebraic(to_algebraic(x), new_num.size(), new_num.c_ptr(), new_num2); + normalize_algebraic(to_algebraic(x), new_num.size(), new_num.data(), new_num2); SASSERT(!new_num.empty()); - mk_mul_value(a, b, new_num2.size(), new_num2.c_ptr(), one.size(), one.c_ptr(), r); + mk_mul_value(a, b, new_num2.size(), new_num2.data(), one.size(), one.data(), r); } else { - mk_mul_value(a, b, new_num.size(), new_num.c_ptr(), one.size(), one.c_ptr(), r); + mk_mul_value(a, b, new_num.size(), new_num.data(), one.size(), one.data(), r); } } @@ -5238,14 +5238,14 @@ namespace realclosure { polynomial const & bd = b->den(); value_ref_buffer num(*this); value_ref_buffer den(*this); - mul(an.size(), an.c_ptr(), bn.size(), bn.c_ptr(), num); - mul(ad.size(), ad.c_ptr(), bd.size(), bd.c_ptr(), den); + mul(an.size(), an.data(), bn.size(), bn.data(), num); + mul(ad.size(), ad.data(), bd.size(), bd.data(), den); SASSERT(!num.empty()); SASSERT(!den.empty()); value_ref_buffer new_num(*this); value_ref_buffer new_den(*this); - normalize_fraction(num.size(), num.c_ptr(), den.size(), den.c_ptr(), new_num, new_den); + normalize_fraction(num.size(), num.data(), den.size(), den.data(), new_num, new_den); SASSERT(!new_num.empty()); - mk_mul_value(a, b, new_num.size(), new_num.c_ptr(), new_den.size(), new_den.c_ptr(), r); + mk_mul_value(a, b, new_num.size(), new_num.data(), new_den.size(), new_den.data(), r); } } @@ -5350,20 +5350,20 @@ namespace realclosure { // In every iteration of the loop we have // Q(alpha) * h(alpha) = R(alpha) TRACE("inv_algebraic", - tout << "Q: "; display_poly(tout, Q.size(), Q.c_ptr()); tout << "\n"; - tout << "R: "; display_poly(tout, R.size(), R.c_ptr()); tout << "\n";); + 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) { // If the new Q is the constant polynomial, they we are done. // We just divide R by Q[0]. // h(alpha) = R(alpha) / Q[0] - div(R.size(), R.c_ptr(), Q[0], h); - TRACE("inv_algebraic", tout << "h: "; display_poly(tout, h.size(), h.c_ptr()); tout << "\n";); + div(R.size(), R.data(), Q[0], h); + TRACE("inv_algebraic", tout << "h: "; display_poly(tout, h.size(), h.data()); tout << "\n";); // g <- 1 g.reset(); g.push_back(one()); return true; } else { - div_rem(p_sz, p, Q.size(), Q.c_ptr(), Quo, Rem); + div_rem(p_sz, p, Q.size(), Q.data(), Quo, Rem); if (Rem.empty()) { // failed // GCD(q, p) != 1 @@ -5384,11 +5384,11 @@ namespace realclosure { // Q <- -REM // R <- R * Quo // Q <- -Rem - neg(Rem.size(), Rem.c_ptr(), Q); - mul(R.size(), R.c_ptr(), Quo.size(), Quo.c_ptr(), aux); + neg(Rem.size(), Rem.data(), Q); + mul(R.size(), R.data(), Quo.size(), Quo.data(), aux); // Moreover since p(alpha) = 0, we can simplify Q, by using // Q(alpha) = REM(Q, p)(alpha) - rem(aux.size(), aux.c_ptr(), p_sz, p, R); + rem(aux.size(), aux.data(), p_sz, p, R); SASSERT(R.size() < p_sz); // } @@ -5410,15 +5410,15 @@ namespace realclosure { polynomial const & p = alpha->p(); value_ref_buffer norm_q(*this); // since p(alpha) = 0, we have that q(alpha) = rem(q, p)(alpha) - rem(q.size(), q.c_ptr(), p.size(), p.c_ptr(), norm_q); + rem(q.size(), q.data(), p.size(), p.data(), norm_q); SASSERT(norm_q.size() < p.size()); value_ref_buffer new_num(*this), g(*this); - if (inv_algebraic(norm_q.size(), norm_q.c_ptr(), p.size(), p.c_ptr(), g, new_num)) { + if (inv_algebraic(norm_q.size(), norm_q.data(), p.size(), p.data(), g, new_num)) { if (new_num.size() == 1) { r = new_num[0]; } else { - r = mk_rational_function_value_core(alpha, new_num.size(), new_num.c_ptr()); + r = mk_rational_function_value_core(alpha, new_num.size(), new_num.data()); swap(r->interval(), ri); SASSERT(!contains_zero(r->interval())); } @@ -5436,11 +5436,11 @@ namespace realclosure { // And try again :) value_ref_buffer new_p(*this); - div(p.size(), p.c_ptr(), g.size(), g.c_ptr(), new_p); + div(p.size(), p.data(), g.size(), g.data(), new_p); if (m_clean_denominators) { value_ref_buffer tmp(*this); value_ref d(*this); - clean_denominators(new_p.size(), new_p.c_ptr(), tmp, d); + clean_denominators(new_p.size(), new_p.data(), tmp, d); new_p = tmp; } SASSERT(new_p.size() >= 2); @@ -5454,7 +5454,7 @@ namespace realclosure { div(alpha_val, new_p[1], alpha_val); // Thus, a is equal to q(alpha_val) value_ref new_a(*this); - mk_polynomial_value(q.size(), q.c_ptr(), alpha_val, new_a); + mk_polynomial_value(q.size(), q.data(), alpha_val, new_a); // Remark new_a does not depend on alpha anymore // r == 1/inv(new_a) inv(new_a, r); @@ -5465,7 +5465,7 @@ namespace realclosure { // The m_iso_interval for p() is also an isolating interval for new_p, // since the roots of new_p() are a subset of the roots of p reset_p(alpha->m_p); - set_p(alpha->m_p, new_p.size(), new_p.c_ptr()); + set_p(alpha->m_p, new_p.size(), new_p.data()); // The new call will succeed because q and new_p are co-prime inv_algebraic(a, r); @@ -5488,7 +5488,7 @@ namespace realclosure { // - new_p is square free (it is a factor of the square free polynomial p) // - 0 is not a root of new_p (it is a factor of p, and 0 is not a root of p) numeral_vector roots; - nl_nz_sqf_isolate_roots(new_p.size(), new_p.c_ptr(), roots); + nl_nz_sqf_isolate_roots(new_p.size(), new_p.data(), roots); SASSERT(roots.size() > 0); algebraic * new_alpha; if (roots.size() == 1) { @@ -5513,7 +5513,7 @@ namespace realclosure { // copy new_alpha->m_p reset_p(alpha->m_p); - set_p(alpha->m_p, new_alpha->m_p.size(), new_alpha->m_p.c_ptr()); + set_p(alpha->m_p, new_alpha->m_p.size(), new_alpha->m_p.data()); // copy new_alpha->m_sign_det inc_ref_sign_det(new_alpha->m_sign_det); dec_ref_sign_det(alpha->m_sign_det); @@ -5542,8 +5542,8 @@ namespace realclosure { // The GCD of an and ad is one, we may use a simpler version of normalize value_ref_buffer new_num(*this); value_ref_buffer new_den(*this); - normalize_fraction(ad.size(), ad.c_ptr(), an.size(), an.c_ptr(), new_num, new_den); - r = mk_rational_function_value_core(a->ext(), new_num.size(), new_num.c_ptr(), new_den.size(), new_den.c_ptr()); + normalize_fraction(ad.size(), ad.data(), an.size(), an.data(), new_num, new_den); + r = mk_rational_function_value_core(a->ext(), new_num.size(), new_num.data(), new_den.size(), new_den.data()); swap(r->interval(), ri); SASSERT(!contains_zero(r->interval())); } @@ -5646,7 +5646,7 @@ namespace realclosure { p.push_back(one()); numeral_vector roots; - nz_isolate_roots(p.size(), p.c_ptr(), roots); + nz_isolate_roots(p.size(), p.data(), roots); SASSERT(roots.size() == 1 || roots.size() == 2); if (roots.size() == 1 || sign(roots[0].m_value) > 0) { set(b, roots[0]); @@ -5817,7 +5817,7 @@ namespace realclosure { template void display_polynomial(std::ostream & out, polynomial const & p, DisplayVar const & display_var, bool compact, bool pp) const { - display_polynomial(out, p.size(), p.c_ptr(), display_var, compact, pp); + display_polynomial(out, p.size(), p.data(), display_var, compact, pp); } struct display_free_var_proc { diff --git a/src/math/realclosure/realclosure.h b/src/math/realclosure/realclosure.h index 4e0a95ece..8154c43d3 100644 --- a/src/math/realclosure/realclosure.h +++ b/src/math/realclosure/realclosure.h @@ -273,7 +273,7 @@ namespace realclosure { num():m_value(nullptr) {} // Low level functions for implementing the C API - void * c_ptr() { return m_value; } + void * data() { return m_value; } static num mk(void * ptr) { num r; r.m_value = reinterpret_cast(ptr); return r; } }; }; diff --git a/src/math/simplex/model_based_opt.cpp b/src/math/simplex/model_based_opt.cpp index 73c9e0d1e..a52dabf9e 100644 --- a/src/math/simplex/model_based_opt.cpp +++ b/src/math/simplex/model_based_opt.cpp @@ -699,7 +699,7 @@ namespace opt { unsigned i = 0, j = 0; while (i < r1.m_vars.size() || j < r2.m_vars.size()) { if (j == r2.m_vars.size()) { - m_new_vars.append(r1.m_vars.size() - i, r1.m_vars.c_ptr() + i); + m_new_vars.append(r1.m_vars.size() - i, r1.m_vars.data() + i); break; } if (i == r1.m_vars.size()) { @@ -823,7 +823,7 @@ namespace opt { row& r = m_rows[row_id]; rational val(c); SASSERT(r.m_vars.empty()); - r.m_vars.append(coeffs.size(), coeffs.c_ptr()); + r.m_vars.append(coeffs.size(), coeffs.data()); bool is_int_row = !coeffs.empty(); std::sort(r.m_vars.begin(), r.m_vars.end(), var::compare()); for (auto const& c : coeffs) { diff --git a/src/math/subpaving/subpaving.cpp b/src/math/subpaving/subpaving.cpp index c43b74f0d..19dd661c6 100644 --- a/src/math/subpaving/subpaving.cpp +++ b/src/math/subpaving/subpaving.cpp @@ -76,7 +76,7 @@ namespace subpaving { m_ctx.nm().set(m_as[i], as[i]); } m_ctx.nm().set(m_c, c); - return m_ctx.mk_sum(m_c, sz, m_as.c_ptr(), xs); + return m_ctx.mk_sum(m_c, sz, m_as.data(), xs); } ineq * mk_ineq(var x, mpq const & k, bool lower, bool open) override { return reinterpret_cast(m_ctx.mk_ineq(x, k, lower, open)); @@ -119,7 +119,7 @@ namespace subpaving { int2mpf(as[i], m_as[i]); } int2mpf(c, m_c); - return m_ctx.mk_sum(m_c, sz, m_as.c_ptr(), xs); + return m_ctx.mk_sum(m_c, sz, m_as.data(), xs); } catch (const f2n::exception &) { throw subpaving::exception(); @@ -176,7 +176,7 @@ namespace subpaving { int2hwf(as[i], m_as[i]); } int2hwf(c, m_c); - return m_ctx.mk_sum(m_c, sz, m_as.c_ptr(), xs); + return m_ctx.mk_sum(m_c, sz, m_as.data(), xs); } catch (const f2n::exception &) { throw subpaving::exception(); @@ -234,7 +234,7 @@ namespace subpaving { int2fpoint(as[i], m_as[i]); } int2fpoint(c, m_c); - return this->m_ctx.mk_sum(m_c, sz, m_as.c_ptr(), xs); + return this->m_ctx.mk_sum(m_c, sz, m_as.data(), xs); } catch (const typename context_fpoint::numeral_manager::exception &) { throw subpaving::exception(); diff --git a/src/math/subpaving/subpaving_t_def.h b/src/math/subpaving/subpaving_t_def.h index 21f7c020e..c31e920ab 100644 --- a/src/math/subpaving/subpaving_t_def.h +++ b/src/math/subpaving/subpaving_t_def.h @@ -712,7 +712,7 @@ var context_t::mk_monomial(unsigned sz, power const * pws) { } } sz = j + 1; - pws = m_pws.c_ptr(); + pws = m_pws.data(); unsigned mem_sz = monomial::get_obj_size(sz); void * mem = allocator().allocate(mem_sz); monomial * r = new (mem) monomial(sz, pws); diff --git a/src/math/subpaving/tactic/expr2subpaving.cpp b/src/math/subpaving/tactic/expr2subpaving.cpp index 09ebe40e3..ba7bf3546 100644 --- a/src/math/subpaving/tactic/expr2subpaving.cpp +++ b/src/math/subpaving/tactic/expr2subpaving.cpp @@ -212,7 +212,7 @@ struct expr2subpaving::imp { else if (pws.size() == 1 && pws[0].degree() == 1) x = pws[0].get_var(); else - x = s().mk_monomial(pws.size(), pws.c_ptr()); + x = s().mk_monomial(pws.size(), pws.data()); cache_result(t, x, n, d); return x; } @@ -258,7 +258,7 @@ struct expr2subpaving::imp { x = subpaving::null_var; } else { - x = s().mk_sum(sum_c, sz, ns.c_ptr(), xs.c_ptr()); + x = s().mk_sum(sum_c, sz, ns.data(), xs.data()); qm().set(n, 1); } cache_result(t, x, n, d); diff --git a/src/math/subpaving/tactic/subpaving_tactic.cpp b/src/math/subpaving/tactic/subpaving_tactic.cpp index 7a3f2e7b3..c453806bf 100644 --- a/src/math/subpaving/tactic/subpaving_tactic.cpp +++ b/src/math/subpaving/tactic/subpaving_tactic.cpp @@ -174,7 +174,7 @@ class subpaving_tactic : public tactic { for (unsigned i = 0; i < sz; i++) { ineq_buffer.push_back(mk_ineq(args[i])); } - m_ctx->add_clause(sz, ineq_buffer.c_ptr()); + m_ctx->add_clause(sz, ineq_buffer.data()); } void internalize(goal const & g) { diff --git a/src/model/array_factory.cpp b/src/model/array_factory.cpp index 8350839b7..b68d708a1 100644 --- a/src/model/array_factory.cpp +++ b/src/model/array_factory.cpp @@ -30,7 +30,7 @@ func_decl * mk_aux_decl_for_array_sort(ast_manager & m, sort * s) { for (unsigned i = 0; i < arity; i++) { domain.push_back(get_array_domain(s, i)); } - return m.mk_fresh_func_decl(symbol::null, symbol::null, arity, domain.c_ptr(), range); + return m.mk_fresh_func_decl(symbol::null, symbol::null, arity, domain.data(), range); } array_factory::array_factory(ast_manager & m, model_core & md): @@ -88,8 +88,8 @@ bool array_factory::mk_two_diff_values_for(sort * s) { func_interp * fi2; mk_array_interp(s, fi1); mk_array_interp(s, fi2); - fi1->insert_entry(args.c_ptr(), r1); - fi2->insert_entry(args.c_ptr(), r2); + fi1->insert_entry(args.data(), r1); + fi2->insert_entry(args.data(), r2); DEBUG_CODE({ value_set * set = 0; SASSERT(m_sort2value_set.find(s, set) && set->size() >= 2); @@ -175,8 +175,8 @@ expr * array_factory::get_fresh_value(sort * s) { if (found) { func_interp * fi; expr * val = mk_array_interp(s, fi); - fi->insert_entry(args1.c_ptr(), v1); - fi->insert_entry(args2.c_ptr(), v2); + fi->insert_entry(args1.data(), v1); + fi->insert_entry(args2.data(), v2); return val; } } diff --git a/src/model/func_interp.cpp b/src/model/func_interp.cpp index e327adcf6..76b628dd3 100644 --- a/src/model/func_interp.cpp +++ b/src/model/func_interp.cpp @@ -146,7 +146,7 @@ void func_interp::set_else(expr * e) { ptr_vector args; while (e && is_fi_entry_expr(e, args)) { - insert_entry(args.c_ptr(), to_app(e)->get_arg(1)); + insert_entry(args.data(), to_app(e)->get_arg(1)); e = to_app(e)->get_arg(2); } @@ -348,7 +348,7 @@ expr * func_interp::get_interp_core() const { eqs.push_back(m().mk_eq(vars[i], curr->get_arg(i))); } SASSERT(eqs.size() == m_arity); - expr * cond = mk_and(m(), eqs.size(), eqs.c_ptr()); + expr * cond = mk_and(m(), eqs.size(), eqs.data()); expr * th = curr->get_result(); if (m().is_true(th)) { r = m().is_false(r) ? cond : m().mk_or(cond, r); @@ -393,13 +393,13 @@ expr_ref func_interp::get_array_interp_core(func_decl * f) const { vars.push_back(m().mk_var(m_arity - i - 1, sorts.back())); } r = sub(r, vars); - r = m().mk_lambda(sorts.size(), sorts.c_ptr(), var_names.c_ptr(), r); + r = m().mk_lambda(sorts.size(), sorts.data(), var_names.data(), r); return r; } expr_ref_vector args(m()); array_util autil(m()); - sort_ref A(autil.mk_array_sort(domain.size(), domain.c_ptr(), m_else->get_sort()), m()); + sort_ref A(autil.mk_array_sort(domain.size(), domain.data(), m_else->get_sort()), m()); r = autil.mk_const_array(A, m_else); for (func_entry * curr : m_entries) { expr * res = curr->get_result(); @@ -448,7 +448,7 @@ func_interp * func_interp::translate(ast_translation & translator) const { ptr_buffer new_args; for (unsigned i = 0; i < m_arity; i++) new_args.push_back(translator(curr->get_arg(i))); - new_fi->insert_new_entry(new_args.c_ptr(), translator(curr->get_result())); + new_fi->insert_new_entry(new_args.data(), translator(curr->get_result())); } new_fi->set_else(translator(m_else)); return new_fi; diff --git a/src/model/func_interp.h b/src/model/func_interp.h index 115013008..2413d013a 100644 --- a/src/model/func_interp.h +++ b/src/model/func_interp.h @@ -107,7 +107,7 @@ public: unsigned num_entries() const { return m_entries.size(); } ptr_vector::const_iterator begin() const { return m_entries.begin(); } ptr_vector::const_iterator end() const { return m_entries.end(); } - func_entry const * const * get_entries() const { return m_entries.c_ptr(); } + func_entry const * const * get_entries() const { return m_entries.data(); } func_entry const * get_entry(unsigned idx) const { return m_entries[idx]; } void del_entry(unsigned idx); diff --git a/src/model/model.cpp b/src/model/model.cpp index 83d13f703..982cabdde 100644 --- a/src/model/model.cpp +++ b/src/model/model.cpp @@ -49,7 +49,7 @@ model::model(ast_manager & m): model::~model() { for (auto & kv : m_usort2universe) { m.dec_ref(kv.m_key); - m.dec_array_ref(kv.m_value->size(), kv.m_value->c_ptr()); + m.dec_array_ref(kv.m_value->size(), kv.m_value->data()); dealloc(kv.m_value); } } @@ -73,7 +73,7 @@ void model::copy_func_interps(model const & source) { void model::copy_usort_interps(model const & source) { for (auto const& kv : source.m_usort2universe) - register_usort(kv.m_key, kv.m_value->size(), kv.m_value->c_ptr()); + register_usort(kv.m_key, kv.m_value->size(), kv.m_value->data()); } model * model::copy() const { @@ -161,7 +161,7 @@ void model::register_usort(sort * s, unsigned usize, expr * const * universe) { u->append(usize, universe); } else { - m.dec_array_ref(u->size(), u->c_ptr()); + m.dec_array_ref(u->size(), u->data()); u->reset(); u->append(usize, universe); } @@ -190,7 +190,7 @@ model * model::translate(ast_translation & translator) const { } res->register_usort(translator(kv.m_key), new_universe.size(), - new_universe.c_ptr()); + new_universe.data()); } return res; @@ -469,7 +469,7 @@ expr_ref model::cleanup_expr(top_sort& ts, expr* e, unsigned current_partition) else if (f->is_skolem() && can_inline_def(ts, f) && (fi = get_func_interp(f)) && fi->get_interp() && (!ts.partition_ids().find(f, pid) || pid != current_partition)) { var_subst vs(m, false); - new_t = vs(fi->get_interp(), args.size(), args.c_ptr()); + new_t = vs(fi->get_interp(), args.size(), args.data()); } else if (bv.is_bit2bool(t)) { unsigned idx = f->get_parameter(0).get_int(); @@ -482,7 +482,7 @@ expr_ref model::cleanup_expr(top_sort& ts, expr* e, unsigned current_partition) } #endif else { - new_t = ts.m_rewrite.mk_app(f, args.size(), args.c_ptr()); + new_t = ts.m_rewrite.mk_app(f, args.size(), args.data()); } if (t != new_t.get()) trail.push_back(new_t); diff --git a/src/model/model2expr.cpp b/src/model/model2expr.cpp index b29c8ca8c..7b7313dd4 100644 --- a/src/model/model2expr.cpp +++ b/src/model/model2expr.cpp @@ -73,7 +73,7 @@ static void mk_entry_cond(unsigned arity, func_entry const* entry, expr_ref& res conjs.push_back(m.mk_eq(m.mk_var(i, e->get_sort()), e)); } } - bool_rewriter(m).mk_and(conjs.size(), conjs.c_ptr(), result); + bool_rewriter(m).mk_and(conjs.size(), conjs.data(), result); } void model2expr(model& md, expr_ref& result) { @@ -113,7 +113,7 @@ void model2expr(model& md, expr_ref& result) { for (unsigned j = 0; j < f->get_arity(); ++j) { args.push_back(m.mk_var(j, f->get_domain(j))); } - func = m.mk_app(f, args.size(), args.c_ptr()); + func = m.mk_app(f, args.size(), args.data()); if (fi->is_partial()) { if (num_entries == 0) { continue; @@ -147,11 +147,11 @@ void model2expr(model& md, expr_ref& result) { } if (f->get_arity() > 0) { var_subst vs(m, false); - tmp = vs(tmp, rev_vars.size(), rev_vars.c_ptr()); - tmp = m.mk_forall(sorts.size(), sorts.c_ptr(), names.c_ptr(), tmp); + tmp = vs(tmp, rev_vars.size(), rev_vars.data()); + tmp = m.mk_forall(sorts.size(), sorts.data(), names.data(), tmp); } conjs.push_back(tmp); } - bool_rewriter(m).mk_and(conjs.size(), conjs.c_ptr(), result); + bool_rewriter(m).mk_and(conjs.size(), conjs.data(), result); } diff --git a/src/model/model_evaluator.cpp b/src/model/model_evaluator.cpp index b326966d7..3bc902ddd 100644 --- a/src/model/model_evaluator.cpp +++ b/src/model/model_evaluator.cpp @@ -290,7 +290,7 @@ struct evaluator_cfg : public default_rewriter_cfg { for (unsigned i = stores.size(); i-- > 0; ) { expr_ref_vector args(m); args.push_back(val); - args.append(stores[i].size(), stores[i].c_ptr()); + args.append(stores[i].size(), stores[i].data()); val = m_ar.mk_store(args); } TRACE("model_evaluator", tout << val << "\n";); @@ -423,10 +423,10 @@ struct evaluator_cfg : public default_rewriter_cfg { args2.push_back(b); stores1.append(stores2); for (unsigned i = 0; i < stores1.size(); ++i) { - args1.resize(1); args1.append(stores1[i].size() - 1, stores1[i].c_ptr()); - args2.resize(1); args2.append(stores1[i].size() - 1, stores1[i].c_ptr()); - expr_ref s1(m_ar.mk_select(args1.size(), args1.c_ptr()), m); - expr_ref s2(m_ar.mk_select(args2.size(), args2.c_ptr()), m); + args1.resize(1); args1.append(stores1[i].size() - 1, stores1[i].data()); + args2.resize(1); args2.append(stores1[i].size() - 1, stores1[i].data()); + expr_ref s1(m_ar.mk_select(args1.size(), args1.data()), m); + expr_ref s2(m_ar.mk_select(args2.size(), args2.data()), m); conj.push_back(m.mk_eq(s1, s2)); } result = mk_and(conj); @@ -481,19 +481,19 @@ struct evaluator_cfg : public default_rewriter_cfg { // stores with smaller index take precedence for (unsigned i = stores1.size(); i-- > 0; ) { - table1.insert(stores1[i].c_ptr()); + table1.insert(stores1[i].data()); } for (unsigned i = 0, sz = stores2.size(); i < sz; ++i) { - if (table2.contains(stores2[i].c_ptr())) { + if (table2.contains(stores2[i].data())) { // first insertion takes precedence. TRACE("model_evaluator", tout << "duplicate " << stores2[i] << "\n";); continue; } - table2.insert(stores2[i].c_ptr()); + table2.insert(stores2[i].data()); expr * const* args = nullptr; expr* val = stores2[i][arity]; - if (table1.find(stores2[i].c_ptr(), args)) { + if (table1.find(stores2[i].data(), args)) { TRACE("model_evaluator", tout << "found value " << stores2[i] << "\n";); table1.remove(args); switch (compare(args[arity], val)) { diff --git a/src/model/model_implicant.cpp b/src/model/model_implicant.cpp index ad0db9ca1..eedd66601 100644 --- a/src/model/model_implicant.cpp +++ b/src/model/model_implicant.cpp @@ -582,10 +582,10 @@ void model_implicant::eval_array_eq(app* e, expr* arg1, expr* arg2) { for (unsigned i = 0; i < store.size(); ++i) { args1.resize(1); args2.resize(1); - args1.append(store[i].size()-1, store[i].c_ptr()); - args2.append(store[i].size()-1, store[i].c_ptr()); - s1 = m_array.mk_select(args1.size(), args1.c_ptr()); - s2 = m_array.mk_select(args2.size(), args2.c_ptr()); + args1.append(store[i].size()-1, store[i].data()); + args2.append(store[i].size()-1, store[i].data()); + s1 = m_array.mk_select(args1.size(), args1.data()); + s2 = m_array.mk_select(args2.size(), args2.data()); w1 = (*m_model)(s1); w2 = (*m_model)(s2); if (w1 == w2) { diff --git a/src/model/model_smt2_pp.cpp b/src/model/model_smt2_pp.cpp index 5a0b40657..df1a8b734 100644 --- a/src/model/model_smt2_pp.cpp +++ b/src/model/model_smt2_pp.cpp @@ -263,7 +263,7 @@ static void pp_funs(std::ostream & out, ast_printer_context & ctx, model_core co body.get()))); for (unsigned i = 0; i < f_i->num_entries(); i++) f_entries.push_back(mk_string(m, ")")); - body = mk_compose(m, f_entries.size(), f_entries.c_ptr()); + body = mk_compose(m, f_entries.size(), f_entries.data()); } format_ref def(fm(m)); std::string fname; diff --git a/src/muz/base/bind_variables.cpp b/src/muz/base/bind_variables.cpp index 7b406869d..5ac41e0bf 100644 --- a/src/muz/base/bind_variables.cpp +++ b/src/muz/base/bind_variables.cpp @@ -38,7 +38,7 @@ expr_ref bind_variables::operator()(expr* fml, bool is_forall) { if (!m_names.empty()) { m_bound.reverse(); m_names.reverse(); - result = m.mk_quantifier(is_forall ? forall_k : exists_k, m_bound.size(), m_bound.c_ptr(), m_names.c_ptr(), result); + result = m.mk_quantifier(is_forall ? forall_k : exists_k, m_bound.size(), m_bound.data(), m_names.data(), result); } m_pinned.reset(); m_cache.reset(); @@ -114,7 +114,7 @@ expr_ref bind_variables::abstract(expr* term, cache_t& cache, unsigned scope) { } if (all_visited) { if (some_diff) { - b = m.mk_app(a->get_decl(), m_args.size(), m_args.c_ptr()); + b = m.mk_app(a->get_decl(), m_args.size(), m_args.data()); m_pinned.push_back(b); } else { @@ -135,7 +135,7 @@ expr_ref bind_variables::abstract(expr* term, cache_t& cache, unsigned scope) { patterns.push_back(abstract(q->get_pattern(i), new_cache, new_scope)); } result1 = abstract(q->get_expr(), new_cache, new_scope); - b = m.update_quantifier(q, patterns.size(), patterns.c_ptr(), result1.get()); + b = m.update_quantifier(q, patterns.size(), patterns.data(), result1.get()); m_pinned.push_back(b); cache.insert(e, b); m_todo.pop_back(); diff --git a/src/muz/base/dl_boogie_proof.cpp b/src/muz/base/dl_boogie_proof.cpp index 8f4f9c02d..97e4689dc 100644 --- a/src/muz/base/dl_boogie_proof.cpp +++ b/src/muz/base/dl_boogie_proof.cpp @@ -113,10 +113,10 @@ namespace datalog { } } } - premises[i] = m.mk_hyper_resolve(premises2.size(), premises2.c_ptr(), l2, positions2, substs2); + premises[i] = m.mk_hyper_resolve(premises2.size(), premises2.data(), l2, positions2, substs2); } conclusion = conclusion1; - pr = m.mk_hyper_resolve(premises.size(), premises.c_ptr(), conclusion, positions, substs); + pr = m.mk_hyper_resolve(premises.size(), premises.data(), conclusion, positions, substs); } } diff --git a/src/muz/base/dl_context.cpp b/src/muz/base/dl_context.cpp index d3a79acb5..6d95b705f 100644 --- a/src/muz/base/dl_context.cpp +++ b/src/muz/base/dl_context.cpp @@ -625,7 +625,7 @@ namespace datalog { m_rel->add_fact(pred, fact); } else { - expr_ref rule(m.mk_app(pred, fact.size(), (expr*const*)fact.c_ptr()), m); + expr_ref rule(m.mk_app(pred, fact.size(), (expr*const*)fact.data()), m); add_rule(rule, symbol::null); } } @@ -1125,7 +1125,7 @@ namespace datalog { ast_pp_util visitor(m); func_decl_set rels; unsigned num_axioms = m_background.size(); - expr* const* axioms = m_background.c_ptr(); + expr* const* axioms = m_background.data(); expr_ref fml(m); expr_ref_vector rules(m), queries(m); svector names; @@ -1141,8 +1141,8 @@ namespace datalog { smt2_pp_environment_dbg env(m); mk_fresh_name fresh_names; collect_free_funcs(num_axioms, axioms, visitor, fresh_names); - collect_free_funcs(rules.size(), rules.c_ptr(), visitor, fresh_names); - collect_free_funcs(queries.size(), queries.c_ptr(), visitor, fresh_names); + collect_free_funcs(rules.size(), rules.data(), visitor, fresh_names); + collect_free_funcs(queries.size(), queries.data(), visitor, fresh_names); func_decl_set funcs; unsigned sz = visitor.coll.get_num_decls(); for (unsigned i = 0; i < sz; ++i) { @@ -1212,7 +1212,7 @@ namespace datalog { else { m_free_vars(q); m_free_vars.set_default_sort(m.mk_bool_sort()); - sort* const* domain = m_free_vars.c_ptr(); + sort* const* domain = m_free_vars.data(); expr_ref qfn(m); expr_ref_vector args(m); fn = m.mk_fresh_func_decl(symbol("q"), symbol(""), m_free_vars.size(), domain, m.mk_bool_sort()); @@ -1220,7 +1220,7 @@ namespace datalog { for (unsigned j = 0; j < m_free_vars.size(); ++j) { args.push_back(m.mk_var(j, m_free_vars[j])); } - qfn = m.mk_implies(q, m.mk_app(fn, args.size(), args.c_ptr())); + qfn = m.mk_implies(q, m.mk_app(fn, args.size(), args.data())); out << "(assert "; PP(qfn); @@ -1327,7 +1327,7 @@ namespace datalog { subst.push_back(fresh_vars[vars[max_var]].get()); } - res = vsubst(q->get_expr(), subst.size(), subst.c_ptr()); + res = vsubst(q->get_expr(), subst.size(), subst.data()); rules[i] = res.get(); } } diff --git a/src/muz/base/dl_context.h b/src/muz/base/dl_context.h index 754132f2a..c35cfd58a 100644 --- a/src/muz/base/dl_context.h +++ b/src/muz/base/dl_context.h @@ -94,8 +94,8 @@ namespace datalog { relation_fact(ast_manager & m, unsigned sz) : app_ref_vector(m) { resize(sz); } relation_fact(context & ctx); - iterator begin() const { return c_ptr(); } - iterator end() const { return c_ptr()+size(); } + iterator begin() const { return data(); } + iterator end() const { return data()+size(); } relation_element operator[](unsigned i) const { return get(i); } el_proxy operator[](unsigned i) { return el_proxy(*this, i); } diff --git a/src/muz/base/dl_engine_base.h b/src/muz/base/dl_engine_base.h index 21e2272fb..05872c06b 100644 --- a/src/muz/base/dl_engine_base.h +++ b/src/muz/base/dl_engine_base.h @@ -63,9 +63,9 @@ namespace datalog { } sorts.reverse(); names.reverse(); - q = m.mk_app(r, args.size(), args.c_ptr()); + q = m.mk_app(r, args.size(), args.data()); if (!args.empty()) { - q = m.mk_exists(sorts.size(), sorts.c_ptr(), names.c_ptr(), q); + q = m.mk_exists(sorts.size(), sorts.data(), names.data(), q); } return query(q); } diff --git a/src/muz/base/dl_rule.cpp b/src/muz/base/dl_rule.cpp index 6c49edc27..2baaf57b9 100644 --- a/src/muz/base/dl_rule.cpp +++ b/src/muz/base/dl_rule.cpp @@ -197,10 +197,10 @@ namespace datalog { mk_negations(m_body, m_neg); - check_valid_rule(m_head, m_body.size(), m_body.c_ptr()); + check_valid_rule(m_head, m_body.size(), m_body.data()); rule_ref r(*this); - r = mk(m_head.get(), m_body.size(), m_body.c_ptr(), m_neg.c_ptr(), name); + r = mk(m_head.get(), m_body.size(), m_body.data(), m_neg.data(), name); expr_ref fml1(m); if (p) { @@ -278,7 +278,7 @@ namespace datalog { qh.pull_quantifier(false, q, nullptr, &names); // retrieve free variables. m_free_vars(q); - vars.append(m_free_vars.size(), m_free_vars.c_ptr()); + vars.append(m_free_vars.size(), m_free_vars.data()); if (vars.contains(static_cast(nullptr))) { var_subst sub(m, false); expr_ref_vector args(m); @@ -293,10 +293,10 @@ namespace datalog { args.push_back(m.mk_var(0, m.mk_bool_sort())); } } - q = sub(q, args.size(), args.c_ptr()); + q = sub(q, args.size(), args.data()); vars.reset(); m_free_vars(q); - vars.append(m_free_vars.size(), m_free_vars.c_ptr()); + vars.append(m_free_vars.size(), m_free_vars.data()); } SASSERT(!vars.contains(static_cast(0)) && "Unused variables have been eliminated"); @@ -322,7 +322,7 @@ namespace datalog { } vars.reverse(); names.reverse(); - func_decl* qpred = m_ctx.mk_fresh_head_predicate(symbol("query"), symbol(), vars.size(), vars.c_ptr(), body_pred); + func_decl* qpred = m_ctx.mk_fresh_head_predicate(symbol("query"), symbol(), vars.size(), vars.data(), body_pred); m_ctx.register_predicate(qpred, false); rules.set_output_predicate(qpred); @@ -336,11 +336,11 @@ namespace datalog { for (unsigned i = 0; i < vars.size(); i++) { qhead_args.push_back(m.mk_var(vars.size()-i-1, vars[i])); } - app_ref qhead(m.mk_app(qpred, qhead_args.c_ptr()), m); + app_ref qhead(m.mk_app(qpred, qhead_args.data()), m); app_ref impl(m.mk_implies(q, qhead), m); expr_ref rule_expr(impl.get(), m); if (!vars.empty()) { - rule_expr = m.mk_forall(vars.size(), vars.c_ptr(), names.c_ptr(), impl); + rule_expr = m.mk_forall(vars.size(), vars.data(), names.data(), impl); } TRACE("dl", tout << rule_expr << "\n";); @@ -401,7 +401,7 @@ namespace datalog { body.push_back(m.mk_eq(v, b)); } } - fml = m.mk_app(fml->get_decl(), m_args.size(), m_args.c_ptr()); + fml = m.mk_app(fml->get_decl(), m_args.size(), m_args.data()); TRACE("dl_rule", tout << mk_pp(fml.get(), m) << "\n";); } @@ -567,7 +567,7 @@ namespace datalog { switch (body.size()) { case 0: break; case 1: fml = m.mk_implies(body[0].get(), fml); break; - default: fml = m.mk_implies(m.mk_and(body.size(), body.c_ptr()), fml); break; + default: fml = m.mk_implies(m.mk_and(body.size(), body.data()), fml); break; } m_free_vars.reset(); @@ -594,7 +594,7 @@ namespace datalog { } } } - fml = m.mk_forall(m_free_vars.size(), m_free_vars.c_ptr(), names.c_ptr(), fml); + fml = m.mk_forall(m_free_vars.size(), m_free_vars.data(), names.data(), fml); } std::ostream& rule_manager::display_smt2(rule const& r, std::ostream & out) { @@ -638,7 +638,7 @@ namespace datalog { tail.push_back(ensure_app(conjs[i].get())); } tail_neg.resize(tail.size(), false); - r = mk(r->get_head(), tail.size(), tail.c_ptr(), tail_neg.c_ptr(), r->name()); + r = mk(r->get_head(), tail.size(), tail.data(), tail_neg.data(), r->name()); TRACE("dl", r->display(m_ctx, tout << "reduced rule\n");); } } @@ -703,7 +703,7 @@ namespace datalog { return; } expr_ref unbound_tail(m); - bool_rewriter(m).mk_and(tails_with_unbound.size(), tails_with_unbound.c_ptr(), unbound_tail); + bool_rewriter(m).mk_and(tails_with_unbound.size(), tails_with_unbound.data(), unbound_tail); unsigned q_var_cnt = unbound_vars.num_elems(); @@ -743,9 +743,9 @@ namespace datalog { expr_ref unbound_tail_pre_quant(m), fixed_tail(m), quant_tail(m); var_subst vs(m, false); - unbound_tail_pre_quant = vs(unbound_tail, subst.size(), subst.c_ptr()); + unbound_tail_pre_quant = vs(unbound_tail, subst.size(), subst.data()); - quant_tail = m.mk_exists(q_var_cnt, qsorts.c_ptr(), qnames.c_ptr(), unbound_tail_pre_quant); + 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", @@ -783,7 +783,7 @@ namespace datalog { SASSERT(tail.size()==tail_neg.size()); rule_ref old_r = r; - r = mk(head, tail.size(), tail.c_ptr(), tail_neg.c_ptr(), old_r->name()); + r = mk(head, tail.size(), tail.data(), tail_neg.data(), old_r->name()); r->set_accounting_parent_object(m_ctx, old_r); } @@ -821,7 +821,7 @@ namespace datalog { new_tail.push_back(to_app(tmp)); tail_neg.push_back(r->is_neg_tail(i)); } - r = mk(new_head.get(), new_tail.size(), new_tail.c_ptr(), tail_neg.c_ptr(), r->name(), false); + r = mk(new_head.get(), new_tail.size(), new_tail.data(), tail_neg.data(), r->name(), false); // keep old variable indices around so we can compose with substitutions. // r->norm_vars(*this); @@ -1000,14 +1000,14 @@ namespace datalog { var_subst vs(m, false); - app_ref new_head_a = rm.ensure_app(vs(m_head, subst_vals.size(), subst_vals.c_ptr())); + app_ref new_head_a = rm.ensure_app(vs(m_head, subst_vals.size(), subst_vals.data())); m.inc_ref(new_head_a); m.dec_ref(m_head); m_head = new_head_a; for (unsigned i = 0; i < m_tail_size; i++) { app * old_tail = get_tail(i); - app_ref new_tail_a = rm.ensure_app(vs(old_tail, subst_vals.size(), subst_vals.c_ptr())); + app_ref new_tail_a = rm.ensure_app(vs(old_tail, subst_vals.size(), subst_vals.data())); bool sign = is_neg_tail(i); m.inc_ref(new_tail_a); m.dec_ref(old_tail); diff --git a/src/muz/base/dl_rule_set.cpp b/src/muz/base/dl_rule_set.cpp index e8234120a..63fac2460 100644 --- a/src/muz/base/dl_rule_set.cpp +++ b/src/muz/base/dl_rule_set.cpp @@ -391,8 +391,8 @@ namespace datalog { \brief Return true if the negation is indeed stratified. */ bool rule_set::stratified_negation() { - ptr_vector::const_iterator it = m_rules.c_ptr(); - ptr_vector::const_iterator end = m_rules.c_ptr() + m_rules.size(); + ptr_vector::const_iterator it = m_rules.data(); + ptr_vector::const_iterator end = m_rules.data() + m_rules.size(); for (; it != end; it++) { rule * r = *it; func_decl * head_decl = r->get_decl(); diff --git a/src/muz/base/dl_rule_set.h b/src/muz/base/dl_rule_set.h index 7c71ff946..4afacacf0 100644 --- a/src/muz/base/dl_rule_set.h +++ b/src/muz/base/dl_rule_set.h @@ -269,8 +269,8 @@ namespace datalog { void display_deps(std::ostream & out) const; typedef rule * const * iterator; - iterator begin() const { return m_rules.c_ptr(); } - iterator end() const { return m_rules.c_ptr()+m_rules.size(); } + iterator begin() const { return m_rules.data(); } + iterator end() const { return m_rules.data()+m_rules.size(); } decl2rules::iterator begin_grouped_rules() const { return m_head2rules.begin(); } decl2rules::iterator end_grouped_rules() const { return m_head2rules.end(); } diff --git a/src/muz/base/dl_util.cpp b/src/muz/base/dl_util.cpp index aa7414c0d..5114cb1c3 100644 --- a/src/muz/base/dl_util.cpp +++ b/src/muz/base/dl_util.cpp @@ -107,7 +107,7 @@ namespace datalog { new_args.push_back(new_var); } } - new_pred = m.mk_app(pred->get_decl(), new_args.size(), new_args.c_ptr()); + new_pred = m.mk_app(pred->get_decl(), new_args.size(), new_args.data()); } void apply_subst(expr_ref_vector& tgt, expr_ref_vector const& sub) { @@ -116,7 +116,7 @@ namespace datalog { expr_ref tmp(m); for (unsigned i = 0; i < tgt.size(); ++i) { if (tgt[i].get()) { - tgt[i] = vs(tgt[i].get(), sub.size(), sub.c_ptr()); + tgt[i] = vs(tgt[i].get(), sub.size(), sub.data()); } else { tgt[i] = sub[i]; @@ -304,7 +304,7 @@ namespace datalog { tout << mk_pp(body[i].get(), m) << "\n"; }); - mc->insert(r.get_head(), body.size(), body.c_ptr()); + mc->insert(r.get_head(), body.size(), body.data()); } } @@ -343,7 +343,7 @@ namespace datalog { tout << "\n"; ); - pr = m.mk_hyper_resolve(2, premises.c_ptr(), fml3, positions, substs); + pr = m.mk_hyper_resolve(2, premises.data(), fml3, positions, substs); pc->insert(pr); } @@ -381,7 +381,7 @@ namespace datalog { tout << "\n"; ); - pr = m.mk_hyper_resolve(2, premises.c_ptr(), fml, positions, substs); + pr = m.mk_hyper_resolve(2, premises.data(), fml, positions, substs); res.set_proof(m, pr); } diff --git a/src/muz/base/dl_util.h b/src/muz/base/dl_util.h index ce5b37a29..1b69a2733 100644 --- a/src/muz/base/dl_util.h +++ b/src/muz/base/dl_util.h @@ -159,11 +159,11 @@ namespace datalog { } const unsigned * get_cols1() const { - return m_args1.c_ptr(); + return m_args1.data(); } const unsigned * get_cols2() const { - return m_args2.c_ptr(); + return m_args2.data(); } bool empty() const { @@ -290,7 +290,7 @@ namespace datalog { template void project_out_vector_columns(T & container, const unsigned_vector & removed_cols) { - project_out_vector_columns(container, removed_cols.size(), removed_cols.c_ptr()); + project_out_vector_columns(container, removed_cols.size(), removed_cols.data()); } @@ -321,7 +321,7 @@ namespace datalog { if (cycle_len<2) { return; } - typename T::data aux = container[permutation_cycle[0]]; + auto aux = container[permutation_cycle[0]]; for (unsigned i=1; i void permutate_by_cycle(T & container, const unsigned_vector & permutation_cycle) { - permutate_by_cycle(container, permutation_cycle.size(), permutation_cycle.c_ptr()); + permutate_by_cycle(container, permutation_cycle.size(), permutation_cycle.data()); } @@ -387,9 +387,9 @@ namespace datalog { if (c1.size()!=c2.size()) { return false; } - typename T::data * it1 = c1.c_ptr(); - typename T::data * end1 = c1.c_ptr()+c1.size(); - typename U::data * it2 = c2.c_ptr(); + auto * it1 = c1.data(); + auto * end1 = c1.data()+c1.size(); + auto * it2 = c2.data(); for (; it1!=end1; ++it1, ++it2) { if (*it1!=*it2) { return false; @@ -420,7 +420,7 @@ namespace datalog { template struct svector_hash_proc { - unsigned operator()(const svector & cont) const { + unsigned operator()(const svector & cont) const { return svector_hash()(cont); } }; @@ -477,7 +477,7 @@ namespace datalog { is not preserved. */ template - bool remove_from_vector(T & v, const typename T::data & el) { + bool remove_from_vector(T & v, const typename T::data_t & el) { unsigned sz = v.size(); for (unsigned i=0; iget_arg(1)); - p2 = m.mk_oeq_congruence(e2, fml, defs.size(), defs.c_ptr()); + p2 = m.mk_oeq_congruence(e2, fml, defs.size(), defs.data()); p3 = mk_transitivity(p1, p2); defs.reset(); return p3; @@ -507,7 +507,7 @@ private: if (m_sorts.empty()) { return expr_ref(e, m); } - return expr_ref(m.mk_forall(m_sorts.size(), m_sorts.c_ptr(), m_names.c_ptr(), e), m); + return expr_ref(m.mk_forall(m_sorts.size(), m_sorts.data(), m_names.data(), e), m); } }; diff --git a/src/muz/bmc/dl_bmc_engine.cpp b/src/muz/bmc/dl_bmc_engine.cpp index dd828f756..913e35f36 100644 --- a/src/muz/bmc/dl_bmc_engine.cpp +++ b/src/muz/bmc/dl_bmc_engine.cpp @@ -110,31 +110,31 @@ namespace datalog { // apply substitution to body. var_subst vs(m, false); for (unsigned k = 0; k < p->get_arity(); ++k) { - trm = vs(r.get_head()->get_arg(k), sub.size(), sub.c_ptr()); + trm = vs(r.get_head()->get_arg(k), sub.size(), sub.data()); conjs.push_back(m.mk_eq(trm, mk_q_arg(p, k, true))); } for (unsigned j = 0; j < r.get_uninterpreted_tail_size(); ++j) { func_decl* q = r.get_decl(j); for (unsigned k = 0; k < q->get_arity(); ++k) { - trm = vs(r.get_tail(j)->get_arg(k), sub.size(), sub.c_ptr()); + trm = vs(r.get_tail(j)->get_arg(k), sub.size(), sub.data()); conjs.push_back(m.mk_eq(trm, mk_q_arg(q, k, false))); } func_decl_ref qr = mk_q_func_decl(q); conjs.push_back(m.mk_app(qr, m_bv.mk_bv_sub(var, mk_q_one()))); } for (unsigned j = r.get_uninterpreted_tail_size(); j < r.get_tail_size(); ++j) { - trm = vs(r.get_tail(j), sub.size(), sub.c_ptr()); + trm = vs(r.get_tail(j), sub.size(), sub.data()); conjs.push_back(trm); } if (r.get_uninterpreted_tail_size() > 0) { conjs.push_back(m_bv.mk_ule(mk_q_one(), var)); } - bool_rewriter(m).mk_and(conjs.size(), conjs.c_ptr(), rule_body); + bool_rewriter(m).mk_and(conjs.size(), conjs.data(), rule_body); trm = m.mk_implies(rule_i, rule_body); trm = m.mk_forall(1, index_sorts, &tick, trm, 1); b.assert_expr(trm); } - bool_rewriter(m).mk_or(rules.size(), rules.c_ptr(), trm); + bool_rewriter(m).mk_or(rules.size(), rules.data(), trm); trm = m.mk_implies(pred, trm); trm = m.mk_forall(1, index_sorts, &tick, trm, 1); SASSERT(is_well_sorted(m, trm)); @@ -302,7 +302,7 @@ namespace datalog { rm.to_formula(*r, fml); r2 = r; - rm.substitute(r2, sub.size(), sub.c_ptr()); + rm.substitute(r2, sub.size(), sub.data()); proof_ref p(m); if (r0) { VERIFY(unifier.unify_rules(*r0.get(), 0, *r2.get())); @@ -399,7 +399,7 @@ namespace datalog { symbol nm(_name.str()); vars.push_back(m.mk_const(nm, level_p->get_domain(i))); } - return expr_ref(m.mk_app(level_p, vars.size(), vars.c_ptr()), m); + return expr_ref(m.mk_app(level_p, vars.size(), vars.data()), m); } void compile(rule_set const& rules, expr_ref_vector& result, unsigned level) { @@ -441,11 +441,11 @@ namespace datalog { ++num_vars; } } - head = m.mk_app(rule_i, args.size(), args.c_ptr()); + head = m.mk_app(rule_i, args.size(), args.data()); for (unsigned i = 0; i < r.get_tail_size(); ++i) { conjs.push_back(r.get_tail(i)); } - br.mk_and(conjs.size(), conjs.c_ptr(), body); + br.mk_and(conjs.size(), conjs.data(), body); replace_by_level_predicates(level, body); body = skolemize_vars(r, args, rule_vars, body); @@ -453,7 +453,7 @@ namespace datalog { body = bind_vars(body, head); result.push_back(body); } - br.mk_or(rules.size(), rules.c_ptr(), body); + br.mk_or(rules.size(), rules.data(), body); head = apply_vars(level_pred); body = m.mk_implies(head, body); body = bind_vars(body, head); @@ -545,12 +545,12 @@ namespace datalog { for (unsigned j = 0; j < sz; ++j) { func_decl* head_j = r->get_decl(j); app* body_j = r->get_tail(j); - prop_body = vs(body_j, sub.size(), sub.c_ptr()); + prop_body = vs(body_j, sub.size(), sub.data()); prs.push_back(get_proof(md, head_j, to_app(prop_body), level-1)); positions.push_back(std::make_pair(j+1,0)); substs.push_back(expr_ref_vector(m)); } - pr = m.mk_hyper_resolve(sz+1, prs.c_ptr(), prop, positions, substs); + pr = m.mk_hyper_resolve(sz+1, prs.data(), prop, positions, substs); return pr; } @@ -585,7 +585,7 @@ namespace datalog { for (unsigned i = 0; i < p->get_arity(); ++i) { vars.push_back(m.mk_var(i, p->get_domain(i))); } - return expr_ref(m.mk_app(p, vars.size(), vars.c_ptr()), m); + return expr_ref(m.mk_app(p, vars.size(), vars.data()), m); } // remove variables from dst that are in src. @@ -609,7 +609,7 @@ namespace datalog { for (unsigned i = 0; i < vars.size(); ++i) { if (vars[i]) { func_decl_ref f = mk_body_func(r, arg_sorts, i, vars[i]); - binding.push_back(m.mk_app(f, args.size(), args.c_ptr())); + binding.push_back(m.mk_app(f, args.size(), args.data())); } else { binding.push_back(nullptr); @@ -621,14 +621,14 @@ namespace datalog { expr_ref skolemize_vars(rule& r, expr_ref_vector const& args, ptr_vector const& vars, expr* e) { expr_ref_vector binding = mk_skolem_binding(r, vars, args); var_subst vs(m, false); - return vs(e, binding.size(), binding.c_ptr()); + return vs(e, binding.size(), binding.data()); } func_decl_ref mk_body_func(rule& r, ptr_vector const& args, unsigned index, sort* s) { std::stringstream _name; _name << r.get_decl()->get_name() << "@" << index; symbol name(_name.str()); - func_decl* f = m.mk_func_decl(name, args.size(), args.c_ptr(), s); + func_decl* f = m.mk_func_decl(name, args.size(), args.data(), s); return func_decl_ref(f, m); } @@ -654,11 +654,11 @@ namespace datalog { return expr_ref(e, m); } var_subst vs(m, false); - tmp = vs(e, binding.size(), binding.c_ptr()); - head = vs(pat, binding.size(), binding.c_ptr()); + tmp = vs(e, binding.size(), binding.data()); + head = vs(pat, binding.size(), binding.data()); patterns.push_back(m.mk_pattern(to_app(head))); symbol qid, skid; - return expr_ref(m.mk_forall(sorts.size(), sorts.c_ptr(), names.c_ptr(), tmp, 1, qid, skid, 1, patterns.c_ptr()), m); + return expr_ref(m.mk_forall(sorts.size(), sorts.data(), names.data(), tmp, 1, qid, skid, 1, patterns.data()), m); } public: @@ -892,14 +892,14 @@ namespace datalog { for (unsigned j = 0; j < arity; ++j) { vars.push_back(m.mk_var(arity-j,cnstr->get_domain(j))); } - trace_arg = m.mk_app(cnstr, vars.size(), vars.c_ptr()); + trace_arg = m.mk_app(cnstr, vars.size(), vars.data()); mk_subst(r, path_var, to_app(trace_arg), sub); // apply substitution to body. var_subst vs(m, false); for (unsigned k = 0; k < p->get_arity(); ++k) { - tmp = vs(r.get_head()->get_arg(k), sub.size(), sub.c_ptr()); + tmp = vs(r.get_head()->get_arg(k), sub.size(), sub.data()); expr_ref arg = mk_arg(p, k, path_var, trace_arg); conjs.push_back(m.mk_eq(tmp, arg)); } @@ -913,7 +913,7 @@ namespace datalog { } func_decl* q = r.get_decl(j); for (unsigned k = 0; k < q->get_arity(); ++k) { - tmp = vs(r.get_tail(j)->get_arg(k), sub.size(), sub.c_ptr()); + tmp = vs(r.get_tail(j)->get_arg(k), sub.size(), sub.data()); expr_ref arg = mk_arg(q, k, path_arg, vars[j].get()); conjs.push_back(m.mk_eq(tmp, arg)); } @@ -921,10 +921,10 @@ namespace datalog { conjs.push_back(m.mk_app(q_pred, vars[j].get(), path_arg)); } for (unsigned j = r.get_uninterpreted_tail_size(); j < r.get_tail_size(); ++j) { - tmp = vs(r.get_tail(j), sub.size(), sub.c_ptr()); + tmp = vs(r.get_tail(j), sub.size(), sub.data()); conjs.push_back(tmp); } - bool_rewriter(m).mk_and(conjs.size(), conjs.c_ptr(), rule_body); + bool_rewriter(m).mk_and(conjs.size(), conjs.data(), rule_body); ptr_vector q_sorts; vector names; for (unsigned i = 0; i < vars.size(); ++i) { @@ -941,7 +941,7 @@ namespace datalog { patterns.reset(); patterns.push_back(m.mk_pattern(to_app(tmp))); fml = m.mk_implies(tmp, rule_body); - fml = m.mk_forall(vars.size(), q_sorts.c_ptr(), names.c_ptr(), fml, 1, qid, skid, 1, patterns.c_ptr()); + fml = m.mk_forall(vars.size(), q_sorts.data(), names.data(), fml, 1, qid, skid, 1, patterns.data()); b.assert_expr(fml); } } @@ -980,16 +980,16 @@ namespace datalog { symbol name(_name.str()); _name << '?'; symbol is_name(_name.str()); - cnstrs.push_back(mk_constructor_decl(name, is_name, accs.size(), accs.c_ptr())); + cnstrs.push_back(mk_constructor_decl(name, is_name, accs.size(), accs.data())); } - dts.push_back(mk_datatype_decl(dtu, pred->get_name(), 0, nullptr, cnstrs.size(), cnstrs.c_ptr())); + dts.push_back(mk_datatype_decl(dtu, pred->get_name(), 0, nullptr, cnstrs.size(), cnstrs.data())); } sort_ref_vector new_sorts(m); family_id dfid = m.mk_family_id("datatype"); datatype_decl_plugin* dtp = static_cast(m.get_plugin(dfid)); - VERIFY (dtp->mk_datatypes(dts.size(), dts.c_ptr(), 0, nullptr, new_sorts)); + VERIFY (dtp->mk_datatypes(dts.size(), dts.data(), 0, nullptr, new_sorts)); it = b.m_rules.begin_grouped_rules(); for (unsigned i = 0; it != end; ++it, ++i) { @@ -1000,7 +1000,7 @@ namespace datalog { if (!new_sorts.empty()) { TRACE("bmc", dtu.display_datatype(new_sorts[0].get(), tout);); } - del_datatype_decls(dts.size(), dts.c_ptr()); + del_datatype_decls(dts.size(), dts.data()); // declare path data-type. { @@ -1028,10 +1028,10 @@ namespace datalog { ptr_vector accs; type_ref tr(0); accs.push_back(mk_accessor_decl(m, name, tr)); - cnstrs.push_back(mk_constructor_decl(name, is_name, accs.size(), accs.c_ptr())); + cnstrs.push_back(mk_constructor_decl(name, is_name, accs.size(), accs.data())); } - dts.push_back(mk_datatype_decl(dtu, symbol("Path"), 0, nullptr, cnstrs.size(), cnstrs.c_ptr())); - VERIFY (dtp->mk_datatypes(dts.size(), dts.c_ptr(), 0, nullptr, new_sorts)); + dts.push_back(mk_datatype_decl(dtu, symbol("Path"), 0, nullptr, cnstrs.size(), cnstrs.data())); + VERIFY (dtp->mk_datatypes(dts.size(), dts.data(), 0, nullptr, new_sorts)); m_path_sort = new_sorts[0].get(); } } @@ -1069,7 +1069,7 @@ namespace datalog { } rule_ref rl(b.m_ctx.get_rule_manager()); rl = rules[i]; - b.m_ctx.get_rule_manager().substitute(rl, sub.size(), sub.c_ptr()); + b.m_ctx.get_rule_manager().substitute(rl, sub.size(), sub.data()); substs.push_back(sub); @@ -1086,7 +1086,7 @@ namespace datalog { substs.push_back(expr_ref_vector(m)); } head = rl->get_head(); - pr = m.mk_hyper_resolve(sz+1, prs.c_ptr(), head, positions, substs); + pr = m.mk_hyper_resolve(sz+1, prs.data(), head, positions, substs); b.m_rule_trace.push_back(rl.get()); return pr; } @@ -1235,7 +1235,7 @@ namespace datalog { rm.to_formula(*r, fml); r2 = r; - rm.substitute(r2, sub.size(), sub.c_ptr()); + rm.substitute(r2, sub.size(), sub.data()); proof_ref p(m); { scoped_proof _sp(m); @@ -1405,27 +1405,27 @@ namespace datalog { // apply substitution to body. var_subst vs(m, false); for (unsigned k = 0; k < p->get_arity(); ++k) { - tmp = vs(r.get_head()->get_arg(k), sub.size(), sub.c_ptr()); + tmp = vs(r.get_head()->get_arg(k), sub.size(), sub.data()); conjs.push_back(m.mk_eq(tmp, mk_level_arg(p, k, level))); } for (unsigned j = 0; j < r.get_uninterpreted_tail_size(); ++j) { SASSERT(level > 0); func_decl* q = r.get_decl(j); for (unsigned k = 0; k < q->get_arity(); ++k) { - tmp = vs(r.get_tail(j)->get_arg(k), sub.size(), sub.c_ptr()); + tmp = vs(r.get_tail(j)->get_arg(k), sub.size(), sub.data()); conjs.push_back(m.mk_eq(tmp, mk_level_arg(q, k, level-1))); } conjs.push_back(mk_level_predicate(q, level-1)); } for (unsigned j = r.get_uninterpreted_tail_size(); j < r.get_tail_size(); ++j) { - tmp = vs(r.get_tail(j), sub.size(), sub.c_ptr()); + tmp = vs(r.get_tail(j), sub.size(), sub.data()); conjs.push_back(tmp); } - bool_rewriter(m).mk_and(conjs.size(), conjs.c_ptr(), rule_body); + bool_rewriter(m).mk_and(conjs.size(), conjs.data(), rule_body); rule_body = m.mk_implies(rule_i, rule_body); b.assert_expr(rule_body); } - bool_rewriter(m).mk_or(rules.size(), rules.c_ptr(), tmp); + bool_rewriter(m).mk_or(rules.size(), rules.data(), tmp); tmp = m.mk_implies(level_pred, tmp); b.assert_expr(tmp); } diff --git a/src/muz/clp/clp_context.cpp b/src/muz/clp/clp_context.cpp index 61d1fd418..89ae71e36 100644 --- a/src/muz/clp/clp_context.cpp +++ b/src/muz/clp/clp_context.cpp @@ -120,7 +120,7 @@ namespace datalog { m_ground[i] = m.mk_fresh_const("c", fv[i]); } } - e = m_var_subst(e, m_ground.size(), m_ground.c_ptr()); + e = m_var_subst(e, m_ground.size(), m_ground.data()); } static bool rule_sort_fn(const rule *r1, const rule *r2) { diff --git a/src/muz/ddnf/ddnf.cpp b/src/muz/ddnf/ddnf.cpp index 4763fce7e..ad1994865 100644 --- a/src/muz/ddnf/ddnf.cpp +++ b/src/muz/ddnf/ddnf.cpp @@ -679,7 +679,7 @@ namespace datalog { for (; dit != dend; ++dit) { heads.push_back(dit->m_key); } - return m_inner_ctx.rel_query(heads.size(), heads.c_ptr()); + return m_inner_ctx.rel_query(heads.size(), heads.data()); } bool compile_rules1(rule_set const& rules, rule_set& new_rules) { @@ -709,7 +709,7 @@ namespace datalog { compile_expr(r.get_tail(i), tmp); body.push_back(to_app(tmp)); } - rule* r_new = rm.mk(head, body.size(), body.c_ptr(), nullptr, r.name(), false); + rule* r_new = rm.mk(head, body.size(), body.data(), nullptr, r.name(), false); new_rules.add_rule(r_new); IF_VERBOSE(20, r_new->display(m_ctx, verbose_stream());); if (old_rules.is_output_predicate(r.get_decl())) { @@ -726,7 +726,7 @@ namespace datalog { domain.push_back(compile_sort(p->get_arg(i)->get_sort())); } func_decl_ref fn(m); - fn = m.mk_func_decl(d->get_name(), domain.size(), domain.c_ptr(), m.mk_bool_sort()); + fn = m.mk_func_decl(d->get_name(), domain.size(), domain.data(), m.mk_bool_sort()); m_ctx.register_predicate(fn, false); expr_ref_vector args(m); expr_ref tmp(m); @@ -734,7 +734,7 @@ namespace datalog { compile_expr(p->get_arg(i), tmp); args.push_back(tmp); } - result = m.mk_app(fn, args.size(), args.c_ptr()); + result = m.mk_app(fn, args.size(), args.data()); } void insert_cache(expr* e, expr* r) { @@ -804,7 +804,7 @@ namespace datalog { compile_expr(a->get_arg(i), tmp); args.push_back(tmp); } - result = m.mk_app(a->get_decl(), args.size(), args.c_ptr()); + result = m.mk_app(a->get_decl(), args.size(), args.data()); insert_cache(e, result); return; } @@ -863,7 +863,7 @@ namespace datalog { result = eqs[0].get(); break; default: - result = m.mk_or(eqs.size(), eqs.c_ptr()); + result = m.mk_or(eqs.size(), eqs.data()); break; } } diff --git a/src/muz/fp/datalog_parser.cpp b/src/muz/fp/datalog_parser.cpp index 8ffe59389..899ec497c 100644 --- a/src/muz/fp/datalog_parser.cpp +++ b/src/muz/fp/datalog_parser.cpp @@ -729,7 +729,7 @@ protected: while (tok != TK_ERROR && tok != TK_EOS) { if (tok == TK_PERIOD) { SASSERT(body.size()==polarity_vect.size()); - add_rule(head, body.size(), body.c_ptr(), polarity_vect.c_ptr()); + add_rule(head, body.size(), body.data(), polarity_vect.data()); return m_lexer->next_token(); } char const* td = m_lexer->get_token_data(); @@ -852,7 +852,7 @@ protected: for (unsigned i = 0; i < arity; ++i) { domain.push_back(args[i]->get_sort()); } - f = m.mk_func_decl(s, domain.size(), domain.c_ptr(), m.mk_bool_sort()); + f = m.mk_func_decl(s, domain.size(), domain.data(), m.mk_bool_sort()); m_context.register_predicate(f, true); @@ -870,7 +870,7 @@ protected: } SASSERT(args.size()==f->get_arity()); //TODO: we do not need to do the mk_app if we're in a declaration - pred = m.mk_app(f, args.size(), args.c_ptr()); + pred = m.mk_app(f, args.size(), args.data()); return tok; } diff --git a/src/muz/fp/dl_cmds.cpp b/src/muz/fp/dl_cmds.cpp index 7500674ad..62455b625 100644 --- a/src/muz/fp/dl_cmds.cpp +++ b/src/muz/fp/dl_cmds.cpp @@ -127,7 +127,7 @@ struct dl_context { for (unsigned i = 0; i < q->get_arity(); ++i) { args.push_back(m.mk_var(i, q->get_domain(i))); } - qr = m.mk_app(q, args.size(), args.c_ptr()); + qr = m.mk_app(q, args.size(), args.data()); qr = m_context->bind_vars(qr, false); m_collected_cmds->m_queries.push_back(qr); m_trail.push(push_back_vector(m_collected_cmds->m_queries)); @@ -427,9 +427,9 @@ public: ast_manager& m = ctx.m(); func_decl_ref pred( - m.mk_func_decl(m_rel_name, m_domain.size(), m_domain.c_ptr(), m.mk_bool_sort()), m); + m.mk_func_decl(m_rel_name, m_domain.size(), m_domain.data(), m.mk_bool_sort()), m); ctx.insert(pred); - m_dl_ctx->register_predicate(pred, m_kinds.size(), m_kinds.c_ptr()); + m_dl_ctx->register_predicate(pred, m_kinds.size(), m_kinds.data()); } }; diff --git a/src/muz/fp/horn_tactic.cpp b/src/muz/fp/horn_tactic.cpp index b7423c106..591e57944 100644 --- a/src/muz/fp/horn_tactic.cpp +++ b/src/muz/fp/horn_tactic.cpp @@ -160,13 +160,13 @@ class horn_tactic : public tactic { } if (head) { if (!is_implication(f)) { - f = m.mk_and(body.size(), body.c_ptr()); + f = m.mk_and(body.size(), body.data()); f = m.mk_implies(f, head); } return IS_RULE; } else { - f = m.mk_and(body.size(), body.c_ptr()); + f = m.mk_and(body.size(), body.data()); return IS_QUERY; } } @@ -308,7 +308,7 @@ class horn_tactic : public tactic { for (unsigned i = 0; i < m_free_vars.size(); ++i) { names.push_back(symbol(m_free_vars.size() - i - 1)); } - f = m.mk_forall(m_free_vars.size(), m_free_vars.c_ptr(), names.c_ptr(), f); + f = m.mk_forall(m_free_vars.size(), m_free_vars.data(), names.data(), f); } } diff --git a/src/muz/rel/aig_exporter.cpp b/src/muz/rel/aig_exporter.cpp index c38964be0..d22f1761b 100644 --- a/src/muz/rel/aig_exporter.cpp +++ b/src/muz/rel/aig_exporter.cpp @@ -133,7 +133,7 @@ namespace datalog { exprs.push_back(e); } - transition_function.push_back(m.mk_and(exprs.size(), exprs.c_ptr())); + transition_function.push_back(m.mk_and(exprs.size(), exprs.data())); } } @@ -148,11 +148,11 @@ namespace datalog { exprs.push_back(m.mk_eq(get_latch_var(i, m_latch_varsp), I->second[i])); } - transition_function.push_back(m.mk_and(exprs.size(), exprs.c_ptr())); + transition_function.push_back(m.mk_and(exprs.size(), exprs.data())); } } - expr *tr = m.mk_or(transition_function.size(), transition_function.c_ptr()); + expr *tr = m.mk_or(transition_function.size(), transition_function.data()); aig_ref aig = m_aigm.mk_aig(tr); expr_ref aig_expr(m); m_aigm.to_formula(aig, aig_expr); @@ -194,10 +194,10 @@ namespace datalog { for (func_decl_set::iterator I = preds.begin(), E = preds.end(); I != E; ++I) { exprs.reset(); assert_pred_id(*I, m_ruleid_var_set, exprs); - output.push_back(m.mk_and(exprs.size(), exprs.c_ptr())); + output.push_back(m.mk_and(exprs.size(), exprs.data())); } - expr *out = m.mk_or(output.size(), output.c_ptr()); + expr *out = m.mk_or(output.size(), output.data()); aig = m_aigm.mk_aig(out); m_aigm.to_formula(aig, aig_expr); output_id = expr_to_aig(aig_expr); diff --git a/src/muz/rel/check_relation.cpp b/src/muz/rel/check_relation.cpp index d5b5d42f6..ff2210610 100644 --- a/src/muz/rel/check_relation.cpp +++ b/src/muz/rel/check_relation.cpp @@ -39,7 +39,7 @@ namespace datalog { for (unsigned i = 0; i < sig.size(); ++i) { conjs.push_back(m.mk_eq(m.mk_var(i, sig[i]), f[i])); } - return expr_ref(mk_and(m, conjs.size(), conjs.c_ptr()), m); + return expr_ref(mk_and(m, conjs.size(), conjs.data()), m); } expr_ref check_relation::ground(expr* fml) const { @@ -59,7 +59,7 @@ namespace datalog { for (unsigned i = 0; i < sig.size(); ++i) { vars.push_back(m.mk_const(symbol(i), sig[i])); } - return sub(fml, vars.size(), vars.c_ptr()); + return sub(fml, vars.size(), vars.data()); } void check_relation::add_fact(const relation_fact & f) { @@ -290,9 +290,9 @@ namespace datalog { } } var_subst sub(m, false); - fml1 = sub(fml, vars.size(), vars.c_ptr()); + fml1 = sub(fml, vars.size(), vars.data()); bound.reverse(); - fml1 = m.mk_exists(bound.size(), bound.c_ptr(), names.c_ptr(), fml1); + fml1 = m.mk_exists(bound.size(), bound.data(), names.data(), fml1); return fml1; } @@ -331,7 +331,7 @@ namespace datalog { for (unsigned i = 0; i < sig2.size(); ++i) { vars.push_back(m.mk_var(i + sig1.size(), sig2[i])); } - fml2 = sub(fml2, vars.size(), vars.c_ptr()); + fml2 = sub(fml2, vars.size(), vars.data()); fml1 = m.mk_and(fml1, fml2); for (unsigned i = 0; i < cols1.size(); ++i) { unsigned v1 = cols1[i]; @@ -370,14 +370,14 @@ namespace datalog { expr_ref fml1(m), fml2(m); src.to_formula(fml1); dst.to_formula(fml2); - fml1 = subst(fml1, sub.size(), sub.c_ptr()); + fml1 = subst(fml1, sub.size(), sub.data()); expr_ref_vector vars(m); for (unsigned i = 0; i < sig2.size(); ++i) { vars.push_back(m.mk_const(symbol(i), sig2[i])); } - fml1 = subst(fml1, vars.size(), vars.c_ptr()); - fml2 = subst(fml2, vars.size(), vars.c_ptr()); + fml1 = subst(fml1, vars.size(), vars.data()); + fml2 = subst(fml2, vars.size(), vars.data()); check_equiv("permutation", fml1, fml2); } @@ -403,8 +403,8 @@ namespace datalog { strm << 'x' << i; vars.push_back(m.mk_const(symbol(strm.str()), sig[i])); } - fml1 = sub(fml1, vars.size(), vars.c_ptr()); - fml2 = sub(fml2, vars.size(), vars.c_ptr()); + fml1 = sub(fml1, vars.size(), vars.data()); + fml2 = sub(fml2, vars.size(), vars.data()); check_equiv("filter", fml1, fml2); } @@ -451,8 +451,8 @@ namespace datalog { strm << 'x' << i; vars.push_back(m.mk_const(symbol(strm.str()), sig[i])); } - fml1 = sub(fml1, vars.size(), vars.c_ptr()); - fml2 = sub(fml2, vars.size(), vars.c_ptr()); + fml1 = sub(fml1, vars.size(), vars.data()); + fml2 = sub(fml2, vars.size(), vars.data()); check_equiv("union", fml1, fml2); @@ -464,13 +464,13 @@ namespace datalog { // dst \ dst0 == delta & dst & \ dst0 expr_ref fml4(m), fml5(m); fml4 = m.mk_and(fml2, m.mk_not(dst0)); - fml4 = sub(fml4, vars.size(), vars.c_ptr()); - d = sub(d, vars.size(), vars.c_ptr()); + fml4 = sub(fml4, vars.size(), vars.data()); + d = sub(d, vars.size(), vars.data()); check_contains("union_delta low", d, fml4); // // delta >= delta0 // - d0 = sub(delta0, vars.size(), vars.c_ptr()); + d0 = sub(delta0, vars.size(), vars.data()); check_contains("union delta0", d, d0); // @@ -478,8 +478,8 @@ namespace datalog { // fml4 = m.mk_or(fml2, delta0); fml5 = m.mk_or(d, dst0); - fml4 = sub(fml4, vars.size(), vars.c_ptr()); - fml5 = sub(fml5, vars.size(), vars.c_ptr()); + fml4 = sub(fml4, vars.size(), vars.data()); + fml5 = sub(fml5, vars.size(), vars.data()); check_equiv("union no overflow", fml4, fml5); } } @@ -541,7 +541,7 @@ namespace datalog { unsigned c2 = m_cols[i]; conds.push_back(m.mk_eq(m.mk_var(c1, sig[c1]), m.mk_var(c2, sig[c2]))); } - cond = mk_and(m, conds.size(), conds.c_ptr()); + cond = mk_and(m, conds.size(), conds.data()); r.consistent_formula(); (*m_filter)(r.rb()); p.verify_filter(r.m_fml, r.rb(), cond); @@ -733,14 +733,14 @@ namespace datalog { v2 = m.mk_var(c2, sig2[c2]); eqs.push_back(m.mk_eq(v1, v2)); } - negf = mk_and(m, eqs.size(), eqs.c_ptr()); - ptr_vector rev_sig2(sig2.size(), sig2.c_ptr()); + negf = mk_and(m, eqs.size(), eqs.data()); + ptr_vector rev_sig2(sig2.size(), sig2.data()); rev_sig2.reverse(); svector names; for (unsigned i = 0; i < sig2.size(); ++i) { names.push_back(symbol(i)); } - negf = m.mk_exists(rev_sig2.size(), rev_sig2.c_ptr(), names.c_ptr(), negf); + negf = m.mk_exists(rev_sig2.size(), rev_sig2.data(), names.data(), negf); negf = m.mk_and(dst0, m.mk_not(negf)); negf = ground(dst, negf); dstf = ground(dst, dstf); diff --git a/src/muz/rel/dl_base.cpp b/src/muz/rel/dl_base.cpp index 8dd7b9d26..2377d6e09 100644 --- a/src/muz/rel/dl_base.cpp +++ b/src/muz/rel/dl_base.cpp @@ -257,7 +257,7 @@ namespace datalog { k.get_fact(row); to_remove.push_back(row); } - remove_facts(to_remove.size(), to_remove.c_ptr()); + remove_facts(to_remove.size(), to_remove.data()); } bool table_base::contains_fact(const table_fact & f) const { @@ -456,9 +456,9 @@ namespace datalog { for (unsigned i = 0; i < fact.size(); ++i) { conjs.push_back(m.mk_eq(m.mk_var(i, sig[i]), util.mk_numeral(fact[i], sig[i]))); } - brw.mk_and(conjs.size(), conjs.c_ptr(), fml); + brw.mk_and(conjs.size(), conjs.data(), fml); disjs.push_back(fml); } - brw.mk_or(disjs.size(), disjs.c_ptr(), fml); + brw.mk_or(disjs.size(), disjs.data(), fml); } } diff --git a/src/muz/rel/dl_base.h b/src/muz/rel/dl_base.h index cf5b5c1e3..147fc26f1 100644 --- a/src/muz/rel/dl_base.h +++ b/src/muz/rel/dl_base.h @@ -98,7 +98,7 @@ namespace datalog { if (n!=o.size()) { return false; } - return memcmp(this->c_ptr(), o.c_ptr(), n*sizeof(sort))==0; + return memcmp(this->data(), o.data(), n*sizeof(sort))==0; /*for (unsigned i=0; i(p.mk_full(nullptr, get_result_signature())); - result->mk_join(r1, r2, m_cols1.size(), m_cols1.c_ptr(), m_cols2.c_ptr()); + result->mk_join(r1, r2, m_cols1.size(), m_cols1.data(), m_cols2.data()); return result; } }; @@ -108,7 +108,7 @@ namespace datalog { bound_relation const& r = get(_r); bound_relation_plugin& p = r.get_plugin(); bound_relation* result = get(p.mk_full(nullptr, get_result_signature())); - result->mk_project(r, m_removed_cols.size(), m_removed_cols.c_ptr()); + result->mk_project(r, m_removed_cols.size(), m_removed_cols.data()); return result; } }; @@ -128,7 +128,7 @@ namespace datalog { bound_relation const& r = get(_r); bound_relation_plugin& p = r.get_plugin(); bound_relation* result = get(p.mk_full(nullptr, get_result_signature())); - result->mk_rename(r, m_cycle.size(), m_cycle.c_ptr()); + result->mk_rename(r, m_cycle.size(), m_cycle.data()); return result; } }; @@ -671,7 +671,7 @@ namespace datalog { conjs.push_back(arith.mk_le(m.mk_var(i, sig[i]), m.mk_var(*it, sig[*it]))); } } - bsimp.mk_and(conjs.size(), conjs.c_ptr(), fml); + bsimp.mk_and(conjs.size(), conjs.data(), fml); } diff --git a/src/muz/rel/dl_compiler.cpp b/src/muz/rel/dl_compiler.cpp index dea02d533..a970c5904 100644 --- a/src/muz/rel/dl_compiler.cpp +++ b/src/muz/rel/dl_compiler.cpp @@ -66,12 +66,12 @@ namespace datalog { relation_signature sig2 = m_reg_signatures[t2]; relation_signature::from_join(sig1, sig2, vars.size(), vars.get_cols1(), vars.get_cols2(), aux_sig); relation_signature res_sig; - relation_signature::from_project(aux_sig, removed_cols.size(), removed_cols.c_ptr(), + relation_signature::from_project(aux_sig, removed_cols.size(), removed_cols.data(), res_sig); result = get_register(res_sig, reuse_t1, t1); acc.push_back(instruction::mk_join_project(t1, t2, vars.size(), vars.get_cols1(), - vars.get_cols2(), removed_cols.size(), removed_cols.c_ptr(), result)); + vars.get_cols2(), removed_cols.size(), removed_cols.data(), result)); } void compiler::make_filter_interpreted_and_project(reg_idx src, app_ref & cond, @@ -79,11 +79,11 @@ namespace datalog { SASSERT(!removed_cols.empty()); relation_signature res_sig; relation_signature::from_project(m_reg_signatures[src], removed_cols.size(), - removed_cols.c_ptr(), res_sig); + removed_cols.data(), res_sig); result = get_register(res_sig, reuse, src); acc.push_back(instruction::mk_filter_interpreted_and_project(src, cond, - removed_cols.size(), removed_cols.c_ptr(), result)); + removed_cols.size(), removed_cols.data(), result)); } void compiler::make_select_equal_and_project(reg_idx src, const relation_element val, unsigned col, @@ -245,7 +245,7 @@ namespace datalog { removed_cols.push_back(i); } } - make_projection(src, removed_cols.size(), removed_cols.c_ptr(), single_col_reg, false, acc); + make_projection(src, removed_cols.size(), removed_cols.data(), single_col_reg, false, acc); } variable_intersection vi(m_context.get_manager()); vi.add_pair(col, 0); @@ -311,7 +311,7 @@ namespace datalog { new_src_col_offset.push_back(src_cols_to_remove.size()); } if(!src_cols_to_remove.empty()) { - make_projection(curr, src_cols_to_remove.size(), src_cols_to_remove.c_ptr(), curr, dealloc, acc); + make_projection(curr, src_cols_to_remove.size(), src_cols_to_remove.data(), curr, dealloc, acc); dealloc = true; curr_sig = & m_reg_signatures[curr]; @@ -385,7 +385,7 @@ namespace datalog { SASSERT(permutation.size()<=col_cnt); //this should not be an infinite loop } while(next!=i); - make_rename(curr, permutation.size(), permutation.c_ptr(), curr, dealloc, acc); + make_rename(curr, permutation.size(), permutation.data(), curr, dealloc, acc); dealloc = true; curr_sig = & m_reg_signatures[curr]; } @@ -594,7 +594,7 @@ namespace datalog { } if (!dealloc) make_clone(filtered_res, filtered_res, acc); - acc.push_back(instruction::mk_filter_identical(filtered_res, indexes.size(), indexes.c_ptr())); + acc.push_back(instruction::mk_filter_identical(filtered_res, indexes.size(), indexes.data())); dealloc = true; } @@ -675,13 +675,13 @@ namespace datalog { if (!dealloc) make_clone(filtered_res, filtered_res, acc); acc.push_back(instruction::mk_filter_by_negation(filtered_res, neg_reg, t_cols.size(), - t_cols.c_ptr(), neg_cols.c_ptr())); + t_cols.data(), neg_cols.data())); dealloc = true; } // enforce interpreted tail predicates if (!tail.empty()) { - app_ref filter_cond(tail.size() == 1 ? to_app(tail.back()) : m.mk_and(tail.size(), tail.c_ptr()), m); + app_ref filter_cond(tail.size() == 1 ? to_app(tail.back()) : m.mk_and(tail.size(), tail.data()), m); // check if there are any columns to remove unsigned_vector remove_columns; @@ -725,7 +725,7 @@ namespace datalog { } } - expr_ref renamed = m_context.get_var_subst()(filter_cond, binding.size(), binding.c_ptr()); + expr_ref renamed = m_context.get_var_subst()(filter_cond, binding.size(), binding.data()); app_ref app_renamed(to_app(renamed), m); if (remove_columns.empty()) { if (!dealloc && filtered_res != UINT_MAX) @@ -931,7 +931,7 @@ namespace datalog { } if(!input_deltas || all_or_nothing_deltas()) { - compile_rule_evaluation_run(r, head_reg, tail_regs.c_ptr(), output_delta, use_widening, acc); + compile_rule_evaluation_run(r, head_reg, tail_regs.data(), output_delta, use_widening, acc); } else { tail_delta_infos::iterator tdit = tail_deltas.begin(); @@ -939,7 +939,7 @@ namespace datalog { for(; tdit!=tdend; ++tdit) { tail_delta_info tdinfo = *tdit; flet flet_tail_reg(tail_regs[tdinfo.second], tdinfo.first); - compile_rule_evaluation_run(r, head_reg, tail_regs.c_ptr(), output_delta, use_widening, acc); + compile_rule_evaluation_run(r, head_reg, tail_regs.data(), output_delta, use_widening, acc); } } } @@ -1121,7 +1121,7 @@ namespace datalog { loop_body->set_observer(nullptr); acc.push_back(instruction::mk_while_loop(loop_control_regs.size(), - loop_control_regs.c_ptr(), loop_body)); + loop_control_regs.data(), loop_body)); } void compiler::compile_dependent_rules(const func_decl_set & head_preds, diff --git a/src/muz/rel/dl_external_relation.cpp b/src/muz/rel/dl_external_relation.cpp index 43d68759a..a47b0719f 100644 --- a/src/muz/rel/dl_external_relation.cpp +++ b/src/muz/rel/dl_external_relation.cpp @@ -46,14 +46,14 @@ namespace datalog { args.push_back(f[i]); } if (!fn.get()) { - fn = m.mk_func_decl(fid, k, 0, nullptr, args.size(), args.c_ptr()); + fn = m.mk_func_decl(fid, k, 0, nullptr, args.size(), args.data()); } if (destructive) { - get_plugin().reduce_assign(fn, args.size(), args.c_ptr(), 1, args.c_ptr()); + get_plugin().reduce_assign(fn, args.size(), args.data(), 1, args.data()); res = m_rel; } else { - get_plugin().reduce(fn, args.size(), args.c_ptr(), res); + get_plugin().reduce(fn, args.size(), args.data(), res); } } @@ -152,7 +152,7 @@ namespace datalog { for (unsigned i = 0; i < sig.size(); ++i) { sorts.push_back(parameter(sig[i])); } - return m.mk_sort(fid, DL_RELATION_SORT, sorts.size(), sorts.c_ptr()); + return m.mk_sort(fid, DL_RELATION_SORT, sorts.size(), sorts.data()); } sort* external_relation_plugin::get_column_sort(unsigned col, sort* s) { @@ -192,7 +192,7 @@ namespace datalog { params.push_back(parameter(cols2[i])); } sort* domain[2] = { p.get_relation_sort(o1_sig), p.get_relation_sort(o2_sig) }; - m_join_fn = m.mk_func_decl(fid, OP_RA_JOIN, params.size(), params.c_ptr(), 2, domain); + m_join_fn = m.mk_func_decl(fid, OP_RA_JOIN, params.size(), params.data(), 2, domain); } relation_base * operator()(const relation_base & r1, const relation_base & r2) override { @@ -228,7 +228,7 @@ namespace datalog { for (unsigned i = 0; i < removed_col_cnt; ++i) { params.push_back(parameter(removed_cols[i])); } - m_project_fn = m.mk_func_decl(fid, OP_RA_PROJECT, params.size(), params.c_ptr(), 1, &relation_sort); + m_project_fn = m.mk_func_decl(fid, OP_RA_PROJECT, params.size(), params.data(), 1, &relation_sort); } relation_base * operator()(const relation_base & r) override { @@ -262,7 +262,7 @@ namespace datalog { SASSERT(cycle[i] < orig_sig.size()); params.push_back(parameter(cycle[i])); } - m_rename_fn = m.mk_func_decl(fid, OP_RA_RENAME, params.size(), params.c_ptr(), 1, &relation_sort); + m_rename_fn = m.mk_func_decl(fid, OP_RA_RENAME, params.size(), params.data(), 1, &relation_sort); } relation_base * operator()(const relation_base & r) override { @@ -433,7 +433,7 @@ namespace datalog { params.push_back(parameter(negated_cols[i])); } sort* domain[2] = { get(tgt).get_sort(), get(neg_t).get_sort() }; - m_negated_filter_fn = m.mk_func_decl(fid, OP_RA_NEGATION_FILTER, params.size(), params.c_ptr(), 2, domain); + m_negated_filter_fn = m.mk_func_decl(fid, OP_RA_NEGATION_FILTER, params.size(), params.data(), 2, domain); } void operator()(relation_base & t, const relation_base & negated_obj) override { diff --git a/src/muz/rel/dl_finite_product_relation.cpp b/src/muz/rel/dl_finite_product_relation.cpp index d4611e4c2..8a4b86e6d 100644 --- a/src/muz/rel/dl_finite_product_relation.cpp +++ b/src/muz/rel/dl_finite_product_relation.cpp @@ -163,7 +163,7 @@ namespace datalog { relation_signature candidate_rel_sig; unsigned rel_sig_ofs = s.size()/2; unsigned rel_sig_sz = s.size()-rel_sig_ofs; - candidate_rel_sig.append(rel_sig_sz, s.c_ptr()+rel_sig_ofs); + candidate_rel_sig.append(rel_sig_sz, s.data()+rel_sig_ofs); if(m_inner_plugin.can_handle_signature(candidate_rel_sig)) { for(unsigned i=rel_sig_ofs; i res_table = (*join_fun)(t, *idx_singleton); bool_vector table_cols(sig.size(), true); - finite_product_relation * res = mk_empty(sig, table_cols.c_ptr()); + finite_product_relation * res = mk_empty(sig, table_cols.data()); //this one does not need to be deleted -- it will be taken over by \c res in the \c init function relation_base * inner_rel = get_inner_plugin().mk_full(pred, inner_sig, get_inner_plugin().get_kind()); @@ -302,7 +302,7 @@ namespace datalog { idx_singleton->add_fact(idx_singleton_fact); bool_vector table_cols(sig.size(), false); - finite_product_relation * res = mk_empty(sig, table_cols.c_ptr()); + finite_product_relation * res = mk_empty(sig, table_cols.data()); relation_vector rels; rels.push_back(r.clone()); @@ -426,7 +426,7 @@ namespace datalog { } } m_tjoin_fn = r1.get_manager().mk_join_fn(r1.get_table(), r2.get_table(), m_t_joined_cols1.size(), - m_t_joined_cols1.c_ptr(), m_t_joined_cols2.c_ptr()); + m_t_joined_cols1.data(), m_t_joined_cols2.data()); SASSERT(m_tjoin_fn); @@ -482,7 +482,7 @@ namespace datalog { //It would however need to be somehow inferred for the new signature. finite_product_relation * res = alloc(finite_product_relation, r1.get_plugin(), get_result_signature(), - m_res_table_columns.c_ptr(), res_table->get_plugin(), res_oplugin, null_family_id); + m_res_table_columns.data(), res_table->get_plugin(), res_oplugin, null_family_id); res->init(*res_table, joined_orelations, true); @@ -491,7 +491,7 @@ namespace datalog { //We enforce those equalities here. if(!m_filter_tr_identities) { m_filter_tr_identities = plugin.mk_filter_identical_pairs(*res, m_tr_table_joined_cols.size(), - m_tr_table_joined_cols.c_ptr(), m_tr_rel_joined_cols.c_ptr()); + m_tr_table_joined_cols.data(), m_tr_rel_joined_cols.data()); SASSERT(m_filter_tr_identities); } (*m_filter_tr_identities)(*res); @@ -603,7 +603,7 @@ namespace datalog { else { project_reducer * preducer = alloc(project_reducer, *this, res_relations); scoped_ptr tproject = - rmgr.mk_project_with_reduce_fn(rtable, m_removed_table_cols.size(), m_removed_table_cols.c_ptr(), preducer); + rmgr.mk_project_with_reduce_fn(rtable, m_removed_table_cols.size(), m_removed_table_cols.data(), preducer); res_table = (*tproject)(rtable); } @@ -635,7 +635,7 @@ namespace datalog { //It would however need to be somehow inferred for the new signature. finite_product_relation * res = alloc(finite_product_relation, r.get_plugin(), get_result_signature(), - m_res_table_columns.c_ptr(), res_table->get_plugin(), *res_oplugin, null_family_id); + m_res_table_columns.data(), res_table->get_plugin(), *res_oplugin, null_family_id); res->init(*res_table, res_relations, false); @@ -733,7 +733,7 @@ namespace datalog { //It would however need to be somehow inferred for the new signature. finite_product_relation * res = alloc(finite_product_relation, r.get_plugin(), get_result_signature(), - m_res_table_columns.c_ptr(), res_table->get_plugin(), r.m_other_plugin, null_family_id); + m_res_table_columns.data(), res_table->get_plugin(), r.m_other_plugin, null_family_id); res->init(*res_table, res_relations, false); @@ -1143,7 +1143,7 @@ namespace datalog { } if(m_table_cols.size()>1) { m_table_filter = r.get_manager().mk_filter_identical_fn(r.get_table(), m_table_cols.size(), - m_table_cols.c_ptr()); + m_table_cols.data()); SASSERT(m_table_filter); } if(!m_table_cols.empty() && !m_rel_cols.empty()) { @@ -1159,7 +1159,7 @@ namespace datalog { if(m_rel_filter) { return; } - m_rel_filter = orel.get_manager().mk_filter_identical_fn(orel, m_rel_cols.size(), m_rel_cols.c_ptr()); + m_rel_filter = orel.get_manager().mk_filter_identical_fn(orel, m_rel_cols.size(), m_rel_cols.data()); SASSERT(m_rel_filter); } @@ -1310,7 +1310,7 @@ namespace datalog { if(m_rel_cond_columns.empty()) { expr_ref_vector renaming(m_manager); get_renaming_args(r.m_sig2table, r.get_signature(), renaming); - expr_ref table_cond = m_subst(condition, renaming.size(), renaming.c_ptr()); + expr_ref table_cond = m_subst(condition, renaming.size(), renaming.data()); m_table_filter = rmgr.mk_filter_interpreted_fn(r.get_table(), to_app(table_cond)); } else { @@ -1359,7 +1359,7 @@ namespace datalog { continue; } if(!m_rel_filter) { - expr_ref inner_cond = m_subst(m_cond, m_renaming_for_inner_rel.size(), m_renaming_for_inner_rel.c_ptr()); + expr_ref inner_cond = m_subst(m_cond, m_renaming_for_inner_rel.size(), m_renaming_for_inner_rel.data()); m_rel_filter = rmgr.mk_filter_interpreted_fn(*inner, to_app(inner_cond)); } (*m_rel_filter)(*inner); @@ -1407,7 +1407,7 @@ namespace datalog { //create the condition with table values substituted in and relation values properly renamed expr_ref inner_cond(m_manager); - inner_cond = m_subst(m_cond, m_renaming_for_inner_rel.size(), m_renaming_for_inner_rel.c_ptr()); + inner_cond = m_subst(m_cond, m_renaming_for_inner_rel.size(), m_renaming_for_inner_rel.data()); th_rewriter rw(m_manager); rw(inner_cond); if (m_manager.is_false(inner_cond)) { @@ -1660,7 +1660,7 @@ namespace datalog { unsigned_vector removed_cols; add_sequence_without_set(0, t_sz-1, m_table_cols, removed_cols); if(!removed_cols.empty()) { - m_tproject_fn = r.get_manager().mk_project_fn(r.get_table(), removed_cols.size(), removed_cols.c_ptr()); + m_tproject_fn = r.get_manager().mk_project_fn(r.get_table(), removed_cols.size(), removed_cols.data()); } } @@ -1744,7 +1744,7 @@ namespace datalog { SASSERT(filtered_table.get_signature().functional_columns()==1); unsigned_vector rtable_joined_cols; - rtable_joined_cols.append(selected_col_cnt, selected_columns.c_ptr()); //filtered table cols + rtable_joined_cols.append(selected_col_cnt, selected_columns.data()); //filtered table cols rtable_joined_cols.push_back(rtable_sig_sz-1); //unfiltered relation indexes unsigned_vector filtered_joined_cols; @@ -2073,7 +2073,7 @@ namespace datalog { removed_cols[i] = i; } live_rel_collection_reducer * reducer = alloc(live_rel_collection_reducer, m_live_rel_collection_acc); - m_live_rel_collection_project = get_manager().mk_project_with_reduce_fn(get_table(), removed_cols.size(), removed_cols.c_ptr(), reducer); + m_live_rel_collection_project = get_manager().mk_project_with_reduce_fn(get_table(), removed_cols.size(), removed_cols.data(), reducer); SASSERT(m_live_rel_collection_project); } @@ -2172,7 +2172,7 @@ namespace datalog { it = rels.begin(); for(; it!=end; ++it) { finite_product_relation & rel = **it; - if(!rel.try_modify_specification(table_cols.c_ptr())) { + if(!rel.try_modify_specification(table_cols.data())) { return false; } } @@ -2226,7 +2226,7 @@ namespace datalog { bool_vector moved_cols_table_flags(moved_cols_sig.size(), false); scoped_rel moved_cols_rel = get_plugin().mk_empty(moved_cols_sig, - moved_cols_table_flags.c_ptr()); + moved_cols_table_flags.data()); scoped_ptr union_fun = get_manager().mk_union_fn(*moved_cols_rel, *moved_cols_trel); @@ -2369,9 +2369,9 @@ namespace datalog { } sh(tmp, fact_sz-1, tmp); conjs.push_back(tmp); - disjs.push_back(m.mk_and(conjs.size(), conjs.c_ptr())); + disjs.push_back(m.mk_and(conjs.size(), conjs.data())); } - bool_rewriter(m).mk_or(disjs.size(), disjs.c_ptr(), fml); + bool_rewriter(m).mk_or(disjs.size(), disjs.data(), fml); } }; diff --git a/src/muz/rel/dl_instruction.cpp b/src/muz/rel/dl_instruction.cpp index 98bb2be13..0df03172f 100644 --- a/src/muz/rel/dl_instruction.cpp +++ b/src/muz/rel/dl_instruction.cpp @@ -486,7 +486,7 @@ namespace datalog { relation_mutator_fn * fn; relation_base & r = *ctx.reg(m_reg); if (!find_fn(r, fn)) { - fn = r.get_manager().mk_filter_identical_fn(r, m_cols.size(), m_cols.c_ptr()); + fn = r.get_manager().mk_filter_identical_fn(r, m_cols.size(), m_cols.data()); if (!fn) { throw default_exception(default_exception::fmt(), "trying to perform unsupported filter_identical operation on a relation of kind %s", @@ -590,7 +590,7 @@ namespace datalog { relation_base & reg = *ctx.reg(m_src); 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.c_ptr()); + fn = reg.get_manager().mk_filter_interpreted_and_project_fn(reg, m_cond, m_cols.size(), m_cols.data()); if (!fn) { throw default_exception(default_exception::fmt(), "trying to perform unsupported filter_interpreted_and_project operation on a relation of kind %s", @@ -766,10 +766,10 @@ namespace datalog { relation_base & r_src = *ctx.reg(m_src); if (!find_fn(r_src, fn)) { if (m_projection) { - fn = r_src.get_manager().mk_project_fn(r_src, m_cols.size(), m_cols.c_ptr()); + fn = r_src.get_manager().mk_project_fn(r_src, m_cols.size(), m_cols.data()); } else { - fn = r_src.get_manager().mk_rename_fn(r_src, m_cols.size(), m_cols.c_ptr()); + fn = r_src.get_manager().mk_rename_fn(r_src, m_cols.size(), m_cols.data()); } if (!fn) { std::stringstream sstm; @@ -962,7 +962,7 @@ namespace datalog { relation_base & r1 = *ctx.reg(m_tgt); const relation_base & r2 = *ctx.reg(m_neg_rel); if (!find_fn(r1, r2, fn)) { - fn = r1.get_manager().mk_filter_by_negation_fn(r1, r2, m_cols1.size(), m_cols1.c_ptr(), m_cols2.c_ptr()); + fn = r1.get_manager().mk_filter_by_negation_fn(r1, r2, m_cols1.size(), m_cols1.data(), m_cols2.data()); if (!fn) { std::stringstream sstm; sstm << "trying to perform unsupported filter_by_negation on relations of kinds "; diff --git a/src/muz/rel/dl_interval_relation.cpp b/src/muz/rel/dl_interval_relation.cpp index 5c5e446db..9bf399e73 100644 --- a/src/muz/rel/dl_interval_relation.cpp +++ b/src/muz/rel/dl_interval_relation.cpp @@ -64,7 +64,7 @@ namespace datalog { interval_relation const& r2 = get(_r2); interval_relation_plugin& p = r1.get_plugin(); interval_relation* result = dynamic_cast(p.mk_full(nullptr, get_result_signature())); - result->mk_join(r1, r2, m_cols1.size(), m_cols1.c_ptr(), m_cols2.c_ptr()); + result->mk_join(r1, r2, m_cols1.size(), m_cols1.data(), m_cols2.data()); return result; } }; @@ -88,7 +88,7 @@ namespace datalog { interval_relation const& r = get(_r); interval_relation_plugin& p = r.get_plugin(); interval_relation* result = dynamic_cast(p.mk_full(nullptr, get_result_signature())); - result->mk_project(r, m_removed_cols.size(), m_removed_cols.c_ptr()); + result->mk_project(r, m_removed_cols.size(), m_removed_cols.data()); return result; } }; @@ -108,7 +108,7 @@ namespace datalog { interval_relation const& r = get(_r); interval_relation_plugin& p = r.get_plugin(); interval_relation* result = dynamic_cast(p.mk_full(nullptr, get_result_signature())); - result->mk_rename(r, m_cycle.size(), m_cycle.c_ptr()); + result->mk_rename(r, m_cycle.size(), m_cycle.data()); return result; } }; @@ -402,7 +402,7 @@ namespace datalog { } } bool_rewriter br(m); - br.mk_and(conjs.size(), conjs.c_ptr(), fml); + br.mk_and(conjs.size(), conjs.data(), fml); } diff --git a/src/muz/rel/dl_lazy_table.cpp b/src/muz/rel/dl_lazy_table.cpp index 1407aec6c..74141e426 100644 --- a/src/muz/rel/dl_lazy_table.cpp +++ b/src/muz/rel/dl_lazy_table.cpp @@ -53,7 +53,7 @@ namespace datalog { table_base* operator()(const table_base& _t1, const table_base& _t2) override { lazy_table const& t1 = get(_t1); lazy_table const& t2 = get(_t2); - lazy_table_ref* tr = alloc(lazy_table_join, m_cols1.size(), m_cols1.c_ptr(), m_cols2.c_ptr(), t1, t2, get_result_signature()); + lazy_table_ref* tr = alloc(lazy_table_join, m_cols1.size(), m_cols1.data(), m_cols2.data(), t1, t2, get_result_signature()); return alloc(lazy_table, tr); } }; @@ -113,7 +113,7 @@ namespace datalog { table_base* operator()(table_base const& _t) override { lazy_table const& t = get(_t); - return alloc(lazy_table, alloc(lazy_table_project, m_removed_cols.size(), m_removed_cols.c_ptr(), t, get_result_signature())); + return alloc(lazy_table, alloc(lazy_table_project, m_removed_cols.size(), m_removed_cols.data(), t, get_result_signature())); } }; @@ -139,7 +139,7 @@ namespace datalog { table_base* operator()(table_base const& _t) override { lazy_table const& t = get(_t); - return alloc(lazy_table, alloc(lazy_table_rename, m_cycle.size(), m_cycle.c_ptr(), t, get_result_signature())); + return alloc(lazy_table, alloc(lazy_table_rename, m_cycle.size(), m_cycle.data(), t, get_result_signature())); } }; @@ -165,7 +165,7 @@ namespace datalog { void operator()(table_base& _t) override { lazy_table& t = get(_t); - t.set(alloc(lazy_table_filter_identical, m_cols.size(), m_cols.c_ptr(), t)); + t.set(alloc(lazy_table_filter_identical, m_cols.size(), m_cols.data(), t)); } }; @@ -326,7 +326,7 @@ namespace datalog { table_base* t1 = m_t1->eval(); table_base* t2 = m_t2->eval(); verbose_action _t("join"); - table_join_fn* join = rm().mk_join_fn(*t1, *t2, m_cols1.size(), m_cols1.c_ptr(), m_cols2.c_ptr()); + table_join_fn* join = rm().mk_join_fn(*t1, *t2, m_cols1.size(), m_cols1.data(), m_cols2.data()); m_table = (*join)(*t1, *t2); dealloc(join); return m_table.get(); @@ -349,7 +349,7 @@ namespace datalog { } case LAZY_TABLE_FILTER_INTERPRETED: { lazy_table_filter_interpreted& src = dynamic_cast(*m_src); - table_transformer_fn* tr = rm().mk_filter_interpreted_and_project_fn(*src.eval(), src.condition(), m_cols.size(), m_cols.c_ptr()); + table_transformer_fn* tr = rm().mk_filter_interpreted_and_project_fn(*src.eval(), src.condition(), m_cols.size(), m_cols.data()); if (tr) { verbose_action _t("filter_interpreted_project"); m_table = (*tr)(*src.eval()); @@ -376,7 +376,7 @@ namespace datalog { } table_base* src = m_src->eval(); verbose_action _t("project"); - table_transformer_fn* project = rm().mk_project_fn(*src, m_cols.size(), m_cols.c_ptr()); + table_transformer_fn* project = rm().mk_project_fn(*src, m_cols.size(), m_cols.data()); SASSERT(project); m_table = (*project)(*src); dealloc(project); @@ -387,7 +387,7 @@ namespace datalog { SASSERT(!m_table); table_base* src = m_src->eval(); verbose_action _t("rename"); - table_transformer_fn* rename = rm().mk_rename_fn(*src, m_cols.size(), m_cols.c_ptr()); + table_transformer_fn* rename = rm().mk_rename_fn(*src, m_cols.size(), m_cols.data()); m_table = (*rename)(*src); dealloc(rename); return m_table.get(); @@ -399,7 +399,7 @@ namespace datalog { m_src->release_table(); m_src = nullptr; verbose_action _t("filter_identical"); - table_mutator_fn* m = rm().mk_filter_identical_fn(*m_table, m_cols.size(), m_cols.c_ptr()); + table_mutator_fn* m = rm().mk_filter_identical_fn(*m_table, m_cols.size(), m_cols.data()); SASSERT(m); (*m)(*m_table); dealloc(m); diff --git a/src/muz/rel/dl_mk_explanations.cpp b/src/muz/rel/dl_mk_explanations.cpp index 03c4d6fee..7c5691c0a 100644 --- a/src/muz/rel/dl_mk_explanations.cpp +++ b/src/muz/rel/dl_mk_explanations.cpp @@ -153,7 +153,7 @@ namespace datalog { unsigned n=get_signature().size(); SASSERT(f.size()==n); m_data.reset(); - m_data.append(n, f.c_ptr()); + m_data.append(n, f.data()); } void set_undefined() { m_empty = false; @@ -476,7 +476,7 @@ namespace datalog { not_handled(); subst_arg[ofs-i] = r.m_data.get(i); } - expr_ref res = m_subst(m_new_rule, subst_arg.size(), subst_arg.c_ptr()); + expr_ref res = m_subst(m_new_rule, subst_arg.size(), subst_arg.data()); r.m_data[m_col_idx] = to_app(res); } }; @@ -682,7 +682,7 @@ namespace datalog { e_domain.append(orig_decl->get_arity(), orig_decl->get_domain()); e_domain.push_back(m_e_sort); func_decl * new_decl = m_context.mk_fresh_head_predicate(orig_decl->get_name(), symbol("expl"), - e_domain.size(), e_domain.c_ptr(), orig_decl); + e_domain.size(), e_domain.data(), orig_decl); m_pinned.push_back(new_decl); value = new_decl; @@ -698,7 +698,7 @@ namespace datalog { func_decl * e_decl = get_e_decl(lit->get_decl()); args.append(lit->get_num_args(), lit->get_args()); args.push_back(m_manager.mk_var(e_var_idx, m_e_sort)); - return m_manager.mk_app(e_decl, args.c_ptr()); + return m_manager.mk_app(e_decl, args.data()); } symbol mk_explanations::get_rule_symbol(rule * r) { @@ -753,14 +753,14 @@ namespace datalog { } //rule_expr contains rule function with string representation of the rule as symbol and //for each positive uninterpreted tail it contains its argument values and its explanation term - expr * rule_expr = m_decl_util.mk_rule(rule_repr, rule_expr_args.size(), rule_expr_args.c_ptr()); + expr * rule_expr = m_decl_util.mk_rule(rule_repr, rule_expr_args.size(), rule_expr_args.data()); app_ref e_record(m_manager.mk_eq(m_manager.mk_var(head_var, m_e_sort), rule_expr), m_manager); e_tail.push_back(e_record); neg_flags.push_back(false); SASSERT(e_tail.size()==neg_flags.size()); - return m_context.get_rule_manager().mk(e_head, e_tail.size(), e_tail.c_ptr(), neg_flags.c_ptr()); + return m_context.get_rule_manager().mk(e_head, e_tail.size(), e_tail.data(), neg_flags.data()); } void mk_explanations::transform_rules(const rule_set & src, rule_set & dst) { @@ -784,7 +784,7 @@ namespace datalog { for (unsigned i=0; iget_domain(i))); } - app_ref orig_lit(m_manager.mk_app(orig_decl, lit_args.c_ptr()), m_manager); + app_ref orig_lit(m_manager.mk_app(orig_decl, lit_args.data()), m_manager); app_ref e_lit(get_e_lit(orig_lit, arity), m_manager); app * tail[] = { e_lit.get() }; dst.add_rule(m_context.get_rule_manager().mk(orig_lit, 1, tail, nullptr)); diff --git a/src/muz/rel/dl_mk_similarity_compressor.cpp b/src/muz/rel/dl_mk_similarity_compressor.cpp index 3072b986b..ea1ef42b5 100644 --- a/src/muz/rel/dl_mk_similarity_compressor.cpp +++ b/src/muz/rel/dl_mk_similarity_compressor.cpp @@ -360,7 +360,7 @@ namespace datalog { symbol const& name_prefix = head_pred->get_name(); std::string name_suffix = "sc_" + to_string(const_cnt); func_decl * aux_pred = m_context.mk_fresh_head_predicate(name_prefix, symbol(name_suffix.c_str()), - aux_domain.size(), aux_domain.c_ptr(), head_pred); + aux_domain.size(), aux_domain.data(), head_pred); m_pinned.push_back(aux_pred); relation_fact val_fact(m_manager, const_cnt); @@ -416,17 +416,17 @@ namespace datalog { mod_args[inf.arg_index()] = mod_var; } - app * upd_tail = m_manager.mk_app(mod_tail->get_decl(), mod_args.c_ptr()); + app * upd_tail = m_manager.mk_app(mod_tail->get_decl(), mod_args.data()); m_pinned.push_back(upd_tail); mod_tail = upd_tail; } - app_ref aux_tail(m_manager.mk_app(aux_pred, aux_vars.c_ptr()), m_manager); + app_ref aux_tail(m_manager.mk_app(aux_pred, aux_vars.data()), m_manager); new_tail.push_back(aux_tail); new_negs.push_back(false); - rule * new_rule = m_context.get_rule_manager().mk(new_head, new_tail.size(), new_tail.c_ptr(), - new_negs.c_ptr(), r->name()); + rule * new_rule = m_context.get_rule_manager().mk(new_head, new_tail.size(), new_tail.data(), + new_negs.data(), r->name()); m_result_rules.push_back(new_rule); //TODO: allow for a rule to have multiple parent objects diff --git a/src/muz/rel/dl_mk_simple_joins.cpp b/src/muz/rel/dl_mk_simple_joins.cpp index d87836566..c556e37e4 100644 --- a/src/muz/rel/dl_mk_simple_joins.cpp +++ b/src/muz/rel/dl_mk_simple_joins.cpp @@ -381,9 +381,9 @@ namespace datalog { func_decl * decl = m_context.mk_fresh_head_predicate( symbol(parent_name), symbol("split"), - arity, domain.c_ptr(), parent_head); + arity, domain.data(), parent_head); - app_ref head(m.mk_app(decl, arity, args.c_ptr()), m); + app_ref head(m.mk_app(decl, arity, args.data()), m); app * tail[] = { t1, t2 }; @@ -726,8 +726,8 @@ namespace datalog { negs.push_back(orig_r->is_neg_tail(i)); } - rule * new_rule = rm.mk(orig_r->get_head(), tail.size(), tail.c_ptr(), - negs.c_ptr(), orig_r->name()); + rule * new_rule = rm.mk(orig_r->get_head(), tail.size(), tail.data(), + negs.data(), orig_r->name()); new_rule->set_accounting_parent_object(m_context, orig_r); rm.mk_rule_rewrite_proof(*orig_r, *new_rule); diff --git a/src/muz/rel/dl_product_relation.cpp b/src/muz/rel/dl_product_relation.cpp index c591b7186..52c168f12 100644 --- a/src/muz/rel/dl_product_relation.cpp +++ b/src/muz/rel/dl_product_relation.cpp @@ -178,7 +178,7 @@ namespace datalog { for(unsigned i=0; idisplay(tout);); return result; } @@ -501,7 +501,7 @@ namespace datalog { for (unsigned i = 0; i < r.size(); ++i) { relations.push_back((*m_transforms[i])(r[i])); } - relation_base* result = alloc(product_relation, p, m_sig, relations.size(), relations.c_ptr()); + relation_base* result = alloc(product_relation, p, m_sig, relations.size(), relations.data()); TRACE("dl", _r.display(tout); result->display(tout);); return result; } @@ -517,7 +517,7 @@ namespace datalog { } relation_signature s; relation_signature::from_project(r.get_signature(), col_cnt, removed_cols, s); - return alloc(transform_fn, s, projs.size(), projs.c_ptr()); + return alloc(transform_fn, s, projs.size(), projs.data()); } return nullptr; } @@ -532,7 +532,7 @@ namespace datalog { } relation_signature s; relation_signature::from_rename(r.get_signature(), cycle_len, permutation_cycle, s); - return alloc(transform_fn, s, trans.size(), trans.c_ptr()); + return alloc(transform_fn, s, trans.size(), trans.data()); } return nullptr; } @@ -864,7 +864,7 @@ namespace datalog { if (m) found = true; } if (found) { - return alloc(mutator_fn, mutators.size(), mutators.c_ptr()); + return alloc(mutator_fn, mutators.size(), mutators.data()); } } return nullptr; @@ -882,7 +882,7 @@ namespace datalog { if (m) found = true; } if (found) { - return alloc(mutator_fn, mutators.size(), mutators.c_ptr()); + return alloc(mutator_fn, mutators.size(), mutators.data()); } } return nullptr; @@ -1086,7 +1086,7 @@ namespace datalog { relations.push_back((*this)[i].clone()); } product_relation_plugin& p = get_plugin(); - return alloc(product_relation, p, get_signature(), relations.size(), relations.c_ptr()); + return alloc(product_relation, p, get_signature(), relations.size(), relations.data()); } product_relation * product_relation::complement(func_decl*) const { @@ -1119,7 +1119,7 @@ namespace datalog { m_relations[i]->to_formula(tmp); conjs.push_back(tmp); } - bool_rewriter(m).mk_and(conjs.size(), conjs.c_ptr(), fml); + bool_rewriter(m).mk_and(conjs.size(), conjs.data(), fml); } void product_relation::display(std::ostream & out) const { diff --git a/src/muz/rel/dl_product_relation.h b/src/muz/rel/dl_product_relation.h index d67e817be..63c000489 100644 --- a/src/muz/rel/dl_product_relation.h +++ b/src/muz/rel/dl_product_relation.h @@ -43,8 +43,8 @@ namespace datalog { class filter_identical_fn; class filter_interpreted_fn; struct fid_hash { - typedef family_id data; - unsigned operator()(data x) const { return static_cast(x); } + typedef family_id data_t; + unsigned operator()(data_t x) const { return static_cast(x); } }; rel_spec_store > m_spec_store; diff --git a/src/muz/rel/dl_relation_manager.cpp b/src/muz/rel/dl_relation_manager.cpp index 5130a588c..3b32a1532 100644 --- a/src/muz/rel/dl_relation_manager.cpp +++ b/src/muz/rel/dl_relation_manager.cpp @@ -613,7 +613,7 @@ namespace datalog { (*m_filter)(*t1); if( !m_project) { relation_manager & rmgr = t1->get_plugin().get_manager(); - m_project = rmgr.mk_project_fn(*t1, m_removed_cols.size(), m_removed_cols.c_ptr()); + m_project = rmgr.mk_project_fn(*t1, m_removed_cols.size(), m_removed_cols.data()); if (!m_project) { throw default_exception("projection does not exist"); } @@ -685,7 +685,7 @@ namespace datalog { scoped_rel aux = (*m_join)(t1, t2); if(!m_project) { relation_manager & rmgr = aux->get_plugin().get_manager(); - m_project = rmgr.mk_project_fn(*aux, m_removed_cols.size(), m_removed_cols.c_ptr()); + m_project = rmgr.mk_project_fn(*aux, m_removed_cols.size(), m_removed_cols.data()); if(!m_project) { throw default_exception("projection does not exist"); } @@ -842,7 +842,7 @@ namespace datalog { 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, - join_removed_cols.size(), join_removed_cols.c_ptr(), false); + join_removed_cols.size(), join_removed_cols.data(), false); if(!join_fun) { return nullptr; } @@ -1100,7 +1100,7 @@ namespace datalog { if(get_result_signature().functional_columns()!=0) { //to preserve functional columns we need to do the project_with_reduction unreachable_reducer * reducer = alloc(unreachable_reducer); - m_project = rmgr.mk_project_with_reduce_fn(*aux, m_removed_cols.size(), m_removed_cols.c_ptr(), reducer); + m_project = rmgr.mk_project_with_reduce_fn(*aux, m_removed_cols.size(), m_removed_cols.data(), reducer); } else { m_project = rmgr.mk_project_fn(*aux, m_removed_cols); @@ -1250,11 +1250,11 @@ namespace datalog { for (table_base::row_interface& a : r) { a.get_fact(m_row); if (should_remove(m_row)) { - m_to_remove.append(m_row.size(), m_row.c_ptr()); + m_to_remove.append(m_row.size(), m_row.data()); ++sz; } } - r.remove_facts(sz, m_to_remove.c_ptr()); + r.remove_facts(sz, m_to_remove.data()); } }; @@ -1444,7 +1444,7 @@ namespace datalog { (*m_filter)(*t2); if (!m_project) { relation_manager & rmgr = t2->get_plugin().get_manager(); - m_project = rmgr.mk_project_fn(*t2, m_removed_cols.size(), m_removed_cols.c_ptr()); + m_project = rmgr.mk_project_fn(*t2, m_removed_cols.size(), m_removed_cols.data()); if (!m_project) { throw default_exception("projection does not exist"); } @@ -1599,7 +1599,7 @@ namespace datalog { for (table_base::row_interface& a : t) { a.get_fact(m_curr_fact); - if((*m_mapper)(m_curr_fact.c_ptr()+m_first_functional)) { + if((*m_mapper)(m_curr_fact.data()+m_first_functional)) { m_aux_table->add_fact(m_curr_fact); } } @@ -1683,7 +1683,7 @@ namespace datalog { for (; it != end; ++it) { mk_project(it); if (!res->suggest_fact(m_former_row)) { - (*m_reducer)(m_former_row.c_ptr()+m_res_first_functional, m_row.c_ptr()+m_res_first_functional); + (*m_reducer)(m_former_row.data()+m_res_first_functional, m_row.data()+m_res_first_functional); res->ensure_fact(m_former_row); } } diff --git a/src/muz/rel/dl_relation_manager.h b/src/muz/rel/dl_relation_manager.h index f90d00ae7..58d46347d 100644 --- a/src/muz/rel/dl_relation_manager.h +++ b/src/muz/rel/dl_relation_manager.h @@ -246,7 +246,7 @@ namespace datalog { relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2, const unsigned_vector & cols1, const unsigned_vector & cols2, bool allow_product_relation=true) { SASSERT(cols1.size()==cols2.size()); - return mk_join_fn(t1, t2, cols1.size(), cols1.c_ptr(), cols2.c_ptr(), allow_product_relation); + return mk_join_fn(t1, t2, cols1.size(), cols1.data(), cols2.data(), allow_product_relation); } /** @@ -259,7 +259,7 @@ namespace datalog { const unsigned * removed_cols); relation_transformer_fn * mk_project_fn(const relation_base & t, const unsigned_vector & removed_cols) { - return mk_project_fn(t, removed_cols.size(), removed_cols.c_ptr()); + return mk_project_fn(t, removed_cols.size(), removed_cols.data()); } /** @@ -272,14 +272,14 @@ namespace datalog { relation_join_fn * mk_join_project_fn(const relation_base & t1, const relation_base & t2, const unsigned_vector & cols1, const unsigned_vector & cols2, const unsigned_vector & removed_cols, bool allow_product_relation_join=true) { - return mk_join_project_fn(t1, t2, cols1.size(), cols1.c_ptr(), cols2.c_ptr(), removed_cols.size(), - removed_cols.c_ptr(), allow_product_relation_join); + return mk_join_project_fn(t1, t2, cols1.size(), cols1.data(), cols2.data(), removed_cols.size(), + removed_cols.data(), allow_product_relation_join); } relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len, const unsigned * permutation_cycle); relation_transformer_fn * mk_rename_fn(const relation_base & t, const unsigned_vector & permutation_cycle) { - return mk_rename_fn(t, permutation_cycle.size(), permutation_cycle.c_ptr()); + return mk_rename_fn(t, permutation_cycle.size(), permutation_cycle.data()); } /** @@ -291,7 +291,7 @@ namespace datalog { relation_transformer_fn * mk_permutation_rename_fn(const relation_base & t, const unsigned_vector & permutation) { SASSERT(t.get_signature().size()==permutation.size()); - return mk_permutation_rename_fn(t, permutation.c_ptr()); + return mk_permutation_rename_fn(t, permutation.data()); } @@ -344,7 +344,7 @@ namespace datalog { relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt, const unsigned * identical_cols); relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, const unsigned_vector & identical_cols) { - return mk_filter_identical_fn(t, identical_cols.size(), identical_cols.c_ptr()); + return mk_filter_identical_fn(t, identical_cols.size(), identical_cols.data()); } relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value, @@ -378,7 +378,7 @@ namespace datalog { relation_intersection_filter_fn * mk_filter_by_intersection_fn(const relation_base & tgt, const relation_base & src, const unsigned_vector & tgt_cols, const unsigned_vector & src_cols) { SASSERT(tgt_cols.size()==src_cols.size()); - return mk_filter_by_intersection_fn(tgt, src, tgt_cols.size(), tgt_cols.c_ptr(), src_cols.c_ptr()); + return mk_filter_by_intersection_fn(tgt, src, tgt_cols.size(), tgt_cols.data(), src_cols.data()); } relation_intersection_filter_fn * mk_filter_by_intersection_fn(const relation_base & tgt, const relation_base & src); @@ -396,7 +396,7 @@ namespace datalog { const relation_base & negated_obj, const unsigned_vector & t_cols, const unsigned_vector & negated_cols) { SASSERT(t_cols.size()==negated_cols.size()); - return mk_filter_by_negation_fn(t, negated_obj, t_cols.size(), t_cols.c_ptr(), negated_cols.c_ptr()); + return mk_filter_by_negation_fn(t, negated_obj, t_cols.size(), t_cols.data(), negated_cols.data()); } @@ -413,7 +413,7 @@ namespace datalog { table_join_fn * mk_join_fn(const table_base & t1, const table_base & t2, const unsigned_vector & cols1, const unsigned_vector & cols2) { SASSERT(cols1.size()==cols2.size()); - return mk_join_fn(t1, t2, cols1.size(), cols1.c_ptr(), cols2.c_ptr()); + return mk_join_fn(t1, t2, cols1.size(), cols1.data(), cols2.data()); } /** @@ -429,7 +429,7 @@ namespace datalog { const unsigned * removed_cols); table_transformer_fn * mk_project_fn(const table_base & t, const unsigned_vector & removed_cols) { - return mk_project_fn(t, removed_cols.size(), removed_cols.c_ptr()); + return mk_project_fn(t, removed_cols.size(), removed_cols.data()); } /** @@ -453,14 +453,14 @@ namespace datalog { table_join_fn * mk_join_project_fn(const table_base & t1, const table_base & t2, const unsigned_vector & cols1, const unsigned_vector & cols2, const unsigned_vector & removed_cols) { - return mk_join_project_fn(t1, t2, cols1.size(), cols1.c_ptr(), cols2.c_ptr(), removed_cols.size(), - removed_cols.c_ptr()); + return mk_join_project_fn(t1, t2, cols1.size(), cols1.data(), cols2.data(), removed_cols.size(), + removed_cols.data()); } table_transformer_fn * mk_rename_fn(const table_base & t, unsigned permutation_cycle_len, const unsigned * permutation_cycle); table_transformer_fn * mk_rename_fn(const table_base & t, const unsigned_vector & permutation_cycle) { - return mk_rename_fn(t, permutation_cycle.size(), permutation_cycle.c_ptr()); + return mk_rename_fn(t, permutation_cycle.size(), permutation_cycle.data()); } /** @@ -470,7 +470,7 @@ namespace datalog { table_transformer_fn * mk_permutation_rename_fn(const table_base & t, const unsigned * permutation); table_transformer_fn * mk_permutation_rename_fn(const table_base & t, const unsigned_vector & permutation) { SASSERT(t.get_signature().size()==permutation.size()); - return mk_permutation_rename_fn(t, permutation.c_ptr()); + return mk_permutation_rename_fn(t, permutation.data()); } @@ -523,7 +523,7 @@ namespace datalog { table_mutator_fn * mk_filter_identical_fn(const table_base & t, unsigned col_cnt, const unsigned * identical_cols); table_mutator_fn * mk_filter_identical_fn(const table_base & t, const unsigned_vector & identical_cols) { - return mk_filter_identical_fn(t, identical_cols.size(), identical_cols.c_ptr()); + return mk_filter_identical_fn(t, identical_cols.size(), identical_cols.data()); } table_mutator_fn * mk_filter_equal_fn(const table_base & t, const table_element & value, @@ -551,7 +551,7 @@ namespace datalog { table_intersection_filter_fn * mk_filter_by_intersection_fn(const table_base & t, const table_base & src, const unsigned_vector & t_cols, const unsigned_vector & src_cols) { SASSERT(t_cols.size()==src_cols.size()); - return mk_filter_by_intersection_fn(t, src, t_cols.size(), t_cols.c_ptr(), src_cols.c_ptr()); + return mk_filter_by_intersection_fn(t, src, t_cols.size(), t_cols.data(), src_cols.data()); } /** @@ -565,7 +565,7 @@ namespace datalog { table_intersection_filter_fn * mk_filter_by_negation_fn(const table_base & t, const table_base & negated_obj, const unsigned_vector & t_cols, const unsigned_vector & negated_cols) { SASSERT(t_cols.size()==negated_cols.size()); - return mk_filter_by_negation_fn(t, negated_obj, t_cols.size(), t_cols.c_ptr(), negated_cols.c_ptr()); + return mk_filter_by_negation_fn(t, negated_obj, t_cols.size(), t_cols.data(), negated_cols.data()); } /** diff --git a/src/muz/rel/dl_sieve_relation.cpp b/src/muz/rel/dl_sieve_relation.cpp index b47a151c6..c7eab9549 100644 --- a/src/muz/rel/dl_sieve_relation.cpp +++ b/src/muz/rel/dl_sieve_relation.cpp @@ -63,14 +63,14 @@ namespace datalog { sieve_relation * sieve_relation::clone() const { relation_base * new_inner = get_inner().clone(); - return get_plugin().mk_from_inner(get_signature(), m_inner_cols.c_ptr(), new_inner); + return get_plugin().mk_from_inner(get_signature(), m_inner_cols.data(), new_inner); } relation_base * sieve_relation::complement(func_decl* p) const { //this is not precisely a complement, because we still treat the ignored columns as //full, but it should give reasonable results inside the product relation relation_base * new_inner = get_inner().complement(p); - return get_plugin().mk_from_inner(get_signature(), m_inner_cols.c_ptr(), new_inner); + return get_plugin().mk_from_inner(get_signature(), m_inner_cols.data(), new_inner); } void sieve_relation::to_formula(expr_ref& fml) const { @@ -85,7 +85,7 @@ namespace datalog { s.push_back(m.mk_var(idx, sig[i])); } get_inner().to_formula(tmp); - fml = get_plugin().get_context().get_var_subst()(tmp, sz, s.c_ptr()); + fml = get_plugin().get_context().get_var_subst()(tmp, sz, s.data()); } @@ -220,7 +220,7 @@ namespace datalog { relation_signature inner_sig; collect_inner_signature(s, spec.m_inner_cols, inner_sig); relation_base * inner = get_manager().mk_empty_relation(inner_sig, spec.m_inner_kind); - return mk_from_inner(s, spec.m_inner_cols.c_ptr(), inner); + return mk_from_inner(s, spec.m_inner_cols.data(), inner); } @@ -305,7 +305,7 @@ namespace datalog { relation_base * inner_res = (*m_inner_join_fun)(inner1, inner2); - return m_plugin.mk_from_inner(get_result_signature(), m_result_inner_cols.c_ptr(), inner_res); + return m_plugin.mk_from_inner(get_result_signature(), m_result_inner_cols.data(), inner_res); } }; @@ -364,7 +364,7 @@ namespace datalog { relation_base * inner_res = (*m_inner_fun)(r.get_inner()); - return plugin.mk_from_inner(get_result_signature(), m_result_inner_cols.c_ptr(), inner_res); + return plugin.mk_from_inner(get_result_signature(), m_result_inner_cols.data(), inner_res); } }; @@ -400,7 +400,7 @@ namespace datalog { if(!inner_fun) { return nullptr; } - return alloc(transformer_fn, inner_fun, result_sig, result_inner_cols.c_ptr()); + return alloc(transformer_fn, inner_fun, result_sig, result_inner_cols.data()); } relation_transformer_fn * sieve_relation_plugin::mk_rename_fn(const relation_base & r0, @@ -430,7 +430,7 @@ namespace datalog { if(!inner_fun) { return nullptr; } - return alloc(transformer_fn, inner_fun, result_sig, result_inner_cols.c_ptr()); + return alloc(transformer_fn, inner_fun, result_sig, result_inner_cols.data()); } @@ -584,7 +584,7 @@ namespace datalog { } subst_vect[subst_ofs-i] = m.mk_var(r.m_sig2inner[i], sig[i]); } - expr_ref inner_cond = get_context().get_var_subst()(condition, subst_vect.size(), subst_vect.c_ptr()); + expr_ref inner_cond = get_context().get_var_subst()(condition, subst_vect.size(), subst_vect.data()); relation_mutator_fn * inner_fun = get_manager().mk_filter_interpreted_fn(r.get_inner(), to_app(inner_cond)); if(!inner_fun) { diff --git a/src/muz/rel/dl_sieve_relation.h b/src/muz/rel/dl_sieve_relation.h index 336c5345f..72c246e99 100644 --- a/src/muz/rel/dl_sieve_relation.h +++ b/src/muz/rel/dl_sieve_relation.h @@ -91,7 +91,7 @@ namespace datalog { family_id get_relation_kind(const relation_signature & sig, const bool_vector & inner_columns, family_id inner_kind) { SASSERT(sig.size()==inner_columns.size()); - return get_relation_kind(sig, inner_columns.c_ptr(), inner_kind); + return get_relation_kind(sig, inner_columns.data(), inner_kind); } bool can_handle_signature(const relation_signature & s) override; @@ -110,7 +110,7 @@ namespace datalog { sieve_relation * mk_from_inner(const relation_signature & s, const bool_vector & inner_columns, relation_base * inner_rel) { SASSERT(inner_columns.size()==s.size()); - return mk_from_inner(s, inner_columns.c_ptr(), inner_rel); + return mk_from_inner(s, inner_columns.data(), inner_rel); } protected: diff --git a/src/muz/rel/dl_sparse_table.cpp b/src/muz/rel/dl_sparse_table.cpp index b970d8016..1481b5184 100644 --- a/src/muz/rel/dl_sparse_table.cpp +++ b/src/muz/rel/dl_sparse_table.cpp @@ -293,7 +293,7 @@ namespace datalog { void key_to_reserve(const key_value & key) const { m_keys.ensure_reserve(); - m_keys.write_into_reserve((char *)(key.c_ptr())); + m_keys.write_into_reserve((char *)(key.data())); } offset_vector & get_matching_offset_vector(const key_value & key) { @@ -416,7 +416,7 @@ namespace datalog { //We will change the content of the reserve; which does not change the 'high-level' //content of the table. sparse_table & t = const_cast(m_table); - t.write_into_reserve(m_key_fact.c_ptr()); + t.write_into_reserve(m_key_fact.data()); store_offset res; if (!t.m_data.find_reserve_content(res)) { @@ -514,7 +514,7 @@ namespace datalog { } void sparse_table::add_fact(const table_fact & f) { - write_into_reserve(f.c_ptr()); + write_into_reserve(f.data()); add_reserve_content(); } @@ -525,7 +525,7 @@ namespace datalog { bool sparse_table::contains_fact(const table_fact & f) const { verbose_action _va("contains_fact", 2); sparse_table & t = const_cast(*this); - t.write_into_reserve(f.c_ptr()); + t.write_into_reserve(f.data()); unsigned func_col_cnt = get_signature().functional_columns(); if (func_col_cnt == 0) { return t.m_data.reserve_content_already_present(); @@ -554,7 +554,7 @@ namespace datalog { } else { sparse_table & t = const_cast(*this); - t.write_into_reserve(f.c_ptr()); + t.write_into_reserve(f.data()); store_offset ofs; if (!t.m_data.find_reserve_content(ofs)) { return false; @@ -578,7 +578,7 @@ namespace datalog { add_fact(f); } else { - write_into_reserve(f.c_ptr()); + write_into_reserve(f.data()); store_offset ofs; if (!m_data.find_reserve_content(ofs)) { add_fact(f); @@ -839,12 +839,12 @@ namespace datalog { //one to be at the outer iteration (then the small one will hopefully fit into //the cache) if ( (t1.row_count() > t2.row_count()) == (!m_cols1.empty()) ) { - sparse_table::self_agnostic_join_project(t2, t1, m_cols1.size(), m_cols2.c_ptr(), - m_cols1.c_ptr(), m_removed_cols.c_ptr(), true, *res); + sparse_table::self_agnostic_join_project(t2, t1, m_cols1.size(), m_cols2.data(), + m_cols1.data(), m_removed_cols.data(), true, *res); } else { - sparse_table::self_agnostic_join_project(t1, t2, m_cols1.size(), m_cols1.c_ptr(), - m_cols2.c_ptr(), m_removed_cols.c_ptr(), false, *res); + 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); ); return res; @@ -1156,8 +1156,8 @@ namespace datalog { unsigned joined_col_cnt = m_cols1.size(); unsigned t1_entry_size = t1.m_data.entry_size(); - const unsigned * cols1 = tgt_is_first ? m_cols1.c_ptr() : m_cols2.c_ptr(); - const unsigned * cols2 = tgt_is_first ? m_cols2.c_ptr() : m_cols1.c_ptr(); + const unsigned * cols1 = tgt_is_first ? m_cols1.data() : m_cols2.data(); + const unsigned * cols2 = tgt_is_first ? m_cols2.data() : m_cols1.data(); key_value t1_key; t1_key.resize(joined_col_cnt); @@ -1329,8 +1329,8 @@ namespace datalog { SASSERT(m_s2_cols.size() == m_t2_cols.size() + m_src1_cols.size()); s1_key.resize(m_s1_cols.size()); s2_key.resize(m_s2_cols.size()); - key_indexer & s1_indexer = s1.get_key_indexer(m_s1_cols.size(), m_s1_cols.c_ptr()); - key_indexer & s2_indexer = s2.get_key_indexer(m_s2_cols.size(), m_s2_cols.c_ptr()); + key_indexer & s1_indexer = s1.get_key_indexer(m_s1_cols.size(), m_s1_cols.data()); + key_indexer & s2_indexer = s2.get_key_indexer(m_s2_cols.size(), m_s2_cols.data()); store_offset t_after_last = t.m_data.after_last_offset(); key_indexer::query_result s1_offsets, s2_offsets; diff --git a/src/muz/rel/dl_sparse_table.h b/src/muz/rel/dl_sparse_table.h index b68900a80..a14512730 100644 --- a/src/muz/rel/dl_sparse_table.h +++ b/src/muz/rel/dl_sparse_table.h @@ -122,7 +122,7 @@ namespace datalog { offset_hash_proc(storage & s, unsigned unique_entry_sz) : m_storage(s), m_unique_entry_size(unique_entry_sz) {} unsigned operator()(store_offset ofs) const { - return string_hash(m_storage.c_ptr()+ofs, m_unique_entry_size, 0); + return string_hash(m_storage.data()+ofs, m_unique_entry_size, 0); } }; @@ -133,7 +133,7 @@ namespace datalog { offset_eq_proc(storage & s, unsigned unique_entry_sz) : m_storage(s), m_unique_entry_size(unique_entry_sz) {} bool operator()(store_offset o1, store_offset o2) const { - const char * base = m_storage.c_ptr(); + const char * base = m_storage.data(); return memcmp(base+o1, base+o2, m_unique_entry_size)==0; } }; diff --git a/src/muz/rel/dl_table.cpp b/src/muz/rel/dl_table.cpp index 1275577e3..e0ea17739 100644 --- a/src/muz/rel/dl_table.cpp +++ b/src/muz/rel/dl_table.cpp @@ -274,7 +274,7 @@ namespace datalog { } void bitvector_table::add_fact(const table_fact & f) { - m_bv.set(fact2offset(f.c_ptr())); + m_bv.set(fact2offset(f.data())); } void bitvector_table::remove_fact(const table_element* fact) { @@ -282,7 +282,7 @@ namespace datalog { } bool bitvector_table::contains_fact(const table_fact & f) const { - return m_bv.get(fact2offset(f.c_ptr())); + return m_bv.get(fact2offset(f.data())); } table_base::iterator bitvector_table::begin() const { diff --git a/src/muz/rel/doc.cpp b/src/muz/rel/doc.cpp index a6cf98041..0b7800905 100644 --- a/src/muz/rel/doc.cpp +++ b/src/muz/rel/doc.cpp @@ -702,7 +702,7 @@ expr_ref doc_manager::to_formula(ast_manager& m, doc const& src) { for (unsigned i = 0; i < src.neg().size(); ++i) { conj.push_back(m.mk_not(tbvm().to_formula(m, src.neg()[i]))); } - result = mk_and(m, conj.size(), conj.c_ptr()); + result = mk_and(m, conj.size(), conj.data()); return result; } diff --git a/src/muz/rel/karr_relation.cpp b/src/muz/rel/karr_relation.cpp index 956244b4f..d01056960 100644 --- a/src/muz/rel/karr_relation.cpp +++ b/src/muz/rel/karr_relation.cpp @@ -103,7 +103,7 @@ namespace datalog { for (unsigned i = 0; i < M.size(); ++i) { to_formula(M.A[i], M.b[i], M.eq[i], conj); } - bool_rewriter(m).mk_and(conj.size(), conj.c_ptr(), fml); + bool_rewriter(m).mk_and(conj.size(), conj.data(), fml); } } @@ -480,7 +480,7 @@ namespace datalog { if (!b.is_zero()) { sum.push_back(a.mk_numeral(b, true)); } - lhs = a.mk_add(sum.size(), sum.c_ptr()); + lhs = a.mk_add(sum.size(), sum.data()); if (is_eq) { conj.push_back(m.mk_eq(lhs, zero)); } @@ -519,7 +519,7 @@ namespace datalog { karr_relation const& r2 = get(_r2); karr_relation_plugin& p = r1.get_plugin(); karr_relation* result = dynamic_cast(p.mk_full(nullptr, get_result_signature())); - result->mk_join(r1, r2, m_cols1.size(), m_cols1.c_ptr(), m_cols2.c_ptr()); + result->mk_join(r1, r2, m_cols1.size(), m_cols1.data(), m_cols2.data()); return result; } }; @@ -544,7 +544,7 @@ namespace datalog { karr_relation const& r = get(_r); karr_relation_plugin& p = r.get_plugin(); karr_relation* result = dynamic_cast(p.mk_full(nullptr, get_result_signature())); - result->mk_project(r, m_removed_cols.size(), m_removed_cols.c_ptr()); + result->mk_project(r, m_removed_cols.size(), m_removed_cols.data()); return result; } }; @@ -563,7 +563,7 @@ namespace datalog { karr_relation const& r = get(_r); karr_relation_plugin& p = r.get_plugin(); karr_relation* result = dynamic_cast(p.mk_full(nullptr, get_result_signature())); - result->mk_rename(r, m_cycle.size(), m_cycle.c_ptr()); + result->mk_rename(r, m_cycle.size(), m_cycle.data()); return result; } }; diff --git a/src/muz/rel/rel_context.cpp b/src/muz/rel/rel_context.cpp index a6ab5411c..957c85adb 100644 --- a/src/muz/rel/rel_context.cpp +++ b/src/muz/rel/rel_context.cpp @@ -261,7 +261,7 @@ namespace datalog { } SASSERT(!m_last_result_relation); if (some_non_empty) { - m_answer = mk_and(m, ans.size(), ans.c_ptr()); + m_answer = mk_and(m, ans.size(), ans.data()); if (is_approx) { TRACE("dl", tout << "approx\n";); res = l_undef; diff --git a/src/muz/rel/tbv.cpp b/src/muz/rel/tbv.cpp index 80763e7e7..289e43b4e 100644 --- a/src/muz/rel/tbv.cpp +++ b/src/muz/rel/tbv.cpp @@ -317,7 +317,7 @@ expr_ref tbv_manager::to_formula(ast_manager& m, tbv const& src) { break; } } - result = mk_and(m, conj.size(), conj.c_ptr()); + result = mk_and(m, conj.size(), conj.data()); return result; } diff --git a/src/muz/rel/udoc_relation.cpp b/src/muz/rel/udoc_relation.cpp index 367475f77..2b28a6c82 100644 --- a/src/muz/rel/udoc_relation.cpp +++ b/src/muz/rel/udoc_relation.cpp @@ -109,7 +109,7 @@ namespace datalog { for (unsigned i = 0; i < m_elems.size(); ++i) { disj.push_back(to_formula(m_elems[i])); } - fml = mk_or(m, disj.size(), disj.c_ptr()); + fml = mk_or(m, disj.size(), disj.data()); } expr_ref udoc_relation::to_formula(doc const& d) const { ast_manager& m = get_plugin().get_ast_manager(); @@ -119,7 +119,7 @@ namespace datalog { for (unsigned i = 0; i < d.neg().size(); ++i) { conjs.push_back(m.mk_not(to_formula(d.neg()[i]))); } - result = mk_and(m, conjs.size(), conjs.c_ptr()); + result = mk_and(m, conjs.size(), conjs.data()); return result; } expr_ref udoc_relation::to_formula(tbv const& t) const { @@ -168,7 +168,7 @@ namespace datalog { } } } - result = mk_and(m, conjs.size(), conjs.c_ptr()); + result = mk_and(m, conjs.size(), conjs.data()); return result; } @@ -472,7 +472,7 @@ namespace datalog { doc_manager& dm = r.get_dm(); SASSERT(&result->get_dm() == &dm); for (unsigned i = 0; i < src.size(); ++i) { - dst.push_back(dm.allocate(src[i], m_permutation.c_ptr())); + dst.push_back(dm.allocate(src[i], m_permutation.data())); } TRACE("doc", result->display(tout << "result:\n");); SASSERT(dst.well_formed(dm)); @@ -657,8 +657,8 @@ namespace datalog { rests.push_back(g); } } - guard = mk_and(m, guards.size(), guards.c_ptr()); - rest = mk_and(m, rests.size(), rests.c_ptr()); + guard = mk_and(m, guards.size(), guards.data()); + rest = mk_and(m, rests.size(), rests.data()); } void udoc_relation::extract_equalities(expr* g, expr_ref& rest, subset_ints& equalities, unsigned_vector& roots) const { @@ -676,7 +676,7 @@ namespace datalog { conds.pop_back(); } } - rest = mk_and(m, conds.size(), conds.c_ptr()); + rest = mk_and(m, conds.size(), conds.data()); } void udoc_relation::extract_equalities( @@ -1105,7 +1105,7 @@ namespace datalog { m_neg_cols(joined_col_cnt, neg_cols), m_mk_remove_cols(t, neg, m_remove_cols), m_join_project(t, neg, joined_col_cnt, t_cols, neg_cols, - m_remove_cols.size(), m_remove_cols.c_ptr()), + m_remove_cols.size(), m_remove_cols.data()), m_is_subtract(false)//, /*m_is_aliased(true) */{ SASSERT(joined_col_cnt > 0 || neg.get_signature().size() == 0); diff --git a/src/muz/spacer/spacer_antiunify.cpp b/src/muz/spacer/spacer_antiunify.cpp index ce45818ba..d51d240b0 100644 --- a/src/muz/spacer/spacer_antiunify.cpp +++ b/src/muz/spacer/spacer_antiunify.cpp @@ -151,7 +151,7 @@ void anti_unifier::operator()(expr *e1, expr *e2, expr_ref &res, if (m_todo.size() > todo_sz) {continue;} expr_ref u(m); - u = m.mk_app(n1->get_decl(), kids.size(), kids.c_ptr()); + u = m.mk_app(n1->get_decl(), kids.size(), kids.data()); m_pinned.push_back(u); m_cache.insert(n1, n2, u); } diff --git a/src/muz/spacer/spacer_context.cpp b/src/muz/spacer/spacer_context.cpp index 435a3bd14..42b366d94 100644 --- a/src/muz/spacer/spacer_context.cpp +++ b/src/muz/spacer/spacer_context.cpp @@ -224,7 +224,7 @@ void derivation::exist_skolemize(expr* fml, app_ref_vector& vars, expr_ref& res) return; } - std::stable_sort(vars.c_ptr(), vars.c_ptr() + vars.size(), sk_lt_proc()); + std::stable_sort(vars.data(), vars.data() + vars.size(), sk_lt_proc()); unsigned j = 1; for (unsigned i = 1; i < vars.size(); ++i) if (vars.get(i) != vars.get(j - 1)) @@ -396,7 +396,7 @@ pob *derivation::create_next_child () m_trans = mk_and (summaries); // variables to eliminate - vars.append (rf->aux_vars ().size (), rf->aux_vars ().c_ptr ()); + vars.append (rf->aux_vars ().size (), rf->aux_vars ().data ()); for (unsigned i = 0, sz = pt.head ()->get_arity (); i < sz; ++i) { vars.push_back(m.mk_const(pm.o2n(pt.sig(i), 0))); } @@ -537,7 +537,7 @@ void lemma::mk_expr_core() { zks.append(m_zks); zks.reverse(); m_body = expr_abstract(m, 0, - zks.size(), (expr* const*)zks.c_ptr(), m_body); + zks.size(), (expr* const*)zks.data(), m_body); ptr_buffer sorts; svector names; for (app* z : zks) { @@ -545,8 +545,8 @@ void lemma::mk_expr_core() { names.push_back(z->get_decl()->get_name()); } m_body = m.mk_quantifier(forall_k, zks.size(), - sorts.c_ptr(), - names.c_ptr(), + sorts.data(), + names.data(), m_body, 15, symbol(m_body->get_id())); } SASSERT(m_body); @@ -568,7 +568,7 @@ void lemma::mk_cube_core() { m_cube.push_back(m.mk_true()); } else { - std::sort(m_cube.c_ptr(), m_cube.c_ptr() + m_cube.size(), ast_lt_proc()); + std::sort(m_cube.data(), m_cube.data() + m_cube.size(), ast_lt_proc()); } } else { @@ -669,7 +669,7 @@ void lemma::mk_insts(expr_ref_vector &out, expr* e) unsigned num_decls = to_quantifier(lem)->get_num_decls(); expr_ref inst(m); for (unsigned off = 0, sz = m_bindings.size(); off < sz; off += num_decls) { - instantiate((expr * const *) m_bindings.c_ptr() + off, inst, e); + instantiate((expr * const *) m_bindings.data() + off, inst, e); out.push_back(inst); inst.reset(); } @@ -1100,7 +1100,7 @@ expr_ref pred_transformer::get_reachable() const ptr_vector &aux = f->aux_vars(); if (!aux.empty()) { // -- existentially quantify auxiliary variables - r = mk_exists (m, aux.size(), aux.c_ptr(), r); + r = mk_exists (m, aux.size(), aux.data(), r); // XXX not sure how this interacts with variable renaming later on. // XXX For now, simply dissallow existentially quantified auxiliaries NOT_IMPLEMENTED_YET(); @@ -1503,7 +1503,7 @@ bool pred_transformer::is_invariant(unsigned level, lemma* lem, if (ctx.use_bg_invs()) get_pred_bg_invs(conj); lbool r = m_solver->check_assumptions (cand, aux, m_transition_clause, - conj.size(), conj.c_ptr(), 1); + conj.size(), conj.data(), 1); if (r == l_false) { solver_level = m_solver->uses_level (); lem->reset_ctp(); @@ -1538,7 +1538,7 @@ bool pred_transformer::check_inductive(unsigned level, expr_ref_vector& state, conj.push_back (m_extend_lit); lbool res = m_solver->check_assumptions (state, aux, m_transition_clause, - conj.size (), conj.c_ptr (), 1); + conj.size (), conj.data (), 1); if (res == l_false) { state.reset(); state.append(core); @@ -1682,7 +1682,7 @@ void pred_transformer::init_rule(decl2rel const& pts, datalog::rule const& rule) ground_free_vars(trans, var_reprs, aux_vars, ut_size == 0); // SASSERT(is_all_non_null(var_reprs)); - expr_ref tmp = var_subst(m, false)(trans, var_reprs.size (), (expr*const*)var_reprs.c_ptr()); + expr_ref tmp = var_subst(m, false)(trans, var_reprs.size (), (expr*const*)var_reprs.data()); flatten_and (tmp, side); trans = mk_and(side); side.reset (); @@ -2068,7 +2068,7 @@ void pred_transformer::frames::sort () if (m_sorted) { return; } m_sorted = true; - std::sort(m_lemmas.c_ptr(), m_lemmas.c_ptr() + m_lemmas.size (), m_lt); + std::sort(m_lemmas.data(), m_lemmas.data() + m_lemmas.size (), m_lt); } bool pred_transformer::frames::propagate_to_next_level (unsigned level) @@ -2565,7 +2565,7 @@ bool context::validate() { for (unsigned j = utsz; j < tsz; ++j) { fmls.push_back(r.get_tail(j)); } - tmp = m.mk_and(fmls.size(), fmls.c_ptr()); + tmp = m.mk_and(fmls.size(), fmls.data()); svector names; expr_free_vars fv; fv (tmp); @@ -2576,7 +2576,7 @@ bool context::validate() { } if (!fv.empty()) { fv.reverse (); - tmp = m.mk_exists(fv.size(), fv.c_ptr(), names.c_ptr(), tmp); + tmp = m.mk_exists(fv.size(), fv.data(), names.data(), tmp); } ref sol = mk_smt_solver(m, params_ref::get_empty(), symbol::null); @@ -3779,7 +3779,7 @@ reach_fact *pred_transformer::mk_rf(pob& n, model &mdl, const datalog::rule& r) // collect aux vars to eliminate ptr_vector& aux_vars = get_aux_vars (r); bool elim_aux = ctx.elim_aux(); - if (elim_aux) { vars.append(aux_vars.size(), aux_vars.c_ptr()); } + if (elim_aux) { vars.append(aux_vars.size(), aux_vars.data()); } res = mk_and (path_cons); @@ -3860,7 +3860,7 @@ bool context::create_children(pob& n, datalog::rule const& r, } // local variables of the rule ptr_vector& aux_vars = pt.get_aux_vars(r); - vars.append(aux_vars.size(), aux_vars.c_ptr()); + vars.append(aux_vars.size(), aux_vars.data()); // skolems of the pob n.get_skolems(vars); @@ -3892,7 +3892,7 @@ bool context::create_children(pob& n, datalog::rule const& r, kid_order.reverse(); } else if (m_children_order == CO_RANDOM) { - shuffle(kid_order.size(), kid_order.c_ptr(), m_random); + shuffle(kid_order.size(), kid_order.data(), m_random); } for (unsigned i = 0, sz = preds.size(); i < sz; ++i) { @@ -4036,7 +4036,7 @@ bool context::check_invariant(unsigned lvl, func_decl* fn) if (m.is_true(inv)) { return true; } pt.add_premises(m_rels, lvl, conj); conj.push_back(m.mk_not(inv)); - expr_ref fml(m.mk_and(conj.size(), conj.c_ptr()), m); + 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 @@ -4061,7 +4061,7 @@ expr_ref context::get_constraints (unsigned level) { args.push_back(m.mk_const(m_pm.o2n(r.sig(i), 0))); } expr_ref pred(m); - pred = m.mk_app(r.head (), r.sig_size(), args.c_ptr()); + pred = m.mk_app(r.head (), r.sig_size(), args.data()); constraints.push_back(m.mk_implies(pred, c)); } @@ -4107,7 +4107,7 @@ void context::new_lemma_eh(pred_transformer &pt, lemma *lem) { for (unsigned i = 0; i < pt.sig_size(); ++i) { args.push_back(m.mk_const(pt.get_manager().o2n(pt.sig(i), 0))); } - expr *app = m.mk_app(pt.head(), pt.sig_size(), args.c_ptr()); + expr *app = m.mk_app(pt.head(), pt.sig_size(), args.data()); expr *lemma = m.mk_implies(app, lem->get_expr()); for (unsigned i = 0; i < m_callbacks.size(); i++) { if (m_callbacks[i]->new_lemma()) diff --git a/src/muz/spacer/spacer_context.h b/src/muz/spacer/spacer_context.h index 6338b58ff..e74bf22e6 100644 --- a/src/muz/spacer/spacer_context.h +++ b/src/muz/spacer/spacer_context.h @@ -458,7 +458,7 @@ public: func_decl* head() const {return m_head;} ptr_vector const& rules() const {return m_rules;} func_decl* sig(unsigned i) const {return m_sig[i];} // signature - func_decl* const* sig() {return m_sig.c_ptr();} + func_decl* const* sig() {return m_sig.data();} unsigned sig_size() const {return m_sig.size();} expr* transition() const {return m_transition;} expr* init() const {return m_init;} diff --git a/src/muz/spacer/spacer_farkas_learner.cpp b/src/muz/spacer/spacer_farkas_learner.cpp index b8d8324fb..2a07e96a3 100644 --- a/src/muz/spacer/spacer_farkas_learner.cpp +++ b/src/muz/spacer/spacer_farkas_learner.cpp @@ -374,7 +374,7 @@ void farkas_learner::get_lemmas(proof* root, expr_set const& bs, expr_ref_vector SASSERT(coeffs.size() == lits.size()); if (num_b_pures > 0) { expr_ref res(m); - combine_constraints(coeffs.size(), lits.c_ptr(), coeffs.c_ptr(), res); + combine_constraints(coeffs.size(), lits.data(), coeffs.data(), res); TRACE("farkas_learner2", tout << "Add: " << mk_pp(res, m) << "\n";); INSERT(res); b_closed.mark(p, true); diff --git a/src/muz/spacer/spacer_iuc_solver.cpp b/src/muz/spacer/spacer_iuc_solver.cpp index dabf64277..4f7342590 100644 --- a/src/muz/spacer/spacer_iuc_solver.cpp +++ b/src/muz/spacer/spacer_iuc_solver.cpp @@ -121,7 +121,7 @@ namespace spacer { lbool iuc_solver::check_sat_cc(const expr_ref_vector &cube, vector const & clauses) { if (clauses.empty()) - return check_sat(cube.size(), cube.c_ptr()); + return check_sat(cube.size(), cube.data()); // -- remove any old assumptions m_assumptions.shrink(m_first_assumption); diff --git a/src/muz/spacer/spacer_iuc_solver.h b/src/muz/spacer/spacer_iuc_solver.h index 40d3ea95d..fa9f76311 100644 --- a/src/muz/spacer/spacer_iuc_solver.h +++ b/src/muz/spacer/spacer_iuc_solver.h @@ -103,7 +103,7 @@ public: void get_full_unsat_core(ptr_vector &core) { expr_ref_vector _core(m); m_solver.get_unsat_core(_core); - core.append(_core.size(), _core.c_ptr()); + core.append(_core.size(), _core.data()); } /* solver interface */ diff --git a/src/muz/spacer/spacer_legacy_mev.cpp b/src/muz/spacer/spacer_legacy_mev.cpp index 485663d2b..26752beda 100644 --- a/src/muz/spacer/spacer_legacy_mev.cpp +++ b/src/muz/spacer/spacer_legacy_mev.cpp @@ -506,10 +506,10 @@ void model_evaluator::eval_array_eq(app* e, expr* arg1, expr* arg2) for (unsigned i = 0; i < store.size(); ++i) { args1.resize(1); args2.resize(1); - args1.append(store[i].size() - 1, store[i].c_ptr()); - args2.append(store[i].size() - 1, store[i].c_ptr()); - s1 = m_array.mk_select(args1.size(), args1.c_ptr()); - s2 = m_array.mk_select(args2.size(), args2.c_ptr()); + args1.append(store[i].size() - 1, store[i].data()); + args2.append(store[i].size() - 1, store[i].data()); + s1 = m_array.mk_select(args1.size(), args1.data()); + s2 = m_array.mk_select(args2.size(), args2.data()); w1 = (*m_model)(s1); w2 = (*m_model)(s2); if (w1 == w2) { diff --git a/src/muz/spacer/spacer_manager.h b/src/muz/spacer/spacer_manager.h index 46702efce..583db443b 100644 --- a/src/muz/spacer/spacer_manager.h +++ b/src/muz/spacer/spacer_manager.h @@ -46,7 +46,7 @@ struct relation_info { func_decl_ref_vector m_vars; expr_ref m_body; relation_info(ast_manager& m, func_decl* pred, ptr_vector const& vars, expr* b): - m_pred(pred, m), m_vars(m, vars.size(), vars.c_ptr()), m_body(b, m) {} + m_pred(pred, m), m_vars(m, vars.size(), vars.data()), m_body(b, m) {} }; class unknown_exception {}; diff --git a/src/muz/spacer/spacer_mev_array.cpp b/src/muz/spacer/spacer_mev_array.cpp index 2f2c2b297..aef528359 100644 --- a/src/muz/spacer/spacer_mev_array.cpp +++ b/src/muz/spacer/spacer_mev_array.cpp @@ -151,8 +151,8 @@ void model_evaluator_array_util::eval_array_eq(model& mdl, app* e, expr* arg1, e for (unsigned i = 0; i < store.size(); ++i) { args1.resize(1); args2.resize(1); - args1.append(store[i].size()-1, store[i].c_ptr()); - args2.append(store[i].size()-1, store[i].c_ptr()); + args1.append(store[i].size()-1, store[i].data()); + args2.append(store[i].size()-1, store[i].data()); s1 = m_array.mk_select(args1); s2 = m_array.mk_select(args2); eval (mdl, s1, w1); diff --git a/src/muz/spacer/spacer_pdr.cpp b/src/muz/spacer/spacer_pdr.cpp index 0df9da895..7de091aa7 100644 --- a/src/muz/spacer/spacer_pdr.cpp +++ b/src/muz/spacer/spacer_pdr.cpp @@ -340,7 +340,7 @@ bool context::gpdr_create_split_children(pob &n, const datalog::rule &r, kid_order.reverse(); } else if (m_children_order == CO_RANDOM) { - shuffle(kid_order.size(), kid_order.c_ptr(), m_random); + shuffle(kid_order.size(), kid_order.data(), m_random); } diff --git a/src/muz/spacer/spacer_proof_utils.cpp b/src/muz/spacer/spacer_proof_utils.cpp index 46f715318..a3ebb028a 100644 --- a/src/muz/spacer/spacer_proof_utils.cpp +++ b/src/muz/spacer/spacer_proof_utils.cpp @@ -219,8 +219,8 @@ namespace spacer { proof_ref pf(m); pf = m.mk_th_lemma(tid, m.mk_false(), - parents.size(), parents.c_ptr(), - v.size(), v.c_ptr()); + parents.size(), parents.data(), + v.size(), v.data()); return pf; } @@ -345,8 +345,8 @@ namespace spacer { proof_ref pf(m); pf = m.mk_th_lemma(tid, m.mk_false(), - parents.size(), parents.c_ptr(), - v.size(), v.c_ptr()); + parents.size(), parents.data(), + v.size(), v.data()); SASSERT(is_arith_lemma(m, pf)); TRACE("spacer.fkab", tout << mk_pp(pf, m) << "\n";); @@ -447,7 +447,7 @@ namespace spacer { SASSERT(p->get_decl()->get_arity() == args.size()); proof* res = m.mk_app(p->get_decl(), - args.size(), (expr * const*)args.c_ptr()); + args.size(), (expr * const*)args.data()); m_pinned.push_back(res); m_cache.insert(p, res); } @@ -734,7 +734,7 @@ namespace spacer { } expr_ref lemma(m); - lemma = mk_or(m, args.size(), args.c_ptr()); + lemma = mk_or(m, args.size(), args.data()); proof* res; res = m.mk_lemma(premise, lemma); @@ -816,7 +816,7 @@ namespace spacer { // expr_ref tmp(m); // tmp = mk_or(m, pf_fact.size(), pf_fact.c_ptr()); // proof* res = m.mk_unit_resolution(pf_args.size(), pf_args.c_ptr(), tmp); - proof *res = m.mk_unit_resolution(pf_args.size(), pf_args.c_ptr()); + proof *res = m.mk_unit_resolution(pf_args.size(), pf_args.data()); m_pinned.push_back(res); return res; @@ -839,7 +839,7 @@ namespace spacer { SASSERT(old->get_decl()->get_arity() == args.size()); proof* res = m.mk_app(old->get_decl(), args.size(), - (expr * const*)args.c_ptr()); + (expr * const*)args.data()); m_pinned.push_back(res); return res; } diff --git a/src/muz/spacer/spacer_prop_solver.cpp b/src/muz/spacer/spacer_prop_solver.cpp index e2daa3ac4..a543f5c86 100644 --- a/src/muz/spacer/spacer_prop_solver.cpp +++ b/src/muz/spacer/spacer_prop_solver.cpp @@ -143,7 +143,7 @@ lbool prop_solver::mss(expr_ref_vector &hard, expr_ref_vector &soft) { iuc_solver::scoped_mk_proxy _p_(*m_ctx, hard); unsigned hard_sz = hard.size(); - lbool res = m_ctx->check_sat(hard.size(), hard.c_ptr()); + lbool res = m_ctx->check_sat(hard.size(), hard.data()); // bail out if hard constraints are not sat, or if there are no // soft constraints if (res != l_true || soft.empty()) {return res;} @@ -202,7 +202,7 @@ lbool prop_solver::mss(expr_ref_vector &hard, expr_ref_vector &soft) { // -- grow the set of backbone literals for (;j < hard.size(); ++j) { - res = m_ctx->check_sat(j+1, hard.c_ptr()); + res = m_ctx->check_sat(j+1, hard.data()); if (res == l_false) { // -- flip non-true literal to be false hard[j] = mk_not(m, hard.get(j)); @@ -363,10 +363,10 @@ lbool prop_solver::check_assumptions(const expr_ref_vector & _hard, // current clients expect that flattening of HARD is // done implicitly during check_assumptions expr_ref_vector hard(m); - hard.append(_hard.size(), _hard.c_ptr()); + hard.append(_hard.size(), _hard.data()); flatten_and(hard); - shuffle(hard.size(), hard.c_ptr(), m_random); + shuffle(hard.size(), hard.data(), m_random); m_ctx = m_contexts [solver_id == 0 ? 0 : 0 /* 1 */].get(); diff --git a/src/muz/spacer/spacer_qe_project.cpp b/src/muz/spacer/spacer_qe_project.cpp index 615a5b3a7..5acbab9aa 100644 --- a/src/muz/spacer/spacer_qe_project.cpp +++ b/src/muz/spacer/spacer_qe_project.cpp @@ -128,7 +128,7 @@ peq::peq (expr* lhs, expr* rhs, unsigned num_indices, expr * const * diff_indice sorts.push_back (diff_indices[i]->get_sort ()); m_diff_indices.push_back (diff_indices [i]); } - m_decl = m.mk_func_decl (symbol (PARTIAL_EQ), sorts.size (), sorts.c_ptr (), m.mk_bool_sort ()); + m_decl = m.mk_func_decl (symbol (PARTIAL_EQ), sorts.size (), sorts.data (), m.mk_bool_sort ()); } void peq::lhs (expr_ref& result) { result = m_lhs; } @@ -149,7 +149,7 @@ void peq::mk_peq (app_ref& result) { for (unsigned i = 0; i < m_num_indices; i++) { args.push_back (m_diff_indices.get (i)); } - m_peq = m.mk_app (m_decl, args.size (), args.c_ptr ()); + m_peq = m.mk_app (m_decl, args.size (), args.data ()); } result = m_peq; } @@ -326,7 +326,7 @@ namespace spacer_qe { t = ts.get (0); } else { - t = a.mk_add(ts.size(), ts.c_ptr()); + t = a.mk_add(ts.size(), ts.data()); } return true; @@ -947,7 +947,7 @@ namespace spacer_qe { // all args processed; make new term func_decl* d = ap->get_decl (); expr_ref new_term (m); - new_term = m.mk_app (d, args.size (), args.c_ptr ()); + new_term = m.mk_app (d, args.size (), args.data ()); // check for mod and introduce new var if (a.is_mod (ap)) { app_ref new_var (m); @@ -976,7 +976,7 @@ namespace spacer_qe { if (new_fml) { fml = new_fml; // add in eqs - fml = m.mk_and (fml, m.mk_and (eqs.size (), eqs.c_ptr ())); + fml = m.mk_and (fml, m.mk_and (eqs.size (), eqs.data ())); } else { // unchanged @@ -1045,7 +1045,7 @@ namespace spacer_qe { // t2 < abs (num_val) lits.push_back (a.mk_lt (t2, a.mk_numeral (abs (num_val), a.mk_int ()))); - new_fml = m.mk_and (lits.size (), lits.c_ptr ()); + new_fml = m.mk_and (lits.size (), lits.data ()); } } else if (!is_app (fml)) { @@ -1060,7 +1060,7 @@ namespace spacer_qe { mod2div (ch, map); children.push_back (ch); } - new_fml = m.mk_app (a->get_decl (), children.size (), children.c_ptr ()); + new_fml = m.mk_app (a->get_decl (), children.size (), children.data ()); } map.insert (fml, new_fml, nullptr); @@ -1402,7 +1402,7 @@ namespace spacer_qe { if (!all_done) continue; todo.pop_back (); - expr_ref a_new (m.mk_app (a->get_decl (), args.size (), args.c_ptr ()), m); + expr_ref a_new (m.mk_app (a->get_decl (), args.size (), args.data ()), m); // if a_new is select on m_v, introduce new constant if (m_arr_u.is_select (a) && @@ -1457,7 +1457,7 @@ namespace spacer_qe { ptr_vector sel_args; sel_args.push_back (arr); sel_args.push_back (I.get (i)); - expr_ref val_term (m_arr_u.mk_select (sel_args.size (), sel_args.c_ptr ()), m); + expr_ref val_term (m_arr_u.mk_select (sel_args.size (), sel_args.data ()), m); // evaluate and assign to ith diff_val_const m_mev.eval (*M, val_term, val); M->register_decl (diff_val_consts.get (i)->get_decl (), val); @@ -1537,7 +1537,7 @@ namespace spacer_qe { ); // arr0 ==I arr1 - mk_peq (arr0, arr1, I.size (), I.c_ptr (), p_exp); + mk_peq (arr0, arr1, I.size (), I.data (), p_exp); TRACE ("qe", tout << "new peq:\n"; @@ -1548,7 +1548,7 @@ namespace spacer_qe { m_idx_lits_v.append (idx_diseq); // arr0 ==I+idx arr1 I.push_back (idx); - mk_peq (arr0, arr1, I.size (), I.c_ptr (), p_exp); + mk_peq (arr0, arr1, I.size (), I.data (), p_exp); TRACE ("qe", tout << "new peq:\n"; @@ -1559,7 +1559,7 @@ namespace spacer_qe { ptr_vector sel_args; sel_args.push_back (arr1); sel_args.push_back (idx); - expr_ref arr1_idx (m_arr_u.mk_select (sel_args.size (), sel_args.c_ptr ()), m); + expr_ref arr1_idx (m_arr_u.mk_select (sel_args.size (), sel_args.data ()), m); expr_ref eq (m.mk_eq (arr1_idx, x), m); m_aux_lits_v.push_back (eq); @@ -1737,7 +1737,7 @@ namespace spacer_qe { lits.append (m_idx_lits_v); lits.append (m_aux_lits_v); lits.push_back (fml); - fml = m.mk_and (lits.size (), lits.c_ptr ()); + fml = m.mk_and (lits.size (), lits.data ()); if (m_subst_term_v) { m_true_sub_v.insert (m_v, m_subst_term_v); @@ -1899,7 +1899,7 @@ namespace spacer_qe { todo.pop_back (); if (dirty) { - r = m.mk_app (a->get_decl (), args.size (), args.c_ptr ()); + r = m.mk_app (a->get_decl (), args.size (), args.data ()); m_pinned.push_back (r); } else r = a; @@ -1954,7 +1954,7 @@ namespace spacer_qe { expr_ref_vector lits (m); lits.append (m_idx_lits); lits.push_back (fml); - fml = m.mk_and (lits.size (), lits.c_ptr ()); + fml = m.mk_and (lits.size (), lits.data ()); // simplify all trivial expressions introduced m_rw (fml); @@ -2153,7 +2153,7 @@ namespace spacer_qe { expr_ref_vector lits (m); lits.append (m_idx_lits); lits.push_back (fml); - fml = m.mk_and (lits.size (), lits.c_ptr ()); + fml = m.mk_and (lits.size (), lits.data ()); // substitute for sel terms m_sub (fml); diff --git a/src/muz/spacer/spacer_quant_generalizer.cpp b/src/muz/spacer/spacer_quant_generalizer.cpp index 5a2e9d362..ea56cb8f4 100644 --- a/src/muz/spacer/spacer_quant_generalizer.cpp +++ b/src/muz/spacer/spacer_quant_generalizer.cpp @@ -184,7 +184,7 @@ void lemma_quantifier_generalizer::find_candidates(expr *e, } } - std::sort(candidates.c_ptr(), candidates.c_ptr() + candidates.size(), + std::sort(candidates.data(), candidates.data() + candidates.size(), index_lt_proc(m)); // keep actual select indices in the order found at the back of // candidate list. There is no particular reason for this order @@ -276,8 +276,8 @@ void lemma_quantifier_generalizer::cleanup(expr_ref_vector &cube, } if (!found) continue; - rep = arith.mk_add(kids.size(), kids.c_ptr()); - bind = arith.mk_add(kids_bind.size(), kids_bind.c_ptr()); + rep = arith.mk_add(kids.size(), kids.data()); + bind = arith.mk_add(kids_bind.size(), kids_bind.data()); TRACE("spacer_qgen", tout << "replace " << mk_pp(idx, m) << " with " << mk_pp(rep, m) << "\n" << "bind is: " << bind << "\n";); diff --git a/src/muz/spacer/spacer_sat_answer.cpp b/src/muz/spacer/spacer_sat_answer.cpp index c8b005638..0def79abd 100644 --- a/src/muz/spacer/spacer_sat_answer.cpp +++ b/src/muz/spacer/spacer_sat_answer.cpp @@ -24,7 +24,7 @@ struct ground_sat_answer_op::frame { ast_manager &m = pt.get_ast_manager(); spacer::manager &pm = pt.get_manager(); - m_fact = m.mk_app(head(), m_gnd_subst.size(), m_gnd_subst.c_ptr()); + m_fact = m.mk_app(head(), m_gnd_subst.size(), m_gnd_subst.data()); // compute ground equalities implied by the fact SASSERT(m_gnd_subst.size() == pt.head()->get_arity()); @@ -193,7 +193,7 @@ proof *ground_sat_answer_op::mk_proof_step(frame &fr) { substs.push_back(expr_ref_vector(m)); } m_pinned.push_back(m.mk_hyper_resolve(premises.size(), - premises.c_ptr(), + premises.data(), fr.fact(), positions, substs)); TRACE("spacer_sat", tout << "pf step:\n" diff --git a/src/muz/spacer/spacer_util.cpp b/src/muz/spacer/spacer_util.cpp index c3d1be6d7..e284d6424 100644 --- a/src/muz/spacer/spacer_util.cpp +++ b/src/muz/spacer/spacer_util.cpp @@ -732,7 +732,7 @@ namespace spacer { egraph.to_lits(v); } // sort arguments of the top-level and - std::stable_sort(v.c_ptr(), v.c_ptr() + v.size(), ast_lt_proc()); + std::stable_sort(v.data(), v.data() + v.size(), ast_lt_proc()); TRACE("spacer_normalize", tout << "Normalized:\n" @@ -857,7 +857,7 @@ namespace spacer { sort* s = fv[i] ? fv[i] : m.mk_bool_sort(); vars[i] = mk_zk_const(m, i, s); var_subst vs(m, false); - out = vs(e, vars.size(), (expr**)vars.c_ptr()); + out = vs(e, vars.size(), (expr**)vars.data()); } } diff --git a/src/muz/tab/tab_context.cpp b/src/muz/tab/tab_context.cpp index c43589e17..847110beb 100644 --- a/src/muz/tab/tab_context.cpp +++ b/src/muz/tab/tab_context.cpp @@ -212,7 +212,7 @@ namespace tb { } fmls.push_back(m_constraint); flatten_and(fmls); - bool_rewriter(m).mk_and(fmls.size(), fmls.c_ptr(), fml); + bool_rewriter(m).mk_and(fmls.size(), fmls.data(), fml); return fml; } @@ -223,7 +223,7 @@ namespace tb { fv.accumulate(m_predicates[i]); } fv.accumulate(m_constraint); - vars.append(fv.size(), fv.c_ptr()); + vars.append(fv.size(), fv.data()); } expr_ref to_formula() const { @@ -246,7 +246,7 @@ namespace tb { if (!vars[i]) vars[i] = m.mk_bool_sort(); } if (!vars.empty()) { - body = m.mk_forall(vars.size(), vars.c_ptr(), names.c_ptr(), body); + body = m.mk_forall(vars.size(), vars.data(), names.data(), body); } return body; } @@ -293,7 +293,7 @@ namespace tb { fmls.push_back(m_predicates[i]); } fmls.push_back(m_constraint); - bool_rewriter(m).mk_and(fmls.size(), fmls.c_ptr(), fml); + bool_rewriter(m).mk_and(fmls.size(), fmls.data(), fml); if (!m.is_false(m_head)) { if (m.is_true(fml)) { fml = m_head; @@ -329,7 +329,7 @@ namespace tb { for (unsigned i = 0; i < utsz; ++i) { m_predicates.push_back(r->get_tail(i)); } - bool_rewriter(m).mk_and(fmls.size(), fmls.c_ptr(), m_constraint); + bool_rewriter(m).mk_and(fmls.size(), fmls.data(), m_constraint); } // Simplify a clause by applying equalities as substitutions on predicates. @@ -355,7 +355,7 @@ namespace tb { subst.apply(1, delta, expr_offset(m_predicates[i].get(), 0), tmp); m_predicates[i] = to_app(tmp); } - bool_rewriter(m).mk_and(fmls.size(), fmls.c_ptr(), m_constraint); + bool_rewriter(m).mk_and(fmls.size(), fmls.data(), m_constraint); subst.apply(1, delta, expr_offset(m_constraint, 0), m_constraint); rw(m_constraint); } @@ -559,15 +559,15 @@ namespace tb { } vars.push_back(m.mk_const(symbol(i), sorts[i])); } - fml = vs(g.get_head(), vars.size(), vars.c_ptr()); + fml = vs(g.get_head(), vars.size(), vars.data()); m_head = to_app(fml); for (unsigned i = 0; i < g.get_num_predicates(); ++i) { - fml = vs(g.get_predicate(i), vars.size(), vars.c_ptr()); + fml = vs(g.get_predicate(i), vars.size(), vars.data()); m_preds.push_back(to_app(fml)); } - fml = vs(g.get_constraint(), vars.size(), vars.c_ptr()); + fml = vs(g.get_constraint(), vars.size(), vars.data()); fmls.push_back(fml); - m_precond = m.mk_and(fmls.size(), fmls.c_ptr()); + m_precond = m.mk_and(fmls.size(), fmls.data()); IF_VERBOSE(2, verbose_stream() << "setup-match: "; for (unsigned i = 0; i < m_preds.size(); ++i) { @@ -661,7 +661,7 @@ namespace tb { return false; } } - m_rw.mk_and(fmls.size(), fmls.c_ptr(), postcond); + m_rw.mk_and(fmls.size(), fmls.data(), postcond); if (!m.inc()) { return false; } @@ -1130,12 +1130,12 @@ namespace tb { } } if (change) { - constraint = m_S2(result->get_constraint(), m_rename.size(), m_rename.c_ptr()); + constraint = m_S2(result->get_constraint(), m_rename.size(), m_rename.data()); for (unsigned i = 0; i < result->get_num_predicates(); ++i) { - tmp = m_S2(result->get_predicate(i), m_rename.size(), m_rename.c_ptr()); + tmp = m_S2(result->get_predicate(i), m_rename.size(), m_rename.data()); predicates[i] = to_app(tmp); } - tmp = m_S2(result->get_head(), m_rename.size(), m_rename.c_ptr()); + tmp = m_S2(result->get_head(), m_rename.size(), m_rename.data()); head = to_app(tmp); result->init(head, predicates, constraint); } @@ -1166,7 +1166,7 @@ namespace tb { if (vars[i]) { v = m.mk_var(i, vars[i]); m_S1.apply(2, delta, expr_offset(v, offset), tmp); - tmp = m_S2(tmp, m_rename.size(), m_rename.c_ptr()); + tmp = m_S2(tmp, m_rename.size(), m_rename.data()); insert_subst(offset, tmp); } else { @@ -1222,26 +1222,26 @@ namespace tb { } } app_ref_vector preds(m); - delta = m.mk_fresh_func_decl("Delta", dom.size(), dom.c_ptr(), m.mk_bool_sort()); + delta = m.mk_fresh_func_decl("Delta", dom.size(), dom.data(), m.mk_bool_sort()); acc = alloc(clause, m); delta1 = alloc(clause, m); delta2 = alloc(clause, m); - delta1->init(m.mk_app(delta, zszs.size(), zszs.c_ptr()), preds, m.mk_true()); + delta1->init(m.mk_app(delta, zszs.size(), zszs.data()), preds, m.mk_true()); for (unsigned i = 0; i < zs.size(); ++i) { zszs[i+zs.size()] = p->get_arg(i); } app_ref head(m), pred(m); - head = m.mk_app(delta, zszs.size(), zszs.c_ptr()); + head = m.mk_app(delta, zszs.size(), zszs.data()); for (unsigned i = 0; i < zs.size(); ++i) { zszs[i+zs.size()] = q->get_arg(i); } - pred = m.mk_app(delta, zszs.size(), zszs.c_ptr()); + pred = m.mk_app(delta, zszs.size(), zszs.data()); preds.push_back(pred); for (unsigned i = 1; i < g.get_num_predicates(); ++i) { preds.push_back(g.get_predicate(i)); } delta2->init(head, preds, g.get_constraint()); - preds.push_back(m.mk_app(q->get_decl(), zs.size(), zs.c_ptr())); + preds.push_back(m.mk_app(q->get_decl(), zs.size(), zs.data())); acc->init(p, preds, g.get_constraint()); IF_VERBOSE(1, @@ -1598,7 +1598,7 @@ namespace datalog { pc.invert(); prs.push_back(m.mk_asserted(root)); - pr = pc(m, 1, prs.c_ptr()); + pr = pc(m, 1, prs.data()); return pr; } @@ -1610,7 +1610,7 @@ namespace datalog { } expr_ref body = clause.get_body(); var_subst vs(m, false); - body = vs(body, subst.size(), subst.c_ptr()); + body = vs(body, subst.size(), subst.data()); out << body << "\n"; } @@ -1628,7 +1628,7 @@ namespace datalog { premises.push_back(m.mk_asserted(r1.to_formula())); premises.push_back(m.mk_asserted(r2.to_formula())); positions.push_back(std::make_pair(idx+1, 0)); - pr = m.mk_hyper_resolve(2, premises.c_ptr(), fml, positions, substs); + pr = m.mk_hyper_resolve(2, premises.data(), fml, positions, substs); pc.insert(pr); } }; diff --git a/src/muz/transforms/dl_mk_array_blast.cpp b/src/muz/transforms/dl_mk_array_blast.cpp index 646320b6c..30b57f2a4 100644 --- a/src/muz/transforms/dl_mk_array_blast.cpp +++ b/src/muz/transforms/dl_mk_array_blast.cpp @@ -170,7 +170,7 @@ namespace datalog { } if (valid) { todo.pop_back(); - e1 = m.mk_app(ap->get_decl(), args.size(), args.c_ptr()); + e1 = m.mk_app(ap->get_decl(), args.size(), args.data()); trail.push_back(e1); if (a.is_select(ap)) { if (m_defs.find(e1, v)) { @@ -195,7 +195,7 @@ namespace datalog { for (unsigned j = 0; j < s->get_num_args(); ++j) { args.push_back(cache.find(s->get_arg(j))); } - e1 = m.mk_app(s->get_decl(), args.size(), args.c_ptr()); + e1 = m.mk_app(s->get_decl(), args.size(), args.data()); if (!m_defs.contains(e1) && !insert_def(r, e1, v)) { return false; } @@ -230,10 +230,10 @@ namespace datalog { for (unsigned j = 0; j < args1.size(); ++j) { eqs.push_back(m.mk_eq(args1[j], args2[j])); } - conjs.push_back(m.mk_implies(m.mk_and(eqs.size(), eqs.c_ptr()), m.mk_eq(v1, v2))); + conjs.push_back(m.mk_implies(m.mk_and(eqs.size(), eqs.data()), m.mk_eq(v1, v2))); } } - body = m.mk_and(conjs.size(), conjs.c_ptr()); + body = m.mk_and(conjs.size(), conjs.data()); m_rewriter(body); return true; } @@ -281,7 +281,7 @@ namespace datalog { return false; } expr_ref fml1(m), fml2(m), body(m), head(m); - body = m.mk_and(new_conjs.size(), new_conjs.c_ptr()); + body = m.mk_and(new_conjs.size(), new_conjs.data()); head = r.get_head(); sub(body); m_rewriter(body); diff --git a/src/muz/transforms/dl_mk_array_eq_rewrite.cpp b/src/muz/transforms/dl_mk_array_eq_rewrite.cpp index 15ad66bae..afa44437e 100644 --- a/src/muz/transforms/dl_mk_array_eq_rewrite.cpp +++ b/src/muz/transforms/dl_mk_array_eq_rewrite.cpp @@ -99,7 +99,7 @@ namespace datalog { res_conjs.push_back(tmp); } proof_ref pr(m); - m_src_manager->mk_rule(m.mk_implies(m.mk_and(res_conjs.size(), res_conjs.c_ptr()), r.get_head()), pr, dest, r.name()); + m_src_manager->mk_rule(m.mk_implies(m.mk_and(res_conjs.size(), res_conjs.data()), r.get_head()), pr, dest, r.name()); } // NSB Code review: use substitution facility, such as expr_safe_replace or expr_replacer. @@ -115,7 +115,7 @@ namespace datalog { for (expr * arg : *f) { n_args.push_back(replace(arg, new_val, old_val)); } - return m.mk_app(f->get_decl(), n_args.size(), n_args.c_ptr()); + return m.mk_app(f->get_decl(), n_args.size(), n_args.data()); } } diff --git a/src/muz/transforms/dl_mk_array_instantiation.cpp b/src/muz/transforms/dl_mk_array_instantiation.cpp index 29e4c8c7a..5e54afed1 100644 --- a/src/muz/transforms/dl_mk_array_instantiation.cpp +++ b/src/muz/transforms/dl_mk_array_instantiation.cpp @@ -96,7 +96,7 @@ namespace datalog { new_tail.push_back(m.mk_eq(it->get_value(), tmp)); } proof_ref pr(m); - src_manager->mk_rule(m.mk_implies(m.mk_and(new_tail.size(), new_tail.c_ptr()), new_head), pr, dest, r.name()); + src_manager->mk_rule(m.mk_implies(m.mk_and(new_tail.size(), new_tail.data()), new_head), pr, dest, r.name()); } expr_ref mk_array_instantiation::create_head(app* old_head) { @@ -112,7 +112,7 @@ namespace datalog { cnt++; } expr_ref select(m); - select = m_a.mk_select(dummy_args.size(), dummy_args.c_ptr()); + select = m_a.mk_select(dummy_args.size(), dummy_args.data()); new_args.push_back(select); selects.insert_if_not_there(arg, ptr_vector()); selects[arg].push_back(select); @@ -183,11 +183,11 @@ namespace datalog { new_sorts.push_back(new_args.get(i)->get_sort()); expr_ref res(m); func_decl_ref fun_decl(m); - fun_decl = m.mk_func_decl(symbol((old_pred->get_decl()->get_name().str()+"!inst").c_str()), new_sorts.size(), new_sorts.c_ptr(), old_pred->get_decl()->get_range()); + fun_decl = m.mk_func_decl(symbol((old_pred->get_decl()->get_name().str()+"!inst").c_str()), new_sorts.size(), new_sorts.data(), old_pred->get_decl()->get_range()); m_ctx.register_predicate(fun_decl, false); if(src_set->is_output_predicate(old_pred->get_decl())) dst->set_output_predicate(fun_decl); - res=m.mk_app(fun_decl,new_args.size(), new_args.c_ptr()); + res=m.mk_app(fun_decl,new_args.size(), new_args.data()); return res; } @@ -212,7 +212,7 @@ namespace datalog { for(unsigned i=1; iget_num_args();i++) { args.push_back(s->get_arg(i)); } - res = m_a.mk_select(args.size(), args.c_ptr()); + res = m_a.mk_select(args.size(), args.data()); return res; } @@ -234,7 +234,7 @@ namespace datalog { dummy_args.push_back(m.mk_var(cnt, get_array_domain(array->get_sort(), i))); cnt++; } - all_selects.push_back(m_a.mk_select(dummy_args.size(), dummy_args.c_ptr())); + all_selects.push_back(m_a.mk_select(dummy_args.size(), dummy_args.data())); } return all_selects; } diff --git a/src/muz/transforms/dl_mk_backwards.cpp b/src/muz/transforms/dl_mk_backwards.cpp index 4899ed126..5d124336b 100644 --- a/src/muz/transforms/dl_mk_backwards.cpp +++ b/src/muz/transforms/dl_mk_backwards.cpp @@ -67,7 +67,7 @@ namespace datalog { else { head = r.get_tail(j); } - new_rule = rm.mk(head, tail.size(), tail.c_ptr(), neg.c_ptr(), r.name(), true); + new_rule = rm.mk(head, tail.size(), tail.data(), neg.data(), r.name(), true); result->add_rule(new_rule); } } diff --git a/src/muz/transforms/dl_mk_bit_blast.cpp b/src/muz/transforms/dl_mk_bit_blast.cpp index a22de495e..070432e52 100644 --- a/src/muz/transforms/dl_mk_bit_blast.cpp +++ b/src/muz/transforms/dl_mk_bit_blast.cpp @@ -182,7 +182,7 @@ namespace datalog { m_args.push_back(a->get_arg(i)); m_g_vars.push_back(m.mk_var(idx++,m.mk_bool_sort())); } - m_f_vars.push_back(m_util.mk_bv(sz, m_g_vars.c_ptr()+m_g_vars.size()-sz)); + m_f_vars.push_back(m_util.mk_bv(sz, m_g_vars.data()+m_g_vars.size()-sz)); } else { m_args.push_back(arg); @@ -202,7 +202,7 @@ namespace datalog { for (expr* arg : m_args) { domain.push_back(arg->get_sort()); } - g = m_context.mk_fresh_head_predicate(f->get_name(), symbol("bv"), m_args.size(), domain.c_ptr(), f); + g = m_context.mk_fresh_head_predicate(f->get_name(), symbol("bv"), m_args.size(), domain.data(), f); m_old_funcs.push_back(f); m_new_funcs.push_back(g); m_pred2blast.insert(f, g); diff --git a/src/muz/transforms/dl_mk_coalesce.cpp b/src/muz/transforms/dl_mk_coalesce.cpp index e1e7d34e2..97c4bb3af 100644 --- a/src/muz/transforms/dl_mk_coalesce.cpp +++ b/src/muz/transforms/dl_mk_coalesce.cpp @@ -53,7 +53,7 @@ namespace datalog { m_sub2.push_back(b); args.push_back(m.mk_var(m_idx++, a->get_sort())); } - pred = m.mk_app(p1->get_decl(), args.size(), args.c_ptr()); + pred = m.mk_app(p1->get_decl(), args.size(), args.data()); } void mk_coalesce::extract_conjs(expr_ref_vector const& sub, rule const& rl, expr_ref& result) { @@ -98,10 +98,10 @@ namespace datalog { } var_subst vs(m, false); for (unsigned i = r->get_uninterpreted_tail_size(); i < r->get_tail_size(); ++i) { - result = vs(r->get_tail(i), revsub.size(), revsub.c_ptr()); + result = vs(r->get_tail(i), revsub.size(), revsub.data()); conjs.push_back(result); } - bwr.mk_and(conjs.size(), conjs.c_ptr(), result); + bwr.mk_and(conjs.size(), conjs.data(), result); } void mk_coalesce::merge_rules(rule_ref& tgt, rule const& src) { @@ -132,7 +132,7 @@ namespace datalog { SASSERT(is_app(fml)); tail.push_back(to_app(fml)); is_neg.push_back(false); - res = rm.mk(head, tail.size(), tail.c_ptr(), is_neg.c_ptr(), tgt->name()); + res = rm.mk(head, tail.size(), tail.data(), is_neg.data(), tgt->name()); if (m_ctx.generate_proof_trace()) { rm.to_formula(src, fml1); rm.to_formula(*tgt.get(),fml2); @@ -177,7 +177,7 @@ namespace datalog { rule_set::decl2rules::iterator it = source.begin_grouped_rules(), end = source.end_grouped_rules(); for (; it != end; ++it) { rule_ref_vector d_rules(rm); - d_rules.append(it->m_value->size(), it->m_value->c_ptr()); + d_rules.append(it->m_value->size(), it->m_value->data()); for (unsigned i = 0; i < d_rules.size(); ++i) { rule_ref r1(d_rules[i].get(), rm); for (unsigned j = i + 1; j < d_rules.size(); ++j) { diff --git a/src/muz/transforms/dl_mk_coi_filter.cpp b/src/muz/transforms/dl_mk_coi_filter.cpp index 7839e28db..841ab4637 100644 --- a/src/muz/transforms/dl_mk_coi_filter.cpp +++ b/src/muz/transforms/dl_mk_coi_filter.cpp @@ -84,7 +84,7 @@ namespace datalog { m_new_tail_neg.push_back(false); } rule* new_r = m_context.get_rule_manager().mk(r->get_head(), m_new_tail.size(), - m_new_tail.c_ptr(), m_new_tail_neg.c_ptr(), symbol::null, false); + m_new_tail.data(), m_new_tail_neg.data(), symbol::null, false); res->add_rule(new_r); } else { res->add_rule(r); @@ -155,7 +155,7 @@ namespace datalog { fmls.push_back(mk_and(conj)); } expr_ref fml(m); - fml = m.mk_or(fmls.size(), fmls.c_ptr()); + fml = m.mk_or(fmls.size(), fmls.data()); mc0->add(f, fml); } m_context.add_model_converter(mc0); diff --git a/src/muz/transforms/dl_mk_elim_term_ite.cpp b/src/muz/transforms/dl_mk_elim_term_ite.cpp index 9d8d59d5f..753b82cea 100644 --- a/src/muz/transforms/dl_mk_elim_term_ite.cpp +++ b/src/muz/transforms/dl_mk_elim_term_ite.cpp @@ -135,7 +135,7 @@ namespace datalog { for (expr* e : new_conjs) { tail.push_back(rm.ensure_app(e)); } - rule_ref new_rule(rm.mk(r.get_head(), tail.size(), tail.c_ptr(), nullptr, r.name(), false), rm); + 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";); @@ -178,7 +178,7 @@ namespace datalog { app_ref_vector consts(m); collect_uninterp_consts(fml2, consts, m_ground); - fml2 = mk_forall(m, consts.size(), consts.c_ptr(), fml2); + fml2 = mk_forall(m, consts.size(), consts.data(), fml2); proof_ref p(m); rm.mk_rule(fml2, p, new_rules, r.name()); diff --git a/src/muz/transforms/dl_mk_filter_rules.cpp b/src/muz/transforms/dl_mk_filter_rules.cpp index b552f1a06..a5cd057cd 100644 --- a/src/muz/transforms/dl_mk_filter_rules.cpp +++ b/src/muz/transforms/dl_mk_filter_rules.cpp @@ -82,11 +82,11 @@ namespace datalog { func_decl*& filter_decl = m_tail2filter.insert_if_not_there(key, 0); if (!filter_decl) { filter_decl = m_context.mk_fresh_head_predicate(pred->get_decl()->get_name(), symbol("filter"), - filter_domain.size(), filter_domain.c_ptr(), pred->get_decl()); + filter_domain.size(), filter_domain.data(), pred->get_decl()); m_pinned.push_back(filter_decl); app_ref filter_head(m); - filter_head = m.mk_app(filter_decl, key->filter_args.size(), key->filter_args.c_ptr()); + filter_head = m.mk_app(filter_decl, key->filter_args.size(), key->filter_args.data()); app * filter_tail = key->new_pred; rule * filter_rule = m_context.get_rule_manager().mk(filter_head, 1, &filter_tail, (const bool *)nullptr); filter_rule->set_accounting_parent_object(m_context, m_current); @@ -128,7 +128,7 @@ namespace datalog { } } SASSERT(new_args.size() == filter_decl->get_arity()); - new_tail.push_back(m.mk_app(filter_decl, new_args.size(), new_args.c_ptr())); + new_tail.push_back(m.mk_app(filter_decl, new_args.size(), new_args.data())); rule_modified = true; } else { @@ -139,7 +139,7 @@ namespace datalog { if (rule_modified) { remove_duplicate_tails(new_tail, new_is_negated); SASSERT(new_tail.size() == new_is_negated.size()); - rule * new_rule = m_context.get_rule_manager().mk(new_head, new_tail.size(), new_tail.c_ptr(), new_is_negated.c_ptr(), r->name()); + rule * new_rule = m_context.get_rule_manager().mk(new_head, new_tail.size(), new_tail.data(), new_is_negated.data(), r->name()); new_rule->set_accounting_parent_object(m_context, m_current); m_result->add_rule(new_rule); m_context.get_rule_manager().mk_rule_rewrite_proof(*r, *new_rule); diff --git a/src/muz/transforms/dl_mk_interp_tail_simplifier.cpp b/src/muz/transforms/dl_mk_interp_tail_simplifier.cpp index fe9dee45e..343eb3b7d 100644 --- a/src/muz/transforms/dl_mk_interp_tail_simplifier.cpp +++ b/src/muz/transforms/dl_mk_interp_tail_simplifier.cpp @@ -85,7 +85,7 @@ namespace datalog { mk_rule_inliner::remove_duplicate_tails(m_tail, m_neg); SASSERT(m_tail.size() == m_neg.size()); - res = m_context.get_rule_manager().mk(m_head, m_tail.size(), m_tail.c_ptr(), m_neg.c_ptr(),m_rule->name()); + res = m_context.get_rule_manager().mk(m_head, m_tail.size(), m_tail.data(), m_neg.data(),m_rule->name()); res->set_accounting_parent_object(m_context, m_rule); res->norm_vars(res.get_manager()); } @@ -334,7 +334,7 @@ namespace datalog { m_app_args.reset(); m_app_args.append(num, args); - std::sort(m_app_args.c_ptr(), m_app_args.c_ptr()+m_app_args.size(), m_expr_cmp); + std::sort(m_app_args.data(), m_app_args.data()+m_app_args.size(), m_expr_cmp); remove_duplicates(m_app_args); @@ -347,11 +347,11 @@ namespace datalog { } else { if (m.is_and(f)) { - result = m.mk_and(m_app_args.size(), m_app_args.c_ptr()); + result = m.mk_and(m_app_args.size(), m_app_args.data()); } else { SASSERT(m.is_or(f)); - result = m.mk_or(m_app_args.size(), m_app_args.c_ptr()); + result = m.mk_or(m_app_args.size(), m_app_args.data()); } } @@ -529,7 +529,7 @@ namespace datalog { m_itail_members.push_back(r->get_tail(i)); SASSERT(!r->is_neg_tail(i)); } - itail = m.mk_and(m_itail_members.size(), m_itail_members.c_ptr()); + itail = m.mk_and(m_itail_members.size(), m_itail_members.data()); modified = true; } @@ -559,7 +559,7 @@ namespace datalog { } SASSERT(m_tail.size() == m_tail_neg.size()); - res = m_context.get_rule_manager().mk(head, m_tail.size(), m_tail.c_ptr(), m_tail_neg.c_ptr(), r->name()); + res = m_context.get_rule_manager().mk(head, m_tail.size(), m_tail.data(), m_tail_neg.data(), r->name()); res->set_accounting_parent_object(m_context, r); } else { diff --git a/src/muz/transforms/dl_mk_karr_invariants.cpp b/src/muz/transforms/dl_mk_karr_invariants.cpp index 7476156b9..4436368ce 100644 --- a/src/muz/transforms/dl_mk_karr_invariants.cpp +++ b/src/muz/transforms/dl_mk_karr_invariants.cpp @@ -156,7 +156,7 @@ namespace datalog { for (unsigned i = 0; i < M.size(); ++i) { mk_body(M.A[i], M.b[i], M.eq[i], conj); } - bool_rewriter(m).mk_and(conj.size(), conj.c_ptr(), body); + bool_rewriter(m).mk_and(conj.size(), conj.data(), body); } void mk_body(vector const& row, rational const& b, bool is_eq, expr_ref_vector& conj) { @@ -179,7 +179,7 @@ namespace datalog { if (!b.is_zero()) { sum.push_back(a.mk_numeral(b, true)); } - lhs = a.mk_add(sum.size(), sum.c_ptr()); + lhs = a.mk_add(sum.size(), sum.data()); if (is_eq) { conj.push_back(m.mk_eq(lhs, zero)); } @@ -240,7 +240,7 @@ namespace datalog { for (; dit != dend; ++dit) { heads.push_back(dit->m_key); } - m_inner_ctx.rel_query(heads.size(), heads.c_ptr()); + m_inner_ctx.rel_query(heads.size(), heads.data()); // retrieve invariants. dit = src.begin_grouped_rules(); @@ -306,7 +306,7 @@ namespace datalog { } rule* new_rule = &r; if (tail.size() != tsz) { - new_rule = rm.mk(r.get_head(), tail.size(), tail.c_ptr(), nullptr, r.name()); + new_rule = rm.mk(r.get_head(), tail.size(), tail.data(), nullptr, r.name()); } rules.add_rule(new_rule); rm.mk_rule_rewrite_proof(r, *new_rule); // should be weakening rule. diff --git a/src/muz/transforms/dl_mk_loop_counter.cpp b/src/muz/transforms/dl_mk_loop_counter.cpp index b22d9fa3b..91aaa8d8b 100644 --- a/src/muz/transforms/dl_mk_loop_counter.cpp +++ b/src/muz/transforms/dl_mk_loop_counter.cpp @@ -42,7 +42,7 @@ namespace datalog { ptr_vector domain; domain.append(fn->get_num_args(), old_fn->get_domain()); domain.push_back(a.mk_int()); - new_fn = m.mk_func_decl(old_fn->get_name(), domain.size(), domain.c_ptr(), old_fn->get_range()); + new_fn = m.mk_func_decl(old_fn->get_name(), domain.size(), domain.data(), old_fn->get_range()); m_old2new.insert(old_fn, new_fn); m_new2old.insert(new_fn, old_fn); m_refs.push_back(new_fn); @@ -51,7 +51,7 @@ namespace datalog { dst.set_output_predicate(new_fn); } } - return app_ref(m.mk_app(new_fn, args.size(), args.c_ptr()), m); + return app_ref(m.mk_app(new_fn, args.size(), args.data()), m); } app_ref mk_loop_counter::del_arg(app* fn) { @@ -60,7 +60,7 @@ namespace datalog { SASSERT(fn->get_num_args() > 0); args.append(fn->get_num_args()-1, fn->get_args()); VERIFY (m_new2old.find(new_fn, old_fn)); - return app_ref(m.mk_app(old_fn, args.size(), args.c_ptr()), m); + return app_ref(m.mk_app(old_fn, args.size(), args.data()), m); } rule_set * mk_loop_counter::operator()(rule_set const & source) { @@ -108,10 +108,10 @@ namespace datalog { expr_ref_vector args(m); args.append(head->get_num_args(), head->get_args()); args[last] = a.mk_numeral(rational(0), true); - head = m.mk_app(head->get_decl(), args.size(), args.c_ptr()); + head = m.mk_app(head->get_decl(), args.size(), args.data()); } - new_rule = rm.mk(head, tail.size(), tail.c_ptr(), neg.c_ptr(), r.name(), true); + new_rule = rm.mk(head, tail.size(), tail.data(), neg.data(), r.name(), true); result->add_rule(new_rule); } @@ -145,7 +145,7 @@ namespace datalog { neg.push_back(false); } head = del_arg(r.get_head()); - new_rule = rm.mk(head, tail.size(), tail.c_ptr(), neg.c_ptr(), r.name(), true); + new_rule = rm.mk(head, tail.size(), tail.data(), neg.data(), r.name(), true); result->add_rule(new_rule); } diff --git a/src/muz/transforms/dl_mk_magic_sets.cpp b/src/muz/transforms/dl_mk_magic_sets.cpp index 85c88716c..bbf6e9508 100644 --- a/src/muz/transforms/dl_mk_magic_sets.cpp +++ b/src/muz/transforms/dl_mk_magic_sets.cpp @@ -171,11 +171,11 @@ namespace datalog { } mag_pred = m_context.mk_fresh_head_predicate(l_pred->get_name(), symbol("ms"), - mag_arity, mag_domain.c_ptr(), l_pred); + mag_arity, mag_domain.data(), l_pred); m_pinned.push_back(mag_pred); } - app * res = m.mk_app(mag_pred, bound_args.c_ptr()); + app * res = m.mk_app(mag_pred, bound_args.data()); m_pinned.push_back(res); return res; } @@ -194,7 +194,7 @@ namespace datalog { continue; } app * mag_head = create_magic_literal(tail[i]); - rule * r = m_context.get_rule_manager().mk(mag_head, i+1, new_tail.c_ptr(), negations.c_ptr()); + rule * r = m_context.get_rule_manager().mk(mag_head, i+1, new_tail.data(), negations.data()); TRACE("dl", r->display(m_context,tout); ); result.add_rule(r); } @@ -265,7 +265,7 @@ namespace datalog { app * new_head = m.mk_app(new_head_pred, head->get_args()); SASSERT(new_tail.size()==r->get_uninterpreted_tail_size()); - create_magic_rules(new_head, new_tail.size(), new_tail.c_ptr(), negations.c_ptr(), result); + create_magic_rules(new_head, new_tail.size(), new_tail.data(), negations.data(), result); unsigned tail_len = r->get_tail_size(); for (unsigned i=processed_tail_len; iname()); + rule * nr = m_context.get_rule_manager().mk(new_head, new_tail.size(), new_tail.data(), negations.data(), r->name()); result.add_rule(nr); nr->set_accounting_parent_object(m_context, r); } @@ -291,8 +291,8 @@ namespace datalog { args.push_back(m.mk_var(i, adn_pred->get_domain(i))); } - app * lit = m.mk_app(d.m_pred, args.c_ptr()); - app * adn_lit = m.mk_app(adn_pred, args.c_ptr()); + app * lit = m.mk_app(d.m_pred, args.data()); + app * adn_lit = m.mk_app(adn_pred, args.data()); app * mag_lit = create_magic_literal(adn_lit); app * tail[] = {lit, mag_lit}; diff --git a/src/muz/transforms/dl_mk_magic_sets.h b/src/muz/transforms/dl_mk_magic_sets.h index 689405724..aa4c30274 100644 --- a/src/muz/transforms/dl_mk_magic_sets.h +++ b/src/muz/transforms/dl_mk_magic_sets.h @@ -47,7 +47,7 @@ namespace datalog { }; struct a_flag_hash { - typedef a_flag data; + typedef a_flag data_t; unsigned operator()(a_flag x) const { return x; } }; diff --git a/src/muz/transforms/dl_mk_magic_symbolic.cpp b/src/muz/transforms/dl_mk_magic_symbolic.cpp index ac4efd448..59529e630 100644 --- a/src/muz/transforms/dl_mk_magic_symbolic.cpp +++ b/src/muz/transforms/dl_mk_magic_symbolic.cpp @@ -94,7 +94,7 @@ namespace datalog { tail.push_back(mk_ans(r.get_tail(j))); neg.push_back(false); } - new_rule = rm.mk(mk_ans(r.get_head()), tail.size(), tail.c_ptr(), neg.c_ptr(), r.name(), true); + new_rule = rm.mk(mk_ans(r.get_head()), tail.size(), tail.data(), neg.data(), r.name(), true); result->add_rule(new_rule); if (source.is_output_predicate(r.get_decl())) { result->set_output_predicate(new_rule->get_decl()); @@ -103,7 +103,7 @@ namespace datalog { } for (unsigned j = 0; j < utsz; ++j) { - new_rule = rm.mk(mk_query(r.get_tail(j)), tail.size()-utsz+j, tail.c_ptr(), neg.c_ptr(), r.name(), true); + new_rule = rm.mk(mk_query(r.get_tail(j)), tail.size()-utsz+j, tail.data(), neg.data(), r.name(), true); result->add_rule(new_rule); } diff --git a/src/muz/transforms/dl_mk_quantifier_abstraction.cpp b/src/muz/transforms/dl_mk_quantifier_abstraction.cpp index 603035979..a0ceb8c73 100644 --- a/src/muz/transforms/dl_mk_quantifier_abstraction.cpp +++ b/src/muz/transforms/dl_mk_quantifier_abstraction.cpp @@ -124,7 +124,7 @@ namespace datalog { 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.c_ptr(), names.c_ptr(), body); + body = m.mk_forall(names.size(), bound_sorts.data(), names.data(), body); TRACE("dl", tout << body << "\n";); // 4. replace remaining constants by variables. @@ -198,7 +198,7 @@ namespace datalog { bound.push_back(true); sorts.push_back(s1); } - arg = mk_select(arg, args.size(), args.c_ptr()); + arg = mk_select(arg, args.size(), args.data()); s = get_array_range(s); } domain.push_back(s); @@ -207,7 +207,7 @@ namespace datalog { sorts.push_back(s0); } SASSERT(old_p->get_range() == m.mk_bool_sort()); - new_p = m.mk_func_decl(old_p->get_name(), domain.size(), domain.c_ptr(), old_p->get_range()); + new_p = m.mk_func_decl(old_p->get_name(), domain.size(), domain.data(), old_p->get_range()); m_refs.push_back(new_p); m_ctx.register_predicate(new_p, false); if (m_mc) { @@ -234,7 +234,7 @@ namespace datalog { for (unsigned j = 0; j < arity; ++j) { args.push_back(m.mk_var(idx++, get_array_domain(s, j))); } - arg = mk_select(arg, arity, args.c_ptr()+args.size()-arity); + arg = mk_select(arg, arity, args.data()+args.size()-arity); s = get_array_range(s); } args.push_back(arg); @@ -244,7 +244,7 @@ namespace datalog { for (unsigned i = 0; i < args.size(); ++i) { tout << mk_pp(args[i].get(), m) << "\n"; }); - return app_ref(m.mk_app(new_p, args.size(), args.c_ptr()), m); + return app_ref(m.mk_app(new_p, args.size(), args.data()), m); } app_ref mk_quantifier_abstraction::mk_tail(rule_set const& rules, rule_set& dst, app* p) { @@ -278,7 +278,7 @@ namespace datalog { names.push_back(symbol(idx)); args.push_back(m.mk_var(idx++, vars.back())); } - arg = mk_select(arg, arity, args.c_ptr()+args.size()-arity); + arg = mk_select(arg, arity, args.data()+args.size()-arity); s = get_array_range(s); } if (is_pattern) { @@ -288,12 +288,12 @@ namespace datalog { } expr* pat = nullptr; expr_ref pattern(m); - pattern = m.mk_pattern(pats.size(), pats.c_ptr()); + pattern = m.mk_pattern(pats.size(), pats.data()); pat = pattern.get(); app_ref result(m); symbol qid, skid; - result = m.mk_app(new_p, args.size(), args.c_ptr()); - result = m.mk_eq(m.mk_forall(vars.size(), vars.c_ptr(), names.c_ptr(), result, 1, qid, skid, 1, &pat), m.mk_true()); + result = m.mk_app(new_p, args.size(), args.data()); + result = m.mk_eq(m.mk_forall(vars.size(), vars.data(), names.data(), result, 1, qid, skid, 1, &pat), m.mk_true()); return result; } @@ -301,7 +301,7 @@ namespace datalog { ptr_vector args2; args2.push_back(arg); args2.append(num_args, args); - return a.mk_select(args2.size(), args2.c_ptr()); + return a.mk_select(args2.size(), args2.data()); } rule_set * mk_quantifier_abstraction::operator()(rule_set const & source) { @@ -345,7 +345,7 @@ namespace datalog { tail.push_back(r.get_tail(j)); } head = mk_head(source, *result, r.get_head(), cnt); - fml = m.mk_implies(m.mk_and(tail.size(), tail.c_ptr()), head); + 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);); diff --git a/src/muz/transforms/dl_mk_quantifier_instantiation.cpp b/src/muz/transforms/dl_mk_quantifier_instantiation.cpp index 032b4b19c..61c395b4e 100644 --- a/src/muz/transforms/dl_mk_quantifier_instantiation.cpp +++ b/src/muz/transforms/dl_mk_quantifier_instantiation.cpp @@ -156,7 +156,7 @@ namespace datalog { SASSERT(m_binding[i]); }); m_binding.reverse(); - expr_ref res = instantiate(m, q, m_binding.c_ptr()); + expr_ref res = instantiate(m, q, m_binding.data()); m_binding.reverse(); m_cnst2var(res); conjs.push_back(res); @@ -205,7 +205,7 @@ namespace datalog { m_terms.reset(); m_var2cnst.reset(); m_cnst2var.reset(); - fml = m.mk_and(conjs.size(), conjs.c_ptr()); + fml = m.mk_and(conjs.size(), conjs.data()); for (unsigned i = 0; i < sorts.size(); ++i) { var = m.mk_var(i, sorts[i]); @@ -214,7 +214,7 @@ namespace datalog { m_cnst2var.insert(cnst, var); } - fml = m.mk_and(conjs.size(), conjs.c_ptr()); + fml = m.mk_and(conjs.size(), conjs.data()); m_var2cnst(fml); collect_egraph(fml); @@ -224,7 +224,7 @@ namespace datalog { for (auto & kv : m_funs) dealloc(kv.m_value); m_funs.reset(); - fml = m.mk_and(conjs.size(), conjs.c_ptr()); + 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";); diff --git a/src/muz/transforms/dl_mk_rule_inliner.cpp b/src/muz/transforms/dl_mk_rule_inliner.cpp index 3843123a1..1d4f05155 100644 --- a/src/muz/transforms/dl_mk_rule_inliner.cpp +++ b/src/muz/transforms/dl_mk_rule_inliner.cpp @@ -117,7 +117,7 @@ namespace datalog { std::ostringstream comb_name; comb_name << tgt.name().str() << ";" << src.name().str(); symbol combined_rule_name(comb_name.str()); - res = m_rm.mk(new_head, tail.size(), tail.c_ptr(), tail_neg.c_ptr(), combined_rule_name, m_normalize); + 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", tgt.display(m_context, tout << "tgt (" << tail_index << "): \n"); diff --git a/src/muz/transforms/dl_mk_scale.cpp b/src/muz/transforms/dl_mk_scale.cpp index 84e48d514..efa932fec 100644 --- a/src/muz/transforms/dl_mk_scale.cpp +++ b/src/muz/transforms/dl_mk_scale.cpp @@ -60,7 +60,7 @@ namespace datalog { subst.push_back(a.mk_numeral(rational(1), a.mk_real())); SASSERT(!new_fi->is_partial() && new_fi->num_entries() == 0); - tmp = vs(new_fi->get_else(), subst.size(), subst.c_ptr()); + tmp = vs(new_fi->get_else(), subst.size(), subst.data()); if (old_p->get_arity() == 0) { old_model->register_decl(old_p, tmp); } @@ -154,7 +154,7 @@ namespace datalog { tail.append(m_eqs); tail.push_back(a.mk_gt(m.mk_var(num_vars, a.mk_real()), a.mk_numeral(rational(0), false))); neg.resize(tail.size(), false); - new_rule = rm.mk(new_pred, tail.size(), tail.c_ptr(), neg.c_ptr(), r.name(), true); + new_rule = rm.mk(new_pred, tail.size(), tail.data(), neg.data(), r.name(), true); result->add_rule(new_rule); if (source.is_output_predicate(r.get_decl())) { result->set_output_predicate(new_rule->get_decl()); @@ -174,7 +174,7 @@ namespace datalog { ptr_vector domain(f->get_arity(), f->get_domain()); domain.push_back(a.mk_real()); func_decl_ref g(m); - g = m.mk_func_decl(f->get_name(), f->get_arity() + 1, domain.c_ptr(), f->get_range()); + g = m.mk_func_decl(f->get_name(), f->get_arity() + 1, domain.data(), f->get_range()); expr_ref_vector args(m); for (unsigned i = 0; i < q->get_num_args(); ++i) { expr* arg = q->get_arg(i); @@ -200,7 +200,7 @@ namespace datalog { if (m_mc) { m_mc->add_new2old(g, f); } - return app_ref(m.mk_app(g, q->get_num_args() + 1, args.c_ptr()), m); + return app_ref(m.mk_app(g, q->get_num_args() + 1, args.data()), m); } app_ref mk_scale::mk_constraint(unsigned sigma_idx, app* q) { @@ -227,7 +227,7 @@ namespace datalog { for (unsigned i = 0; i < ap->get_num_args(); ++i) { args.push_back(linearize(sigma_idx, ap->get_arg(i))); } - result = m.mk_app(ap->get_decl(), args.size(), args.c_ptr()); + result = m.mk_app(ap->get_decl(), args.size(), args.data()); } else if (a.is_numeral(e)) { result = a.mk_mul(m.mk_var(sigma_idx, a.mk_real()), e); diff --git a/src/muz/transforms/dl_mk_separate_negated_tails.cpp b/src/muz/transforms/dl_mk_separate_negated_tails.cpp index 74b1438dd..bdcd6db0c 100644 --- a/src/muz/transforms/dl_mk_separate_negated_tails.cpp +++ b/src/muz/transforms/dl_mk_separate_negated_tails.cpp @@ -67,9 +67,9 @@ namespace datalog { sorts.push_back(arg->get_sort()); } } - fn = m.mk_fresh_func_decl(p->get_decl()->get_name(), symbol("N"), sorts.size(), sorts.c_ptr(), m.mk_bool_sort()); + fn = m.mk_fresh_func_decl(p->get_decl()->get_name(), symbol("N"), sorts.size(), sorts.data(), m.mk_bool_sort()); m_ctx.register_predicate(fn, false); - q = m.mk_app(fn, args.size(), args.c_ptr()); + q = m.mk_app(fn, args.size(), args.data()); bool is_neg = true; rules.add_rule(rm.mk(q, 1, & p, &is_neg)); } @@ -101,7 +101,7 @@ namespace datalog { tail.push_back(r.get_tail(i)); neg.push_back(false); } - rules.add_rule(rm.mk(r.get_head(), tail.size(), tail.c_ptr(), neg.c_ptr(), r.name())); + rules.add_rule(rm.mk(r.get_head(), tail.size(), tail.data(), neg.data(), r.name())); } rule_set * mk_separate_negated_tails::operator()(rule_set const& src) { diff --git a/src/muz/transforms/dl_mk_slice.cpp b/src/muz/transforms/dl_mk_slice.cpp index b4b64de24..28cbf638e 100644 --- a/src/muz/transforms/dl_mk_slice.cpp +++ b/src/muz/transforms/dl_mk_slice.cpp @@ -240,7 +240,7 @@ namespace datalog { r1 = r3; } rm.to_formula(*r1.get(), concl); - proof* new_p = m.mk_hyper_resolve(premises.size(), premises.c_ptr(), concl, positions, substs); + 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", @@ -352,7 +352,7 @@ namespace datalog { } if (!new_fi->is_partial()) { TRACE("dl", tout << mk_pp(new_fi->get_else(), m) << "\n";); - tmp = vs(new_fi->get_else(), subst.size(), subst.c_ptr()); + tmp = vs(new_fi->get_else(), subst.size(), subst.data()); old_fi->set_else(tmp); } unsigned num_entries = new_fi->num_entries(); @@ -362,7 +362,7 @@ namespace datalog { func_entry const* e = new_fi->get_entry(j); for (unsigned k = 0, l = 0; k < old_p->get_arity(); ++k) { if (!is_sliced.get(k)) { - tmp = vs(e->get_arg(l++), subst.size(), subst.c_ptr()); + tmp = vs(e->get_arg(l++), subst.size(), subst.data()); args.push_back(tmp); } else { @@ -370,8 +370,8 @@ namespace datalog { } SASSERT(l <= new_p->get_arity()); } - res = vs(e->get_result(), subst.size(), subst.c_ptr()); - old_fi->insert_entry(args.c_ptr(), res.get()); + res = vs(e->get_result(), subst.size(), subst.data()); + old_fi->insert_entry(args.data(), res.get()); } old_model->register_decl(old_p, old_fi); } @@ -731,7 +731,7 @@ namespace datalog { } } if (domain.size() < bv.size()) { - f = m_ctx.mk_fresh_head_predicate(p->get_name(), symbol("slice"), domain.size(), domain.c_ptr(), p); + f = m_ctx.mk_fresh_head_predicate(p->get_name(), symbol("slice"), domain.size(), domain.data(), p); m_pinned.push_back(f); m_predicates.insert(p, f); dst.inherit_predicate(src, p, f); @@ -768,7 +768,7 @@ namespace datalog { args.push_back(p->get_arg(i)); } } - q = m.mk_app(qd, args.size(), args.c_ptr()); + q = m.mk_app(qd, args.size(), args.data()); } else { q = p; @@ -797,7 +797,7 @@ namespace datalog { tail.push_back(to_app(e)); } - new_rule = rm.mk(head.get(), tail.size(), tail.c_ptr(), (const bool*) nullptr, r.name()); + new_rule = rm.mk(head.get(), tail.size(), tail.data(), (const bool*) nullptr, r.name()); rm.fix_unbound_vars(new_rule, false); diff --git a/src/muz/transforms/dl_mk_subsumption_checker.cpp b/src/muz/transforms/dl_mk_subsumption_checker.cpp index 447976cae..b91b9e5c8 100644 --- a/src/muz/transforms/dl_mk_subsumption_checker.cpp +++ b/src/muz/transforms/dl_mk_subsumption_checker.cpp @@ -164,7 +164,7 @@ namespace datalog { } SASSERT(tail.size()==tail_neg.size()); - res = m_context.get_rule_manager().mk(head, tail.size(), tail.c_ptr(), tail_neg.c_ptr(), r->name()); + res = m_context.get_rule_manager().mk(head, tail.size(), tail.data(), tail_neg.data(), r->name()); res->set_accounting_parent_object(m_context, r); m_context.get_rule_manager().fix_unbound_vars(res, true); m_context.get_rule_manager().mk_rule_rewrite_proof(*r, *res.get()); @@ -189,7 +189,7 @@ namespace datalog { //before traversing we sort rules so that the shortest are in the beginning. //this will help make subsumption checks more efficient - std::sort(orig_rules.c_ptr(), orig_rules.c_ptr() + orig_rules.size(), rule_size_comparator); + std::sort(orig_rules.data(), orig_rules.data() + orig_rules.size(), rule_size_comparator); for (rule * r : orig_rules) { func_decl * head_pred = r->get_decl(); diff --git a/src/muz/transforms/dl_mk_synchronize.cpp b/src/muz/transforms/dl_mk_synchronize.cpp index 809b44c17..c24b0164d 100644 --- a/src/muz/transforms/dl_mk_synchronize.cpp +++ b/src/muz/transforms/dl_mk_synchronize.cpp @@ -82,7 +82,7 @@ namespace datalog { was_added = true; func_decl* orig = decls_buf[0]; func_decl* product_pred = m_ctx.mk_fresh_head_predicate(new_name, - symbol::null, domain.size(), domain.c_ptr(), orig); + symbol::null, domain.size(), domain.data(), orig); m_cache.insert(new_name, product_pred); } return; @@ -130,7 +130,7 @@ namespace datalog { rule_ref new_rule(rm); new_rule = rm.mk(r.get_head(), tail_idx + 1, - new_tail.c_ptr(), new_tail_neg.c_ptr(), symbol::null, false); + new_tail.data(), new_tail_neg.data(), symbol::null, false); rules.replace_rule(&r, new_rule.get()); } @@ -150,7 +150,7 @@ namespace datalog { rule_ref new_rule(rm); new_rule = rm.mk(r); - rm.substitute(new_rule, revsub.size(), revsub.c_ptr()); + rm.substitute(new_rule, revsub.size(), revsub.data()); return new_rule; } @@ -246,7 +246,7 @@ namespace datalog { args[idx] = a->get_arg(i); } - return app_ref(m.mk_app(pred, args_num, args.c_ptr()), m); + return app_ref(m.mk_app(pred, args_num, args.data()), m); } rule_ref mk_synchronize::product_rule(rule_ref_vector const & rules) { @@ -302,7 +302,7 @@ namespace datalog { rule_ref new_rule(rm); new_rule = rm.mk(product_head, tail_idx + 1, - new_tail.c_ptr(), new_tail_neg.c_ptr(), symbol(buffer.c_str()), false); + new_tail.data(), new_tail_neg.data(), symbol(buffer.c_str()), false); rm.fix_unbound_vars(new_rule, false); return new_rule; } diff --git a/src/muz/transforms/dl_mk_unbound_compressor.cpp b/src/muz/transforms/dl_mk_unbound_compressor.cpp index 67ae26a8d..e93209f95 100644 --- a/src/muz/transforms/dl_mk_unbound_compressor.cpp +++ b/src/muz/transforms/dl_mk_unbound_compressor.cpp @@ -72,7 +72,7 @@ namespace datalog { name_suffix << "compr_arg_" << arg_index; func_decl * cpred = m_context.mk_fresh_head_predicate(parent_name, symbol(name_suffix.str()), - arity, domain.c_ptr(), pred); + arity, domain.data(), pred); m_pinned.push_back(cpred); m_pinned.push_back(pred); @@ -154,7 +154,7 @@ namespace datalog { } } - app_ref chead(m.mk_app(cpred, head_arity-1, cargs.c_ptr()), m); + app_ref chead(m.mk_app(cpred, head_arity-1, cargs.data()), m); m_modified = true; if (r->get_tail_size()==0 && m_context.get_rule_manager().is_fact(chead)) { @@ -203,7 +203,7 @@ namespace datalog { } } SASSERT(dtail_args.size()==dtail_pred->get_arity()); - app_ref dtail(m.mk_app(dtail_pred, dtail_args.size(), dtail_args.c_ptr()), m); + app_ref dtail(m.mk_app(dtail_pred, dtail_args.size(), dtail_args.data()), m); bool_vector tails_negated; app_ref_vector tails(m); @@ -225,7 +225,7 @@ namespace datalog { tails.push_back(dtail); } - res = m_context.get_rule_manager().mk( r->get_head(), tails.size(), tails.c_ptr(), tails_negated.c_ptr()); + res = m_context.get_rule_manager().mk( r->get_head(), tails.size(), tails.data(), tails_negated.data()); res->set_accounting_parent_object(m_context, r); m_context.get_rule_manager().fix_unbound_vars(res, true); return res; diff --git a/src/nlsat/nlsat_clause.h b/src/nlsat/nlsat_clause.h index 06ede8a13..7c3416feb 100644 --- a/src/nlsat/nlsat_clause.h +++ b/src/nlsat/nlsat_clause.h @@ -45,7 +45,7 @@ namespace nlsat { literal * end() { return m_lits + m_size; } literal const * begin() const { return m_lits; } literal const * end() const { return m_lits + m_size; } - literal const * c_ptr() const { return m_lits; } + literal const * data() const { return m_lits; } void inc_activity() { m_activity++; } void set_activity(unsigned v) { m_activity = v; } unsigned get_activity() const { return m_activity; } diff --git a/src/nlsat/nlsat_explain.cpp b/src/nlsat/nlsat_explain.cpp index 5842acdfa..3f3a9cc89 100644 --- a/src/nlsat/nlsat_explain.cpp +++ b/src/nlsat/nlsat_explain.cpp @@ -174,8 +174,8 @@ namespace nlsat { std::ostream& display(std::ostream & out, literal l) const { return m_solver.display(out, l); } std::ostream& display_var(std::ostream & out, var x) const { return m_solver.display(out, x); } std::ostream& display(std::ostream & out, unsigned sz, literal const * ls) const { return m_solver.display(out, sz, ls); } - std::ostream& display(std::ostream & out, literal_vector const & ls) const { return display(out, ls.size(), ls.c_ptr()); } - std::ostream& display(std::ostream & out, scoped_literal_vector const & ls) const { return display(out, ls.size(), ls.c_ptr()); } + std::ostream& display(std::ostream & out, literal_vector const & ls) const { return display(out, ls.size(), ls.data()); } + std::ostream& display(std::ostream & out, scoped_literal_vector const & ls) const { return display(out, ls.size(), ls.data()); } /** \brief Add literal to the result vector. @@ -277,7 +277,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.c_ptr(), m_is_even.c_ptr()); + 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";); add_literal(l); @@ -468,7 +468,7 @@ namespace nlsat { atom::kind new_k = a->get_kind(); if (atom_sign < 0) new_k = atom::flip(new_k); - literal new_l = m_solver.mk_ineq_literal(new_k, ps.size(), ps.c_ptr(), is_even.c_ptr()); + literal new_l = m_solver.mk_ineq_literal(new_k, ps.size(), ps.data(), is_even.data()); if (l.sign()) new_l.neg(); return new_l; @@ -1191,7 +1191,7 @@ namespace nlsat { atom::kind new_k = _a->get_kind(); if (atom_sign < 0) new_k = atom::flip(new_k); - new_lit = m_solver.mk_ineq_literal(new_k, new_factors.size(), new_factors.c_ptr(), new_factors_even.c_ptr()); + 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";); @@ -1394,7 +1394,7 @@ namespace nlsat { 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";); - main(m_core2.size(), m_core2.c_ptr()); + main(m_core2.size(), m_core2.data()); m_core2.reset(); } else { @@ -1468,14 +1468,14 @@ namespace nlsat { break; } TRACE("nlsat_minimize", tout << "core:\n"; display(tout, core);); - r.append(core.size(), core.c_ptr()); + r.append(core.size(), core.data()); } void process(unsigned num, literal const * ls) { if (m_minimize_cores && num > 1) { m_core1.reset(); minimize(num, ls, m_core1); - process2(m_core1.size(), m_core1.c_ptr()); + process2(m_core1.size(), m_core1.data()); m_core1.reset(); } else { @@ -1515,7 +1515,7 @@ namespace nlsat { SASSERT(!a || m_evaluator.eval(a, ls[i].sign())); }); split_literals(x, num, ls, lits); - collect_polys(lits.size(), lits.c_ptr(), m_ps); + collect_polys(lits.size(), lits.data(), m_ps); var mx_var = max_var(m_ps); if (!m_ps.empty()) { svector renaming; @@ -1524,7 +1524,7 @@ namespace nlsat { renaming.push_back(i); } std::swap(renaming[x], renaming[mx_var]); - m_solver.reorder(renaming.size(), renaming.c_ptr()); + m_solver.reorder(renaming.size(), renaming.data()); TRACE("qe", tout << "x: " << x << " max: " << mx_var << " num_vars: " << m_solver.num_vars() << "\n"; m_solver.display(tout);); } @@ -1549,7 +1549,7 @@ namespace nlsat { result.set(i, ~result[i]); } DEBUG_CODE( - TRACE("nlsat", m_solver.display(tout, result.size(), result.c_ptr()) << "\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";); SASSERT(l_true == m_solver.value(l)); @@ -1809,7 +1809,7 @@ namespace nlsat { svector lits; polynomial_ref p(m_pm); split_literals(x, num, ls, lits); - collect_polys(lits.size(), lits.c_ptr(), m_ps); + collect_polys(lits.size(), lits.data(), m_ps); unbounded = true; scoped_anum x_val(m_am); x_val = m_assignment.value(x); diff --git a/src/nlsat/nlsat_interval_set.cpp b/src/nlsat/nlsat_interval_set.cpp index c50fcb5ea..70b2bd02c 100644 --- a/src/nlsat/nlsat_interval_set.cpp +++ b/src/nlsat/nlsat_interval_set.cpp @@ -263,7 +263,7 @@ namespace nlsat { new_set->m_full = full; new_set->m_ref_count = 0; new_set->m_num_intervals = sz; - memcpy(new_set->m_intervals, buf.c_ptr(), sizeof(interval)*sz); + memcpy(new_set->m_intervals, buf.data(), sizeof(interval)*sz); return new_set; } @@ -470,7 +470,7 @@ namespace nlsat { } SASSERT(!result.empty()); - SASSERT(check_interval_set(m_am, result.size(), result.c_ptr())); + SASSERT(check_interval_set(m_am, result.size(), result.data())); // Compress // Remark: we only combine adjacent intervals when they have the same justification unsigned j = 0; @@ -506,7 +506,7 @@ namespace nlsat { m_am.del(curr.m_upper); } result.shrink(j); - SASSERT(check_interval_set(m_am, result.size(), result.c_ptr())); + SASSERT(check_interval_set(m_am, result.size(), result.data())); sz = j; SASSERT(sz >= 1); bool found_slack = !result[0].m_lower_inf || !result[sz-1].m_upper_inf; diff --git a/src/nlsat/nlsat_scoped_literal_vector.h b/src/nlsat/nlsat_scoped_literal_vector.h index eee258bbe..a2b617e55 100644 --- a/src/nlsat/nlsat_scoped_literal_vector.h +++ b/src/nlsat/nlsat_scoped_literal_vector.h @@ -47,7 +47,7 @@ namespace nlsat { m_solver.dec_ref(m_lits[i]); m_lits[i] = l; } - literal const * c_ptr() const { return m_lits.c_ptr(); } + literal const * data() const { return m_lits.data(); } literal const * begin() const { return m_lits.begin(); } literal const * end() const { return m_lits.end(); } void shrink(unsigned new_sz) { @@ -65,7 +65,7 @@ namespace nlsat { push_back(ls[i]); } void append(scoped_literal_vector const& ls) { - append(ls.size(), ls.c_ptr()); + append(ls.size(), ls.data()); } void swap(scoped_literal_vector& other) { SASSERT(&m_solver == &other.m_solver); diff --git a/src/nlsat/nlsat_solver.cpp b/src/nlsat/nlsat_solver.cpp index 62855b8aa..568a25a29 100644 --- a/src/nlsat/nlsat_solver.cpp +++ b/src/nlsat/nlsat_solver.cpp @@ -401,7 +401,7 @@ namespace nlsat { } var max_var(clause const & cls) const { - return max_var(cls.size(), cls.c_ptr()); + return max_var(cls.size(), cls.data()); } /** @@ -605,7 +605,7 @@ namespace nlsat { void * mem = m_allocator.allocate(ineq_atom::get_obj_size(sz)); if (sign < 0) k = atom::flip(k); - ineq_atom * tmp_atom = new (mem) ineq_atom(k, sz, uniq_ps.c_ptr(), is_even, max); + 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; tout << "mk_ineq_atom hash: " << h(tmp_atom) << "\n"; display(tout, *tmp_atom, m_display_var) << "\n";); @@ -840,7 +840,7 @@ namespace nlsat { ps.push_back(ia.p(i)); is_even.push_back(ia.is_even(i)); } - bv = checker.mk_ineq_atom(ia.get_kind(), sz, ps.c_ptr(), is_even.c_ptr()); + bv = checker.mk_ineq_atom(ia.get_kind(), sz, ps.data(), is_even.data()); } else if (a->is_root_atom()) { root_atom& r = *to_root_atom(a); @@ -864,7 +864,7 @@ namespace nlsat { for (literal lit : *c) { lits.push_back(literal(tr[lit.var()], lit.sign())); } - checker.mk_clause(lits.size(), lits.c_ptr(), nullptr); + checker.mk_clause(lits.size(), lits.data(), nullptr); } } for (unsigned i = 0; i < n; ++i) { @@ -936,7 +936,7 @@ namespace nlsat { log_lemma(verbose_stream(), *cls); } if (learned && m_check_lemmas) { - check_lemma(cls->size(), cls->c_ptr(), false, cls->assumptions()); + check_lemma(cls->size(), cls->data(), false, cls->assumptions()); } if (learned) m_learned.push_back(cls); @@ -1254,7 +1254,7 @@ namespace nlsat { m_ism.get_justifications(s, core, clauses); if (include_l) core.push_back(~l); - assign(l, mk_lazy_jst(m_allocator, core.size(), core.c_ptr(), clauses.size(), clauses.c_ptr())); + assign(l, mk_lazy_jst(m_allocator, core.size(), core.data(), clauses.size(), clauses.data())); SASSERT(value(l) == l_true); } @@ -1585,7 +1585,7 @@ namespace nlsat { m_lemma.push_back(~mk_ineq_literal(atom::LT, 1, &p2, &is_even)); // perform branch and bound - clause * cls = mk_clause(m_lemma.size(), m_lemma.c_ptr(), false, nullptr); + clause * cls = mk_clause(m_lemma.size(), m_lemma.data(), false, nullptr); if (cls) { TRACE("nlsat", display(tout << "conflict " << lo << " " << hi, *cls); tout << "\n";); } @@ -1644,7 +1644,7 @@ namespace nlsat { lbool check(literal_vector& assumptions) { literal_vector result; unsigned sz = assumptions.size(); - literal const* ptr = assumptions.c_ptr(); + literal const* ptr = assumptions.data(); for (unsigned i = 0; i < sz; ++i) { mk_clause(1, ptr+i, (assumption)(ptr+i)); } @@ -1668,7 +1668,7 @@ namespace nlsat { del_clauses(m_valids); if (m_check_lemmas) { for (clause* c : m_learned) { - check_lemma(c->size(), c->c_ptr(), false, nullptr); + check_lemma(c->size(), c->data(), false, nullptr); } } @@ -1701,7 +1701,7 @@ namespace nlsat { bool collect(literal_vector const& assumptions, clause const& c) { unsigned sz = assumptions.size(); - literal const* ptr = assumptions.c_ptr(); + literal const* ptr = assumptions.data(); _assumption_set asms = static_cast<_assumption_set>(c.assumptions()); if (asms == nullptr) { return false; @@ -1796,7 +1796,7 @@ namespace nlsat { void resolve_clause(bool_var b, clause const & c) { TRACE("nlsat_resolve", tout << "resolving clause for b: " << b << "\n"; display(tout, c) << "\n";); - resolve_clause(b, c.size(), c.c_ptr()); + resolve_clause(b, c.size(), c.data()); m_lemma_assumptions = m_asm.mk_join(static_cast<_assumption_set>(c.assumptions()), m_lemma_assumptions); } @@ -1812,7 +1812,7 @@ namespace nlsat { for (unsigned i = 0; i < sz; i++) { core.push_back(~jst.lit(i)); } - display_mathematica_lemma(tout, core.size(), core.c_ptr(), true);); + display_mathematica_lemma(tout, core.size(), core.data(), true);); m_lazy_clause.reset(); m_explain(jst.num_lits(), jst.lits(), m_lazy_clause); @@ -1820,15 +1820,15 @@ 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.c_ptr());); - TRACE("nlsat_proof_sk", tout << "theory lemma\n"; display_abst(tout, m_lazy_clause.size(), m_lazy_clause.c_ptr()); tout << "\n";); + 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.c_ptr()) << "\n";); + display(tout, m_lazy_clause.size(), m_lazy_clause.data()) << "\n";); if (m_check_lemmas) { - m_valids.push_back(mk_clause_core(m_lazy_clause.size(), m_lazy_clause.c_ptr(), false, nullptr)); + m_valids.push_back(mk_clause_core(m_lazy_clause.size(), m_lazy_clause.data(), false, nullptr)); } DEBUG_CODE({ @@ -1846,7 +1846,7 @@ namespace nlsat { } }); checkpoint(); - resolve_clause(b, m_lazy_clause.size(), m_lazy_clause.c_ptr()); + resolve_clause(b, m_lazy_clause.size(), m_lazy_clause.data()); for (unsigned i = 0; i < jst.num_clauses(); ++i) { clause const& c = jst.clause(i); @@ -2034,7 +2034,7 @@ namespace nlsat { // If lemma only contains literals from previous stages, then we can stop. // We make progress by returning to a previous stage with additional information (new lemma) // that forces us to select a new partial interpretation - if (only_literals_from_previous_stages(m_lemma.size(), m_lemma.c_ptr())) + if (only_literals_from_previous_stages(m_lemma.size(), m_lemma.data())) break; // Conflict does not depend on the current decision, and it is still in the current stage. @@ -2044,7 +2044,7 @@ namespace nlsat { // - backtrack to this level // - 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.c_ptr()); + 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";); SASSERT(max_lvl < scope_lvl()); remove_literals_from_lvl(m_lemma, max_lvl); @@ -2063,11 +2063,11 @@ namespace nlsat { } reset_marks(); // remove marks from the literals in m_lemmas. - TRACE("nlsat", tout << "new lemma:\n"; display(tout, m_lemma.size(), m_lemma.c_ptr()); 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 (false && m_check_lemmas) { - check_lemma(m_lemma.size(), m_lemma.c_ptr(), false, m_lemma_assumptions.get()); + check_lemma(m_lemma.size(), m_lemma.data(), false, m_lemma_assumptions.get()); } // There are two possibilities: @@ -2089,18 +2089,18 @@ namespace nlsat { // Case 1) // 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.c_ptr()); + var new_max_var = max_var(sz, m_lemma.data()); 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.c_ptr(), true, m_lemma_assumptions.get()); + 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"; if (new_max_var != null_var) m_display_var(tout, new_max_var) << "\n";); } else { SASSERT(scope_lvl() >= 1); // Case 2) - if (is_bool_lemma(m_lemma.size(), m_lemma.c_ptr())) { + if (is_bool_lemma(m_lemma.size(), m_lemma.data())) { // boolean lemma, we just backtrack until the last literal is unassigned. bool_var max_bool_var = m_lemma[m_lemma.size()-1].var(); undo_until_unassigned(max_bool_var); @@ -2109,7 +2109,7 @@ namespace nlsat { // We must find the maximal decision level in literals in the first sz-1 positions that // 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.c_ptr()); + 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";); undo_until_level(new_lvl); } @@ -2119,7 +2119,7 @@ namespace nlsat { VERIFY(process_clause(*conflict_clause, true)); return true; } - new_cls = mk_clause(sz, m_lemma.c_ptr(), true, m_lemma_assumptions.get()); + new_cls = mk_clause(sz, m_lemma.data(), true, m_lemma_assumptions.get()); } NLSAT_VERBOSE(display(verbose_stream(), *new_cls) << "\n";); @@ -2345,7 +2345,7 @@ namespace nlsat { for (var x = 0; x < num; x++) { perm[new_order[x]] = x; } - reorder(perm.size(), perm.c_ptr()); + reorder(perm.size(), perm.data()); SASSERT(check_invariant()); } @@ -2356,8 +2356,8 @@ namespace nlsat { p.push_back(x); } random_gen r(++m_random_seed); - shuffle(p.size(), p.c_ptr(), r); - reorder(p.size(), p.c_ptr()); + shuffle(p.size(), p.data(), r); + reorder(p.size(), p.data()); } bool can_reorder() const { @@ -2440,7 +2440,7 @@ namespace nlsat { // m_inv_perm: external -> internal var_vector p; p.append(m_perm); - reorder(p.size(), p.c_ptr()); + reorder(p.size(), p.data()); DEBUG_CODE({ for (var x = 0; x < num_vars(); x++) { SASSERT(m_perm[x] == x); @@ -2569,7 +2569,7 @@ namespace nlsat { } 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";); - apply_permutation(sz, cs, m_cs_p.c_ptr()); + 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"; }); } @@ -2577,7 +2577,7 @@ namespace nlsat { unsigned num = num_vars(); for (unsigned i = 0; i < num; i++) { clause_vector & ws = m_watches[i]; - sort_clauses_by_degree(ws.size(), ws.c_ptr()); + sort_clauses_by_degree(ws.size(), ws.data()); } } @@ -2740,7 +2740,7 @@ namespace nlsat { even.push_back(a1.is_even(i)); } if (!change) continue; - literal l = mk_ineq_literal(k, ps.size(), ps.c_ptr(), even.c_ptr()); + literal l = mk_ineq_literal(k, ps.size(), ps.data(), even.data()); lits.push_back(l); if (a1.m_bool_var != l.var()) { b2l.insert(a1.m_bool_var, l); @@ -2787,7 +2787,7 @@ namespace nlsat { is_sat = false; } else { - mk_clause(lits.size(), lits.c_ptr(), c->is_learned(), static_cast<_assumption_set>(c->assumptions())); + mk_clause(lits.size(), lits.data(), c->is_learned(), static_cast<_assumption_set>(c->assumptions())); } } } @@ -3274,7 +3274,7 @@ namespace nlsat { } std::ostream& display(std::ostream & out, scoped_literal_vector const & cs) { - return display(out, cs.size(), cs.c_ptr(), m_display_var); + return display(out, cs.size(), cs.data(), m_display_var); } std::ostream& display(std::ostream & out, clause const & c, display_var_proc const & proc) const { @@ -3282,7 +3282,7 @@ namespace nlsat { display_assumptions(out, static_cast<_assumption_set>(c.assumptions())); out << " |- "; } - return display(out, c.size(), c.c_ptr(), proc); + return display(out, c.size(), c.data(), proc); } std::ostream& display(std::ostream & out, clause const & c) const { @@ -3308,7 +3308,7 @@ namespace nlsat { } std::ostream& display_smt2(std::ostream & out, clause const & c, display_var_proc const & proc = display_var_proc()) const { - return display_smt2(out, c.size(), c.c_ptr(), proc); + return display_smt2(out, c.size(), c.data(), proc); } std::ostream& display_abst(std::ostream & out, literal l) const { @@ -3336,11 +3336,11 @@ namespace nlsat { } std::ostream& display_abst(std::ostream & out, scoped_literal_vector const & cs) const { - return display_abst(out, cs.size(), cs.c_ptr()); + return display_abst(out, cs.size(), cs.data()); } std::ostream& display_abst(std::ostream & out, clause const & c) const { - return display_abst(out, c.size(), c.c_ptr()); + return display_abst(out, c.size(), c.data()); } std::ostream& display_mathematica(std::ostream & out, clause const & c) const { @@ -3672,7 +3672,7 @@ namespace nlsat { } std::ostream& solver::display(std::ostream & out, literal_vector const& ls) const { - return display(out, ls.size(), ls.c_ptr()); + return display(out, ls.size(), ls.data()); } std::ostream& solver::display_smt2(std::ostream & out, literal l) const { @@ -3688,7 +3688,7 @@ namespace nlsat { } std::ostream& solver::display_smt2(std::ostream & out, literal_vector const& ls) const { - return display_smt2(out, ls.size(), ls.c_ptr()); + return display_smt2(out, ls.size(), ls.data()); } std::ostream& solver::display(std::ostream & out, var x) const { diff --git a/src/nlsat/tactic/goal2nlsat.cpp b/src/nlsat/tactic/goal2nlsat.cpp index 0efda9baa..e779fc7fb 100644 --- a/src/nlsat/tactic/goal2nlsat.cpp +++ b/src/nlsat/tactic/goal2nlsat.cpp @@ -106,7 +106,7 @@ struct goal2nlsat::imp { } if (m_qm.is_neg(fs.get_constant())) k = flip(k); - return m_solver.mk_ineq_atom(k, ps.size(), ps.c_ptr(), is_even.c_ptr()); + return m_solver.mk_ineq_atom(k, ps.size(), ps.data(), is_even.data()); } nlsat::literal process_atom(app * f, nlsat::atom::kind k) { @@ -248,7 +248,7 @@ struct goal2nlsat::imp { for (unsigned i = 0; i < num_lits; i++) { ls.push_back(process_literal(lits[i])); } - m_solver.mk_clause(ls.size(), ls.c_ptr(), dep); + m_solver.mk_clause(ls.size(), ls.data(), dep); } void operator()(goal const & g) { diff --git a/src/opt/maxres.cpp b/src/opt/maxres.cpp index 3c5834797..e87965133 100644 --- a/src/opt/maxres.cpp +++ b/src/opt/maxres.cpp @@ -318,11 +318,11 @@ public: } first = false; m_last_index = index; - is_sat = check_sat(index, asms.c_ptr()); + is_sat = check_sat(index, asms.data()); } } else { - is_sat = check_sat(asms.size(), asms.c_ptr()); + is_sat = check_sat(asms.size(), asms.data()); } return is_sat; } @@ -390,7 +390,7 @@ public: model_ref mdl; get_mus_model(mdl); is_sat = minimize_core(_core); - core.append(_core.size(), _core.c_ptr()); + core.append(_core.size(), _core.data()); DEBUG_CODE(verify_core(core);); ++m_stats.m_num_cores; if (is_sat != l_true) { @@ -459,11 +459,11 @@ public: void sort_assumptions(expr_ref_vector& _asms) { compare_asm comp(*this); - exprs asms(_asms.size(), _asms.c_ptr()); + exprs asms(_asms.size(), _asms.data()); expr_ref_vector trail(_asms); std::sort(asms.begin(), asms.end(), comp); _asms.reset(); - _asms.append(asms.size(), asms.c_ptr()); + _asms.append(asms.size(), asms.data()); DEBUG_CODE( for (unsigned i = 0; i + 1 < asms.size(); ++i) { SASSERT(get_weight(asms[i]) >= get_weight(asms[i+1])); @@ -536,7 +536,7 @@ public: TRACE("opt", display_vec(tout << "minimized core: ", core);); IF_VERBOSE(10, display_vec(verbose_stream() << "core: ", core);); max_resolve(core, w); - fml = mk_not(m, mk_and(m, core.size(), core.c_ptr())); + fml = mk_not(m, mk_and(m, core.size(), core.data())); add(fml); // save small cores such that lex-combinations of maxres can reuse these cores. if (core.size() <= 2) { @@ -593,7 +593,7 @@ public: return l_true; } m_mus.reset(); - m_mus.add_soft(core.size(), core.c_ptr()); + m_mus.add_soft(core.size(), core.data()); lbool is_sat = m_mus.get_mus(m_new_core); if (is_sat != l_true) { return is_sat; @@ -631,11 +631,11 @@ public: } void display_vec(std::ostream& out, exprs const& exprs) { - display_vec(out, exprs.size(), exprs.c_ptr()); + display_vec(out, exprs.size(), exprs.data()); } void display_vec(std::ostream& out, expr_ref_vector const& exprs) { - display_vec(out, exprs.size(), exprs.c_ptr()); + display_vec(out, exprs.size(), exprs.data()); } void display_vec(std::ostream& out, unsigned sz, expr* const* args) const { @@ -656,7 +656,7 @@ public: expr_ref fml(m), asum(m); app_ref cls(m), d(m), dd(m); m_B.reset(); - m_B.append(core.size(), core.c_ptr()); + m_B.append(core.size(), core.data()); // // d_0 := true // d_i := b_{i-1} and d_{i-1} for i = 1...sz-1 @@ -708,7 +708,7 @@ public: expr_ref fml(m), asum(m); app_ref cls(m), d(m), dd(m); m_B.reset(); - m_B.append(cs.size(), cs.c_ptr()); + m_B.append(cs.size(), cs.data()); d = m.mk_false(); // // d_0 := false @@ -771,7 +771,7 @@ public: void relax_cores(vector const& cores) { vector wcores; for (auto & core : cores) { - exprs _core(core.size(), core.c_ptr()); + exprs _core(core.size(), core.data()); wcores.push_back(weighted_core(_core, core_weight(_core))); remove_soft(_core, m_asms); split_core(_core); @@ -842,7 +842,7 @@ public: nsoft.push_back(mk_not(m, s.s)); weights.push_back(s.weight); } - fml = u.mk_lt(nsoft.size(), weights.c_ptr(), nsoft.c_ptr(), m_upper); + fml = u.mk_lt(nsoft.size(), weights.data(), nsoft.data(), m_upper); TRACE("opt", tout << "block upper bound " << fml << "\n";);; add(fml); } @@ -906,7 +906,7 @@ public: void verify_core(exprs const& core) { return; - IF_VERBOSE(1, verbose_stream() << "verify core " << s().check_sat(core.size(), core.c_ptr()) << "\n";); + IF_VERBOSE(1, verbose_stream() << "verify core " << s().check_sat(core.size(), core.data()) << "\n";); ref _solver = mk_smt_solver(m, m_params, symbol()); _solver->assert_expr(s().get_assertions()); _solver->assert_expr(core); diff --git a/src/opt/maxsmt.cpp b/src/opt/maxsmt.cpp index f93039c21..6a8a2ee35 100644 --- a/src/opt/maxsmt.cpp +++ b/src/opt/maxsmt.cpp @@ -72,7 +72,7 @@ namespace opt { fmls.push_back(s.s); } pb_util pb(m); - tmp = pb.mk_ge(weights.size(), weights.c_ptr(), fmls.c_ptr(), k); + tmp = pb.mk_ge(weights.size(), weights.data(), fmls.data(), k); TRACE("opt", tout << "cost: " << cost << "\n" << tmp << "\n";); s().assert_expr(tmp); } @@ -194,10 +194,10 @@ namespace opt { return; } maxsmt_compare_soft cmp(new_soft); - ptr_vector _mutex(mutex.size(), mutex.c_ptr()); + ptr_vector _mutex(mutex.size(), mutex.data()); std::sort(_mutex.begin(), _mutex.end(), cmp); mutex.reset(); - mutex.append(_mutex.size(), _mutex.c_ptr()); + mutex.append(_mutex.size(), _mutex.data()); rational weight(0), sum1(0), sum2(0); vector weights; @@ -208,7 +208,7 @@ namespace opt { new_soft.remove(e); } for (unsigned i = mutex.size(); i-- > 0; ) { - expr_ref soft(m.mk_or(i+1, mutex.c_ptr()), m); + expr_ref soft(m.mk_or(i+1, mutex.data()), m); m_trail.push_back(soft); rational w = weights[i]; weight = w - weight; diff --git a/src/opt/opt_context.cpp b/src/opt/opt_context.cpp index ffb83e30d..c522dbf60 100644 --- a/src/opt/opt_context.cpp +++ b/src/opt/opt_context.cpp @@ -215,7 +215,7 @@ namespace opt { for (unsigned i = 0; i < o.m_terms.size(); ++i) { args.push_back(m.mk_ite(o.m_terms[i], zero, m_arith.mk_numeral(o.m_weights[i], false))); } - result = m_arith.mk_add(args.size(), args.c_ptr()); + result = m_arith.mk_add(args.size(), args.data()); break; case O_MAXIMIZE: result = o.m_term; @@ -299,7 +299,7 @@ namespace opt { IF_VERBOSE(1, verbose_stream() << "(optimize:check-sat)\n"); - lbool is_sat = s.check_sat(asms.size(),asms.c_ptr()); + lbool is_sat = s.check_sat(asms.size(),asms.data()); TRACE("opt", s.display(tout << "initial search result: " << is_sat << "\n");); if (is_sat != l_false) { @@ -581,10 +581,10 @@ namespace opt { } } if (is_ge) { - result = pb.mk_ge(sz, coeffs.c_ptr(), terms.c_ptr(), k); + result = pb.mk_ge(sz, coeffs.data(), terms.data(), k); } else { - result = pb.mk_le(sz, coeffs.c_ptr(), terms.c_ptr(), k); + result = pb.mk_le(sz, coeffs.data(), terms.data(), k); } break; } @@ -869,7 +869,7 @@ namespace opt { expr_dependency_ref core(r->dep(i), m); m.linearize(core, deps); if (!deps.empty()) { - fmls.push_back(m.mk_implies(m.mk_and(deps.size(), deps.c_ptr()), r->form(i))); + fmls.push_back(m.mk_implies(m.mk_and(deps.size(), deps.data()), r->form(i))); } else { fmls.push_back(r->form(i)); @@ -879,7 +879,7 @@ namespace opt { ptr_vector core_elems; expr_dependency_ref core(r->dep(0), m); m.linearize(core, core_elems); - m_core.append(core_elems.size(), core_elems.c_ptr()); + m_core.append(core_elems.size(), core_elems.data()); } } @@ -1029,7 +1029,7 @@ namespace opt { case O_MAXSMT: name = "maxsat"; break; default: break; } - func_decl* f = m.mk_fresh_func_decl(name,"", domain.size(), domain.c_ptr(), m.mk_bool_sort()); + func_decl* f = m.mk_fresh_func_decl(name,"", domain.size(), domain.data(), m.mk_bool_sort()); m_objective_fns.insert(f, index); m_objective_refs.push_back(f); m_objective_orig.insert(f, sz > 0 ? args[0] : nullptr); @@ -1175,7 +1175,7 @@ namespace opt { args.push_back(purify(fm, arg)); } } - term = m_arith.mk_add(args.size(), args.c_ptr()); + 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";); @@ -1247,7 +1247,7 @@ namespace opt { fmls.push_back(mk_maximize(i, obj.m_term)); break; case O_MAXSMT: - fmls.push_back(mk_maxsat(i, obj.m_terms.size(), obj.m_terms.c_ptr())); + fmls.push_back(mk_maxsat(i, obj.m_terms.size(), obj.m_terms.data())); break; } } @@ -1353,7 +1353,7 @@ namespace opt { ) { objective& o = m_objectives[0]; unsigned sz = o.m_terms.size(); - inc_sat_display(verbose_stream(), get_solver(), sz, o.m_terms.c_ptr(), o.m_weights.c_ptr()); + inc_sat_display(verbose_stream(), get_solver(), sz, o.m_terms.data(), o.m_weights.data()); } @@ -1481,7 +1481,7 @@ namespace opt { switch(args.size()) { case 0: return expr_ref(m_arith.mk_numeral(rational(0), true), m); case 1: return expr_ref(args[0].get(), m); - default: return expr_ref(m_arith.mk_add(args.size(), args.c_ptr()), m); + default: return expr_ref(m_arith.mk_add(args.size(), args.data()), m); } } @@ -1582,7 +1582,7 @@ namespace opt { std::ostringstream strm; m_sat_solver = mk_inc_sat_solver(m, m_params); m_sat_solver->assert_expr(m_hard_constraints); - inc_sat_display(strm, *m_sat_solver.get(), soft_f.size(), soft_f.c_ptr(), soft_w.c_ptr()); + inc_sat_display(strm, *m_sat_solver.get(), soft_f.size(), soft_f.data(), soft_w.data()); return strm.str(); } diff --git a/src/opt/opt_lns.cpp b/src/opt/opt_lns.cpp index 018c1fab9..ba5a071d3 100644 --- a/src/opt/opt_lns.cpp +++ b/src/opt/opt_lns.cpp @@ -96,7 +96,7 @@ namespace opt { m_hardened.reset(); for (expr* a : ctx.soft()) m_is_assumption.mark(a); - shuffle(m_unprocessed.size(), m_unprocessed.c_ptr(), m_rand); + shuffle(m_unprocessed.size(), m_unprocessed.data(), m_rand); model_ref mdl = m_best_model->copy(); unsigned j = 0; diff --git a/src/opt/opt_parse.cpp b/src/opt/opt_parse.cpp index 6469cc35c..f1aa40886 100644 --- a/src/opt/opt_parse.cpp +++ b/src/opt/opt_parse.cpp @@ -134,7 +134,7 @@ class wcnf { if (parsed_lit < 0) p = m.mk_not(p); ors.push_back(p); } - result = to_app(mk_or(m, ors.size(), ors.c_ptr())); + result = to_app(mk_or(m, ors.size(), ors.data())); return result; } @@ -222,7 +222,7 @@ class opb { in.skip_whitespace(); while ('0' <= *in && *in <='9') num.push_back(*in), ++in; num.push_back(0); - return rational(num.c_ptr()); + return rational(num.data()); } app_ref parse_coeff() { @@ -410,7 +410,7 @@ private: c = in.ch(); } m_buffer.push_back(0); - m_tokens.push_back(asymbol(symbol(m_buffer.c_ptr()), in.line())); + m_tokens.push_back(asymbol(symbol(m_buffer.data()), in.line())); IF_VERBOSE(10, verbose_stream() << "tok: " << m_tokens.back() << "\n"); continue; } @@ -456,7 +456,7 @@ private: } } m_buffer.push_back(0); - m_tokens.push_back(asymbol(symbol(m_buffer.c_ptr()), in.line())); + m_tokens.push_back(asymbol(symbol(m_buffer.data()), in.line())); IF_VERBOSE(10, verbose_stream() << "tok: " << m_tokens.back() << "\n"); } } @@ -868,7 +868,7 @@ private: } result.push_back(term); } - return expr_ref(a.mk_add(result.size(), result.c_ptr()), m); + return expr_ref(a.mk_add(result.size(), result.data()), m); } expr_ref mk_var(symbol const& v) { diff --git a/src/opt/opt_solver.cpp b/src/opt/opt_solver.cpp index 1e5941b39..658c95ed9 100644 --- a/src/opt/opt_solver.cpp +++ b/src/opt/opt_solver.cpp @@ -357,7 +357,7 @@ namespace opt { r.reset(); buffer tmp; m_context.get_relevant_labels(nullptr, tmp); - r.append(tmp.size(), tmp.c_ptr()); + r.append(tmp.size(), tmp.data()); } void opt_solver::set_progress_callback(progress_callback * callback) { diff --git a/src/opt/optsmt.cpp b/src/opt/optsmt.cpp index c8c254179..8c7a1c49a 100644 --- a/src/opt/optsmt.cpp +++ b/src/opt/optsmt.cpp @@ -433,7 +433,7 @@ namespace opt { for (unsigned i = 0; i < m_lower.size() && m.inc(); ++i) { if (m_lower[i] <= mid[i] && mid[i] <= m_upper[i] && m_lower[i] < m_upper[i]) { th.enable_record_conflict(bounds[i].get()); - lbool is_sat = m_s->check_sat(1, bounds.c_ptr() + i); + lbool is_sat = m_s->check_sat(1, bounds.data() + i); switch(is_sat) { case l_true: IF_VERBOSE(2, verbose_stream() << "(optsmt lower bound for v" << m_vars[i] << " := " << m_upper[i] << ")\n";); diff --git a/src/opt/pb_sls.cpp b/src/opt/pb_sls.cpp index 315b6f22a..82802819d 100644 --- a/src/opt/pb_sls.cpp +++ b/src/opt/pb_sls.cpp @@ -663,7 +663,7 @@ namespace smt { coeffs.push_back(pb.get_coeff(f2, i)); k += pb.get_coeff(f2, i); } - tmp = pb.mk_ge(coeffs.size(), coeffs.c_ptr(), args.c_ptr(), k); + tmp = pb.mk_ge(coeffs.size(), coeffs.data(), args.data(), k); return compile_clause(tmp, cls); } else if (pb.is_ge(f) || pb.is_eq(f)) { diff --git a/src/opt/sortmax.cpp b/src/opt/sortmax.cpp index 83ef72a83..c6a2f04a9 100644 --- a/src/opt/sortmax.cpp +++ b/src/opt/sortmax.cpp @@ -67,7 +67,7 @@ namespace opt { --n; } } - m_sort.sorting(in.size(), in.c_ptr(), out); + m_sort.sorting(in.size(), in.data(), out); // initialize sorting network outputs using the initial assignment. unsigned first = 0; diff --git a/src/parsers/smt2/smt2parser.cpp b/src/parsers/smt2/smt2parser.cpp index 3afe67cb9..7601cbb14 100644 --- a/src/parsers/smt2/smt2parser.cpp +++ b/src/parsers/smt2/smt2parser.cpp @@ -541,7 +541,7 @@ namespace smt2 { unsigned epos = sexpr_stack().size(); SASSERT(epos >= spos); unsigned num = epos - spos; - sexpr * r = sm().mk_composite(num, sexpr_stack().c_ptr() + spos, line, pos); + sexpr * r = sm().mk_composite(num, sexpr_stack().data() + spos, line, pos); sexpr_stack().shrink(spos); sexpr_stack().push_back(r); m_stack.deallocate(fr); @@ -632,7 +632,7 @@ namespace smt2 { args.push_back(u); next(); } - sort * r = d->instantiate(pm(), args.size(), args.c_ptr()); + sort * r = d->instantiate(pm(), args.size(), args.data()); if (r == nullptr) throw parser_exception("invalid sort application"); next(); @@ -664,7 +664,7 @@ namespace smt2 { throw parser_exception("invalid number of parameters to sort constructor"); } - psort * r = pm().mk_psort_app(m_sort_id2param_idx.size(), d, num, psort_stack().c_ptr() + spos); + psort * r = pm().mk_psort_app(m_sort_id2param_idx.size(), d, num, psort_stack().data() + spos); psort_stack().shrink(spos); psort_stack().push_back(r); m_stack.deallocate(fr); @@ -725,7 +725,7 @@ namespace smt2 { 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().c_ptr() + spos); + sort * r = d->instantiate(pm(), num, sort_stack().data() + spos); if (r == nullptr) throw parser_exception("invalid sort application"); sort_stack().shrink(spos); @@ -849,7 +849,7 @@ namespace smt2 { next(); paccessor_decl_ref_buffer new_a_decls(pm()); parse_accessor_decls(new_a_decls); - ct_decls.push_back(pm().mk_pconstructor_decl(m_sort_id2param_idx.size(), ct_name, r_name, new_a_decls.size(), new_a_decls.c_ptr())); + ct_decls.push_back(pm().mk_pconstructor_decl(m_sort_id2param_idx.size(), ct_name, r_name, new_a_decls.size(), new_a_decls.data())); check_rparen_next("invalid constructor declaration, ')' expected"); } } @@ -877,14 +877,14 @@ namespace smt2 { } symbol dt_name = m_dt_names[i]; parse_datatype_dec(nullptr, new_ct_decls); - d = pm().mk_pdatatype_decl(m_dt_name2arity.find(dt_name), dt_name, new_ct_decls.size(), new_ct_decls.c_ptr()); + d = pm().mk_pdatatype_decl(m_dt_name2arity.find(dt_name), dt_name, new_ct_decls.size(), new_ct_decls.data()); } else { check_lparen_next("invalid datatype declaration, '(' or ')' expected"); symbol dt_name = check_identifier_next("invalid datatype declaration, symbol (datatype name) expected"); m_dt_name2idx.insert(dt_name, i); parse_constructor_decls(new_ct_decls); - d = pm().mk_pdatatype_decl(m_sort_id2param_idx.size(), dt_name, new_ct_decls.size(), new_ct_decls.c_ptr()); + d = pm().mk_pdatatype_decl(m_sort_id2param_idx.size(), dt_name, new_ct_decls.size(), new_ct_decls.data()); check_rparen_next("invalid datatype declaration, ')' expected"); } new_dt_decls.push_back(d); @@ -908,7 +908,7 @@ namespace smt2 { else { SASSERT(sz > 1); pdatatypes_decl_ref dts(pm()); - dts = pm().mk_pdatatypes_decl(m_sort_id2param_idx.size(), sz, new_dt_decls.c_ptr()); + dts = pm().mk_pdatatypes_decl(m_sort_id2param_idx.size(), sz, new_dt_decls.data()); symbol missing; if (!pm().fix_missing_refs(dts, missing)) { std::string err_msg = "invalid datatype declaration, unknown sort '"; @@ -952,7 +952,7 @@ namespace smt2 { pdatatype_decl_ref d(pm()); pconstructor_decl_ref_buffer new_ct_decls(pm()); parse_datatype_dec(&dt_name, new_ct_decls); - d = pm().mk_pdatatype_decl(m_sort_id2param_idx.size(), dt_name, new_ct_decls.size(), new_ct_decls.c_ptr()); + d = pm().mk_pdatatype_decl(m_sort_id2param_idx.size(), dt_name, new_ct_decls.size(), new_ct_decls.data()); check_missing(d, line, pos); check_duplicate(d, line, pos); @@ -1277,8 +1277,8 @@ namespace smt2 { } next(); TRACE("parse_sorted_vars", tout << "[after] symbol_stack().size(): " << symbol_stack().size() << "\n";); - symbol const * sym_it = symbol_stack().c_ptr() + sym_spos; - sort * const * sort_it = sort_stack().c_ptr() + sort_spos; + symbol const * sym_it = symbol_stack().data() + sym_spos; + sort * const * sort_it = sort_stack().data() + sort_spos; m_num_bindings += num; unsigned i = num; while (i > 0) { @@ -1410,7 +1410,7 @@ namespace smt2 { new_case = cases[i]; } else { - new_case = sub(cases[i], subst.size(), subst.c_ptr()); + new_case = sub(cases[i], subst.size(), subst.data()); inv_var_shifter inv(m()); inv(new_case, subst.size(), new_case); } @@ -1542,7 +1542,7 @@ namespace smt2 { m_env.insert(vars[i], local(v, m_num_bindings)); } } - expr_stack().push_back(m().mk_app(f, args.size(), args.c_ptr())); + expr_stack().push_back(m().mk_app(f, args.size(), args.data())); } symbol parse_indexed_identifier_core() { @@ -1807,7 +1807,7 @@ namespace smt2 { return; } expr_ref t_ref(m()); - m_ctx.mk_app(r, 0, nullptr, num_indices, m_param_stack.c_ptr() + param_spos, has_as ? sort_stack().back() : nullptr, t_ref); + m_ctx.mk_app(r, 0, nullptr, num_indices, m_param_stack.data() + param_spos, has_as ? sort_stack().back() : nullptr, t_ref); m_param_stack.shrink(param_spos); expr_stack().push_back(t_ref.get()); if (has_as) { @@ -1914,9 +1914,9 @@ namespace smt2 { else { m_ctx.mk_app(fr->m_f, num_args, - expr_stack().c_ptr() + fr->m_expr_spos, + expr_stack().data() + fr->m_expr_spos, num_indices, - m_param_stack.c_ptr() + fr->m_param_spos, + m_param_stack.data() + fr->m_param_spos, fr->m_as_sort ? sort_stack().back() : nullptr, t_ref); } @@ -1940,8 +1940,8 @@ namespace smt2 { throw parser_exception("malformed let expression"); } unsigned num_decls = expr_stack().size() - fr->m_expr_spos; - symbol * sym_it = symbol_stack().c_ptr() + fr->m_sym_spos; - expr ** expr_it = expr_stack().c_ptr() + fr->m_expr_spos; + symbol * sym_it = symbol_stack().data() + fr->m_sym_spos; + expr ** expr_it = expr_stack().data() + fr->m_expr_spos; expr ** expr_end = expr_it + num_decls; for (; expr_it != expr_end; ++expr_it, ++sym_it) { TRACE("let_frame", tout << "declaring: " << *sym_it << " " << mk_pp(*expr_it, m()) << "\n";); @@ -2004,14 +2004,14 @@ namespace smt2 { throw parser_exception("quantifier body must be a Boolean expression"); quantifier* new_q = m().mk_quantifier(fr->m_kind, num_decls, - sort_stack().c_ptr() + fr->m_sort_spos, - symbol_stack().c_ptr() + fr->m_sym_spos, + sort_stack().data() + fr->m_sort_spos, + symbol_stack().data() + fr->m_sym_spos, expr_stack().back(), fr->m_weight, fr->m_qid, fr->m_skid, - num_pats, pattern_stack().c_ptr() + fr->m_pat_spos, - num_nopats, nopattern_stack().c_ptr() + fr->m_nopat_spos + 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";); @@ -2049,7 +2049,7 @@ namespace smt2 { } else { unsigned num = expr_stack().size() - fr->m_expr_spos; - expr * new_pat = m().mk_pattern(num, reinterpret_cast(expr_stack().c_ptr() + fr->m_expr_spos)); + expr * new_pat = m().mk_pattern(num, reinterpret_cast(expr_stack().data() + fr->m_expr_spos)); expr_stack().shrink(fr->m_expr_spos); expr_stack().push_back(new_pat); } @@ -2273,7 +2273,7 @@ namespace smt2 { parse_expr(); if (expr_stack().back()->get_sort() != sort_stack().back()) throw parser_exception("invalid function/constant definition, sort mismatch"); - sort* const* sorts = sort_stack().c_ptr() + sort_spos; + sort* const* sorts = sort_stack().data() + sort_spos; expr* t = expr_stack().back(); if (is_fun) { expr_ref _t(t, m()); @@ -2392,10 +2392,10 @@ namespace smt2 { unsigned num_vars = parse_sorted_vars(); SASSERT(num_vars == m_num_bindings); parse_sort("Invalid recursive function definition"); - recfun::promise_def pdef = m_ctx.decl_rec_fun(id, num_vars, sort_stack().c_ptr() + sort_spos, sort_stack().back()); + recfun::promise_def pdef = m_ctx.decl_rec_fun(id, num_vars, sort_stack().data() + sort_spos, sort_stack().back()); f = pdef.get_def()->get_decl(); - bindings.append(num_vars, expr_stack().c_ptr() + expr_spos); - ids.append(num_vars, symbol_stack().c_ptr() + sym_spos); + bindings.append(num_vars, expr_stack().data() + expr_spos); + ids.append(num_vars, symbol_stack().data() + sym_spos); symbol_stack().shrink(sym_spos); sort_stack().shrink(sort_spos); expr_stack().shrink(expr_spos); @@ -2426,7 +2426,7 @@ namespace smt2 { unsigned sym_spos = symbol_stack().size(); unsigned num_vars = bindings.size(); m_env.begin_scope(); - m_symbol_stack.append(ids.size(), ids.c_ptr()); + m_symbol_stack.append(ids.size(), ids.data()); m_num_bindings = num_vars; for (unsigned i = 0; i < num_vars; ++i) { m_env.insert(ids[i], local(bindings[i], num_vars)); @@ -2479,7 +2479,7 @@ namespace smt2 { unsigned num_params = parse_sorts("Parsing function declaration. Expecting sort list '('"); parse_sort("Invalid function declaration"); func_decl_ref f(m()); - f = m().mk_func_decl(id, num_params, sort_stack().c_ptr() + spos, sort_stack().back()); + f = m().mk_func_decl(id, num_params, sort_stack().data() + spos, sort_stack().back()); sort_stack().shrink(spos); m_ctx.insert(f); check_rparen("invalid function declaration, ')' expected"); @@ -2602,7 +2602,7 @@ namespace smt2 { next(); unsigned spos = expr_stack().size(); parse_assumptions(); - m_ctx.check_sat(expr_stack().size() - spos, expr_stack().c_ptr() + spos); + m_ctx.check_sat(expr_stack().size() - spos, expr_stack().data() + spos); next(); expr_stack().shrink(spos); } @@ -2615,7 +2615,7 @@ namespace smt2 { check_lparen_next("invalid check-sat-assuming command, '(', expected"); parse_assumptions(); check_rparen_next("invalid check-sat-assuming command, ')', expected"); - m_ctx.check_sat(expr_stack().size() - spos, expr_stack().c_ptr() + spos); + m_ctx.check_sat(expr_stack().size() - spos, expr_stack().data() + spos); next(); expr_stack().shrink(spos); } @@ -2664,7 +2664,7 @@ namespace smt2 { m_ctx.get_opt()->get_box_model(md, index); } m_ctx.regular_stream() << "("; - expr ** expr_it = expr_stack().c_ptr() + spos; + expr ** expr_it = expr_stack().data() + spos; expr ** expr_end = expr_it + m_cached_strings.size(); md->compress(); for (unsigned i = 0; expr_it < expr_end; expr_it++, i++) { @@ -2752,7 +2752,7 @@ namespace smt2 { parse_sorts("Invalid function name. Expecting sort list starting with '(' to disambiguate function name"); unsigned domain_size = sort_stack().size() - spos; parse_sort("Invalid function name"); - func_decl * d = m_ctx.find_func_decl(id, indices.size(), indices.c_ptr(), domain_size, sort_stack().c_ptr() + spos, sort_stack().back()); + func_decl * d = m_ctx.find_func_decl(id, indices.size(), indices.data(), domain_size, sort_stack().data() + spos, sort_stack().back()); sort_stack().shrink(spos); check_rparen_next("invalid function declaration reference, ')' expected"); return d; @@ -2818,7 +2818,7 @@ namespace smt2 { case CPK_SYMBOL_LIST: { unsigned spos = m_symbol_stack.size(); unsigned num = parse_symbols(); - m_curr_cmd->set_next_arg(m_ctx, num, m_symbol_stack.c_ptr() + spos); + m_curr_cmd->set_next_arg(m_ctx, num, m_symbol_stack.data() + spos); break; } case CPK_SORT: @@ -2828,7 +2828,7 @@ namespace smt2 { case CPK_SORT_LIST: { unsigned spos = sort_stack().size(); unsigned num = parse_sorts("expecting sort list starting with '('"); - m_curr_cmd->set_next_arg(m_ctx, num, sort_stack().c_ptr() + spos); + m_curr_cmd->set_next_arg(m_ctx, num, sort_stack().data() + spos); break; } case CPK_EXPR: @@ -2838,7 +2838,7 @@ namespace smt2 { case CPK_EXPR_LIST: { unsigned spos = expr_stack().size(); unsigned num = parse_exprs(); - m_curr_cmd->set_next_arg(m_ctx, num, expr_stack().c_ptr() + spos); + m_curr_cmd->set_next_arg(m_ctx, num, expr_stack().data() + spos); break; } case CPK_FUNC_DECL: { @@ -2849,7 +2849,7 @@ namespace smt2 { case CPK_FUNC_DECL_LIST: { ptr_buffer flist; parse_func_decl_refs(flist); - m_curr_cmd->set_next_arg(m_ctx, flist.size(), flist.c_ptr()); + m_curr_cmd->set_next_arg(m_ctx, flist.size(), flist.data()); return; } case CPK_SORTED_VAR: diff --git a/src/parsers/util/scanner.cpp b/src/parsers/util/scanner.cpp index 29d837794..2a5923ee2 100644 --- a/src/parsers/util/scanner.cpp +++ b/src/parsers/util/scanner.cpp @@ -26,7 +26,7 @@ inline int scanner::read_char() { if (m_bpos >= m_bend) { m_buffer[0] = m_last_char; - m_stream.read(m_buffer.c_ptr()+1, m_buffer.size()-1); + m_stream.read(m_buffer.data()+1, m_buffer.size()-1); m_bend = 1 + static_cast(m_stream.gcount()); m_bpos = 1; m_last_char = m_buffer[m_bend-1]; @@ -178,7 +178,7 @@ bool scanner::read_params() { ch = read_char(); if (ch == ':' || ch == ']') { m_string.push_back(0); - m_params.push_back(parameter(symbol(m_string.c_ptr()))); + m_params.push_back(parameter(symbol(m_string.data()))); param_num = 0; if (ch == ':') { unread_char(); diff --git a/src/parsers/util/simple_parser.cpp b/src/parsers/util/simple_parser.cpp index 48c42c240..0157f1c11 100644 --- a/src/parsers/util/simple_parser.cpp +++ b/src/parsers/util/simple_parser.cpp @@ -79,7 +79,7 @@ expr * simple_parser::parse_expr(scanner & s) { args.push_back(arg); } else { - expr * r = m_manager.mk_app(op.m_family_id, op.m_kind, args.size(), args.c_ptr()); + expr * r = m_manager.mk_app(op.m_family_id, op.m_kind, args.size(), args.data()); m_exprs.push_back(r); return r; } diff --git a/src/qe/mbp/mbp_arith.cpp b/src/qe/mbp/mbp_arith.cpp index 42e48649b..b0f8f9eb5 100644 --- a/src/qe/mbp/mbp_arith.cpp +++ b/src/qe/mbp/mbp_arith.cpp @@ -343,7 +343,7 @@ namespace mbp { 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.c_ptr(), compute_def); + vector defs = mbo.project(real_vars.size(), real_vars.data(), compute_def); vector rows; mbo.get_live_rows(rows); diff --git a/src/qe/mbp/mbp_arrays.cpp b/src/qe/mbp/mbp_arrays.cpp index 3602b2d39..149d11987 100644 --- a/src/qe/mbp/mbp_arrays.cpp +++ b/src/qe/mbp/mbp_arrays.cpp @@ -102,7 +102,7 @@ namespace { for (expr* e : v) sorts.push_back (e->get_sort()); } - m_decl = m.mk_func_decl (symbol (PARTIAL_EQ), sorts.size (), sorts.c_ptr (), m.mk_bool_sort ()); + m_decl = m.mk_func_decl (symbol (PARTIAL_EQ), sorts.size (), sorts.data (), m.mk_bool_sort ()); } expr_ref lhs () { return m_lhs; } @@ -117,9 +117,9 @@ namespace { args.push_back (m_lhs); args.push_back (m_rhs); for (auto const& v : m_diff_indices) { - args.append (v.size(), v.c_ptr()); + args.append (v.size(), v.data()); } - m_peq = m.mk_app (m_decl, args.size (), args.c_ptr ()); + m_peq = m.mk_app (m_decl, args.size (), args.data ()); } return m_peq; } @@ -135,7 +135,7 @@ namespace { for (expr_ref_vector const& diff : m_diff_indices) { ptr_vector store_args; store_args.push_back (rhs); - store_args.append (diff.size(), diff.c_ptr()); + store_args.append (diff.size(), diff.data()); app_ref val(m.mk_fresh_const ("diff", val_sort), m); store_args.push_back (val); aux_consts.push_back (val); @@ -306,7 +306,7 @@ namespace mbp { if (!all_done) continue; todo.pop_back (); - expr_ref a_new (m.mk_app (a->get_decl (), args.size (), args.c_ptr ()), m); + expr_ref a_new (m.mk_app (a->get_decl (), args.size (), args.data ()), m); // if a_new is select on m_v, introduce new constant if (m_arr_u.is_select (a) && @@ -358,7 +358,7 @@ namespace mbp { // mk val term ptr_vector sel_args; sel_args.push_back (arr); - sel_args.append(I[i].size(), I[i].c_ptr()); + sel_args.append(I[i].size(), I[i].data()); expr_ref val_term (m_arr_u.mk_select (sel_args), m); // evaluate and assign to ith diff_val_const val = (*m_mev)(val_term); @@ -452,7 +452,7 @@ namespace mbp { // arr1[idx] == x ptr_vector sel_args; sel_args.push_back (arr1); - sel_args.append(idxs.size(), idxs.c_ptr()); + sel_args.append(idxs.size(), idxs.data()); expr_ref arr1_idx (m_arr_u.mk_select (sel_args), m); expr_ref eq (m.mk_eq (arr1_idx, x), m); m_aux_lits_v.push_back (eq); @@ -774,7 +774,7 @@ namespace mbp { todo.pop_back (); if (dirty) { - r = m.mk_app (a->get_decl (), args.size (), args.c_ptr ()); + r = m.mk_app (a->get_decl (), args.size (), args.data ()); m_pinned.push_back (r); } else { @@ -1073,7 +1073,7 @@ namespace mbp { for (unsigned i = start; i < m_idxs.size(); ++i) { xs.append(m_idxs[i].idx); } - m_idx_lits.push_back(m.mk_distinct(xs.size(), xs.c_ptr())); + m_idx_lits.push_back(m.mk_distinct(xs.size(), xs.data())); } else { datatype::util dt(m); @@ -1085,7 +1085,7 @@ namespace mbp { name << "get" << (i++); acc.push_back(mk_accessor_decl(m, symbol(name.str()), type_ref(x->get_sort()))); } - constructor_decl* constrs[1] = { mk_constructor_decl(symbol("tuple"), symbol("is-tuple"), acc.size(), acc.c_ptr()) }; + constructor_decl* constrs[1] = { mk_constructor_decl(symbol("tuple"), symbol("is-tuple"), acc.size(), acc.data()) }; datatype::def* dts = mk_datatype_decl(dt, symbol("tuple"), 0, nullptr, 1, constrs); VERIFY(dt.plugin().mk_datatypes(1, &dts, 0, nullptr, srts)); del_datatype_decl(dts); @@ -1093,9 +1093,9 @@ namespace mbp { ptr_vector const & decls = *dt.get_datatype_constructors(tuple); expr_ref_vector xs(m); for (unsigned i = start; i < m_idxs.size(); ++i) { - xs.push_back(m.mk_app(decls[0], m_idxs[i].idx.size(), m_idxs[i].idx.c_ptr())); + xs.push_back(m.mk_app(decls[0], m_idxs[i].idx.size(), m_idxs[i].idx.data())); } - m_idx_lits.push_back(m.mk_distinct(xs.size(), xs.c_ptr())); + m_idx_lits.push_back(m.mk_distinct(xs.size(), xs.data())); } } @@ -1273,7 +1273,7 @@ namespace mbp { args[0] = result; args.push_back(var); - result = a.mk_store(args.size(), args.c_ptr()); + result = a.mk_store(args.size(), args.data()); } expr_safe_replace sub(m); sub.insert(s, result); diff --git a/src/qe/mbp/mbp_datatypes.cpp b/src/qe/mbp/mbp_datatypes.cpp index 2af469a1e..798258599 100644 --- a/src/qe/mbp/mbp_datatypes.cpp +++ b/src/qe/mbp/mbp_datatypes.cpp @@ -81,7 +81,7 @@ namespace mbp { model.register_decl(arg->get_decl(), m_val->get_arg(i)); args.push_back(arg); } - val = m.mk_app(f, args.size(), args.c_ptr()); + val = m.mk_app(f, args.size(), args.data()); TRACE("qe", tout << mk_pp(m_var->x(), m) << " |-> " << val << "\n";); reduce(val, lits); } diff --git a/src/qe/mbp/mbp_term_graph.cpp b/src/qe/mbp/mbp_term_graph.cpp index ad180df26..52d633417 100644 --- a/src/qe/mbp/mbp_term_graph.cpp +++ b/src/qe/mbp/mbp_term_graph.cpp @@ -424,7 +424,7 @@ namespace mbp { for (expr * arg : *a) { kids.push_back (mk_app(arg)); } - app* res = m.mk_app(a->get_decl(), a->get_num_args(), kids.c_ptr()); + app* res = m.mk_app(a->get_decl(), a->get_num_args(), kids.data()); m_pinned.push_back(res); return res; } @@ -610,7 +610,7 @@ namespace mbp { } TRACE("qe_verbose", tout << *ch << " -> " << mk_pp(e, m) << "\n";); } - expr* pure = m.mk_app(a->get_decl(), kids.size(), kids.c_ptr()); + expr* pure = m.mk_app(a->get_decl(), kids.size(), kids.data()); m_pinned.push_back(pure); add_term2app(t, pure); return pure; @@ -712,7 +712,7 @@ namespace mbp { } } if (diff.size() > 1) { - res.push_back(m.mk_distinct(diff.size(), diff.c_ptr())); + res.push_back(m.mk_distinct(diff.size(), diff.data())); } else { TRACE("qe", tout << "skipping " << mk_pp(lit, m) << "\n";); @@ -802,7 +802,7 @@ namespace mbp { args.push_back(r); } TRACE("qe", tout << "function: " << d->get_name() << "\n";); - res.push_back(m.mk_distinct(args.size(), args.c_ptr())); + res.push_back(m.mk_distinct(args.size(), args.data())); } } } @@ -915,7 +915,7 @@ namespace mbp { // -- sort representatives, call mk_distinct on any range // -- of the same sort longer than 1 - std::sort(reps.c_ptr(), reps.c_ptr() + reps.size(), sort_lt_proc()); + std::sort(reps.data(), reps.data() + reps.size(), sort_lt_proc()); unsigned i = 0; unsigned sz = reps.size(); while (i < sz) { @@ -928,7 +928,7 @@ namespace mbp { if (!m.is_true(d)) res.push_back(d); } else if (j - i > 2) - res.push_back(m.mk_distinct(j - i, reps.c_ptr() + i)); + res.push_back(m.mk_distinct(j - i, reps.data() + i)); i = j; } TRACE("qe", tout << "after distinct: " << res << "\n";); diff --git a/src/qe/nlarith_util.cpp b/src/qe/nlarith_util.cpp index 24b4e64e9..e5c4300a5 100644 --- a/src/qe/nlarith_util.cpp +++ b/src/qe/nlarith_util.cpp @@ -528,7 +528,7 @@ namespace nlarith { tout << " 0 [-oo] --> " << mk_pp(t1.get(), m()) << "\n";); } TRACE("nlarith", tout << "inf-branch\n";); - bc.add_branch(mk_and(es.size(), es.c_ptr()), m().mk_true(), subst, mk_inf(bc), z(), z(), z()); + bc.add_branch(mk_and(es.size(), es.data()), m().mk_true(), subst, mk_inf(bc), z(), z(), z()); } void create_branch_l(unsigned j, unsigned i, polys const& polys, comps const& comps, @@ -552,7 +552,7 @@ namespace nlarith { rp->set_substitution(&sub); if (a != z()) es.push_back(mk_eq(a)); es.push_back(mk_ne(b)); - cond = mk_and(es.size(), es.c_ptr()); + cond = mk_and(es.size(), es.data()); es.push_back(bc.preds(i)); for (unsigned k = 0; k < polys.size(); ++k) { mk_subst(cmp, polys[k], comps[k], e0, t1); @@ -560,7 +560,7 @@ namespace nlarith { es.push_back(m().mk_implies(bc.preds(k), t2)); subst.push_back(t1); } - bc.add_branch(mk_and(es.size(), es.c_ptr()), cond, subst, mk_def(cmp, abc_poly(*this, z(), b, c), e0), a, b, c); + bc.add_branch(mk_and(es.size(), es.data()), cond, subst, mk_def(cmp, abc_poly(*this, z(), b, c), e0), a, b, c); } if (i == j && a != z()) { @@ -579,7 +579,7 @@ namespace nlarith { es.push_back(m().mk_implies(bc.preds(k), t1)); subst.push_back(t1); } - bc.add_branch(mk_and(es.size(), es.c_ptr()), cond, subst, mk_def(cmp, abc_poly(*this, a2, b, z()),e1), a, b, c); + bc.add_branch(mk_and(es.size(), es.data()), cond, subst, mk_def(cmp, abc_poly(*this, a2, b, z()),e1), a, b, c); } } @@ -616,7 +616,7 @@ namespace nlarith { rp->set_substitution(&sub); if (a != z()) es.push_back(mk_eq(a)); es.push_back(mk_ne(b)); - cond = mk_and(es.size(), es.c_ptr()); + cond = mk_and(es.size(), es.data()); es.push_back(bc.preds(i)); for (unsigned j = 0; j < polys.size(); ++j) { mk_subst(cmp, polys[j], comps[j], e0, t1); @@ -624,7 +624,7 @@ namespace nlarith { es.push_back(m().mk_implies(bc.preds(j), t2)); subst.push_back(t2); } - branch = mk_and(es.size(), es.c_ptr()); + branch = mk_and(es.size(), es.data()); bc.add_branch(branch, cond, subst, mk_def(cmp, abc_poly(*this, z(), b, c), e0), a, b, c); } @@ -635,14 +635,14 @@ namespace nlarith { subst.reset(); es.push_back(mk_ne(a)); es.push_back(mk_ge(d)); - cond = mk_and(es.size(), es.c_ptr()); + cond = mk_and(es.size(), es.data()); es.push_back(bc.preds(i)); for (unsigned j = 0; j < polys.size(); ++j) { mk_subst(cmp, polys[j], comps[j], e1, t1); es.push_back(m().mk_implies(bc.preds(j), t1)); subst.push_back(t1); } - branch = mk_and(es.size(), es.c_ptr()); + 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";); @@ -657,7 +657,7 @@ namespace nlarith { es.push_back(m().mk_implies(bc.preds(j), t1)); subst.push_back(t1); } - branch = mk_and(es.size(), es.c_ptr()); + 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";); } @@ -953,7 +953,7 @@ namespace nlarith { } TRACE("nlarith_verbose", display(tout, r); display(tout <<" * ", other); display(tout << " = ", result); tout <<"\n";); r.reset(); - r.append(result.size(), result.c_ptr()); + r.append(result.size(), result.data()); } void mk_mul(poly& p, expr* e) { @@ -1261,13 +1261,13 @@ namespace nlarith { tmp.push_back(mk_mul(xx.get(), p[i])); xx = mk_mul(x, xx.get()); } - result = mk_add(tmp.size(), tmp.c_ptr()); + result = mk_add(tmp.size(), tmp.data()); } app* mk_zero(poly const& p) { app_ref_vector tmp(m()); mk_zero(p, tmp); - return mk_and(tmp.size(), reinterpret_cast(tmp.c_ptr())); + return mk_and(tmp.size(), reinterpret_cast(tmp.data())); } void mk_zero(poly const& p, app_ref_vector& zeros) { @@ -1495,7 +1495,7 @@ namespace nlarith { equivs.push_back(m().mk_implies(literals.literal(i), tmp)); new_atoms.push_back(tmp); } - fml = mk_and(equivs.size(), equivs.c_ptr()); + fml = mk_and(equivs.size(), equivs.data()); } void mk_plus_inf_sign(util::literal_set const& literals, app_ref& fml, app_ref_vector& new_atoms) { plus_inf_subst sub(*this); @@ -1520,7 +1520,7 @@ namespace nlarith { mk_same_sign (literals, false, conjs, new_atoms); mk_lt(literals.x(), literals.x_inf(), conjs, new_atoms); mk_lt(literals.x_sup(), literals.x(), conjs, new_atoms); - fml = mk_and(conjs.size(), conjs.c_ptr()); + fml = mk_and(conjs.size(), conjs.data()); } void mk_lt(app* x, app* y, expr_ref_vector& conjs, app_ref_vector& new_atoms) { app* atm = mk_lt(mk_sub(x,y)); @@ -1545,7 +1545,7 @@ namespace nlarith { new_atoms.push_back(fml); ors.push_back(fml); } - conjs.push_back(mk_or(ors.size(), ors.c_ptr())); + conjs.push_back(mk_or(ors.size(), ors.data())); } /* @@ -1831,7 +1831,7 @@ namespace nlarith { // p'(x) > 0 -> r(y+epsilon) > 0 & r(z-epsilon) > 0 mk_bound_ext(p1_lt0, p1, p, lits.x_sup(), lits.x_inf(), conjs, new_atoms); mk_bound_ext(p1_gt0, p1_m, p, lits.x_sup(), lits.x_inf(), conjs, new_atoms); - fml = mk_and(conjs.size(), conjs.c_ptr()); + fml = mk_and(conjs.size(), conjs.data()); simple_branch* br = alloc(simple_branch, m(), fml); swap_atoms(br, lits.lits(), new_atoms); return br; diff --git a/src/qe/nlqsat.cpp b/src/qe/nlqsat.cpp index a332a651c..6439a91c9 100644 --- a/src/qe/nlqsat.cpp +++ b/src/qe/nlqsat.cpp @@ -209,13 +209,13 @@ namespace qe { } void display_assumptions(std::ostream& out) { - m_solver.display(out << "assumptions: ", m_asms.size(), m_asms.c_ptr()); + m_solver.display(out << "assumptions: ", m_asms.size(), m_asms.data()); out << "\n"; } void display_preds(std::ostream& out) { for (unsigned i = 0; i < m_preds.size(); ++i) { - m_solver.display(out << i << ": ", m_preds[i]->size(), m_preds[i]->c_ptr()); + m_solver.display(out << i << ": ", m_preds[i]->size(), m_preds[i]->data()); out << "\n"; } } @@ -361,8 +361,8 @@ namespace qe { out << "(declare-const x" << kv.m_key << " Real)\n"; } s.m_solver.display(out << "(assert (not (exists ((", v) << " Real)) \n"; - s.m_solver.display_smt2(out << "(and ", r1.size(), r1.c_ptr()) << "))))\n"; - s.m_solver.display_smt2(out << "(assert (and ", r2.size(), r2.c_ptr()); out << "))\n"; + s.m_solver.display_smt2(out << "(and ", r1.size(), r1.data()) << "))))\n"; + s.m_solver.display_smt2(out << "(assert (and ", r2.size(), r2.data()); out << "))\n"; out << "(check-sat)\n(reset)\n"; } @@ -380,13 +380,13 @@ namespace qe { result.push_back(lit); } } - TRACE("qe", s.m_solver.display(tout, result.size(), result.c_ptr()); 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.c_ptr(), new_result); + ex.project(vars[i], result.size(), result.data(), new_result); TRACE("qe", display_project(tout, vars[i], result, new_result);); TRACE("qe", display_project(std::cout, vars[i], result, new_result);); result.swap(new_result); @@ -413,12 +413,12 @@ namespace qe { cl.push_back(~s.m_solver.mk_true()); } SASSERT(!cl.empty()); - nlsat::literal_vector lits(cl.size(), cl.c_ptr()); - s.m_solver.mk_clause(lits.size(), lits.c_ptr()); + nlsat::literal_vector lits(cl.size(), cl.data()); + s.m_solver.mk_clause(lits.size(), lits.data()); } max_level get_level(clause const& cl) { - return get_level(cl.size(), cl.c_ptr()); + return get_level(cl.size(), cl.data()); } max_level get_level(unsigned n, nlsat::literal const* ls) { @@ -857,7 +857,7 @@ namespace qe { ptr_vector fmls; expr_ref fml(m); in->get_formulas(fmls); - fml = mk_and(m, fmls.size(), fmls.c_ptr()); + fml = mk_and(m, fmls.size(), fmls.data()); if (m_mode == elim_t) { fml = m.mk_not(fml); } diff --git a/src/qe/qe.cpp b/src/qe/qe.cpp index c534b6726..da0ea8cf7 100644 --- a/src/qe/qe.cpp +++ b/src/qe/qe.cpp @@ -144,9 +144,9 @@ namespace qe { } } bool_rewriter rewriter(m); - rewriter.mk_and(conjs_closed.size(), conjs_closed.c_ptr(), fml_closed); - rewriter.mk_and(conjs_mixed.size(), conjs_mixed.c_ptr(), fml_mixed); - rewriter.mk_and(conjs_open.size(), conjs_open.c_ptr(), fml_open); + rewriter.mk_and(conjs_closed.size(), conjs_closed.data(), fml_closed); + rewriter.mk_and(conjs_mixed.size(), conjs_mixed.data(), fml_mixed); + rewriter.mk_and(conjs_open.size(), conjs_open.data(), fml_open); TRACE("qe", tout << "closed\n" << mk_ismt2_pp(fml_closed, m) << "\n"; @@ -699,7 +699,7 @@ namespace qe { } } if (all_visit) { - m_cache.insert(e, m.mk_app(e->get_decl(), m_args.size(), m_args.c_ptr())); + m_cache.insert(e, m.mk_app(e->get_decl(), m_args.size(), m_args.data())); } } else if (m.is_not(e, f)) { @@ -1105,7 +1105,7 @@ namespace qe { search_tree* st = alloc(search_tree, this, m, m.mk_true()); m_children.push_back(st); st->init(fml); - st->m_vars.append(m_vars.size(), m_vars.c_ptr()); + st->m_vars.append(m_vars.size(), m_vars.data()); SASSERT(invariant()); TRACE("qe", display_node(tout); st->display_node(tout);); return st; @@ -1119,7 +1119,7 @@ namespace qe { search_tree* st = alloc(search_tree, this, m, assignment); m_children.push_back(st); m_branch_index.insert(branch_id, index); - st->m_vars.append(m_vars.size(), m_vars.c_ptr()); + st->m_vars.append(m_vars.size(), m_vars.data()); SASSERT(invariant()); TRACE("qe", display_node(tout); st->display_node(tout);); return st; @@ -1182,7 +1182,7 @@ namespace qe { if (fml) { // abstract free variables in children. ptr_vector child_vars, new_vars; - child_vars.append(child.m_vars.size(), child.m_vars.c_ptr()); + child_vars.append(child.m_vars.size(), child.m_vars.data()); if (child.m_var) { child_vars.push_back(child.m_var); } @@ -1196,7 +1196,7 @@ namespace qe { fmls.push_back(fml); } } - bool_rewriter(m).mk_or(fmls.size(), fmls.c_ptr(), fml); + bool_rewriter(m).mk_or(fmls.size(), fmls.data(), fml); fml = mk_not(m, m.mk_iff(q, fml)); ast_smt_pp pp(m); @@ -1467,7 +1467,7 @@ namespace qe { if (!get_first) { expr_ref_vector result(m); m_root.get_leaves(result); - m_bool_rewriter.mk_or(result.size(), result.c_ptr(), fml); + m_bool_rewriter.mk_or(result.size(), result.data(), fml); } if (defs) { @@ -1634,12 +1634,12 @@ namespace qe { expr_ref tmp(r_args[0], m); get_max_relevant(is_relevant, tmp, subfml); i_args.push_back(tmp); - fml = m.mk_app(a->get_decl(), i_args.size(), i_args.c_ptr()); + fml = m.mk_app(a->get_decl(), i_args.size(), i_args.data()); } else { - subfml = m.mk_app(a->get_decl(), r_args.size(), r_args.c_ptr()); + subfml = m.mk_app(a->get_decl(), r_args.size(), r_args.data()); i_args.push_back(subfml); - fml = m.mk_app(a->get_decl(), i_args.size(), i_args.c_ptr()); + fml = m.mk_app(a->get_decl(), i_args.size(), i_args.data()); } } else { @@ -1735,10 +1735,10 @@ namespace qe { cont.push_back(&contains(i)); vars.push_back(m_current->free_var(i)); } - m_conjs.get_partition(fml, num_vars, vars.c_ptr(), fml_closed, fml_mixed, fml_open); + m_conjs.get_partition(fml, num_vars, vars.data(), fml_closed, fml_mixed, fml_open); if (m.is_and(fml_open) && m_conjs.partition_vars( - num_vars, cont.c_ptr(), + num_vars, cont.data(), to_app(fml_open)->get_num_args(), to_app(fml_open)->get_args(), m_partition)) { process_partition(); @@ -1940,7 +1940,7 @@ namespace qe { ptr_vector vars; bool closed = true; while (extract_partition(vars)) { - lbool r = m_qe.eliminate_exists(vars.size(), vars.c_ptr(), fml, m_free_vars, m_get_first, m_defs); + lbool r = m_qe.eliminate_exists(vars.size(), vars.data(), fml, m_free_vars, m_get_first, m_defs); vars.reset(); closed = closed && (r != l_undef); } @@ -2078,7 +2078,7 @@ namespace qe { } if (!free_vars.empty()) { expr_ref tmp = expr_abstract(free_vars, fml); - fml = m.mk_exists(free_vars.size(), sorts.c_ptr(), names.c_ptr(), tmp, 1); + fml = m.mk_exists(free_vars.size(), sorts.data(), names.data(), tmp, 1); } } } @@ -2189,7 +2189,7 @@ namespace qe { checkpoint(); app_ref_vector free_vars(m); eliminate_exists(num_vars, vars, fml, free_vars, false, nullptr); - bind_variables(free_vars.size(), free_vars.c_ptr(), fml); + bind_variables(free_vars.size(), free_vars.data(), fml); } void eliminate_forall_bind(unsigned num_vars, app* const* vars, expr_ref& fml) { @@ -2230,7 +2230,7 @@ namespace qe { elim(result); m_trail.reset(); m_visited.reset(); - abstract_expr(bound.size(), bound.c_ptr(), result); + abstract_expr(bound.size(), bound.data(), result); TRACE("qe", tout << "elim result\n" << mk_ismt2_pp(result, m) << "\n";); } @@ -2262,7 +2262,7 @@ namespace qe { bound.push_back(m.mk_fresh_const("bound", fv[i])); } var_subst subst(m); - fml = subst(fml, bound.size(), bound.c_ptr()); + fml = subst(fml, bound.size(), bound.data()); } } @@ -2279,7 +2279,7 @@ namespace qe { for (unsigned i = 0; i < nd; ++i) { vars.push_back(m.mk_fresh_const("x",q->get_decl_sort(i))); } - expr* const* exprs = (expr* const*)(vars.c_ptr()); + expr* const* exprs = (expr* const*)(vars.data()); var_subst subst(m); tmp = subst(new_body, vars.size(), exprs); inv_var_shifter shift(m); @@ -2316,7 +2316,7 @@ namespace qe { } } if (all_visited) { - r = m.mk_app(a->get_decl(), args.size(), args.c_ptr()); + r = m.mk_app(a->get_decl(), args.size(), args.data()); todo.pop_back(); m_trail.push_back(r); m_visited.insert(e, r); @@ -2336,7 +2336,7 @@ namespace qe { elim(tmp); init_qe(); m_qe->set_assumption(m_assumption); - m_qe->eliminate(is_fa, vars.size(), vars.c_ptr(), tmp); + m_qe->eliminate(is_fa, vars.size(), vars.data(), tmp); } m_trail.push_back(tmp); m_visited.insert(e, tmp); @@ -2449,7 +2449,7 @@ namespace qe { names.push_back(vars[i]->get_decl()->get_name()); } if (num_bound > 0) { - tmp = m.mk_exists(num_bound, sorts.c_ptr(), names.c_ptr(), tmp, 1); + tmp = m.mk_exists(num_bound, sorts.data(), names.data(), tmp, 1); } fml = tmp; } @@ -2642,7 +2642,7 @@ namespace qe { names.push_back(v->get_decl()->get_name()); } if (!vars.empty()) { - result = m.mk_quantifier(old_q->get_kind(), vars.size(), sorts.c_ptr(), names.c_ptr(), result, 1); + result = m.mk_quantifier(old_q->get_kind(), vars.size(), sorts.data(), names.data(), result, 1); } result_pr = nullptr; return true; diff --git a/src/qe/qe_arith_plugin.cpp b/src/qe/qe_arith_plugin.cpp index 30fc92764..0baf35ece 100644 --- a/src/qe/qe_arith_plugin.cpp +++ b/src/qe/qe_arith_plugin.cpp @@ -200,7 +200,7 @@ namespace qe { rest = mk_zero(x); } else { - rest = m_arith.mk_add(restl.size(), restl.c_ptr()); + rest = m_arith.mk_add(restl.size(), restl.data()); } if (contains_x(rest)) { return false; @@ -246,7 +246,7 @@ namespace qe { rest = mk_zero(p); } else { - rest = m_arith.mk_add(restl.size(), restl.c_ptr()); + rest = m_arith.mk_add(restl.size(), restl.data()); } } @@ -492,7 +492,7 @@ namespace qe { ptr_vector conjs; add_and(e1, conjs); add_and(e2, conjs); - m_bool_rewriter.mk_and(conjs.size(), conjs.c_ptr(), result); + m_bool_rewriter.mk_and(conjs.size(), conjs.data(), result); } void mk_or(unsigned sz, expr*const* args, expr_ref& result) { @@ -635,7 +635,7 @@ namespace qe { args.push_back(to_app(p)->get_arg(i)); } std::sort(args.begin(), args.end(), mul_lt(*this)); - p = m_arith.mk_add(args.size(), args.c_ptr()); + p = m_arith.mk_add(args.size(), args.data()); } void pp_div(std::ostream& out, app* x, div_constraint const& div) { @@ -846,7 +846,7 @@ namespace qe { ors.push_back(result); ++index; } - mk_or(ors.size(), ors.c_ptr(), result); + mk_or(ors.size(), ors.data(), result); TRACE("qe", tout << "[0 " << up << "] " @@ -1007,7 +1007,7 @@ namespace qe { unsigned num_vars = m_ctx.get_num_vars(); app_ref_vector const& vars = m_ctx.get_vars(); - if (!is_linear(p, num_vars, vars.c_ptr(), values)) { + if (!is_linear(p, num_vars, vars.data(), values)) { return false; } @@ -1112,7 +1112,7 @@ namespace qe { for (unsigned i = 0; i <= num_vars; ++i) { values.push_back(numeral(0)); } - numeral* vars_ptr = values.c_ptr() + 1; + numeral* vars_ptr = values.data() + 1; ptr_vector todo; numeral k; expr* e1, *e2; @@ -1215,35 +1215,35 @@ namespace qe { unsigned e_size(bool is_l) { return is_l?le_size():ge_size(); } unsigned size(bool is_strict, bool is_l) { return is_strict?t_size(is_l):e_size(is_l); } - expr* const* lt() { return m_lt_terms.c_ptr(); } - expr* const* le() { return m_le_terms.c_ptr(); } - expr* const* gt() { return m_gt_terms.c_ptr(); } - expr* const* ge() { return m_ge_terms.c_ptr(); } + expr* const* lt() { return m_lt_terms.data(); } + expr* const* le() { return m_le_terms.data(); } + expr* const* gt() { return m_gt_terms.data(); } + expr* const* ge() { return m_ge_terms.data(); } expr* const* t(bool is_l) { return is_l?lt():gt(); } expr* const* e(bool is_l) { return is_l?le():ge(); } expr* const* exprs(bool is_strict, bool is_l) { return is_strict?t(is_l):e(is_l);} - rational const* lt_coeffs() { return m_lt_coeffs.c_ptr(); } - rational const* le_coeffs() { return m_le_coeffs.c_ptr(); } - rational const* gt_coeffs() { return m_gt_coeffs.c_ptr(); } - rational const* ge_coeffs() { return m_ge_coeffs.c_ptr(); } + rational const* lt_coeffs() { return m_lt_coeffs.data(); } + rational const* le_coeffs() { return m_le_coeffs.data(); } + rational const* gt_coeffs() { return m_gt_coeffs.data(); } + rational const* ge_coeffs() { return m_ge_coeffs.data(); } rational const* t_coeffs(bool is_l) { return is_l?lt_coeffs():gt_coeffs(); } rational const* e_coeffs(bool is_l) { return is_l?le_coeffs():ge_coeffs(); } rational const* coeffs(bool is_strict, bool is_l) { return is_strict?t_coeffs(is_l):e_coeffs(is_l); } - app* const* lt_atoms() { return m_lt_atoms.c_ptr(); } - app* const* le_atoms() { return m_le_atoms.c_ptr(); } - app* const* gt_atoms() { return m_gt_atoms.c_ptr(); } - app* const* ge_atoms() { return m_ge_atoms.c_ptr(); } + app* const* lt_atoms() { return m_lt_atoms.data(); } + app* const* le_atoms() { return m_le_atoms.data(); } + app* const* gt_atoms() { return m_gt_atoms.data(); } + app* const* ge_atoms() { return m_ge_atoms.data(); } app* const* t_atoms(bool is_l) { return is_l?lt_atoms():gt_atoms(); } app* const* e_atoms(bool is_l) { return is_l?le_atoms():ge_atoms(); } app* const* atoms(bool is_strict, bool is_l) { return is_strict?t_atoms(is_l):e_atoms(is_l); } unsigned div_size() const { return m_div_terms.size(); } - app* const* div_atoms() { return m_div_atoms.c_ptr(); } - rational const* div_coeffs() { return m_div_coeffs.c_ptr(); } - expr* const* div_terms() { return m_div_terms.c_ptr(); } - rational const* divisors() { return m_div_divisors.c_ptr(); } + app* const* div_atoms() { return m_div_atoms.data(); } + rational const* div_coeffs() { return m_div_coeffs.data(); } + expr* const* div_terms() { return m_div_terms.data(); } + rational const* divisors() { return m_div_divisors.data(); } bool div_z(rational & d, app_ref& z_bv, app_ref& z) { if (m_div_z.get()) { @@ -1503,7 +1503,7 @@ public: m_result(r), m_coeff(coeff), m_term(term), - m_vars(vars.size(), vars.c_ptr()) + m_vars(vars.size(), vars.data()) {} unsigned mk_hash() const { @@ -1829,10 +1829,10 @@ public: terms.push_back(term); } if (is_lower) { - def = m_util.mk_min(terms.size(), terms.c_ptr()); + def = m_util.mk_min(terms.size(), terms.data()); } else { - def = m_util.mk_max(terms.size(), terms.c_ptr()); + def = m_util.mk_max(terms.size(), terms.data()); } if (x_t.get_term()) { @@ -2503,7 +2503,7 @@ public: brs = alloc(nlarith::branch_conditions, m); TRACE("nlarith", tout << mk_pp(fml, m) << "\n";); - if (!m_util.create_branches(x.x(), lits.size(), lits.c_ptr(), *brs)) { + if (!m_util.create_branches(x.x(), lits.size(), lits.data(), *brs)) { 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 8b379abe2..43d2f9686 100644 --- a/src/qe/qe_array_plugin.cpp +++ b/src/qe/qe_array_plugin.cpp @@ -93,7 +93,7 @@ namespace qe { expr_ref save(m); save = lhs = args[i].get(); args[i] = arith.mk_numeral(rational(0), lhs->get_sort()); - rhs = arith.mk_uminus(arith.mk_add(args.size(), args.c_ptr())); + rhs = arith.mk_uminus(arith.mk_add(args.size(), args.data())); if (arith.is_mul(lhs, e1, e2) && arith.is_numeral(e1, r) && r.is_minus_one()) { @@ -173,7 +173,7 @@ namespace qe { } args2.push_back(rhs); - store_B_i_t = m.mk_app(m_fid, OP_STORE, args2.size(), args2.c_ptr()); + store_B_i_t = m.mk_app(m_fid, OP_STORE, args2.size(), args2.data()); TRACE("qe", tout << "fml: " << mk_pp(fml, m) << "\n"; @@ -236,13 +236,13 @@ namespace qe { args2.push_back(store_T); args2.append(args[i]); - select_t = m.mk_app(m_fid, OP_SELECT, args2.size()-1, args2.c_ptr()); + select_t = m.mk_app(m_fid, OP_SELECT, args2.size()-1, args2.data()); fml = m.mk_and(fml, m.mk_eq(select_t, args2.back())); - store_T = m.mk_app(m_fid, OP_STORE, args2.size(), args2.c_ptr()); + store_T = m.mk_app(m_fid, OP_STORE, args2.size(), args2.data()); args2[0] = store_t; args2.back() = w; - store_t = m.mk_app(m_fid, OP_STORE, args2.size(), args2.c_ptr()); + store_t = m.mk_app(m_fid, OP_STORE, args2.size(), args2.data()); m_ctx.add_var(w); } diff --git a/src/qe/qe_datatype_plugin.cpp b/src/qe/qe_datatype_plugin.cpp index 20ed0baff..0f3ab7ccb 100644 --- a/src/qe/qe_datatype_plugin.cpp +++ b/src/qe/qe_datatype_plugin.cpp @@ -169,7 +169,7 @@ namespace qe { unsigned num_neq_terms() const { return m_neqs.size(); } expr* neq_term(unsigned i) const { return m_neqs[i]; } - expr* const* neq_terms() const { return m_neqs.c_ptr(); } + expr* const* neq_terms() const { return m_neqs.data(); } unsigned num_recognizers() { return m_recognizers.size(); } app* recognizer(unsigned i) { return m_recognizers[i].get(); } @@ -388,7 +388,7 @@ namespace qe { expr* l_i = l->get_arg(i); conj.push_back(m.mk_eq(l_i, r_i)); } - expr* e = m.mk_and(conj.size(), conj.c_ptr()); + 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";); return true; @@ -541,7 +541,7 @@ namespace qe { vars.push_back(fresh_x.get()); sub->second.push_back(fresh_x.get()); } - app_ref t(m.mk_app(c, vars.size(), vars.c_ptr()), m); + app_ref t(m.mk_app(c, vars.size(), vars.data()), m); m_trail.push_back(x.x()); m_trail.push_back(c); m_trail.push_back(t); @@ -735,7 +735,7 @@ namespace qe { sort* s = x->get_sort(); ptr_vector sorts; sorts.resize(eqs.num_neq_terms(), s); - func_decl* diag = m.mk_func_decl(symbol("diag"), sorts.size(), sorts.c_ptr(), s); + func_decl* diag = m.mk_func_decl(symbol("diag"), sorts.size(), sorts.data(), s); expr_ref t(m); t = m.mk_app(diag, eqs.num_neq_terms(), eqs.neq_terms()); add_def(t, def); diff --git a/src/qe/qe_lite.cpp b/src/qe/qe_lite.cpp index 3f4b48401..da9367362 100644 --- a/src/qe/qe_lite.cpp +++ b/src/qe/qe_lite.cpp @@ -337,7 +337,7 @@ namespace qel { m_subst_map.reset(); m_subst_map.resize(sz, nullptr); m_subst.reset(); - m_subst.set_inv_bindings(sz, m_subst_map.c_ptr()); + m_subst.set_inv_bindings(sz, m_subst_map.data()); for (unsigned idx : m_order) { // do all the previous substitutions before inserting expr* cur = m_map[idx]; @@ -389,33 +389,33 @@ namespace qel { expr_ref t(m); switch (q->get_kind()) { case forall_k: - rw.mk_or(m_new_args.size(), m_new_args.c_ptr(), t); + rw.mk_or(m_new_args.size(), m_new_args.data(), t); break; case exists_k: - rw.mk_and(m_new_args.size(), m_new_args.c_ptr(), t); + rw.mk_and(m_new_args.size(), m_new_args.data(), t); break; default: t = e; break; } - expr_ref new_e = m_subst(t, m_subst_map.size(), m_subst_map.c_ptr()); + expr_ref new_e = m_subst(t, m_subst_map.size(), m_subst_map.data()); TRACE("qe_lite", tout << new_e << "\n";); // don't forget to update the quantifier patterns expr_ref_buffer new_patterns(m); expr_ref_buffer new_no_patterns(m); for (unsigned j = 0; j < q->get_num_patterns(); j++) { - expr_ref new_pat = m_subst(q->get_pattern(j), m_subst_map.size(), m_subst_map.c_ptr()); + expr_ref new_pat = m_subst(q->get_pattern(j), m_subst_map.size(), m_subst_map.data()); new_patterns.push_back(new_pat); } for (unsigned j = 0; j < q->get_num_no_patterns(); j++) { - expr_ref new_nopat = m_subst(q->get_no_pattern(j), m_subst_map.size(), m_subst_map.c_ptr()); + expr_ref new_nopat = m_subst(q->get_no_pattern(j), m_subst_map.size(), m_subst_map.data()); new_no_patterns.push_back(new_nopat); } - r = m.update_quantifier(q, new_patterns.size(), new_patterns.c_ptr(), - new_no_patterns.size(), new_no_patterns.c_ptr(), new_e); + r = m.update_quantifier(q, new_patterns.size(), new_patterns.data(), + new_no_patterns.size(), new_no_patterns.data(), new_e); } void reduce_quantifier1(quantifier * q, expr_ref & r, proof_ref & pr) { @@ -548,7 +548,7 @@ namespace qel { void flatten_definitions(expr_ref_vector& conjs) { TRACE("qe_lite", expr_ref tmp(m); - tmp = m.mk_and(conjs.size(), conjs.c_ptr()); + tmp = m.mk_and(conjs.size(), conjs.data()); tout << mk_pp(tmp, m) << "\n";); for (unsigned i = 0; i < conjs.size(); ++i) { expr* c = conjs[i].get(); @@ -584,7 +584,7 @@ namespace qel { } TRACE("qe_lite", expr_ref tmp(m); - tmp = m.mk_and(conjs.size(), conjs.c_ptr()); + tmp = m.mk_and(conjs.size(), conjs.data()); tout << "after flatten\n" << mk_pp(tmp, m) << "\n";); } @@ -655,7 +655,7 @@ namespace qel { flatten_definitions(conjs); - find_definitions(conjs.size(), conjs.c_ptr(), true, def_count, largest_vinx); + find_definitions(conjs.size(), conjs.data(), true, def_count, largest_vinx); if (def_count > 0) { get_elimination_order(); @@ -663,9 +663,9 @@ namespace qel { if (!m_order.empty()) { expr_ref r(m), new_r(m); - r = m.mk_and(conjs.size(), conjs.c_ptr()); + r = m.mk_and(conjs.size(), conjs.data()); create_substitution(largest_vinx + 1); - new_r = m_subst(r, m_subst_map.size(), m_subst_map.c_ptr()); + new_r = m_subst(r, m_subst_map.size(), m_subst_map.data()); m_rewriter(new_r); conjs.reset(); flatten_and(new_r, conjs); @@ -802,7 +802,7 @@ namespace qel { args.push_back(A); args.append(a1->get_num_args()-1, a1->get_args()+1); args.push_back(e2); - expr* B = a.mk_store(args.size(), args.c_ptr()); + expr* B = a.mk_store(args.size(), args.data()); expr_safe_replace rep(m); rep.insert(A, B); expr_ref tmp(m); @@ -1145,7 +1145,7 @@ namespace fm { } void reset_constraints() { - del_constraints(m_constraints.size(), m_constraints.c_ptr()); + del_constraints(m_constraints.size(), m_constraints.data()); m_constraints.reset(); } @@ -1518,7 +1518,7 @@ namespace fm { if (c.m_num_vars == 1) lhs = ms[0]; else - lhs = m_util.mk_add(ms.size(), ms.c_ptr()); + lhs = m_util.mk_add(ms.size(), ms.data()); expr * rhs = m_util.mk_numeral(c.m_c, int_cnstr); if (c.m_strict) { ineq = m.mk_not(m_util.mk_ge(lhs, rhs)); @@ -1548,7 +1548,7 @@ namespace fm { if (lits.size() == 1) return to_app(lits[0]); else - return m.mk_or(lits.size(), lits.c_ptr()); + return m.mk_or(lits.size(), lits.data()); } var mk_var(expr * t) { @@ -1683,7 +1683,7 @@ namespace fm { if (!is_int(xs.back())) all_int = false; } - mk_int(as.size(), as.c_ptr(), c); + mk_int(as.size(), as.data(), c); if (all_int && strict) { strict = false; c--; @@ -1694,10 +1694,10 @@ namespace fm { 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.c_ptr(), + lits.data(), xs.size(), - xs.c_ptr(), - as.c_ptr(), + xs.data(), + as.data(), c, strict, dep); @@ -2032,10 +2032,10 @@ namespace fm { } constraint * new_cnstr = mk_constraint(new_lits.size(), - new_lits.c_ptr(), + new_lits.data(), new_xs.size(), - new_xs.c_ptr(), - new_as.c_ptr(), + new_xs.data(), + new_as.data(), new_c, new_strict, new_dep); @@ -2092,7 +2092,7 @@ namespace fm { 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";); - del_constraints(new_constraints.size(), new_constraints.c_ptr()); + del_constraints(new_constraints.size(), new_constraints.data()); return false; } constraint const & l_c = *(l[i]); @@ -2303,14 +2303,14 @@ public: quantifier_ref q(m); proof_ref pr(m); symbol qe_lite("QE"); - expr_abstract(m, 0, vars.size(), (expr*const*)vars.c_ptr(), fml, tmp); + expr_abstract(m, 0, vars.size(), (expr*const*)vars.data(), fml, tmp); ptr_vector sorts; svector names; for (unsigned i = 0; i < vars.size(); ++i) { sorts.push_back(vars[i]->get_sort()); names.push_back(vars[i]->get_decl()->get_name()); } - q = m.mk_exists(vars.size(), sorts.c_ptr(), names.c_ptr(), tmp, 1, qe_lite); + q = m.mk_exists(vars.size(), sorts.data(), names.data(), tmp, 1, qe_lite); m_der.reduce_quantifier(q, tmp, pr); // assumes m_der just updates the quantifier and does not change things more. if (is_exists(tmp) && to_quantifier(tmp)->get_qid() == qe_lite) { @@ -2318,7 +2318,7 @@ public: tmp = to_quantifier(tmp)->get_expr(); used.process(tmp); var_subst vs(m, true); - fml = vs(tmp, vars.size(), (expr*const*)vars.c_ptr()); + fml = vs(tmp, vars.size(), (expr*const*)vars.data()); // collect set of variables that were used. unsigned j = 0; for (unsigned i = 0; i < vars.size(); ++i) { @@ -2350,10 +2350,10 @@ public: conjs.reset(); conjs.push_back(disjs[i].get()); (*this)(index_set, index_of_bound, conjs); - bool_rewriter(m).mk_and(conjs.size(), conjs.c_ptr(), fml); + bool_rewriter(m).mk_and(conjs.size(), conjs.data(), fml); disjs[i] = std::move(fml); } - bool_rewriter(m).mk_or(disjs.size(), disjs.c_ptr(), fml); + bool_rewriter(m).mk_or(disjs.size(), disjs.data(), fml); } diff --git a/src/qe/qe_mbi.cpp b/src/qe/qe_mbi.cpp index da9211ac5..bae670394 100644 --- a/src/qe/qe_mbi.cpp +++ b/src/qe/qe_mbi.cpp @@ -428,7 +428,7 @@ namespace qe { (x->get_depth() > y->get_depth()) || (x->get_depth() == y->get_depth() && x->get_id() > y->get_id()); }; - std::sort(avars.c_ptr(), avars.c_ptr() + avars.size(), compare_depth); + std::sort(avars.data(), avars.data() + avars.size(), compare_depth); TRACE("qe", tout << "avars:" << avars << "\n";); } diff --git a/src/qe/qsat.cpp b/src/qe/qsat.cpp index 0e1023402..537a7ab56 100644 --- a/src/qe/qsat.cpp +++ b/src/qe/qsat.cpp @@ -401,7 +401,7 @@ namespace qe { app_ref r(m); ptr_vector args; unsigned sz0 = todo.size(); - todo.append(fmls.size(), (expr*const*)fmls.c_ptr()); + todo.append(fmls.size(), (expr*const*)fmls.data()); while (sz0 != todo.size()) { app* a = to_app(todo.back()); if (cache.contains(a)) { @@ -1083,7 +1083,7 @@ namespace qe { return expr_ref(m); } reset(); - fml = ::mk_exists(m, vars.size(), vars.c_ptr(), fml); + fml = ::mk_exists(m, vars.size(), vars.data(), fml); fml = ::push_not(fml); hoist(fml); if (!is_ground(fml)) { @@ -1107,7 +1107,7 @@ namespace qe { } m_free_vars.shrink(j); if (!m_free_vars.empty()) { - fml = ::mk_exists(m, m_free_vars.size(), m_free_vars.c_ptr(), fml); + fml = ::mk_exists(m, m_free_vars.size(), m_free_vars.data(), fml); } return fml; default: @@ -1274,7 +1274,7 @@ namespace qe { expr_ref_vector defs(m); expr_ref fml(m); in->get_formulas(fmls); - fml = mk_and(m, fmls.size(), fmls.c_ptr()); + fml = mk_and(m, fmls.size(), fmls.data()); // for now: // fail if cores. (TBD) diff --git a/src/sat/dimacs.cpp b/src/sat/dimacs.cpp index 458c129f1..6800b5c8d 100644 --- a/src/sat/dimacs.cpp +++ b/src/sat/dimacs.cpp @@ -126,7 +126,7 @@ static bool parse_dimacs_core(Buffer & in, std::ostream& err, sat::solver & solv } else { read_clause(in, err, solver, lits); - solver.mk_clause(lits.size(), lits.c_ptr()); + solver.mk_clause(lits.size(), lits.data()); } } } @@ -176,7 +176,7 @@ namespace dimacs { ++in; } m_buffer.push_back(0); - return m_buffer.c_ptr(); + return m_buffer.data(); } char const* drat_parser::parse_quoted_symbol() { @@ -195,7 +195,7 @@ namespace dimacs { ++in; m_buffer.push_back(c); m_buffer.push_back(0); - return m_buffer.c_ptr(); + return m_buffer.data(); } escape = (c == '\\'); m_buffer.push_back(c); @@ -221,7 +221,7 @@ namespace dimacs { ++in; } m_buffer.push_back(0); - return m_buffer.c_ptr(); + return m_buffer.data(); } int drat_parser::read_theory_id() { diff --git a/src/sat/sat_aig_cuts.cpp b/src/sat/sat_aig_cuts.cpp index beb4131aa..3474029ea 100644 --- a/src/sat/sat_aig_cuts.cpp +++ b/src/sat/sat_aig_cuts.cpp @@ -354,7 +354,7 @@ namespace sat { m_literals.append(sz, args); for (unsigned i = 0; i < sz; ++i) reserve(args[i].var()); if (op == and_op || op == xor_op) { - std::sort(m_literals.c_ptr() + offset, m_literals.c_ptr() + offset + sz); + std::sort(m_literals.data() + offset, m_literals.data() + offset + sz); } add_node(v, n); } @@ -424,7 +424,7 @@ namespace sat { } } if (changed && (n.is_and() || n.is_xor())) { - std::sort(m_literals.c_ptr() + n.offset(), m_literals.c_ptr() + n.offset() + n.size()); + std::sort(m_literals.data() + n.offset(), m_literals.data() + n.offset() + n.size()); } return true; } diff --git a/src/sat/sat_anf_simplifier.cpp b/src/sat/sat_anf_simplifier.cpp index db1a3347e..6d28d9f98 100644 --- a/src/sat/sat_anf_simplifier.cpp +++ b/src/sat/sat_anf_simplifier.cpp @@ -363,7 +363,7 @@ namespace sat { svector> vl(nv); for (unsigned i = 0; i < nv; ++i) var2id[i] = i; - shuffle(var2id.size(), var2id.c_ptr(), s.rand()); + shuffle(var2id.size(), var2id.data(), s.rand()); for (unsigned i = 0; i < nv; ++i) id2var[var2id[i]] = i; for (unsigned i = 0; i < nv; ++i) vl[i] = std::make_pair(i, var2id[i]); std::sort(vl.begin(), vl.end()); diff --git a/src/sat/sat_big.cpp b/src/sat/sat_big.cpp index 9d70572fe..8da963729 100644 --- a/src/sat/sat_big.cpp +++ b/src/sat/sat_big.cpp @@ -51,7 +51,7 @@ namespace sat { s.m_ext->is_extended_binary(w.get_ext_constraint_idx(), r)) { seen_idx.insert(w.get_ext_constraint_idx(), true); for (unsigned i = 0; i < std::min(4u, r.size()); ++i) { - shuffle(r.size(), r.c_ptr(), m_rand); + shuffle(r.size(), r.data(), m_rand); literal u = r[0]; for (unsigned j = 1; j < r.size(); ++j) { literal v = ~r[j]; @@ -91,7 +91,7 @@ namespace sat { void big::done_adding_edges() { for (auto& edges : m_dag) { - shuffle(edges.size(), edges.c_ptr(), m_rand); + shuffle(edges.size(), edges.data(), m_rand); } init_dfs_num(); } @@ -128,7 +128,7 @@ namespace sat { todo.push_back(pframe(null_literal, u)); } } - shuffle(todo.size(), todo.c_ptr(), m_rand); + shuffle(todo.size(), todo.data(), m_rand); int dfs_num = 0; while (!todo.empty()) { literal u = todo.back().child(); diff --git a/src/sat/sat_cut_simplifier.cpp b/src/sat/sat_cut_simplifier.cpp index 74e11a040..c10a35d11 100644 --- a/src/sat/sat_cut_simplifier.cpp +++ b/src/sat/sat_cut_simplifier.cpp @@ -70,7 +70,7 @@ namespace sat { IF_VERBOSE(10, verbose_stream() << "validate: " << clause << "\n"); m_assumptions.reset(); for (literal lit : clause) m_assumptions.push_back(~lit); - lbool r = s.check(clause.size(), m_assumptions.c_ptr()); + lbool r = s.check(clause.size(), m_assumptions.data()); if (r != l_false) { IF_VERBOSE(0, verbose_stream() << "not validated: " << clause << "\n"; @@ -131,7 +131,7 @@ namespace sat { m_lits.reset(); m_lits.append(sz, lits); for (unsigned i = 0; i < sz; ++i) m_lits[i].neg(); - m_aig_cuts.add_node(~head, and_op, sz, m_lits.c_ptr()); + m_aig_cuts.add_node(~head, and_op, sz, m_lits.data()); m_stats.m_num_ands++; } @@ -188,7 +188,7 @@ namespace sat { std::function on_and = [&,this](literal head, literal_vector const& ands) { - m_aig_cuts.add_node(head, and_op, ands.size(), ands.c_ptr()); + m_aig_cuts.add_node(head, and_op, ands.size(), ands.data()); m_stats.m_xands++; }; std::function on_ite = @@ -228,7 +228,7 @@ namespace sat { if (i != index) m_lits.push_back(xors[i]); } - m_aig_cuts.add_node(head, xor_op, sz, m_lits.c_ptr()); + m_aig_cuts.add_node(head, xor_op, sz, m_lits.data()); m_lits.reset(); m_stats.m_xxors++; }; @@ -242,7 +242,7 @@ namespace sat { [&,this](uint64_t lut, bool_var_vector const& vars, bool_var v) { m_stats.m_xluts++; // m_aig_cuts.add_cut(v, lut, vars); - m_aig_cuts.add_node(v, lut, vars.size(), vars.c_ptr()); + m_aig_cuts.add_node(v, lut, vars.size(), vars.data()); }; if (s.m_config.m_cut_npn3) { @@ -580,7 +580,7 @@ namespace sat { for (; i < sz; ++i) { auto const& clause = clauses[i]; if (clause[0].sign()) { - literal_vector cl(clause.size() - 1, clause.c_ptr() + 1); + literal_vector cl(clause.size() - 1, clause.data() + 1); clauses.push_back(cl); s.m_drat.add(cl); } diff --git a/src/sat/sat_ddfw.cpp b/src/sat/sat_ddfw.cpp index 1d4d4d1fc..ecfc13aa6 100644 --- a/src/sat/sat_ddfw.cpp +++ b/src/sat/sat_ddfw.cpp @@ -147,7 +147,7 @@ namespace sat { unsigned trail_sz = s.init_trail_size(); for (unsigned i = 0; i < trail_sz; ++i) { - add(1, s.m_trail.c_ptr() + i); + add(1, s.m_trail.data() + i); } unsigned sz = s.m_watches.size(); for (unsigned l_idx = 0; l_idx < sz; ++l_idx) { @@ -171,7 +171,7 @@ namespace sat { void ddfw::add_assumptions() { for (unsigned i = 0; i < m_assumptions.size(); ++i) { - add(1, m_assumptions.c_ptr() + i); + add(1, m_assumptions.data() + i); } } diff --git a/src/sat/sat_ddfw.h b/src/sat/sat_ddfw.h index 358c87656..1cad87363 100644 --- a/src/sat/sat_ddfw.h +++ b/src/sat/sat_ddfw.h @@ -106,8 +106,8 @@ namespace sat { public: use_list(ddfw& p, literal lit): p(p), i(lit.index()) {} - unsigned const* begin() { return p.m_flat_use_list.c_ptr() + p.m_use_list_index[i]; } - unsigned const* end() { return p.m_flat_use_list.c_ptr() + p.m_use_list_index[i + 1]; } + unsigned const* begin() { return p.m_flat_use_list.data() + p.m_use_list_index[i]; } + unsigned const* end() { return p.m_flat_use_list.data() + p.m_use_list_index[i + 1]; } }; void flatten_use_list(); diff --git a/src/sat/sat_drat.cpp b/src/sat/sat_drat.cpp index 20d7c8f1e..982b6bb9b 100644 --- a/src/sat/sat_drat.cpp +++ b/src/sat/sat_drat.cpp @@ -390,7 +390,7 @@ namespace sat { for (unsigned i = num_units; i < m_units.size(); ++i) { m_assignment[m_units[i].var()] = l_undef; } - units.append(m_units.size() - num_units, m_units.c_ptr() + num_units); + units.append(m_units.size() - num_units, m_units.data() + num_units); m_units.shrink(num_units); bool ok = m_inconsistent; m_inconsistent = false; @@ -517,7 +517,7 @@ namespace sat { if (j != c.size()) { lits.append(j, c.begin()); lits.append(c.size() - j - 1, c.begin() + j + 1); - if (!is_drup(lits.size(), lits.c_ptr())) + if (!is_drup(lits.size(), lits.data())) return false; lits.resize(n); } @@ -788,7 +788,7 @@ namespace sat { } } void drat::add(literal_vector const& lits, status st) { - add(lits.size(), lits.c_ptr(), st); + add(lits.size(), lits.data(), st); } void drat::add(unsigned sz, literal const* lits, status st) { @@ -822,7 +822,7 @@ namespace sat { case 1: append(c[0], status::redundant()); break; default: { verify(c.size(), c.begin()); - clause* cl = m_alloc.mk_clause(c.size(), c.c_ptr(), true); + clause* cl = m_alloc.mk_clause(c.size(), c.data(), true); append(*cl, status::redundant()); break; } diff --git a/src/sat/sat_elim_vars.cpp b/src/sat/sat_elim_vars.cpp index 44a8a979d..e07dcea77 100644 --- a/src/sat/sat_elim_vars.cpp +++ b/src/sat/sat_elim_vars.cpp @@ -184,7 +184,7 @@ namespace sat{ s.m_stats.m_mk_ter_clause++; else s.m_stats.m_mk_clause++; - clause* cp = s.alloc_clause(c.size(), c.c_ptr(), false); + clause* cp = s.alloc_clause(c.size(), c.data(), false); s.m_clauses.push_back(cp); simp.m_use_list.insert(*cp); if (simp.m_sub_counter > 0) @@ -213,7 +213,7 @@ namespace sat{ } if (b.is_false()) { if (lits.size() > 1) { - clause* c = s.alloc_clause(lits.size(), lits.c_ptr(), false); + clause* c = s.alloc_clause(lits.size(), lits.data(), false); clauses.push_back(c); } else { diff --git a/src/sat/sat_local_search.cpp b/src/sat/sat_local_search.cpp index fd6f39d5d..433750369 100644 --- a/src/sat/sat_local_search.cpp +++ b/src/sat/sat_local_search.cpp @@ -28,7 +28,7 @@ namespace sat { flet _init(m_initializing, true); m_unsat_stack.reset(); for (unsigned i = 0; i < m_assumptions.size(); ++i) { - add_clause(1, m_assumptions.c_ptr() + i); + add_clause(1, m_assumptions.data() + i); } if (m_is_unsat) return; @@ -388,7 +388,7 @@ namespace sat { // copy units unsigned trail_sz = s.init_trail_size(); for (unsigned i = 0; i < trail_sz; ++i) { - add_clause(1, s.m_trail.c_ptr() + i); + add_clause(1, s.m_trail.data() + i); } // copy binary clauses diff --git a/src/sat/sat_model_converter.cpp b/src/sat/sat_model_converter.cpp index 8ede44857..656270f16 100644 --- a/src/sat/sat_model_converter.cpp +++ b/src/sat/sat_model_converter.cpp @@ -395,7 +395,7 @@ namespace sat { unsigned csz = p.first; literal lit = p.second; swap(lit.var(), csz, clause); - update_stack.append(csz, clause.c_ptr()); + update_stack.append(csz, clause.data()); update_stack.push_back(null_literal); } } diff --git a/src/sat/sat_mus.cpp b/src/sat/sat_mus.cpp index 9c455a219..cbbf01b20 100644 --- a/src/sat/sat_mus.cpp +++ b/src/sat/sat_mus.cpp @@ -89,7 +89,7 @@ namespace sat { flet _restart_bound(s.m_config.m_restart_max, m_max_num_restarts); scoped_append _sa(mus, core); mus.push_back(~lit); - is_sat = s.check(mus.size(), mus.c_ptr()); + is_sat = s.check(mus.size(), mus.data()); TRACE("sat", tout << "mus: " << mus << "\n";); } IF_VERBOSE(1, verbose_stream() << "(sat.mus " << is_sat << ")\n";); @@ -150,7 +150,7 @@ namespace sat { lbool is_sat = l_true; if (has_support) { scoped_append _sa(m_mus, support.to_vector()); - is_sat = s.check(m_mus.size(), m_mus.c_ptr()); + is_sat = s.check(m_mus.size(), m_mus.data()); switch (is_sat) { case l_false: { literal_set core(s.get_core()); @@ -230,7 +230,7 @@ namespace sat { } void mus::verify_core(literal_vector const& core) { - lbool is_sat = s.check(core.size(), core.c_ptr()); + lbool is_sat = s.check(core.size(), core.data()); IF_VERBOSE(3, verbose_stream() << "core verification: " << is_sat << " " << core << "\n";); } diff --git a/src/sat/sat_parallel.cpp b/src/sat/sat_parallel.cpp index 5fb07ef3c..2f7a19558 100644 --- a/src/sat/sat_parallel.cpp +++ b/src/sat/sat_parallel.cpp @@ -130,7 +130,7 @@ namespace sat { lock_guard lock(m_mux); if (limit < m_units.size()) { // this might repeat some literals. - out.append(m_units.size() - limit, m_units.c_ptr() + limit); + out.append(m_units.size() - limit, m_units.data() + limit); } for (unsigned i = 0; i < in.size(); ++i) { literal lit = in[i]; @@ -192,7 +192,7 @@ namespace sat { IF_VERBOSE(3, verbose_stream() << s.m_par_id << ": retrieve " << m_lits << "\n";); SASSERT(n >= 2); if (usable_clause) { - s.mk_clause_core(m_lits.size(), m_lits.c_ptr(), sat::status::redundant()); + s.mk_clause_core(m_lits.size(), m_lits.data(), sat::status::redundant()); } } } diff --git a/src/sat/sat_parallel.h b/src/sat/sat_parallel.h index a162f8f7b..3693cf323 100644 --- a/src/sat/sat_parallel.h +++ b/src/sat/sat_parallel.h @@ -39,7 +39,7 @@ namespace sat { void next(unsigned& index); unsigned get_owner(unsigned index) const { return m_vectors[index]; } unsigned get_length(unsigned index) const { return m_vectors[index+1]; } - unsigned const* get_ptr(unsigned index) const { return m_vectors.c_ptr() + index + 2; } + unsigned const* get_ptr(unsigned index) const { return m_vectors.data() + index + 2; } public: vector_pool() {} void reserve(unsigned num_owners, unsigned sz); diff --git a/src/sat/sat_prob.cpp b/src/sat/sat_prob.cpp index d0dcb2f60..46a098ba8 100644 --- a/src/sat/sat_prob.cpp +++ b/src/sat/sat_prob.cpp @@ -126,7 +126,7 @@ namespace sat { m_values.reserve(s.num_vars(), false); unsigned trail_sz = s.init_trail_size(); for (unsigned i = 0; i < trail_sz; ++i) { - add(1, s.m_trail.c_ptr() + i); + add(1, s.m_trail.data() + i); } unsigned sz = s.m_watches.size(); for (unsigned l_idx = 0; l_idx < sz; ++l_idx) { diff --git a/src/sat/sat_prob.h b/src/sat/sat_prob.h index 1b3184f44..048fc448c 100644 --- a/src/sat/sat_prob.h +++ b/src/sat/sat_prob.h @@ -80,8 +80,8 @@ namespace sat { public: use_list(prob& p, literal lit): p(p), i(lit.index()) {} - unsigned const* begin() { return p.m_flat_use_list.c_ptr() + p.m_use_list_index[i]; } - unsigned const* end() { return p.m_flat_use_list.c_ptr() + p.m_use_list_index[i+1]; } + unsigned const* begin() { return p.m_flat_use_list.data() + p.m_use_list_index[i]; } + unsigned const* end() { return p.m_flat_use_list.data() + p.m_use_list_index[i+1]; } }; void flatten_use_list(); diff --git a/src/sat/sat_simplifier.cpp b/src/sat/sat_simplifier.cpp index b79635dda..faa940869 100644 --- a/src/sat/sat_simplifier.cpp +++ b/src/sat/sat_simplifier.cpp @@ -1376,7 +1376,7 @@ namespace sat { bool first = true; unsigned sz = 0, sz0 = m_covered_clause.size(); for (literal l : m_covered_clause) s.mark_visited(l); - shuffle(m_covered_clause.size(), m_covered_clause.c_ptr(), s.s.m_rand); + shuffle(m_covered_clause.size(), m_covered_clause.data(), s.s.m_rand); m_tautology.reset(); m_mc.stackv().reset(); m_ala_qhead = 0; @@ -2003,7 +2003,7 @@ namespace sat { s.m_stats.m_mk_ter_clause++; else s.m_stats.m_mk_clause++; - clause * new_c = s.alloc_clause(m_new_cls.size(), m_new_cls.c_ptr(), false); + clause * new_c = s.alloc_clause(m_new_cls.size(), m_new_cls.data(), false); if (s.m_config.m_drat) s.m_drat.add(*new_c, status::redundant()); s.m_clauses.push_back(new_c); diff --git a/src/sat/sat_solver.cpp b/src/sat/sat_solver.cpp index c143988ba..bf85242ed 100644 --- a/src/sat/sat_solver.cpp +++ b/src/sat/sat_solver.cpp @@ -220,7 +220,7 @@ namespace sat { if (c->glue() <= 2 || (c->size() <= 40 && c->glue() <= 8) || copy_learned) { buffer.reset(); for (literal l : *c) buffer.push_back(l); - clause* c1 = mk_clause_core(buffer.size(), buffer.c_ptr(), sat::status::redundant()); + clause* c1 = mk_clause_core(buffer.size(), buffer.data(), sat::status::redundant()); if (c1) { ++num_learned; c1->set_glue(c->glue()); @@ -358,7 +358,7 @@ namespace sat { m_aux_literals.reset(); m_aux_literals.append(num_lits, lits); m_aux_literals.append(m_user_scope_literals); - return mk_clause_core(m_aux_literals.size(), m_aux_literals.c_ptr(), st); + return mk_clause_core(m_aux_literals.size(), m_aux_literals.data(), st); } } @@ -983,7 +983,7 @@ namespace sat { __builtin_prefetch((const char*)((m_watches[l.index()].c_ptr()))); #else #if !defined(_M_ARM) && !defined(_M_ARM64) - _mm_prefetch((const char*)((m_watches[l.index()].c_ptr())), _MM_HINT_T1); + _mm_prefetch((const char*)((m_watches[l.index()].data())), _MM_HINT_T1); #endif #endif } @@ -1402,7 +1402,7 @@ namespace sat { m_local_search->add(*this); m_local_search->updt_params(m_params); scoped_rl.push_child(&(m_local_search->rlimit())); - lbool r = m_local_search->check(_lits.size(), _lits.c_ptr(), nullptr); + lbool r = m_local_search->check(_lits.size(), _lits.data(), nullptr); if (r == l_true) { m_model = m_local_search->get_model(); m_model_is_current = true; @@ -2589,7 +2589,7 @@ namespace sat { } } - unsigned glue = num_diff_levels(m_lemma.size(), m_lemma.c_ptr()); + unsigned glue = num_diff_levels(m_lemma.size(), m_lemma.data()); m_fast_glue_avg.update(glue); m_slow_glue_avg.update(glue); @@ -2605,7 +2605,7 @@ namespace sat { ++m_stats.m_backtracks; pop_reinit(m_scope_lvl - backtrack_lvl + 1); } - clause * lemma = mk_clause_core(m_lemma.size(), m_lemma.c_ptr(), sat::status::redundant()); + clause * lemma = mk_clause_core(m_lemma.size(), m_lemma.data(), sat::status::redundant()); if (lemma) { lemma->set_glue(glue); } @@ -3557,7 +3557,7 @@ namespace 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"; - tout << "free vars: " << bool_var_vector(m_free_vars.size() - free_vars_head, m_free_vars.c_ptr() + free_vars_head) << "\n"; + tout << "free vars: " << bool_var_vector(m_free_vars.size() - free_vars_head, m_free_vars.data() + free_vars_head) << "\n"; for (unsigned i = m_clauses_to_reinit.size(); i-- > old_sz; ) tout << "reinit: " << m_clauses_to_reinit[i] << "\n"; display(tout);); @@ -4234,7 +4234,7 @@ namespace sat { for (literal lit : gamma) { sat::literal_vector asms1(asms); asms1.push_back(~lit); - lbool r = s.check(asms1.size(), asms1.c_ptr()); + lbool r = s.check(asms1.size(), asms1.data()); if (r == l_false) { conseq.push_back(s.get_core()); } @@ -4258,7 +4258,7 @@ namespace sat { while (true) { sat::literal_vector asms1(asms); asms1.append(omegaN); - lbool r = s.check(asms1.size(), asms1.c_ptr()); + lbool r = s.check(asms1.size(), asms1.data()); if (r == l_true) { IF_VERBOSE(1, verbose_stream() << "(sat) " << omegaN << "\n";); prune_unfixed(lambda, s.get_model()); @@ -4308,7 +4308,7 @@ namespace sat { return get_bounded_consequences(asms, vars, conseq); } if (!m_model_is_current) { - is_sat = check(asms.size(), asms.c_ptr()); + is_sat = check(asms.size(), asms.data()); } if (is_sat != l_true) { return is_sat; @@ -4379,7 +4379,7 @@ namespace sat { init_assumptions(1, &lit); } else { - init_assumptions(asms.size(), asms.c_ptr()); + init_assumptions(asms.size(), asms.data()); } propagate(false); if (check_inconsistent()) return l_false; @@ -4438,7 +4438,7 @@ namespace sat { init_assumptions(1, &lit); } else { - init_assumptions(asms.size(), asms.c_ptr()); + init_assumptions(asms.size(), asms.data()); } propagate(false); if (check_inconsistent()) return l_false; diff --git a/src/sat/sat_solver.h b/src/sat/sat_solver.h index bcb2c0e77..10e5bd06d 100644 --- a/src/sat/sat_solver.h +++ b/src/sat/sat_solver.h @@ -264,7 +264,7 @@ namespace sat { bool_var mk_var(bool ext = false, bool dvar = true); - clause* mk_clause(literal_vector const& lits, sat::status st = sat::status::asserted()) { return mk_clause(lits.size(), lits.c_ptr(), st); } + clause* mk_clause(literal_vector const& lits, sat::status st = sat::status::asserted()) { return mk_clause(lits.size(), lits.data(), st); } clause* mk_clause(unsigned num_lits, literal * lits, sat::status st = sat::status::asserted()); clause* mk_clause(literal l1, literal l2, sat::status st = sat::status::asserted()); clause* mk_clause(literal l1, literal l2, literal l3, sat::status st = sat::status::asserted()); @@ -284,7 +284,7 @@ namespace sat { bool memory_pressure(); void del_clause(clause & c); clause * mk_clause_core(unsigned num_lits, literal * lits, sat::status st); - clause * mk_clause_core(literal_vector const& lits) { return mk_clause_core(lits.size(), lits.c_ptr()); } + clause * mk_clause_core(literal_vector const& lits) { return mk_clause_core(lits.size(), lits.data()); } clause * mk_clause_core(unsigned num_lits, literal * lits) { return mk_clause_core(num_lits, lits, sat::status::asserted()); } void mk_clause_core(literal l1, literal l2) { literal lits[2] = { l1, l2 }; mk_clause_core(2, lits); } void mk_bin_clause(literal l1, literal l2, sat::status st); diff --git a/src/sat/sat_solver/inc_sat_solver.cpp b/src/sat/sat_solver/inc_sat_solver.cpp index 003d630d8..f22ef3aec 100644 --- a/src/sat/sat_solver/inc_sat_solver.cpp +++ b/src/sat/sat_solver/inc_sat_solver.cpp @@ -165,13 +165,13 @@ public: asms.push_back(a); } VERIFY(l_true == internalize_formulas()); - VERIFY(l_true == internalize_assumptions(sz, asms.c_ptr())); + VERIFY(l_true == internalize_assumptions(sz, asms.data())); svector nweights; for (unsigned i = 0; i < m_asms.size(); ++i) { nweights.push_back((unsigned) m_weights[i]); } m_weights.reset(); - m_solver.display_wcnf(out, m_asms.size(), m_asms.c_ptr(), nweights.c_ptr()); + m_solver.display_wcnf(out, m_asms.size(), m_asms.data(), nweights.data()); } bool is_literal(expr* e) const { @@ -204,7 +204,7 @@ public: m_dep2asm.reset(); lbool r = internalize_formulas(); if (r != l_true) return r; - r = internalize_assumptions(sz, _assumptions.c_ptr()); + r = internalize_assumptions(sz, _assumptions.data()); if (r != l_true) return r; init_reason_unknown(); @@ -212,7 +212,7 @@ public: bool reason_set = false; try { // IF_VERBOSE(0, m_solver.display(verbose_stream())); - r = m_solver.check(m_asms.size(), m_asms.c_ptr()); + r = m_solver.check(m_asms.size(), m_asms.data()); } catch (z3_exception& ex) { IF_VERBOSE(1, verbose_stream() << "exception: " << ex.msg() << "\n";); @@ -337,7 +337,7 @@ public: expr_ref_vector args(m); args.push_back(::mk_not(m, a)); args.append(to_app(t)->get_num_args(), to_app(t)->get_args()); - assert_expr_core(m.mk_or(args.size(), args.c_ptr())); + assert_expr_core(m.mk_or(args.size(), args.data())); } else { m_is_cnf = false; @@ -377,7 +377,7 @@ public: } void get_unsat_core(expr_ref_vector & r) override { r.reset(); - r.append(m_core.size(), m_core.c_ptr()); + r.append(m_core.size(), m_core.data()); } void get_levels(ptr_vector const& vars, unsigned_vector& depth) override { @@ -475,7 +475,7 @@ public: if (r != l_true) return r; r = internalize_vars(vars, bvars); if (r != l_true) return r; - r = internalize_assumptions(assumptions.size(), assumptions.c_ptr()); + r = internalize_assumptions(assumptions.size(), assumptions.data()); if (r != l_true) return r; r = m_solver.get_consequences(m_asms, bvars, lconseq); if (r == l_false) { @@ -1090,7 +1090,7 @@ void inc_sat_display(std::ostream& out, solver& _s, unsigned sz, expr*const* sof } weights.push_back(_weights[i].get_unsigned()); } - s.display_weighted(out, sz, soft, weights.c_ptr()); + s.display_weighted(out, sz, soft, weights.data()); } diff --git a/src/sat/sat_types.h b/src/sat/sat_types.h index 887d09e0b..54e2b0e5e 100644 --- a/src/sat/sat_types.h +++ b/src/sat/sat_types.h @@ -234,7 +234,7 @@ namespace sat { } inline std::ostream & operator<<(std::ostream & out, literal_vector const & ls) { - return out << mk_lits_pp(ls.size(), ls.c_ptr()); + return out << mk_lits_pp(ls.size(), ls.data()); } class i_local_search { diff --git a/src/sat/smt/arith_internalize.cpp b/src/sat/smt/arith_internalize.cpp index 30d2689c0..8c0f5fdd2 100644 --- a/src/sat/smt/arith_internalize.cpp +++ b/src/sat/smt/arith_internalize.cpp @@ -447,7 +447,7 @@ namespace arith { vars.push_back(register_theory_var_in_lar_solver(w)); ensure_nla(); m_solver->register_existing_terms(); - m_nla->add_monic(register_theory_var_in_lar_solver(v), vars.size(), vars.c_ptr()); + m_nla->add_monic(register_theory_var_in_lar_solver(v), vars.size(), vars.data()); } return v; } @@ -470,7 +470,7 @@ namespace arith { 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.c_ptr()); + m_nla->add_monic(register_theory_var_in_lar_solver(v), vars.size(), vars.data()); } return v; } @@ -572,7 +572,7 @@ namespace arith { if (reflect(e)) for (expr* arg : *to_app(e)) args.push_back(e_internalize(arg)); - n = ctx.mk_enode(e, args.size(), args.c_ptr()); + n = ctx.mk_enode(e, args.size(), args.data()); ctx.attach_node(n); } return n; diff --git a/src/sat/smt/arith_solver.cpp b/src/sat/smt/arith_solver.cpp index e38d8d7b2..cd2433ead 100644 --- a/src/sat/smt/arith_solver.cpp +++ b/src/sat/smt/arith_solver.cpp @@ -613,7 +613,7 @@ namespace arith { else args.push_back(values.get(arg->get_root_id())); } - value = m.mk_app(to_app(o)->get_decl(), args.size(), args.c_ptr()); + value = m.mk_app(to_app(o)->get_decl(), args.size(), args.data()); ctx.get_rewriter()(value); } else { @@ -865,7 +865,7 @@ namespace arith { } } if (!vars.empty()) - lp().random_update(vars.size(), vars.c_ptr()); + lp().random_update(vars.size(), vars.data()); } bool solver::assume_eqs() { @@ -1351,7 +1351,7 @@ namespace arith { if (args.size() == 1) return app_ref(to_app(args[0].get()), m); - return app_ref(a.mk_add(args.size(), args.c_ptr()), m); + return app_ref(a.mk_add(args.size(), args.data()), m); } app_ref solver::mk_term(lp::lar_term const& term, bool is_int) { diff --git a/src/sat/smt/array_axioms.cpp b/src/sat/smt/array_axioms.cpp index b2ecc139a..1db56b3e1 100644 --- a/src/sat/smt/array_axioms.cpp +++ b/src/sat/smt/array_axioms.cpp @@ -319,7 +319,7 @@ namespace array { ptr_vector sel_args(num_args, select->get_args()); sel_args[0] = arr; expr_ref sel(a.mk_select(sel_args), m); - expr_ref val(m.mk_app(f, sel_args.size() - 1, sel_args.c_ptr() + 1), m); + expr_ref val(m.mk_app(f, sel_args.size() - 1, sel_args.data() + 1), m); euf::enode* n1 = e_internalize(sel); euf::enode* n2 = e_internalize(val); return ctx.propagate(n1, n2, array_axiom()); @@ -450,10 +450,10 @@ namespace array { args1.push_back(k); args2.push_back(k); } - expr * sel1 = a.mk_select(dimension+1, args1.c_ptr()); - expr * sel2 = a.mk_select(dimension+1, args2.c_ptr()); + expr * sel1 = a.mk_select(dimension+1, args1.data()); + expr * sel2 = a.mk_select(dimension+1, args2.data()); expr * eq = m.mk_eq(sel1, sel2); - expr_ref q(m.mk_forall(dimension, sorts.c_ptr(), names.c_ptr(), eq), m); + expr_ref q(m.mk_forall(dimension, sorts.data(), names.data(), eq), m); rewrite(q); return add_clause(~eq_internalize(e1, e2), mk_literal(q)); } @@ -573,7 +573,7 @@ namespace array { r->mark1(); to_unmark.push_back(r); } - TRACE("array", tout << "collecting shared vars...\n" << unsigned_vector(roots.size(), (unsigned*)roots.c_ptr()) << "\n";); + TRACE("array", tout << "collecting shared vars...\n" << unsigned_vector(roots.size(), (unsigned*)roots.data()) << "\n";); for (auto* n : to_unmark) n->unmark1(); } diff --git a/src/sat/smt/array_diagnostics.cpp b/src/sat/smt/array_diagnostics.cpp index 4c48dfa40..f28cc47b4 100644 --- a/src/sat/smt/array_diagnostics.cpp +++ b/src/sat/smt/array_diagnostics.cpp @@ -118,8 +118,8 @@ namespace array { args.push_back(n->get_arg(i)); for (euf::enode* n : args) eargs.push_back(n->get_expr()); - expr_ref sel(a.mk_select(eargs.size(), eargs.c_ptr()), m); - euf::enode* n1 = ctx.get_egraph().find(sel, args.size(), args.c_ptr()); + expr_ref sel(a.mk_select(eargs.size(), eargs.data()), m); + euf::enode* n1 = ctx.get_egraph().find(sel, args.size(), args.data()); if (n1 && n1->get_root() == n->get_root()) return; IF_VERBOSE(0, diff --git a/src/sat/smt/array_model.cpp b/src/sat/smt/array_model.cpp index 0ca3bb48e..b74270c23 100644 --- a/src/sat/smt/array_model.cpp +++ b/src/sat/smt/array_model.cpp @@ -95,7 +95,7 @@ namespace array { args.reset(); for (unsigned i = 1; i < p->num_args(); ++i) args.push_back(values.get(p->get_arg(i)->get_root_id())); - fi->insert_entry(args.c_ptr(), value); + fi->insert_entry(args.data(), value); } } diff --git a/src/sat/smt/bv_internalize.cpp b/src/sat/smt/bv_internalize.cpp index 27334d637..87611386b 100644 --- a/src/sat/smt/bv_internalize.cpp +++ b/src/sat/smt/bv_internalize.cpp @@ -413,7 +413,7 @@ namespace bv { unsigned i = 0; for (expr* b : k_bits) args.push_back(m.mk_ite(b, m_autil.mk_int(power2(i++)), zero)); - expr_ref sum(m_autil.mk_add(sz, args.c_ptr()), m); + expr_ref sum(m_autil.mk_add(sz, args.data()), m); expr_ref eq = mk_eq(n, sum); sat::literal lit = ctx.internalize(eq, false, false, m_is_redundant); add_unit(lit); @@ -471,9 +471,9 @@ namespace bv { get_arg_bits(n, Rev ? 0 : 1, arg2_bits); expr_ref le(m); if (Signed) - m_bb.mk_sle(arg1_bits.size(), arg1_bits.c_ptr(), arg2_bits.c_ptr(), le); + m_bb.mk_sle(arg1_bits.size(), arg1_bits.data(), arg2_bits.data(), le); else - m_bb.mk_ule(arg1_bits.size(), arg1_bits.c_ptr(), arg2_bits.c_ptr(), le); + m_bb.mk_ule(arg1_bits.size(), arg1_bits.data(), arg2_bits.data(), le); literal def = ctx.internalize(le, false, false, m_is_redundant); if (Negated) def.neg(); @@ -535,7 +535,7 @@ namespace bv { SASSERT(n->get_num_args() == 1); expr_ref_vector arg1_bits(m), bits(m); get_arg_bits(n, 0, arg1_bits); - fn(arg1_bits.size(), arg1_bits.c_ptr(), bits); + fn(arg1_bits.size(), arg1_bits.data(), bits); init_bits(n, bits); } @@ -544,7 +544,7 @@ namespace bv { expr_ref_vector arg1_bits(m), bits(m); get_arg_bits(n, 0, arg1_bits); unsigned param = n->get_decl()->get_parameter(0).get_int(); - fn(arg1_bits.size(), arg1_bits.c_ptr(), param, bits); + fn(arg1_bits.size(), arg1_bits.data(), param, bits); init_bits(n, bits); } @@ -554,7 +554,7 @@ namespace bv { get_arg_bits(e, 0, arg1_bits); get_arg_bits(e, 1, arg2_bits); SASSERT(arg1_bits.size() == arg2_bits.size()); - fn(arg1_bits.size(), arg1_bits.c_ptr(), arg2_bits.c_ptr(), bits); + fn(arg1_bits.size(), arg1_bits.data(), arg2_bits.data(), bits); init_bits(e, bits); } @@ -568,7 +568,7 @@ namespace bv { get_arg_bits(e, i, arg_bits); SASSERT(arg_bits.size() == bits.size()); new_bits.reset(); - fn(arg_bits.size(), arg_bits.c_ptr(), bits.c_ptr(), new_bits); + fn(arg_bits.size(), arg_bits.data(), bits.data(), new_bits); bits.swap(new_bits); } init_bits(e, bits); @@ -581,7 +581,7 @@ namespace bv { get_arg_bits(n, 0, arg1_bits); get_arg_bits(n, 1, arg2_bits); expr_ref out(m); - fn(arg1_bits.size(), arg1_bits.c_ptr(), arg2_bits.c_ptr(), out); + fn(arg1_bits.size(), arg1_bits.data(), arg2_bits.data(), out); sat::literal def = ctx.internalize(out, false, false, m_is_redundant); add_def(def, expr2literal(n)); } @@ -613,7 +613,7 @@ namespace bv { get_arg_bits(n, 1, arg2_bits); SASSERT(arg1_bits.size() == arg2_bits.size()); expr_ref carry(m); - m_bb.mk_subtracter(arg1_bits.size(), arg1_bits.c_ptr(), arg2_bits.c_ptr(), bits, carry); + m_bb.mk_subtracter(arg1_bits.size(), arg1_bits.data(), arg2_bits.data(), bits, carry); init_bits(n, bits); } @@ -748,6 +748,6 @@ namespace bv { eqs.push_back(~eq); } TRACE("bv", for (auto l : eqs) tout << mk_bounded_pp(literal2expr(l), m) << " "; tout << "\n";); - s().add_clause(eqs.size(), eqs.c_ptr(), sat::status::th(m_is_redundant, get_id())); + s().add_clause(eqs.size(), eqs.data(), sat::status::th(m_is_redundant, get_id())); } } diff --git a/src/sat/smt/bv_solver.cpp b/src/sat/smt/bv_solver.cpp index 52a6be565..8c7238f1f 100644 --- a/src/sat/smt/bv_solver.cpp +++ b/src/sat/smt/bv_solver.cpp @@ -568,7 +568,7 @@ namespace bv { hash(solver& s) :s(s) {} bool operator()(theory_var v) const { literal_vector const& a = s.m_bits[v]; - return string_hash(reinterpret_cast(a.c_ptr()), a.size() * sizeof(sat::literal), 3); + return string_hash(reinterpret_cast(a.data()), a.size() * sizeof(sat::literal), 3); } }; eq eq_proc(*this); diff --git a/src/sat/smt/euf_internalize.cpp b/src/sat/smt/euf_internalize.cpp index e98129710..ea13ba398 100644 --- a/src/sat/smt/euf_internalize.cpp +++ b/src/sat/smt/euf_internalize.cpp @@ -96,7 +96,7 @@ namespace euf { if (auto* s = expr2solver(e)) s->internalize(e, m_is_redundant); else - attach_node(m_egraph.mk(e, m_generation, num, m_args.c_ptr())); + attach_node(m_egraph.mk(e, m_generation, num, m_args.data())); return true; } @@ -165,9 +165,9 @@ namespace euf { if (m.is_distinct(e)) { enode_vector _args(args); if (sign) - add_not_distinct_axiom(e, _args.c_ptr()); + add_not_distinct_axiom(e, _args.data()); else - add_distinct_axiom(e, _args.c_ptr()); + add_distinct_axiom(e, _args.data()); return true; } return false; @@ -192,7 +192,7 @@ namespace euf { } s().mk_clause(lits, st); if (relevancy_enabled()) - add_root(lits.size(), lits.c_ptr()); + add_root(lits.size(), lits.data()); } else { // g(f(x_i)) = x_i @@ -214,7 +214,7 @@ namespace euf { eqs.push_back(mk_eq(fapp, a)); } pb_util pb(m); - expr_ref at_least2(pb.mk_at_least_k(eqs.size(), eqs.c_ptr(), 2), m); + expr_ref at_least2(pb.mk_at_least_k(eqs.size(), eqs.data(), 2), m); sat::literal lit = si.internalize(at_least2, m_is_redundant); s().mk_clause(1, &lit, st); if (relevancy_enabled()) diff --git a/src/sat/smt/euf_model.cpp b/src/sat/smt/euf_model.cpp index 895cbb701..a9a721ccc 100644 --- a/src/sat/smt/euf_model.cpp +++ b/src/sat/smt/euf_model.cpp @@ -35,7 +35,7 @@ namespace euf { ~user_sort() { for (auto kv : sort2values) - mdl->register_usort(kv.m_key, kv.m_value->size(), kv.m_value->c_ptr()); + mdl->register_usort(kv.m_key, kv.m_value->size(), kv.m_value->data()); } void add(enode* r, sort* srt) { @@ -203,8 +203,8 @@ namespace euf { args.push_back(m_values.get(arg->get_root_id())); DEBUG_CODE(for (expr* arg : args) VERIFY(arg);); SASSERT(args.size() == arity); - if (!fi->get_entry(args.c_ptr())) - fi->insert_new_entry(args.c_ptr(), v); + if (!fi->get_entry(args.data())) + fi->insert_new_entry(args.data(), v); } } } diff --git a/src/sat/smt/euf_solver.h b/src/sat/smt/euf_solver.h index 0361e0735..ae9ba1488 100644 --- a/src/sat/smt/euf_solver.h +++ b/src/sat/smt/euf_solver.h @@ -380,7 +380,7 @@ namespace euf { ::solver::fresh_eh_t& fresh_eh); bool watches_fixed(enode* n) const; void assign_fixed(enode* n, expr* val, unsigned sz, literal const* explain); - void assign_fixed(enode* n, expr* val, literal_vector const& explain) { assign_fixed(n, val, explain.size(), explain.c_ptr()); } + void assign_fixed(enode* n, expr* val, literal_vector const& explain) { assign_fixed(n, val, explain.size(), explain.data()); } void assign_fixed(enode* n, expr* val, literal explain) { assign_fixed(n, val, 1, &explain); } void user_propagate_register_final(::solver::final_eh_t& final_eh) { diff --git a/src/sat/smt/pb_internalize.cpp b/src/sat/smt/pb_internalize.cpp index 5f7b04fd5..f30d25b31 100644 --- a/src/sat/smt/pb_internalize.cpp +++ b/src/sat/smt/pb_internalize.cpp @@ -263,7 +263,7 @@ namespace pb { for (sat::literal l : c) { lits.push_back(lit2expr(l)); } - expr_ref fml(m_pb.mk_at_least_k(c.size(), lits.c_ptr(), c.k()), m); + expr_ref fml(m_pb.mk_at_least_k(c.size(), lits.data(), c.k()), m); if (c.lit() != sat::null_literal) { fml = m.mk_eq(lit2expr(c.lit()), fml); @@ -279,7 +279,7 @@ namespace pb { coeffs.push_back(rational(wl.first)); } rational k(p.k()); - expr_ref fml(m_pb.mk_ge(p.size(), coeffs.c_ptr(), lits.c_ptr(), k), m); + expr_ref fml(m_pb.mk_ge(p.size(), coeffs.data(), lits.data(), k), m); if (p.lit() != sat::null_literal) { fml = m.mk_eq(lit2expr(p.lit()), fml); diff --git a/src/sat/smt/pb_solver.cpp b/src/sat/smt/pb_solver.cpp index 041a5485e..4b5d63cf4 100644 --- a/src/sat/smt/pb_solver.cpp +++ b/src/sat/smt/pb_solver.cpp @@ -99,7 +99,7 @@ namespace pb { } if (p.k() == 1 && p.lit() == sat::null_literal) { literal_vector lits(p.literals()); - s().mk_clause(lits.size(), lits.c_ptr(), sat::status::th(p.learned(), get_id())); + s().mk_clause(lits.size(), lits.data(), sat::status::th(p.learned(), get_id())); IF_VERBOSE(100, display(verbose_stream() << "add clause: " << lits << "\n", p, true);); remove_constraint(p, "implies clause"); } @@ -150,8 +150,8 @@ namespace pb { unsigned k = p.k() - true_val; if (k == 1 && p.lit() == sat::null_literal) { - literal_vector lits(sz, p.literals().c_ptr()); - s().mk_clause(sz, lits.c_ptr(), sat::status::th(p.learned(), get_id())); + literal_vector lits(sz, p.literals().data()); + s().mk_clause(sz, lits.data(), sat::status::th(p.learned(), get_id())); remove_constraint(p, "is clause"); return; } @@ -448,14 +448,14 @@ namespace pb { } else if (k == 1 && p.lit() == sat::null_literal) { - literal_vector lits(sz, p.literals().c_ptr()); - s().mk_clause(sz, lits.c_ptr(), sat::status::th(p.learned(), get_id())); + literal_vector lits(sz, p.literals().data()); + s().mk_clause(sz, lits.data(), sat::status::th(p.learned(), get_id())); remove_constraint(p, "recompiled to clause"); return; } else if (all_units) { - literal_vector lits(sz, p.literals().c_ptr()); + literal_vector lits(sz, p.literals().data()); add_at_least(p.lit(), lits, k, p.learned()); remove_constraint(p, "recompiled to cardinality"); return; @@ -1368,10 +1368,10 @@ namespace pb { constraint* solver::add_at_least(literal lit, literal_vector const& lits, unsigned k, bool learned) { if (k == 1 && lit == sat::null_literal) { literal_vector _lits(lits); - s().mk_clause(_lits.size(), _lits.c_ptr(), sat::status::th(learned, get_id())); + s().mk_clause(_lits.size(), _lits.data(), sat::status::th(learned, get_id())); return nullptr; } - if (!learned && clausify(lit, lits.size(), lits.c_ptr(), k)) { + if (!learned && clausify(lit, lits.size(), lits.data(), k)) { return nullptr; } void * mem = m_allocator.allocate(card::get_obj_size(lits.size())); @@ -2143,7 +2143,7 @@ namespace pb { s.s().mk_clause(~m_lits[i], max); } m_lits.push_back(~max); - s.s().mk_clause(m_lits.size(), m_lits.c_ptr()); + s.s().mk_clause(m_lits.size(), m_lits.data()); return max; } } @@ -2168,7 +2168,7 @@ namespace pb { m_lits[i] = ~m_lits[i]; } m_lits.push_back(min); - s.s().mk_clause(m_lits.size(), m_lits.c_ptr()); + s.s().mk_clause(m_lits.size(), m_lits.data()); return min; } } @@ -2177,7 +2177,7 @@ namespace pb { void solver::ba_sort::mk_clause(unsigned n, literal const* lits) { m_lits.reset(); m_lits.append(n, lits); - s.s().mk_clause(n, m_lits.c_ptr()); + s.s().mk_clause(n, m_lits.data()); } std::ostream& solver::ba_sort::pp(std::ostream& out, literal l) const { @@ -2306,8 +2306,8 @@ namespace pb { } if (k == 1 && c.lit() == sat::null_literal) { - literal_vector lits(sz, c.literals().c_ptr()); - s().mk_clause(sz, lits.c_ptr(), sat::status::th(c.learned(), get_id())); + literal_vector lits(sz, c.literals().data()); + s().mk_clause(sz, lits.data(), sat::status::th(c.learned(), get_id())); remove_constraint(c, "recompiled to clause"); return; } @@ -2417,7 +2417,7 @@ namespace pb { } if (is_cardinality(p, m_lemma)) { - literal lit = m_sort.ge(is_def, p.k(), m_lemma.size(), m_lemma.c_ptr()); + literal lit = m_sort.ge(is_def, p.k(), m_lemma.size(), m_lemma.data()); if (is_def) { s().mk_clause(p.lit(), ~lit); s().mk_clause(~p.lit(), lit); @@ -3450,7 +3450,7 @@ namespace pb { for (wliteral wl : m_wlits) { if (value(wl.second) == l_false) lits.push_back(wl.second); } - unsigned glue = s().num_diff_levels(lits.size(), lits.c_ptr()); + unsigned glue = s().num_diff_levels(lits.size(), lits.data()); c->set_glue(glue); } return c; @@ -3761,7 +3761,7 @@ namespace pb { // ~c.lits() <= n - k lits.reset(); for (unsigned j = 0; j < n; ++j) lits.push_back(c[j]); - add_cardinality(lits.size(), lits.c_ptr(), n - k); + add_cardinality(lits.size(), lits.data(), n - k); } else { // @@ -3778,13 +3778,13 @@ namespace pb { coeffs.reset(); for (literal l : c) lits.push_back(l), coeffs.push_back(1); lits.push_back(~c.lit()); coeffs.push_back(n - k + 1); - add_pb(lits.size(), lits.c_ptr(), coeffs.c_ptr(), n); + add_pb(lits.size(), lits.data(), coeffs.data(), n); lits.reset(); coeffs.reset(); for (literal l : c) lits.push_back(~l), coeffs.push_back(1); lits.push_back(c.lit()); coeffs.push_back(k); - add_pb(lits.size(), lits.c_ptr(), coeffs.c_ptr(), n); + add_pb(lits.size(), lits.data(), coeffs.data(), n); } break; } @@ -3800,7 +3800,7 @@ namespace pb { // <=> // ~wl + ... + ~w_n <= sum_of_weights - k for (wliteral wl : p) lits.push_back(~(wl.second)), coeffs.push_back(wl.first); - add_pb(lits.size(), lits.c_ptr(), coeffs.c_ptr(), sum - p.k()); + add_pb(lits.size(), lits.data(), coeffs.data(), sum - p.k()); } else { // lit <=> w1 + .. + w_n >= k @@ -3812,13 +3812,13 @@ namespace pb { // k*lit + ~wl + ... + ~w_n <= sum lits.push_back(p.lit()), coeffs.push_back(p.k()); for (wliteral wl : p) lits.push_back(~(wl.second)), coeffs.push_back(wl.first); - add_pb(lits.size(), lits.c_ptr(), coeffs.c_ptr(), sum); + add_pb(lits.size(), lits.data(), coeffs.data(), sum); lits.reset(); coeffs.reset(); lits.push_back(~p.lit()), coeffs.push_back(sum + 1 - p.k()); for (wliteral wl : p) lits.push_back(wl.second), coeffs.push_back(wl.first); - add_pb(lits.size(), lits.c_ptr(), coeffs.c_ptr(), sum); + add_pb(lits.size(), lits.data(), coeffs.data(), sum); } break; } diff --git a/src/sat/smt/q_eval.cpp b/src/sat/smt/q_eval.cpp index d06d05480..8f03d4d8b 100644 --- a/src/sat/smt/q_eval.cpp +++ b/src/sat/smt/q_eval.cpp @@ -182,7 +182,7 @@ namespace q { todo.push_back(arg); } if (args.size() == to_app(t)->get_num_args()) { - euf::enode* n = ctx.get_egraph().find(t, args.size(), args.c_ptr()); + euf::enode* n = ctx.get_egraph().find(t, args.size(), args.data()); if (!n) return nullptr; m_indirect_nodes.push_back(n); diff --git a/src/sat/smt/q_mam.cpp b/src/sat/smt/q_mam.cpp index d48613e19..a73df33ae 100644 --- a/src/sat/smt/q_mam.cpp +++ b/src/sat/smt/q_mam.cpp @@ -1012,7 +1012,7 @@ namespace q { SASSERT(m_vars[to_var(arg)->get_idx()] != -1); iregs.push_back(m_vars[to_var(arg)->get_idx()]); } - m_seq.push_back(m_ct_manager.mk_is_cgr(lbl, first_app_reg, num_args, iregs.c_ptr())); + m_seq.push_back(m_ct_manager.mk_is_cgr(lbl, first_app_reg, num_args, iregs.data())); } else { // Generate a BIND operation for this application. @@ -1089,7 +1089,7 @@ namespace q { } unsigned oreg = m_tree->m_num_regs; m_tree->m_num_regs += 1; - m_seq.push_back(m_ct_manager.mk_get_cgr(n->get_decl(), oreg, n->get_num_args(), iregs.c_ptr())); + m_seq.push_back(m_ct_manager.mk_get_cgr(n->get_decl(), oreg, n->get_num_args(), iregs.data())); return oreg; } @@ -1201,7 +1201,7 @@ namespace q { } } SASSERT(joints.size() == num_args); - m_seq.push_back(m_ct_manager.mk_cont(lbl, num_args, oreg, s, joints.c_ptr())); + m_seq.push_back(m_ct_manager.mk_cont(lbl, num_args, oreg, s, joints.data())); m_num_choices++; while (!m_todo.empty()) linearise_core(); @@ -2621,7 +2621,7 @@ namespace q { goto backtrack; cgr_common: - m_n1 = ctx.get_egraph().get_enode_eq_to(static_cast(m_pc)->m_label, static_cast(m_pc)->m_num_args, m_args.c_ptr()); + m_n1 = ctx.get_egraph().get_enode_eq_to(static_cast(m_pc)->m_label, static_cast(m_pc)->m_num_args, m_args.data()); if (!m_n1 || !ctx.is_relevant(m_n1)) goto backtrack; update_max_generation(m_n1, nullptr); diff --git a/src/sat/smt/q_model_fixer.cpp b/src/sat/smt/q_model_fixer.cpp index 3d2a06629..512a21179 100644 --- a/src/sat/smt/q_model_fixer.cpp +++ b/src/sat/smt/q_model_fixer.cpp @@ -162,7 +162,7 @@ namespace q { bool operator()(expr* a, expr* b) const { return (*p)(a, b); } }; lt _lt(proj); - std::sort(values.c_ptr(), values.c_ptr() + values.size(), _lt); + std::sort(values.data(), values.data() + values.size(), _lt); unsigned j = 0; for (unsigned i = 0; i < values.size(); ++i) if (i == 0 || values.get(i - 1) != values.get(i)) diff --git a/src/sat/smt/q_queue.cpp b/src/sat/smt/q_queue.cpp index 96eee11c7..add7dbc41 100644 --- a/src/sat/smt/q_queue.cpp +++ b/src/sat/smt/q_queue.cpp @@ -110,14 +110,14 @@ namespace q { float queue::get_cost(fingerprint& f) { set_values(f, 0); - float r = m_evaluator(m_cost_function, m_vals.size(), m_vals.c_ptr()); + float r = m_evaluator(m_cost_function, m_vals.size(), m_vals.data()); f.c->m_stat->update_max_cost(r); return r; } unsigned queue::get_new_gen(fingerprint& f, float cost) { set_values(f, cost); - float r = m_evaluator(m_new_gen_function, m_vals.size(), m_vals.c_ptr()); + float r = m_evaluator(m_new_gen_function, m_vals.size(), m_vals.data()); return std::max(f.m_max_generation + 1, static_cast(r)); } diff --git a/src/sat/smt/sat_dual_solver.cpp b/src/sat/smt/sat_dual_solver.cpp index e26bbb30d..22af58d59 100644 --- a/src/sat/smt/sat_dual_solver.cpp +++ b/src/sat/smt/sat_dual_solver.cpp @@ -98,7 +98,7 @@ namespace sat { m_lits.reset(); for (unsigned i = 0; i < sz; ++i) m_lits.push_back(ext2lit(clause[i])); - m_solver.mk_clause(sz, m_lits.c_ptr(), status::input()); + m_solver.mk_clause(sz, m_lits.data(), status::input()); } bool dual_solver::operator()(solver const& s) { @@ -107,11 +107,11 @@ namespace sat { if (m_roots.empty()) return true; m_solver.user_push(); - m_solver.add_clause(m_roots.size(), m_roots.c_ptr(), status::input()); + m_solver.add_clause(m_roots.size(), m_roots.data(), status::input()); m_lits.reset(); for (bool_var v : m_tracked_vars) m_lits.push_back(literal(v, l_false == s.value(m_var2ext[v]))); - lbool is_sat = m_solver.check(m_lits.size(), m_lits.c_ptr()); + lbool is_sat = m_solver.check(m_lits.size(), m_lits.data()); if (is_sat == l_false) for (literal lit : m_solver.get_core()) m_core.push_back(lit2ext(lit)); diff --git a/src/sat/smt/sat_th.cpp b/src/sat/smt/sat_th.cpp index 5e391533a..2870c263f 100644 --- a/src/sat/smt/sat_th.cpp +++ b/src/sat/smt/sat_th.cpp @@ -163,7 +163,7 @@ namespace euf { bool was_true = false; for (auto lit : lits) was_true |= is_true(lit); - s().add_clause(lits.size(), lits.c_ptr(), mk_status()); + s().add_clause(lits.size(), lits.data(), mk_status()); return !was_true; } @@ -191,7 +191,7 @@ namespace euf { if (!suppress_args) for (expr* arg : *to_app(e)) m_args.push_back(expr2enode(arg)); - euf::enode* n = ctx.mk_enode(e, m_args.size(), m_args.c_ptr()); + euf::enode* n = ctx.mk_enode(e, m_args.size(), m_args.data()); ctx.attach_node(n); return n; } @@ -251,11 +251,11 @@ namespace euf { } th_explain* th_explain::propagate(th_euf_solver& th, sat::literal_vector const& lits, enode_pair_vector const& eqs, sat::literal consequent) { - return mk(th, lits.size(), lits.c_ptr(), eqs.size(), eqs.c_ptr(), consequent, nullptr, nullptr); + return mk(th, lits.size(), lits.data(), eqs.size(), eqs.data(), consequent, nullptr, nullptr); } th_explain* th_explain::propagate(th_euf_solver& th, sat::literal_vector const& lits, enode_pair_vector const& eqs, euf::enode* x, euf::enode* y) { - return mk(th, lits.size(), lits.c_ptr(), eqs.size(), eqs.c_ptr(), sat::null_literal, x, y); + return mk(th, lits.size(), lits.data(), eqs.size(), eqs.data(), sat::null_literal, x, y); } th_explain* th_explain::propagate(th_euf_solver& th, sat::literal lit, euf::enode* x, euf::enode* y) { @@ -263,7 +263,7 @@ namespace euf { } th_explain* th_explain::conflict(th_euf_solver& th, sat::literal_vector const& lits, enode_pair_vector const& eqs) { - return conflict(th, lits.size(), lits.c_ptr(), eqs.size(), eqs.c_ptr()); + return conflict(th, lits.size(), lits.data(), eqs.size(), eqs.data()); } th_explain* th_explain::conflict(th_euf_solver& th, unsigned n_lits, sat::literal const* lits, unsigned n_eqs, enode_pair const* eqs) { @@ -271,7 +271,7 @@ namespace euf { } th_explain* th_explain::conflict(th_euf_solver& th, enode_pair_vector const& eqs) { - return conflict(th, 0, nullptr, eqs.size(), eqs.c_ptr()); + return conflict(th, 0, nullptr, eqs.size(), eqs.data()); } th_explain* th_explain::conflict(th_euf_solver& th, sat::literal lit) { diff --git a/src/sat/smt/sat_th.h b/src/sat/smt/sat_th.h index d7865300d..f8e26e345 100644 --- a/src/sat/smt/sat_th.h +++ b/src/sat/smt/sat_th.h @@ -211,7 +211,7 @@ namespace euf { public: static th_explain* conflict(th_euf_solver& th, sat::literal_vector const& lits, enode_pair_vector const& eqs); - static th_explain* conflict(th_euf_solver& th, sat::literal_vector const& lits) { return conflict(th, lits.size(), lits.c_ptr(), 0, nullptr); } + static th_explain* conflict(th_euf_solver& th, sat::literal_vector const& lits) { return conflict(th, lits.size(), lits.data(), 0, nullptr); } static th_explain* conflict(th_euf_solver& th, unsigned n_lits, sat::literal const* lits, unsigned n_eqs, enode_pair const* eqs); static th_explain* conflict(th_euf_solver& th, enode_pair_vector const& eqs); static th_explain* conflict(th_euf_solver& th, sat::literal lit); diff --git a/src/sat/tactic/goal2sat.cpp b/src/sat/tactic/goal2sat.cpp index a41ff72b8..d11ff60a9 100644 --- a/src/sat/tactic/goal2sat.cpp +++ b/src/sat/tactic/goal2sat.cpp @@ -419,7 +419,7 @@ struct goal2sat::imp : public sat::sat_internalizer { } } else { - mk_root_clause(m_result_stack.size(), m_result_stack.c_ptr()); + mk_root_clause(m_result_stack.size(), m_result_stack.data()); } m_result_stack.shrink(old_sz); } @@ -442,7 +442,7 @@ struct goal2sat::imp : public sat::sat_internalizer { // I have to execute it after the binary mk_clause above. mk_clause(num+1, lits); if (aig()) - aig()->add_or(l, num, aig_lits.c_ptr()); + aig()->add_or(l, num, aig_lits.data()); m_solver.set_phase(~l); m_result_stack.shrink(old_sz); @@ -463,7 +463,7 @@ struct goal2sat::imp : public sat::sat_internalizer { for (unsigned i = 0; i < num; ++i) { m_result_stack[i].neg(); } - mk_root_clause(m_result_stack.size(), m_result_stack.c_ptr()); + mk_root_clause(m_result_stack.size(), m_result_stack.data()); } else { for (unsigned i = 0; i < num; ++i) { @@ -495,7 +495,7 @@ struct goal2sat::imp : public sat::sat_internalizer { } mk_clause(num+1, lits); if (aig()) { - aig()->add_and(l, num, aig_lits.c_ptr()); + aig()->add_and(l, num, aig_lits.data()); } m_solver.set_phase(l); if (sign) diff --git a/src/sat/tactic/sat_tactic.cpp b/src/sat/tactic/sat_tactic.cpp index 3a1f19fe7..4c511fa98 100644 --- a/src/sat/tactic/sat_tactic.cpp +++ b/src/sat/tactic/sat_tactic.cpp @@ -63,7 +63,7 @@ class sat_tactic : public tactic { IF_VERBOSE(TACTIC_VERBOSITY_LVL, m_solver->display_status(verbose_stream());); TRACE("sat_dimacs", m_solver->display_dimacs(tout);); dep2assumptions(dep2asm, assumptions); - lbool r = m_solver->check(assumptions.size(), assumptions.c_ptr()); + lbool r = m_solver->check(assumptions.size(), assumptions.data()); TRACE("sat", tout << "result of checking: " << r << " "; if (r == l_undef) tout << m_solver->get_reason_unknown(); tout << "\n";); if (r == l_false) { diff --git a/src/shell/dimacs_frontend.cpp b/src/shell/dimacs_frontend.cpp index f11f9dc56..8dc3104fc 100644 --- a/src/shell/dimacs_frontend.cpp +++ b/src/shell/dimacs_frontend.cpp @@ -95,7 +95,7 @@ static void track_clause(sat::solver& dst, sat::literal lit = sat::literal(dst.mk_var(true, false), false); tracking_clauses.set(lit.var(), lits); lits.push_back(~lit); - dst.mk_clause(lits.size(), lits.c_ptr()); + dst.mk_clause(lits.size(), lits.data()); assumptions.push_back(lit); } @@ -254,7 +254,7 @@ unsigned read_dimacs(char const * file_name) { g_solver = &solver2; sat::literal_vector assumptions; track_clauses(solver, solver2, assumptions, tracking_clauses); - r = g_solver->check(assumptions.size(), assumptions.c_ptr()); + r = g_solver->check(assumptions.size(), assumptions.data()); } else if (par.get_bool("enable", false)) { r = solve_parallel(solver); diff --git a/src/shell/drat_frontend.cpp b/src/shell/drat_frontend.cpp index 9eccc659f..6972571e0 100644 --- a/src/shell/drat_frontend.cpp +++ b/src/shell/drat_frontend.cpp @@ -49,7 +49,7 @@ class smt_checker { expr_ref_vector args(m); for (expr* arg : *to_app(e)) args.push_back(define(arg, depth - 1)); - r = m.mk_app(to_app(e)->get_decl(), args.size(), args.c_ptr()); + r = m.mk_app(to_app(e)->get_decl(), args.size(), args.data()); } return r; } @@ -77,7 +77,7 @@ class smt_checker { m_lemma_solver->assert_expr(lit2expr(lit)); } #endif - m_units.append(units.size() - m_units.size(), units.c_ptr() + m_units.size()); + m_units.append(units.size() - m_units.size(), units.data() + m_units.size()); } void check_assertion_redundant(sat::literal_vector const& input) { @@ -111,7 +111,7 @@ class smt_checker { add_units(); drup_units.reset(); - if (m_drat.is_drup(lits.size(), lits.c_ptr(), drup_units)) { + if (m_drat.is_drup(lits.size(), lits.data(), drup_units)) { std::cout << "drup\n"; return; } @@ -194,7 +194,7 @@ public: } if (name == "is" && sz == 3) { name = sexpr->get_child(2)->get_child(0)->get_symbol(); - f = ctx.find_func_decl(name, params.size(), params.c_ptr(), args.size(), sorts.c_ptr(), rng.get()); + f = ctx.find_func_decl(name, params.size(), params.data(), args.size(), sorts.data(), rng.get()); if (!f) goto bail; datatype_util dtu(m); @@ -238,7 +238,7 @@ public: default: goto bail; } - f = ctx.find_func_decl(name, params.size(), params.c_ptr(), args.size(), sorts.c_ptr(), rng.get()); + f = ctx.find_func_decl(name, params.size(), params.data(), args.size(), sorts.data(), rng.get()); if (!f) goto bail; result = ctx.m().mk_app(f, args); @@ -328,7 +328,7 @@ static void verify_smt(char const* drat_file, char const* smt_file) { sargs.push_back(sorts.get(n)); psort_decl* pd = ctx.find_psort_decl(name); if (pd) - srt = pd->instantiate(ctx.pm(), sargs.size(), sargs.c_ptr()); + srt = pd->instantiate(ctx.pm(), sargs.size(), sargs.data()); else srt = m.mk_uninterpreted_sort(name); sorts.reserve(r.m_node_id+1); diff --git a/src/smt/arith_eq_adapter.cpp b/src/smt/arith_eq_adapter.cpp index 6f3828bd5..f251d01ae 100644 --- a/src/smt/arith_eq_adapter.cpp +++ b/src/smt/arith_eq_adapter.cpp @@ -209,9 +209,9 @@ namespace smt { if (m.proofs_enabled() && m_proof_hint.empty()) { m_proof_hint.push_back(parameter(symbol("triangle-eq"))); } - ctx.mk_th_axiom(tid, ~t1_eq_t2_lit, le_lit, m_proof_hint.size(), m_proof_hint.c_ptr()); - ctx.mk_th_axiom(tid, ~t1_eq_t2_lit, ge_lit, m_proof_hint.size(), m_proof_hint.c_ptr()); - ctx.mk_th_axiom(tid, t1_eq_t2_lit, ~le_lit, ~ge_lit, m_proof_hint.size(), m_proof_hint.c_ptr()); + 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: " << " " << mk_pp(le, m) << ": " << le_lit << " " << mk_pp(ge, m) << ": " << ge_lit @@ -219,7 +219,7 @@ namespace smt { if (m_owner.get_fparams().m_arith_add_binary_bounds) { 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.c_ptr()); + ctx.mk_th_axiom(tid, le_lit, ge_lit, m_proof_hint.size(), m_proof_hint.data()); } if (ctx.relevancy()) { relevancy_eh * eh = ctx.mk_relevancy_eh(arith_eq_relevancy_eh(n1->get_expr(), n2->get_expr(), t1_eq_t2, le, ge)); diff --git a/src/smt/arith_eq_solver.cpp b/src/smt/arith_eq_solver.cpp index 99f9cb3c6..c47880ce5 100644 --- a/src/smt/arith_eq_solver.cpp +++ b/src/smt/arith_eq_solver.cpp @@ -64,7 +64,7 @@ void arith_eq_solver::prop_mod_const(expr * e, unsigned depth, numeral const& k, prop_mod_const(a->get_arg(i), depth - 1, k, tmp); args.push_back(tmp); } - m_arith_rewriter.mk_app(a->get_decl(), args.size(), args.c_ptr(), result); + m_arith_rewriter.mk_app(a->get_decl(), args.size(), args.data(), result); } else if (m_util.is_numeral(e, n, is_int) && is_int) { result = m_util.mk_numeral(mod(n, k), true); diff --git a/src/smt/diff_logic.h b/src/smt/diff_logic.h index fa0c8255d..ee1dbd63a 100644 --- a/src/smt/diff_logic.h +++ b/src/smt/diff_logic.h @@ -640,7 +640,7 @@ public: } ); - if (!check_explanation(edges.size(), edges.c_ptr())) { + if (!check_explanation(edges.size(), edges.data())) { throw default_exception("edges are not inconsistent"); } diff --git a/src/smt/dyn_ack.cpp b/src/smt/dyn_ack.cpp index 7d35784db..42844f575 100644 --- a/src/smt/dyn_ack.cpp +++ b/src/smt/dyn_ack.cpp @@ -87,7 +87,7 @@ namespace smt { } } app_ref eq(m.mk_eq(m_app1, m_app2), m); - proof_ref a1(m.mk_congruence(m_app1, m_app2, prs.size(), prs.c_ptr()), m); + proof_ref a1(m.mk_congruence(m_app1, m_app2, prs.size(), prs.data()), m); proof_ref a2(mk_hypothesis(m, eq, true, m_app1, m_app2), m); proof * antecedents[2] = { a1.get(), a2.get() }; proof_ref false_pr(m.mk_unit_resolution(2, antecedents), m); @@ -432,7 +432,7 @@ namespace smt { justification * js = nullptr; if (m.proofs_enabled()) js = alloc(dyn_ack_cc_justification, n1, n2); - clause * cls = m_context.mk_clause(lits.size(), lits.c_ptr(), js, CLS_TH_LEMMA, del_eh); + clause * cls = m_context.mk_clause(lits.size(), lits.data(), js, CLS_TH_LEMMA, del_eh); if (!cls) { dealloc(del_eh); return; @@ -488,7 +488,7 @@ namespace smt { m.mk_eq(n2, r), m.mk_eq(n1, n2)); } - clause * cls = ctx.mk_clause(lits.size(), lits.c_ptr(), js, CLS_TH_LEMMA, del_eh); + clause * cls = ctx.mk_clause(lits.size(), lits.data(), js, CLS_TH_LEMMA, del_eh); if (!cls) { dealloc(del_eh); return; diff --git a/src/smt/expr_context_simplifier.cpp b/src/smt/expr_context_simplifier.cpp index fe733f897..eefb29458 100644 --- a/src/smt/expr_context_simplifier.cpp +++ b/src/smt/expr_context_simplifier.cpp @@ -231,10 +231,10 @@ void expr_context_simplifier::reduce_and_or(bool is_and, unsigned num_args, expr clean_trail(trail_size); if (is_and) { - m_simp.mk_and(args1.size(), args1.c_ptr(), result); + m_simp.mk_and(args1.size(), args1.data(), result); } else { - m_simp.mk_or(args1.size(), args1.c_ptr(), result); + m_simp.mk_or(args1.size(), args1.data(), result); } } diff --git a/src/smt/fingerprints.cpp b/src/smt/fingerprints.cpp index 490f62aa5..447c2b2a1 100644 --- a/src/smt/fingerprints.cpp +++ b/src/smt/fingerprints.cpp @@ -48,7 +48,7 @@ namespace smt { m_dummy.m_data = data; m_dummy.m_data_hash = data_hash; m_dummy.m_num_args = num_args; - m_dummy.m_args = m_tmp.c_ptr(); + m_dummy.m_args = m_tmp.data(); return &m_dummy; } diff --git a/src/smt/mam.cpp b/src/smt/mam.cpp index f86314820..387afa386 100644 --- a/src/smt/mam.cpp +++ b/src/smt/mam.cpp @@ -999,7 +999,7 @@ namespace { SASSERT(m_vars[to_var(arg)->get_idx()] != -1); iregs.push_back(m_vars[to_var(arg)->get_idx()]); } - m_seq.push_back(m_ct_manager.mk_is_cgr(lbl, first_app_reg, num_args, iregs.c_ptr())); + m_seq.push_back(m_ct_manager.mk_is_cgr(lbl, first_app_reg, num_args, iregs.data())); } else { // Generate a BIND operation for this application. @@ -1080,7 +1080,7 @@ namespace { } unsigned oreg = m_tree->m_num_regs; m_tree->m_num_regs += 1; - m_seq.push_back(m_ct_manager.mk_get_cgr(n->get_decl(), oreg, num_args, iregs.c_ptr())); + m_seq.push_back(m_ct_manager.mk_get_cgr(n->get_decl(), oreg, num_args, iregs.data())); return oreg; } @@ -1194,7 +1194,7 @@ namespace { } } SASSERT(joints.size() == num_args); - m_seq.push_back(m_ct_manager.mk_cont(lbl, num_args, oreg, s, joints.c_ptr())); + m_seq.push_back(m_ct_manager.mk_cont(lbl, num_args, oreg, s, joints.data())); m_num_choices++; while (!m_todo.empty()) linearise_core(); @@ -2592,7 +2592,7 @@ namespace { case GET_CGR1: #define GET_CGR_COMMON() \ - m_n1 = m_context.get_enode_eq_to(static_cast(m_pc)->m_label, static_cast(m_pc)->m_num_args, m_args.c_ptr()); \ + m_n1 = m_context.get_enode_eq_to(static_cast(m_pc)->m_label, static_cast(m_pc)->m_num_args, m_args.data()); \ if (m_n1 == 0 || !m_context.is_relevant(m_n1)) \ goto backtrack; \ update_max_generation(m_n1, nullptr); \ @@ -3653,8 +3653,8 @@ namespace { recycle(t->m_todo); t->m_todo = nullptr; // remove both marks. - unmark_enodes(to_unmark->size(), to_unmark->c_ptr()); - unmark_enodes2(to_unmark2->size(), to_unmark2->c_ptr()); + unmark_enodes(to_unmark->size(), to_unmark->data()); + unmark_enodes2(to_unmark2->size(), to_unmark2->data()); to_unmark->reset(); to_unmark2->reset(); } diff --git a/src/smt/proto_model/proto_model.cpp b/src/smt/proto_model/proto_model.cpp index cd237d851..c3e34f0de 100644 --- a/src/smt/proto_model/proto_model.cpp +++ b/src/smt/proto_model/proto_model.cpp @@ -173,7 +173,7 @@ expr* proto_model::cleanup_expr(expr_ref_vector& trail, expr* fi_else, func_decl TRACE("model_bug", tout << f->get_name() << "\n";); found_aux_fs.insert(f); } - new_t = m_rewrite.mk_app(f, args.size(), args.c_ptr()); + new_t = m_rewrite.mk_app(f, args.size(), args.data()); if (t != new_t.get()) trail.push_back(new_t); todo.pop_back(); @@ -400,7 +400,7 @@ model * proto_model::mk_model() { sort * s = get_uninterpreted_sort(i); 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.c_ptr()); + mdl->register_usort(s, buf.size(), buf.data()); } return mdl; diff --git a/src/smt/qi_queue.cpp b/src/smt/qi_queue.cpp index cce8a6339..875c728a4 100644 --- a/src/smt/qi_queue.cpp +++ b/src/smt/qi_queue.cpp @@ -121,7 +121,7 @@ namespace smt { float qi_queue::get_cost(quantifier * q, app * pat, unsigned generation, unsigned min_top_generation, unsigned max_top_generation) { q::quantifier_stat * stat = set_values(q, pat, generation, min_top_generation, max_top_generation, 0); - float r = m_evaluator(m_cost_function, m_vals.size(), m_vals.c_ptr()); + float r = m_evaluator(m_cost_function, m_vals.size(), m_vals.data()); stat->update_max_cost(r); return r; } @@ -129,7 +129,7 @@ namespace smt { unsigned qi_queue::get_new_gen(quantifier * q, unsigned generation, float cost) { // max_top_generation and min_top_generation are not available for computing inc_gen set_values(q, nullptr, generation, 0, 0, cost); - float r = m_evaluator(m_new_gen_function, m_vals.size(), m_vals.c_ptr()); + float r = m_evaluator(m_new_gen_function, m_vals.size(), m_vals.data()); return std::max(generation + 1, static_cast(r)); } @@ -254,7 +254,7 @@ namespace smt { ptr_vector args; args.push_back(m.mk_not(q)); args.append(to_app(s_instance)->get_num_args(), to_app(s_instance)->get_args()); - lemma = m.mk_or(args.size(), args.c_ptr()); + lemma = m.mk_or(args.size(), args.data()); } else if (m.is_false(s_instance)) { lemma = m.mk_not(q); @@ -274,7 +274,7 @@ namespace smt { bindings_e.push_back(bindings[i]->get_expr()); } app * bare_lemma = m.mk_or(m.mk_not(q), instance); - proof * qi_pr = m.mk_quant_inst(bare_lemma, num_bindings, bindings_e.c_ptr()); + proof * qi_pr = m.mk_quant_inst(bare_lemma, num_bindings, bindings_e.data()); proof_id = qi_pr->get_id(); if (bare_lemma == lemma) { pr1 = qi_pr; diff --git a/src/smt/seq_eq_solver.cpp b/src/smt/seq_eq_solver.cpp index 0ea878349..bd346ab4a 100644 --- a/src/smt/seq_eq_solver.cpp +++ b/src/smt/seq_eq_solver.cpp @@ -195,9 +195,9 @@ bool theory_seq::len_based_split(depeq const& e) { 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.c_ptr()+1, srt); + expr_ref x12 = mk_concat(ls.size()-1, ls.data()+1, srt); expr_ref y11 = expr_ref(rs[0], m); - expr_ref y12 = mk_concat(rs.size()-1, rs.c_ptr()+1, srt); + expr_ref y12 = mk_concat(rs.size()-1, rs.data()+1, srt); expr_ref lenX11 = mk_len(x11); expr_ref lenY11 = mk_len(y11); @@ -457,7 +457,7 @@ bool theory_seq::branch_binary_variable(depeq const& e) { } if (lenX <= rational(ys.size())) { expr_ref_vector Ys(m); - Ys.append(ys.size(), ys.c_ptr()); + Ys.append(ys.size(), ys.data()); m_eq_deps = e.dep(); if (m_eq.branch_unit_variable(x, Ys)) return true; @@ -675,9 +675,9 @@ bool theory_seq::branch_quat_variable(depeq const& e) { if (xs == ys) { expr_ref_vector xs1(m), xs2(m); xs1.reset(); - xs1.append(xs.size()-1, xs.c_ptr()+1); + xs1.append(xs.size()-1, xs.data()+1); xs2.reset(); - xs2.append(xs.size()-1, xs.c_ptr()); + xs2.append(xs.size()-1, xs.data()); if (xs1.empty() || xs2.empty()) cond = true; else if (!can_align_from_lhs(xs2, ys) && !can_align_from_rhs(xs1, ys)) @@ -759,22 +759,22 @@ bool theory_seq::branch_quat_variable(depeq const& e) { if (ctx.get_assignment(lit1) == l_false && ctx.get_assignment(lit2) == l_true) { lits.push_back(~lit1); lits.push_back(lit2); - return propagate_lit(nullptr, lits.size(), lits.c_ptr(), false_literal); + return propagate_lit(nullptr, lits.size(), lits.data(), false_literal); } if (ctx.get_assignment(lit1) == l_true && ctx.get_assignment(lit3) == l_true) { lits.push_back(lit1); lits.push_back(lit3); - return propagate_lit(nullptr, lits.size(), lits.c_ptr(), false_literal); + return propagate_lit(nullptr, lits.size(), lits.data(), false_literal); } if (ctx.get_assignment(lit1) == l_true && ctx.get_assignment(lit2) == l_false) { lits.push_back(lit1); lits.push_back(~lit2); - return propagate_lit(dep, lits.size(), lits.c_ptr(), false_literal); + return propagate_lit(dep, lits.size(), lits.data(), false_literal); } if (ctx.get_assignment(lit1) == l_false && ctx.get_assignment(lit3) == l_false) { lits.push_back(~lit1); lits.push_back(~lit3); - return propagate_lit(dep, lits.size(), lits.c_ptr(), false_literal); + return propagate_lit(dep, lits.size(), lits.data(), false_literal); } UNREACHABLE(); return false; @@ -838,7 +838,7 @@ bool theory_seq::find_branch_candidate(unsigned& start, dependency* dep, expr_re expr_ref v0(m); v0 = m_util.str.mk_empty(l->get_sort()); - if (can_be_equal(ls.size() - 1, ls.c_ptr() + 1, rs.size(), rs.c_ptr())) { + 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";); return true; @@ -851,10 +851,10 @@ bool theory_seq::find_branch_candidate(unsigned& start, dependency* dep, expr_re if (l == rs.get(j)) { return false; } - if (!can_be_equal(ls.size() - 1, ls.c_ptr() + 1, rs.size() - j - 1, rs.c_ptr() + j + 1)) { + if (!can_be_equal(ls.size() - 1, ls.data() + 1, rs.size() - j - 1, rs.data() + j + 1)) { continue; } - v0 = mk_concat(j + 1, rs.c_ptr()); + v0 = mk_concat(j + 1, rs.data()); if (assume_equality(l, v0)) { TRACE("seq", tout << mk_pp(l, m) << " " << v0 << "\n";); ++start; @@ -870,8 +870,8 @@ bool theory_seq::find_branch_candidate(unsigned& start, dependency* dep, expr_re literal_vector lits; lits.push_back(~mk_eq_empty(l)); for (unsigned i = 0; i < rs.size(); ++i) { - if (can_be_equal(ls.size() - 1, ls.c_ptr() + 1, rs.size() - i - 1, rs.c_ptr() + i + 1)) { - v0 = mk_concat(i + 1, rs.c_ptr()); + if (can_be_equal(ls.size() - 1, ls.data() + 1, rs.size() - i - 1, rs.data() + i + 1)) { + v0 = mk_concat(i + 1, rs.data()); lits.push_back(~mk_eq(l, v0, false)); } } @@ -981,7 +981,7 @@ bool theory_seq::propagate_length_coherence(expr* e) { } expr_ref emp(m_util.str.mk_empty(e->get_sort()), m); elems.push_back(seq); - tail = mk_concat(elems.size(), elems.c_ptr()); + tail = mk_concat(elems.size(), elems.data()); // len(e) >= low => e = tail; expr_ref lo_e(m_autil.mk_numeral(lo, true), m); expr_ref len_e_ge_lo(m_autil.mk_ge(mk_len(e), lo_e), m); @@ -1135,7 +1135,7 @@ bool theory_seq::solve_nth_eq(expr_ref_vector const& ls, expr_ref_vector const& expr_ref_vector ls1(m), rs1(m); expr_ref idx1(m_autil.mk_add(idx, m_autil.mk_int(1)), m); m_rewrite(idx1); - expr_ref rhs = mk_concat(rs.size(), rs.c_ptr(), ls[0]->get_sort()); + expr_ref rhs = mk_concat(rs.size(), rs.data(), ls[0]->get_sort()); if (m_nth_eq2_cache.contains(std::make_pair(rhs, ls[0]))) return false; m_nth_eq2_cache.insert(std::make_pair(rhs, ls[0])); diff --git a/src/smt/seq_ne_solver.cpp b/src/smt/seq_ne_solver.cpp index 72cdf2a8f..7dfe7d208 100644 --- a/src/smt/seq_ne_solver.cpp +++ b/src/smt/seq_ne_solver.cpp @@ -108,7 +108,7 @@ bool theory_seq::propagate_ne2lit(unsigned idx) { } else { TRACE("seq", tout << "propagate: " << undef_lit << "\n";); - propagate_lit(n.dep(), lits.size(), lits.c_ptr(), ~undef_lit); + propagate_lit(n.dep(), lits.size(), lits.data(), ~undef_lit); } return true; } diff --git a/src/smt/smt_checker.cpp b/src/smt/smt_checker.cpp index 7e4627c41..9751b33e3 100644 --- a/src/smt/smt_checker.cpp +++ b/src/smt/smt_checker.cpp @@ -127,7 +127,7 @@ namespace smt { return nullptr; buffer.push_back(arg); } - enode * e = m_context.get_enode_eq_to(n->get_decl(), num, buffer.c_ptr()); + enode * e = m_context.get_enode_eq_to(n->get_decl(), num, buffer.data()); if (e == nullptr) return nullptr; return m_context.is_relevant(e) ? e : nullptr; diff --git a/src/smt/smt_clause.cpp b/src/smt/smt_clause.cpp index f1c62a3cf..291adbecf 100644 --- a/src/smt/smt_clause.cpp +++ b/src/smt/smt_clause.cpp @@ -122,7 +122,7 @@ namespace smt { args.push_back(bool_var2expr_map[lit.var()]); if (lit.sign()) args[args.size()-1] = m.mk_not(args.back()); } - expr_ref disj(m.mk_or(args.size(), args.c_ptr()), m); + expr_ref disj(m.mk_or(args.size(), args.data()), m); return out << mk_pp(disj, m, 3); } diff --git a/src/smt/smt_clause_proof.cpp b/src/smt/smt_clause_proof.cpp index 6b59bd61f..9722d95c0 100644 --- a/src/smt/smt_clause_proof.cpp +++ b/src/smt/smt_clause_proof.cpp @@ -149,7 +149,7 @@ namespace smt { else { ps.push_back(m.mk_const("clause-trail-end", m.mk_bool_sort())); } - return proof_ref(m.mk_clause_trail(ps.size(), ps.c_ptr()), m); + return proof_ref(m.mk_clause_trail(ps.size(), ps.data()), m); } std::ostream& operator<<(std::ostream& out, clause_proof::status st) { diff --git a/src/smt/smt_conflict_resolution.cpp b/src/smt/smt_conflict_resolution.cpp index 1359fe3bd..47bc13242 100644 --- a/src/smt/smt_conflict_resolution.cpp +++ b/src/smt/smt_conflict_resolution.cpp @@ -881,7 +881,7 @@ namespace smt { app * e2_prime = m.mk_app(e2->get_decl(), e2->get_arg(1), e2->get_arg(0)); proof * pr1 = nullptr; if (!prs.empty()) { - pr1 = m.mk_congruence(e1, e2_prime, prs.size(), prs.c_ptr()); + pr1 = m.mk_congruence(e1, e2_prime, prs.size(), prs.data()); m_new_proofs.push_back(pr1); } else { @@ -908,7 +908,7 @@ namespace smt { } if (!visited) return nullptr; - proof * pr = m.mk_congruence(n1->get_expr(), n2->get_expr(), prs.size(), prs.c_ptr()); + proof * pr = m.mk_congruence(n1->get_expr(), n2->get_expr(), prs.size(), prs.data()); m_new_proofs.push_back(pr); return pr; } @@ -1042,7 +1042,7 @@ namespace smt { tout << l.index() << " " << true_literal.index() << " " << false_literal.index() << " "; m_ctx.display_literal(tout, l); tout << " --->\n"; tout << mk_ll_pp(l_exr, m);); - pr = m.mk_unit_resolution(prs.size(), prs.c_ptr(), l_exr); + pr = m.mk_unit_resolution(prs.size(), prs.data(), l_exr); m_new_proofs.push_back(pr); return pr; } @@ -1250,7 +1250,7 @@ namespace smt { for (unsigned i = 0; i < sz; i++) { tout << mk_ll_pp(prs1[i], m) << "\n"; }); - pr = m.mk_transitivity(prs1.size(), prs1.c_ptr(), lhs->get_expr(), rhs->get_expr()); + 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";); @@ -1346,7 +1346,7 @@ namespace smt { switch (lits.size()) { case 0: fact = nullptr; break; case 1: fact = lits[0]; break; - default: fact = m.mk_or(lits.size(), lits.c_ptr()); + default: fact = m.mk_or(lits.size(), lits.data()); } if (fact == nullptr) m_lemma_proof = pr; diff --git a/src/smt/smt_conflict_resolution.h b/src/smt/smt_conflict_resolution.h index 444745cd4..cf707bd31 100644 --- a/src/smt/smt_conflict_resolution.h +++ b/src/smt/smt_conflict_resolution.h @@ -233,11 +233,11 @@ namespace smt { } literal * get_lemma_literals() { - return m_lemma.c_ptr(); + return m_lemma.data(); } expr * * get_lemma_atoms() { - return m_lemma_atoms.c_ptr(); + return m_lemma_atoms.data(); } void release_lemma_atoms() { diff --git a/src/smt/smt_consequences.cpp b/src/smt/smt_consequences.cpp index 632b780dd..6b61bec62 100644 --- a/src/smt/smt_consequences.cpp +++ b/src/smt/smt_consequences.cpp @@ -244,8 +244,8 @@ namespace smt { literal lit = mk_diseq(k, v); literals.push_back(lit); - mk_clause(literals.size(), literals.c_ptr(), nullptr); - TRACE("context", display_literals_verbose(tout, literals.size(), literals.c_ptr());); + mk_clause(literals.size(), literals.data(), nullptr); + TRACE("context", display_literals_verbose(tout, literals.size(), literals.data());); } } for (expr* e : to_delete) { @@ -330,7 +330,7 @@ namespace smt { m_assumption2orig.insert(lit.var(), a); } - lbool is_sat = check(assumptions.size(), assumptions.c_ptr()); + lbool is_sat = check(assumptions.size(), assumptions.data()); if (is_sat != l_true) { TRACE("context", tout << is_sat << "\n";); diff --git a/src/smt/smt_context.cpp b/src/smt/smt_context.cpp index ff1478a0e..9c45df153 100644 --- a/src/smt/smt_context.cpp +++ b/src/smt/smt_context.cpp @@ -2547,9 +2547,9 @@ namespace smt { new_js = mk_justification(unit_resolution_justification(m_region, js, simp_lits.size(), - simp_lits.c_ptr())); + simp_lits.data())); else - new_js = alloc(unit_resolution_justification, js, simp_lits.size(), simp_lits.c_ptr()); + new_js = alloc(unit_resolution_justification, js, simp_lits.size(), simp_lits.data()); cls.set_justification(new_js); } return false; @@ -2605,10 +2605,10 @@ namespace smt { js = mk_justification(unit_resolution_justification(m_region, cls_js, simp_lits.size(), - simp_lits.c_ptr())); + simp_lits.data())); } else { - js = alloc(unit_resolution_justification, cls_js, simp_lits.size(), simp_lits.c_ptr()); + js = alloc(unit_resolution_justification, cls_js, simp_lits.size(), simp_lits.data()); // js took ownership of the justification object. cls->set_justification(nullptr); m_justifications.push_back(js); @@ -3081,7 +3081,7 @@ namespace smt { literal l2 = *set_it; if (l2 != l) { b_justification js(l); - TRACE("theory_case_split", tout << "case split literal "; l2.display(tout, m, m_bool_var2expr.c_ptr()); tout << std::endl;); + TRACE("theory_case_split", tout << "case split literal "; l2.display(tout, m, m_bool_var2expr.data()); tout << std::endl;); if (l2 == true_literal || l2 == false_literal || l2 == null_literal) continue; assign(~l2, js); if (inconsistent()) { @@ -3206,10 +3206,10 @@ namespace smt { if (lits.size() >= 2) { justification* js = nullptr; if (m.proofs_enabled()) { - proof * pr = mk_clause_def_axiom(lits.size(), lits.c_ptr(), nullptr); + proof * pr = mk_clause_def_axiom(lits.size(), lits.data(), nullptr); js = mk_justification(justification_proof_wrapper(*this, pr)); } - clausep = clause::mk(m, lits.size(), lits.c_ptr(), CLS_AUX, js); + clausep = clause::mk(m, lits.size(), lits.data(), CLS_AUX, js); } m_tmp_clauses.push_back(std::make_pair(clausep, lits)); } @@ -3238,7 +3238,7 @@ namespace smt { } if (unassigned != null_literal) { - shuffle(lits.size(), lits.c_ptr(), m_random); + shuffle(lits.size(), lits.data(), m_random); push_scope(); assign(unassigned, b_justification::mk_axiom(), true); return l_undef; @@ -3347,7 +3347,7 @@ namespace smt { 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.c_ptr(), m_unsat_core.c_ptr() + m_unsat_core.size(), ast_lt_proc()); + 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";); validate_unsat_core(); // theory validation of unsat core @@ -4188,7 +4188,7 @@ namespace smt { for (unsigned i = 0; i < num_lits; i++) { display_literal(tout, v[i]); tout << "\n"; - v[i].display(tout, m, m_bool_var2expr.c_ptr()); + v[i].display(tout, m, m_bool_var2expr.data()); tout << "\n\n"; } tout << "\n";); @@ -4601,7 +4601,7 @@ namespace smt { subst.push_back(m.mk_var(i, f->get_domain(i))); } var_subst sub(m, true); - expr_ref bodyr = sub(rhs, subst.size(), subst.c_ptr()); + expr_ref bodyr = sub(rhs, subst.size(), subst.data()); fi->set_else(bodyr); m_model->register_decl(f, fi); diff --git a/src/smt/smt_context.h b/src/smt/smt_context.h index e7e924036..163d205f8 100644 --- a/src/smt/smt_context.h +++ b/src/smt/smt_context.h @@ -910,7 +910,7 @@ namespace smt { void mk_th_axiom(theory_id tid, literal l1, literal l2, literal l3, unsigned num_params = 0, parameter * params = nullptr); void mk_th_axiom(theory_id tid, literal_vector const& ls, unsigned num_params = 0, parameter * params = nullptr) { - mk_th_axiom(tid, ls.size(), ls.c_ptr(), num_params, params); + mk_th_axiom(tid, ls.size(), ls.data(), num_params, params); } void mk_th_lemma(theory_id tid, literal l1, literal l2, unsigned num_params = 0, parameter * params = nullptr) { @@ -928,7 +928,7 @@ namespace smt { } void mk_th_lemma(theory_id tid, literal_vector const& ls, unsigned num_params = 0, parameter * params = nullptr) { - mk_th_lemma(tid, ls.size(), ls.c_ptr(), num_params, params); + mk_th_lemma(tid, ls.size(), ls.data(), num_params, params); } /* @@ -1357,14 +1357,14 @@ namespace smt { std::ostream& display_literal(std::ostream & out, literal l) const; - std::ostream& display_detailed_literal(std::ostream & out, literal l) const { l.display(out, m, m_bool_var2expr.c_ptr()); return out; } + std::ostream& display_detailed_literal(std::ostream & out, literal l) const { l.display(out, m, m_bool_var2expr.data()); return out; } void display_literal_info(std::ostream & out, literal l) const; std::ostream& display_literals(std::ostream & out, unsigned num_lits, literal const * lits) const; std::ostream& display_literals(std::ostream & out, literal_vector const& lits) const { - return display_literals(out, lits.size(), lits.c_ptr()); + return display_literals(out, lits.size(), lits.data()); } std::ostream& display_literal_smt2(std::ostream& out, literal lit) const; @@ -1373,14 +1373,14 @@ namespace smt { std::ostream& display_literals_smt2(std::ostream& out, unsigned num_lits, literal const* lits) const; - std::ostream& display_literals_smt2(std::ostream& out, literal_vector const& ls) const { return display_literals_smt2(out, ls.size(), ls.c_ptr()); } + std::ostream& display_literals_smt2(std::ostream& out, literal_vector const& ls) const { return display_literals_smt2(out, ls.size(), ls.data()); } std::ostream& display_literal_verbose(std::ostream & out, literal lit) const; std::ostream& display_literals_verbose(std::ostream & out, unsigned num_lits, literal const * lits) const; std::ostream& display_literals_verbose(std::ostream & out, literal_vector const& lits) const { - return display_literals_verbose(out, lits.size(), lits.c_ptr()); + return display_literals_verbose(out, lits.size(), lits.data()); } void display_watch_list(std::ostream & out, literal l) const; @@ -1733,7 +1733,7 @@ namespace smt { void assign_fixed(enode* n, expr* val, unsigned sz, literal const* explain); void assign_fixed(enode* n, expr* val, literal_vector const& explain) { - assign_fixed(n, val, explain.size(), explain.c_ptr()); + assign_fixed(n, val, explain.size(), explain.data()); } void assign_fixed(enode* n, expr* val, literal explain) { @@ -1778,7 +1778,7 @@ namespace smt { literal const *lits; unsigned len; pp_lits(context & ctx, unsigned len, literal const *lits) : ctx(ctx), lits(lits), len(len) {} - pp_lits(context & ctx, literal_vector const& ls) : ctx(ctx), lits(ls.c_ptr()), len(ls.size()) {} + pp_lits(context & ctx, literal_vector const& ls) : ctx(ctx), lits(ls.data()), len(ls.size()) {} }; inline std::ostream & operator<<(std::ostream & out, pp_lits const & pp) { diff --git a/src/smt/smt_context_pp.cpp b/src/smt/smt_context_pp.cpp index 63688fe77..4c3fb18e0 100644 --- a/src/smt/smt_context_pp.cpp +++ b/src/smt/smt_context_pp.cpp @@ -89,11 +89,11 @@ namespace smt { } std::ostream& context::display_literal(std::ostream & out, literal l) const { - l.display_compact(out, m_bool_var2expr.c_ptr()); return out; + l.display_compact(out, m_bool_var2expr.data()); return out; } std::ostream& context::display_literals(std::ostream & out, unsigned num_lits, literal const * lits) const { - display_compact(out, num_lits, lits, m_bool_var2expr.c_ptr()); return out; + display_compact(out, num_lits, lits, m_bool_var2expr.data()); return out; } std::ostream& context::display_literal_verbose(std::ostream & out, literal lit) const { @@ -101,7 +101,7 @@ namespace smt { } std::ostream& context::display_literals_verbose(std::ostream & out, unsigned num_lits, literal const * lits) const { - display_verbose(out, m, num_lits, lits, m_bool_var2expr.c_ptr(), "\n"); return out; + display_verbose(out, m, num_lits, lits, m_bool_var2expr.data(), "\n"); return out; } std::ostream& context::display_literal_smt2(std::ostream& out, literal l) const { @@ -120,7 +120,7 @@ namespace smt { } void context::display_literal_info(std::ostream & out, literal l) const { - l.display_compact(out, m_bool_var2expr.c_ptr()); + l.display_compact(out, m_bool_var2expr.data()); display_literal_smt2(out, l); out << "relevant: " << is_relevant(bool_var2expr(l.var())) << ", val: " << get_assignment(l) << "\n"; } @@ -171,7 +171,7 @@ namespace smt { } std::ostream& context::display_clause(std::ostream & out, clause const * cls) const { - cls->display_compact(out, m, m_bool_var2expr.c_ptr()); + cls->display_compact(out, m, m_bool_var2expr.data()); return out; } @@ -229,7 +229,7 @@ namespace smt { display_literal(out << lit << " ", lit); if (!is_relevant(lit)) out << " n "; out << ": "; - display_verbose(out, m, 1, &lit, m_bool_var2expr.c_ptr()); + display_verbose(out, m, 1, &lit, m_bool_var2expr.data()); if (level > 0) { auto j = get_justification(lit.var()); display(out << " ", j); diff --git a/src/smt/smt_farkas_util.cpp b/src/smt/smt_farkas_util.cpp index e427c9224..163f96bb0 100644 --- a/src/smt/smt_farkas_util.cpp +++ b/src/smt/smt_farkas_util.cpp @@ -347,7 +347,7 @@ namespace smt { lits.push_back(extract_consequence(lo, hi)); lo = hi; } - bool_rewriter(m).mk_or(lits.size(), lits.c_ptr(), res); + bool_rewriter(m).mk_or(lits.size(), lits.data(), res); IF_VERBOSE(2, { if (lits.size() > 1) { verbose_stream() << "combined lemma: " << res << "\n"; } }); } else { diff --git a/src/smt/smt_implied_equalities.cpp b/src/smt/smt_implied_equalities.cpp index f02639c90..a2a9098b4 100644 --- a/src/smt/smt_implied_equalities.cpp +++ b/src/smt/smt_implied_equalities.cpp @@ -163,7 +163,7 @@ namespace { } for (unsigned i = 0; i < terms.size(); ++i) { args[0] = terms[i].term; - terms[i].term = m.mk_app(m_array_util.get_family_id(), OP_SELECT, 0, nullptr, args.size(), args.c_ptr()); + terms[i].term = m.mk_app(m_array_util.get_family_id(), OP_SELECT, 0, nullptr, args.size(), args.data()); } assert_relevant(terms); VERIFY(m_solver.check_sat(0,nullptr) != l_false); diff --git a/src/smt/smt_induction.cpp b/src/smt/smt_induction.cpp index 895e8ae76..51cdb5e33 100644 --- a/src/smt/smt_induction.cpp +++ b/src/smt/smt_induction.cpp @@ -383,7 +383,7 @@ void induction_lemmas::create_hypotheses(unsigned depth, expr_ref_vector const& void induction_lemmas::add_th_lemma(literal_vector const& lits) { IF_VERBOSE(0, ctx.display_literals_verbose(verbose_stream() << "lemma:\n", lits) << "\n"); - ctx.mk_clause(lits.size(), lits.c_ptr(), nullptr, smt::CLS_TH_AXIOM); + ctx.mk_clause(lits.size(), lits.data(), nullptr, smt::CLS_TH_AXIOM); // CLS_TH_LEMMA, but then should re-instance if GC'ed ++m_num_lemmas; } @@ -451,7 +451,7 @@ void induction_lemmas::apply_induction(literal lit, induction_positions_t const induction_term_and_position_t itp(alpha, positions); bool found = m_skolems.find(itp, itp); if (found) { - sks.append(itp.m_skolems.size(), itp.m_skolems.c_ptr()); + sks.append(itp.m_skolems.size(), itp.m_skolems.data()); } unsigned i = 0; @@ -470,7 +470,7 @@ void induction_lemmas::apply_induction(literal lit, induction_positions_t const ++i; } if (!found) { - itp.m_skolems.append(sks.size(), sks.c_ptr()); + itp.m_skolems.append(sks.size(), sks.data()); m_trail.push_back(alpha); m_trail.append(sks); m_skolems.insert(itp); diff --git a/src/smt/smt_internalizer.cpp b/src/smt/smt_internalizer.cpp index 37306cb3d..4a4aed0f4 100644 --- a/src/smt/smt_internalizer.cpp +++ b/src/smt/smt_internalizer.cpp @@ -248,7 +248,7 @@ namespace smt { internalize_rec(arg, true); lits.push_back(get_literal(arg)); } - mk_root_clause(lits.size(), lits.c_ptr(), pr); + mk_root_clause(lits.size(), lits.data(), pr); add_or_rel_watches(to_app(n)); break; } @@ -592,7 +592,7 @@ namespace smt { vars.push_back(m.mk_var(sz - i - 1, q->get_decl_sort(i))); } array_util autil(m); - lam_app = autil.mk_select(vars.size(), vars.c_ptr()); + lam_app = autil.mk_select(vars.size(), vars.data()); eq = m.mk_eq(lam_app, q->get_expr()); quantifier_ref fa(m); expr * patterns[1] = { m.mk_pattern(lam_app) }; @@ -1369,7 +1369,7 @@ namespace smt { } DEBUG_CODE(for (literal lit : simp_lits) SASSERT(get_assignment(lit) == l_true);); if (!simp_lits.empty()) { - j = mk_justification(unit_resolution_justification(m_region, j, simp_lits.size(), simp_lits.c_ptr())); + j = mk_justification(unit_resolution_justification(m_region, j, simp_lits.size(), simp_lits.data())); } break; } @@ -1429,7 +1429,7 @@ namespace smt { bool save_atoms = lemma && iscope_lvl > m_base_lvl; bool reinit = save_atoms; SASSERT(!lemma || j == 0 || !j->in_region()); - clause * cls = clause::mk(m, num_lits, lits, k, j, del_eh, save_atoms, m_bool_var2expr.c_ptr()); + clause * cls = clause::mk(m, num_lits, lits, k, j, del_eh, save_atoms, m_bool_var2expr.data()); m_clause_proof.add(*cls); if (lemma) { cls->set_activity(activity); @@ -1506,7 +1506,7 @@ namespace smt { literal_buffer tmp; neg_literals(num_lits, lits, tmp); SASSERT(tmp.size() == num_lits); - display_lemma_as_smt_problem(tmp.size(), tmp.c_ptr(), false_literal, m_fparams.m_logic); + display_lemma_as_smt_problem(tmp.size(), tmp.data(), false_literal, m_fparams.m_logic); } mk_clause(num_lits, lits, js, k); } @@ -1532,7 +1532,7 @@ namespace smt { if (root_gate) new_lits.push_back(m.mk_not(root_gate)); SASSERT(num_lits > 1); - expr * fact = m.mk_or(new_lits.size(), new_lits.c_ptr()); + expr * fact = m.mk_or(new_lits.size(), new_lits.data()); return m.mk_def_axiom(fact); } @@ -1644,7 +1644,7 @@ namespace smt { mk_gate_clause(~l, l_arg); buffer.push_back(~l_arg); } - mk_gate_clause(buffer.size(), buffer.c_ptr()); + mk_gate_clause(buffer.size(), buffer.data()); } void context::mk_or_cnstr(app * n) { @@ -1656,7 +1656,7 @@ namespace smt { mk_gate_clause(l, ~l_arg); buffer.push_back(l_arg); } - mk_gate_clause(buffer.size(), buffer.c_ptr()); + mk_gate_clause(buffer.size(), buffer.data()); } void context::mk_iff_cnstr(app * n, bool sign) { diff --git a/src/smt/smt_justification.cpp b/src/smt/smt_justification.cpp index 573db1a78..acdf03222 100644 --- a/src/smt/smt_justification.cpp +++ b/src/smt/smt_justification.cpp @@ -98,7 +98,7 @@ namespace smt { 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.c_ptr()); + return m.mk_unit_resolution(prs.size(), prs.data()); } void eq_conflict_justification::get_antecedents(conflict_resolution & cr) { @@ -141,7 +141,7 @@ namespace smt { expr * lhs = m_node1->get_root()->get_expr(); expr * rhs = m_node2->get_root()->get_expr(); - proof * pr1 = m.mk_transitivity(prs.size(), prs.c_ptr(), lhs, rhs); + proof * pr1 = m.mk_transitivity(prs.size(), prs.data(), lhs, rhs); proof * pr2 = m.mk_rewrite(m.mk_eq(lhs, rhs), m.mk_false()); return m.mk_modus_ponens(pr1, pr2); } @@ -275,9 +275,9 @@ namespace smt { lits.push_back(std::move(l)); } if (lits.size() == 1) - return m.mk_th_lemma(m_th_id, lits.get(0), 0, nullptr, m_params.size(), m_params.c_ptr()); + return m.mk_th_lemma(m_th_id, lits.get(0), 0, nullptr, m_params.size(), m_params.data()); else - return m.mk_th_lemma(m_th_id, m.mk_or(lits.size(), lits.c_ptr()), 0, nullptr, m_params.size(), m_params.c_ptr()); + return m.mk_th_lemma(m_th_id, m.mk_or(lits.size(), lits.data()), 0, nullptr, m_params.size(), m_params.data()); } proof * theory_propagation_justification::mk_proof(conflict_resolution & cr) { @@ -288,7 +288,7 @@ namespace smt { ast_manager & m = cr.get_manager(); expr_ref fact(m); ctx.literal2expr(m_consequent, fact); - return m.mk_th_lemma(m_th_id, fact, prs.size(), prs.c_ptr(), m_params.size(), m_params.c_ptr()); + return m.mk_th_lemma(m_th_id, fact, prs.size(), prs.data(), m_params.size(), m_params.data()); } proof * theory_conflict_justification::mk_proof(conflict_resolution & cr) { @@ -296,7 +296,7 @@ namespace smt { if (!antecedent2proof(cr, prs)) return nullptr; ast_manager & m = cr.get_manager(); - return m.mk_th_lemma(m_th_id, m.mk_false(), prs.size(), prs.c_ptr(), m_params.size(), m_params.c_ptr()); + return m.mk_th_lemma(m_th_id, m.mk_false(), prs.size(), prs.data(), m_params.size(), m_params.data()); } ext_simple_justification::ext_simple_justification(region & r, unsigned num_lits, literal const * lits, unsigned num_eqs, enode_pair const * eqs): @@ -340,7 +340,7 @@ namespace smt { ast_manager & m = cr.get_manager(); expr_ref fact(m); ctx.literal2expr(m_consequent, fact); - return m.mk_th_lemma(m_th_id, fact, prs.size(), prs.c_ptr(), m_params.size(), m_params.c_ptr()); + return m.mk_th_lemma(m_th_id, fact, prs.size(), prs.data(), m_params.size(), m_params.data()); } proof * ext_theory_conflict_justification::mk_proof(conflict_resolution & cr) { @@ -348,7 +348,7 @@ namespace smt { if (!antecedent2proof(cr, prs)) return nullptr; ast_manager & m = cr.get_manager(); - return m.mk_th_lemma(m_th_id, m.mk_false(), prs.size(), prs.c_ptr(), m_params.size(), m_params.c_ptr()); + return m.mk_th_lemma(m_th_id, m.mk_false(), prs.size(), prs.data(), m_params.size(), m_params.data()); } proof * ext_theory_eq_propagation_justification::mk_proof(conflict_resolution & cr) { @@ -358,7 +358,7 @@ namespace smt { ast_manager & m = cr.get_manager(); context & ctx = cr.get_context(); expr * fact = ctx.mk_eq_atom(m_lhs->get_expr(), m_rhs->get_expr()); - return m.mk_th_lemma(m_th_id, fact, prs.size(), prs.c_ptr(), m_params.size(), m_params.c_ptr()); + return m.mk_th_lemma(m_th_id, fact, prs.size(), prs.data(), m_params.size(), m_params.data()); } @@ -401,9 +401,9 @@ namespace smt { lits.push_back(sign ? m.mk_not(v) : v); } if (lits.size() == 1) - return m.mk_th_lemma(m_th_id, lits.get(0), 0, nullptr, m_params.size(), m_params.c_ptr()); + return m.mk_th_lemma(m_th_id, lits.get(0), 0, nullptr, m_params.size(), m_params.data()); else - return m.mk_th_lemma(m_th_id, m.mk_or(lits.size(), lits.c_ptr()), 0, nullptr, m_params.size(), m_params.c_ptr()); + return m.mk_th_lemma(m_th_id, m.mk_or(lits.size(), lits.data()), 0, nullptr, m_params.size(), m_params.data()); } }; diff --git a/src/smt/smt_kernel.h b/src/smt/smt_kernel.h index aef5cd073..68fbca582 100644 --- a/src/smt/smt_kernel.h +++ b/src/smt/smt_kernel.h @@ -128,9 +128,9 @@ namespace smt { */ lbool check(unsigned num_assumptions = 0, expr * const * assumptions = nullptr); - lbool check(expr_ref_vector const& asms) { return check(asms.size(), asms.c_ptr()); } + lbool check(expr_ref_vector const& asms) { return check(asms.size(), asms.data()); } - lbool check(app_ref_vector const& asms) { return check(asms.size(), (expr* const*)asms.c_ptr()); } + lbool check(app_ref_vector const& asms) { return check(asms.size(), (expr* const*)asms.data()); } lbool check(expr_ref_vector const& cube, vector const& clauses); diff --git a/src/smt/smt_model_checker.cpp b/src/smt/smt_model_checker.cpp index 447cbded2..7b0877c62 100644 --- a/src/smt/smt_model_checker.cpp +++ b/src/smt/smt_model_checker.cpp @@ -85,7 +85,7 @@ namespace smt { for (expr* arg : *to_app(val)) { args.push_back(get_type_compatible_term(arg)); } - fresh_term = m.mk_app(to_app(val)->get_decl(), args.size(), args.c_ptr()); + fresh_term = m.mk_app(to_app(val)->get_decl(), args.size(), args.data()); } else { expr * sk_term = get_term_from_ctx(val); @@ -152,7 +152,7 @@ namespace smt { for (expr * e : universe) { eqs.push_back(m.mk_eq(sk, e)); } - expr_ref fml(m.mk_or(eqs.size(), eqs.c_ptr()), m); + expr_ref fml(m.mk_or(eqs.size(), eqs.data()), m); m_aux_context->assert_expr(fml); } @@ -186,7 +186,7 @@ namespace smt { } var_subst s(m); - expr_ref sk_body = s(tmp, subst_args.size(), subst_args.c_ptr()); + 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";); @@ -249,7 +249,7 @@ namespace smt { } defined_names dn(m); body = replace_value_from_ctx(body); - body = m.mk_lambda(sorts.size(), sorts.c_ptr(), names.c_ptr(), body); + body = m.mk_lambda(sorts.size(), sorts.data(), names.data(), body); // sk_value = m.mk_fresh_const(0, m.get_sort(sk_value)); // get rid of as-array body = dn.mk_definition(body, to_app(sk_value)); defs.push_back(body); @@ -309,7 +309,7 @@ namespace smt { 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.c_ptr()); + blocking_clause = m.mk_or(diseqs.size(), diseqs.data()); TRACE("model_checker", tout << "blocking clause:\n" << mk_ismt2_pp(blocking_clause, m) << "\n";); m_aux_context->assert_expr(blocking_clause); return true; @@ -557,8 +557,8 @@ namespace smt { 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.c_ptr() + offset) << "\n";); - m_context->add_instance(q, nullptr, num_decls, bindings.c_ptr(), inst.m_def, gen, gen, gen, dummy); + tout << "bindings:\n" << expr_ref_vector(m, num_decls, m_pinned_exprs.data() + offset) << "\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";); } } diff --git a/src/smt/smt_model_finder.cpp b/src/smt/smt_model_finder.cpp index 4f76bc63e..4a3f1fff8 100644 --- a/src/smt/smt_model_finder.cpp +++ b/src/smt/smt_model_finder.cpp @@ -1076,7 +1076,7 @@ namespace smt { // f_aux will be assigned to the old interpretation of f. 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.c_ptr())); + 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" << mk_pp(new_fi->get_else(), m) << "\n"; tout << "old interpretation: " << mk_pp(fi->get_interp(), m) << "\n";); @@ -2551,7 +2551,7 @@ namespace smt { eqs.push_back(m.mk_eq(sk, val)); } expr_ref new_cnstr(m); - new_cnstr = m.mk_or(eqs.size(), eqs.c_ptr()); + new_cnstr = m.mk_or(eqs.size(), eqs.data()); TRACE("model_finder", tout << "assert_restriction:\n" << mk_pp(new_cnstr, m) << "\n";); aux_ctx->assert_expr(new_cnstr); asserted_something = true; diff --git a/src/smt/smt_model_generator.cpp b/src/smt/smt_model_generator.cpp index ef9ed9120..316a36227 100644 --- a/src/smt/smt_model_generator.cpp +++ b/src/smt/smt_model_generator.cpp @@ -437,8 +437,8 @@ namespace smt { } tout << "\n"; tout << "value: #" << n->get_owner_id() << "\n" << mk_ismt2_pp(result, m) << "\n";); - if (fi->get_entry(args.c_ptr()) == nullptr) - fi->insert_new_entry(args.c_ptr(), result); + if (fi->get_entry(args.data()) == nullptr) + fi->insert_new_entry(args.data(), result); } } } diff --git a/src/smt/smt_parallel.cpp b/src/smt/smt_parallel.cpp index 45cb6fc30..e82b3f56e 100644 --- a/src/smt/smt_parallel.cpp +++ b/src/smt/smt_parallel.cpp @@ -50,7 +50,7 @@ namespace smt { // try first sequential with a low conflict budget to make super easy problems cheap unsigned max_c = std::min(thread_max_conflicts, 40u); flet _mc(ctx.get_fparams().m_max_conflicts, max_c); - result = ctx.check(asms.size(), asms.c_ptr()); + result = ctx.check(asms.size(), asms.data()); if (result != l_undef || ctx.m_num_conflicts < max_c) { return result; } @@ -156,7 +156,7 @@ namespace smt { if (num_rounds > 0) verbose_stream() << " :round " << num_rounds; if (c) verbose_stream() << " :cube " << mk_bounded_pp(c, pm, 3); verbose_stream() << ")\n";); - lbool r = pctx.check(lasms.size(), lasms.c_ptr()); + lbool r = pctx.check(lasms.size(), lasms.data()); if (r == l_undef && pctx.m_num_conflicts >= max_conflicts) { // no-op diff --git a/src/smt/smt_quick_checker.cpp b/src/smt/smt_quick_checker.cpp index a8ba15a82..d1e276f2b 100644 --- a/src/smt/smt_quick_checker.cpp +++ b/src/smt/smt_quick_checker.cpp @@ -222,7 +222,7 @@ namespace smt { do { for (unsigned i = 0; i < m_num_bindings; i++) m_bindings[m_num_bindings - i - 1] = m_candidate_vectors[i][it[i]]; - if (!m_context.contains_instance(q, m_num_bindings, m_bindings.c_ptr())) { + if (!m_context.contains_instance(q, m_num_bindings, m_bindings.data())) { bool is_candidate = false; TRACE("quick_checker", tout << "processing bindings:"; for (unsigned i = 0; i < m_num_bindings; i++) tout << " #" << m_bindings[i]->get_owner_id(); @@ -235,8 +235,8 @@ namespace smt { 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.c_ptr()); - if (m_context.add_instance(q, nullptr /* no pattern was used */, m_num_bindings, m_bindings.c_ptr(), nullptr, + 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, max_generation, 0, // min_top_generation is only available for instances created by the MAM 0, // max_top_generation is only available for instances created by the MAM @@ -245,7 +245,7 @@ namespace smt { } } } - while (product_iterator_next(szs.size(), szs.c_ptr(), it.c_ptr())); + while (product_iterator_next(szs.size(), szs.data(), it.data())); return result; } @@ -380,7 +380,7 @@ namespace smt { has_arg_enodes = false; } if (has_arg_enodes) { - enode * e = m_context.get_enode_eq_to(to_app(n)->get_decl(), num_args, new_arg_enodes.c_ptr()); + enode * e = m_context.get_enode_eq_to(to_app(n)->get_decl(), num_args, new_arg_enodes.data()); if (e) { m_canonize_cache.insert(n, e->get_root()->get_expr()); return e->get_root()->get_expr(); @@ -398,7 +398,7 @@ namespace smt { } } expr_ref new_expr(m_manager); - new_expr = m_context.get_rewriter().mk_app(to_app(n)->get_decl(), num_args, new_args.c_ptr()); + new_expr = m_context.get_rewriter().mk_app(to_app(n)->get_decl(), num_args, new_args.data()); m_new_exprs.push_back(new_expr); m_canonize_cache.insert(n, new_expr); return new_expr; diff --git a/src/smt/smt_setup.cpp b/src/smt/smt_setup.cpp index 06f00fa08..9f1103da2 100644 --- a/src/smt/smt_setup.cpp +++ b/src/smt/smt_setup.cpp @@ -150,7 +150,7 @@ namespace smt { IF_VERBOSE(100, verbose_stream() << "(smt.collecting-features)\n";); ptr_vector fmls; m_context.get_asserted_formulas(fmls); - st.collect(fmls.size(), fmls.c_ptr()); + st.collect(fmls.size(), fmls.data()); TRACE("setup", st.display_primitive(tout);); IF_VERBOSE(1000, st.display_primitive(verbose_stream());); if (m_logic == "QF_UF") @@ -785,7 +785,7 @@ namespace smt { IF_VERBOSE(100, verbose_stream() << "(smt.collecting-features)\n";); ptr_vector fmls; m_context.get_asserted_formulas(fmls); - st.collect(fmls.size(), fmls.c_ptr()); + st.collect(fmls.size(), fmls.data()); IF_VERBOSE(1000, st.display_primitive(verbose_stream());); bool fixnum = st.arith_k_sum_is_small() && m_params.m_arith_fixnum; bool int_only = !st.m_has_rational && !st.m_has_real && m_params.m_arith_int_only; @@ -953,7 +953,7 @@ namespace smt { static_features st(m_manager); ptr_vector fmls; m_context.get_asserted_formulas(fmls); - st.collect(fmls.size(), fmls.c_ptr()); + st.collect(fmls.size(), fmls.data()); TRACE("setup", tout << "setup_unknown\n";); setup_arith(); setup_arrays(); diff --git a/src/smt/smt_solver.cpp b/src/smt/smt_solver.cpp index 6e600992a..930a731a1 100644 --- a/src/smt/smt_solver.cpp +++ b/src/smt/smt_solver.cpp @@ -264,7 +264,7 @@ namespace { if (!m_minimizing_core && smt_params_helper(get_params()).core_minimize()) { scoped_minimize_core scm(*this); mus mus(*this); - mus.add_soft(r.size(), r.c_ptr()); + mus.add_soft(r.size(), r.data()); expr_ref_vector r2(m); if (l_true == mus.get_mus(r2)) { r.reset(); @@ -297,7 +297,7 @@ namespace { void get_labels(svector & r) override { buffer tmp; m_context.get_relevant_labels(nullptr, tmp); - r.append(tmp.size(), tmp.c_ptr()); + r.append(tmp.size(), tmp.data()); } ast_manager & get_manager() const override { return m_context.m(); } @@ -435,7 +435,7 @@ namespace { } } - core.append(new_core_literals.size(), new_core_literals.c_ptr()); + core.append(new_core_literals.size(), new_core_literals.data()); if (new_core_literals.empty()) break; diff --git a/src/smt/tactic/ctx_solver_simplify_tactic.cpp b/src/smt/tactic/ctx_solver_simplify_tactic.cpp index 8307dff3f..ec867f59d 100644 --- a/src/smt/tactic/ctx_solver_simplify_tactic.cpp +++ b/src/smt/tactic/ctx_solver_simplify_tactic.cpp @@ -102,7 +102,7 @@ protected: return; ptr_vector fmls; g.get_formulas(fmls); - fml = mk_and(m, fmls.size(), fmls.c_ptr()); + fml = mk_and(m, fmls.size(), fmls.data()); m_solver.push(); reduce(fml); m_solver.pop(1); @@ -120,7 +120,7 @@ protected: // enable_trace("after_search"); m_solver.push(); expr_ref fml1(m); - fml1 = mk_and(m, fmls.size(), fmls.c_ptr()); + fml1 = mk_and(m, fmls.size(), fmls.data()); fml1 = m.mk_iff(fml, fml1); fml1 = m.mk_not(fml1); m_solver.assert_expr(fml1); @@ -240,7 +240,7 @@ protected: args.push_back(arg); } } - m_mk_app(a->get_decl(), args.size(), args.c_ptr(), res); + m_mk_app(a->get_decl(), args.size(), args.data(), res); trail.push_back(res); // child needs to be visited. if (n2) { diff --git a/src/smt/tactic/smt_tactic_core.cpp b/src/smt/tactic/smt_tactic_core.cpp index 705f2751d..3aa2df869 100644 --- a/src/smt/tactic/smt_tactic_core.cpp +++ b/src/smt/tactic/smt_tactic_core.cpp @@ -200,7 +200,7 @@ public: if (assumptions.empty()) r = m_ctx->setup_and_check(); else - r = m_ctx->check(assumptions.size(), assumptions.c_ptr()); + r = m_ctx->check(assumptions.size(), assumptions.data()); } catch(...) { TRACE("smt_tactic", tout << "exception\n";); @@ -225,7 +225,7 @@ public: buffer r; m_ctx->get_relevant_labels(nullptr, r); labels_vec rv; - rv.append(r.size(), r.c_ptr()); + rv.append(r.size(), r.data()); model_converter_ref mc; mc = model_and_labels2model_converter(md.get(), rv); mc = concat(fmc.get(), mc.get()); @@ -288,7 +288,7 @@ public: buffer r; m_ctx->get_relevant_labels(nullptr, r); labels_vec rv; - rv.append(r.size(), r.c_ptr()); + rv.append(r.size(), r.data()); in->add(model_and_labels2model_converter(md.get(), rv)); } return; diff --git a/src/smt/theory_arith.h b/src/smt/theory_arith.h index dac417c02..31acc2be0 100644 --- a/src/smt/theory_arith.h +++ b/src/smt/theory_arith.h @@ -254,8 +254,8 @@ namespace smt { void append(unsigned sz, literal const* ls) { m_lits.append(sz, ls); } void append(unsigned sz, enode_pair const* ps) { m_eqs.append(sz, ps); } unsigned num_params() const { return empty()?0:m_eq_coeffs.size() + m_lit_coeffs.size() + 1; } - numeral const* lit_coeffs() const { return m_lit_coeffs.c_ptr(); } - numeral const* eq_coeffs() const { return m_eq_coeffs.c_ptr(); } + numeral const* lit_coeffs() const { return m_lit_coeffs.data(); } + numeral const* eq_coeffs() const { return m_eq_coeffs.data(); } parameter* params(char const* name); std::ostream& display(theory_arith& th, std::ostream& out) const; }; diff --git a/src/smt/theory_arith_aux.h b/src/smt/theory_arith_aux.h index 507969469..f152c2430 100644 --- a/src/smt/theory_arith_aux.h +++ b/src/smt/theory_arith_aux.h @@ -359,7 +359,7 @@ namespace smt { if (empty()) return nullptr; init(); m_params[0] = parameter(symbol(name)); - return m_params.c_ptr(); + return m_params.data(); } // ----------------------------------- @@ -746,8 +746,8 @@ namespace smt { a.push_eq(e, coeff, proofs_enabled); } else { - a.append(m_lits.size(), m_lits.c_ptr()); - a.append(m_eqs.size(), m_eqs.c_ptr()); + a.append(m_lits.size(), m_lits.data()); + a.append(m_eqs.size(), m_eqs.data()); } } diff --git a/src/smt/theory_arith_core.h b/src/smt/theory_arith_core.h index e31f0c1f4..4a2963656 100644 --- a/src/smt/theory_arith_core.h +++ b/src/smt/theory_arith_core.h @@ -888,7 +888,7 @@ namespace smt { void theory_arith::normalize_quasi_base_row(unsigned r_id) { buffer to_add; collect_vars(r_id, QUASI_BASE, to_add); - add_rows(r_id, to_add.size(), to_add.c_ptr()); + add_rows(r_id, to_add.size(), to_add.data()); SASSERT(!has_var_kind(r_id, QUASI_BASE)); } @@ -910,7 +910,7 @@ namespace smt { display_row_info(tout, get_var_row(v)); tout << "\n"; }); - add_rows(r_id, to_add.size(), to_add.c_ptr()); + add_rows(r_id, to_add.size(), to_add.data()); theory_var s = m_rows[r_id].get_base_var(); set_var_kind(s, BASE); inf_numeral tmp; @@ -2942,8 +2942,8 @@ namespace smt { void theory_arith::dump_lemmas(literal l, antecedents const& ante) { if (dump_lemmas()) { TRACE("arith", ante.display(tout) << " --> "; ctx.display_detailed_literal(tout, l); tout << "\n";); - ctx.display_lemma_as_smt_problem(ante.lits().size(), ante.lits().c_ptr(), - ante.eqs().size(), ante.eqs().c_ptr(), l); + ctx.display_lemma_as_smt_problem(ante.lits().size(), ante.lits().data(), + ante.eqs().size(), ante.eqs().data(), l); } } @@ -2951,8 +2951,8 @@ namespace smt { template void theory_arith::dump_lemmas(literal l, derived_bound const& ante) { if (dump_lemmas()) { - ctx.display_lemma_as_smt_problem(ante.lits().size(), ante.lits().c_ptr(), - ante.eqs().size(), ante.eqs().c_ptr(), l); + ctx.display_lemma_as_smt_problem(ante.lits().size(), ante.lits().data(), + ante.eqs().size(), ante.eqs().data(), l); } } @@ -2978,17 +2978,17 @@ namespace smt { lits.push_back(~(*it)); justification * js = nullptr; if (proofs_enabled()) { - js = alloc(theory_lemma_justification, get_id(), ctx, lits.size(), lits.c_ptr(), + js = alloc(theory_lemma_justification, get_id(), ctx, lits.size(), lits.data(), ante.num_params(), ante.params("assign-bounds")); } - ctx.mk_clause(lits.size(), lits.c_ptr(), js, CLS_TH_LEMMA, nullptr); + ctx.mk_clause(lits.size(), lits.data(), js, CLS_TH_LEMMA, nullptr); } else { region & r = ctx.get_region(); ctx.assign(l, ctx.mk_justification( ext_theory_propagation_justification( - get_id(), r, ante.lits().size(), ante.lits().c_ptr(), - ante.eqs().size(), ante.eqs().c_ptr(), l, + get_id(), r, ante.lits().size(), ante.lits().data(), + ante.eqs().size(), ante.eqs().data(), l, ante.num_params(), ante.params("assign-bounds")))); } } @@ -3049,13 +3049,13 @@ namespace smt { template void theory_arith::set_conflict(antecedents const& ante, antecedents& bounds, char const* proof_rule) { - set_conflict(ante.lits().size(), ante.lits().c_ptr(), ante.eqs().size(), ante.eqs().c_ptr(), bounds, proof_rule); + set_conflict(ante.lits().size(), ante.lits().data(), ante.eqs().size(), ante.eqs().data(), bounds, proof_rule); dump_lemmas(false_literal, ante); } template void theory_arith::set_conflict(derived_bound const& ante, antecedents& bounds, char const* proof_rule) { - set_conflict(ante.lits().size(), ante.lits().c_ptr(), ante.eqs().size(), ante.eqs().c_ptr(), bounds, proof_rule); + set_conflict(ante.lits().size(), ante.lits().data(), ante.eqs().size(), ante.eqs().data(), bounds, proof_rule); dump_lemmas(false_literal, ante); } diff --git a/src/smt/theory_arith_eq.h b/src/smt/theory_arith_eq.h index 2e73773d3..0b8e41e20 100644 --- a/src/smt/theory_arith_eq.h +++ b/src/smt/theory_arith_eq.h @@ -337,8 +337,8 @@ namespace smt { ctx.mk_justification( ext_theory_eq_propagation_justification( get_id(), r, - lits.size(), lits.c_ptr(), - eqs.size(), eqs.c_ptr(), + lits.size(), lits.data(), + 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"; diff --git a/src/smt/theory_arith_int.h b/src/smt/theory_arith_int.h index 7eaf57276..f6a713d0d 100644 --- a/src/smt/theory_arith_int.h +++ b/src/smt/theory_arith_int.h @@ -371,11 +371,11 @@ namespace smt { } expr_ref p1(get_manager()), p2(get_manager()); - mk_polynomial_ge(pol.size(), pol.c_ptr(), -unsat_row[0]+rational(1), p1); + mk_polynomial_ge(pol.size(), pol.data(), -unsat_row[0]+rational(1), p1); for (unsigned i = 0; i < pol.size(); ++i) { pol[i].m_coeff.neg(); } - mk_polynomial_ge(pol.size(), pol.c_ptr(), unsat_row[0]+rational(1), p2); + mk_polynomial_ge(pol.size(), pol.data(), unsat_row[0]+rational(1), p2); { std::function fn = [&]() { return m.mk_or(p1, p2); }; @@ -475,7 +475,7 @@ namespace smt { } expr_ref pol(m); - pol = m_util.mk_add(_args.size(), _args.c_ptr()); + 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";); proof_ref pr(m); @@ -663,7 +663,7 @@ namespace smt { } tout << "k: " << k << "\n";); } - mk_polynomial_ge(pol.size(), pol.c_ptr(), k.to_rational(), bound); + mk_polynomial_ge(pol.size(), pol.data(), k.to_rational(), bound); } TRACE("gomory_cut", tout << "new cut:\n" << bound << "\n"; ante.display(tout);); literal l = null_literal; @@ -680,8 +680,8 @@ namespace smt { auto js = ctx.mk_justification( gomory_cut_justification( get_id(), ctx.get_region(), - ante.lits().size(), ante.lits().c_ptr(), - ante.eqs().size(), ante.eqs().c_ptr(), ante, l)); + ante.lits().size(), ante.lits().data(), + ante.eqs().size(), ante.eqs().data(), ante, l)); if (l == false_literal) { ctx.mk_clause(0, nullptr, js, CLS_TH_LEMMA, nullptr); @@ -760,8 +760,8 @@ namespace smt { ctx.set_conflict( ctx.mk_justification( ext_theory_conflict_justification( - get_id(), ctx.get_region(), ante.lits().size(), ante.lits().c_ptr(), - ante.eqs().size(), ante.eqs().c_ptr(), + get_id(), ctx.get_region(), ante.lits().size(), ante.lits().data(), + ante.eqs().size(), ante.eqs().data(), ante.num_params(), ante.params("gcd-test")))); return false; } @@ -841,7 +841,7 @@ namespace smt { ctx.mk_justification( ext_theory_conflict_justification( get_id(), ctx.get_region(), - ante.lits().size(), ante.lits().c_ptr(), ante.eqs().size(), ante.eqs().c_ptr(), + ante.lits().size(), ante.lits().data(), ante.eqs().size(), ante.eqs().data(), ante.num_params(), ante.params("gcd-test")))); return false; } diff --git a/src/smt/theory_arith_nl.h b/src/smt/theory_arith_nl.h index dea5a4ad6..d73f604c1 100644 --- a/src/smt/theory_arith_nl.h +++ b/src/smt/theory_arith_nl.h @@ -1184,7 +1184,7 @@ expr_ref theory_arith::p2expr(buffer & p) { } } SASSERT(!args.empty()); - expr_ref r(mk_nary_add(args.size(), args.c_ptr()), get_manager()); + expr_ref r(mk_nary_add(args.size(), args.data()), get_manager()); m_nl_new_exprs.push_back(r); return r; } @@ -1367,7 +1367,7 @@ 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";); - expr * result = mk_nary_mul(new_args.size(), new_args.c_ptr(), m_util.is_int(var)); + 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";); return result; @@ -1720,7 +1720,7 @@ grobner::monomial * theory_arith::mk_gb_monomial(rational const & _coeff, e proc_var(m); if (!coeff.is_zero()) - return gb.mk_monomial(coeff, vars.size(), vars.c_ptr()); + return gb.mk_monomial(coeff, vars.size(), vars.data()); else return nullptr; } @@ -1748,7 +1748,7 @@ void theory_arith::add_row_to_gb(row const & r, grobner & gb) { monomials.push_back(new_m); } } - gb.assert_eq_0(monomials.size(), monomials.c_ptr(), dep); + gb.assert_eq_0(monomials.size(), monomials.data(), dep); } /** @@ -1776,7 +1776,7 @@ void theory_arith::add_monomial_def_to_gb(theory_var v, grobner & gb) { else { monomials.push_back(gb.mk_monomial(coeff, 1, &m)); } - gb.assert_eq_0(monomials.size(), monomials.c_ptr(), dep); + gb.assert_eq_0(monomials.size(), monomials.data(), dep); } /** @@ -2059,7 +2059,7 @@ bool theory_arith::is_inconsistent2(grobner::equation const * eq, grobner & if (monomials.size() == num) 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.c_ptr(), eq->get_dependency())) { + if (is_inconsistent(ge_zero, monomials.size(), monomials.data(), eq->get_dependency())) { TRACE("non_linear", tout << "found conflict\n"; gb.display_equation(tout, *eq);); return true; } @@ -2074,7 +2074,7 @@ expr * theory_arith::monomial2expr(grobner::monomial const * m, bool is_int args.push_back(m_util.mk_numeral(m->get_coeff(), is_int)); for (unsigned j = 0; j < num_vars; j++) args.push_back(m->get_var(j)); - return mk_nary_mul(args.size(), args.c_ptr(), is_int); + return mk_nary_mul(args.size(), args.data(), is_int); } /** @@ -2104,7 +2104,7 @@ bool theory_arith::internalize_gb_eq(grobner::equation const * eq) { th_rewriter& s = ctx.get_rewriter(); expr_ref pol(get_manager()); SASSERT(!args.empty()); - pol = mk_nary_add(args.size(), args.c_ptr()); + 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";); diff --git a/src/smt/theory_arith_pp.h b/src/smt/theory_arith_pp.h index 9dce32979..a4dba46d0 100644 --- a/src/smt/theory_arith_pp.h +++ b/src/smt/theory_arith_pp.h @@ -418,7 +418,7 @@ namespace smt { template std::ostream& theory_arith::antecedents_t::display(theory_arith& th, std::ostream & out) const { - th.get_context().display_literals_verbose(out, lits().size(), lits().c_ptr()); + th.get_context().display_literals_verbose(out, lits().size(), lits().data()); if (!lits().empty()) out << "\n"; ast_manager& m = th.get_manager(); for (auto const& e : m_eqs) { diff --git a/src/smt/theory_array.cpp b/src/smt/theory_array.cpp index e27103757..ab1673a9d 100644 --- a/src/smt/theory_array.cpp +++ b/src/smt/theory_array.cpp @@ -454,11 +454,11 @@ namespace smt { out << std::right; out << " is_array: " << d->m_is_array << " is_select: " << d->m_is_select << " upward: " << d->m_prop_upward; out << " stores: {"; - display_ids(out, d->m_stores.size(), d->m_stores.c_ptr()); + display_ids(out, d->m_stores.size(), d->m_stores.data()); out << "} p_stores: {"; - display_ids(out, d->m_parent_stores.size(), d->m_parent_stores.c_ptr()); + display_ids(out, d->m_parent_stores.size(), d->m_parent_stores.data()); out << "} p_selects: {"; - display_ids(out, d->m_parent_selects.size(), d->m_parent_selects.c_ptr()); + display_ids(out, d->m_parent_selects.size(), d->m_parent_selects.data()); out << "}"; out << "\n"; } diff --git a/src/smt/theory_array_bapa.cpp b/src/smt/theory_array_bapa.cpp index 5a20d588b..7b7f93f02 100644 --- a/src/smt/theory_array_bapa.cpp +++ b/src/smt/theory_array_bapa.cpp @@ -430,13 +430,13 @@ namespace smt { lits.push_back(mk_eq(args[0], args[1])); } else { - expr_ref diff(m.mk_distinct_expanded(args.size(), args.c_ptr()), m); + expr_ref diff(m.mk_distinct_expanded(args.size(), args.data()), m); lits.push_back(~mk_literal(diff)); } } expr_ref ge(m_arith.mk_ge(sz->get_arg(1), m_arith.mk_int(info.m_selects.size())), m); lits.push_back(mk_literal(ge)); - mk_th_axiom(lits.size(), lits.c_ptr()); + mk_th_axiom(lits.size(), lits.data()); return l_false; } return l_true; diff --git a/src/smt/theory_array_base.cpp b/src/smt/theory_array_base.cpp index d32b29606..ab3570872 100644 --- a/src/smt/theory_array_base.cpp +++ b/src/smt/theory_array_base.cpp @@ -104,7 +104,7 @@ namespace smt { sel_args.push_back(to_app(n->get_arg(i))); } expr_ref sel(m); - sel = mk_select(sel_args.size(), sel_args.c_ptr()); + 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";); if (m.proofs_enabled()) { @@ -167,8 +167,8 @@ namespace smt { } if (!init) { - sel1 = mk_select(sel1_args.size(), sel1_args.c_ptr()); - sel2 = mk_select(sel2_args.size(), sel2_args.c_ptr()); + 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";); break; @@ -331,8 +331,8 @@ namespace smt { args1.push_back(k); args2.push_back(k); } - expr_ref sel1(mk_select(args1.size(), args1.c_ptr()), m); - expr_ref sel2(mk_select(args2.size(), args2.c_ptr()), m); + 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";); literal n1_eq_n2 = mk_eq(e1, e2, true); literal sel1_eq_sel2 = mk_eq(sel1, sel2, true); @@ -370,10 +370,10 @@ namespace smt { args1.push_back(k); args2.push_back(k); } - expr * sel1 = mk_select(dimension+1, args1.c_ptr()); - expr * sel2 = mk_select(dimension+1, args2.c_ptr()); + expr * sel1 = mk_select(dimension+1, args1.data()); + expr * sel2 = mk_select(dimension+1, args2.data()); expr * eq = m.mk_eq(sel1, sel2); - expr_ref q(m.mk_forall(dimension, sorts.c_ptr(), names.c_ptr(), eq), m); + expr_ref q(m.mk_forall(dimension, sorts.data(), names.data(), eq), m); ctx.get_rewriter()(q); if (!ctx.b_internalized(q)) { ctx.internalize(q, true); @@ -401,7 +401,7 @@ namespace smt { } es[j++] = e->get_arg(i); } - f = sub(q, es.size(), es.c_ptr()); + f = sub(q, es.size(), es.data()); } return f; } @@ -545,8 +545,8 @@ namespace smt { r->set_mark(); to_unmark.push_back(r); } - TRACE("array", tout << "collecting shared vars...\n" << unsigned_vector(result.size(), (unsigned*)result.c_ptr()) << "\n";); - unmark_enodes(to_unmark.size(), to_unmark.c_ptr()); + TRACE("array", tout << "collecting shared vars...\n" << unsigned_vector(result.size(), (unsigned*)result.data()) << "\n";); + unmark_enodes(to_unmark.size(), to_unmark.data()); } #endif @@ -934,7 +934,7 @@ namespace smt { } void get_dependencies(buffer & result) override { - result.append(m_dependencies.size(), m_dependencies.c_ptr()); + result.append(m_dependencies.size(), m_dependencies.data()); } app * mk_value(model_generator & mg, expr_ref_vector const & values) override { @@ -967,7 +967,7 @@ namespace smt { args.push_back(values[idx]); expr * result = values[idx]; idx++; - fi->insert_entry(args.c_ptr(), result); + fi->insert_entry(args.data(), result); } parameter p[1] = { parameter(f) }; @@ -1034,7 +1034,7 @@ namespace smt { for (unsigned j = 1; j < num; ++j) args.push_back(select->get_arg(j)); SASSERT(ctx.is_relevant(select)); - result->add_entry(args.size(), args.c_ptr(), select); + result->add_entry(args.size(), args.data(), select); } } TRACE("array", diff --git a/src/smt/theory_array_base.h b/src/smt/theory_array_base.h index b73805be8..a0550683f 100644 --- a/src/smt/theory_array_base.h +++ b/src/smt/theory_array_base.h @@ -62,7 +62,7 @@ namespace smt { bool is_select_arg(enode* r); app * mk_select(unsigned num_args, expr * const * args); - app * mk_select(expr_ref_vector const& args) { return mk_select(args.size(), args.c_ptr()); } + app * mk_select(expr_ref_vector const& args) { return mk_select(args.size(), args.data()); } app * mk_store(unsigned num_args, expr * const * args); app * mk_default(expr* a); diff --git a/src/smt/theory_array_full.cpp b/src/smt/theory_array_full.cpp index ca6240d94..15214a81b 100644 --- a/src/smt/theory_array_full.cpp +++ b/src/smt/theory_array_full.cpp @@ -210,11 +210,11 @@ namespace smt { theory_array::display_var(out, v); var_data_full const * d = m_var_data_full[v]; out << " maps: {"; - display_ids(out, d->m_maps.size(), d->m_maps.c_ptr()); + display_ids(out, d->m_maps.size(), d->m_maps.data()); out << "} p_parent_maps: {"; - display_ids(out, d->m_parent_maps.size(), d->m_parent_maps.c_ptr()); + display_ids(out, d->m_parent_maps.size(), d->m_parent_maps.data()); out << "} p_const: {"; - display_ids(out, d->m_consts.size(), d->m_consts.c_ptr()); + display_ids(out, d->m_consts.size(), d->m_consts.data()); out << "}\n"; } @@ -486,13 +486,13 @@ namespace smt { args1.push_back(arg); } for (unsigned j = 0; j < num_arrays; ++j) { - expr* sel = mk_select(args2l[j].size(), args2l[j].c_ptr()); + expr* sel = mk_select(args2l[j].size(), args2l[j].data()); args2.push_back(sel); } expr_ref sel1(m), sel2(m); - sel1 = mk_select(args1.size(), args1.c_ptr()); - sel2 = m.mk_app(f, args2.size(), args2.c_ptr()); + sel1 = mk_select(args1.size(), args1.data()); + sel2 = m.mk_app(f, args2.size(), args2.data()); ctx.get_rewriter()(sel2); ctx.internalize(sel1, false); ctx.internalize(sel2, false); @@ -528,7 +528,7 @@ namespace smt { args2.push_back(mk_default(arg)); } - expr_ref def2(m.mk_app(f, args2.size(), args2.c_ptr()), m); + expr_ref def2(m.mk_app(f, args2.size(), args2.data()), m); ctx.get_rewriter()(def2); expr* def1 = mk_default(map); ctx.internalize(def1, false); @@ -630,7 +630,7 @@ namespace smt { for (unsigned short i = 1; i < num_args; ++i) { sel_args.push_back(select->get_expr()->get_arg(i)); } - expr * sel = mk_select(sel_args.size(), sel_args.c_ptr()); + 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"; tout << "const: " << mk_bounded_pp(cnst->get_expr(), m) << "\n"; @@ -664,9 +664,9 @@ namespace smt { for (unsigned short i = 1; i < num_args; ++i) { sel_args.push_back(select->get_expr()->get_arg(i)); } - expr * sel = mk_select(sel_args.size(), sel_args.c_ptr()); + 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.c_ptr()+1), m); + 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"; tout << "as-array: " << mk_bounded_pp(arr->get_expr(), m) << "\n"; tout << "select: " << mk_bounded_pp(select->get_expr(), m) << "\n"; diff --git a/src/smt/theory_bv.cpp b/src/smt/theory_bv.cpp index b8aa9eed9..6efcc68c1 100644 --- a/src/smt/theory_bv.cpp +++ b/src/smt/theory_bv.cpp @@ -55,7 +55,7 @@ namespace smt { for (unsigned i = 0; i < bv_size; i++) { m_bits_expr.push_back(mk_bit2bool(owner, i)); } - ctx.internalize(m_bits_expr.c_ptr(), bv_size, true); + ctx.internalize(m_bits_expr.data(), bv_size, true); for (unsigned i = 0; i < bv_size; i++) { bool_var b = ctx.get_bool_var(m_bits_expr[i]); @@ -325,7 +325,7 @@ namespace smt { SASSERT(get_bv_size(n) == sz); m_bits[v].reset(); - ctx.internalize(bits.c_ptr(), sz, true); + ctx.internalize(bits.data(), sz, true); for (unsigned i = 0; i < sz; i++) { expr * bit = bits.get(i); @@ -420,7 +420,7 @@ namespace smt { return nullptr; expr * fact = ctx.mk_eq_atom(m_th.get_enode(m_var1)->get_expr(), m_th.get_enode(m_var2)->get_expr()); ast_manager & m = ctx.get_manager(); - return m.mk_th_lemma(get_from_theory(), fact, prs.size(), prs.c_ptr()); + return m.mk_th_lemma(get_from_theory(), fact, prs.size(), prs.data()); } theory_id get_from_theory() const override { @@ -471,7 +471,7 @@ namespace smt { eqs.push_back(~eq); } eqs.push_back(oeq); - ctx.mk_th_axiom(get_id(), eqs.size(), eqs.c_ptr()); + ctx.mk_th_axiom(get_id(), eqs.size(), eqs.data()); } void theory_bv::fixed_var_eh(theory_var v) { @@ -634,7 +634,7 @@ namespace smt { args.push_back(m.mk_ite(b, n, zero)); num *= numeral(2); } - expr_ref sum(m_autil.mk_add(sz, args.c_ptr()), m); + expr_ref sum(m_autil.mk_add(sz, args.data()), m); th_rewriter rw(m); rw(sum); literal l(mk_eq(n, sum, false)); @@ -727,7 +727,7 @@ namespace smt { enode * e = mk_enode(n); \ expr_ref_vector arg1_bits(m), bits(m); \ get_arg_bits(e, 0, arg1_bits); \ - m_bb.BLAST_OP(arg1_bits.size(), arg1_bits.c_ptr(), bits); \ + m_bb.BLAST_OP(arg1_bits.size(), arg1_bits.data(), bits); \ init_bits(e, bits); \ } @@ -741,7 +741,7 @@ namespace smt { get_arg_bits(e, 0, arg1_bits); \ get_arg_bits(e, 1, arg2_bits); \ SASSERT(arg1_bits.size() == arg2_bits.size()); \ - m_bb.BLAST_OP(arg1_bits.size(), arg1_bits.c_ptr(), arg2_bits.c_ptr(), bits); \ + m_bb.BLAST_OP(arg1_bits.size(), arg1_bits.data(), arg2_bits.data(), bits); \ init_bits(e, bits); \ } @@ -764,7 +764,7 @@ namespace smt { get_arg_bits(e, i, arg_bits); \ SASSERT(arg_bits.size() == bits.size()); \ new_bits.reset(); \ - m_bb.BLAST_OP(arg_bits.size(), arg_bits.c_ptr(), bits.c_ptr(), new_bits); \ + m_bb.BLAST_OP(arg_bits.size(), arg_bits.data(), bits.data(), new_bits); \ bits.swap(new_bits); \ } \ init_bits(e, bits); \ @@ -781,7 +781,7 @@ namespace smt { get_arg_bits(e, 1, arg2_bits); SASSERT(arg1_bits.size() == arg2_bits.size()); expr_ref carry(m); - m_bb.mk_subtracter(arg1_bits.size(), arg1_bits.c_ptr(), arg2_bits.c_ptr(), bits, carry); + m_bb.mk_subtracter(arg1_bits.size(), arg1_bits.data(), arg2_bits.data(), bits, carry); init_bits(e, bits); } @@ -818,7 +818,7 @@ namespace smt { expr_ref_vector arg1_bits(m), bits(m); \ get_arg_bits(e, 0, arg1_bits); \ unsigned param = n->get_decl()->get_parameter(0).get_int(); \ - m_bb.BLAST_OP(arg1_bits.size(), arg1_bits.c_ptr(), param, bits); \ + m_bb.BLAST_OP(arg1_bits.size(), arg1_bits.data(), param, bits); \ init_bits(e, bits); \ } @@ -939,7 +939,7 @@ namespace smt { get_arg_bits(n, 0, arg1_bits); \ get_arg_bits(n, 1, arg2_bits); \ expr_ref out(m); \ - m_bb.OP(arg1_bits.size(), arg1_bits.c_ptr(), arg2_bits.c_ptr(), out); \ + m_bb.OP(arg1_bits.size(), arg1_bits.data(), arg2_bits.data(), out); \ expr_ref s_out(m); \ simplify_bit(out, s_out); \ ctx.internalize(s_out, true); \ @@ -973,9 +973,9 @@ namespace smt { get_arg_bits(n, 1, arg2_bits); expr_ref le(m); if (Signed) - m_bb.mk_sle(arg1_bits.size(), arg1_bits.c_ptr(), arg2_bits.c_ptr(), le); + m_bb.mk_sle(arg1_bits.size(), arg1_bits.data(), arg2_bits.data(), le); else - m_bb.mk_ule(arg1_bits.size(), arg1_bits.c_ptr(), arg2_bits.c_ptr(), le); + m_bb.mk_ule(arg1_bits.size(), arg1_bits.data(), arg2_bits.data(), le); expr_ref s_le(m); simplify_bit(le, s_le); ctx.internalize(s_le, true); @@ -1197,7 +1197,7 @@ namespace smt { m_stats.m_num_diseq_dynamic++; scoped_trace_stream st(*this, lits); - ctx.mk_th_axiom(get_id(), lits.size(), lits.c_ptr()); + ctx.mk_th_axiom(get_id(), lits.size(), lits.data()); } void theory_bv::assign_eh(bool_var v, bool is_true) { @@ -1313,7 +1313,7 @@ namespace smt { ctx.mark_as_relevant(lits[2]); { scoped_trace_stream _sts(*this, lits); - ctx.mk_th_axiom(get_id(), lits.size(), lits.c_ptr()); + ctx.mk_th_axiom(get_id(), lits.size(), lits.data()); } } @@ -1623,7 +1623,7 @@ namespace smt { ast_manager & m = cr.get_manager(); expr_ref fact(m); ctx.literal2expr(m_consequent, fact); - return m.mk_th_lemma(get_from_theory(), fact, prs.size(), prs.c_ptr()); + return m.mk_th_lemma(get_from_theory(), fact, prs.size(), prs.data()); } theory_id get_from_theory() const override { diff --git a/src/smt/theory_char.cpp b/src/smt/theory_char.cpp index 83ec9b30d..a89693476 100644 --- a/src/smt/theory_char.cpp +++ b/src/smt/theory_char.cpp @@ -121,12 +121,12 @@ namespace smt { else { for (unsigned i = 0; i < seq.num_bits(); ++i) ebits.push_back(seq.mk_char_bit(e, i)); - ctx.internalize(ebits.c_ptr(), ebits.size(), true); + ctx.internalize(ebits.data(), ebits.size(), true); for (expr* arg : ebits) bits.push_back(literal(ctx.get_bool_var(arg))); for (literal bit : bits) ctx.mark_as_relevant(bit); - expr_ref bits2char(seq.mk_skolem(m_bits2char, ebits.size(), ebits.c_ptr(), e->get_sort()), m); + expr_ref bits2char(seq.mk_skolem(m_bits2char, ebits.size(), ebits.data(), e->get_sort()), m); ctx.mark_as_relevant(bits2char.get()); enode* n1 = ensure_enode(e); enode* n2 = ensure_enode(bits2char); @@ -148,7 +148,7 @@ namespace smt { auto const& b1 = get_ebits(v1); auto const& b2 = get_ebits(v2); expr_ref e(m); - m_bb.mk_ule(b1.size(), b1.c_ptr(), b2.c_ptr(), e); + m_bb.mk_ule(b1.size(), b1.data(), b2.data(), e); literal le = mk_literal(e); ctx.mark_as_relevant(le); ctx.mk_th_axiom(get_id(), ~lit, le); @@ -170,8 +170,8 @@ namespace smt { auto const& zv = get_ebits(z); auto const& nv = get_ebits(n); expr_ref le1(m), le2(m); - m_bb.mk_ule(bv.size(), zv.c_ptr(), bv.c_ptr(), le1); - m_bb.mk_ule(bv.size(), bv.c_ptr(), nv.c_ptr(), le2); + m_bb.mk_ule(bv.size(), zv.data(), bv.data(), le1); + m_bb.mk_ule(bv.size(), bv.data(), nv.data(), le2); literal lit1 = mk_literal(le1); literal lit2 = mk_literal(le2); ctx.mk_th_axiom(get_id(), ~lit, lit1); @@ -353,7 +353,7 @@ namespace smt { auto const& mbits = get_ebits(w); auto const& bits = get_ebits(v); expr_ref le(m); - m_bb.mk_ule(bits.size(), bits.c_ptr(), mbits.c_ptr(), le); + m_bb.mk_ule(bits.size(), bits.data(), mbits.data(), le); ctx.assign(mk_literal(le), nullptr); ++m_stats.m_num_bounds; } @@ -378,7 +378,7 @@ namespace smt { } // a = b => eq lits.push_back(eq); - ctx.mk_th_axiom(get_id(), lits.size(), lits.c_ptr()); + ctx.mk_th_axiom(get_id(), lits.size(), lits.data()); ++m_stats.m_num_ackerman; } diff --git a/src/smt/theory_datatype.cpp b/src/smt/theory_datatype.cpp index 3e87894af..80b3b5062 100644 --- a/src/smt/theory_datatype.cpp +++ b/src/smt/theory_datatype.cpp @@ -50,8 +50,8 @@ namespace smt { } void theory_datatype::clear_mark() { - unmark_enodes(m_to_unmark.size(), m_to_unmark.c_ptr()); - unmark_enodes2(m_to_unmark2.size(), m_to_unmark2.c_ptr()); + unmark_enodes(m_to_unmark.size(), m_to_unmark.data()); + unmark_enodes2(m_to_unmark2.size(), m_to_unmark2.data()); m_to_unmark.reset(); m_to_unmark2.reset(); } @@ -185,7 +185,7 @@ namespace smt { std::function fn = [&]() { app_ref body(m); body = m.mk_eq(arg->get_expr(), acc_app); - log_axiom_instantiation(body, base_id + 3*i, bindings.size(), bindings.c_ptr(), base_id - 3, used_enodes); + log_axiom_instantiation(body, base_id + 3*i, bindings.size(), bindings.data(), base_id - 3, used_enodes); }; scoped_trace_stream _st(m, fn); assert_eq_axiom(arg, acc_app, null_literal); @@ -670,7 +670,7 @@ namespace smt { // m_used_eqs should contain conflict region & r = ctx.get_region(); clear_mark(); - ctx.set_conflict(ctx.mk_justification(ext_theory_conflict_justification(get_id(), r, 0, nullptr, m_used_eqs.size(), m_used_eqs.c_ptr()))); + ctx.set_conflict(ctx.mk_justification(ext_theory_conflict_justification(get_id(), r, 0, nullptr, m_used_eqs.size(), m_used_eqs.data()))); } return res; } @@ -760,11 +760,11 @@ namespace smt { void add_dependency(enode * n) { m_dependencies.push_back(model_value_dependency(n)); } ~datatype_value_proc() override {} void get_dependencies(buffer & result) override { - result.append(m_dependencies.size(), m_dependencies.c_ptr()); + result.append(m_dependencies.size(), m_dependencies.data()); } app * mk_value(model_generator & mg, expr_ref_vector const & values) override { SASSERT(values.size() == m_dependencies.size()); - return mg.get_manager().mk_app(m_constructor, values.size(), values.c_ptr()); + return mg.get_manager().mk_app(m_constructor, values.size(), values.data()); } }; @@ -917,7 +917,7 @@ namespace smt { for (auto const& p : eqs) { tout << enode_eq_pp(p, ctx); }); - ctx.set_conflict(ctx.mk_justification(ext_theory_conflict_justification(get_id(), reg, lits.size(), lits.c_ptr(), eqs.size(), eqs.c_ptr()))); + ctx.set_conflict(ctx.mk_justification(ext_theory_conflict_justification(get_id(), reg, lits.size(), lits.data(), eqs.size(), eqs.data()))); } else if (num_unassigned == 1) { // propagate remaining recognizer @@ -937,8 +937,8 @@ namespace smt { ctx.mark_as_relevant(consequent); region & reg = ctx.get_region(); ctx.assign(consequent, - ctx.mk_justification(ext_theory_propagation_justification(get_id(), reg, lits.size(), lits.c_ptr(), - eqs.size(), eqs.c_ptr(), consequent))); + ctx.mk_justification(ext_theory_propagation_justification(get_id(), reg, lits.size(), lits.data(), + eqs.size(), eqs.data(), consequent))); } else { // there are more than 2 unassigned recognizers... diff --git a/src/smt/theory_dense_diff_logic_def.h b/src/smt/theory_dense_diff_logic_def.h index 717d67f3c..3a19b1c19 100644 --- a/src/smt/theory_dense_diff_logic_def.h +++ b/src/smt/theory_dense_diff_logic_def.h @@ -539,7 +539,7 @@ namespace smt { literal_vector & antecedents = m_tmp_literals; antecedents.reset(); get_antecedents(source, target, antecedents); - ctx.assign(l, ctx.mk_justification(theory_propagation_justification(get_id(), ctx.get_region(), antecedents.size(), antecedents.c_ptr(), l))); + ctx.assign(l, ctx.mk_justification(theory_propagation_justification(get_id(), ctx.get_region(), antecedents.size(), antecedents.data(), l))); } template @@ -592,10 +592,10 @@ namespace smt { if (l != null_literal) antecedents.push_back(l); region & r = ctx.get_region(); - ctx.set_conflict(ctx.mk_justification(theory_conflict_justification(get_id(), r, antecedents.size(), antecedents.c_ptr()))); + ctx.set_conflict(ctx.mk_justification(theory_conflict_justification(get_id(), r, antecedents.size(), antecedents.data()))); if (dump_lemmas()) { - ctx.display_lemma_as_smt_problem(antecedents.size(), antecedents.c_ptr(), false_literal); + ctx.display_lemma_as_smt_problem(antecedents.size(), antecedents.data(), false_literal); } return; @@ -962,7 +962,7 @@ namespace smt { vars[0] = e.m_target; vars[1] = e.m_source; vars[2] = base_var; - S.add_row(base_var, 3, vars.c_ptr(), coeffs.c_ptr()); + S.add_row(base_var, 3, vars.data(), coeffs.data()); // t - s <= w // => // t - s - b = 0, b <= w @@ -984,7 +984,7 @@ namespace smt { } coeffs.push_back(mpq(1)); vars.push_back(w); - Simplex::row row = S.add_row(w, vars.size(), vars.c_ptr(), coeffs.c_ptr()); + Simplex::row row = S.add_row(w, vars.size(), vars.data(), coeffs.data()); TRACE("opt", S.display(tout); display(tout);); @@ -1098,7 +1098,7 @@ namespace smt { else { // expr_ref_vector const& core = m_objective_assignments[v]; - f = m.mk_and(core.size(), core.c_ptr()); + f = m.mk_and(core.size(), core.data()); if (is_strict) { f = m.mk_not(f); } @@ -1114,7 +1114,7 @@ namespace smt { } else { expr_ref_vector const& core = m_objective_assignments[v]; - f = m.mk_and(core.size(), core.c_ptr()); + f = m.mk_and(core.size(), core.data()); } } else { diff --git a/src/smt/theory_diff_logic_def.h b/src/smt/theory_diff_logic_def.h index 4c2c2ba88..e9747c4ae 100644 --- a/src/smt/theory_diff_logic_def.h +++ b/src/smt/theory_diff_logic_def.h @@ -651,7 +651,7 @@ void theory_diff_logic::new_edge(dl_var src, dl_var dst, unsigned num_edges TRACE("dl_activity", tout << mk_pp(le, m) << "\n"; tout << "edge: " << a->get_pos() << "\n"; - ctx.display_literals_verbose(tout, lits.size(), lits.c_ptr()); + ctx.display_literals_verbose(tout, lits.size(), lits.data()); tout << "\n"; ); @@ -661,13 +661,13 @@ void theory_diff_logic::new_edge(dl_var src, dl_var dst, unsigned num_edges params.push_back(parameter(symbol("farkas"))); params.resize(lits.size()+1, parameter(rational(1))); js = new (ctx.get_region()) theory_lemma_justification(get_id(), ctx, - lits.size(), lits.c_ptr(), - params.size(), params.c_ptr()); + lits.size(), lits.data(), + params.size(), params.data()); } - ctx.mk_clause(lits.size(), lits.c_ptr(), js, CLS_TH_LEMMA, nullptr); + ctx.mk_clause(lits.size(), lits.data(), js, CLS_TH_LEMMA, nullptr); if (dump_lemmas()) { symbol logic(m_lia_or_lra == is_lia ? "QF_LIA" : "QF_LRA"); - ctx.display_lemma_as_smt_problem(lits.size(), lits.c_ptr(), false_literal, logic); + ctx.display_lemma_as_smt_problem(lits.size(), lits.data(), false_literal, logic); } #if 0 @@ -709,7 +709,7 @@ void theory_diff_logic::set_neg_cycle_conflict() { if (dump_lemmas()) { symbol logic(m_lia_or_lra == is_lia ? "QF_LIA" : "QF_LRA"); - ctx.display_lemma_as_smt_problem(lits.size(), lits.c_ptr(), false_literal, logic); + ctx.display_lemma_as_smt_problem(lits.size(), lits.data(), false_literal, logic); } vector params; @@ -724,7 +724,7 @@ void theory_diff_logic::set_neg_cycle_conflict() { ctx.mk_justification( ext_theory_conflict_justification( get_id(), ctx.get_region(), - lits.size(), lits.c_ptr(), 0, nullptr, params.size(), params.c_ptr()))); + lits.size(), lits.data(), 0, nullptr, params.size(), params.data()))); } @@ -1182,7 +1182,7 @@ void theory_diff_logic::update_simplex(Simplex& S) { vars[0] = node2simplex(e.get_target()); vars[1] = node2simplex(e.get_source()); vars[2] = base_var; - S.add_row(base_var, 3, vars.c_ptr(), coeffs.c_ptr()); + S.add_row(base_var, 3, vars.data(), coeffs.data()); } m_num_simplex_edges = es.size(); for (unsigned i = 0; i < es.size(); ++i) { @@ -1214,7 +1214,7 @@ void theory_diff_logic::update_simplex(Simplex& S) { } coeffs.push_back(mpq(1)); vars.push_back(w); - Simplex::row row = S.add_row(w, vars.size(), vars.c_ptr(), coeffs.c_ptr()); + Simplex::row row = S.add_row(w, vars.size(), vars.data(), coeffs.data()); m_objective_rows.push_back(row); } } @@ -1362,7 +1362,7 @@ expr_ref theory_diff_logic::mk_ineq(theory_var v, inf_eps const& val, bool else { // expr_ref_vector const& core = m_objective_assignments[v]; - f = m.mk_and(core.size(), core.c_ptr()); + f = m.mk_and(core.size(), core.data()); if (is_strict) { f = m.mk_not(f); } @@ -1378,7 +1378,7 @@ expr_ref theory_diff_logic::mk_ineq(theory_var v, inf_eps const& val, bool } else { expr_ref_vector const& core = m_objective_assignments[v]; - f = m.mk_and(core.size(), core.c_ptr()); + f = m.mk_and(core.size(), core.data()); } } else { diff --git a/src/smt/theory_lra.cpp b/src/smt/theory_lra.cpp index ec66cdcfd..8ded1bb49 100644 --- a/src/smt/theory_lra.cpp +++ b/src/smt/theory_lra.cpp @@ -515,7 +515,7 @@ class theory_lra::imp { vars.push_back(register_theory_var_in_lar_solver(w)); ensure_nla(); m_solver->register_existing_terms(); - m_nla->add_monic(register_theory_var_in_lar_solver(v), vars.size(), vars.c_ptr()); + m_nla->add_monic(register_theory_var_in_lar_solver(v), vars.size(), vars.data()); return v; } @@ -537,7 +537,7 @@ class theory_lra::imp { 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.c_ptr()); + m_nla->add_monic(register_theory_var_in_lar_solver(v), vars.size(), vars.data()); } return v; } @@ -1326,7 +1326,7 @@ public: } if (m.has_trace_stream()) { app_ref body(m); - body = m.mk_or(exprs.size(), exprs.c_ptr()); + body = m.mk_or(exprs.size(), exprs.data()); th.log_axiom_instantiation(body); } ctx().mk_th_axiom(get_id(), lits.size(), lits.begin()); @@ -1455,7 +1455,7 @@ public: } tout << "\n"; ); if (!vars.empty()) { - lp().random_update(vars.size(), vars.c_ptr()); + lp().random_update(vars.size(), vars.data()); } } @@ -1813,7 +1813,7 @@ public: t = ts.back(); } else { - t = a.mk_add(ts.size(), ts.c_ptr()); + t = a.mk_add(ts.size(), ts.data()); } return t; } @@ -1827,11 +1827,11 @@ public: ts.push_back(multerm(cv.first, var2expr(cv.second))); } switch (c.kind()) { - case lp::LE: fml = a.mk_le(a.mk_add(ts.size(), ts.c_ptr()), a.mk_numeral(rhs, true)); break; - case lp::LT: fml = a.mk_lt(a.mk_add(ts.size(), ts.c_ptr()), a.mk_numeral(rhs, true)); break; - case lp::GE: fml = a.mk_ge(a.mk_add(ts.size(), ts.c_ptr()), a.mk_numeral(rhs, true)); break; - case lp::GT: fml = a.mk_gt(a.mk_add(ts.size(), ts.c_ptr()), a.mk_numeral(rhs, true)); break; - case lp::EQ: fml = m.mk_eq(a.mk_add(ts.size(), ts.c_ptr()), a.mk_numeral(rhs, true)); break; + case lp::LE: fml = a.mk_le(a.mk_add(ts.size(), ts.data()), a.mk_numeral(rhs, true)); break; + case lp::LT: fml = a.mk_lt(a.mk_add(ts.size(), ts.data()), a.mk_numeral(rhs, true)); break; + case lp::GE: fml = a.mk_ge(a.mk_add(ts.size(), ts.data()), a.mk_numeral(rhs, true)); break; + case lp::GT: fml = a.mk_gt(a.mk_add(ts.size(), ts.data()), a.mk_numeral(rhs, true)); break; + case lp::EQ: fml = m.mk_eq(a.mk_add(ts.size(), ts.data()), a.mk_numeral(rhs, true)); break; case lp::NE: SASSERT(false); // unexpected break; @@ -1931,7 +1931,7 @@ public: TRACE("arith", dump_cut_lemma(tout, m_lia->get_term(), m_lia->get_offset(), m_explanation, m_lia->is_upper());); literal lit(ctx().get_bool_var(b), false); TRACE("arith", - ctx().display_lemma_as_smt_problem(tout << "new cut:\n", m_core.size(), m_core.c_ptr(), m_eqs.size(), m_eqs.c_ptr(), lit); + 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); lia_check = l_false; @@ -2297,17 +2297,17 @@ public: m_core2.push_back(lit); justification * js = nullptr; if (proofs_enabled()) { - js = alloc(theory_lemma_justification, get_id(), ctx(), m_core2.size(), m_core2.c_ptr(), - params.size(), params.c_ptr()); + js = alloc(theory_lemma_justification, get_id(), ctx(), m_core2.size(), m_core2.data(), + params.size(), params.data()); } - ctx().mk_clause(m_core2.size(), m_core2.c_ptr(), js, CLS_TH_LEMMA, nullptr); + ctx().mk_clause(m_core2.size(), m_core2.data(), js, CLS_TH_LEMMA, nullptr); } else { ctx().assign( lit, ctx().mk_justification( ext_theory_propagation_justification( - get_id(), ctx().get_region(), core.size(), core.c_ptr(), - eqs.size(), eqs.c_ptr(), lit, params.size(), params.c_ptr()))); + get_id(), ctx().get_region(), core.size(), core.data(), + eqs.size(), eqs.data(), lit, params.size(), params.data()))); } } @@ -3037,7 +3037,7 @@ public: justification* js = ctx().mk_justification( ext_theory_eq_propagation_justification( - get_id(), ctx().get_region(), m_core.size(), m_core.c_ptr(), m_eqs.size(), m_eqs.c_ptr(), x, y)); + get_id(), ctx().get_region(), m_core.size(), m_core.data(), m_eqs.size(), m_eqs.data(), x, y)); TRACE("arith", for (auto c : m_core) @@ -3170,8 +3170,8 @@ public: ctx().mk_justification( ext_theory_conflict_justification( get_id(), ctx().get_region(), - m_core.size(), m_core.c_ptr(), - m_eqs.size(), m_eqs.c_ptr(), m_params.size(), m_params.c_ptr()))); + m_core.size(), m_core.data(), + m_eqs.size(), m_eqs.data(), m_params.size(), m_params.data()))); } else { for (auto const& eq : m_eqs) { @@ -3192,7 +3192,7 @@ public: // The lemmas can come in batches // and the same literal can appear in several lemmas in a batch: it becomes l_true // in earlier processing, but it was not so when the lemma was produced - ctx().mk_th_axiom(get_id(), m_core.size(), m_core.c_ptr()); + ctx().mk_th_axiom(get_id(), m_core.size(), m_core.data()); } } @@ -3377,7 +3377,7 @@ public: void dump_conflict(literal_vector const& core, svector const& eqs) { if (dump_lemmas()) { - ctx().display_lemma_as_smt_problem(core.size(), core.c_ptr(), eqs.size(), eqs.c_ptr(), false_literal); + ctx().display_lemma_as_smt_problem(core.size(), core.data(), eqs.size(), eqs.data(), false_literal); } } @@ -3389,13 +3389,13 @@ 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, core.size(), core.c_ptr(), eqs.size(), eqs.c_ptr(), false_literal);); + CTRACE("arith", !result, ctx().display_lemma_as_smt_problem(tout, core.size(), core.data(), eqs.size(), eqs.data(), false_literal);); return result; } void dump_assign(literal lit, literal_vector const& core, svector const& eqs) { if (dump_lemmas()) { - unsigned id = ctx().display_lemma_as_smt_problem(core.size(), core.c_ptr(), eqs.size(), eqs.c_ptr(), lit); + unsigned id = ctx().display_lemma_as_smt_problem(core.size(), core.data(), eqs.size(), eqs.data(), lit); (void)id; } } @@ -3410,7 +3410,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, core.size(), core.c_ptr(), eqs.size(), eqs.c_ptr(), lit); + CTRACE("arith", !result, ctx().display_lemma_as_smt_problem(tout, core.size(), core.data(), eqs.size(), eqs.data(), lit); display(tout);); return result; } @@ -3586,7 +3586,7 @@ public: case 1: return app_ref(to_app(args[0].get()), m); default: - return app_ref(a.mk_add(args.size(), args.c_ptr()), m); + return app_ref(a.mk_add(args.size(), args.data()), m); } } diff --git a/src/smt/theory_pb.cpp b/src/smt/theory_pb.cpp index 19f7e0677..8cef18ab2 100644 --- a/src/smt/theory_pb.cpp +++ b/src/smt/theory_pb.cpp @@ -145,10 +145,10 @@ namespace smt { } pb_util pb(m); if (is_eq) { - result = pb.mk_eq(coeffs.size(), coeffs.c_ptr(), args.c_ptr(), k()); + result = pb.mk_eq(coeffs.size(), coeffs.data(), args.data(), k()); } else { - result = pb.mk_ge(coeffs.size(), coeffs.c_ptr(), args.c_ptr(), k()); + result = pb.mk_ge(coeffs.size(), coeffs.data(), args.data(), k()); } return result; } @@ -243,7 +243,7 @@ namespace smt { for (unsigned i = 0; i < size(); ++i) { args.push_back(th.literal2expr(m_args[i])); } - return app_ref(th.pb.mk_at_least_k(args.size(), args.c_ptr(), k()), m); + return app_ref(th.pb.mk_at_least_k(args.size(), args.data(), k()), m); } lbool theory_pb::card::assign(theory_pb& th, literal alit) { @@ -500,8 +500,8 @@ namespace smt { // -ax - by - cz >= -k // <=> // a(1-x) + b(1-y) + c(1-z) >= a + b + c - k - expr_ref le(pb.mk_ge(num_args, coeffs.c_ptr(), nargs.c_ptr(), sum - k), m); - expr_ref ge(pb.mk_ge(num_args, coeffs.c_ptr(), args.c_ptr(), k), m); + expr_ref le(pb.mk_ge(num_args, coeffs.data(), nargs.data(), sum - k), m); + expr_ref ge(pb.mk_ge(num_args, coeffs.data(), args.data(), k), m); ctx.internalize(le, false); ctx.internalize(ge, false); literal le_lit = ctx.get_literal(le); @@ -568,7 +568,7 @@ namespace smt { SASSERT(c->coeff(i).is_one()); ctx.mk_th_axiom(get_id(), lit, ~c->lit(i)); } - ctx.mk_th_axiom(get_id(), lits.size(), lits.c_ptr()); + ctx.mk_th_axiom(get_id(), lits.size(), lits.data()); return true; } @@ -765,7 +765,7 @@ namespace smt { return nullptr; } else { - return m.mk_th_lemma(m_fid, fact, prs.size(), prs.c_ptr()); + return m.mk_th_lemma(m_fid, fact, prs.size(), prs.data()); } } }; @@ -844,7 +844,7 @@ namespace smt { lits.push_back(~c.lit(i)); } lits.push_back(lit); - ctx.mk_th_axiom(get_id(), lits.size(), lits.c_ptr()); + ctx.mk_th_axiom(get_id(), lits.size(), lits.data()); for (unsigned i = 0; i < c.size(); ++i) { literal lits2[2] = { ~lit, c.lit(i) }; ctx.mk_th_axiom(get_id(), 2, lits2); @@ -858,7 +858,7 @@ namespace smt { lits.push_back(c.lit(i)); } lits.push_back(~lit); - ctx.mk_th_axiom(get_id(), lits.size(), lits.c_ptr()); + ctx.mk_th_axiom(get_id(), lits.size(), lits.data()); for (unsigned i = 0; i < c.size(); ++i) { literal lits2[2] = { lit, ~c.lit(i) }; ctx.mk_th_axiom(get_id(), 2, lits2); @@ -934,9 +934,9 @@ namespace smt { c.inc_propagations(*this); if (!resolve_conflict(c, lits)) { if (proofs_enabled()) { - js = alloc(theory_lemma_justification, get_id(), ctx, lits.size(), lits.c_ptr()); + js = alloc(theory_lemma_justification, get_id(), ctx, lits.size(), lits.data()); } - ctx.mk_clause(lits.size(), lits.c_ptr(), js, CLS_TH_LEMMA, nullptr); + ctx.mk_clause(lits.size(), lits.data(), js, CLS_TH_LEMMA, nullptr); } SASSERT(ctx.inconsistent()); } @@ -1280,7 +1280,7 @@ namespace smt { ctx.literal2expr(lits[i], tmp); es.push_back(tmp); } - tmp = m.mk_or(es.size(), es.c_ptr()); + tmp = m.mk_or(es.size(), es.data()); bool_var v = ctx.b_internalized(tmp)?ctx.get_bool_var(tmp):ctx.mk_bool_var(tmp); return literal(v); } @@ -1292,7 +1292,7 @@ namespace smt { ctx.literal2expr(lits[i], tmp); es.push_back(tmp); } - tmp = m.mk_and(es.size(), es.c_ptr()); + tmp = m.mk_and(es.size(), es.data()); bool_var v = ctx.b_internalized(tmp)?ctx.get_bool_var(tmp):ctx.mk_bool_var(tmp); return literal(v); } @@ -1301,7 +1301,7 @@ namespace smt { void mk_clause(unsigned n, literal const* ls) { literal_vector tmp(n, ls); - ctx.mk_clause(n, tmp.c_ptr(), th.justify(tmp), CLS_AUX, nullptr); + ctx.mk_clause(n, tmp.data(), th.justify(tmp), CLS_AUX, nullptr); } literal mk_false() { return false_literal; } @@ -1504,7 +1504,7 @@ namespace smt { SASSERT(validate_antecedents(lits)); ctx.assign(l, ctx.mk_justification( pb_justification( - c, get_id(), ctx.get_region(), lits.size(), lits.c_ptr(), l))); + c, get_id(), ctx.get_region(), lits.size(), lits.data(), l))); } @@ -1516,9 +1516,9 @@ namespace smt { display(tout, c, true);); justification* js = nullptr; if (proofs_enabled()) { - js = alloc(theory_lemma_justification, get_id(), ctx, lits.size(), lits.c_ptr()); + js = alloc(theory_lemma_justification, get_id(), ctx, lits.size(), lits.data()); } - ctx.mk_clause(lits.size(), lits.c_ptr(), js, CLS_TH_LEMMA, nullptr); + ctx.mk_clause(lits.size(), lits.data(), js, CLS_TH_LEMMA, nullptr); } @@ -1622,7 +1622,7 @@ namespace smt { literal lit = cls.get_literal(i); args.push_back(literal2expr(lit)); } - result = m.mk_or(args.size(), args.c_ptr()); + result = m.mk_or(args.size(), args.data()); break; } case b_justification::BIN_CLAUSE: @@ -2005,7 +2005,7 @@ namespace smt { SASSERT(validate_antecedents(m_antecedents)); TRACE("pb", tout << "assign " << m_antecedents << " ==> " << alit << "\n";); - ctx.assign(alit, ctx.mk_justification(theory_propagation_justification(get_id(), ctx.get_region(), m_antecedents.size(), m_antecedents.c_ptr(), alit, 0, nullptr))); + ctx.assign(alit, ctx.mk_justification(theory_propagation_justification(get_id(), ctx.get_region(), m_antecedents.size(), m_antecedents.data(), alit, 0, nullptr))); DEBUG_CODE( m_antecedents.push_back(~alit); @@ -2013,7 +2013,7 @@ namespace smt { for (literal lit : m_antecedents) { args.push_back(literal2expr(lit)); } - B = m.mk_not(m.mk_and(args.size(), args.c_ptr())); + B = m.mk_not(m.mk_and(args.size(), args.data())); validate_implies(A, B); ); return true; } @@ -2034,7 +2034,7 @@ namespace smt { justification* theory_pb::justify(literal_vector const& lits) { justification* js = nullptr; if (proofs_enabled()) { - js = ctx.mk_justification(theory_axiom_justification(get_id(), ctx.get_region(), lits.size(), lits.c_ptr())); + js = ctx.mk_justification(theory_axiom_justification(get_id(), ctx.get_region(), lits.size(), lits.data())); } return js; } @@ -2188,7 +2188,7 @@ namespace smt { coeffs.push_back(rational(get_abs_coeff(v))); } rational k(m_bound); - return app_ref(pb.mk_ge(args.size(), coeffs.c_ptr(), args.c_ptr(), k), m); + return app_ref(pb.mk_ge(args.size(), coeffs.data(), args.data(), k), m); } // display methods @@ -2296,7 +2296,7 @@ namespace smt { } void get_dependencies(buffer & result) override { - result.append(m_dependencies.size(), m_dependencies.c_ptr()); + result.append(m_dependencies.size(), m_dependencies.data()); } app * mk_value(model_generator & mg, expr_ref_vector const& values) override { diff --git a/src/smt/theory_seq.cpp b/src/smt/theory_seq.cpp index 0296d2f46..6c5612c37 100644 --- a/src/smt/theory_seq.cpp +++ b/src/smt/theory_seq.cpp @@ -495,7 +495,7 @@ bool theory_seq::fixed_length(expr* len_e, bool is_zero) { elems.push_back(head); seq = tail; } - seq = mk_concat(elems.size(), elems.c_ptr()); + seq = mk_concat(elems.size(), elems.data()); } 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); @@ -753,7 +753,7 @@ bool theory_seq::propagate_lit(dependency* dep, unsigned n, literal const* _lits justification* js = ctx.mk_justification( ext_theory_propagation_justification( - get_id(), ctx.get_region(), lits.size(), lits.c_ptr(), eqs.size(), eqs.c_ptr(), lit)); + get_id(), ctx.get_region(), lits.size(), lits.data(), eqs.size(), eqs.data(), lit)); m_new_propagation = true; ctx.assign(lit, js); @@ -774,7 +774,7 @@ void theory_seq::set_conflict(enode_pair_vector const& eqs, literal_vector const ctx.set_conflict( ctx.mk_justification( ext_theory_conflict_justification( - get_id(), ctx.get_region(), lits.size(), lits.c_ptr(), eqs.size(), eqs.c_ptr(), 0, nullptr))); + get_id(), ctx.get_region(), lits.size(), lits.data(), eqs.size(), eqs.data(), 0, nullptr))); validate_conflict(eqs, lits); } @@ -799,7 +799,7 @@ bool theory_seq::propagate_eq(dependency* dep, enode* n1, enode* n2) { justification* js = ctx.mk_justification( ext_theory_eq_propagation_justification( - get_id(), ctx.get_region(), lits.size(), lits.c_ptr(), eqs.size(), eqs.c_ptr(), n1, n2)); + get_id(), ctx.get_region(), lits.size(), lits.data(), eqs.size(), eqs.data(), n1, n2)); { std::function fn = [&]() { return m.mk_eq(n1->get_expr(), n2->get_expr()); }; @@ -997,8 +997,8 @@ bool theory_seq::reduce_length_eq(expr_ref_vector const& ls, expr_ref_vector con expr_ref l(ls[0], m), r(rs[0], m); if (reduce_length(l, r, lits)) { expr_ref_vector lhs(m), rhs(m); - lhs.append(ls.size()-1, ls.c_ptr() + 1); - rhs.append(rs.size()-1, rs.c_ptr() + 1); + lhs.append(ls.size()-1, ls.data() + 1); + rhs.append(rs.size()-1, rs.data() + 1); SASSERT(!lhs.empty() || !rhs.empty()); deps = mk_join(deps, lits); m_eqs.push_back(depeq(m_eq_id++, lhs, rhs, deps)); @@ -1010,8 +1010,8 @@ bool theory_seq::reduce_length_eq(expr_ref_vector const& ls, expr_ref_vector con l = ls.back(); r = rs.back(); if (reduce_length(l, r, lits)) { expr_ref_vector lhs(m), rhs(m); - lhs.append(ls.size()-1, ls.c_ptr()); - rhs.append(rs.size()-1, rs.c_ptr()); + lhs.append(ls.size()-1, ls.data()); + 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";); @@ -1065,10 +1065,10 @@ bool theory_seq::reduce_length_eq(expr_ref_vector const& ls, expr_ref_vector con } bool theory_seq::reduce_length(unsigned i, unsigned j, bool front, expr_ref_vector const& ls, expr_ref_vector const& rs, dependency* deps) { - expr* const* ls1 = ls.c_ptr(); - expr* const* ls2 = ls.c_ptr()+i; - expr* const* rs1 = rs.c_ptr(); - expr* const* rs2 = rs.c_ptr()+j; + expr* const* ls1 = ls.data(); + expr* const* ls2 = ls.data()+i; + expr* const* rs1 = rs.data(); + expr* const* rs2 = rs.data()+j; unsigned l1 = i; unsigned l2 = ls.size()-i; unsigned r1 = j; @@ -1785,7 +1785,7 @@ public: m_source.push_back(string_source); } void get_dependencies(buffer & result) override { - result.append(m_dependencies.size(), m_dependencies.c_ptr()); + result.append(m_dependencies.size(), m_dependencies.data()); } void add_buffer(svector& sbuffer, zstring const& zs) { @@ -1845,7 +1845,7 @@ public: } // TRACE("seq", tout << src << " " << sbuffer << "\n";); } - result = th.m_util.str.mk_string(zstring(sbuffer.size(), sbuffer.c_ptr())); + result = th.m_util.str.mk_string(zstring(sbuffer.size(), sbuffer.data())); } else { for (source_t src : m_source) { @@ -2745,7 +2745,7 @@ void theory_seq::add_axiom(literal_vector & lits) { scoped_trace_stream _sts(*this, lits); validate_axiom(lits); - ctx.mk_th_axiom(get_id(), lits.size(), lits.c_ptr()); + ctx.mk_th_axiom(get_id(), lits.size(), lits.data()); } @@ -2797,7 +2797,7 @@ bool theory_seq::propagate_eq(dependency* deps, literal_vector const& _lits, exp justification* js = ctx.mk_justification( ext_theory_eq_propagation_justification( - get_id(), ctx.get_region(), lits.size(), lits.c_ptr(), eqs.size(), eqs.c_ptr(), n1, n2)); + get_id(), ctx.get_region(), lits.size(), lits.data(), eqs.size(), eqs.data(), n1, n2)); m_new_propagation = true; diff --git a/src/smt/theory_seq.h b/src/smt/theory_seq.h index 6dbeddf41..5042fe14f 100644 --- a/src/smt/theory_seq.h +++ b/src/smt/theory_seq.h @@ -476,9 +476,9 @@ namespace smt { expr_ref mk_empty(sort* s) { return expr_ref(m_util.str.mk_empty(s), m); } expr_ref mk_concat(unsigned n, expr*const* es) { return expr_ref(m_util.str.mk_concat(n, es, es[0]->get_sort()), m); } expr_ref mk_concat(unsigned n, expr*const* es, sort* s) { return expr_ref(m_util.str.mk_concat(n, es, s), m); } - expr_ref mk_concat(expr_ref_vector const& es, sort* s) { return mk_concat(es.size(), es.c_ptr(), s); } - expr_ref mk_concat(expr_ref_vector const& es) { SASSERT(!es.empty()); return expr_ref(m_util.str.mk_concat(es.size(), es.c_ptr(), es[0]->get_sort()), m); } - expr_ref mk_concat(ptr_vector const& es) { SASSERT(!es.empty()); return mk_concat(es.size(), es.c_ptr(), es[0]->get_sort()); } + expr_ref mk_concat(expr_ref_vector const& es, sort* s) { return mk_concat(es.size(), es.data(), s); } + expr_ref mk_concat(expr_ref_vector const& es) { SASSERT(!es.empty()); return expr_ref(m_util.str.mk_concat(es.size(), es.data(), es[0]->get_sort()), m); } + expr_ref mk_concat(ptr_vector const& es) { SASSERT(!es.empty()); return mk_concat(es.size(), es.data(), es[0]->get_sort()); } expr_ref mk_concat(expr* e1, expr* e2) { return expr_ref(m_util.str.mk_concat(e1, e2), m); } expr_ref mk_concat(expr* e1, expr* e2, expr* e3) { return expr_ref(m_util.str.mk_concat(e1, e2, e3), m); } bool solve_nqs(unsigned i); diff --git a/src/smt/theory_special_relations.cpp b/src/smt/theory_special_relations.cpp index 7b4fed92d..c612d4938 100644 --- a/src/smt/theory_special_relations.cpp +++ b/src/smt/theory_special_relations.cpp @@ -472,7 +472,7 @@ namespace smt { ctx.mk_justification( ext_theory_conflict_justification( get_id(), ctx.get_region(), - lits.size(), lits.c_ptr(), 0, 0, params.size(), params.c_ptr()))); + lits.size(), lits.data(), 0, 0, params.size(), params.data()))); } lbool theory_special_relations::final_check(relation& r) { @@ -534,7 +534,7 @@ namespace smt { 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";); 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.get_region(), lits.size(), lits.c_ptr(), 0, nullptr, + eq_justification js(ctx.mk_justification(ext_theory_eq_propagation_justification(get_id(), ctx.get_region(), lits.size(), lits.data(), 0, nullptr, x, y))); ctx.assign_eq(x, y, js); } diff --git a/src/smt/theory_str.cpp b/src/smt/theory_str.cpp index 544b4807f..ba81cb2e1 100644 --- a/src/smt/theory_str.cpp +++ b/src/smt/theory_str.cpp @@ -750,7 +750,7 @@ namespace smt { for (auto el : childrenVector) { items.push_back(mk_strlen(el)); } - expr_ref lenAssert(ctx.mk_eq_atom(concat_length, m_autil.mk_add(items.size(), items.c_ptr())), m); + expr_ref lenAssert(ctx.mk_eq_atom(concat_length, m_autil.mk_add(items.size(), items.data())), m); assert_axiom(lenAssert); } return concatAst; @@ -1143,7 +1143,7 @@ namespace smt { innerItems.push_back(ctx.mk_eq_atom(expr->get_arg(1), mk_concat(ts0, ts1))); innerItems.push_back(ctx.mk_eq_atom(mk_strlen(ts0), mk_strlen(expr->get_arg(0)))); innerItems.push_back(m.mk_ite(ctx.mk_eq_atom(ts0, expr->get_arg(0)), expr, mk_not(m, expr))); - expr_ref then1(m.mk_and(innerItems.size(), innerItems.c_ptr()), m); + expr_ref then1(m.mk_and(innerItems.size(), innerItems.data()), m); SASSERT(then1); // the top-level condition is Length(arg0) >= Length(arg1) @@ -1179,7 +1179,7 @@ namespace smt { innerItems.push_back(ctx.mk_eq_atom(expr->get_arg(1), mk_concat(ts0, ts1))); innerItems.push_back(ctx.mk_eq_atom(mk_strlen(ts1), mk_strlen(expr->get_arg(0)))); innerItems.push_back(m.mk_ite(ctx.mk_eq_atom(ts1, expr->get_arg(0)), expr, mk_not(m, expr))); - expr_ref then1(m.mk_and(innerItems.size(), innerItems.c_ptr()), m); + expr_ref then1(m.mk_and(innerItems.size(), innerItems.data()), m); SASSERT(then1); // the top-level condition is Length(arg0) >= Length(arg1) @@ -1546,9 +1546,9 @@ namespace smt { expr_ref_vector elseItems(m); elseItems.push_back(ctx.mk_eq_atom(indexAst, mk_int(-1))); - items.push_back(m.mk_ite(condAst, m.mk_and(thenItems.size(), thenItems.c_ptr()), m.mk_and(elseItems.size(), elseItems.c_ptr()))); + items.push_back(m.mk_ite(condAst, m.mk_and(thenItems.size(), thenItems.data()), m.mk_and(elseItems.size(), elseItems.data()))); - expr_ref breakdownAssert(m.mk_and(items.size(), items.c_ptr()), m); + expr_ref breakdownAssert(m.mk_and(items.size(), items.data()), m); SASSERT(breakdownAssert); expr_ref reduceToIndex(ctx.mk_eq_atom(expr, indexAst), m); @@ -2503,7 +2503,7 @@ namespace smt { l_items.push_back(ctx.mk_eq_atom(mk_strlen(arg1), mk_int(arg1_len))); } - expr_ref axl(m.mk_and(l_items.size(), l_items.c_ptr()), m); + 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;); @@ -2564,7 +2564,7 @@ namespace smt { } if (axr) { - expr_ref axl(m.mk_and(l_items.size(), l_items.c_ptr()), m); + expr_ref axl(m.mk_and(l_items.size(), l_items.data()), m); assert_implication(axl, axr); } } @@ -2640,7 +2640,7 @@ namespace smt { literal l = ctx.get_literal(e); ls.push_back(l); } - ctx.mk_th_case_split(ls.size(), ls.c_ptr()); + ctx.mk_th_case_split(ls.size(), ls.data()); } void theory_str::print_cut_var(expr * node, std::ofstream & xout) { @@ -3960,7 +3960,7 @@ namespace smt { zstring suffixStr = strValue.extract(prefixLen.get_unsigned(), str_sub_prefix.get_unsigned()); expr_ref prefixAst(mk_string(prefixStr), mgr); expr_ref suffixAst(mk_string(suffixStr), mgr); - expr_ref ax_l(mgr.mk_and(litems.size(), litems.c_ptr()), mgr); + expr_ref ax_l(mgr.mk_and(litems.size(), litems.data()), mgr); expr_ref suf_n_concat(mk_concat(suffixAst, n), mgr); if (can_two_nodes_eq(x, prefixAst) && can_two_nodes_eq(y, suf_n_concat)) { @@ -4009,7 +4009,7 @@ namespace smt { tmpLen = x_len - str_len; litems.push_back(ctx.mk_eq_atom(mk_strlen(x), mk_int(x_len))); } - expr_ref ax_l(mgr.mk_and(litems.size(), litems.c_ptr()), mgr); + expr_ref ax_l(mgr.mk_and(litems.size(), litems.data()), mgr); expr_ref str_temp1(mk_concat(strAst, temp1), mgr); expr_ref temp1_y(mk_concat(temp1, y), mgr); @@ -8421,7 +8421,7 @@ namespace smt { expr_ref lenEqNum(ctx.mk_eq_atom(nodeWithLenExpr, varLenExpr), m); l_items.push_back(lenEqNum); - expr_ref axl(m.mk_and(l_items.size(), l_items.c_ptr()), m); + expr_ref axl(m.mk_and(l_items.size(), l_items.data()), m); expr_ref varLen(mk_strlen(var), m); expr_ref axr(ctx.mk_eq_atom(varLen, mk_int(varLen)), m); assert_implication(axl, axr); @@ -8474,7 +8474,7 @@ namespace smt { } } if (allLeafResolved) { - expr_ref axl(m.mk_and(l_items.size(), l_items.c_ptr()), m); + expr_ref axl(m.mk_and(l_items.size(), l_items.data()), m); expr_ref lenValueExpr (mk_int(lenValue), m); expr_ref axr(ctx.mk_eq_atom(concatlenExpr, lenValueExpr), m); assert_implication(axl, axr); @@ -9268,10 +9268,10 @@ namespace smt { diseqs.push_back(extra_right_cond); } if (extra_deps.size() > 0) { - diseqs.push_back(m.mk_and(extra_deps.size(), extra_deps.c_ptr())); + 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;); } - expr* final_diseq = m.mk_and(diseqs.size(), diseqs.c_ptr()); + expr* final_diseq = m.mk_and(diseqs.size(), diseqs.data()); TRACE("str", tout << "learning not " << mk_pp(final_diseq, m) << std::endl;); return final_diseq; } diff --git a/src/smt/theory_str_mc.cpp b/src/smt/theory_str_mc.cpp index e642d6c7b..8979a7a37 100644 --- a/src/smt/theory_str_mc.cpp +++ b/src/smt/theory_str_mc.cpp @@ -1292,7 +1292,7 @@ namespace smt { assignment.push_back((unsigned)'?'); } } - zstring strValue(assignment.size(), assignment.c_ptr()); + zstring strValue(assignment.size(), assignment.data()); model.insert(var, strValue); subst.insert(var, mk_string(strValue)); } @@ -1313,7 +1313,7 @@ namespace smt { assignment.push_back((unsigned)'?'); } } - zstring strValue(assignment.size(), assignment.c_ptr()); + zstring strValue(assignment.size(), assignment.data()); model.insert(var, strValue); subst.insert(var, mk_string(strValue)); } diff --git a/src/smt/theory_str_regex.cpp b/src/smt/theory_str_regex.cpp index 032592171..57ed89588 100644 --- a/src/smt/theory_str_regex.cpp +++ b/src/smt/theory_str_regex.cpp @@ -1314,7 +1314,7 @@ namespace smt { SASSERT(new_arg); rewritten_args.push_back(new_arg); } - retval = m.mk_app(a_cond->get_decl(), rewritten_args.c_ptr()); + retval = m.mk_app(a_cond->get_decl(), rewritten_args.data()); TRACE("str", tout << "final rewritten term is " << mk_pp(retval, m) << std::endl;); return retval; } else { diff --git a/src/smt/theory_utvpi_def.h b/src/smt/theory_utvpi_def.h index 340346018..b43c8a57d 100644 --- a/src/smt/theory_utvpi_def.h +++ b/src/smt/theory_utvpi_def.h @@ -208,7 +208,7 @@ namespace smt { if (m_params.m_arith_dump_lemmas) { symbol logic(m_lra ? (m_lia?"QF_LIRA":"QF_LRA") : "QF_LIA"); - ctx.display_lemma_as_smt_problem(lits.size(), lits.c_ptr(), false_literal, logic); + ctx.display_lemma_as_smt_problem(lits.size(), lits.data(), false_literal, logic); } vector params; @@ -223,7 +223,7 @@ namespace smt { ctx.mk_justification( ext_theory_conflict_justification( get_id(), ctx.get_region(), - lits.size(), lits.c_ptr(), 0, nullptr, params.size(), params.c_ptr()))); + lits.size(), lits.data(), 0, nullptr, params.size(), params.data()))); m_nc_functor.reset(); } diff --git a/src/smt/theory_wmaxsat.cpp b/src/smt/theory_wmaxsat.cpp index c93dacdf5..d6c6793e1 100644 --- a/src/smt/theory_wmaxsat.cpp +++ b/src/smt/theory_wmaxsat.cpp @@ -254,7 +254,7 @@ namespace smt { //ctx.display(tout); ); } - expr_ref result(m.mk_or(disj.size(), disj.c_ptr()), m); + expr_ref result(m.mk_or(disj.size(), disj.data()), m); TRACE("opt", tout << result << " weight: " << weight << "\n"; tout << "cost: " << m_zcost << " min-cost: " << m_zmin_cost << "\n";); @@ -283,7 +283,7 @@ namespace smt { ctx.set_conflict( ctx.mk_justification( - ext_theory_conflict_justification(get_id(), ctx.get_region(), lits.size(), lits.c_ptr(), 0, nullptr, 0, nullptr))); + ext_theory_conflict_justification(get_id(), ctx.get_region(), lits.size(), lits.data(), 0, nullptr, 0, nullptr))); } bool theory_wmaxsat::max_unassigned_is_blocked() { @@ -325,13 +325,13 @@ namespace smt { lits.push_back(literal(w)); } TRACE("opt", - ctx.display_literals_verbose(tout, lits.size(), lits.c_ptr()); + ctx.display_literals_verbose(tout, lits.size(), lits.data()); ctx.display_literal_verbose(tout << " --> ", lit);); region& r = ctx.get_region(); ctx.assign(lit, ctx.mk_justification( ext_theory_propagation_justification( - get_id(), r, lits.size(), lits.c_ptr(), 0, nullptr, lit, 0, nullptr))); + get_id(), r, lits.size(), lits.data(), 0, nullptr, lit, 0, nullptr))); } diff --git a/src/smt/user_propagator.cpp b/src/smt/user_propagator.cpp index 3fd58ff4d..5769a34e5 100644 --- a/src/smt/user_propagator.cpp +++ b/src/smt/user_propagator.cpp @@ -129,14 +129,14 @@ void user_propagator::propagate() { if (m.is_false(prop.m_conseq)) { js = ctx.mk_justification( ext_theory_conflict_justification( - get_id(), ctx.get_region(), m_lits.size(), m_lits.c_ptr(), m_eqs.size(), m_eqs.c_ptr(), 0, nullptr)); + get_id(), ctx.get_region(), m_lits.size(), m_lits.data(), m_eqs.size(), m_eqs.data(), 0, nullptr)); ctx.set_conflict(js); } else { literal lit = mk_literal(prop.m_conseq); js = ctx.mk_justification( ext_theory_propagation_justification( - get_id(), ctx.get_region(), m_lits.size(), m_lits.c_ptr(), m_eqs.size(), m_eqs.c_ptr(), lit)); + get_id(), ctx.get_region(), m_lits.size(), m_lits.data(), m_eqs.size(), m_eqs.data(), lit)); ctx.assign(lit, js); } ++m_stats.m_num_propagations; diff --git a/src/solver/assertions/asserted_formulas.cpp b/src/solver/assertions/asserted_formulas.cpp index e0c7456b9..816ccb4e1 100644 --- a/src/solver/assertions/asserted_formulas.cpp +++ b/src/solver/assertions/asserted_formulas.cpp @@ -369,7 +369,7 @@ void asserted_formulas::swap_asserted_formulas(vector& formulas) void asserted_formulas::find_macros_core() { vector new_fmls; unsigned sz = m_formulas.size(); - (*m_macro_finder)(sz - m_qhead, m_formulas.c_ptr() + m_qhead, new_fmls); + (*m_macro_finder)(sz - m_qhead, m_formulas.data() + m_qhead, new_fmls); swap_asserted_formulas(new_fmls); reduce_and_solve(); } @@ -425,7 +425,7 @@ void asserted_formulas::apply_quasi_macros() { vector new_fmls; quasi_macros proc(m, m_macro_manager); while (proc(m_formulas.size() - m_qhead, - m_formulas.c_ptr() + m_qhead, + m_formulas.data() + m_qhead, new_fmls)) { swap_asserted_formulas(new_fmls); new_fmls.reset(); @@ -516,7 +516,7 @@ void asserted_formulas::commit() { } void asserted_formulas::commit(unsigned new_qhead) { - m_macro_manager.mark_forbidden(new_qhead - m_qhead, m_formulas.c_ptr() + m_qhead); + m_macro_manager.mark_forbidden(new_qhead - m_qhead, m_formulas.data() + m_qhead); m_expr2depth.reset(); for (unsigned i = m_qhead; i < new_qhead; ++i) { justified_expr const& j = m_formulas[i]; diff --git a/src/solver/check_sat_result.cpp b/src/solver/check_sat_result.cpp index 3c1d1665c..b772f21ae 100644 --- a/src/solver/check_sat_result.cpp +++ b/src/solver/check_sat_result.cpp @@ -52,7 +52,7 @@ void simple_check_sat_result::collect_statistics(statistics & st) const { void simple_check_sat_result::get_unsat_core(expr_ref_vector & r) { if (m_status == l_false) { r.reset(); - r.append(m_core.size(), m_core.c_ptr()); + r.append(m_core.size(), m_core.data()); } } diff --git a/src/solver/mus.cpp b/src/solver/mus.cpp index 4ae93a52e..bfb1d25c3 100644 --- a/src/solver/mus.cpp +++ b/src/solver/mus.cpp @@ -78,7 +78,7 @@ struct mus::imp { } lbool get_mus1(expr_ref_vector& mus) { - ptr_vector unknown(m_lit2expr.size(), m_lit2expr.c_ptr()); + ptr_vector unknown(m_lit2expr.size(), m_lit2expr.data()); expr_ref_vector core_exprs(m); TRACE("mus", m_solver.display(tout);); while (!unknown.empty()) { @@ -129,7 +129,7 @@ struct mus::imp { lbool get_mus2(expr_ref_vector& mus) { expr* lit = nullptr; lbool is_sat; - ptr_vector unknown(m_lit2expr.size(), m_lit2expr.c_ptr()); + ptr_vector unknown(m_lit2expr.size(), m_lit2expr.data()); while (!unknown.empty()) { IF_VERBOSE(12, verbose_stream() << "(mus reducing core: " << unknown.size() << " new core: " << mus.size() << ")\n";); { @@ -281,7 +281,7 @@ struct mus::imp { scoped_append(imp& imp, expr_ref_vector& fmls1, ptr_vector const& fmls2): m_fmls(fmls1), m_size(fmls1.size()) { - fmls1.append(fmls2.size(), fmls2.c_ptr()); + fmls1.append(fmls2.size(), fmls2.data()); } scoped_append(imp& imp, expr_ref_vector& fmls1, expr* fml): m_fmls(fmls1), diff --git a/src/solver/parallel_tactic.cpp b/src/solver/parallel_tactic.cpp index 95f5a6410..c0bf63b23 100644 --- a/src/solver/parallel_tactic.cpp +++ b/src/solver/parallel_tactic.cpp @@ -226,7 +226,7 @@ class parallel_tactic : public tactic { solver const& get_solver() const { return *m_solver; } void set_assumptions(ptr_vector const& asms) { - m_assumptions.append(asms.size(), asms.c_ptr()); + m_assumptions.append(asms.size(), asms.data()); } bool has_assumptions() const { return !m_assumptions.empty(); } diff --git a/src/solver/solver.h b/src/solver/solver.h index b324368b1..b65dc2fe8 100644 --- a/src/solver/solver.h +++ b/src/solver/solver.h @@ -158,9 +158,9 @@ public: lbool check_sat(unsigned num_assumptions, expr * const * assumptions); - lbool check_sat(expr_ref_vector const& asms) { return check_sat(asms.size(), asms.c_ptr()); } + lbool check_sat(expr_ref_vector const& asms) { return check_sat(asms.size(), asms.data()); } - lbool check_sat(app_ref_vector const& asms) { return check_sat(asms.size(), (expr* const*)asms.c_ptr()); } + lbool check_sat(app_ref_vector const& asms) { return check_sat(asms.size(), (expr* const*)asms.data()); } lbool check_sat() { return check_sat(0, nullptr); } @@ -171,7 +171,7 @@ public: assumed for the check. */ virtual lbool check_sat_cc(expr_ref_vector const& cube, vector const& clauses) { - if (clauses.empty()) return check_sat(cube.size(), cube.c_ptr()); + if (clauses.empty()) return check_sat(cube.size(), cube.data()); NOT_IMPLEMENTED_YET(); return l_undef; } diff --git a/src/solver/solver2tactic.cpp b/src/solver/solver2tactic.cpp index 498b4d545..8641a2aa8 100644 --- a/src/solver/solver2tactic.cpp +++ b/src/solver/solver2tactic.cpp @@ -71,7 +71,7 @@ void extract_clauses_and_dependencies(goal_ref const& g, expr_ref_vector& clause } SASSERT(clause.size() > 1); expr_ref cls(m); - cls = mk_or(m, clause.size(), clause.c_ptr()); + cls = mk_or(m, clause.size(), clause.data()); clauses.push_back(cls); } } @@ -110,7 +110,7 @@ public: TRACE("solver2tactic", tout << "clauses asserted\n";); lbool r; try { - r = local_solver->check_sat(assumptions.size(), assumptions.c_ptr()); + r = local_solver->check_sat(assumptions.size(), assumptions.data()); } catch (...) { local_solver->collect_statistics(m_st); diff --git a/src/solver/solver_na2as.cpp b/src/solver/solver_na2as.cpp index 845973dbf..4951f8833 100644 --- a/src/solver/solver_na2as.cpp +++ b/src/solver/solver_na2as.cpp @@ -64,17 +64,17 @@ 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);); - return check_sat_core2(m_assumptions.size(), m_assumptions.c_ptr()); + return check_sat_core2(m_assumptions.size(), m_assumptions.data()); } lbool solver_na2as::check_sat_cc(const expr_ref_vector &assumptions, vector const &clauses) { - if (clauses.empty()) return check_sat(assumptions.size(), assumptions.c_ptr()); - append_assumptions app(m_assumptions, assumptions.size(), assumptions.c_ptr()); + if (clauses.empty()) return check_sat(assumptions.size(), assumptions.data()); + append_assumptions app(m_assumptions, assumptions.size(), assumptions.data()); return check_sat_cc_core(m_assumptions, clauses); } lbool solver_na2as::get_consequences(expr_ref_vector const& asms, expr_ref_vector const& vars, expr_ref_vector& consequences) { - append_assumptions app(m_assumptions, asms.size(), asms.c_ptr()); + append_assumptions app(m_assumptions, asms.size(), asms.data()); return get_consequences_core(m_assumptions, vars, consequences); } diff --git a/src/solver/solver_pool.cpp b/src/solver/solver_pool.cpp index baaf17dc6..9e897208f 100644 --- a/src/solver/solver_pool.cpp +++ b/src/solver/solver_pool.cpp @@ -290,7 +290,7 @@ private: } out << "(set-info :status " << lbool2status(last_status) << ")\n"; - m_base->display(out, cube.size(), cube.c_ptr()); + m_base->display(out, cube.size(), cube.data()); for (auto const& clause : clauses) { out << ";; extra clause\n"; out << "(assert (or "; diff --git a/src/solver/tactic2solver.cpp b/src/solver/tactic2solver.cpp index 06cab4462..761c202cf 100644 --- a/src/solver/tactic2solver.cpp +++ b/src/solver/tactic2solver.cpp @@ -229,7 +229,7 @@ lbool tactic2solver::check_sat_core2(unsigned num_assumptions, expr * const * as if (m_produce_unsat_cores) { ptr_vector core_elems; m.linearize(core, core_elems); - m_result->m_core.append(core_elems.size(), core_elems.c_ptr()); + m_result->m_core.append(core_elems.size(), core_elems.data()); } m_tactic->cleanup(); return m_result->status(); diff --git a/src/tactic/aig/aig.cpp b/src/tactic/aig/aig.cpp index c17093f78..37027e63a 100644 --- a/src/tactic/aig/aig.cpp +++ b/src/tactic/aig/aig.cpp @@ -870,7 +870,7 @@ struct aig_manager::imp { add_child(left(t)); add_child(right(t)); } - expr * r = ast_mng.mk_not(ast_mng.mk_or(m_and_children.size(), m_and_children.c_ptr())); + 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";); } @@ -1059,7 +1059,7 @@ struct aig_manager::imp { } void reset_saved() { - m.dec_array_ref(m_saved.size(), m_saved.c_ptr()); + m.dec_array_ref(m_saved.size(), m_saved.data()); m_saved.finalize(); } @@ -1600,7 +1600,7 @@ public: } } } - unmark(queue.size(), queue.c_ptr()); + unmark(queue.size(), queue.data()); } void display_smt2_ref(std::ostream & out, aig_lit const & r) const { @@ -1635,9 +1635,9 @@ public: bool visited = true; for (unsigned i = 0; i < 2; i++) { aig_lit c = t->m_children[i]; - aig * c_ptr = c.ptr(); - if (!c_ptr->m_mark) { - todo.push_back(c_ptr); + aig * data = c.ptr(); + if (!data->m_mark) { + todo.push_back(data); visited = false; } } @@ -1656,7 +1656,7 @@ public: out << "(assert "; display_smt2_ref(out, r); out << ")\n"; - unmark(to_unmark.size(), to_unmark.c_ptr()); + unmark(to_unmark.size(), to_unmark.data()); } unsigned get_num_aigs() const { diff --git a/src/tactic/arith/bv2int_rewriter.h b/src/tactic/arith/bv2int_rewriter.h index 335404651..eb3c05790 100644 --- a/src/tactic/arith/bv2int_rewriter.h +++ b/src/tactic/arith/bv2int_rewriter.h @@ -40,7 +40,7 @@ public: void reset() { m_side_conditions.reset(); m_trail.reset(); m_power2.reset(); } void add_side_condition(expr* e) { m_side_conditions.push_back(e); } unsigned num_side_conditions() const { return m_side_conditions.size(); } - expr* const* side_conditions() const { return m_side_conditions.c_ptr(); } + expr* const* side_conditions() const { return m_side_conditions.data(); } unsigned get_max_num_bits() const { return m_max_size; } void collect_power2(goal const & s); diff --git a/src/tactic/arith/bv2real_rewriter.h b/src/tactic/arith/bv2real_rewriter.h index c17dbf0c7..7b3915105 100644 --- a/src/tactic/arith/bv2real_rewriter.h +++ b/src/tactic/arith/bv2real_rewriter.h @@ -110,7 +110,7 @@ public: void add_side_condition(expr* e) { m_side_conditions.push_back(e); } unsigned num_side_conditions() const { return m_side_conditions.size(); } - expr* const* side_conditions() const { return m_side_conditions.c_ptr(); } + expr* const* side_conditions() const { return m_side_conditions.data(); } bool is_zero(expr* e); diff --git a/src/tactic/arith/factor_tactic.cpp b/src/tactic/arith/factor_tactic.cpp index c32063f4f..7875aaf6d 100644 --- a/src/tactic/arith/factor_tactic.cpp +++ b/src/tactic/arith/factor_tactic.cpp @@ -63,7 +63,7 @@ class factor_tactic : public tactic { m_expr2poly.to_expr(fs[i], true, arg); args.push_back(arg); } - result = m.mk_eq(mk_mul(args.size(), args.c_ptr()), mk_zero_for(arg)); + result = m.mk_eq(mk_mul(args.size(), args.data()), mk_zero_for(arg)); } // p1^k1 * p2^k2 = 0 --> p1 = 0 or p2 = 0 @@ -77,7 +77,7 @@ class factor_tactic : public tactic { if (args.size() == 1) result = args[0]; else - result = m.mk_or(args.size(), args.c_ptr()); + result = m.mk_or(args.size(), args.data()); } decl_kind flip(decl_kind k) { @@ -106,7 +106,7 @@ class factor_tactic : public tactic { arg = m_util.mk_power(arg, m_util.mk_numeral(rational(2), m_util.is_int(arg))); args.push_back(arg); } - expr * lhs = mk_mul(args.size(), args.c_ptr()); + expr * lhs = mk_mul(args.size(), args.data()); result = m.mk_app(m_util.get_family_id(), k, lhs, mk_zero_for(lhs)); } @@ -155,15 +155,15 @@ class factor_tactic : public tactic { } } else { - args.push_back(m.mk_app(m_util.get_family_id(), k, mk_mul(odd_factors.size(), odd_factors.c_ptr()), mk_zero_for(odd_factors[0]))); + args.push_back(m.mk_app(m_util.get_family_id(), k, mk_mul(odd_factors.size(), odd_factors.data()), mk_zero_for(odd_factors[0]))); } SASSERT(!args.empty()); if (args.size() == 1) result = args[0]; else if (strict) - result = m.mk_and(args.size(), args.c_ptr()); + result = m.mk_and(args.size(), args.data()); else - result = m.mk_or(args.size(), args.c_ptr()); + result = m.mk_or(args.size(), args.data()); } br_status factor(func_decl * f, expr * lhs, expr * rhs, expr_ref & result) { diff --git a/src/tactic/arith/fm_tactic.cpp b/src/tactic/arith/fm_tactic.cpp index c57a4900c..44b771d53 100644 --- a/src/tactic/arith/fm_tactic.cpp +++ b/src/tactic/arith/fm_tactic.cpp @@ -162,16 +162,16 @@ class fm_tactic : public tactic { fm_model_converter(ast_manager & _m):m(_m) {} ~fm_model_converter() override { - m.dec_array_ref(m_xs.size(), m_xs.c_ptr()); + m.dec_array_ref(m_xs.size(), m_xs.data()); vector::iterator it = m_clauses.begin(); vector::iterator end = m_clauses.end(); for (; it != end; ++it) - m.dec_array_ref(it->size(), it->c_ptr()); + m.dec_array_ref(it->size(), it->data()); } void insert(func_decl * x, clauses & c) { m.inc_ref(x); - m.inc_array_ref(c.size(), c.c_ptr()); + m.inc_array_ref(c.size(), c.data()); m_xs.push_back(x); m_clauses.push_back(clauses()); m_clauses.back().swap(c); @@ -531,7 +531,7 @@ class fm_tactic : public tactic { } void reset_constraints() { - del_constraints(m_constraints.size(), m_constraints.c_ptr()); + del_constraints(m_constraints.size(), m_constraints.data()); m_constraints.reset(); } @@ -897,7 +897,7 @@ class fm_tactic : public tactic { if (c.m_num_vars == 1) lhs = ms[0]; else - lhs = m_util.mk_add(ms.size(), ms.c_ptr()); + lhs = m_util.mk_add(ms.size(), ms.data()); expr * rhs = m_util.mk_numeral(c.m_c, int_cnstr); if (c.m_strict) { ineq = m.mk_not(m_util.mk_ge(lhs, rhs)); @@ -927,7 +927,7 @@ class fm_tactic : public tactic { if (lits.size() == 1) return to_app(lits[0]); else - return m.mk_or(lits.size(), lits.c_ptr()); + return m.mk_or(lits.size(), lits.data()); } var mk_var(expr * t) { @@ -1060,7 +1060,7 @@ class fm_tactic : public tactic { if (!is_int(xs.back())) all_int = false; } - mk_int(as.size(), as.c_ptr(), c); + mk_int(as.size(), as.data(), c); if (all_int && strict) { strict = false; c--; @@ -1071,10 +1071,10 @@ 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";); constraint * new_c = mk_constraint(lits.size(), - lits.c_ptr(), + lits.data(), xs.size(), - xs.c_ptr(), - as.c_ptr(), + xs.data(), + as.data(), c, strict, dep); @@ -1428,10 +1428,10 @@ class fm_tactic : public tactic { } constraint * new_cnstr = mk_constraint(new_lits.size(), - new_lits.c_ptr(), + new_lits.data(), new_xs.size(), - new_xs.c_ptr(), - new_as.c_ptr(), + new_xs.data(), + new_as.data(), new_c, new_strict, new_dep); @@ -1488,7 +1488,7 @@ class fm_tactic : public tactic { 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";); - del_constraints(new_constraints.size(), new_constraints.c_ptr()); + del_constraints(new_constraints.size(), new_constraints.data()); return false; } constraint const & l_c = *(l[i]); diff --git a/src/tactic/arith/lia2card_tactic.cpp b/src/tactic/arith/lia2card_tactic.cpp index 7f333dc1b..ae0467039 100644 --- a/src/tactic/arith/lia2card_tactic.cpp +++ b/src/tactic/arith/lia2card_tactic.cpp @@ -57,7 +57,7 @@ class lia2card_tactic : public tactic { bool is_le(expr* x, expr* y, expr_ref& result) { if (is_pb(x, y, args, coeffs, coeff)) { - result = t.mk_le(coeffs.size(), coeffs.c_ptr(), args.c_ptr(), -coeff); + result = t.mk_le(coeffs.size(), coeffs.data(), args.data(), -coeff); return true; } else { @@ -77,7 +77,7 @@ class lia2card_tactic : public tactic { result = m.mk_not(result); } else if (m.is_eq(f) && is_pb(es[0], es[1], args, coeffs, coeff)) { - result = t.mk_eq(coeffs.size(), coeffs.c_ptr(), args.c_ptr(), -coeff); + result = t.mk_eq(coeffs.size(), coeffs.data(), args.data(), -coeff); } else { return BR_FAILED; @@ -158,7 +158,7 @@ public: m_mc->hide(v); last_v = v; } - expr* r = a.mk_add(xs.size(), xs.c_ptr()); + expr* r = a.mk_add(xs.size(), xs.data()); m_mc->add(x->get_decl(), r); return expr_ref(r, m); } @@ -329,7 +329,7 @@ public: if (!m.is_true(e)) { es.push_back(e); } - result = mk_and(m, es.size(), es.c_ptr()); + result = mk_and(m, es.size(), es.data()); if (!m.is_true(e)) { es.pop_back(); } diff --git a/src/tactic/arith/lia2pb_tactic.cpp b/src/tactic/arith/lia2pb_tactic.cpp index a94c0dab5..9af642e69 100644 --- a/src/tactic/arith/lia2pb_tactic.cpp +++ b/src/tactic/arith/lia2pb_tactic.cpp @@ -248,7 +248,7 @@ class lia2pb_tactic : public tactic { a *= rational(2); } SASSERT(def_args.size() > 1); - expr * def = m_util.mk_add(def_args.size(), def_args.c_ptr()); + expr * def = m_util.mk_add(def_args.size(), def_args.data()); expr_dependency * dep = nullptr; if (m_produce_unsat_cores) { dep = m.mk_join(m_bm.lower_dep(x), m_bm.upper_dep(x)); diff --git a/src/tactic/arith/linear_equation.cpp b/src/tactic/arith/linear_equation.cpp index 5db0a4cf9..5d9f821e6 100644 --- a/src/tactic/arith/linear_equation.cpp +++ b/src/tactic/arith/linear_equation.cpp @@ -80,7 +80,7 @@ linear_equation * linear_equation_manager::mk(unsigned sz, mpq * as, var * xs, b m_int_buffer.push_back(as[i].numerator()); } - linear_equation * new_eq = mk(sz, m_int_buffer.c_ptr(), xs, normalized); + linear_equation * new_eq = mk(sz, m_int_buffer.data(), xs, normalized); m.del(r); m.del(l); @@ -266,7 +266,7 @@ linear_equation * linear_equation_manager::mk(mpz const & b1, linear_equation co SASSERT(m_int_buffer.size() == m_var_buffer.size()); if (m_int_buffer.empty()) return nullptr; - return mk_core(m_int_buffer.size(), m_int_buffer.c_ptr(), m_var_buffer.c_ptr()); + return mk_core(m_int_buffer.size(), m_int_buffer.data(), m_var_buffer.data()); } void linear_equation_manager::del(linear_equation * eq) { diff --git a/src/tactic/arith/pb2bv_tactic.cpp b/src/tactic/arith/pb2bv_tactic.cpp index c0771e4b1..aeda016c7 100644 --- a/src/tactic/arith/pb2bv_tactic.cpp +++ b/src/tactic/arith/pb2bv_tactic.cpp @@ -293,7 +293,7 @@ private: switch (m_cls.size()) { case 0: m_result.push_back(m.mk_false()); break; case 1: m_result.push_back(m_cls[0]); break; - default: m_result.push_back(m.mk_or(m_cls.size(), m_cls.c_ptr())); + default: m_result.push_back(m.mk_or(m_cls.size(), m_cls.data())); } return; } @@ -311,7 +311,7 @@ private: init_sums(m_p); init_lits(m_p); process(0, m_c); - m_owner.m_b_rw.mk_and(m_result.size(), m_result.c_ptr(), r); + m_owner.m_b_rw.mk_and(m_result.size(), m_result.data(), r); } }; @@ -380,7 +380,7 @@ private: for (unsigned i = 0; i < m_p.size(); i++) { args.push_back(mon_lit2lit(m_p[i])); } - r = m.mk_or(args.size(), args.c_ptr()); + r = m.mk_or(args.size(), args.data()); return; } @@ -389,7 +389,7 @@ private: for (unsigned i = 0; i < m_p.size(); i++) { args.push_back(mon_lit2lit(m_p[i])); } - m_b_rw.mk_and(args.size(), args.c_ptr(), r); + m_b_rw.mk_and(args.size(), args.data(), r); return; } @@ -468,7 +468,7 @@ private: lhs_args.push_back(bv_monom); } - expr * lhs = m.mk_app(m_bv_util.get_family_id(), OP_BADD, lhs_args.size(), lhs_args.c_ptr()); + expr * lhs = m.mk_app(m_bv_util.get_family_id(), OP_BADD, lhs_args.size(), lhs_args.data()); expr * rhs = m_bv_util.mk_numeral(m_c, bits); r = m_bv_util.mk_ule(rhs, lhs); @@ -808,7 +808,7 @@ private: app * y_i = to_app(m_p[i+1].m_lit.var()); eqs.push_back(m.mk_eq(int2lit(x_i), int2lit(y_i))); } - m_b_rw.mk_and(eqs.size(), eqs.c_ptr(), r); + m_b_rw.mk_and(eqs.size(), eqs.data(), r); if (!pos) m_b_rw.mk_not(r, r); return; diff --git a/src/tactic/arith/propagate_ineqs_tactic.cpp b/src/tactic/arith/propagate_ineqs_tactic.cpp index 4afcfb609..f4169cfba 100644 --- a/src/tactic/arith/propagate_ineqs_tactic.cpp +++ b/src/tactic/arith/propagate_ineqs_tactic.cpp @@ -166,7 +166,7 @@ struct propagate_ineqs_tactic::imp { expr2linear_pol(t, m_num_buffer, m_var_buffer); m_num_buffer.push_back(mpq(-1)); m_var_buffer.push_back(x); - bp.mk_eq(m_num_buffer.size(), m_num_buffer.c_ptr(), m_var_buffer.c_ptr()); + bp.mk_eq(m_num_buffer.size(), m_num_buffer.data(), m_var_buffer.data()); } return x; } @@ -278,7 +278,7 @@ struct propagate_ineqs_tactic::imp { mpq implied_k; bool implied_strict; bool result = - bp.lower(m_var_buffer.size(), m_num_buffer.c_ptr(), m_var_buffer.c_ptr(), implied_k, implied_strict) && + bp.lower(m_var_buffer.size(), m_num_buffer.data(), m_var_buffer.data(), implied_k, implied_strict) && (nm.gt(implied_k, k) || (nm.eq(implied_k, k) && (!strict || implied_strict))); nm.del(implied_k); return result; @@ -293,7 +293,7 @@ struct propagate_ineqs_tactic::imp { mpq implied_k; bool implied_strict; bool result = - bp.upper(m_var_buffer.size(), m_num_buffer.c_ptr(), m_var_buffer.c_ptr(), implied_k, implied_strict) && + bp.upper(m_var_buffer.size(), m_num_buffer.data(), m_var_buffer.data(), implied_k, implied_strict) && (nm.lt(implied_k, k) || (nm.eq(implied_k, k) && (!strict || implied_strict))); nm.del(implied_k); return result; diff --git a/src/tactic/arith/purify_arith_tactic.cpp b/src/tactic/arith/purify_arith_tactic.cpp index 275acbd18..1691fe29a 100644 --- a/src/tactic/arith/purify_arith_tactic.cpp +++ b/src/tactic/arith/purify_arith_tactic.cpp @@ -540,7 +540,7 @@ struct purify_arith_proc { } } SASSERT(args.size() >= 2); - push_cnstr(EQ(u().mk_add(args.size(), args.c_ptr()), mk_real_zero())); + push_cnstr(EQ(u().mk_add(args.size(), args.data()), mk_real_zero())); push_cnstr_pr(result_pr); push_cnstr(u().mk_lt(u().mk_numeral(lower, false), k)); push_cnstr_pr(result_pr); diff --git a/src/tactic/arith/recover_01_tactic.cpp b/src/tactic/arith/recover_01_tactic.cpp index 122a376b4..a50e6fef3 100644 --- a/src/tactic/arith/recover_01_tactic.cpp +++ b/src/tactic/arith/recover_01_tactic.cpp @@ -281,7 +281,7 @@ class recover_01_tactic : public tactic { if (def_args.size() == 1) x_def = def_args[0]; else - x_def = m_util.mk_add(def_args.size(), def_args.c_ptr()); + x_def = m_util.mk_add(def_args.size(), def_args.data()); TRACE("recover_01", tout << x->get_name() << " --> " << mk_ismt2_pp(x_def, m) << "\n";); subst->insert(m.mk_const(x), x_def); diff --git a/src/tactic/bv/bit_blaster_model_converter.cpp b/src/tactic/bv/bit_blaster_model_converter.cpp index e49b7f003..c389e6df4 100644 --- a/src/tactic/bv/bit_blaster_model_converter.cpp +++ b/src/tactic/bv/bit_blaster_model_converter.cpp @@ -159,11 +159,11 @@ struct bit_blaster_model_converter : public model_converter { if (TO_BOOL) { SASSERT(is_app_of(bs, m().get_family_id("bv"), OP_MKBV)); - result = util.mk_bv(bv_sz, args.c_ptr()); + result = util.mk_bv(bv_sz, args.data()); } else { SASSERT(is_app_of(bs, m().get_family_id("bv"), OP_CONCAT)); - result = util.mk_concat(bv_sz, args.c_ptr()); + result = util.mk_concat(bv_sz, args.data()); } return result; } diff --git a/src/tactic/bv/bv1_blaster_tactic.cpp b/src/tactic/bv/bv1_blaster_tactic.cpp index bc33b9f76..9fd077599 100644 --- a/src/tactic/bv/bv1_blaster_tactic.cpp +++ b/src/tactic/bv/bv1_blaster_tactic.cpp @@ -109,7 +109,7 @@ class bv1_blaster_tactic : public tactic { bits.push_back(m().mk_fresh_const(nullptr, b)); m_newbits.push_back(to_app(bits.back())->get_decl()); } - r = butil().mk_concat(bits.size(), bits.c_ptr()); + r = butil().mk_concat(bits.size(), bits.data()); m_saved.push_back(r); m_const2bits.insert(f, r); result = r; @@ -127,7 +127,7 @@ class bv1_blaster_tactic : public tactic { --i; bits.push_back(butil().mk_extract(i, i, t)); } - result = butil().mk_concat(bits.size(), bits.c_ptr()); + result = butil().mk_concat(bits.size(), bits.data()); } void reduce_eq(expr * arg1, expr * arg2, expr_ref & result) { @@ -142,7 +142,7 @@ class bv1_blaster_tactic : public tactic { --i; new_eqs.push_back(m().mk_eq(bits1[i], bits2[i])); } - result = mk_and(m(), new_eqs.size(), new_eqs.c_ptr()); + result = mk_and(m(), new_eqs.size(), new_eqs.data()); } void reduce_ite(expr * c, expr * t, expr * e, expr_ref & result) { @@ -155,7 +155,7 @@ class bv1_blaster_tactic : public tactic { unsigned num = t_bits.size(); for (unsigned i = 0; i < num; i++) new_ites.push_back(t_bits[i] == e_bits[i] ? t_bits[i] : m().mk_ite(c, t_bits[i], e_bits[i])); - result = butil().mk_concat(new_ites.size(), new_ites.c_ptr()); + result = butil().mk_concat(new_ites.size(), new_ites.data()); } void reduce_num(func_decl * f, expr_ref & result) { @@ -174,7 +174,7 @@ class bv1_blaster_tactic : public tactic { v = div(v, two); } std::reverse(bits.begin(), bits.end()); - result = butil().mk_concat(bits.size(), bits.c_ptr()); + result = butil().mk_concat(bits.size(), bits.data()); } void reduce_extract(func_decl * f, expr * arg, expr_ref & result) { @@ -190,7 +190,7 @@ class bv1_blaster_tactic : public tactic { for (unsigned i = start; i <= end; i++) { bits.push_back(arg_bits[i]); } - result = butil().mk_concat(bits.size(), bits.c_ptr()); + result = butil().mk_concat(bits.size(), bits.data()); } void reduce_concat(unsigned num, expr * const * args, expr_ref & result) { @@ -200,9 +200,9 @@ class bv1_blaster_tactic : public tactic { expr * arg = args[i]; arg_bits.reset(); get_bits(arg, arg_bits); - bits.append(arg_bits.size(), arg_bits.c_ptr()); + bits.append(arg_bits.size(), arg_bits.data()); } - result = butil().mk_concat(bits.size(), bits.c_ptr()); + result = butil().mk_concat(bits.size(), bits.data()); } void reduce_bin_xor(expr * arg1, expr * arg2, expr_ref & result) { @@ -216,7 +216,7 @@ class bv1_blaster_tactic : public tactic { for (unsigned i = 0; i < num; i++) { new_bits.push_back(m().mk_ite(m().mk_eq(bits1[i], bits2[i]), m_bit0, m_bit1)); } - result = butil().mk_concat(new_bits.size(), new_bits.c_ptr()); + result = butil().mk_concat(new_bits.size(), new_bits.data()); } void reduce_xor(unsigned num_args, expr * const * args, expr_ref & result) { diff --git a/src/tactic/bv/bvarray2uf_rewriter.cpp b/src/tactic/bv/bvarray2uf_rewriter.cpp index 05e895a4c..7a065c44d 100644 --- a/src/tactic/bv/bvarray2uf_rewriter.cpp +++ b/src/tactic/bv/bvarray2uf_rewriter.cpp @@ -296,7 +296,7 @@ br_status bvarray2uf_rewriter_cfg::reduce_app(func_decl * f, unsigned num, expr expr_ref body(m_manager); body = m_manager.mk_eq(m_manager.mk_app(f_t, x.get()), - m_manager.mk_app(map_f, num, new_args.c_ptr())); + m_manager.mk_app(map_f, num, new_args.data())); expr_ref frllx(m_manager.mk_forall(1, sorts, names, body), m_manager); extra_assertions.push_back(frllx); diff --git a/src/tactic/bv/elim_small_bv_tactic.cpp b/src/tactic/bv/elim_small_bv_tactic.cpp index f2e668a31..178a8fc77 100644 --- a/src/tactic/bv/elim_small_bv_tactic.cpp +++ b/src/tactic/bv/elim_small_bv_tactic.cpp @@ -84,7 +84,7 @@ class elim_small_bv_tactic : public tactic { // (VAR num_decls) ... (VAR num_decls+sz-1); are in positions num_decls .. num_decls+sz-1 - std::reverse(substitution.c_ptr(), substitution.c_ptr() + substitution.size()); + std::reverse(substitution.data(), substitution.data() + substitution.size()); // (VAR 0) should be in the last position of substitution. @@ -98,7 +98,7 @@ class elim_small_bv_tactic : public tactic { }); var_subst vsbst(m); - res = vsbst(e, substitution.size(), substitution.c_ptr()); + res = vsbst(e, substitution.size(), substitution.data()); SASSERT(is_well_sorted(m, res)); proof_ref pr(m); @@ -171,8 +171,8 @@ class elim_small_bv_tactic : public tactic { for (unsigned k = 0; k < new_bodies.size(); k++) tout << mk_ismt2_pp(new_bodies[k].get(), m) << std::endl; ); - body = is_forall(q) ? m.mk_and(new_bodies.size(), new_bodies.c_ptr()) : - m.mk_or(new_bodies.size(), new_bodies.c_ptr()); + body = is_forall(q) ? m.mk_and(new_bodies.size(), new_bodies.data()) : + m.mk_or(new_bodies.size(), new_bodies.data()); SASSERT(is_well_sorted(m, body)); proof_ref pr(m); diff --git a/src/tactic/converter.h b/src/tactic/converter.h index 1731689a5..3146058bb 100644 --- a/src/tactic/converter.h +++ b/src/tactic/converter.h @@ -86,7 +86,7 @@ protected: ptr_buffer t2s; for (T* c : m_c2s) t2s.push_back(c ? c->translate(translator) : nullptr); - return alloc(T2, t1, m_c2s.size(), t2s.c_ptr(), m_szs.c_ptr()); + return alloc(T2, t1, m_c2s.size(), t2s.data(), m_szs.data()); } public: diff --git a/src/tactic/core/blast_term_ite_tactic.cpp b/src/tactic/core/blast_term_ite_tactic.cpp index bdc146079..97662a0c9 100644 --- a/src/tactic/core/blast_term_ite_tactic.cpp +++ b/src/tactic/core/blast_term_ite_tactic.cpp @@ -80,14 +80,14 @@ class blast_term_ite_tactic : public tactic { expr_ref e1(m), e2(m); ptr_vector args1(num_args, args); args1[i] = t; - e1 = m.mk_app(f, num_args, args1.c_ptr()); + e1 = m.mk_app(f, num_args, args1.data()); if (m.are_equal(t, e)) { result = e1; return BR_REWRITE1; } else { args1[i] = e; - e2 = m.mk_app(f, num_args, args1.c_ptr()); + e2 = m.mk_app(f, num_args, args1.data()); result = m.mk_ite(c, e1, e2); ++m_num_fresh; return BR_REWRITE3; diff --git a/src/tactic/core/cofactor_elim_term_ite.cpp b/src/tactic/core/cofactor_elim_term_ite.cpp index 2d9aafbda..eda079e46 100644 --- a/src/tactic/core/cofactor_elim_term_ite.cpp +++ b/src/tactic/core/cofactor_elim_term_ite.cpp @@ -617,7 +617,7 @@ struct cofactor_elim_term_ite::imp { has_term_ite = true; expr_ref new_t(m); if (has_new_args) - new_t = m.mk_app(to_app(t)->get_decl(), num, new_args.c_ptr()); + new_t = m.mk_app(to_app(t)->get_decl(), num, new_args.data()); else new_t = t; if (has_term_ite && is_atom(new_t)) { diff --git a/src/tactic/core/ctx_simplify_tactic.cpp b/src/tactic/core/ctx_simplify_tactic.cpp index 5b1a30af9..c8aa1a4c4 100644 --- a/src/tactic/core/ctx_simplify_tactic.cpp +++ b/src/tactic/core/ctx_simplify_tactic.cpp @@ -420,8 +420,8 @@ struct ctx_simplify_tactic::imp { r = new_new_args[0]; } else { - std::reverse(new_new_args.c_ptr(), new_new_args.c_ptr() + new_new_args.size()); - m_mk_app(t->get_decl(), new_new_args.size(), new_new_args.c_ptr(), r); + std::reverse(new_new_args.data(), new_new_args.data() + new_new_args.size()); + m_mk_app(t->get_decl(), new_new_args.size(), new_new_args.data(), r); } cache(t, r); } @@ -495,7 +495,7 @@ struct ctx_simplify_tactic::imp { r = t; } else { - m_mk_app(t->get_decl(), new_args.size(), new_args.c_ptr(), r); + m_mk_app(t->get_decl(), new_args.size(), new_args.data(), r); } } diff --git a/src/tactic/core/distribute_forall_tactic.cpp b/src/tactic/core/distribute_forall_tactic.cpp index cbf1b019b..cb7eac498 100644 --- a/src/tactic/core/distribute_forall_tactic.cpp +++ b/src/tactic/core/distribute_forall_tactic.cpp @@ -52,7 +52,7 @@ class distribute_forall_tactic : public tactic { tmp_q = m.update_quantifier(old_q, not_arg); new_args.push_back(elim_unused_vars(m, tmp_q, params_ref())); } - result = m.mk_and(new_args.size(), new_args.c_ptr()); + result = m.mk_and(new_args.size(), new_args.data()); if (m.proofs_enabled()) { result_pr = m.mk_push_quant(old_q, result); } @@ -73,7 +73,7 @@ class distribute_forall_tactic : public tactic { tmp_q = m.update_quantifier(old_q, arg); new_args.push_back(elim_unused_vars(m, tmp_q, params_ref())); } - result = m.mk_and(new_args.size(), new_args.c_ptr()); + result = m.mk_and(new_args.size(), new_args.data()); if (m.proofs_enabled()) { result_pr = m.mk_push_quant(old_q, result); } diff --git a/src/tactic/core/dom_simplify_tactic.cpp b/src/tactic/core/dom_simplify_tactic.cpp index f8bd98fa5..719de8911 100644 --- a/src/tactic/core/dom_simplify_tactic.cpp +++ b/src/tactic/core/dom_simplify_tactic.cpp @@ -290,7 +290,7 @@ expr_ref dom_simplify_tactic::simplify_rec(expr * e0) { // for fn applications. m_args.push_back(m.is_bool(arg) ? arg : simplify_arg(arg)); } - r = m.mk_app(to_app(e)->get_decl(), m_args.size(), m_args.c_ptr()); + r = m.mk_app(to_app(e)->get_decl(), m_args.size(), m_args.data()); } else { r = e; diff --git a/src/tactic/core/elim_uncnstr_tactic.cpp b/src/tactic/core/elim_uncnstr_tactic.cpp index 35e3e6cc4..f5756bfd4 100644 --- a/src/tactic/core/elim_uncnstr_tactic.cpp +++ b/src/tactic/core/elim_uncnstr_tactic.cpp @@ -161,12 +161,12 @@ class elim_uncnstr_tactic : public tactic { for (unsigned i = 0; i < arity; i++) new_args.push_back(m().get_some_value(get_array_domain(s, i))); expr_ref sel(m()); - sel = m().mk_app(fid, OP_SELECT, new_args.size(), new_args.c_ptr()); + sel = m().mk_app(fid, OP_SELECT, new_args.size(), new_args.data()); expr_ref diff_sel(m()); if (!mk_diff(sel, diff_sel)) return false; new_args.push_back(diff_sel); - r = m().mk_app(fid, OP_STORE, new_args.size(), new_args.c_ptr()); + r = m().mk_app(fid, OP_STORE, new_args.size(), new_args.data()); return true; } if (fid == m_dt_util.get_family_id()) { @@ -197,7 +197,7 @@ class elim_uncnstr_tactic : public tactic { new_args.push_back(m().get_some_value(constructor->get_domain(i))); } } - r = m().mk_app(constructor, new_args.size(), new_args.c_ptr()); + r = m().mk_app(constructor, new_args.size(), new_args.data()); return true; } // TODO: handle more cases. @@ -396,7 +396,7 @@ class elim_uncnstr_tactic : public tactic { if (new_args.size() == 1) rest = new_args[0]; else - rest = m().mk_app(fid, add_k, new_args.size(), new_args.c_ptr()); + rest = m().mk_app(fid, add_k, new_args.size(), new_args.data()); add_def(v, m().mk_app(fid, sub_k, u, rest)); } return u; @@ -503,7 +503,7 @@ class elim_uncnstr_tactic : public tactic { args.push_back(r); if (low > 0) args.push_back(m_bv_util.mk_numeral(rational(0), low)); - add_def(arg, m_bv_util.mk_concat(args.size(), args.c_ptr())); + add_def(arg, m_bv_util.mk_concat(args.size(), args.data())); } return r; } @@ -698,7 +698,7 @@ class elim_uncnstr_tactic : public tactic { else new_args.push_back(m().get_some_value(c->get_domain(i))); } - add_def(args[0], m().mk_app(c, new_args.size(), new_args.c_ptr())); + add_def(args[0], m().mk_app(c, new_args.size(), new_args.data())); return u; } } diff --git a/src/tactic/core/occf_tactic.cpp b/src/tactic/core/occf_tactic.cpp index 2deef831f..b1f9d3f93 100644 --- a/src/tactic/core/occf_tactic.cpp +++ b/src/tactic/core/occf_tactic.cpp @@ -175,7 +175,7 @@ class occf_tactic : public tactic { } if (keep != nullptr) new_lits.push_back(keep); - g->update(i, m.mk_or(new_lits.size(), new_lits.c_ptr()), nullptr, d); + g->update(i, m.mk_or(new_lits.size(), new_lits.data()), nullptr, d); } g->inc_depth(); result.push_back(g.get()); diff --git a/src/tactic/core/pb_preprocess_tactic.cpp b/src/tactic/core/pb_preprocess_tactic.cpp index 90c6cb217..87f10dfc2 100644 --- a/src/tactic/core/pb_preprocess_tactic.cpp +++ b/src/tactic/core/pb_preprocess_tactic.cpp @@ -256,7 +256,7 @@ private: coeffs.push_back(pb.get_coeff(r, j)); args.push_back(negate(to_app(r)->get_arg(j))); } - tmp = pb.mk_ge(args.size(), coeffs.c_ptr(), args.c_ptr(), sum - k + rational::one()); + tmp = pb.mk_ge(args.size(), coeffs.data(), args.data(), sum - k + rational::one()); g->update(i, tmp, g->pr(i), g->dep(i)); } } @@ -293,7 +293,7 @@ private: start = end; TRACE("pb", tout << fml1 << "\n";); } - fml2 = pb.mk_ge(cut_args.size(), cut_coeffs.c_ptr(), cut_args.c_ptr(), pb.get_k(e)); + 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";); } @@ -350,7 +350,7 @@ private: cut_args.push_back(z); j <<= 1; } - fml1 = pb.mk_ge(args.size(), coeffs.c_ptr(), args.c_ptr(), rational(0)); + fml1 = pb.mk_ge(args.size(), coeffs.data(), args.data(), rational(0)); m_r(fml1, fml); return fml; } @@ -519,7 +519,7 @@ private: set_value(mc, arg, j != min_index); } - tmp1 = pb.mk_ge(args2.size(), coeffs2.c_ptr(), args2.c_ptr(), k2); + tmp1 = pb.mk_ge(args2.size(), coeffs2.data(), args2.data(), k2); IF_VERBOSE(3, verbose_stream() << " " << tmp1 << "\n"; for (unsigned i = 0; i < args2.size(); ++i) { verbose_stream() << mk_pp(args2[i].get(), m) << " "; diff --git a/src/tactic/core/reduce_args_tactic.cpp b/src/tactic/core/reduce_args_tactic.cpp index a5535e039..f6ea1b09b 100644 --- a/src/tactic/core/reduce_args_tactic.cpp +++ b/src/tactic/core/reduce_args_tactic.cpp @@ -372,7 +372,7 @@ struct reduce_args_tactic::imp { if (!bv.get(i)) domain.push_back(f->get_domain(i)); } - new_f = m.mk_fresh_func_decl(f->get_name(), symbol::null, domain.size(), domain.c_ptr(), f->get_range()); + new_f = m.mk_fresh_func_decl(f->get_name(), symbol::null, domain.size(), domain.data(), f->get_range()); m.inc_ref(tmp); m.inc_ref(new_f); } @@ -382,7 +382,7 @@ struct reduce_args_tactic::imp { if (!bv.get(i)) new_args.push_back(args[i]); } - result = m.mk_app(new_f, new_args.size(), new_args.c_ptr()); + result = m.mk_app(new_f, new_args.size(), new_args.data()); return BR_DONE; } }; @@ -421,7 +421,7 @@ struct reduce_args_tactic::imp { func_decl * new_def = it2->m_value; f_mc->hide(new_def); SASSERT(new_def->get_arity() == new_args.size()); - app * new_t = m_manager.mk_app(new_def, new_args.size(), new_args.c_ptr()); + app * new_t = m_manager.mk_app(new_def, new_args.size(), new_args.data()); if (def == nullptr) { def = new_t; } @@ -436,7 +436,7 @@ struct reduce_args_tactic::imp { if (new_eqs.size() == 1) cond = new_eqs[0]; else - cond = m_manager.mk_and(new_eqs.size(), new_eqs.c_ptr()); + cond = m_manager.mk_and(new_eqs.size(), new_eqs.data()); def = m_manager.mk_ite(cond, new_t, def); } } diff --git a/src/tactic/core/reduce_invertible_tactic.cpp b/src/tactic/core/reduce_invertible_tactic.cpp index cfee5bde7..85062b03b 100644 --- a/src/tactic/core/reduce_invertible_tactic.cpp +++ b/src/tactic/core/reduce_invertible_tactic.cpp @@ -490,7 +490,7 @@ private: } if (has_new_var) { sub(new_body, result); - result = m.mk_quantifier(old_q->get_kind(), new_sorts.size(), new_sorts.c_ptr(), old_q->get_decl_names(), result, old_q->get_weight()); + result = m.mk_quantifier(old_q->get_kind(), new_sorts.size(), new_sorts.data(), old_q->get_decl_names(), result, old_q->get_weight()); result_pr = nullptr; return true; } diff --git a/src/tactic/core/solve_eqs_tactic.cpp b/src/tactic/core/solve_eqs_tactic.cpp index 6dced5b7b..5196b1df1 100644 --- a/src/tactic/core/solve_eqs_tactic.cpp +++ b/src/tactic/core/solve_eqs_tactic.cpp @@ -230,7 +230,7 @@ class solve_eqs_tactic : public tactic { for (unsigned k = 0; k < n; ++k) { if (k != j) args.push_back(arg->get_arg(k)); } - div = m_a_util.mk_mul(args.size(), args.c_ptr()); + div = m_a_util.mk_mul(args.size(), args.data()); return true; } return false; @@ -248,7 +248,7 @@ class solve_eqs_tactic : public tactic { for (unsigned k = 0; k < num; ++k) { if (k != i) args.push_back(lhs->get_arg(k)); } - def = m_a_util.mk_sub(rhs, m_a_util.mk_add(args.size(), args.c_ptr())); + def = m_a_util.mk_sub(rhs, m_a_util.mk_add(args.size(), args.data())); def = m_a_util.mk_div(def, div); if (m_produce_proofs) pr = m().mk_rewrite(eq, m().mk_eq(var, def)); @@ -311,7 +311,7 @@ class solve_eqs_tactic : public tactic { def = m_a_util.mk_sub(rhs, other_args[0]); break; default: - def = m_a_util.mk_sub(rhs, m_a_util.mk_add(other_args.size(), other_args.c_ptr())); + def = m_a_util.mk_sub(rhs, m_a_util.mk_add(other_args.size(), other_args.data())); break; } if (m_produce_proofs) diff --git a/src/tactic/core/split_clause_tactic.cpp b/src/tactic/core/split_clause_tactic.cpp index 620a80e97..453e4a218 100644 --- a/src/tactic/core/split_clause_tactic.cpp +++ b/src/tactic/core/split_clause_tactic.cpp @@ -67,7 +67,7 @@ class split_clause_tactic : public tactic { expr * not_li = m.mk_not(m_clause->get_arg(i)); prs.push_back(m.mk_lemma(pr_i, not_li)); } - return proof_ref(m.mk_unit_resolution(prs.size(), prs.c_ptr()), m); + return proof_ref(m.mk_unit_resolution(prs.size(), prs.data()), m); } proof_converter * translate(ast_translation & translator) override { @@ -124,8 +124,8 @@ public: subgoal_i->inc_depth(); result.push_back(subgoal_i); } - in->set(concat(in->pc(), result.size(), result.c_ptr())); - in->add(dependency_converter::concat(result.size(), result.c_ptr())); + in->set(concat(in->pc(), result.size(), result.data())); + in->add(dependency_converter::concat(result.size(), result.data())); } void cleanup() override { diff --git a/src/tactic/core/symmetry_reduce_tactic.cpp b/src/tactic/core/symmetry_reduce_tactic.cpp index 6f215e922..9823be26d 100644 --- a/src/tactic/core/symmetry_reduce_tactic.cpp +++ b/src/tactic/core/symmetry_reduce_tactic.cpp @@ -164,7 +164,7 @@ private: for (unsigned i = 0; i < g.size(); ++i) { conjs.push_back(g.form(i)); } - fml = m().mk_and(conjs.size(), conjs.c_ptr()); + fml = m().mk_and(conjs.size(), conjs.data()); normalize(fml); } @@ -613,7 +613,7 @@ private: for (unsigned i = 0; i < C.size(); ++i) { eqs.push_back(m().mk_eq(t, C[i])); } - return m().mk_or(eqs.size(), eqs.c_ptr()); + return m().mk_or(eqs.size(), eqs.data()); } }; diff --git a/src/tactic/core/tseitin_cnf_tactic.cpp b/src/tactic/core/tseitin_cnf_tactic.cpp index add9868eb..b466c50fb 100644 --- a/src/tactic/core/tseitin_cnf_tactic.cpp +++ b/src/tactic/core/tseitin_cnf_tactic.cpp @@ -495,7 +495,7 @@ class tseitin_cnf_tactic : public tactic { inv(lb, nlb); mk_clause(la, nlb); } - mk_clause(lits.size(), lits.c_ptr()); + mk_clause(lits.size(), lits.data()); return DONE; } @@ -575,13 +575,13 @@ class tseitin_cnf_tactic : public tactic { #define MK_ITE_ROOT_CLS(L1, L2) { \ ctx.push_back(L1); ctx.push_back(L2); \ - mk_clause(ctx.size(), ctx.c_ptr()); \ + mk_clause(ctx.size(), ctx.data()); \ ctx.pop_back(); ctx.pop_back(); \ } #define MK_ITE_CLS(L1, L2, L3) { \ ctx.push_back(L1); ctx.push_back(L2); ctx.push_back(L3); \ - mk_clause(ctx.size(), ctx.c_ptr()); \ + mk_clause(ctx.size(), ctx.data()); \ ctx.pop_back(); ctx.pop_back(); ctx.pop_back(); \ } @@ -643,9 +643,9 @@ class tseitin_cnf_tactic : public tactic { MK_ITE_CLS(nlb, nlc, k); ex_neg_ctx.push_back(lb); ex_neg_ctx.push_back(lc); ex_neg_ctx.push_back(nk); - mk_clause(ex_neg_ctx.size(), ex_neg_ctx.c_ptr()); + mk_clause(ex_neg_ctx.size(), ex_neg_ctx.data()); ex_pos_ctx.push_back(nlb); ex_pos_ctx.push_back(nlc); ex_pos_ctx.push_back(k); - mk_clause(ex_pos_ctx.size(), ex_pos_ctx.c_ptr()); + mk_clause(ex_pos_ctx.size(), ex_pos_ctx.data()); } } break; @@ -707,7 +707,7 @@ class tseitin_cnf_tactic : public tactic { lits.push_back(l); } if (root) { - mk_clause(lits.size(), lits.c_ptr()); + mk_clause(lits.size(), lits.data()); } else { for (unsigned i = 0; i < num; i++) { @@ -715,7 +715,7 @@ class tseitin_cnf_tactic : public tactic { mk_clause(l, k); } lits.push_back(nk); - mk_clause(lits.size(), lits.c_ptr()); + mk_clause(lits.size(), lits.data()); } } else { @@ -745,7 +745,7 @@ class tseitin_cnf_tactic : public tactic { } if (!root) { lits.push_back(k); - mk_clause(lits.size(), lits.c_ptr()); + mk_clause(lits.size(), lits.data()); } continue; } @@ -761,7 +761,7 @@ class tseitin_cnf_tactic : public tactic { SASSERT(offsets.size() == num); sbuffer arg_lits; ptr_buffer lits; - expr ** buffer_ptr = buffer.c_ptr(); + expr ** buffer_ptr = buffer.data(); for (unsigned i = 0; i < num; i++) { arg_lits.push_back(buffer_ptr + offsets[i]); } @@ -772,9 +772,9 @@ class tseitin_cnf_tactic : public tactic { } if (!root) lits.push_back(nk); - mk_clause(lits.size(), lits.c_ptr()); + mk_clause(lits.size(), lits.data()); } - while (product_iterator_next(szs.size(), szs.c_ptr(), it.c_ptr())); + while (product_iterator_next(szs.size(), szs.data(), it.data())); } return DONE; } diff --git a/src/tactic/dependency_converter.cpp b/src/tactic/dependency_converter.cpp index dcd50717b..0047cdbc4 100644 --- a/src/tactic/dependency_converter.cpp +++ b/src/tactic/dependency_converter.cpp @@ -84,7 +84,7 @@ public: dependency_converter * translate(ast_translation & translator) override { goal_ref_buffer goals; for (goal_ref g : m_goals) goals.push_back(g->translate(translator)); - return alloc(goal_dependency_converter, goals.size(), goals.c_ptr()); + return alloc(goal_dependency_converter, goals.size(), goals.data()); } void display(std::ostream& out) override { out << "goal-dep\n"; } diff --git a/src/tactic/fd_solver/smtfd_solver.cpp b/src/tactic/fd_solver/smtfd_solver.cpp index 8e91c2c9f..4ebb07898 100644 --- a/src/tactic/fd_solver/smtfd_solver.cpp +++ b/src/tactic/fd_solver/smtfd_solver.cpp @@ -317,13 +317,13 @@ namespace smtfd { r = m.mk_eq(m_args.get(0), m_args.get(1)); } else if (m.is_distinct(a)) { - r = m.mk_distinct(m_args.size(), m_args.c_ptr()); + r = m.mk_distinct(m_args.size(), m_args.data()); } else if (m.is_ite(a)) { r = m.mk_ite(m_args.get(0), m_args.get(1), m_args.get(2)); } else if (bvfid == fid || bfid == fid || pbfid == fid) { - r = m.mk_app(a->get_decl(), m_args.size(), m_args.c_ptr()); + r = m.mk_app(a->get_decl(), m_args.size(), m_args.data()); } else if (is_uninterp_const(t) && m.is_bool(t)) { r = t; @@ -697,7 +697,7 @@ namespace smtfd { } unsigned f_app_hash::operator()(f_app const& a) const { - return get_composite_hash(p.values().c_ptr() + a.m_val_offset, a.m_t->get_num_args(), *this, *this); + return get_composite_hash(p.values().data() + a.m_val_offset, a.m_t->get_num_args(), *this, *this); } class basic_plugin : public theory_plugin { @@ -779,7 +779,7 @@ namespace smtfd { values.push_back(m.mk_model_value(values.size(), s)); m_pinned.push_back(values.back()); } - m_context.get_model().register_usort(s, values.size(), values.c_ptr()); + m_context.get_model().register_usort(s, values.size(), values.data()); for (unsigned i = 0; i < keys.size(); ++i) { v2e.insert(keys[i], values[i]); } @@ -859,7 +859,7 @@ namespace smtfd { } expr_ref val = model_value(f.m_t); TRACE("smtfd_verbose", tout << mk_bounded_pp(f.m_t, m, 2) << " := " << val << "\n";); - fi->insert_new_entry(args.c_ptr(), val); + fi->insert_new_entry(args.data(), val); } mdl->register_decl(fn, fi); } @@ -1410,7 +1410,7 @@ namespace smtfd { for (expr* arg : *to_app(e)) { args.push_back(replace_model_value(arg)); } - return expr_ref(m.mk_app(to_app(e)->get_decl(), args.size(), args.c_ptr()), m); + return expr_ref(m.mk_app(to_app(e)->get_decl(), args.size(), args.data()), m); } return expr_ref(e, m); } @@ -1450,7 +1450,7 @@ namespace smtfd { } } var_subst subst(m); - expr_ref body = subst(tmp, vars.size(), vars.c_ptr()); + expr_ref body = subst(tmp, vars.size(), vars.data()); if (is_forall(q)) { body = m.mk_not(body); @@ -1489,7 +1489,7 @@ namespace smtfd { } if (r == l_true) { - body = subst(q->get_expr(), vals.size(), vals.c_ptr()); + body = subst(q->get_expr(), vals.size(), vals.data()); m_context.rewrite(body); TRACE("smtfd", tout << "vals: " << vals << "\n" << body << "\n";); if (is_forall(q)) { @@ -1518,7 +1518,7 @@ namespace smtfd { vars[i] = m.mk_fresh_const(q->get_decl_name(i), q->get_decl_sort(i)); } var_subst subst(m); - expr_ref body = subst(q->get_expr(), vars.size(), vars.c_ptr()); + expr_ref body = subst(q->get_expr(), vars.size(), vars.data()); if (is_exists(q)) { body = m.mk_implies(q, body); } @@ -1646,7 +1646,7 @@ namespace smtfd { unsigned sz = m_assertions.size() - m_assertions_qhead; if (sz > 0) { m_assertions.push_back(m_toggles.back()); - expr_ref fml(m.mk_and(sz + 1, m_assertions.c_ptr() + m_assertions_qhead), m); + expr_ref fml(m.mk_and(sz + 1, m_assertions.data() + m_assertions_qhead), m); m_assertions.pop_back(); expr* toggle = add_toggle(m.mk_fresh_const("toggle", m.mk_bool_sort())); m_assertions_qhead = m_assertions.size(); @@ -2010,7 +2010,7 @@ namespace smtfd { } m_stats.m_num_lemmas += m_context.size(); m_context.reset(m_model); - r = check_abs(core.size(), core.c_ptr()); + r = check_abs(core.size(), core.data()); update_reason_unknown(r, m_fd_sat_solver); switch (r) { case l_false: diff --git a/src/tactic/fpa/fpa2bv_model_converter.cpp b/src/tactic/fpa/fpa2bv_model_converter.cpp index 5e952eb6e..67c427492 100644 --- a/src/tactic/fpa/fpa2bv_model_converter.cpp +++ b/src/tactic/fpa/fpa2bv_model_converter.cpp @@ -79,7 +79,7 @@ void fpa2bv_model_converter::convert(model_core * mc, model * float_mdl) { for (unsigned i = 0; i < sz; i++) { sort * s = mc->get_uninterpreted_sort(i); ptr_vector u = mc->get_universe(s); - float_mdl->register_usort(s, u.size(), u.c_ptr()); + float_mdl->register_usort(s, u.size(), u.data()); } } diff --git a/src/tactic/generic_model_converter.cpp b/src/tactic/generic_model_converter.cpp index db7e879b6..8ef21d9c9 100644 --- a/src/tactic/generic_model_converter.cpp +++ b/src/tactic/generic_model_converter.cpp @@ -179,9 +179,9 @@ void generic_model_converter::operator()(expr_ref& fml) { args.push_back(m.mk_var(i, sorts.back())); } // TBD: check if order is correct with respect to quantifier binding ordering - expr_ref lhs(m.mk_app(e.m_f, arity, args.c_ptr()), m); + expr_ref lhs(m.mk_app(e.m_f, arity, args.data()), m); expr_ref body(m.mk_eq(lhs, e.m_def), m); - fmls.push_back(m.mk_forall(arity, sorts.c_ptr(), names.c_ptr(), body)); + fmls.push_back(m.mk_forall(arity, sorts.data(), names.data(), body)); } if (m_first_idx[e.m_f] == i) { m_first_idx.remove(e.m_f); diff --git a/src/tactic/goal.cpp b/src/tactic/goal.cpp index 9823147f5..e489a1100 100644 --- a/src/tactic/goal.cpp +++ b/src/tactic/goal.cpp @@ -443,7 +443,7 @@ void goal::display_as_and(std::ostream & out) const { for (unsigned i = 0; i < sz; i++) args.push_back(form(i)); expr_ref tmp(m()); - tmp = m().mk_and(args.size(), args.c_ptr()); + tmp = m().mk_and(args.size(), args.data()); out << mk_ismt2_pp(tmp, m()) << "\n"; } diff --git a/src/tactic/horn_subsume_model_converter.cpp b/src/tactic/horn_subsume_model_converter.cpp index 869cf7b01..38e6a42c5 100644 --- a/src/tactic/horn_subsume_model_converter.cpp +++ b/src/tactic/horn_subsume_model_converter.cpp @@ -92,11 +92,11 @@ bool horn_subsume_model_converter::mk_horn( } } expr_ref body_expr(m); - body_expr = m.mk_and(conjs.size(), conjs.c_ptr()); + body_expr = m.mk_and(conjs.size(), conjs.data()); // substitute variables directly. if (!subst.empty()) { - body_expr = vs(body_expr, subst.size(), subst.c_ptr()); + body_expr = vs(body_expr, subst.size(), subst.data()); } if (fv.empty()) { @@ -104,7 +104,7 @@ bool horn_subsume_model_converter::mk_horn( body_res = body_expr; } else { - body_res = m.mk_exists(fv.size(), fv.c_ptr(), names.c_ptr(), body_expr.get()); + body_res = m.mk_exists(fv.size(), fv.data(), names.data(), body_expr.get()); m_rewrite(body_res); } diff --git a/src/tactic/model_converter.cpp b/src/tactic/model_converter.cpp index 2ac23f838..6bb2f48c5 100644 --- a/src/tactic/model_converter.cpp +++ b/src/tactic/model_converter.cpp @@ -137,7 +137,7 @@ public: } void operator()(labels_vec & r) override { - r.append(m_labels.size(), m_labels.c_ptr()); + r.append(m_labels.size(), m_labels.data()); } void operator()(expr_ref& fml) override { diff --git a/src/tactic/proof_converter.cpp b/src/tactic/proof_converter.cpp index faa9a36db..b876f1216 100644 --- a/src/tactic/proof_converter.cpp +++ b/src/tactic/proof_converter.cpp @@ -71,7 +71,7 @@ public: proof_converter_ref pc1 = m_pc->translate(tr); goal_ref_buffer goals; for (goal_ref g : m_goals) goals.push_back(g->translate(tr)); - return alloc(subgoal_proof_converter, pc1.get(), goals.size(), goals.c_ptr()); + return alloc(subgoal_proof_converter, pc1.get(), goals.size(), goals.data()); } void display(std::ostream& out) override {} @@ -133,5 +133,5 @@ proof_ref apply(ast_manager & m, proof_converter_ref & pc1, proof_converter_ref_ pr = pc2s[i]->operator()(m, 0, nullptr); prs.push_back(pr); } - return (*pc1)(m, sz, prs.c_ptr()); + return (*pc1)(m, sz, prs.data()); } diff --git a/src/tactic/sls/sls_evaluator.h b/src/tactic/sls/sls_evaluator.h index 8523c80a9..d386ece15 100644 --- a/src/tactic/sls/sls_evaluator.h +++ b/src/tactic/sls/sls_evaluator.h @@ -510,7 +510,7 @@ public: m_temp_exprs.push_back(m_tracker.mpz2value(arg->get_sort(), v)); } expr_ref q(m_manager), temp(m_manager); - q = m_manager.mk_app(a->get_decl(), m_temp_exprs.size(), m_temp_exprs.c_ptr()); + q = m_manager.mk_app(a->get_decl(), m_temp_exprs.size(), m_temp_exprs.data()); model dummy_model(m_manager); model_evaluator evaluator(dummy_model); evaluator(q, temp); diff --git a/src/tactic/tactical.cpp b/src/tactic/tactical.cpp index 9683e121e..07be90518 100644 --- a/src/tactic/tactical.cpp +++ b/src/tactic/tactical.cpp @@ -137,7 +137,7 @@ public: } } else { - result.append(r2.size(), r2.c_ptr()); + result.append(r2.size(), r2.data()); } } @@ -270,7 +270,7 @@ protected: for (tactic* curr : m_ts) { new_ts.push_back(curr->translate(m)); } - return alloc(T, new_ts.size(), new_ts.c_ptr()); + return alloc(T, new_ts.size(), new_ts.data()); } }; @@ -661,7 +661,7 @@ public: else { goal_ref_buffer * new_r2 = alloc(goal_ref_buffer); goals_vect.set(i, new_r2); - new_r2->append(r2.size(), r2.c_ptr()); + new_r2->append(r2.size(), r2.data()); dependency_converter* dc = r1[i]->dc(); if (cores_enabled && dc) { expr_dependency_ref * new_dep = alloc(expr_dependency_ref, new_m); @@ -707,7 +707,7 @@ public: } if (proofs_enabled) { // update proof converter of r1[i] - r1[i]->set(concat(r1[i]->pc(), result.size() - j, result.c_ptr() + j)); + r1[i]->set(concat(r1[i]->pc(), result.size() - j, result.data() + j)); } expr_dependency_translation td(translator); if (core_buffer[i] != nullptr) { @@ -852,7 +852,7 @@ class repeat_tactical : public unary_tactical { } } else { - result.append(r2.size(), r2.c_ptr()); + result.append(r2.size(), r2.data()); } } diff --git a/src/tactic/ufbv/ufbv_rewriter.cpp b/src/tactic/ufbv/ufbv_rewriter.cpp index 938162df7..bfaf35980 100644 --- a/src/tactic/ufbv/ufbv_rewriter.cpp +++ b/src/tactic/ufbv/ufbv_rewriter.cpp @@ -284,7 +284,7 @@ bool ufbv_rewriter::rewrite1(func_decl * f, expr_ref_vector & m_new_args, expr_r SASSERT(large->get_decl() == f); - if (m_match_subst(large, l_s.second, m_new_args.c_ptr(), np)) { + if (m_match_subst(large, l_s.second, m_new_args.data(), np)) { TRACE("demodulator_bug", tout << "succeeded...\n" << mk_pp(l_s.second, m) << "\n===>\n" << mk_pp(np, m) << "\n";); return true; } @@ -397,7 +397,7 @@ expr * ufbv_rewriter::rewrite(expr * n) { if (f->get_family_id() != m.get_basic_family_id()) na = m.mk_app(f, m_new_args); else - m_bsimp.mk_app(f, m_new_args.size(), m_new_args.c_ptr(), na); + 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"; tout << m_new_args << "\n"; tout << "=====>\n"; diff --git a/src/tactic/ufbv/ufbv_rewriter_tactic.cpp b/src/tactic/ufbv/ufbv_rewriter_tactic.cpp index 9d197d8c9..bb2b4d5be 100644 --- a/src/tactic/ufbv/ufbv_rewriter_tactic.cpp +++ b/src/tactic/ufbv/ufbv_rewriter_tactic.cpp @@ -59,7 +59,7 @@ public: proofs.push_back(g->pr(i)); } - dem(forms.size(), forms.c_ptr(), proofs.c_ptr(), new_forms, new_proofs); + dem(forms.size(), forms.data(), proofs.data(), new_forms, new_proofs); g->reset(); for (unsigned i = 0; i < new_forms.size(); i++) diff --git a/src/test/bits.cpp b/src/test/bits.cpp index f0f04f661..2bef6a0ba 100644 --- a/src/test/bits.cpp +++ b/src/test/bits.cpp @@ -26,8 +26,8 @@ static void tst_shl(unsigned src_sz, unsigned const * src, unsigned k, for (unsigned sz = 1; sz <= dst_sz; sz++) { if (trace) std::cout << " for sz = " << sz << std::endl; - shl(src_sz, src, k, sz, actual_dst.c_ptr()); - ENSURE(!has_one_at_first_k_bits(sz, actual_dst.c_ptr(), k)); + shl(src_sz, src, k, sz, actual_dst.data()); + ENSURE(!has_one_at_first_k_bits(sz, actual_dst.data(), k)); for (unsigned i = 0; i < sz; i++) { if (trace && dst[i] != actual_dst[i]) std::cout << "UNEXPECTED RESULT at [" << i << "]: " << actual_dst[i] << ", expected: " << dst[i] << "\n"; @@ -36,7 +36,7 @@ static void tst_shl(unsigned src_sz, unsigned const * src, unsigned k, if (sz == src_sz) { unsigned nz1 = nlz(sz, src); if (nz1 >= k && !is_zero(sz, src)) { - unsigned nz2 = nlz(sz, actual_dst.c_ptr()); + unsigned nz2 = nlz(sz, actual_dst.data()); if (nz1 - k != nz2) { if (trace) std::cout << "nlz BUG, nlz1: " << nz1 << ", k: " << k << ", nlz2: " << nz2 << std::endl; @@ -47,7 +47,7 @@ static void tst_shl(unsigned src_sz, unsigned const * src, unsigned k, if (sz >= src_sz + (k/32) + 1) { svector new_src; new_src.resize(sz, 0xAAAAAAAA); - shr(sz, actual_dst.c_ptr(), k, new_src.c_ptr()); + shr(sz, actual_dst.data(), k, new_src.data()); for (unsigned i = 0; i < src_sz; i++) { if (trace && src[i] != new_src[i]) { std::cout << "shr BUG, inverting shl, at bit[" << i << "], " << new_src[i] << ", expected: " << src[i] << std::endl; @@ -58,9 +58,9 @@ static void tst_shl(unsigned src_sz, unsigned const * src, unsigned k, } if (trace) std::cout << " shift by 1, k times" << std::endl; - copy(src_sz, src, dst_sz, actual_dst.c_ptr()); + copy(src_sz, src, dst_sz, actual_dst.data()); for (unsigned i = 0; i < k; i++) { - shl(dst_sz, actual_dst.c_ptr(), 1, dst_sz, actual_dst.c_ptr()); + shl(dst_sz, actual_dst.data(), 1, dst_sz, actual_dst.data()); } for (unsigned i = 0; i < dst_sz; i++) { if (trace && dst[i] != actual_dst[i]) @@ -130,7 +130,7 @@ static void tst_shr(unsigned src_sz, unsigned const * src, unsigned k, } svector actual_dst; actual_dst.resize(src_sz, 0xAAAAAAAA); - shr(src_sz, src, k, actual_dst.c_ptr()); + shr(src_sz, src, k, actual_dst.data()); for (unsigned i = 0; i < src_sz; i++) { if (trace && dst[i] != actual_dst[i]) std::cout << "UNEXPECTED RESULT at [" << i << "]: " << actual_dst[i] << ", expected: " << dst[i] << "\n"; @@ -182,7 +182,7 @@ static void tst_shl_rand(unsynch_mpz_manager & m, unsigned sz, unsigned k, bool unsigned word_shift = (k / 32); for (unsigned i = 0; i < word_shift; i++) dst.push_back(0); - tst_shl(src.size(), src.c_ptr(), k, dst.size(), dst.c_ptr(), trace); + tst_shl(src.size(), src.data(), k, dst.size(), dst.data(), trace); } static void tst_shl_rand(unsigned N, unsigned sz, unsigned k, bool trace = false) { diff --git a/src/test/cnf_backbones.cpp b/src/test/cnf_backbones.cpp index 9db15c304..32a8149bd 100644 --- a/src/test/cnf_backbones.cpp +++ b/src/test/cnf_backbones.cpp @@ -73,7 +73,7 @@ static void track_clause(sat::solver& dst, sat::literal lit = sat::literal(dst.mk_var(true, false), false); tracking_clauses.set(lit.var(), lits); lits.push_back(~lit); - dst.mk_clause(lits.size(), lits.c_ptr()); + dst.mk_clause(lits.size(), lits.data()); assumptions.push_back(lit); } @@ -145,7 +145,7 @@ static void brute_force_consequences(sat::solver& s, sat::literal_vector const& sat::literal nlit = ~gamma[i]; sat::literal_vector asms1(asms); asms1.push_back(nlit); - lbool r = s.check(asms1.size(), asms1.c_ptr()); + lbool r = s.check(asms1.size(), asms1.data()); if (r == l_false) { backbones.push_back(gamma[i]); } @@ -153,7 +153,7 @@ static void brute_force_consequences(sat::solver& s, sat::literal_vector const& } static lbool core_chunking(sat::solver& s, sat::bool_var_vector& vars, sat::literal_vector const& asms, vector& conseq, unsigned K) { - lbool r = s.check(asms.size(), asms.c_ptr()); + lbool r = s.check(asms.size(), asms.data()); if (r != l_true) { return r; } @@ -174,7 +174,7 @@ static lbool core_chunking(sat::solver& s, sat::bool_var_vector& vars, sat::lite while (true) { sat::literal_vector asms1(asms); asms1.append(omegaN); - r = s.check(asms1.size(), asms1.c_ptr()); + r = s.check(asms1.size(), asms1.data()); if (r == l_true) { IF_VERBOSE(1, verbose_stream() << "(sat) " << omegaN << "\n";); prune_unfixed(lambda, s.get_model()); diff --git a/src/test/dl_query.cpp b/src/test/dl_query.cpp index 3dc99e33c..2181f97ad 100644 --- a/src/test/dl_query.cpp +++ b/src/test/dl_query.cpp @@ -17,7 +17,7 @@ Copyright (c) 2015 Microsoft Corporation using namespace datalog; void dl_query_ask_ground_query(context & ctx, func_decl * pred, relation_fact & f, bool should_be_successful) { - expr * const * q_args = reinterpret_cast(f.c_ptr()); + expr * const * q_args = reinterpret_cast(f.data()); app * query = ctx.get_manager().mk_app(pred, q_args); lbool is_sat = ctx.query(query); @@ -36,7 +36,7 @@ void dl_query_ask_for_last_arg(context & ctx, func_decl * pred, relation_fact & push_into_vector(query_args, f); query_args.pop_back(); query_args.push_back(m.mk_var(0, pred->get_domain(query_args.size()))); - app * query = ctx.get_manager().mk_app(pred, query_args.c_ptr()); + app * query = ctx.get_manager().mk_app(pred, query_args.data()); lbool is_sat = ctx.query(query); std::cerr << "@@ last arg query should succeed: " << should_be_successful << "\n"; @@ -178,7 +178,7 @@ void dl_query_test_wpa(smt_params & fparams, params_ref& params) { q_args.push_back(dl_util.mk_numeral(el1, var_sort)); q_args.push_back(dl_util.mk_numeral(el2, var_sort)); - app_ref query_lit(m.mk_app(v_pred, q_args.c_ptr()), m); + app_ref query_lit(m.mk_app(v_pred, q_args.data()), m); lbool is_sat = ctx.query(query_lit); ENSURE(is_sat != l_undef); bool found = is_sat == l_true; @@ -190,7 +190,7 @@ void dl_query_test_wpa(smt_params & fparams, params_ref& params) { q_args.pop_back(); q_args.push_back(m.mk_var(0, var_sort)); - query_lit = m.mk_app(v_pred, q_args.c_ptr()); + query_lit = m.mk_app(v_pred, q_args.data()); is_sat = ctx.query(query_lit.get()); ENSURE(is_sat != l_false); std::cerr<<"non-ground query finished\n"; diff --git a/src/test/doc.cpp b/src/test/doc.cpp index 13892a192..4d84ff964 100644 --- a/src/test/doc.cpp +++ b/src/test/doc.cpp @@ -173,7 +173,7 @@ class test_doc_cls { default: break; } } - result = mk_and(m, conjs.size(), conjs.c_ptr()); + result = mk_and(m, conjs.size(), conjs.data()); return result; } @@ -197,7 +197,7 @@ class test_doc_cls { break; } } - result = mk_and(m, conjs.size(), conjs.c_ptr()); + result = mk_and(m, conjs.size(), conjs.data()); return result; } @@ -208,7 +208,7 @@ class test_doc_cls { for (unsigned i = 0; i < d.neg().size(); ++i) { conjs.push_back(m.mk_not(to_formula(d.neg()[i], m2))); } - result = mk_and(m, conjs.size(), conjs.c_ptr()); + result = mk_and(m, conjs.size(), conjs.data()); return result; } @@ -218,7 +218,7 @@ class test_doc_cls { for (unsigned i = 0; i < ud.size(); ++i) { disjs.push_back(to_formula(ud[i], m2)); } - result = mk_or(m, disjs.size(), disjs.c_ptr()); + result = mk_or(m, disjs.size(), disjs.data()); return result; } @@ -299,7 +299,7 @@ class test_doc_cls { fmls.push_back(m.mk_not(mk_conj(*t))); d->neg().push_back(t); } - fml1 = mk_and(m, fmls.size(), fmls.c_ptr()); + fml1 = mk_and(m, fmls.size(), fmls.data()); bool_vector to_merge(N, false); bit_vector discard_cols; discard_cols.resize(N, false); @@ -321,7 +321,7 @@ class test_doc_cls { } } eqs.push_back(to_formula(*d, dm)); - fml1 = mk_and(m, eqs.size(), eqs.c_ptr()); + fml1 = mk_and(m, eqs.size(), eqs.data()); if (dm.merge(*d, lo, 1, equalities, discard_cols)) { fml2 = to_formula(*d, dm); } diff --git a/src/test/fuzzing/expr_delta.cpp b/src/test/fuzzing/expr_delta.cpp index 8e94a84ce..b087cc35a 100644 --- a/src/test/fuzzing/expr_delta.cpp +++ b/src/test/fuzzing/expr_delta.cpp @@ -14,7 +14,7 @@ void expr_delta::assert_cnstr(expr* n) { } bool expr_delta::delta_dfs(unsigned n, expr_ref_vector& result) { - return delta_dfs(n, m_exprs.size(), m_exprs.c_ptr(), result); + return delta_dfs(n, m_exprs.size(), m_exprs.data(), result); } bool expr_delta::delta_dfs(unsigned& n, unsigned sz, expr* const* exprs, expr_ref_vector& result) { @@ -38,7 +38,7 @@ bool expr_delta::delta_dfs(unsigned& n, unsigned sz, expr* const* exprs, expr_re bool expr_delta::delta_dfs(unsigned& n, app* a, expr_ref& result) { expr_ref_vector args(m_manager); if (delta_dfs(n, a->get_num_args(), a->get_args(), args)) { - result = m_manager.mk_app(a->get_decl(), args.size(), args.c_ptr()); + result = m_manager.mk_app(a->get_decl(), args.size(), args.data()); return true; } else { diff --git a/src/test/fuzzing/expr_rand.cpp b/src/test/fuzzing/expr_rand.cpp index 8d20a4e92..65d5f70c9 100644 --- a/src/test/fuzzing/expr_rand.cpp +++ b/src/test/fuzzing/expr_rand.cpp @@ -55,7 +55,7 @@ void expr_rand::walk() { for (unsigned i = 0; i < arity; ++i) { args.push_back(choose_expr(f->get_domain(i))); } - expr* r = m_manager.mk_app(f, args.size(), args.c_ptr()); + expr* r = m_manager.mk_app(f, args.size(), args.data()); add_expr(r); } diff --git a/src/test/hilbert_basis.cpp b/src/test/hilbert_basis.cpp index 752a9a089..06446e8e9 100644 --- a/src/test/hilbert_basis.cpp +++ b/src/test/hilbert_basis.cpp @@ -160,15 +160,15 @@ expr_ref hilbert_basis_validate::mk_validate(hilbert_basis& hb) { for (unsigned k = 0; k < increments.size(); ++k) { sum.push_back(increments[k][j].get()); } - eqs.push_back(m.mk_eq(xs[j].get(), a.mk_add(sum.size(), sum.c_ptr()))); + eqs.push_back(m.mk_eq(xs[j].get(), a.mk_add(sum.size(), sum.data()))); } - fml = m.mk_and(eqs.size(), eqs.c_ptr()); + fml = m.mk_and(eqs.size(), eqs.data()); if (!names.empty()) { - fml = m.mk_exists(names.size(), sorts.c_ptr(), names.c_ptr(), fml); + fml = m.mk_exists(names.size(), sorts.data(), names.data(), fml); } fmls.push_back(fml); } - fml1 = m.mk_or(fmls.size(), fmls.c_ptr()); + fml1 = m.mk_or(fmls.size(), fmls.data()); fmls.reset(); sz = hb.get_num_ineqs(); @@ -184,7 +184,7 @@ expr_ref hilbert_basis_validate::mk_validate(hilbert_basis& hb) { } } expr_ref lhs(m), rhs(m); - lhs = a.mk_add(sum.size(), sum.c_ptr()); + lhs = a.mk_add(sum.size(), sum.data()); rhs = a.mk_numeral(bound, true); if (is_eq) { fmls.push_back(a.mk_eq(lhs, rhs)); @@ -193,7 +193,7 @@ expr_ref hilbert_basis_validate::mk_validate(hilbert_basis& hb) { fmls.push_back(a.mk_ge(lhs, rhs)); } } - fml2 = m.mk_and(fmls.size(), fmls.c_ptr()); + fml2 = m.mk_and(fmls.size(), fmls.data()); fml = m.mk_eq(fml1, fml2); bounds.reset(); @@ -203,7 +203,7 @@ expr_ref hilbert_basis_validate::mk_validate(hilbert_basis& hb) { } } if (!bounds.empty()) { - fml = m.mk_implies(m.mk_and(bounds.size(), bounds.c_ptr()), fml); + fml = m.mk_implies(m.mk_and(bounds.size(), bounds.data()), fml); } return fml; diff --git a/src/test/horn_subsume_model_converter.cpp b/src/test/horn_subsume_model_converter.cpp index 3e493d408..6d4dcc26f 100644 --- a/src/test/horn_subsume_model_converter.cpp +++ b/src/test/horn_subsume_model_converter.cpp @@ -21,9 +21,9 @@ void tst_horn_subsume_model_converter() { ints.push_back(a.mk_int()); func_decl_ref p(m), q(m), r(m); - p = m.mk_func_decl(symbol("p"), 2, ints.c_ptr(), m.mk_bool_sort()); - q = m.mk_func_decl(symbol("q"), 2, ints.c_ptr(), m.mk_bool_sort()); - r = m.mk_func_decl(symbol("r"), 2, ints.c_ptr(), m.mk_bool_sort()); + p = m.mk_func_decl(symbol("p"), 2, ints.data(), m.mk_bool_sort()); + q = m.mk_func_decl(symbol("q"), 2, ints.data(), m.mk_bool_sort()); + r = m.mk_func_decl(symbol("r"), 2, ints.data(), m.mk_bool_sort()); ref mc = alloc(horn_subsume_model_converter,m); model_ref mr = alloc(model, m); diff --git a/src/test/karr.cpp b/src/test/karr.cpp index dc18f7e19..cf5867324 100644 --- a/src/test/karr.cpp +++ b/src/test/karr.cpp @@ -149,7 +149,7 @@ namespace karr { TD.display(std::cout << "TD:\n"); for (unsigned i = 0; i < TD.size(); ++i) { vector v; - v.append(src.size(), TD.A[i].c_ptr() + src.size()); + v.append(src.size(), TD.A[i].data() + src.size()); dst.A.push_back(v); dst.b.push_back(TD.b[i]); } diff --git a/src/test/model2expr.cpp b/src/test/model2expr.cpp index 457fc1751..41047825c 100644 --- a/src/test/model2expr.cpp +++ b/src/test/model2expr.cpp @@ -21,8 +21,8 @@ void tst_model2expr() { ints.push_back(a.mk_int()); func_decl_ref p(m), q(m), x(m); - p = m.mk_func_decl(symbol("p"), 2, ints.c_ptr(), a.mk_int()); - q = m.mk_func_decl(symbol("q"), 2, ints.c_ptr(), a.mk_int()); + p = m.mk_func_decl(symbol("p"), 2, ints.data(), a.mk_int()); + q = m.mk_func_decl(symbol("q"), 2, ints.data(), a.mk_int()); x = m.mk_const_decl(symbol("x"), a.mk_int()); expr_ref n0(m), n1(m), n2(m); n0 = a.mk_numeral(rational(0), true); @@ -35,12 +35,12 @@ void tst_model2expr() { expr_ref_vector args(m); args.push_back(n1); args.push_back(n2); - fip->insert_entry(args.c_ptr(), n1); - fiq->insert_entry(args.c_ptr(), n1); + fip->insert_entry(args.data(), n1); + fiq->insert_entry(args.data(), n1); args[0] = n0; args[1] = n1; - fip->insert_entry(args.c_ptr(), n2); - fiq->insert_entry(args.c_ptr(), n2); + fip->insert_entry(args.data(), n2); + fiq->insert_entry(args.data(), n2); fip->set_else(n0); diff --git a/src/test/nlsat.cpp b/src/test/nlsat.cpp index 540924713..44d4120fe 100644 --- a/src/test/nlsat.cpp +++ b/src/test/nlsat.cpp @@ -311,7 +311,7 @@ static void project(nlsat::solver& s, nlsat::explain& ex, nlsat::var x, unsigned s.display(std::cout, num, lits); nlsat::scoped_literal_vector result(s); ex.project(x, num, lits, result); - s.display(std::cout << "\n==>\n", result.size(), result.c_ptr()); + s.display(std::cout << "\n==>\n", result.size(), result.data()); std::cout << "\n"; } @@ -398,12 +398,12 @@ static void tst6() { s.set_rvalues(as); - project(s, ex, x0, 2, lits.c_ptr()); - project(s, ex, x1, 3, lits.c_ptr()); - project(s, ex, x2, 3, lits.c_ptr()); - project(s, ex, x2, 2, lits.c_ptr()); - project(s, ex, x2, 4, lits.c_ptr()); - project(s, ex, x2, 3, lits.c_ptr()+1); + project(s, ex, x0, 2, lits.data()); + project(s, ex, x1, 3, lits.data()); + project(s, ex, x2, 3, lits.data()); + project(s, ex, x2, 2, lits.data()); + project(s, ex, x2, 4, lits.data()); + project(s, ex, x2, 3, lits.data()+1); } @@ -441,7 +441,7 @@ static void tst7() { lits.push_back(mk_gt(s, p2)); lits.push_back(mk_gt(s, p3)); - nlsat::literal_vector litsv(lits.size(), lits.c_ptr()); + nlsat::literal_vector litsv(lits.size(), lits.data()); lbool res = s.check(litsv); VERIFY(res == l_false); for (unsigned i = 0; i < litsv.size(); ++i) { @@ -451,7 +451,7 @@ static void tst7() { std::cout << "\n"; litsv.reset(); - litsv.append(2, lits.c_ptr()); + litsv.append(2, lits.data()); res = s.check(litsv); ENSURE(res == l_true); s.display(std::cout); @@ -505,7 +505,7 @@ static void tst8() { nlsat::scoped_literal_vector lits(s); lits.push_back(mk_eq(s, (_a*_x2*_x2) - (_b*_x2) - _c)); - project(s, ex, x2, 1, lits.c_ptr()); + project(s, ex, x2, 1, lits.data()); } @@ -560,16 +560,16 @@ static void tst9() { #define TEST_ON_OFF() \ std::cout << "Off "; \ ex.set_signed_project(false); \ - project(s, ex, _x, lits.size()-1, lits.c_ptr()); \ + project(s, ex, _x, lits.size()-1, lits.data()); \ std::cout << "On "; \ ex.set_signed_project(true); \ - project(s, ex, _x, lits.size()-1, lits.c_ptr()); \ + project(s, ex, _x, lits.size()-1, lits.data()); \ std::cout << "Off "; \ ex.set_signed_project(false); \ - project(s, ex, _x, lits.size(), lits.c_ptr()); \ + project(s, ex, _x, lits.size(), lits.data()); \ std::cout << "On "; \ ex.set_signed_project(true); \ - project(s, ex, _x, lits.size(), lits.c_ptr()) \ + project(s, ex, _x, lits.size(), lits.data()) \ TEST_ON_OFF(); @@ -620,7 +620,7 @@ static void test_root_literal(nlsat::solver& s, nlsat::explain& ex, nlsat::var x ex.test_root_literal(k, x, 1, p, result); nlsat::bool_var b = s.mk_root_atom(k, x, i, p); s.display(std::cout, nlsat::literal(b, false)); - s.display(std::cout << " ==> ", result.size(), result.c_ptr()); + s.display(std::cout << " ==> ", result.size(), result.data()); std::cout << "\n"; } @@ -748,7 +748,7 @@ static void tst11() { lits.reset(); lits.push_back(mk_gt(s, p1)); lits.push_back(mk_eq(s, p2)); - project_fa(s, ex, x, 2, lits.c_ptr()); + project_fa(s, ex, x, 2, lits.data()); // return; p1 = ((_x * _x) - (2 * _y * _x) - _z + (_y *_y)); @@ -759,7 +759,7 @@ static void tst11() { lits.reset(); lits.push_back(mk_lt(s, p1)); lits.push_back(mk_eq(s, p2)); - project_fa(s, ex, x, 2, lits.c_ptr()); + project_fa(s, ex, x, 2, lits.data()); return; as.set(z, zero); @@ -770,7 +770,7 @@ static void tst11() { lits.reset(); lits.push_back(mk_gt(s, p1)); lits.push_back(mk_eq(s, p2)); - project_fa(s, ex, x, 2, lits.c_ptr()); + project_fa(s, ex, x, 2, lits.data()); #if 0 diff --git a/src/test/pb2bv.cpp b/src/test/pb2bv.cpp index 2d83ad87d..169df85ad 100644 --- a/src/test/pb2bv.cpp +++ b/src/test/pb2bv.cpp @@ -37,7 +37,7 @@ static void test1() { for (unsigned k = 1; k <= N; ++k) { expr_ref fml(m), result(m); proof_ref proof(m); - fml = pb.mk_at_least_k(vars.size(), vars.c_ptr(), k); + fml = pb.mk_at_least_k(vars.size(), vars.data(), k); rw(true, fml, result, proof); std::cout << fml << " |-> " << result << "\n"; } @@ -57,9 +57,9 @@ static void test_semantics(ast_manager& m, expr_ref_vector const& vars, vector(1 << N); ++values) { @@ -152,9 +152,9 @@ static void test_solver_semantics(ast_manager& m, expr_ref_vector const& vars, v slv->assert_expr(m.mk_eq(result1, fml1)); switch (kind) { - case 0: fml2 = pb.mk_ge(tf.size(), coeffs.c_ptr(), tf.c_ptr(), rational(k)); break; - case 1: fml2 = pb.mk_le(tf.size(), coeffs.c_ptr(), tf.c_ptr(), rational(k)); break; - default: fml2 = pb.mk_eq(tf.size(), coeffs.c_ptr(), tf.c_ptr(), rational(k)); break; + case 0: fml2 = pb.mk_ge(tf.size(), coeffs.data(), tf.data(), rational(k)); break; + case 1: fml2 = pb.mk_le(tf.size(), coeffs.data(), tf.data(), rational(k)); break; + default: fml2 = pb.mk_eq(tf.size(), coeffs.data(), tf.data(), rational(k)); break; } std::cout << fml1 << " " << fml2 << "\n"; th_rw(fml2, result2, proof); diff --git a/src/test/pdd_solver.cpp b/src/test/pdd_solver.cpp index 46999f565..170e887a7 100644 --- a/src/test/pdd_solver.cpp +++ b/src/test/pdd_solver.cpp @@ -111,10 +111,10 @@ namespace dd { for (unsigned i = 0; i < args.size(); ++i) { args[i] = mk_not(m, args.get(i)); } - g = m.mk_not(m.mk_and(args.size(), args.c_ptr())); + g = m.mk_not(m.mk_and(args.size(), args.data())); } else if (m.is_and(a)) { - g = m.mk_and(args.size(), args.c_ptr()); + g = m.mk_and(args.size(), args.data()); trail.push_back(g); } else if (m.is_eq(a)) { @@ -134,7 +134,7 @@ namespace dd { g = mk_not(m, args.get(0)); } else { - g = m.mk_app(a->get_decl(), args.size(), args.c_ptr()); + g = m.mk_app(a->get_decl(), args.size(), args.data()); } trail.push_back(g); cache.insert(a, g); diff --git a/src/test/polynomial.cpp b/src/test/polynomial.cpp index 00998a181..091d03c61 100644 --- a/src/test/polynomial.cpp +++ b/src/test/polynomial.cpp @@ -928,7 +928,7 @@ static void tst_substitute(polynomial_ref const & p, std::cout << "---------------\n"; std::cout << "p: " << p << std::endl; polynomial_ref r(p.m()); - r = p.m().substitute(p, 2, xs, vs.c_ptr()); + r = p.m().substitute(p, 2, xs, vs.data()); std::cout << "r: " << r << std::endl; std::cout << "expected: " << expected << std::endl; ENSURE(eq(r, expected)); @@ -969,7 +969,7 @@ static void tst_qsubstitute(polynomial_ref const & p, std::cout << "---------------\n"; std::cout << "p: " << p << std::endl; polynomial_ref r(p.m()); - r = p.m().substitute(p, 2, xs, vs.c_ptr()); + r = p.m().substitute(p, 2, xs, vs.data()); std::cout << "r: " << r << std::endl; std::cout << "expected (modulo a constant): " << expected << std::endl; ENSURE(eq(r, normalize(expected))); @@ -1666,7 +1666,7 @@ static void tst_newton_interpolation() { polynomial_ref r(m); { polynomial::scoped_set_zp setZ97(m, 97); - m.newton_interpolation(0, 2, ins.c_ptr(), outs, r); + m.newton_interpolation(0, 2, ins.data(), outs, r); } std::cout << "interpolation result: " << r << "\n"; ENSURE(m.eq((x^2)*y + 5*x*y + 41*x - 9*y - 21, r)); @@ -1721,17 +1721,17 @@ void tst_linear_solver() { as.reset(); as.push_back(mpq(2)); as.push_back(mpq(1)); as.push_back(mpq(-1)); qm.set(b, 8); - solver.add(0, as.c_ptr(), b); + solver.add(0, as.data(), b); as.reset(); as.push_back(mpq(-3)); as.push_back(mpq(-1)); as.push_back(mpq(2)); qm.set(b, -11); - solver.add(1, as.c_ptr(), b); + solver.add(1, as.data(), b); as.reset(); as.push_back(mpq(-2)); as.push_back(mpq(1)); as.push_back(mpq(2)); qm.set(b, -3); - solver.add(2, as.c_ptr(), b); + solver.add(2, as.data(), b); - VERIFY(solver.solve(xs.c_ptr())); + VERIFY(solver.solve(xs.data())); ENSURE(qm.eq(xs[0], mpq(2))); ENSURE(qm.eq(xs[1], mpq(3))); ENSURE(qm.eq(xs[2], mpq(-1))); diff --git a/src/test/qe_arith.cpp b/src/test/qe_arith.cpp index ae8c09518..ab268a651 100644 --- a/src/test/qe_arith.cpp +++ b/src/test/qe_arith.cpp @@ -192,7 +192,7 @@ static app_ref generate_ineqs(ast_manager& m, sort* s, vector& static void test_c(app* x, expr_ref_vector const& c) { ast_manager& m = c.get_manager(); expr_ref fml(m); - fml = m.mk_and(c.size(), c.c_ptr()); + fml = m.mk_and(c.size(), c.data()); test(x, fml); } @@ -261,8 +261,8 @@ static void test2(char const *ex) { names.push_back(vars[i]->get_decl()->get_name()); sorts.push_back(vars[i]->get_sort()); } - expr_abstract(m, 0, bound.size(), bound.c_ptr(), fml, fml2); - fml2 = m.mk_exists(bound.size(), sorts.c_ptr(), names.c_ptr(), fml2); + expr_abstract(m, 0, bound.size(), bound.data(), fml, fml2); + fml2 = m.mk_exists(bound.size(), sorts.data(), names.data(), fml2); qe::expr_quant_elim qe(m, params); for (unsigned i = 0; i < vars.size(); ++i) { VERIFY(mbp::arith_project(*md, vars[i].get(), lits)); @@ -303,7 +303,7 @@ static void mk_term(vector const& vars, rational const& coeff, app_ref& t ts.push_back(a.mk_mul(a.mk_numeral(coeff, false), var)); } ts.push_back(a.mk_numeral(coeff, a.mk_real())); - term = a.mk_add(ts.size(), ts.c_ptr()); + term = a.mk_add(ts.size(), ts.data()); } static void add_random_ineq( @@ -466,9 +466,9 @@ static void test_project() { nums.push_back(a.mk_int(0)); nums.push_back(a.mk_int(1)); nums.push_back(a.mk_int(2)); - fi->insert_new_entry(nums.c_ptr(), a.mk_int(1)); - fi->insert_new_entry(nums.c_ptr()+1, a.mk_int(2)); - fi->insert_new_entry(nums.c_ptr()+2, a.mk_int(3)); + fi->insert_new_entry(nums.data(), a.mk_int(1)); + fi->insert_new_entry(nums.data()+1, a.mk_int(2)); + fi->insert_new_entry(nums.data()+2, a.mk_int(3)); fi->set_else(a.mk_int(10)); mdl.register_decl(f, fi); vars.reset(); @@ -502,7 +502,7 @@ static void test_project() { ds.push_back(z + 2); ds.push_back(u); ds.push_back(z); - lits.push_back(m.mk_not(m.mk_distinct(ds.size(), ds.c_ptr()))); + lits.push_back(m.mk_not(m.mk_distinct(ds.size(), ds.data()))); plugin(mdl, vars, lits); std::cout << lits << "\n"; @@ -522,7 +522,7 @@ static void test_project() { ds.push_back(u); ds.push_back(z + 10); ds.push_back(u + 4); - lits.push_back(m.mk_not(m.mk_distinct(ds.size(), ds.c_ptr()))); + lits.push_back(m.mk_not(m.mk_distinct(ds.size(), ds.data()))); plugin(mdl, vars, lits); std::cout << lits << "\n"; @@ -541,7 +541,7 @@ static void test_project() { ds.push_back(y); ds.push_back(z + 2); ds.push_back(u); - lits.push_back(m.mk_distinct(ds.size(), ds.c_ptr())); + lits.push_back(m.mk_distinct(ds.size(), ds.data())); plugin(mdl, vars, lits); std::cout << lits << "\n"; diff --git a/src/test/quant_solve.cpp b/src/test/quant_solve.cpp index 3acdd0692..fb89d1c8a 100644 --- a/src/test/quant_solve.cpp +++ b/src/test/quant_solve.cpp @@ -146,7 +146,7 @@ static void parse_fml(char const* str, app_ref_vector& vars, expr_ref& fml) { } fml = q->get_expr(); var_subst vs(m, true); - fml = vs(fml, vars.size(), (expr*const*)vars.c_ptr()); + fml = vs(fml, vars.size(), (expr*const*)vars.data()); } } @@ -164,7 +164,7 @@ static void test_quant_solver(ast_manager& m, char const* str, bool validate = t expr_ref fml(m); app_ref_vector vars(m); parse_fml(str, vars, fml); - test_quant_solver(m, vars.size(), vars.c_ptr(), fml, validate); + test_quant_solver(m, vars.size(), vars.data(), fml, validate); } diff --git a/src/test/rcf.cpp b/src/test/rcf.cpp index 2f97d49d2..c577cba40 100644 --- a/src/test/rcf.cpp +++ b/src/test/rcf.cpp @@ -115,7 +115,7 @@ static void tst_solve(unsigned n, int _A[], int _b[], int _c[], bool solved) { A.set(i, j, _A[i*n + j]); svector b; b.resize(n, 0); - if (mm.solve(A, b.c_ptr(), _c)) { + if (mm.solve(A, b.data(), _c)) { ENSURE(solved); for (unsigned i = 0; i < n; i++) { ENSURE(b[i] == _b[i]); @@ -138,7 +138,7 @@ static void tst_lin_indep(unsigned m, unsigned n, int _A[], unsigned ex_sz, unsi unsigned_vector r; r.resize(A.n()); scoped_mpz_matrix B(mm); - mm.linear_independent_rows(A, r.c_ptr(), B); + mm.linear_independent_rows(A, r.data(), B); for (unsigned i = 0; i < ex_sz; i++) { ENSURE(r[i] == ex_r[i]); } diff --git a/src/test/sat_local_search.cpp b/src/test/sat_local_search.cpp index e501c53fa..7ba9e61f7 100644 --- a/src/test/sat_local_search.cpp +++ b/src/test/sat_local_search.cpp @@ -58,7 +58,7 @@ static bool build_instance(char const * filename, sat::solver& s, sat::local_sea } infile >> k; //local_search.add_cardinality(lits.size(), lits.c_ptr(), static_cast(lits.size() - k)); - local_search.add_cardinality(lits.size(), lits.c_ptr(), static_cast(k)); + local_search.add_cardinality(lits.size(), lits.data(), static_cast(k)); } infile.close(); diff --git a/src/test/sat_user_scope.cpp b/src/test/sat_user_scope.cpp index 51af0f7c3..aeba0bf04 100644 --- a/src/test/sat_user_scope.cpp +++ b/src/test/sat_user_scope.cpp @@ -31,7 +31,7 @@ static void add_clause(sat::solver& s, random_gen& r, trail_t& t) { for (unsigned i = 0; i < 3; ++i) { add_literal(r, cls); } - s.mk_clause(cls.size(), cls.c_ptr()); + s.mk_clause(cls.size(), cls.data()); } static void pop_user_scope(sat::solver& s, trail_t& t) { @@ -63,7 +63,7 @@ static void check_coherence(sat::solver& s1, trail_t& t) { for (unsigned j = 0; j < clss.size(); ++j) { cls.reset(); cls.append(clss[j]); - s2.mk_clause(cls.size(), cls.c_ptr()); + s2.mk_clause(cls.size(), cls.data()); } } lbool is_sat1 = s1.check(); diff --git a/src/test/simplex.cpp b/src/test/simplex.cpp index 782be7ea5..713cdd31c 100644 --- a/src/test/simplex.cpp +++ b/src/test/simplex.cpp @@ -88,7 +88,7 @@ void add_row(Simplex& S, vector const& _v, R const& _b, bool is_eq = false) { if (is_eq) S.set_upper(nv, zero); S.set_lower(nv+1, one); S.set_upper(nv+1, one); - S.add_row(nv, coeffs.size(), vars.c_ptr(), coeffs.c_ptr()); + S.add_row(nv, coeffs.size(), vars.data(), coeffs.data()); } static void feas(Simplex& S) { diff --git a/src/test/smt_context.cpp b/src/test/smt_context.cpp index c7bf22813..d7297c9d0 100644 --- a/src/test/smt_context.cpp +++ b/src/test/smt_context.cpp @@ -30,7 +30,7 @@ void tst_smt_context() ptr_vector assumptions; assumptions.push_back(nc.get()); - ctx.check(assumptions.size(), assumptions.c_ptr()); + ctx.check(assumptions.size(), assumptions.data()); } ctx.check(); diff --git a/src/test/sorting_network.cpp b/src/test/sorting_network.cpp index 9a143c012..b86f6ad87 100644 --- a/src/test/sorting_network.cpp +++ b/src/test/sorting_network.cpp @@ -196,7 +196,7 @@ static void test_eq1(unsigned n, sorting_network_encoding enc) { // equality: solver.push(); - result1 = sn.eq(true, 1, in.size(), in.c_ptr()); + result1 = sn.eq(true, 1, in.size(), in.data()); for (expr* cls : ext.m_clauses) { solver.assert_expr(cls); } @@ -242,7 +242,7 @@ static void test_sorting_eq(unsigned n, unsigned k, sorting_network_encoding enc // equality: std::cout << "eq " << k << " out of " << n << " for encoding " << enc << "\n"; solver.push(); - result = sn.eq(false, k, in.size(), in.c_ptr()); + result = sn.eq(false, k, in.size(), in.data()); solver.assert_expr(result); for (expr* cl : ext.m_clauses) { solver.assert_expr(cl); @@ -297,7 +297,7 @@ static void test_sorting_le(unsigned n, unsigned k, sorting_network_encoding enc // B <= k std::cout << "le " << k << "\n"; solver.push(); - result = sn.le(false, k, in.size(), in.c_ptr()); + result = sn.le(false, k, in.size(), in.data()); solver.assert_expr(result); for (expr* cls : ext.m_clauses) { solver.assert_expr(cls); @@ -355,7 +355,7 @@ void test_sorting_ge(unsigned n, unsigned k, sorting_network_encoding enc) { // k <= B std::cout << "ge " << k << "\n"; solver.push(); - result = sn.ge(false, k, in.size(), in.c_ptr()); + result = sn.ge(false, k, in.size(), in.data()); solver.assert_expr(result); for (expr* cls : ext.m_clauses) { solver.assert_expr(cls); @@ -416,7 +416,7 @@ void test_at_most_1(unsigned n, bool full, sorting_network_encoding enc) { psort_nw sn(ext); sn.cfg().m_encoding = enc; expr_ref result1(m), result2(m); - result1 = sn.le(full, 1, in.size(), in.c_ptr()); + result1 = sn.le(full, 1, in.size(), in.data()); result2 = naive_at_most1(in); @@ -494,7 +494,7 @@ static void test_at_most1(sorting_network_encoding enc) { psort_nw sn(ext); sn.cfg().m_encoding = enc; expr_ref result(m); - result = sn.le(true, 1, in.size(), in.c_ptr()); + result = sn.le(true, 1, in.size(), in.data()); //std::cout << result << "\n"; //std::cout << ext.m_clauses << "\n"; } @@ -557,7 +557,7 @@ static void test_pb(unsigned max_w, unsigned sz, unsigned_vector& ws) { solver.push(); //std::cout << "bound: " << k << "\n"; //std::cout << ws << " " << xs << "\n"; - ge = sn.ge(k, sz, ws.c_ptr(), xs.c_ptr()); + ge = sn.ge(k, sz, ws.data(), xs.data()); //std::cout << "ge: " << ge << "\n"; for (expr* cls : ext.m_clauses) { solver.assert_expr(cls); @@ -606,7 +606,7 @@ static void test_pb(unsigned max_w, unsigned sz, unsigned_vector& ws) { solver.pop(1); solver.push(); - eq = sn.eq(k, sz, ws.c_ptr(), xs.c_ptr()); + eq = sn.eq(k, sz, ws.data(), xs.data()); for (expr* cls : ext.m_clauses) { solver.assert_expr(cls); diff --git a/src/test/substitution.cpp b/src/test/substitution.cpp index b713dfcfe..9b28927fc 100644 --- a/src/test/substitution.cpp +++ b/src/test/substitution.cpp @@ -52,7 +52,7 @@ void tst_substitution() sorts.push_back(m.mk_bool_sort()); names.push_back(symbol("dude")); body = m.mk_and(m.mk_eq(v1,v2), m.mk_eq(v3,v4)); - q = m.mk_forall(sorts.size(), sorts.c_ptr(), names.c_ptr(), body); + 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";); diff --git a/src/test/theory_pb.cpp b/src/test/theory_pb.cpp index 1c23c1eaa..a6ccf733d 100644 --- a/src/test/theory_pb.cpp +++ b/src/test/theory_pb.cpp @@ -72,7 +72,7 @@ private: k += coeffs[i]; } } - fml = pb.mk_ge(args.size(), coeffs.c_ptr(), args.c_ptr(), k); + fml = pb.mk_ge(args.size(), coeffs.data(), args.data(), k); rw(fml, tmp); rw(tmp, tmp); if (pb.is_ge(tmp)) { @@ -142,7 +142,7 @@ void tst_theory_pb() { { smt::context ctx(m, params); ctx.push(); - smt::literal l = smt::theory_pb::assert_ge(ctx, k+1, lits.size(), lits.c_ptr()); + 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"; @@ -154,7 +154,7 @@ void tst_theory_pb() { { smt::context ctx(m, params); ctx.push(); - smt::literal l = smt::theory_pb::assert_ge(ctx, k, lits.size(), lits.c_ptr()); + 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);); diff --git a/src/test/udoc_relation.cpp b/src/test/udoc_relation.cpp index 4555d4ef0..0b49567b0 100644 --- a/src/test/udoc_relation.cpp +++ b/src/test/udoc_relation.cpp @@ -128,7 +128,7 @@ public: udoc_relation* mk_full(relation_signature const& sig) { func_decl_ref fn(m); - fn = m.mk_func_decl(symbol("full"), sig.size(), sig.c_ptr(), m.mk_bool_sort()); + fn = m.mk_func_decl(symbol("full"), sig.size(), sig.data(), m.mk_bool_sort()); relation_base* full = p.mk_full(fn, sig); return dynamic_cast(full); } @@ -209,7 +209,7 @@ public: unsigned_vector jc1, jc2; jc1.push_back(1); jc2.push_back(1); - datalog::relation_join_fn* join_fn = p.mk_join_fn(*t1, *t2, jc1.size(), jc1.c_ptr(), jc2.c_ptr()); + datalog::relation_join_fn* join_fn = p.mk_join_fn(*t1, *t2, jc1.size(), jc1.data(), jc2.data()); ENSURE(join_fn); t = (*join_fn)(*t1, *t2); cr.verify_join(*t1, *t2, *t, jc1, jc2); @@ -240,7 +240,7 @@ public: t1 = mk_full(sig); unsigned_vector pc; pc.push_back(0); - datalog::relation_transformer_fn* proj_fn = p.mk_project_fn(*t1, pc.size(), pc.c_ptr()); + datalog::relation_transformer_fn* proj_fn = p.mk_project_fn(*t1, pc.size(), pc.data()); t = (*proj_fn)(*t1); cr.verify_project(*t1, *t, pc); t->display(std::cout); std::cout << "\n"; @@ -298,7 +298,7 @@ public: id.push_back(0); id.push_back(2); id.push_back(4); - rel_mut filter_id = p.mk_filter_identical_fn(*t1, id.size(), id.c_ptr()); + rel_mut filter_id = p.mk_filter_identical_fn(*t1, id.size(), id.data()); relation_fact f1(m); f1.push_back(bv.mk_numeral(rational(1),3)); f1.push_back(bv.mk_numeral(rational(1),6)); @@ -468,7 +468,7 @@ public: t2 = mk_rand(sig); t1->display(std::cout); t2->display(std::cout); - join_project_fn = p.mk_join_project_fn(*t1, *t2, jc1.size(), jc1.c_ptr(), jc2.c_ptr(), pc.size(), pc.c_ptr()); + join_project_fn = p.mk_join_project_fn(*t1, *t2, jc1.size(), jc1.data(), jc2.data(), pc.size(), pc.data()); t = (*join_project_fn)(*t1, *t2); t->display(std::cout); cr.verify_join_project(*t1, *t2, *t, jc1, jc2, pc); @@ -518,7 +518,7 @@ public: pc.push_back(2); scoped_ptr join_project_fn; - join_project_fn = p.mk_join_project_fn(*t1, *t2, jc1.size(), jc1.c_ptr(), jc2.c_ptr(), pc.size(), pc.c_ptr()); + join_project_fn = p.mk_join_project_fn(*t1, *t2, jc1.size(), jc1.data(), jc2.data(), pc.size(), pc.data()); relation_base *t = (*join_project_fn)(*t1, *t2); cr.verify_join_project(*t1, *t2, *t, jc1, jc2, pc); t->deallocate(); @@ -564,7 +564,7 @@ public: t1->display(std::cout << "t1:"); t2->display(std::cout << "t2:"); - join_project_fn = p.mk_join_project_fn(*t1, *t2, jc1.size(), jc1.c_ptr(), jc2.c_ptr(), pc.size(), pc.c_ptr()); + join_project_fn = p.mk_join_project_fn(*t1, *t2, jc1.size(), jc1.data(), jc2.data(), pc.size(), pc.data()); relation_base* t; t = (*join_project_fn)(*t1, *t2); @@ -638,7 +638,7 @@ public: jc2.push_back(0); scoped_ptr join_fn; - join_fn = p.mk_join_fn(*t1, *t2, jc1.size(), jc1.c_ptr(), jc2.c_ptr()); + join_fn = p.mk_join_fn(*t1, *t2, jc1.size(), jc1.data(), jc2.data()); t = (*join_fn)(*t1, *t2); cr.verify_join(*t1, *t2, *t, jc1, jc2); @@ -659,7 +659,7 @@ public: void check_permutation(relation_base* t1, unsigned_vector const& cycle) { scoped_ptr rename; - rename = p.mk_rename_fn(*t1, cycle.size(), cycle.c_ptr()); + rename = p.mk_rename_fn(*t1, cycle.size(), cycle.data()); relation_base* t = (*rename)(*t1); cr.verify_permutation(*t1,*t, cycle); t1->display(std::cout); std::cout << "\n"; @@ -829,7 +829,7 @@ public: cols3.push_back(1); udoc_relation* tgt = mk_full(sig1); udoc_relation* neg = mk_full(sig2); - rel_mut filter_id = p.mk_filter_identical_fn(*tgt, cols3.size(), cols3.c_ptr()); + rel_mut filter_id = p.mk_filter_identical_fn(*tgt, cols3.size(), cols3.data()); (*filter_id)(*tgt); if (disable_fast) p.disable_fast_pass(); apply_filter_neg(*tgt, *neg, cols1, cols2); @@ -859,7 +859,7 @@ public: unsigned_vector const& cols1, unsigned_vector const& cols2) { scoped_ptr negf; - negf = p.mk_filter_by_negation_fn(dst, neg, cols1.size(), cols1.c_ptr(), cols2.c_ptr()); + negf = p.mk_filter_by_negation_fn(dst, neg, cols1.size(), cols1.data(), cols2.data()); expr_ref dst0(m); dst.to_formula(dst0); (*negf)(dst, neg); @@ -880,7 +880,7 @@ public: void apply_filter_project(udoc_relation& t, unsigned_vector const& rm, app* cond) { scoped_ptr rt; - rt = p.mk_filter_interpreted_and_project_fn(t, cond, rm.size(), rm.c_ptr()); + rt = p.mk_filter_interpreted_and_project_fn(t, cond, rm.size(), rm.data()); datalog::relation_base* result = (*rt)(t); cr.verify_filter_project(t, *result, cond, rm); result->deallocate(); @@ -900,7 +900,7 @@ public: repl(tmp); disj.push_back(tmp); } - fml = mk_or(m, disj.size(), disj.c_ptr()); + fml = mk_or(m, disj.size(), disj.data()); } void apply_filter(udoc_relation& t, app* cond) { diff --git a/src/test/upolynomial.cpp b/src/test/upolynomial.cpp index 0c53ce18f..a020e104f 100644 --- a/src/test/upolynomial.cpp +++ b/src/test/upolynomial.cpp @@ -57,11 +57,11 @@ static void tst1() { std::cout << "new q: "; um.display(std::cout, q); std::cout << "\n"; // q^2 - um.mul(q.size(), q.c_ptr(), q.size(), q.c_ptr(), q); + um.mul(q.size(), q.data(), q.size(), q.data(), q); std::cout << "new q^2: "; um.display(std::cout, q); std::cout << "\n"; // using pw for (q^2)^3 - um.pw(q.size(), q.c_ptr(), 3, q); + um.pw(q.size(), q.data(), 3, q); std::cout << "new (q^2)^3: "; um.display(std::cout, q); std::cout << "\n"; } @@ -73,13 +73,13 @@ static void tst_isolate_roots(polynomial_ref const & p, unsigned prec, mpbq_mana std::cout << "isolating roots of: "; um.display(std::cout, q); std::cout << "\n"; { timeit timer(true, "isolate time"); - um.isolate_roots(q.size(), q.c_ptr(), bqm, roots, lowers, uppers); + um.isolate_roots(q.size(), q.data(), bqm, roots, lowers, uppers); } upolynomial::scoped_upolynomial_sequence sseq(um), fseq(um); { timeit timer(true, "sturm time"); - um.sturm_seq(q.size(), q.c_ptr(), sseq); + um.sturm_seq(q.size(), q.data(), sseq); // um.display(std::cout, sseq); std::cout << "\n"; } @@ -87,13 +87,13 @@ static void tst_isolate_roots(polynomial_ref const & p, unsigned prec, mpbq_mana upolynomial::scoped_numeral_vector q_sqf(um); { timeit timer(true, "sqf time"); - um.square_free(q.size(), q.c_ptr(), q_sqf); + um.square_free(q.size(), q.data(), q_sqf); std::cout << "square free part: "; um.display(std::cout, q_sqf); std::cout << "\n"; } { timeit timer(true, "fourier time"); - um.fourier_seq(q_sqf.size(), q_sqf.c_ptr(), fseq); + um.fourier_seq(q_sqf.size(), q_sqf.data(), fseq); } // um.display(std::cout, fseq); @@ -104,7 +104,7 @@ static void tst_isolate_roots(polynomial_ref const & p, unsigned prec, mpbq_mana ENSURE(roots.size() + lowers.size() == um.sign_variations_at_minus_inf(sseq) - um.sign_variations_at_plus_inf(sseq)); std::cout << "roots:"; for (unsigned i = 0; i < roots.size(); i++) { - ENSURE(um.eval_sign_at(q.size(), q.c_ptr(), roots[i]) == 0); + ENSURE(um.eval_sign_at(q.size(), q.data(), roots[i]) == 0); std::cout << " "; bqm.display_decimal(std::cout, roots[i], prec); } { @@ -118,8 +118,8 @@ static void tst_isolate_roots(polynomial_ref const & p, unsigned prec, mpbq_mana bqm.display_decimal(std::cout, uppers[i], prec); std::cout << ")"; // Check interval with Sturm sequence. Small detail: Sturm sequence is for close intervals. - ENSURE(um.eval_sign_at(q.size(), q.c_ptr(), lowers[i]) == 0 || - um.eval_sign_at(q.size(), q.c_ptr(), uppers[i]) == 0 || + ENSURE(um.eval_sign_at(q.size(), q.data(), lowers[i]) == 0 || + 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", @@ -129,8 +129,8 @@ static void tst_isolate_roots(polynomial_ref const & p, unsigned prec, mpbq_mana tout << "fourier upper: " << um.sign_variations_at(fseq, uppers[i]) << "\n";); unsigned fsv_lower = um.sign_variations_at(fseq, lowers[i]); unsigned fsv_upper = um.sign_variations_at(fseq, uppers[i]); - VERIFY(um.eval_sign_at(q.size(), q.c_ptr(), lowers[i]) == 0 || - um.eval_sign_at(q.size(), q.c_ptr(), uppers[i]) == 0 || + VERIFY(um.eval_sign_at(q.size(), q.data(), lowers[i]) == 0 || + um.eval_sign_at(q.size(), q.data(), uppers[i]) == 0 || // fsv_lower - fsv_upper is an upper bound for the number of roots in the interval // fsv_upper - fsv_upper - num_roots is even // Recall that num_roots == 1 in the interval. @@ -138,7 +138,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.c_ptr(), bqm, lowers[i], uppers[i]); + 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";); VERIFY(dab == 1); } @@ -292,9 +292,9 @@ static void tst_remove_one_half() { upolynomial::scoped_numeral_vector _p(um), _q(um), _r(um); um.to_numeral_vector(p, _p); um.to_numeral_vector(r, _r); - ENSURE(um.has_one_half_root(_p.size(), _p.c_ptr())); - um.remove_one_half_root(_p.size(), _p.c_ptr(), _q); - ENSURE(!um.has_one_half_root(_q.size(), _q.c_ptr())); + ENSURE(um.has_one_half_root(_p.size(), _p.data())); + um.remove_one_half_root(_p.size(), _p.data(), _q); + ENSURE(!um.has_one_half_root(_q.size(), _q.data())); std::cout << "_p: "; um.display(std::cout, _p); std::cout << "\n"; std::cout << "_r: "; um.display(std::cout, _r); std::cout << "\n"; std::cout << "_q: "; um.display(std::cout, _q); std::cout << "\n"; @@ -302,11 +302,11 @@ static void tst_remove_one_half() { p = (((x^5) - 1000000000)^3)*((3*x - 10000000)^2)*((10*x - 632)^2); um.to_numeral_vector(p, _p); - ENSURE(!um.has_one_half_root(_p.size(), _p.c_ptr())); + ENSURE(!um.has_one_half_root(_p.size(), _p.data())); p = (x - 2)*(x - 4)*(x - 8)*(x - 16)*(x - 32)*(x - 64)*(2*x - 1)*(4*x - 1)*(8*x - 1)*(16*x - 1)*(32*x - 1); um.to_numeral_vector(p, _p); - ENSURE(um.has_one_half_root(_p.size(), _p.c_ptr())); + ENSURE(um.has_one_half_root(_p.size(), _p.data())); } template @@ -316,9 +316,9 @@ static void tst_gcd(polynomial_ref const & p, polynomial_ref const & q, pmanager um.to_numeral_vector(q, _q); std::cout << "_p: "; um.display(std::cout, _p); std::cout << "\n"; std::cout << "_q: "; um.display(std::cout, _q); std::cout << std::endl; - um.gcd(_p.size(), _p.c_ptr(), _q.size(), _q.c_ptr(), _r); + um.gcd(_p.size(), _p.data(), _q.size(), _q.data(), _r); std::cout << "gcd: "; um.display(std::cout, _r); std::cout << "\n"; - um.subresultant_gcd(_p.size(), _p.c_ptr(), _q.size(), _q.c_ptr(), _r); + um.subresultant_gcd(_p.size(), _p.data(), _q.size(), _q.data(), _r); std::cout << "_p: "; um.display(std::cout, _p); std::cout << "\n"; std::cout << "_q: "; um.display(std::cout, _q); std::cout << "\n"; std::cout << "subresultant_gcd: "; um.display(std::cout, _r); std::cout << "\n"; @@ -426,7 +426,7 @@ static void tst_ext_gcd() { upolynomial::zp_manager::scoped_numeral_vector A(z13), B(z13), U(z13), V(z13), D(z13); um.to_numeral_vector(a, A); um.to_numeral_vector(b, B); - um.ext_gcd(A.size(), A.c_ptr(), B.size(), B.c_ptr(), U, V, D); + um.ext_gcd(A.size(), A.data(), B.size(), B.data(), U, V, D); std::cout << "A: "; um.display(std::cout, A); std::cout << "\n"; std::cout << "B: "; um.display(std::cout, B); std::cout << "\n"; std::cout << "U: "; um.display(std::cout, U); std::cout << "\n"; @@ -457,7 +457,7 @@ static void tst_ext_gcd_z7() { upolynomial::zp_manager::scoped_numeral_vector A(z7), B(z7), U(z7), V(z7), D(z7); um.to_numeral_vector(a, A); um.to_numeral_vector(b, B); - um.ext_gcd(A.size(), A.c_ptr(), B.size(), B.c_ptr(), U, V, D); + um.ext_gcd(A.size(), A.data(), B.size(), B.data(), U, V, D); std::cout << "A: "; um.display(std::cout, A); std::cout << "\n"; std::cout << "B: "; um.display(std::cout, B); std::cout << "\n"; std::cout << "U: "; um.display(std::cout, U); std::cout << "\n"; @@ -482,7 +482,7 @@ static void tst_sturm() { upolynomial::scoped_numeral_vector _p(um); upolynomial::scoped_upolynomial_sequence seq2(um); um.to_numeral_vector(p, _p); - um.sturm_seq(_p.size(), _p.c_ptr(), seq2); + um.sturm_seq(_p.size(), _p.data(), seq2); std::cout << "upolynomial sturm seq...\n"; um.display(std::cout, seq2); } @@ -494,16 +494,16 @@ static void tst_refinable(polynomial_ref const & p, mpbq_manager & bqm, mpbq & a upolynomial::scoped_numeral_vector _p(um); um.to_numeral_vector(p, _p); std::cout << "before (" << bqm.to_string(a) << ", " << bqm.to_string(b) << ")\n"; - bool r = um.isolating2refinable(_p.size(), _p.c_ptr(), bqm, a, b); + bool r = um.isolating2refinable(_p.size(), _p.data(), bqm, a, b); if (r) { std::cout << "new (" << bqm.to_string(a) << ", " << bqm.to_string(b) << ")\n"; - int sign_a = um.eval_sign_at(_p.size(), _p.c_ptr(), a); - int sign_b = um.eval_sign_at(_p.size(), _p.c_ptr(), b); + int sign_a = um.eval_sign_at(_p.size(), _p.data(), a); + int sign_b = um.eval_sign_at(_p.size(), _p.data(), b); VERIFY(sign_a != 0 && sign_b != 0 && sign_a == -sign_b); } else { std::cout << "new root: " << bqm.to_string(a) << "\n"; - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), a) == 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), a) == 0); } } @@ -561,7 +561,7 @@ static void tst_refine(polynomial_ref const & p, mpbq_manager & bqm, mpbq & a, m upolynomial::scoped_numeral_vector _p(um); um.to_numeral_vector(p, _p); std::cout << "before (" << bqm.to_string(a) << ", " << bqm.to_string(b) << ")\n"; - bool r = um.refine(_p.size(), _p.c_ptr(), bqm, a, b, prec_k); + bool r = um.refine(_p.size(), _p.data(), bqm, a, b, prec_k); if (r) { std::cout << "new (" << bqm.to_string(a) << ", " << bqm.to_string(b) << ")\n"; std::cout << "as decimal: "; bqm.display_decimal(std::cout, a, prec_k); std::cout << "\n"; @@ -608,13 +608,13 @@ static void tst_translate_q() { upolynomial::manager um(rl, nm); upolynomial::scoped_numeral_vector _p(um), _q(um); um.to_numeral_vector(p, _p); - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), mpq(1)) == 0); - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), mpq(2)) == 0); - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), mpq(3)) == 0); - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), mpq(4)) == 0); - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), mpq(-1)) != 0); - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), mpq(5)) != 0); - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), mpq(-2)) != 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), mpq(1)) == 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), mpq(2)) == 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), mpq(3)) == 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), mpq(4)) == 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), mpq(-1)) != 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), mpq(5)) != 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), mpq(-2)) != 0); scoped_mpq c(nm); nm.set(c, 1, 3); scoped_mpq r1(nm); @@ -623,32 +623,32 @@ static void tst_translate_q() { scoped_mpq r2(nm); r2 = 3; r2 -= c; - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), r1) != 0); - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), r2) != 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), r1) != 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), r2) != 0); std::cout << "p: "; um.display(std::cout, _p); std::cout << "\n"; - um.translate_q(_p.size(), _p.c_ptr(), c, _q); + um.translate_q(_p.size(), _p.data(), c, _q); std::cout << "q: "; um.display(std::cout, _q); std::cout << "\n"; - ENSURE(um.eval_sign_at(_q.size(), _q.c_ptr(), mpq(1)) != 0); - ENSURE(um.eval_sign_at(_q.size(), _q.c_ptr(), mpq(2)) != 0); - ENSURE(um.eval_sign_at(_q.size(), _q.c_ptr(), mpq(3)) != 0); - ENSURE(um.eval_sign_at(_q.size(), _q.c_ptr(), mpq(4)) != 0); - ENSURE(um.eval_sign_at(_q.size(), _q.c_ptr(), mpq(-1)) != 0); - ENSURE(um.eval_sign_at(_q.size(), _q.c_ptr(), mpq(5)) != 0); - ENSURE(um.eval_sign_at(_q.size(), _q.c_ptr(), mpq(-2)) != 0); - ENSURE(um.eval_sign_at(_q.size(), _q.c_ptr(), r1) == 0); - ENSURE(um.eval_sign_at(_q.size(), _q.c_ptr(), r2) == 0); - um.p_1_div_x(_p.size(), _p.c_ptr()); + ENSURE(um.eval_sign_at(_q.size(), _q.data(), mpq(1)) != 0); + ENSURE(um.eval_sign_at(_q.size(), _q.data(), mpq(2)) != 0); + ENSURE(um.eval_sign_at(_q.size(), _q.data(), mpq(3)) != 0); + ENSURE(um.eval_sign_at(_q.size(), _q.data(), mpq(4)) != 0); + ENSURE(um.eval_sign_at(_q.size(), _q.data(), mpq(-1)) != 0); + ENSURE(um.eval_sign_at(_q.size(), _q.data(), mpq(5)) != 0); + ENSURE(um.eval_sign_at(_q.size(), _q.data(), mpq(-2)) != 0); + ENSURE(um.eval_sign_at(_q.size(), _q.data(), r1) == 0); + ENSURE(um.eval_sign_at(_q.size(), _q.data(), r2) == 0); + um.p_1_div_x(_p.size(), _p.data()); std::cout << "p: "; um.display(std::cout, _p); std::cout << "\n"; - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), mpq(1)) == 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), mpq(1)) == 0); nm.set(c, 1, 2); - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), c) == 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), c) == 0); nm.set(c, 1, 3); - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), c) == 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), c) == 0); nm.set(c, 1, 4); - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), c) == 0); - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), mpq(2)) != 0); - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), mpq(3)) != 0); - ENSURE(um.eval_sign_at(_p.size(), _p.c_ptr(), mpq(4)) != 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), c) == 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), mpq(2)) != 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), mpq(3)) != 0); + ENSURE(um.eval_sign_at(_p.size(), _p.data(), mpq(4)) != 0); } static void tst_convert_q2bq(unsynch_mpq_manager & m, polynomial_ref const & p, mpq const & a, mpq const & b) { @@ -663,7 +663,7 @@ static void tst_convert_q2bq(unsynch_mpq_manager & m, polynomial_ref const & p, mpbq_manager bqm(m); scoped_mpbq c(bqm); scoped_mpbq d(bqm); - if (!um.convert_q2bq_interval(_p.size(), _p.c_ptr(), a, b, bqm, c, d)) { + if (!um.convert_q2bq_interval(_p.size(), _p.data(), a, b, bqm, c, d)) { std::cout << "found root: " << c << "\n"; } else { @@ -738,7 +738,7 @@ static void tst_sturm2() { upolynomial::scoped_upolynomial_sequence seq2(um); um.to_numeral_vector(p, _p); um.to_numeral_vector(q, _q); - um.sturm_tarski_seq(_p.size(), _p.c_ptr(), _q.size(), _q.c_ptr(), seq2); + um.sturm_tarski_seq(_p.size(), _p.data(), _q.size(), _q.data(), seq2); std::cout << "upolynomial sturm seq...\n"; um.display(std::cout, seq2); @@ -840,7 +840,7 @@ static void tst_exact_div(polynomial_ref const & p1, polynomial_ref const & p2, std::cout << "------\n"; std::cout << "p1: "; um.display(std::cout, _p1); std::cout << "\n"; std::cout << "p2: "; um.display(std::cout, _p2); std::cout << std::endl; - bool res = um.exact_div(_p1.size(), _p1.c_ptr(), _p2.size(), _p2.c_ptr(), _r); + bool res = um.exact_div(_p1.size(), _p1.data(), _p2.size(), _p2.data(), _r); if (res) { std::cout << "r: "; um.display(std::cout, _r); std::cout << "\n"; } @@ -849,7 +849,7 @@ static void tst_exact_div(polynomial_ref const & p1, polynomial_ref const & p2, } std::cout.flush(); ENSURE(res == expected); - ENSURE(expected == um.divides(_p1.size(), _p1.c_ptr(), _p2.size(), _p2.c_ptr())); + ENSURE(expected == um.divides(_p1.size(), _p1.data(), _p2.size(), _p2.data())); ENSURE(!expected || um.eq(_r, _q)); } @@ -1002,9 +1002,9 @@ static void tst_rem(polynomial_ref const & p, polynomial_ref const & q, polynomi upolynomial::scoped_numeral_vector _p(um), _q(um), _r(um); um.to_numeral_vector(p, _p); um.to_numeral_vector(q, _q); - um.rem(_p.size(), _p.c_ptr(), _q.size(), _q.c_ptr(), _r); + um.rem(_p.size(), _p.data(), _q.size(), _q.data(), _r); polynomial_ref r(p.m()); - r = p.m().to_polynomial(_r.size(), _r.c_ptr(), 0); + r = p.m().to_polynomial(_r.size(), _r.data(), 0); std::cout << "r: " << r << std::endl; ENSURE(eq(expected, r)); } @@ -1030,7 +1030,7 @@ static void tst_lower_bound(polynomial_ref const & p) { upolynomial::scoped_numeral_vector _p(um); um.to_numeral_vector(p, _p); std::cout << "_p: "; um.display(std::cout, _p); std::cout << "\n"; - unsigned k = um.nonzero_root_lower_bound(_p.size(), _p.c_ptr()); + unsigned k = um.nonzero_root_lower_bound(_p.size(), _p.data()); std::cout << "_p: "; um.display(std::cout, _p); std::cout << "\n"; std::cout << "k: " << k << "\n"; } diff --git a/src/test/var_subst.cpp b/src/test/var_subst.cpp index 068e29930..12646798f 100644 --- a/src/test/var_subst.cpp +++ b/src/test/var_subst.cpp @@ -50,7 +50,7 @@ void tst_instantiate(ast_manager & m, expr * f) { expr_ref_vector cnsts(m); 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.c_ptr()); + 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";); } } @@ -82,7 +82,7 @@ void tst_subst(ast_manager& m) { sub1.push_back(x); sub1.push_back(y); // replace #1 -> #2, #2 -> #1 - e3 = subst(e2, 2, sub1.c_ptr()); + e3 = subst(e2, 2, sub1.data()); std::cout << mk_pp(e2, m) << "\n"; std::cout << mk_pp(e3, m) << "\n"; std::cout << mk_pp(t1, m) << "\n"; @@ -90,7 +90,7 @@ void tst_subst(ast_manager& m) { // replace #2 -> #3, #3 -> #2 e2 = m.mk_forall(2, ss, names, e1); - e3 = subst(e2, 2, sub1.c_ptr()); + e3 = subst(e2, 2, sub1.data()); std::cout << mk_pp(e2, m) << "\n"; std::cout << mk_pp(e3, m) << "\n"; std::cout << mk_pp(t2, m) << "\n"; diff --git a/src/util/array.h b/src/util/array.h index 8cdd6404b..6c04c10d2 100644 --- a/src/util/array.h +++ b/src/util/array.h @@ -69,7 +69,7 @@ private: } public: - typedef T data; + typedef T data_t; typedef T * iterator; typedef const T * const_iterator; @@ -181,8 +181,8 @@ public: return m_data + size(); } - T const * c_ptr() const { return m_data; } - T * c_ptr() { return m_data; } + T const * data() const { return m_data; } + T * data() { return m_data; } void swap(array & other) { std::swap(m_data, other.m_data); diff --git a/src/util/buffer.h b/src/util/buffer.h index 22cf17ada..e1721f94e 100644 --- a/src/util/buffer.h +++ b/src/util/buffer.h @@ -69,7 +69,7 @@ protected: } public: - typedef T data; + typedef T data_t; typedef T * iterator; typedef const T * const_iterator; @@ -184,7 +184,7 @@ public: return m_buffer[m_pos - 1]; } - T * c_ptr() const { + T * data() const { return m_buffer; } @@ -195,7 +195,7 @@ public: } void append(const buffer& source) { - append(source.size(), source.c_ptr()); + append(source.size(), source.data()); } T & operator[](unsigned idx) { diff --git a/src/util/container_util.h b/src/util/container_util.h index fe70e9fd3..b4319f24f 100644 --- a/src/util/container_util.h +++ b/src/util/container_util.h @@ -85,7 +85,7 @@ void print_container(const T & cont, std::ostream & out) { template void print_container(const ref_vector & cont, std::ostream & out) { - print_container(cont.c_ptr(), cont.c_ptr() + cont.size(), out); + print_container(cont.data(), cont.data() + cont.size(), out); } template diff --git a/src/util/hash.h b/src/util/hash.h index 5643954e2..f32cd09ed 100644 --- a/src/util/hash.h +++ b/src/util/hash.h @@ -129,33 +129,33 @@ template struct default_kind_hash_proc { unsigned operator()(Composite const & c) const { return 17; } }; struct int_hash { - typedef int data; + typedef int data_t; unsigned operator()(int x) const { return static_cast(x); } }; struct unsigned_hash { - typedef unsigned data; + typedef unsigned data_t; unsigned operator()(unsigned x) const { return x; } }; struct size_t_hash { - typedef size_t data; + typedef size_t data_t; unsigned operator()(size_t x) const { return static_cast(x); } }; struct uint64_hash { - typedef uint64_t data; + typedef uint64_t data_t; unsigned operator()(uint64_t x) const { return static_cast(x); } }; struct bool_hash { - typedef bool data; + typedef bool data_t; unsigned operator()(bool x) const { return static_cast(x); } }; template struct obj_hash { - typedef T data; + typedef T data_t; unsigned operator()(const T & e) const { return e.hash(); } @@ -163,7 +163,7 @@ struct obj_hash { template struct obj_ptr_hash { - typedef T * data; + typedef T * data_t; unsigned operator()(T * a) const { return a->hash(); } @@ -171,8 +171,8 @@ struct obj_ptr_hash { template struct obj_ptr_pair_hash { - typedef std::pair data; - unsigned operator()(data const & d) const { + typedef std::pair data_t; + unsigned operator()(data_t const & d) const { return combine_hash(d.first->hash(), d.second->hash()); } }; @@ -197,22 +197,22 @@ template struct triple_hash : private Hash1 { Hash2 m_hash2; Hash3 m_hash3; - typedef triple data; + typedef triple data_t; triple_hash(Hash1 const & h1 = Hash1(), Hash2 const & h2 = Hash2(), Hash3 const & h3 = Hash3()): Hash1(h1), m_hash2(h2), m_hash3(h3) { } - unsigned operator()(std::pair const & p) const { + unsigned operator()(std::pair const & p) const { return combine_hash(combine_hash(Hash1::operator()(p.first), m_hash2.operator()(p.second)), m_hash3.operator()(p.third)); } }; template struct obj_ptr_triple_hash { - typedef triple data; - unsigned operator()(data const & d) const { + typedef triple data_t; + unsigned operator()(data_t const & d) const { return combine_hash(combine_hash(d.first->hash(), d.second->hash()), d.third->hash()); } }; @@ -220,13 +220,13 @@ struct obj_ptr_triple_hash { template struct pair_hash : private Hash1 { Hash2 m_hash2; - typedef std::pair data; + typedef std::pair data_t; pair_hash(Hash1 const & h1 = Hash1(), Hash2 const & h2 = Hash2()): Hash1(h1), m_hash2(h2) { } - unsigned operator()(std::pair const & p) const { + unsigned operator()(std::pair const & p) const { return combine_hash(Hash1::operator()(p.first), m_hash2.operator()(p.second)); } }; @@ -238,7 +238,7 @@ inline unsigned get_ptr_hash(T * ptr) { template struct ptr_hash { - typedef T * data; + typedef T * data_t; unsigned operator()(T * ptr) const { return get_ptr_hash(ptr); } diff --git a/src/util/mpff.cpp b/src/util/mpff.cpp index a46757059..547407ce0 100644 --- a/src/util/mpff.cpp +++ b/src/util/mpff.cpp @@ -345,8 +345,8 @@ void mpff_manager::set_core(mpff & n, mpz_manager & m, mpz const & v) { 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.c_ptr()); - shl(w_sz, w.c_ptr(), num_leading_zeros, w_sz, w.c_ptr()); + unsigned num_leading_zeros = nlz(w_sz, w.data()); + shl(w_sz, w.data(), num_leading_zeros, w_sz, w.data()); unsigned * s = sig(n); unsigned i = m_precision; unsigned j = w_sz; @@ -685,7 +685,7 @@ void mpff_manager::add_sub(bool is_sub, mpff const & a, mpff const & b, mpff & c // Make sure that a and b have the same exponent. if (exp_a > exp_b) { unsigned shift = (unsigned)exp_a - (unsigned)exp_b; - n_sig_b = m_buffers[0].c_ptr(); + n_sig_b = m_buffers[0].data(); shr(m_precision, sig_b, shift, m_precision, n_sig_b); if (sgn_b != m_to_plus_inf && has_one_at_first_k_bits(m_precision, sig_b, shift)) { // Precision was lost when normalizing the significand. @@ -702,7 +702,7 @@ void mpff_manager::add_sub(bool is_sub, mpff const & a, mpff const & b, mpff & c // Compute c if (sgn_a == sgn_b) { c.m_sign = sgn_a; - unsigned * sig_r = m_buffers[1].c_ptr(); + unsigned * sig_r = m_buffers[1].data(); size_t r_sz; m_mpn_manager.add(sig_a, m_precision, n_sig_b, m_precision, sig_r, m_precision + 1, &r_sz); SASSERT(r_sz <= m_precision + 1); @@ -796,7 +796,7 @@ void mpff_manager::mul(mpff const & a, mpff const & b, mpff & c) { int64_t exp_b = b.m_exponent; int64_t exp_c = exp_a + exp_b; // store result in m_buffers[0] - unsigned * r = m_buffers[0].c_ptr(); + unsigned * r = m_buffers[0].data(); m_mpn_manager.mul(sig(a), m_precision, sig(b), m_precision, r); // r has 2*m_precision_bits bits unsigned num_leading_zeros = nlz(m_precision*2, r); @@ -854,10 +854,10 @@ void mpff_manager::div(mpff const & a, mpff const & b, mpff & c) { exp_c -= m_precision_bits; // we will multiplying (shifting) a by 2^m_precision_bits. // copy a to buffer 0, and shift by m_precision_bits to_buffer_shifting(0, a); - unsigned * _a = m_buffers[0].c_ptr(); - unsigned * q = m_buffers[1].c_ptr(); + unsigned * _a = m_buffers[0].data(); + unsigned * q = m_buffers[1].data(); unsigned q_sz = m_precision + 1; // 2*m_precision - m_precision + 1 - unsigned * r = m_buffers[2].c_ptr(); + unsigned * r = m_buffers[2].data(); unsigned r_sz = m_precision; SASSERT(!::is_zero(2*m_precision, _a)); SASSERT(!::is_zero(m_precision, sig(b))); @@ -1094,7 +1094,7 @@ void mpff_manager::to_mpz_core(mpff const & n, mpz_manager & m, mpz & t) if (exp < 0) { SASSERT(exp > -static_cast(m_precision_bits)); to_buffer(0, n); - unsigned * b = m_buffers[0].c_ptr(); + unsigned * b = m_buffers[0].data(); shr(m_precision, b, -exp, m_precision, b); m.set_digits(t, m_precision, b); } @@ -1127,7 +1127,7 @@ void mpff_manager::to_mpq_core(mpff const & n, mpq_manager & m, mpq & t) 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].c_ptr(); + unsigned * b = m_buffers[0].data(); shr(m_precision, b, -exp, m_precision, b); m.set(t, m_precision, b); } @@ -1185,7 +1185,7 @@ void mpff_manager::display(std::ostream & out, mpff const & n) const { out << "-"; to_buffer_ext(0, n); svector & u_buffer = const_cast(this)->m_buffers[0]; - int num_trailing_zeros = ntz(m_precision, u_buffer.c_ptr()); + int num_trailing_zeros = ntz(m_precision, u_buffer.data()); int shift = 0; int64_t exp = n.m_exponent; // use int64_t to avoid -INT_MIN == INT_MIN issue if (exp < 0) { @@ -1199,9 +1199,9 @@ void mpff_manager::display(std::ostream & out, mpff const & n) const { } } if (shift > 0) - shr(m_precision, u_buffer.c_ptr(), shift, u_buffer.c_ptr()); + shr(m_precision, u_buffer.data(), shift, u_buffer.data()); sbuffer str_buffer(11*m_precision, 0); - out << m_mpn_manager.to_string(u_buffer.c_ptr(), m_precision, str_buffer.begin(), str_buffer.size()); + out << m_mpn_manager.to_string(u_buffer.data(), m_precision, str_buffer.begin(), str_buffer.size()); if (exp > 0) { if (exp <= 63) { uint64_t _exp = 1; @@ -1252,9 +1252,9 @@ void mpff_manager::display_decimal(std::ostream & out, mpff const & n, unsigned unsigned * s = sig(n); for (unsigned i = 0; i < m_precision; i++) buffer.push_back(s[i]); - shr(buffer.size(), buffer.c_ptr(), shift, buffer.size(), buffer.c_ptr()); + shr(buffer.size(), buffer.data(), shift, buffer.size(), buffer.data()); sbuffer str_buffer(11*buffer.size(), 0); - out << m_mpn_manager.to_string(buffer.c_ptr(), buffer.size(), str_buffer.begin(), str_buffer.size()); + out << m_mpn_manager.to_string(buffer.data(), buffer.size(), str_buffer.begin(), str_buffer.size()); } else { sbuffer buffer1, buffer2; @@ -1277,19 +1277,19 @@ void mpff_manager::display_decimal(std::ostream & out, mpff const & n, unsigned sbuffer pw_buffer; pw_buffer.resize(num_words, 0); pw_buffer[0] = 1; - shl(num_words, pw_buffer.c_ptr(), static_cast(exp), num_words, pw_buffer.c_ptr()); + shl(num_words, pw_buffer.data(), static_cast(exp), num_words, pw_buffer.data()); if (num_words > m_precision) { out << "0"; } else { - m_mpn_manager.div(buffer1.c_ptr(), m_precision, - pw_buffer.c_ptr(), num_words, - buffer3.c_ptr(), - buffer2.c_ptr()); + m_mpn_manager.div(buffer1.data(), m_precision, + pw_buffer.data(), num_words, + buffer3.data(), + buffer2.data()); sbuffer str_buffer(11*buffer3.size(), 0); - out << m_mpn_manager.to_string(buffer3.c_ptr(), buffer3.size(), str_buffer.begin(), str_buffer.size()); - SASSERT(!::is_zero(buffer2.size(), buffer2.c_ptr())); // otherwise n is an integer - ::copy(buffer2.size(), buffer2.c_ptr(), buffer1.size(), buffer1.c_ptr()); + out << m_mpn_manager.to_string(buffer3.data(), buffer3.size(), str_buffer.begin(), str_buffer.size()); + SASSERT(!::is_zero(buffer2.size(), buffer2.data())); // otherwise n is an integer + ::copy(buffer2.size(), buffer2.data(), buffer1.size(), buffer1.data()); } out << "."; // buffer1 contain the fractional part @@ -1304,7 +1304,7 @@ void mpff_manager::display_decimal(std::ostream & out, mpff const & n, unsigned return; } i = i + 1; - m_mpn_manager.mul(buffer1.c_ptr(), sz1, &ten, 1, buffer2.c_ptr()); + m_mpn_manager.mul(buffer1.data(), sz1, &ten, 1, buffer2.data()); unsigned sz2 = sz1 + 1; while (sz2 > 0 && buffer2[sz2-1] == 0) --sz2; @@ -1312,19 +1312,19 @@ void mpff_manager::display_decimal(std::ostream & out, mpff const & n, unsigned if (num_words > sz2) { out << "0"; sz1 = sz2; - ::copy(sz2, buffer2.c_ptr(), sz1, buffer1.c_ptr()); - SASSERT(sz1 == 0 || !::is_zero(sz1, buffer1.c_ptr())); + ::copy(sz2, buffer2.data(), sz1, buffer1.data()); + SASSERT(sz1 == 0 || !::is_zero(sz1, buffer1.data())); } else { - m_mpn_manager.div(buffer2.c_ptr(), sz2, - pw_buffer.c_ptr(), num_words, - buffer3.c_ptr(), - buffer1.c_ptr()); + m_mpn_manager.div(buffer2.data(), sz2, + pw_buffer.data(), num_words, + buffer3.data(), + buffer1.data()); out << buffer3[0]; sz1 = num_words; while (sz1 > 0 && buffer1[sz1-1] == 0) --sz1; - SASSERT(sz1 == 0 || !::is_zero(sz1, buffer1.c_ptr())); + SASSERT(sz1 == 0 || !::is_zero(sz1, buffer1.data())); } } } @@ -1335,7 +1335,7 @@ void mpff_manager::display_smt2(std::ostream & out, mpff const & n, bool decimal out << "(- "; to_buffer_ext(0, n); svector & u_buffer = const_cast(this)->m_buffers[0]; - int num_trailing_zeros = ntz(m_precision, u_buffer.c_ptr()); + int num_trailing_zeros = ntz(m_precision, u_buffer.data()); int shift = 0; int64_t exp = n.m_exponent; if (exp < 0) { @@ -1349,7 +1349,7 @@ void mpff_manager::display_smt2(std::ostream & out, mpff const & n, bool decimal } } if (shift > 0) - shr(m_precision, u_buffer.c_ptr(), shift, u_buffer.c_ptr()); + shr(m_precision, u_buffer.data(), shift, u_buffer.data()); if (exp > 0) out << "(* "; @@ -1357,7 +1357,7 @@ void mpff_manager::display_smt2(std::ostream & out, mpff const & n, bool decimal out << "(/ "; sbuffer str_buffer(11*m_precision, 0); - out << m_mpn_manager.to_string(u_buffer.c_ptr(), m_precision, str_buffer.begin(), str_buffer.size()); + out << m_mpn_manager.to_string(u_buffer.data(), m_precision, str_buffer.begin(), str_buffer.size()); if (decimal) out << ".0"; if (exp != 0) { diff --git a/src/util/mpff.h b/src/util/mpff.h index cb352cec8..f766236f8 100644 --- a/src/util/mpff.h +++ b/src/util/mpff.h @@ -122,7 +122,7 @@ class mpff_manager { mpff m_one; mpn_manager m_mpn_manager; - unsigned * sig(mpff const & n) const { return m_significands.c_ptr() + (n.m_sig_idx * m_precision); } + unsigned * sig(mpff const & n) const { return m_significands.data() + (n.m_sig_idx * m_precision); } void ensure_capacity(unsigned sig_idx) { while (sig_idx >= m_capacity) diff --git a/src/util/mpfx.cpp b/src/util/mpfx.cpp index 8595e0185..98d05f66d 100644 --- a/src/util/mpfx.cpp +++ b/src/util/mpfx.cpp @@ -264,7 +264,7 @@ void mpfx_manager::set_core(mpfx & n, mpz_manager & m, mpz const & v) { unsigned * w = words(n); for (unsigned i = 0; i < m_frac_part_sz; i++) w[i] = 0; - ::copy(sz, m_tmp_digits.c_ptr(), m_int_part_sz, w + m_frac_part_sz); + ::copy(sz, m_tmp_digits.data(), m_int_part_sz, w + m_frac_part_sz); } SASSERT(check(n)); } @@ -303,7 +303,7 @@ void mpfx_manager::set_core(mpfx & n, mpq_manager & m, mpq const & v) { if (sz > m_total_sz) throw overflow_exception(); unsigned * w = words(n); - ::copy(sz, m_tmp_digits.c_ptr(), m_total_sz, w); + ::copy(sz, m_tmp_digits.data(), m_total_sz, w); } SASSERT(check(n)); } @@ -429,7 +429,7 @@ void mpfx_manager::mul(mpfx const & a, mpfx const & b, mpfx & c) { else { allocate_if_needed(c); c.m_sign = a.m_sign ^ b.m_sign; - unsigned * r = m_buffer0.c_ptr(); + unsigned * r = m_buffer0.data(); m_mpn_manager.mul(words(a), m_total_sz, words(b), m_total_sz, r); // round result unsigned * _r = r + m_frac_part_sz; @@ -460,7 +460,7 @@ void mpfx_manager::div(mpfx const & a, mpfx const & b, mpfx & c) { allocate_if_needed(c); c.m_sign = a.m_sign ^ b.m_sign; unsigned * w_a = words(a); - unsigned * w_a_shft = m_buffer0.c_ptr(); + unsigned * w_a_shft = m_buffer0.data(); unsigned a_shft_sz = sz(w_a) + m_frac_part_sz; // copy a to buffer 0, and shift by m_frac_part_sz for (unsigned i = 0; i < m_frac_part_sz; i++) @@ -469,7 +469,7 @@ void mpfx_manager::div(mpfx const & a, mpfx const & b, mpfx & c) { w_a_shft[i+m_frac_part_sz] = w_a[i]; unsigned * w_b = words(b); unsigned b_sz = sz(w_b); - unsigned * w_q = m_buffer1.c_ptr(); + unsigned * w_q = m_buffer1.data(); if (b_sz > a_shft_sz) { if ((c.m_sign == 1) != m_to_plus_inf) set_epsilon(c); @@ -478,7 +478,7 @@ void mpfx_manager::div(mpfx const & a, mpfx const & b, mpfx & c) { } else { unsigned q_sz = a_shft_sz - b_sz + 1; - unsigned * w_r = m_buffer2.c_ptr(); + unsigned * w_r = m_buffer2.data(); unsigned r_sz = b_sz; m_mpn_manager.div(w_a_shft, a_shft_sz, w_b, b_sz, @@ -811,7 +811,7 @@ void mpfx_manager::display_smt2(std::ostream & out, mpfx const & n) const { out << m_mpn_manager.to_string(w, sz, str_buffer.begin(), str_buffer.size()); if (!is_int(n)) { out << " "; - unsigned * w = m_buffer0.c_ptr(); + unsigned * w = m_buffer0.data(); for (unsigned i = 0; i < m_frac_part_sz; i++) w[i] = 0; w[m_frac_part_sz] = 1; @@ -831,10 +831,10 @@ void mpfx_manager::display_decimal(std::ostream & out, mpfx const & n, unsigned out << m_mpn_manager.to_string(w + m_frac_part_sz, m_int_part_sz, str_buffer.begin(), str_buffer.size()); if (!is_int(n)) { out << "."; - unsigned * frac = m_buffer0.c_ptr(); + unsigned * frac = m_buffer0.data(); ::copy(m_frac_part_sz, w, m_frac_part_sz, frac); unsigned ten = 10; - unsigned * n_frac = m_buffer1.c_ptr(); + unsigned * n_frac = m_buffer1.data(); bool frac_is_zero = false; unsigned i = 0; while (!frac_is_zero) { diff --git a/src/util/mpfx.h b/src/util/mpfx.h index 52775de2a..0834995a9 100644 --- a/src/util/mpfx.h +++ b/src/util/mpfx.h @@ -90,7 +90,7 @@ class mpfx_manager { mpfx m_one; mpn_manager m_mpn_manager; - unsigned * words(mpfx const & n) const { return m_words.c_ptr() + (n.m_sig_idx * m_total_sz); } + unsigned * words(mpfx const & n) const { return m_words.data() + (n.m_sig_idx * m_total_sz); } unsigned sz(unsigned * ws) const; void ensure_capacity(unsigned sig_idx) { diff --git a/src/util/mpn.cpp b/src/util/mpn.cpp index d0615f31d..f36dd3d3d 100644 --- a/src/util/mpn.cpp +++ b/src/util/mpn.cpp @@ -201,14 +201,14 @@ bool mpn_manager::div(mpn_digit const * numer, size_t const lnum, #ifdef Z3DEBUG mpn_sbuffer temp(lnum+1, 0); - mul(quot, lnum-lden+1, denom, lden, temp.c_ptr()); + mul(quot, lnum-lden+1, denom, lden, temp.data()); size_t real_size; - add(temp.c_ptr(), lnum, rem, lden, temp.c_ptr(), lnum+1, &real_size); + add(temp.data(), lnum, rem, lden, temp.data(), lnum+1, &real_size); bool ok = true; for (size_t 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.c_ptr(), 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 @@ -249,8 +249,8 @@ size_t mpn_manager::div_normalize(mpn_digit const * numer, size_t const lnum, d = 0; } - TRACE("mpn_norm", tout << "Normalized: n_numer="; display_raw(tout, n_numer.c_ptr(), n_numer.size()); - tout << " n_denom="; display_raw(tout, n_denom.c_ptr(), n_denom.size()); tout << std::endl; ); + 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; } @@ -292,7 +292,7 @@ bool mpn_manager::div_1(mpn_sbuffer & numer, mpn_digit const denom, mpn_double_digit r_hat = temp % (mpn_double_digit) denom; tout << "j=" << j << " q_hat=" << q_hat << " r_hat=" << r_hat; tout << " ms=" << ms; - tout << " new numer="; display_raw(tout, numer.c_ptr(), numer.size()); + tout << " new numer="; display_raw(tout, numer.data(), numer.size()); tout << " borrow=" << borrow; tout << std::endl; ); } @@ -331,20 +331,20 @@ bool mpn_manager::div_n(mpn_sbuffer & numer, mpn_sbuffer const & denom, // Replace numer[j+n]...numer[j] with // numer[j+n]...numer[j] - q * (denom[n-1]...denom[0]) mpn_digit q_hat_small = (mpn_digit)q_hat; - mul(&q_hat_small, 1, denom.c_ptr(), n, ms.c_ptr()); - sub(&numer[j], n+1, ms.c_ptr(), n+1, &numer[j], &borrow); + mul(&q_hat_small, 1, denom.data(), n, ms.data()); + sub(&numer[j], n+1, ms.data(), n+1, &numer[j], &borrow); quot[j] = q_hat_small; if (borrow) { quot[j]--; ab.resize(n+2); size_t real_size; - add(denom.c_ptr(), n, &numer[j], n+1, ab.c_ptr(), n+2, &real_size); + add(denom.data(), n, &numer[j], n+1, ab.data(), n+2, &real_size); for (size_t i = 0; i < n+1; i++) numer[j+i] = ab[i]; } TRACE("mpn_div", tout << "q_hat=" << q_hat << " r_hat=" << r_hat; - tout << " ms="; display_raw(tout, ms.c_ptr(), n); - tout << " new numer="; display_raw(tout, numer.c_ptr(), m+n+1); + tout << " ms="; display_raw(tout, ms.data(), n); + tout << " new numer="; display_raw(tout, numer.data(), m+n+1); tout << " borrow=" << borrow; tout << std::endl; ); } diff --git a/src/util/numeral_buffer.h b/src/util/numeral_buffer.h index a0791f42a..5bd678d78 100644 --- a/src/util/numeral_buffer.h +++ b/src/util/numeral_buffer.h @@ -26,7 +26,7 @@ class numeral_buffer { svector m_buffer; public: typedef Numeral numeral; - typedef Numeral data; + typedef Numeral data_t; typedef NumeralManager manager; numeral_buffer(NumeralManager & m):m_manager(m) {} @@ -75,7 +75,7 @@ public: m_buffer.reset(); } - Numeral * c_ptr() { return m_buffer.c_ptr(); } + Numeral * data() { return m_buffer.data(); } void reserve(unsigned sz) { m_buffer.reserve(sz); diff --git a/src/util/params.cpp b/src/util/params.cpp index 79d2f0cea..1819684e0 100644 --- a/src/util/params.cpp +++ b/src/util/params.cpp @@ -105,7 +105,7 @@ struct param_descrs::imp { if (!period) return false; svector prefix_((unsigned)(period-str), str); prefix_.push_back(0); - prefix = symbol(prefix_.c_ptr()); + prefix = symbol(prefix_.data()); suffix = symbol(period + 1); return true; } diff --git a/src/util/ref_buffer.h b/src/util/ref_buffer.h index 00350c5bc..2833effe4 100644 --- a/src/util/ref_buffer.h +++ b/src/util/ref_buffer.h @@ -43,7 +43,7 @@ protected: } public: - typedef T * data; + typedef T * data_t; ref_buffer_core(Ref const & r = Ref()): Ref(r) { @@ -79,16 +79,16 @@ public: return m_buffer.back(); } - T ** c_ptr() const { - return m_buffer.c_ptr(); + T ** data() const { + return m_buffer.data(); } T * operator[](unsigned idx) const { return m_buffer[idx]; } - T* const* begin() const { return c_ptr(); } - T* const* end() const { return c_ptr() + size(); } + T* const* begin() const { return data(); } + T* const* end() const { return data() + size(); } void set(unsigned idx, T * n) { inc_ref(n); @@ -121,7 +121,7 @@ public: } void append(ref_buffer_core const & other) { - append(other.size(), other.c_ptr()); + append(other.size(), other.data()); } void resize(unsigned sz) { diff --git a/src/util/ref_pair_vector.h b/src/util/ref_pair_vector.h index fb8769a53..489767912 100644 --- a/src/util/ref_pair_vector.h +++ b/src/util/ref_pair_vector.h @@ -45,7 +45,7 @@ protected: } public: - typedef T * data; + typedef T * data_t; ref_pair_vector_core(Ref const & r = Ref()):Ref(r) {} @@ -127,7 +127,7 @@ public: elem_t const& get(unsigned idx) const { return m_nodes[idx]; } - elem_t const * c_ptr() const { return m_nodes.begin(); } + elem_t const * data() const { return m_nodes.begin(); } typedef elem_t const* iterator; diff --git a/src/util/ref_vector.h b/src/util/ref_vector.h index 3b7a9b3e9..27d6e7e3a 100644 --- a/src/util/ref_vector.h +++ b/src/util/ref_vector.h @@ -46,7 +46,7 @@ protected: } }; public: - typedef T * data; + typedef T * data_t; ref_vector_core() = default; ref_vector_core(Ref const & r) : Ref(r) {} @@ -130,11 +130,11 @@ public: T * get(unsigned idx, T * d) const { return m_nodes.get(idx, d); } - T * const * c_ptr() const { return m_nodes.begin(); } + T * const * data() const { return m_nodes.begin(); } typedef T* const* iterator; - T ** c_ptr() { return m_nodes.begin(); } + T ** data() { return m_nodes.begin(); } unsigned hash() const { unsigned sz = size(); diff --git a/src/util/sexpr.cpp b/src/util/sexpr.cpp index 53de22d79..bebce4273 100644 --- a/src/util/sexpr.cpp +++ b/src/util/sexpr.cpp @@ -169,7 +169,7 @@ void sexpr::display_atom(std::ostream & out) const { } std::reverse(buf.begin(), buf.end()); buf.push_back(0); - out << buf.c_ptr(); + out << buf.data(); break; } case sexpr::kind_t::STRING: diff --git a/src/util/sorting_network.h b/src/util/sorting_network.h index 9378fc757..d159104f6 100644 --- a/src/util/sorting_network.h +++ b/src/util/sorting_network.h @@ -241,7 +241,7 @@ Notes: return mk_or(n, xs); } if (dualize(k, n, xs, in)) { - return le(full, k, in.size(), in.c_ptr()); + return le(full, k, in.size(), in.data()); } else { switch (m_cfg.m_encoding) { @@ -272,7 +272,7 @@ Notes: SASSERT(k < n); literal_vector in, out; if (dualize(k, n, xs, in)) { - return ge(full, k, n, in.c_ptr()); + return ge(full, k, n, in.data()); } else if (k == 1) { literal_vector ors; @@ -322,7 +322,7 @@ Notes: SASSERT(k <= n); literal_vector in, out; if (dualize(k, n, xs, in)) { - return eq(full, k, n, in.c_ptr()); + return eq(full, k, n, in.data()); } else if (k == 1) { // scoped_stats _ss(m_stats, k, n); @@ -526,12 +526,12 @@ Notes: ors.push_back(mk_and(x[i], mk_not(c), mk_not(y[i]))); ors.push_back(mk_and(y[i], mk_not(c), mk_not(x[i]))); ors.push_back(mk_and(c, x[i], y[i])); - literal o = mk_or(4, ors.c_ptr()); + literal o = mk_or(4, ors.data()); out.push_back(o); ors[0] = mk_and(c, x[i]); ors[1] = mk_and(c, y[i]); ors[2] = mk_and(x[i], y[i]); - c = mk_or(3, ors.c_ptr()); + c = mk_or(3, ors.data()); } return c; } @@ -629,7 +629,7 @@ Notes: switch (j) { case 0: return ctx.mk_false(); case 1: return ors[0]; - default: return ctx.mk_max(ors.size(), ors.c_ptr()); + default: return ctx.mk_max(ors.size(), ors.data()); } } @@ -643,7 +643,7 @@ Notes: } literal mk_or(literal_vector const& ors) { - return mk_or(ors.size(), ors.c_ptr()); + return mk_or(ors.size(), ors.data()); } literal mk_not(literal lit) { @@ -688,7 +688,7 @@ Notes: case 2: return mk_min(ands[0], ands[1]); default: { - return ctx.mk_min(ands.size(), ands.c_ptr()); + return ctx.mk_min(ands.size(), ands.data()); } } } @@ -718,7 +718,7 @@ Notes: r1 = mk_and(r1, mk_or(ors)); } else { - add_implies_or(r1, ors.size(), ors.c_ptr()); + add_implies_or(r1, ors.size(), ors.data()); } return r1; } @@ -738,9 +738,9 @@ Notes: if (n + 1 == inc_size) ++inc_size; for (unsigned i = 0; i < n; i += inc_size) { unsigned inc = std::min(n - i, inc_size); - mk_at_most_1_small(full, inc, in.c_ptr() + i, result, ands); + mk_at_most_1_small(full, inc, in.data() + i, result, ands); if (use_ors || n > inc_size) { - ors.push_back(mk_or(inc, in.c_ptr() + i)); + ors.push_back(mk_or(inc, in.data() + i)); } } if (n <= inc_size) { @@ -902,8 +902,8 @@ Notes: literal_vector ands; for (unsigned i = 0; i < n; i += inc_size) { unsigned inc = std::min(n - i, inc_size); - mk_at_most_1_small(full, inc, in.c_ptr() + i, result, ands); - ors.push_back(mk_or(inc, in.c_ptr() + i)); + mk_at_most_1_small(full, inc, in.data() + i, result, ands); + ors.push_back(mk_or(inc, in.data() + i)); } unsigned nbits = 0; @@ -989,7 +989,7 @@ Notes: add_clause(2, lits); } void add_clause(literal_vector const& lits) { - add_clause(lits.size(), lits.c_ptr()); + add_clause(lits.size(), lits.data()); } void add_clause(unsigned n, literal const* ls) { for (unsigned i = 0; i < n; ++i) { @@ -998,7 +998,7 @@ Notes: m_stats.m_num_compiled_clauses++; m_stats.m_num_clause_vars += n; literal_vector tmp(n, ls); - ctx.mk_clause(n, tmp.c_ptr()); + ctx.mk_clause(n, tmp.data()); } // y1 <= mk_max(x1,x2) @@ -1048,7 +1048,7 @@ Notes: unsigned half = n/2; // TBD card(k, half, xs, out1); card(k, n-half, xs + half, out2); - smerge(k, out1.size(), out1.c_ptr(), out2.size(), out2.c_ptr(), out); + smerge(k, out1.size(), out1.data(), out2.size(), out2.data(), out); } TRACE("pb_verbose", tout << "card k: " << k << " n: " << n << "\n"; //pp(tout << "in:", n, xs) << "\n"; @@ -1109,10 +1109,10 @@ Notes: split(b, bs, even_b, odd_b); SASSERT(!even_a.empty()); SASSERT(!even_b.empty()); - merge(even_a.size(), even_a.c_ptr(), - even_b.size(), even_b.c_ptr(), out1); - merge(odd_a.size(), odd_a.c_ptr(), - odd_b.size(), odd_b.c_ptr(), out2); + merge(even_a.size(), even_a.data(), + even_b.size(), even_b.data(), out1); + merge(odd_a.size(), odd_a.data(), + odd_b.size(), odd_b.data(), out2); interleave(out1, out2, out); } TRACE("pb_verbose", tout << "merge a: " << a << " b: " << b << " "; @@ -1213,8 +1213,8 @@ Notes: unsigned half = n/2; // TBD sorting(half, xs, out1); sorting(n-half, xs+half, out2); - merge(out1.size(), out1.c_ptr(), - out2.size(), out2.c_ptr(), + merge(out1.size(), out1.data(), + out2.size(), out2.data(), out); } break; @@ -1305,10 +1305,10 @@ Notes: else { c1 = (c + 1)/2; c2 = (c - 1)/2; } - smerge(c1, even_a.size(), even_a.c_ptr(), - even_b.size(), even_b.c_ptr(), out1); - smerge(c2, odd_a.size(), odd_a.c_ptr(), - odd_b.size(), odd_b.c_ptr(), out2); + smerge(c1, even_a.size(), even_a.data(), + even_b.size(), even_b.data(), out1); + smerge(c2, odd_a.size(), odd_a.data(), + odd_b.size(), odd_b.data(), out2); SASSERT(out1.size() == std::min(even_a.size()+even_b.size(), c1)); SASSERT(out2.size() == std::min(odd_a.size()+odd_b.size(), c2)); literal y; diff --git a/src/util/statistics.cpp b/src/util/statistics.cpp index af4ba5d61..632a7f750 100644 --- a/src/util/statistics.cpp +++ b/src/util/statistics.cpp @@ -46,7 +46,7 @@ void statistics::reset() { template static void mk_map(V const & v, M & m) { for (auto const& p : v) { - typename V::data::second_type val; + typename V::data_t::second_type val; if (m.find(p.first, val)) m.insert(p.first, p.second + val); else diff --git a/src/util/vector.h b/src/util/vector.h index 08f7940a1..1a64a7cae 100644 --- a/src/util/vector.h +++ b/src/util/vector.h @@ -120,7 +120,7 @@ class vector { } public: - typedef T data; + typedef T data_t; typedef T * iterator; typedef const T * const_iterator; @@ -528,7 +528,7 @@ public: append(sz, data); } - T * c_ptr() const { + T * data() const { return m_data; } @@ -654,10 +654,10 @@ struct vector_hash_tpl { }; template -struct vector_hash : public vector_hash_tpl > {}; +struct vector_hash : public vector_hash_tpl > {}; template -struct svector_hash : public vector_hash_tpl > {}; +struct svector_hash : public vector_hash_tpl > {}; template diff --git a/src/util/warning.cpp b/src/util/warning.cpp index 7916115d9..1bc91fbfa 100644 --- a/src/util/warning.cpp +++ b/src/util/warning.cpp @@ -99,10 +99,10 @@ void format2ostream(std::ostream & out, char const* msg, va_list args) { // +1 is for NUL termination. buff.resize(static_cast(msg_len + 1)); - VPRF(buff.c_ptr(), buff.size(), msg, args); + VPRF(buff.data(), buff.size(), msg, args); END_ERR_HANDLER(); - out << buff.c_ptr(); + out << buff.data(); }