From 3131b5fb51fdc3b639df2ed889f1055ddc982ba8 Mon Sep 17 00:00:00 2001 From: c-cube Date: Tue, 29 Jun 2021 01:41:24 +0000 Subject: [PATCH] deploy: 655ea76a6a340859033598cc2de484616083349b --- .../Sidekick_arith_lra/Make/argument-1-A/S/Lit/index.html | 2 +- .../Sidekick_arith_lra/Make/argument-1-A/S/P/Quip/index.html | 2 ++ .../Sidekick_arith_lra/Make/argument-1-A/S/P/index.html | 2 +- .../Sidekick_arith_lra/Make/argument-1-A/S/Pre_proof/index.html | 2 ++ .../Sidekick_arith_lra/Make/argument-1-A/S/Proof/index.html | 2 -- .../Make/argument-1-A/S/Solver_internal/CC/Actions/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/CC/Expl/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/CC/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/Simplify/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/index.html | 2 +- .../Sidekick_arith_lra/Make/argument-1-A/S/index.html | 2 +- .../Sidekick_arith_lra/Make/argument-1-A/index.html | 2 +- .../Sidekick_arith_lra/module-type-ARG/S/Lit/index.html | 2 +- .../Sidekick_arith_lra/module-type-ARG/S/P/Quip/index.html | 2 ++ .../Sidekick_arith_lra/module-type-ARG/S/P/index.html | 2 +- .../Sidekick_arith_lra/module-type-ARG/S/Pre_proof/index.html | 2 ++ .../Sidekick_arith_lra/module-type-ARG/S/Proof/index.html | 2 -- .../module-type-ARG/S/Solver_internal/CC/Actions/index.html | 2 +- .../module-type-ARG/S/Solver_internal/CC/Expl/index.html | 2 +- .../module-type-ARG/S/Solver_internal/CC/index.html | 2 +- .../module-type-ARG/S/Solver_internal/Simplify/index.html | 2 +- .../module-type-ARG/S/Solver_internal/index.html | 2 +- .../Sidekick_arith_lra/module-type-ARG/S/index.html | 2 +- .../Sidekick_arith_lra/module-type-ARG/index.html | 2 +- .../Sidekick_arith_lra/module-type-S/A/S/Lit/index.html | 2 +- .../Sidekick_arith_lra/module-type-S/A/S/P/Quip/index.html | 2 ++ .../Sidekick_arith_lra/module-type-S/A/S/P/index.html | 2 +- .../Sidekick_arith_lra/module-type-S/A/S/Pre_proof/index.html | 2 ++ .../Sidekick_arith_lra/module-type-S/A/S/Proof/index.html | 2 -- .../module-type-S/A/S/Solver_internal/CC/Actions/index.html | 2 +- .../module-type-S/A/S/Solver_internal/CC/Expl/index.html | 2 +- .../module-type-S/A/S/Solver_internal/CC/index.html | 2 +- .../module-type-S/A/S/Solver_internal/Simplify/index.html | 2 +- .../module-type-S/A/S/Solver_internal/index.html | 2 +- .../Sidekick_arith_lra/module-type-S/A/S/index.html | 2 +- .../Sidekick_arith_lra/module-type-S/A/index.html | 2 +- .../Sidekick_base_term/Base_types/Cstor/index.html | 2 +- .../Sidekick_base_term/Base_types/Proof/index.html | 2 -- .../Sidekick_base_term/Base_types/Term/Iter_dag/index.html | 2 +- .../Sidekick_base_term/Base_types/Term/index.html | 2 +- dev/sidekick-arith/Sidekick_base_term/Base_types/Ty/index.html | 2 +- dev/sidekick-arith/Sidekick_base_term/Base_types/index.html | 2 +- dev/sidekick-arith/Sidekick_base_term/Proof/Quip/index.html | 2 ++ dev/sidekick-arith/Sidekick_base_term/Proof/index.html | 2 ++ dev/sidekick-arith/Sidekick_base_term/index.html | 2 +- .../Sidekick_base_term__/Base_types/Cstor/index.html | 2 +- .../Sidekick_base_term__/Base_types/Proof/index.html | 2 -- .../Sidekick_base_term__/Base_types/Term/Iter_dag/index.html | 2 +- .../Sidekick_base_term__/Base_types/Term/index.html | 2 +- .../Sidekick_base_term__/Base_types/Ty/index.html | 2 +- dev/sidekick-arith/Sidekick_base_term__/Base_types/index.html | 2 +- dev/sidekick-arith/Sidekick_base_term__/Proof/Quip/index.html | 2 ++ dev/sidekick-arith/Sidekick_base_term__/Proof/index.html | 2 ++ dev/sidekick-arith/Sidekick_base_term__/index.html | 2 +- .../Sidekick_base_term__Base_types/Cstor/index.html | 2 +- .../Sidekick_base_term__Base_types/Proof/index.html | 2 -- .../Sidekick_base_term__Base_types/Term/Iter_dag/index.html | 2 +- .../Sidekick_base_term__Base_types/Term/index.html | 2 +- dev/sidekick-arith/Sidekick_base_term__Base_types/Ty/index.html | 2 +- dev/sidekick-arith/Sidekick_base_term__Base_types/index.html | 2 +- dev/sidekick-arith/Sidekick_base_term__Proof/.dune-keep | 0 dev/sidekick-arith/Sidekick_base_term__Proof/Quip/index.html | 2 ++ dev/sidekick-arith/Sidekick_base_term__Proof/index.html | 2 ++ dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Lit/index.html | 2 +- .../Sidekick_smtlib/Process/Solver/P/Quip/index.html | 2 ++ dev/sidekick-bin/Sidekick_smtlib/Process/Solver/P/index.html | 2 +- .../Sidekick_smtlib/Process/Solver/Pre_proof/index.html | 2 ++ .../Sidekick_smtlib/Process/Solver/Proof/index.html | 2 -- .../Process/Solver/Solver_internal/CC/Actions/index.html | 2 +- .../Process/Solver/Solver_internal/CC/Expl/index.html | 2 +- .../Process/Solver/Solver_internal/CC/index.html | 2 +- .../Process/Solver/Solver_internal/Simplify/index.html | 2 +- .../Sidekick_smtlib/Process/Solver/Solver_internal/index.html | 2 +- dev/sidekick-bin/Sidekick_smtlib/Process/Solver/index.html | 2 +- dev/sidekick-bin/Sidekick_smtlib/Process/index.html | 2 +- .../Sidekick_smtlib__/Process/Solver/Lit/index.html | 2 +- .../Sidekick_smtlib__/Process/Solver/P/Quip/index.html | 2 ++ dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/P/index.html | 2 +- .../Sidekick_smtlib__/Process/Solver/Pre_proof/index.html | 2 ++ .../Sidekick_smtlib__/Process/Solver/Proof/index.html | 2 -- .../Process/Solver/Solver_internal/CC/Actions/index.html | 2 +- .../Process/Solver/Solver_internal/CC/Expl/index.html | 2 +- .../Process/Solver/Solver_internal/CC/index.html | 2 +- .../Process/Solver/Solver_internal/Simplify/index.html | 2 +- .../Sidekick_smtlib__/Process/Solver/Solver_internal/index.html | 2 +- dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/index.html | 2 +- dev/sidekick-bin/Sidekick_smtlib__/Process/index.html | 2 +- dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Lit/index.html | 2 +- .../Sidekick_smtlib__Process/Solver/P/Quip/index.html | 2 ++ dev/sidekick-bin/Sidekick_smtlib__Process/Solver/P/index.html | 2 +- .../Sidekick_smtlib__Process/Solver/Pre_proof/index.html | 2 ++ .../Sidekick_smtlib__Process/Solver/Proof/index.html | 2 -- .../Solver/Solver_internal/CC/Actions/index.html | 2 +- .../Solver/Solver_internal/CC/Expl/index.html | 2 +- .../Solver/Solver_internal/CC/index.html | 2 +- .../Solver/Solver_internal/Simplify/index.html | 2 +- .../Sidekick_smtlib__Process/Solver/Solver_internal/index.html | 2 +- dev/sidekick-bin/Sidekick_smtlib__Process/Solver/index.html | 2 +- dev/sidekick-bin/Sidekick_smtlib__Process/index.html | 2 +- dev/sidekick/Sidekick_cc/Make/Expl/index.html | 2 +- dev/sidekick/Sidekick_cc/Make/argument-1-A/Actions/index.html | 2 +- dev/sidekick/Sidekick_cc/Make/argument-1-A/Lit/index.html | 2 +- dev/sidekick/Sidekick_cc/Make/argument-1-A/P/Quip/index.html | 2 ++ dev/sidekick/Sidekick_cc/Make/argument-1-A/P/index.html | 2 +- dev/sidekick/Sidekick_cc/Make/argument-1-A/index.html | 2 +- dev/sidekick/Sidekick_cc/Make/index.html | 2 +- dev/sidekick/Sidekick_cc/module-type-S/Actions/index.html | 2 +- dev/sidekick/Sidekick_cc/module-type-S/Expl/index.html | 2 +- dev/sidekick/Sidekick_cc/module-type-S/Lit/index.html | 2 +- dev/sidekick/Sidekick_cc/module-type-S/P/Quip/index.html | 2 ++ dev/sidekick/Sidekick_cc/module-type-S/P/index.html | 2 +- dev/sidekick/Sidekick_cc/module-type-S/index.html | 2 +- .../Monoid_of_repr/argument-1-M/SI/CC/Actions/index.html | 2 +- .../Monoid_of_repr/argument-1-M/SI/CC/Expl/index.html | 2 +- .../Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/index.html | 2 +- .../Sidekick_core/Monoid_of_repr/argument-1-M/SI/Lit/index.html | 2 +- .../Monoid_of_repr/argument-1-M/SI/P/Quip/index.html | 2 ++ .../Sidekick_core/Monoid_of_repr/argument-1-M/SI/P/index.html | 2 +- .../Monoid_of_repr/argument-1-M/SI/Simplify/index.html | 2 +- .../Sidekick_core/Monoid_of_repr/argument-1-M/SI/index.html | 2 +- .../Sidekick_core/module-type-CC_ACTIONS/Lit/index.html | 2 +- .../Sidekick_core/module-type-CC_ACTIONS/P/Quip/index.html | 2 ++ dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/P/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/index.html | 2 +- .../Sidekick_core/module-type-CC_ARG/Actions/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-CC_ARG/Lit/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-CC_ARG/P/Quip/index.html | 2 ++ dev/sidekick/Sidekick_core/module-type-CC_ARG/P/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-CC_ARG/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-CC_S/Actions/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-CC_S/Expl/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-CC_S/Lit/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-CC_S/P/Quip/index.html | 2 ++ dev/sidekick/Sidekick_core/module-type-CC_S/P/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-CC_S/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-LIT/index.html | 2 +- .../module-type-MONOID_ARG/SI/CC/Actions/index.html | 2 +- .../Sidekick_core/module-type-MONOID_ARG/SI/CC/Expl/index.html | 2 +- .../Sidekick_core/module-type-MONOID_ARG/SI/CC/index.html | 2 +- .../Sidekick_core/module-type-MONOID_ARG/SI/Lit/index.html | 2 +- .../Sidekick_core/module-type-MONOID_ARG/SI/P/Quip/index.html | 2 ++ .../Sidekick_core/module-type-MONOID_ARG/SI/P/index.html | 2 +- .../Sidekick_core/module-type-MONOID_ARG/SI/Simplify/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-PROOF/Quip/index.html | 2 ++ dev/sidekick/Sidekick_core/module-type-PROOF/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-SOLVER/Lit/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-SOLVER/P/Quip/index.html | 2 ++ dev/sidekick/Sidekick_core/module-type-SOLVER/P/index.html | 2 +- .../Sidekick_core/module-type-SOLVER/Pre_proof/index.html | 2 ++ dev/sidekick/Sidekick_core/module-type-SOLVER/Proof/index.html | 2 -- .../module-type-SOLVER/Solver_internal/CC/Actions/index.html | 2 +- .../module-type-SOLVER/Solver_internal/CC/Expl/index.html | 2 +- .../module-type-SOLVER/Solver_internal/CC/index.html | 2 +- .../module-type-SOLVER/Solver_internal/Simplify/index.html | 2 +- .../Sidekick_core/module-type-SOLVER/Solver_internal/index.html | 2 +- dev/sidekick/Sidekick_core/module-type-SOLVER/index.html | 2 +- .../module-type-SOLVER_INTERNAL/CC/Actions/index.html | 2 +- .../module-type-SOLVER_INTERNAL/CC/Expl/index.html | 2 +- .../Sidekick_core/module-type-SOLVER_INTERNAL/CC/index.html | 2 +- .../Sidekick_core/module-type-SOLVER_INTERNAL/Lit/index.html | 2 +- .../Sidekick_core/module-type-SOLVER_INTERNAL/P/Quip/index.html | 2 ++ .../Sidekick_core/module-type-SOLVER_INTERNAL/P/index.html | 2 +- .../module-type-SOLVER_INTERNAL/Simplify/index.html | 2 +- .../Sidekick_core/module-type-SOLVER_INTERNAL/index.html | 2 +- dev/sidekick/Sidekick_msat_solver/Make/Lit/index.html | 2 +- dev/sidekick/Sidekick_msat_solver/Make/Pre_proof/index.html | 2 ++ dev/sidekick/Sidekick_msat_solver/Make/Proof/index.html | 2 -- .../Make/Solver_internal/CC/Actions/index.html | 2 +- .../Make/Solver_internal/CC/Expl/index.html | 2 +- .../Sidekick_msat_solver/Make/Solver_internal/CC/index.html | 2 +- .../Make/Solver_internal/Simplify/index.html | 2 +- .../Sidekick_msat_solver/Make/Solver_internal/index.html | 2 +- .../Sidekick_msat_solver/Make/argument-1-A/P/Quip/index.html | 2 ++ .../Sidekick_msat_solver/Make/argument-1-A/P/index.html | 2 +- dev/sidekick/Sidekick_msat_solver/Make/argument-1-A/index.html | 2 +- dev/sidekick/Sidekick_msat_solver/Make/index.html | 2 +- .../Sidekick_msat_solver/module-type-ARG/P/Quip/index.html | 2 ++ dev/sidekick/Sidekick_msat_solver/module-type-ARG/P/index.html | 2 +- dev/sidekick/Sidekick_msat_solver/module-type-ARG/index.html | 2 +- dev/sidekick/Sidekick_msat_solver/module-type-S/Lit/index.html | 2 +- .../Sidekick_msat_solver/module-type-S/P/Quip/index.html | 2 ++ dev/sidekick/Sidekick_msat_solver/module-type-S/P/index.html | 2 +- .../Sidekick_msat_solver/module-type-S/Pre_proof/index.html | 2 ++ .../Sidekick_msat_solver/module-type-S/Proof/index.html | 2 -- .../module-type-S/Solver_internal/CC/Actions/index.html | 2 +- .../module-type-S/Solver_internal/CC/Expl/index.html | 2 +- .../module-type-S/Solver_internal/CC/index.html | 2 +- .../module-type-S/Solver_internal/Simplify/index.html | 2 +- .../module-type-S/Solver_internal/index.html | 2 +- dev/sidekick/Sidekick_msat_solver/module-type-S/index.html | 2 +- .../Sidekick_th_bool_static/Make/argument-1-A/S/Lit/index.html | 2 +- .../Make/argument-1-A/S/P/Quip/index.html | 2 ++ .../Sidekick_th_bool_static/Make/argument-1-A/S/P/index.html | 2 +- .../Make/argument-1-A/S/Pre_proof/index.html | 2 ++ .../Make/argument-1-A/S/Proof/index.html | 2 -- .../Make/argument-1-A/S/Solver_internal/CC/Actions/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/CC/Expl/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/CC/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/Simplify/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/index.html | 2 +- .../Sidekick_th_bool_static/Make/argument-1-A/S/index.html | 2 +- .../Sidekick_th_bool_static/Make/argument-1-A/index.html | 2 +- .../Sidekick_th_bool_static/module-type-ARG/S/Lit/index.html | 2 +- .../Sidekick_th_bool_static/module-type-ARG/S/P/Quip/index.html | 2 ++ .../Sidekick_th_bool_static/module-type-ARG/S/P/index.html | 2 +- .../module-type-ARG/S/Pre_proof/index.html | 2 ++ .../Sidekick_th_bool_static/module-type-ARG/S/Proof/index.html | 2 -- .../module-type-ARG/S/Solver_internal/CC/Actions/index.html | 2 +- .../module-type-ARG/S/Solver_internal/CC/Expl/index.html | 2 +- .../module-type-ARG/S/Solver_internal/CC/index.html | 2 +- .../module-type-ARG/S/Solver_internal/Simplify/index.html | 2 +- .../module-type-ARG/S/Solver_internal/index.html | 2 +- .../Sidekick_th_bool_static/module-type-ARG/S/index.html | 2 +- dev/sidekick/Sidekick_th_bool_static/module-type-ARG/index.html | 2 +- .../Sidekick_th_bool_static/module-type-S/A/S/Lit/index.html | 2 +- .../Sidekick_th_bool_static/module-type-S/A/S/P/Quip/index.html | 2 ++ .../Sidekick_th_bool_static/module-type-S/A/S/P/index.html | 2 +- .../module-type-S/A/S/Pre_proof/index.html | 2 ++ .../Sidekick_th_bool_static/module-type-S/A/S/Proof/index.html | 2 -- .../module-type-S/A/S/Solver_internal/CC/Actions/index.html | 2 +- .../module-type-S/A/S/Solver_internal/CC/Expl/index.html | 2 +- .../module-type-S/A/S/Solver_internal/CC/index.html | 2 +- .../module-type-S/A/S/Solver_internal/Simplify/index.html | 2 +- .../module-type-S/A/S/Solver_internal/index.html | 2 +- .../Sidekick_th_bool_static/module-type-S/A/S/index.html | 2 +- dev/sidekick/Sidekick_th_bool_static/module-type-S/A/index.html | 2 +- .../Sidekick_th_cstor/Make/argument-1-A/S/Lit/index.html | 2 +- .../Sidekick_th_cstor/Make/argument-1-A/S/P/Quip/index.html | 2 ++ dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/P/index.html | 2 +- .../Sidekick_th_cstor/Make/argument-1-A/S/Pre_proof/index.html | 2 ++ .../Sidekick_th_cstor/Make/argument-1-A/S/Proof/index.html | 2 -- .../Make/argument-1-A/S/Solver_internal/CC/Actions/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/CC/Expl/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/CC/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/Simplify/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/index.html | 2 +- dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/index.html | 2 +- dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Lit/index.html | 2 +- .../Sidekick_th_cstor/module-type-ARG/S/P/Quip/index.html | 2 ++ dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/P/index.html | 2 +- .../Sidekick_th_cstor/module-type-ARG/S/Pre_proof/index.html | 2 ++ .../Sidekick_th_cstor/module-type-ARG/S/Proof/index.html | 2 -- .../module-type-ARG/S/Solver_internal/CC/Actions/index.html | 2 +- .../module-type-ARG/S/Solver_internal/CC/Expl/index.html | 2 +- .../module-type-ARG/S/Solver_internal/CC/index.html | 2 +- .../module-type-ARG/S/Solver_internal/Simplify/index.html | 2 +- .../module-type-ARG/S/Solver_internal/index.html | 2 +- dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/index.html | 2 +- dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Lit/index.html | 2 +- .../Sidekick_th_cstor/module-type-S/A/S/P/Quip/index.html | 2 ++ dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/P/index.html | 2 +- .../Sidekick_th_cstor/module-type-S/A/S/Pre_proof/index.html | 2 ++ .../Sidekick_th_cstor/module-type-S/A/S/Proof/index.html | 2 -- .../module-type-S/A/S/Solver_internal/CC/Actions/index.html | 2 +- .../module-type-S/A/S/Solver_internal/CC/Expl/index.html | 2 +- .../module-type-S/A/S/Solver_internal/CC/index.html | 2 +- .../module-type-S/A/S/Solver_internal/Simplify/index.html | 2 +- .../module-type-S/A/S/Solver_internal/index.html | 2 +- dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/index.html | 2 +- .../Sidekick_th_data/Make/argument-1-A/S/Lit/index.html | 2 +- .../Sidekick_th_data/Make/argument-1-A/S/P/Quip/index.html | 2 ++ dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/P/index.html | 2 +- .../Sidekick_th_data/Make/argument-1-A/S/Pre_proof/index.html | 2 ++ .../Sidekick_th_data/Make/argument-1-A/S/Proof/index.html | 2 -- .../Make/argument-1-A/S/Solver_internal/CC/Actions/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/CC/Expl/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/CC/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/Simplify/index.html | 2 +- .../Make/argument-1-A/S/Solver_internal/index.html | 2 +- dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/index.html | 2 +- dev/sidekick/Sidekick_th_data/Make/argument-1-A/index.html | 2 +- dev/sidekick/Sidekick_th_data/module-type-ARG/S/Lit/index.html | 2 +- .../Sidekick_th_data/module-type-ARG/S/P/Quip/index.html | 2 ++ dev/sidekick/Sidekick_th_data/module-type-ARG/S/P/index.html | 2 +- .../Sidekick_th_data/module-type-ARG/S/Pre_proof/index.html | 2 ++ .../Sidekick_th_data/module-type-ARG/S/Proof/index.html | 2 -- .../module-type-ARG/S/Solver_internal/CC/Actions/index.html | 2 +- .../module-type-ARG/S/Solver_internal/CC/Expl/index.html | 2 +- .../module-type-ARG/S/Solver_internal/CC/index.html | 2 +- .../module-type-ARG/S/Solver_internal/Simplify/index.html | 2 +- .../module-type-ARG/S/Solver_internal/index.html | 2 +- dev/sidekick/Sidekick_th_data/module-type-ARG/S/index.html | 2 +- dev/sidekick/Sidekick_th_data/module-type-ARG/index.html | 2 +- dev/sidekick/Sidekick_th_data/module-type-S/A/S/Lit/index.html | 2 +- .../Sidekick_th_data/module-type-S/A/S/P/Quip/index.html | 2 ++ dev/sidekick/Sidekick_th_data/module-type-S/A/S/P/index.html | 2 +- .../Sidekick_th_data/module-type-S/A/S/Pre_proof/index.html | 2 ++ .../Sidekick_th_data/module-type-S/A/S/Proof/index.html | 2 -- .../module-type-S/A/S/Solver_internal/CC/Actions/index.html | 2 +- .../module-type-S/A/S/Solver_internal/CC/Expl/index.html | 2 +- .../module-type-S/A/S/Solver_internal/CC/index.html | 2 +- .../module-type-S/A/S/Solver_internal/Simplify/index.html | 2 +- .../module-type-S/A/S/Solver_internal/index.html | 2 +- dev/sidekick/Sidekick_th_data/module-type-S/A/S/index.html | 2 +- dev/sidekick/Sidekick_th_data/module-type-S/A/index.html | 2 +- dev/sidekick/Sidekick_util/IArray/index.html | 2 +- dev/sidekick/Sidekick_util/Profile/index.html | 2 +- dev/sidekick/Sidekick_util__/IArray/index.html | 2 +- dev/sidekick/Sidekick_util__/Profile/index.html | 2 +- dev/sidekick/Sidekick_util__IArray/index.html | 2 +- dev/sidekick/Sidekick_util__Profile/index.html | 2 +- 302 files changed, 332 insertions(+), 270 deletions(-) create mode 100644 dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/P/Quip/index.html create mode 100644 dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Pre_proof/index.html delete mode 100644 dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Proof/index.html create mode 100644 dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/P/Quip/index.html create mode 100644 dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Pre_proof/index.html delete mode 100644 dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Proof/index.html create mode 100644 dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/P/Quip/index.html create mode 100644 dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Pre_proof/index.html delete mode 100644 dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Proof/index.html delete mode 100644 dev/sidekick-arith/Sidekick_base_term/Base_types/Proof/index.html create mode 100644 dev/sidekick-arith/Sidekick_base_term/Proof/Quip/index.html create mode 100644 dev/sidekick-arith/Sidekick_base_term/Proof/index.html delete mode 100644 dev/sidekick-arith/Sidekick_base_term__/Base_types/Proof/index.html create mode 100644 dev/sidekick-arith/Sidekick_base_term__/Proof/Quip/index.html create mode 100644 dev/sidekick-arith/Sidekick_base_term__/Proof/index.html delete mode 100644 dev/sidekick-arith/Sidekick_base_term__Base_types/Proof/index.html create mode 100644 dev/sidekick-arith/Sidekick_base_term__Proof/.dune-keep create mode 100644 dev/sidekick-arith/Sidekick_base_term__Proof/Quip/index.html create mode 100644 dev/sidekick-arith/Sidekick_base_term__Proof/index.html create mode 100644 dev/sidekick-bin/Sidekick_smtlib/Process/Solver/P/Quip/index.html create mode 100644 dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Pre_proof/index.html delete mode 100644 dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Proof/index.html create mode 100644 dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/P/Quip/index.html create mode 100644 dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Pre_proof/index.html delete mode 100644 dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Proof/index.html create mode 100644 dev/sidekick-bin/Sidekick_smtlib__Process/Solver/P/Quip/index.html create mode 100644 dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Pre_proof/index.html delete mode 100644 dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Proof/index.html create mode 100644 dev/sidekick/Sidekick_cc/Make/argument-1-A/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_cc/module-type-S/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_core/module-type-CC_ARG/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_core/module-type-CC_S/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_core/module-type-PROOF/Quip/index.html create mode 100644 dev/sidekick/Sidekick_core/module-type-SOLVER/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_core/module-type-SOLVER/Pre_proof/index.html delete mode 100644 dev/sidekick/Sidekick_core/module-type-SOLVER/Proof/index.html create mode 100644 dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_msat_solver/Make/Pre_proof/index.html delete mode 100644 dev/sidekick/Sidekick_msat_solver/Make/Proof/index.html create mode 100644 dev/sidekick/Sidekick_msat_solver/Make/argument-1-A/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_msat_solver/module-type-ARG/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_msat_solver/module-type-S/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_msat_solver/module-type-S/Pre_proof/index.html delete mode 100644 dev/sidekick/Sidekick_msat_solver/module-type-S/Proof/index.html create mode 100644 dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Pre_proof/index.html delete mode 100644 dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Proof/index.html create mode 100644 dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Pre_proof/index.html delete mode 100644 dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Proof/index.html create mode 100644 dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Pre_proof/index.html delete mode 100644 dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Proof/index.html create mode 100644 dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Pre_proof/index.html delete mode 100644 dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Proof/index.html create mode 100644 dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Pre_proof/index.html delete mode 100644 dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Proof/index.html create mode 100644 dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Pre_proof/index.html delete mode 100644 dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Proof/index.html create mode 100644 dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Pre_proof/index.html delete mode 100644 dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Proof/index.html create mode 100644 dev/sidekick/Sidekick_th_data/module-type-ARG/S/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_th_data/module-type-ARG/S/Pre_proof/index.html delete mode 100644 dev/sidekick/Sidekick_th_data/module-type-ARG/S/Proof/index.html create mode 100644 dev/sidekick/Sidekick_th_data/module-type-S/A/S/P/Quip/index.html create mode 100644 dev/sidekick/Sidekick_th_data/module-type-S/A/S/Pre_proof/index.html delete mode 100644 dev/sidekick/Sidekick_th_data/module-type-S/A/S/Proof/index.html diff --git a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Lit/index.html b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Lit/index.html index 1e7d6789..da90129d 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Lit/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/P/Quip/index.html b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/P/Quip/index.html new file mode 100644 index 00000000..844b4da5 --- /dev/null +++ b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/P/index.html b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/P/index.html index 7537bd43..c3bda450 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/P/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/P/index.html @@ -1,2 +1,2 @@ -P (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.P)

Module S.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.P)

Module S.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Pre_proof/index.html b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Pre_proof/index.html new file mode 100644 index 00000000..ba72323f --- /dev/null +++ b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.Pre_proof)

Module S.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Proof/index.html b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Proof/index.html deleted file mode 100644 index 567a3fa6..00000000 --- a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.Proof)

Module S.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/Actions/index.html b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/Actions/index.html index 06f30d6c..a32af7fa 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/Expl/index.html b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/Expl/index.html index 342e73e0..019254b2 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/index.html b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/index.html index 28282b6b..7f6eda5d 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/Simplify/index.html b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/Simplify/index.html index 81a8e682..98d81425 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/Simplify/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/index.html b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/index.html index 33c1fdf3..fba7689d 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick-arith.Sidekick_arith_lra.Make.1-A.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/index.html b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/index.html index dc54ea15..7ff8e927 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/S/index.html @@ -1,2 +1,2 @@ -S (sidekick-arith.Sidekick_arith_lra.Make.1-A.S)

Module 1-A.S

module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +S (sidekick-arith.Sidekick_arith_lra.Make.1-A.S)

Module 1-A.S

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/index.html b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/index.html index d56dc872..3313be3f 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/Make/argument-1-A/index.html @@ -1,2 +1,2 @@ -1-A (sidekick-arith.Sidekick_arith_lra.Make.1-A)

Parameter Make.1-A

type term = S.T.Term.t
type ty = S.T.Ty.t
val view_as_lra : term -> term lra_view

Project the term into the theory view

val mk_bool : S.T.Term.state -> bool -> term
val mk_lra : S.T.Term.state -> term lra_view -> term

Make a term from the given theory view

val ty_lra : S.T.Term.state -> ty
val mk_eq : S.T.Term.state -> term -> term -> term

syntactic equality

val has_ty_real : term -> bool

Does this term have the type Real

module Gensym : sig ... end
\ No newline at end of file +1-A (sidekick-arith.Sidekick_arith_lra.Make.1-A)

Parameter Make.1-A

type term = S.T.Term.t
type ty = S.T.Ty.t
val view_as_lra : term -> term lra_view

Project the term into the theory view

val mk_bool : S.T.Term.state -> bool -> term
val mk_lra : S.T.Term.state -> term lra_view -> term

Make a term from the given theory view

val ty_lra : S.T.Term.state -> ty
val mk_eq : S.T.Term.state -> term -> term -> term

syntactic equality

val has_ty_real : term -> bool

Does this term have the type Real

val proof_lra : S.P.lit Iter.t -> S.P.t

TODO: more accurate certificates

val proof_lra_l : S.P.lit list -> S.P.t
module Gensym : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Lit/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Lit/index.html index f5c243fb..f08c7a42 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Lit/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick-arith.Sidekick_arith_lra.ARG.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick-arith.Sidekick_arith_lra.ARG.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/P/Quip/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/P/Quip/index.html new file mode 100644 index 00000000..1430ded7 --- /dev/null +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick-arith.Sidekick_arith_lra.ARG.S.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/P/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/P/index.html index f4167e2c..d1c10d1b 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/P/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/P/index.html @@ -1,2 +1,2 @@ -P (sidekick-arith.Sidekick_arith_lra.ARG.S.P)

Module S.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick-arith.Sidekick_arith_lra.ARG.S.P)

Module S.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Pre_proof/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Pre_proof/index.html new file mode 100644 index 00000000..09f02d5d --- /dev/null +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick-arith.Sidekick_arith_lra.ARG.S.Pre_proof)

Module S.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Proof/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Proof/index.html deleted file mode 100644 index 1597ec58..00000000 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick-arith.Sidekick_arith_lra.ARG.S.Proof)

Module S.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/Actions/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/Actions/index.html index 03ac227d..02738fb2 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick-arith.Sidekick_arith_lra.ARG.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick-arith.Sidekick_arith_lra.ARG.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/Expl/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/Expl/index.html index bcf571c7..5e78c888 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick-arith.Sidekick_arith_lra.ARG.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick-arith.Sidekick_arith_lra.ARG.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/index.html index 90c14af1..d5f59756 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick-arith.Sidekick_arith_lra.ARG.S.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick-arith.Sidekick_arith_lra.ARG.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/Simplify/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/Simplify/index.html index 8b7c530f..16c4a06c 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/Simplify/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick-arith.Sidekick_arith_lra.ARG.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick-arith.Sidekick_arith_lra.ARG.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/index.html index 52b7f859..711d685b 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick-arith.Sidekick_arith_lra.ARG.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick-arith.Sidekick_arith_lra.ARG.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/index.html index 6efa6e9d..5ac29028 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/S/index.html @@ -1,2 +1,2 @@ -S (sidekick-arith.Sidekick_arith_lra.ARG.S)

Module ARG.S

module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +S (sidekick-arith.Sidekick_arith_lra.ARG.S)

Module ARG.S

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/index.html index 91c3e5e0..89ffe5c6 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-ARG/index.html @@ -1,2 +1,2 @@ -ARG (sidekick-arith.Sidekick_arith_lra.ARG)

Module type Sidekick_arith_lra.ARG

type term = S.T.Term.t
type ty = S.T.Ty.t
val view_as_lra : term -> term lra_view

Project the term into the theory view

val mk_bool : S.T.Term.state -> bool -> term
val mk_lra : S.T.Term.state -> term lra_view -> term

Make a term from the given theory view

val ty_lra : S.T.Term.state -> ty
val mk_eq : S.T.Term.state -> term -> term -> term

syntactic equality

val has_ty_real : term -> bool

Does this term have the type Real

module Gensym : sig ... end
\ No newline at end of file +ARG (sidekick-arith.Sidekick_arith_lra.ARG)

Module type Sidekick_arith_lra.ARG

type term = S.T.Term.t
type ty = S.T.Ty.t
val view_as_lra : term -> term lra_view

Project the term into the theory view

val mk_bool : S.T.Term.state -> bool -> term
val mk_lra : S.T.Term.state -> term lra_view -> term

Make a term from the given theory view

val ty_lra : S.T.Term.state -> ty
val mk_eq : S.T.Term.state -> term -> term -> term

syntactic equality

val has_ty_real : term -> bool

Does this term have the type Real

val proof_lra : S.P.lit Iter.t -> S.P.t

TODO: more accurate certificates

val proof_lra_l : S.P.lit list -> S.P.t
module Gensym : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Lit/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Lit/index.html index 372bf2f8..ee55c2fc 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Lit/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick-arith.Sidekick_arith_lra.S.A.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick-arith.Sidekick_arith_lra.S.A.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/P/Quip/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/P/Quip/index.html new file mode 100644 index 00000000..0004fb36 --- /dev/null +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick-arith.Sidekick_arith_lra.S.A.S.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/P/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/P/index.html index 502df474..1dae0649 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/P/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/P/index.html @@ -1,2 +1,2 @@ -P (sidekick-arith.Sidekick_arith_lra.S.A.S.P)

Module S.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick-arith.Sidekick_arith_lra.S.A.S.P)

Module S.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Pre_proof/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Pre_proof/index.html new file mode 100644 index 00000000..c3430f63 --- /dev/null +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick-arith.Sidekick_arith_lra.S.A.S.Pre_proof)

Module S.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Proof/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Proof/index.html deleted file mode 100644 index 6f210a34..00000000 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick-arith.Sidekick_arith_lra.S.A.S.Proof)

Module S.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/Actions/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/Actions/index.html index 17bd4cbe..83a1abed 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick-arith.Sidekick_arith_lra.S.A.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick-arith.Sidekick_arith_lra.S.A.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/Expl/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/Expl/index.html index 6a7099e7..61693a88 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick-arith.Sidekick_arith_lra.S.A.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick-arith.Sidekick_arith_lra.S.A.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/index.html index 19a2bd8f..4066d3e5 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick-arith.Sidekick_arith_lra.S.A.S.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick-arith.Sidekick_arith_lra.S.A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/Simplify/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/Simplify/index.html index 8fa8a60c..329e9e69 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/Simplify/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick-arith.Sidekick_arith_lra.S.A.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick-arith.Sidekick_arith_lra.S.A.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/index.html index 9a7cf104..c0b2f82e 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick-arith.Sidekick_arith_lra.S.A.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick-arith.Sidekick_arith_lra.S.A.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/index.html index a788065e..c29a953f 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/S/index.html @@ -1,2 +1,2 @@ -S (sidekick-arith.Sidekick_arith_lra.S.A.S)

Module A.S

module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +S (sidekick-arith.Sidekick_arith_lra.S.A.S)

Module A.S

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/index.html b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/index.html index a5ba382c..96a2c7ea 100644 --- a/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/index.html +++ b/dev/sidekick-arith/Sidekick_arith_lra/module-type-S/A/index.html @@ -1,2 +1,2 @@ -A (sidekick-arith.Sidekick_arith_lra.S.A)

Module S.A

type term = S.T.Term.t
type ty = S.T.Ty.t
val view_as_lra : term -> term lra_view

Project the term into the theory view

val mk_bool : S.T.Term.state -> bool -> term
val mk_lra : S.T.Term.state -> term lra_view -> term

Make a term from the given theory view

val ty_lra : S.T.Term.state -> ty
val mk_eq : S.T.Term.state -> term -> term -> term

syntactic equality

val has_ty_real : term -> bool

Does this term have the type Real

module Gensym : sig ... end
\ No newline at end of file +A (sidekick-arith.Sidekick_arith_lra.S.A)

Module S.A

type term = S.T.Term.t
type ty = S.T.Ty.t
val view_as_lra : term -> term lra_view

Project the term into the theory view

val mk_bool : S.T.Term.state -> bool -> term
val mk_lra : S.T.Term.state -> term lra_view -> term

Make a term from the given theory view

val ty_lra : S.T.Term.state -> ty
val mk_eq : S.T.Term.state -> term -> term -> term

syntactic equality

val has_ty_real : term -> bool

Does this term have the type Real

val proof_lra : S.P.lit Iter.t -> S.P.t

TODO: more accurate certificates

val proof_lra_l : S.P.lit list -> S.P.t
module Gensym : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term/Base_types/Cstor/index.html b/dev/sidekick-arith/Sidekick_base_term/Base_types/Cstor/index.html index eb3c4a8a..26edea74 100644 --- a/dev/sidekick-arith/Sidekick_base_term/Base_types/Cstor/index.html +++ b/dev/sidekick-arith/Sidekick_base_term/Base_types/Cstor/index.html @@ -1,2 +1,2 @@ -Cstor (sidekick-arith.Sidekick_base_term.Base_types.Cstor)

Module Base_types.Cstor

type t = cstor = {
cstor_id : ID.t;
cstor_is_a : ID.t;
mutable cstor_arity : int;
cstor_args : select list lazy_t;
cstor_ty_as_data : data;
cstor_ty : ty lazy_t;
}
val ty_args : t -> ty Iter.t
val equal : cstor -> cstor -> bool
val pp : CCFormat.t -> t -> unit
\ No newline at end of file +Cstor (sidekick-arith.Sidekick_base_term.Base_types.Cstor)

Module Base_types.Cstor

type t = cstor = {
cstor_id : ID.t;
cstor_is_a : ID.t;
mutable cstor_arity : int;
cstor_args : select list lazy_t;
cstor_ty_as_data : data;
cstor_ty : ty lazy_t;
}
val id : t -> ID.t
val ty_args : t -> ty Iter.t
val equal : cstor -> cstor -> bool
val pp : CCFormat.t -> t -> unit
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term/Base_types/Proof/index.html b/dev/sidekick-arith/Sidekick_base_term/Base_types/Proof/index.html deleted file mode 100644 index 76ffbdbb..00000000 --- a/dev/sidekick-arith/Sidekick_base_term/Base_types/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick-arith.Sidekick_base_term.Base_types.Proof)

Module Base_types.Proof

type t =
| Default
val default : t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term/Base_types/Term/Iter_dag/index.html b/dev/sidekick-arith/Sidekick_base_term/Base_types/Term/Iter_dag/index.html index 35263827..dfb2af5c 100644 --- a/dev/sidekick-arith/Sidekick_base_term/Base_types/Term/Iter_dag/index.html +++ b/dev/sidekick-arith/Sidekick_base_term/Base_types/Term/Iter_dag/index.html @@ -1,2 +1,2 @@ -Iter_dag (sidekick-arith.Sidekick_base_term.Base_types.Term.Iter_dag)

Module Term.Iter_dag

type t
val create : unit -> t
val iter_dag : t -> term -> term Iter.t
\ No newline at end of file +Iter_dag (sidekick-arith.Sidekick_base_term.Base_types.Term.Iter_dag)

Module Term.Iter_dag

type t
type order =
| Pre
| Post
val create : unit -> t
val iter_dag : ?⁠order:order -> t -> term -> term Iter.t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term/Base_types/Term/index.html b/dev/sidekick-arith/Sidekick_base_term/Base_types/Term/index.html index c9ad25a0..80125d4e 100644 --- a/dev/sidekick-arith/Sidekick_base_term/Base_types/Term/index.html +++ b/dev/sidekick-arith/Sidekick_base_term/Base_types/Term/index.html @@ -1,2 +1,2 @@ -Term (sidekick-arith.Sidekick_base_term.Base_types.Term)

Module Base_types.Term

type t = term = {
mutable term_id : int;
mutable term_ty : ty;
term_view : t term_view;
}
type 'a view = 'a term_view =
| Bool of bool
| App_fun of fun_ * 'a Sidekick_util.IArray.t
| Eq of 'a * 'a
| Not of 'a
| Ite of 'a * 'a * 'a
| LRA of 'a lra_view
val id : t -> int
val view : t -> term view
val ty : t -> Ty.t
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
type state
val create : ?⁠size:int -> unit -> state
val make : state -> t view -> t
val true_ : state -> t
val false_ : state -> t
val bool : state -> bool -> t
val const : state -> fun_ -> t
val app_fun : state -> fun_ -> t Sidekick_util.IArray.t -> t
val eq : state -> t -> t -> t
val not_ : state -> t -> t
val ite : state -> t -> t -> t -> t
val select : state -> select -> t -> t
val app_cstor : state -> cstor -> t Sidekick_util.IArray.t -> t
val is_a : state -> cstor -> t -> t
val lra : state -> t lra_view -> t
val abs : state -> t -> t * bool

Obtain unsigned version of t, + the sign as a boolean

module Iter_dag : sig ... end
val iter_dag : t -> t Iter.t
val map_shallow : state -> (t -> t) -> t -> t
val pp : t Fmt.printer
Views
val is_true : t -> bool
val is_false : t -> bool
val is_const : t -> bool
val cc_view : t -> (fun_tt Iter.t) CC_view.t
val as_fun_undef : t -> (fun_ * Ty.Fun.t) option
val as_bool : t -> bool option
Containers
module Tbl : CCHashtbl.S with type Tbl.key = t
module Map : CCMap.S with type Map.key = t
module Set : CCSet.S with type Set.elt = t
\ No newline at end of file +Term (sidekick-arith.Sidekick_base_term.Base_types.Term)

Module Base_types.Term

type t = term = {
mutable term_id : int;
mutable term_ty : ty;
term_view : t term_view;
}
type 'a view = 'a term_view =
| Bool of bool
| App_fun of fun_ * 'a Sidekick_util.IArray.t
| Eq of 'a * 'a
| Not of 'a
| Ite of 'a * 'a * 'a
| LRA of 'a lra_view
val id : t -> int
val view : t -> term view
val ty : t -> Ty.t
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
type state
val create : ?⁠size:int -> unit -> state
val make : state -> t view -> t
val true_ : state -> t
val false_ : state -> t
val bool : state -> bool -> t
val const : state -> fun_ -> t
val app_fun : state -> fun_ -> t Sidekick_util.IArray.t -> t
val eq : state -> t -> t -> t
val not_ : state -> t -> t
val ite : state -> t -> t -> t -> t
val select : state -> select -> t -> t
val app_cstor : state -> cstor -> t Sidekick_util.IArray.t -> t
val is_a : state -> cstor -> t -> t
val lra : state -> t lra_view -> t
val abs : state -> t -> t * bool

Obtain unsigned version of t, + the sign as a boolean

module Iter_dag : sig ... end
val iter_dag_with : order:Iter_dag.order -> t -> t Iter.t
val iter_dag : t -> t Iter.t
val map_shallow : state -> (t -> t) -> t -> t
val pp : t Fmt.printer
Views
val is_true : t -> bool
val is_false : t -> bool
val is_const : t -> bool
val cc_view : t -> (fun_tt Iter.t) CC_view.t
val as_fun_undef : t -> (fun_ * Ty.Fun.t) option
val as_bool : t -> bool option
Containers
module Tbl : CCHashtbl.S with type Tbl.key = t
module Map : CCMap.S with type Map.key = t
module Set : CCSet.S with type Set.elt = t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term/Base_types/Ty/index.html b/dev/sidekick-arith/Sidekick_base_term/Base_types/Ty/index.html index a88db462..612e588f 100644 --- a/dev/sidekick-arith/Sidekick_base_term/Base_types/Ty/index.html +++ b/dev/sidekick-arith/Sidekick_base_term/Base_types/Ty/index.html @@ -1,2 +1,2 @@ -Ty (sidekick-arith.Sidekick_base_term.Base_types.Ty)

Module Base_types.Ty

type t = ty
type state = unit
type view = ty_view =
| Ty_bool
| Ty_real
| Ty_atomic of {
def : ty_def;
args : ty list;
mutable finite : bool;
}
type def = ty_def =
| Ty_uninterpreted of ID.t
| Ty_data of {
data : data;
}
| Ty_def of {
id : ID.t;
pp : ty Fmt.printer -> ty list Fmt.printer;
default_val : value list -> value;
}
val id : t -> int
val view : t -> view
val bool : state -> t
val real : state -> t
val atomic : def -> t list -> t
val atomic_uninterpreted : ID.t -> t
val finite : t -> bool
val set_finite : t -> bool -> unit
val is_bool : t -> bool
val is_uninterpreted : t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
val pp : t CCFormat.printer
module Tbl : CCHashtbl.S with type Tbl.key = t
module Fun : sig ... end
\ No newline at end of file +Ty (sidekick-arith.Sidekick_base_term.Base_types.Ty)

Module Base_types.Ty

type t = ty
type state = unit
type view = ty_view =
| Ty_bool
| Ty_real
| Ty_atomic of {
def : ty_def;
args : ty list;
mutable finite : bool;
}
type def = ty_def =
| Ty_uninterpreted of ID.t
| Ty_data of {
data : data;
}
| Ty_def of {
id : ID.t;
pp : ty Fmt.printer -> ty list Fmt.printer;
default_val : value list -> value;
}
val id : t -> int
val view : t -> view
val bool : state -> t
val real : state -> t
val atomic : def -> t list -> t
val id_of_def : def -> ID.t
val atomic_uninterpreted : ID.t -> t
val finite : t -> bool
val set_finite : t -> bool -> unit
val is_bool : t -> bool
val is_uninterpreted : t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
val pp : t CCFormat.printer
module Tbl : CCHashtbl.S with type Tbl.key = t
module Fun : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term/Base_types/index.html b/dev/sidekick-arith/Sidekick_base_term/Base_types/index.html index 7d309c1a..584d1be6 100644 --- a/dev/sidekick-arith/Sidekick_base_term/Base_types/index.html +++ b/dev/sidekick-arith/Sidekick_base_term/Base_types/index.html @@ -1,2 +1,2 @@ -Base_types (sidekick-arith.Sidekick_base_term.Base_types)

Module Sidekick_base_term.Base_types

module Vec = Msat.Vec
module Log = Msat.Log
module Fmt = CCFormat
module CC_view = Sidekick_core.CC_view
type lra_pred = Sidekick_arith_lra.Predicate.t =
| Leq
| Geq
| Lt
| Gt
| Eq
| Neq
type lra_op = Sidekick_arith_lra.op =
| Plus
| Minus
type 'a lra_view = 'a Sidekick_arith_lra.lra_view =
| LRA_pred of lra_pred * 'a * 'a
| LRA_op of lra_op * 'a * 'a
| LRA_mult of Q.t * 'a
| LRA_const of Q.t
| LRA_simplex_var of 'a
| LRA_simplex_pred of 'a * Sidekick_arith_lra.S_op.t * Q.t
| LRA_other of 'a
type term = {
mutable term_id : int;
mutable term_ty : ty;
term_view : term term_view;
}
and 'a term_view =
| Bool of bool
| App_fun of fun_ * 'a Sidekick_util.IArray.t
| Eq of 'a * 'a
| Not of 'a
| Ite of 'a * 'a * 'a
| LRA of 'a lra_view
and fun_ = {
fun_id : ID.t;
fun_view : fun_view;
}
and fun_view =
| Fun_undef of fun_ty
| Fun_select of select
| Fun_cstor of cstor
| Fun_is_a of cstor
| Fun_def of {
pp : a. ('a Fmt.printer -> 'a Sidekick_util.IArray.t Fmt.printer) option;
abs : self:term -> term Sidekick_util.IArray.t -> term * bool;
do_cc : bool;
relevant : a. ID.t -> 'a Sidekick_util.IArray.t -> int -> bool;
ty : ID.t -> term Sidekick_util.IArray.t -> ty;
eval : value Sidekick_util.IArray.t -> value;
}

Methods on the custom term view whose arguments are 'a. Terms must be printable, and provide some additional theory handles.

  • relevant must return a subset of args (possibly the same set). The terms it returns will be activated and evaluated whenever possible. Terms in args \ relevant args are considered for congruence but not for evaluation.
and fun_ty = {
fun_ty_args : ty list;
fun_ty_ret : ty;
}

Function type

and ty = {
mutable ty_id : int;
ty_view : ty_view;
}

Hashconsed type

and ty_view =
| Ty_bool
| Ty_real
| Ty_atomic of {
def : ty_def;
args : ty list;
mutable finite : bool;
}
and ty_def =
| Ty_uninterpreted of ID.t
| Ty_data of {
data : data;
}
| Ty_def of {
id : ID.t;
pp : ty Fmt.printer -> ty list Fmt.printer;
default_val : value list -> value;
}
and data = {
data_id : ID.t;
data_cstors : cstor Sidekick_base_term__.ID.Map.t lazy_t;
data_as_ty : ty lazy_t;
}
and cstor = {
cstor_id : ID.t;
cstor_is_a : ID.t;
mutable cstor_arity : int;
cstor_args : select list lazy_t;
cstor_ty_as_data : data;
cstor_ty : ty lazy_t;
}
and select = {
select_id : ID.t;
select_cstor : cstor;
select_ty : ty lazy_t;
select_i : int;
}
and value =
| V_bool of bool
| V_element of {
id : ID.t;
ty : ty;
}

a named constant, distinct from any other constant

| V_cstor of {
c : cstor;
args : value list;
}
| V_custom of {
view : value_custom_view;
pp : value_custom_view Fmt.printer;
eq : value_custom_view -> value_custom_view -> bool;
hash : value_custom_view -> int;
}

Custom value

| V_real of Q.t

Semantic values, used for models (and possibly model-constructing calculi)

and value_custom_view = ..
type definition = ID.t * ty * term
type statement =
| Stmt_set_logic of string
| Stmt_set_option of string list
| Stmt_set_info of string * string
| Stmt_data of data list
| Stmt_ty_decl of ID.t * int
| Stmt_decl of ID.t * ty list * ty
| Stmt_define of definition list
| Stmt_assert of term
| Stmt_assert_clause of term list
| Stmt_check_sat of (bool * term) list
| Stmt_exit
val term_equal_ : term -> term -> bool
val term_hash_ : term -> int
val term_cmp_ : term -> term -> int
val fun_compare : fun_ -> fun_ -> int
val pp_fun : CCFormat.t -> fun_ -> unit
val id_of_fun : fun_ -> ID.t
val eq_ty : ty -> ty -> bool
val eq_cstor : cstor -> cstor -> bool
val eq_value : value -> value -> bool
val hash_value : value Sidekick_util.Hash.t
val pp_value : value Sidekick_util.Util.printer
val pp_db : Stdlib.Format.formatter -> (int * 'a) -> unit
val pp_ty : ty Sidekick_util.Util.printer
val string_of_lra_pred : lra_pred -> string
val pp_pred : Fmt.t -> lra_pred -> unit
val string_of_lra_op : lra_op -> string
val pp_lra_op : Fmt.t -> lra_op -> unit
val pp_term_view_gen : pp_id:(Fmt.t -> ID.t -> unit) -> pp_t:'a Fmt.printer -> Fmt.t -> 'a term_view -> unit
val pp_term_top : ids:bool -> Fmt.t -> term -> unit
val pp_term : Fmt.t -> term -> unit
val pp_term_view : Fmt.t -> term term_view -> unit
module Ty : sig ... end
module Fun : sig ... end
module Term_cell : sig ... end
module Term : sig ... end
module Value : sig ... end
module Data : sig ... end
module Select : sig ... end
module Cstor : sig ... end
module Proof : sig ... end
module Statement : sig ... end
\ No newline at end of file +Base_types (sidekick-arith.Sidekick_base_term.Base_types)

Module Sidekick_base_term.Base_types

module Vec = Msat.Vec
module Log = Msat.Log
module Fmt = CCFormat
module CC_view = Sidekick_core.CC_view
type lra_pred = Sidekick_arith_lra.Predicate.t =
| Leq
| Geq
| Lt
| Gt
| Eq
| Neq
type lra_op = Sidekick_arith_lra.op =
| Plus
| Minus
type 'a lra_view = 'a Sidekick_arith_lra.lra_view =
| LRA_pred of lra_pred * 'a * 'a
| LRA_op of lra_op * 'a * 'a
| LRA_mult of Q.t * 'a
| LRA_const of Q.t
| LRA_simplex_var of 'a
| LRA_simplex_pred of 'a * Sidekick_arith_lra.S_op.t * Q.t
| LRA_other of 'a
type term = {
mutable term_id : int;
mutable term_ty : ty;
term_view : term term_view;
}
and 'a term_view =
| Bool of bool
| App_fun of fun_ * 'a Sidekick_util.IArray.t
| Eq of 'a * 'a
| Not of 'a
| Ite of 'a * 'a * 'a
| LRA of 'a lra_view
and fun_ = {
fun_id : ID.t;
fun_view : fun_view;
}
and fun_view =
| Fun_undef of fun_ty
| Fun_select of select
| Fun_cstor of cstor
| Fun_is_a of cstor
| Fun_def of {
pp : a. ('a Fmt.printer -> 'a Sidekick_util.IArray.t Fmt.printer) option;
abs : self:term -> term Sidekick_util.IArray.t -> term * bool;
do_cc : bool;
relevant : a. ID.t -> 'a Sidekick_util.IArray.t -> int -> bool;
ty : ID.t -> term Sidekick_util.IArray.t -> ty;
eval : value Sidekick_util.IArray.t -> value;
}

Methods on the custom term view whose arguments are 'a. Terms must be printable, and provide some additional theory handles.

  • relevant must return a subset of args (possibly the same set). The terms it returns will be activated and evaluated whenever possible. Terms in args \ relevant args are considered for congruence but not for evaluation.
and fun_ty = {
fun_ty_args : ty list;
fun_ty_ret : ty;
}

Function type

and ty = {
mutable ty_id : int;
ty_view : ty_view;
}

Hashconsed type

and ty_view =
| Ty_bool
| Ty_real
| Ty_atomic of {
def : ty_def;
args : ty list;
mutable finite : bool;
}
and ty_def =
| Ty_uninterpreted of ID.t
| Ty_data of {
data : data;
}
| Ty_def of {
id : ID.t;
pp : ty Fmt.printer -> ty list Fmt.printer;
default_val : value list -> value;
}
and data = {
data_id : ID.t;
data_cstors : cstor Sidekick_base_term__.ID.Map.t lazy_t;
data_as_ty : ty lazy_t;
}
and cstor = {
cstor_id : ID.t;
cstor_is_a : ID.t;
mutable cstor_arity : int;
cstor_args : select list lazy_t;
cstor_ty_as_data : data;
cstor_ty : ty lazy_t;
}
and select = {
select_id : ID.t;
select_cstor : cstor;
select_ty : ty lazy_t;
select_i : int;
}
and value =
| V_bool of bool
| V_element of {
id : ID.t;
ty : ty;
}

a named constant, distinct from any other constant

| V_cstor of {
c : cstor;
args : value list;
}
| V_custom of {
view : value_custom_view;
pp : value_custom_view Fmt.printer;
eq : value_custom_view -> value_custom_view -> bool;
hash : value_custom_view -> int;
}

Custom value

| V_real of Q.t

Semantic values, used for models (and possibly model-constructing calculi)

and value_custom_view = ..
type definition = ID.t * ty * term
type statement =
| Stmt_set_logic of string
| Stmt_set_option of string list
| Stmt_set_info of string * string
| Stmt_data of data list
| Stmt_ty_decl of ID.t * int
| Stmt_decl of ID.t * ty list * ty
| Stmt_define of definition list
| Stmt_assert of term
| Stmt_assert_clause of term list
| Stmt_check_sat of (bool * term) list
| Stmt_exit
val term_equal_ : term -> term -> bool
val term_hash_ : term -> int
val term_cmp_ : term -> term -> int
val fun_compare : fun_ -> fun_ -> int
val pp_fun : CCFormat.t -> fun_ -> unit
val id_of_fun : fun_ -> ID.t
val eq_ty : ty -> ty -> bool
val eq_cstor : cstor -> cstor -> bool
val eq_value : value -> value -> bool
val hash_value : value Sidekick_util.Hash.t
val pp_value : value Sidekick_util.Util.printer
val pp_db : Stdlib.Format.formatter -> (int * 'a) -> unit
val pp_ty : ty Sidekick_util.Util.printer
val string_of_lra_pred : lra_pred -> string
val pp_pred : Fmt.t -> lra_pred -> unit
val string_of_lra_op : lra_op -> string
val pp_lra_op : Fmt.t -> lra_op -> unit
val pp_term_view_gen : pp_id:(Fmt.t -> ID.t -> unit) -> pp_t:'a Fmt.printer -> Fmt.t -> 'a term_view -> unit
val pp_term_top : ids:bool -> Fmt.t -> term -> unit
val pp_term : Fmt.t -> term -> unit
val pp_term_view : Fmt.t -> term term_view -> unit
module Ty : sig ... end
module Fun : sig ... end
module Term_cell : sig ... end
module Term : sig ... end
module Value : sig ... end
module Data : sig ... end
module Select : sig ... end
module Cstor : sig ... end
module Statement : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term/Proof/Quip/index.html b/dev/sidekick-arith/Sidekick_base_term/Proof/Quip/index.html new file mode 100644 index 00000000..f3b95fdc --- /dev/null +++ b/dev/sidekick-arith/Sidekick_base_term/Proof/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick-arith.Sidekick_base_term.Proof.Quip)

Module Proof.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term/Proof/index.html b/dev/sidekick-arith/Sidekick_base_term/Proof/index.html new file mode 100644 index 00000000..4b0bd10a --- /dev/null +++ b/dev/sidekick-arith/Sidekick_base_term/Proof/index.html @@ -0,0 +1,2 @@ + +Proof (sidekick-arith.Sidekick_base_term.Proof)

Module Sidekick_base_term.Proof

include Sidekick_core.PROOF with type term = Base_types.Term.t and type ty = Base_types.Ty.t
type term = Base_types.Term.t
type ty = Base_types.Ty.t
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
val isa_split : ty -> term Iter.t -> t
val isa_disj : ty -> term -> term -> t
val cstor_inj : Base_types.Cstor.t -> int -> term list -> term list -> t
val bool_eq : term -> term -> t
val bool_c : string -> term list -> t
val ite_true : term -> t
val ite_false : term -> t
val lra : lit Iter.t -> t
val lra_l : lit list -> t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term/index.html b/dev/sidekick-arith/Sidekick_base_term/index.html index ef484009..3d6ac549 100644 --- a/dev/sidekick-arith/Sidekick_base_term/index.html +++ b/dev/sidekick-arith/Sidekick_base_term/index.html @@ -1,2 +1,2 @@ -Sidekick_base_term (sidekick-arith.Sidekick_base_term)

Module Sidekick_base_term

module Base_types : sig ... end
module ID : sig ... end
module Fun = Base_types.Fun
module Stat = Sidekick_util.Stat
module Model : sig ... end
module Term = Base_types.Term
module Value = Base_types.Value
module Term_cell = Base_types.Term_cell
module Ty = Base_types.Ty
module Statement = Base_types.Statement
module Data = Base_types.Data
module Select = Base_types.Select
module Arg : Sidekick_core.TERM with type Term.t = Term.t and type Fun.t = Fun.t and type Ty.t = Ty.t and type Term.state = Term.state
\ No newline at end of file +Sidekick_base_term (sidekick-arith.Sidekick_base_term)

Module Sidekick_base_term

module Base_types : sig ... end
module ID : sig ... end
module Fun = Base_types.Fun
module Stat = Sidekick_util.Stat
module Model : sig ... end
module Term = Base_types.Term
module Value = Base_types.Value
module Term_cell = Base_types.Term_cell
module Ty = Base_types.Ty
module Statement = Base_types.Statement
module Data = Base_types.Data
module Select = Base_types.Select
module Proof : sig ... end
module Arg : Sidekick_core.TERM with type Term.t = Term.t and type Fun.t = Fun.t and type Ty.t = Ty.t and type Term.state = Term.state
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__/Base_types/Cstor/index.html b/dev/sidekick-arith/Sidekick_base_term__/Base_types/Cstor/index.html index 3e792618..f1ea194f 100644 --- a/dev/sidekick-arith/Sidekick_base_term__/Base_types/Cstor/index.html +++ b/dev/sidekick-arith/Sidekick_base_term__/Base_types/Cstor/index.html @@ -1,2 +1,2 @@ -Cstor (sidekick-arith.Sidekick_base_term__.Base_types.Cstor)

Module Base_types.Cstor

type t = cstor = {
cstor_id : Sidekick_base_term.ID.t;
cstor_is_a : Sidekick_base_term.ID.t;
mutable cstor_arity : int;
cstor_args : select list lazy_t;
cstor_ty_as_data : data;
cstor_ty : ty lazy_t;
}
val ty_args : t -> ty Iter.t
val equal : cstor -> cstor -> bool
val pp : CCFormat.t -> t -> unit
\ No newline at end of file +Cstor (sidekick-arith.Sidekick_base_term__.Base_types.Cstor)

Module Base_types.Cstor

type t = cstor = {
cstor_id : Sidekick_base_term.ID.t;
cstor_is_a : Sidekick_base_term.ID.t;
mutable cstor_arity : int;
cstor_args : select list lazy_t;
cstor_ty_as_data : data;
cstor_ty : ty lazy_t;
}
val id : t -> Sidekick_base_term.ID.t
val ty_args : t -> ty Iter.t
val equal : cstor -> cstor -> bool
val pp : CCFormat.t -> t -> unit
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__/Base_types/Proof/index.html b/dev/sidekick-arith/Sidekick_base_term__/Base_types/Proof/index.html deleted file mode 100644 index 0fec475e..00000000 --- a/dev/sidekick-arith/Sidekick_base_term__/Base_types/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick-arith.Sidekick_base_term__.Base_types.Proof)

Module Base_types.Proof

type t =
| Default
val default : t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__/Base_types/Term/Iter_dag/index.html b/dev/sidekick-arith/Sidekick_base_term__/Base_types/Term/Iter_dag/index.html index 00b0ef44..bdeddd02 100644 --- a/dev/sidekick-arith/Sidekick_base_term__/Base_types/Term/Iter_dag/index.html +++ b/dev/sidekick-arith/Sidekick_base_term__/Base_types/Term/Iter_dag/index.html @@ -1,2 +1,2 @@ -Iter_dag (sidekick-arith.Sidekick_base_term__.Base_types.Term.Iter_dag)

Module Term.Iter_dag

type t
val create : unit -> t
val iter_dag : t -> term -> term Iter.t
\ No newline at end of file +Iter_dag (sidekick-arith.Sidekick_base_term__.Base_types.Term.Iter_dag)

Module Term.Iter_dag

type t
type order =
| Pre
| Post
val create : unit -> t
val iter_dag : ?⁠order:order -> t -> term -> term Iter.t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__/Base_types/Term/index.html b/dev/sidekick-arith/Sidekick_base_term__/Base_types/Term/index.html index f0212590..76f8538c 100644 --- a/dev/sidekick-arith/Sidekick_base_term__/Base_types/Term/index.html +++ b/dev/sidekick-arith/Sidekick_base_term__/Base_types/Term/index.html @@ -1,2 +1,2 @@ -Term (sidekick-arith.Sidekick_base_term__.Base_types.Term)

Module Base_types.Term

type t = term = {
mutable term_id : int;
mutable term_ty : ty;
term_view : t term_view;
}
type 'a view = 'a term_view =
| Bool of bool
| App_fun of fun_ * 'a Sidekick_util.IArray.t
| Eq of 'a * 'a
| Not of 'a
| Ite of 'a * 'a * 'a
| LRA of 'a lra_view
val id : t -> int
val view : t -> term view
val ty : t -> Ty.t
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
type state
val create : ?⁠size:int -> unit -> state
val make : state -> t view -> t
val true_ : state -> t
val false_ : state -> t
val bool : state -> bool -> t
val const : state -> fun_ -> t
val app_fun : state -> fun_ -> t Sidekick_util.IArray.t -> t
val eq : state -> t -> t -> t
val not_ : state -> t -> t
val ite : state -> t -> t -> t -> t
val select : state -> select -> t -> t
val app_cstor : state -> cstor -> t Sidekick_util.IArray.t -> t
val is_a : state -> cstor -> t -> t
val lra : state -> t lra_view -> t
val abs : state -> t -> t * bool

Obtain unsigned version of t, + the sign as a boolean

module Iter_dag : sig ... end
val iter_dag : t -> t Iter.t
val map_shallow : state -> (t -> t) -> t -> t
val pp : t Fmt.printer
Views
val is_true : t -> bool
val is_false : t -> bool
val is_const : t -> bool
val cc_view : t -> (fun_tt Iter.t) CC_view.t
val as_fun_undef : t -> (fun_ * Ty.Fun.t) option
val as_bool : t -> bool option
Containers
module Tbl : CCHashtbl.S with type Tbl.key = t
module Map : CCMap.S with type Map.key = t
module Set : CCSet.S with type Set.elt = t
\ No newline at end of file +Term (sidekick-arith.Sidekick_base_term__.Base_types.Term)

Module Base_types.Term

type t = term = {
mutable term_id : int;
mutable term_ty : ty;
term_view : t term_view;
}
type 'a view = 'a term_view =
| Bool of bool
| App_fun of fun_ * 'a Sidekick_util.IArray.t
| Eq of 'a * 'a
| Not of 'a
| Ite of 'a * 'a * 'a
| LRA of 'a lra_view
val id : t -> int
val view : t -> term view
val ty : t -> Ty.t
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
type state
val create : ?⁠size:int -> unit -> state
val make : state -> t view -> t
val true_ : state -> t
val false_ : state -> t
val bool : state -> bool -> t
val const : state -> fun_ -> t
val app_fun : state -> fun_ -> t Sidekick_util.IArray.t -> t
val eq : state -> t -> t -> t
val not_ : state -> t -> t
val ite : state -> t -> t -> t -> t
val select : state -> select -> t -> t
val app_cstor : state -> cstor -> t Sidekick_util.IArray.t -> t
val is_a : state -> cstor -> t -> t
val lra : state -> t lra_view -> t
val abs : state -> t -> t * bool

Obtain unsigned version of t, + the sign as a boolean

module Iter_dag : sig ... end
val iter_dag_with : order:Iter_dag.order -> t -> t Iter.t
val iter_dag : t -> t Iter.t
val map_shallow : state -> (t -> t) -> t -> t
val pp : t Fmt.printer
Views
val is_true : t -> bool
val is_false : t -> bool
val is_const : t -> bool
val cc_view : t -> (fun_tt Iter.t) CC_view.t
val as_fun_undef : t -> (fun_ * Ty.Fun.t) option
val as_bool : t -> bool option
Containers
module Tbl : CCHashtbl.S with type Tbl.key = t
module Map : CCMap.S with type Map.key = t
module Set : CCSet.S with type Set.elt = t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__/Base_types/Ty/index.html b/dev/sidekick-arith/Sidekick_base_term__/Base_types/Ty/index.html index 9ef728e7..a0ea5efe 100644 --- a/dev/sidekick-arith/Sidekick_base_term__/Base_types/Ty/index.html +++ b/dev/sidekick-arith/Sidekick_base_term__/Base_types/Ty/index.html @@ -1,2 +1,2 @@ -Ty (sidekick-arith.Sidekick_base_term__.Base_types.Ty)

Module Base_types.Ty

type t = ty
type state = unit
type view = ty_view =
| Ty_bool
| Ty_real
| Ty_atomic of {
def : ty_def;
args : ty list;
mutable finite : bool;
}
type def = ty_def =
| Ty_uninterpreted of Sidekick_base_term.ID.t
| Ty_data of {
data : data;
}
| Ty_def of {
id : Sidekick_base_term.ID.t;
pp : ty Fmt.printer -> ty list Fmt.printer;
default_val : value list -> value;
}
val id : t -> int
val view : t -> view
val bool : state -> t
val real : state -> t
val atomic : def -> t list -> t
val atomic_uninterpreted : Sidekick_base_term.ID.t -> t
val finite : t -> bool
val set_finite : t -> bool -> unit
val is_bool : t -> bool
val is_uninterpreted : t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
val pp : t CCFormat.printer
module Tbl : CCHashtbl.S with type Tbl.key = t
module Fun : sig ... end
\ No newline at end of file +Ty (sidekick-arith.Sidekick_base_term__.Base_types.Ty)

Module Base_types.Ty

type t = ty
type state = unit
type view = ty_view =
| Ty_bool
| Ty_real
| Ty_atomic of {
def : ty_def;
args : ty list;
mutable finite : bool;
}
type def = ty_def =
| Ty_uninterpreted of Sidekick_base_term.ID.t
| Ty_data of {
data : data;
}
| Ty_def of {
id : Sidekick_base_term.ID.t;
pp : ty Fmt.printer -> ty list Fmt.printer;
default_val : value list -> value;
}
val id : t -> int
val view : t -> view
val bool : state -> t
val real : state -> t
val atomic : def -> t list -> t
val id_of_def : def -> Sidekick_base_term.ID.t
val atomic_uninterpreted : Sidekick_base_term.ID.t -> t
val finite : t -> bool
val set_finite : t -> bool -> unit
val is_bool : t -> bool
val is_uninterpreted : t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
val pp : t CCFormat.printer
module Tbl : CCHashtbl.S with type Tbl.key = t
module Fun : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__/Base_types/index.html b/dev/sidekick-arith/Sidekick_base_term__/Base_types/index.html index 00d791ac..62932a78 100644 --- a/dev/sidekick-arith/Sidekick_base_term__/Base_types/index.html +++ b/dev/sidekick-arith/Sidekick_base_term__/Base_types/index.html @@ -1,2 +1,2 @@ -Base_types (sidekick-arith.Sidekick_base_term__.Base_types)

Module Sidekick_base_term__.Base_types

module Vec = Msat.Vec
module Log = Msat.Log
module Fmt = CCFormat
module CC_view = Sidekick_core.CC_view
type lra_pred = Sidekick_arith_lra.Predicate.t =
| Leq
| Geq
| Lt
| Gt
| Eq
| Neq
type lra_op = Sidekick_arith_lra.op =
| Plus
| Minus
type 'a lra_view = 'a Sidekick_arith_lra.lra_view =
| LRA_pred of lra_pred * 'a * 'a
| LRA_op of lra_op * 'a * 'a
| LRA_mult of Q.t * 'a
| LRA_const of Q.t
| LRA_simplex_var of 'a
| LRA_simplex_pred of 'a * Sidekick_arith_lra.S_op.t * Q.t
| LRA_other of 'a
type term = {
mutable term_id : int;
mutable term_ty : ty;
term_view : term term_view;
}
and 'a term_view =
| Bool of bool
| App_fun of fun_ * 'a Sidekick_util.IArray.t
| Eq of 'a * 'a
| Not of 'a
| Ite of 'a * 'a * 'a
| LRA of 'a lra_view
and fun_ = {
fun_id : Sidekick_base_term.ID.t;
fun_view : fun_view;
}
and fun_view =
| Fun_undef of fun_ty
| Fun_select of select
| Fun_cstor of cstor
| Fun_is_a of cstor
| Fun_def of {
pp : a. ('a Fmt.printer -> 'a Sidekick_util.IArray.t Fmt.printer) option;
abs : self:term -> term Sidekick_util.IArray.t -> term * bool;
do_cc : bool;
relevant : a. Sidekick_base_term.ID.t -> 'a Sidekick_util.IArray.t -> int -> bool;
ty : Sidekick_base_term.ID.t -> term Sidekick_util.IArray.t -> ty;
eval : value Sidekick_util.IArray.t -> value;
}

Methods on the custom term view whose arguments are 'a. Terms must be printable, and provide some additional theory handles.

  • relevant must return a subset of args (possibly the same set). The terms it returns will be activated and evaluated whenever possible. Terms in args \ relevant args are considered for congruence but not for evaluation.
and fun_ty = {
fun_ty_args : ty list;
fun_ty_ret : ty;
}

Function type

and ty = {
mutable ty_id : int;
ty_view : ty_view;
}

Hashconsed type

and ty_view =
| Ty_bool
| Ty_real
| Ty_atomic of {
def : ty_def;
args : ty list;
mutable finite : bool;
}
and ty_def =
| Ty_uninterpreted of Sidekick_base_term.ID.t
| Ty_data of {
data : data;
}
| Ty_def of {
id : Sidekick_base_term.ID.t;
pp : ty Fmt.printer -> ty list Fmt.printer;
default_val : value list -> value;
}
and data = {
data_id : Sidekick_base_term.ID.t;
data_cstors : cstor Sidekick_base_term__.ID.Map.t lazy_t;
data_as_ty : ty lazy_t;
}
and cstor = {
cstor_id : Sidekick_base_term.ID.t;
cstor_is_a : Sidekick_base_term.ID.t;
mutable cstor_arity : int;
cstor_args : select list lazy_t;
cstor_ty_as_data : data;
cstor_ty : ty lazy_t;
}
and select = {
select_id : Sidekick_base_term.ID.t;
select_cstor : cstor;
select_ty : ty lazy_t;
select_i : int;
}
and value =
| V_bool of bool
| V_element of {
id : Sidekick_base_term.ID.t;
ty : ty;
}

a named constant, distinct from any other constant

| V_cstor of {
c : cstor;
args : value list;
}
| V_custom of {
view : value_custom_view;
pp : value_custom_view Fmt.printer;
eq : value_custom_view -> value_custom_view -> bool;
hash : value_custom_view -> int;
}

Custom value

| V_real of Q.t

Semantic values, used for models (and possibly model-constructing calculi)

and value_custom_view = ..
type definition = Sidekick_base_term.ID.t * ty * term
type statement =
| Stmt_set_logic of string
| Stmt_set_option of string list
| Stmt_set_info of string * string
| Stmt_data of data list
| Stmt_ty_decl of Sidekick_base_term.ID.t * int
| Stmt_decl of Sidekick_base_term.ID.t * ty list * ty
| Stmt_define of definition list
| Stmt_assert of term
| Stmt_assert_clause of term list
| Stmt_check_sat of (bool * term) list
| Stmt_exit
val term_equal_ : term -> term -> bool
val term_hash_ : term -> int
val term_cmp_ : term -> term -> int
val fun_compare : fun_ -> fun_ -> int
val pp_fun : CCFormat.t -> fun_ -> unit
val id_of_fun : fun_ -> Sidekick_base_term.ID.t
val eq_ty : ty -> ty -> bool
val eq_cstor : cstor -> cstor -> bool
val eq_value : value -> value -> bool
val hash_value : value Sidekick_util.Hash.t
val pp_value : value Sidekick_util.Util.printer
val pp_db : Stdlib.Format.formatter -> (int * 'a) -> unit
val pp_ty : ty Sidekick_util.Util.printer
val string_of_lra_pred : lra_pred -> string
val pp_pred : Fmt.t -> lra_pred -> unit
val string_of_lra_op : lra_op -> string
val pp_lra_op : Fmt.t -> lra_op -> unit
val pp_term_view_gen : pp_id:(Fmt.t -> Sidekick_base_term.ID.t -> unit) -> pp_t:'a Fmt.printer -> Fmt.t -> 'a term_view -> unit
val pp_term_top : ids:bool -> Fmt.t -> term -> unit
val pp_term : Fmt.t -> term -> unit
val pp_term_view : Fmt.t -> term term_view -> unit
module Ty : sig ... end
module Fun : sig ... end
module Term_cell : sig ... end
module Term : sig ... end
module Value : sig ... end
module Data : sig ... end
module Select : sig ... end
module Cstor : sig ... end
module Proof : sig ... end
module Statement : sig ... end
\ No newline at end of file +Base_types (sidekick-arith.Sidekick_base_term__.Base_types)

Module Sidekick_base_term__.Base_types

module Vec = Msat.Vec
module Log = Msat.Log
module Fmt = CCFormat
module CC_view = Sidekick_core.CC_view
type lra_pred = Sidekick_arith_lra.Predicate.t =
| Leq
| Geq
| Lt
| Gt
| Eq
| Neq
type lra_op = Sidekick_arith_lra.op =
| Plus
| Minus
type 'a lra_view = 'a Sidekick_arith_lra.lra_view =
| LRA_pred of lra_pred * 'a * 'a
| LRA_op of lra_op * 'a * 'a
| LRA_mult of Q.t * 'a
| LRA_const of Q.t
| LRA_simplex_var of 'a
| LRA_simplex_pred of 'a * Sidekick_arith_lra.S_op.t * Q.t
| LRA_other of 'a
type term = {
mutable term_id : int;
mutable term_ty : ty;
term_view : term term_view;
}
and 'a term_view =
| Bool of bool
| App_fun of fun_ * 'a Sidekick_util.IArray.t
| Eq of 'a * 'a
| Not of 'a
| Ite of 'a * 'a * 'a
| LRA of 'a lra_view
and fun_ = {
fun_id : Sidekick_base_term.ID.t;
fun_view : fun_view;
}
and fun_view =
| Fun_undef of fun_ty
| Fun_select of select
| Fun_cstor of cstor
| Fun_is_a of cstor
| Fun_def of {
pp : a. ('a Fmt.printer -> 'a Sidekick_util.IArray.t Fmt.printer) option;
abs : self:term -> term Sidekick_util.IArray.t -> term * bool;
do_cc : bool;
relevant : a. Sidekick_base_term.ID.t -> 'a Sidekick_util.IArray.t -> int -> bool;
ty : Sidekick_base_term.ID.t -> term Sidekick_util.IArray.t -> ty;
eval : value Sidekick_util.IArray.t -> value;
}

Methods on the custom term view whose arguments are 'a. Terms must be printable, and provide some additional theory handles.

  • relevant must return a subset of args (possibly the same set). The terms it returns will be activated and evaluated whenever possible. Terms in args \ relevant args are considered for congruence but not for evaluation.
and fun_ty = {
fun_ty_args : ty list;
fun_ty_ret : ty;
}

Function type

and ty = {
mutable ty_id : int;
ty_view : ty_view;
}

Hashconsed type

and ty_view =
| Ty_bool
| Ty_real
| Ty_atomic of {
def : ty_def;
args : ty list;
mutable finite : bool;
}
and ty_def =
| Ty_uninterpreted of Sidekick_base_term.ID.t
| Ty_data of {
data : data;
}
| Ty_def of {
id : Sidekick_base_term.ID.t;
pp : ty Fmt.printer -> ty list Fmt.printer;
default_val : value list -> value;
}
and data = {
data_id : Sidekick_base_term.ID.t;
data_cstors : cstor Sidekick_base_term__.ID.Map.t lazy_t;
data_as_ty : ty lazy_t;
}
and cstor = {
cstor_id : Sidekick_base_term.ID.t;
cstor_is_a : Sidekick_base_term.ID.t;
mutable cstor_arity : int;
cstor_args : select list lazy_t;
cstor_ty_as_data : data;
cstor_ty : ty lazy_t;
}
and select = {
select_id : Sidekick_base_term.ID.t;
select_cstor : cstor;
select_ty : ty lazy_t;
select_i : int;
}
and value =
| V_bool of bool
| V_element of {
id : Sidekick_base_term.ID.t;
ty : ty;
}

a named constant, distinct from any other constant

| V_cstor of {
c : cstor;
args : value list;
}
| V_custom of {
view : value_custom_view;
pp : value_custom_view Fmt.printer;
eq : value_custom_view -> value_custom_view -> bool;
hash : value_custom_view -> int;
}

Custom value

| V_real of Q.t

Semantic values, used for models (and possibly model-constructing calculi)

and value_custom_view = ..
type definition = Sidekick_base_term.ID.t * ty * term
type statement =
| Stmt_set_logic of string
| Stmt_set_option of string list
| Stmt_set_info of string * string
| Stmt_data of data list
| Stmt_ty_decl of Sidekick_base_term.ID.t * int
| Stmt_decl of Sidekick_base_term.ID.t * ty list * ty
| Stmt_define of definition list
| Stmt_assert of term
| Stmt_assert_clause of term list
| Stmt_check_sat of (bool * term) list
| Stmt_exit
val term_equal_ : term -> term -> bool
val term_hash_ : term -> int
val term_cmp_ : term -> term -> int
val fun_compare : fun_ -> fun_ -> int
val pp_fun : CCFormat.t -> fun_ -> unit
val id_of_fun : fun_ -> Sidekick_base_term.ID.t
val eq_ty : ty -> ty -> bool
val eq_cstor : cstor -> cstor -> bool
val eq_value : value -> value -> bool
val hash_value : value Sidekick_util.Hash.t
val pp_value : value Sidekick_util.Util.printer
val pp_db : Stdlib.Format.formatter -> (int * 'a) -> unit
val pp_ty : ty Sidekick_util.Util.printer
val string_of_lra_pred : lra_pred -> string
val pp_pred : Fmt.t -> lra_pred -> unit
val string_of_lra_op : lra_op -> string
val pp_lra_op : Fmt.t -> lra_op -> unit
val pp_term_view_gen : pp_id:(Fmt.t -> Sidekick_base_term.ID.t -> unit) -> pp_t:'a Fmt.printer -> Fmt.t -> 'a term_view -> unit
val pp_term_top : ids:bool -> Fmt.t -> term -> unit
val pp_term : Fmt.t -> term -> unit
val pp_term_view : Fmt.t -> term term_view -> unit
module Ty : sig ... end
module Fun : sig ... end
module Term_cell : sig ... end
module Term : sig ... end
module Value : sig ... end
module Data : sig ... end
module Select : sig ... end
module Cstor : sig ... end
module Statement : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__/Proof/Quip/index.html b/dev/sidekick-arith/Sidekick_base_term__/Proof/Quip/index.html new file mode 100644 index 00000000..8c8f2527 --- /dev/null +++ b/dev/sidekick-arith/Sidekick_base_term__/Proof/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick-arith.Sidekick_base_term__.Proof.Quip)

Module Proof.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__/Proof/index.html b/dev/sidekick-arith/Sidekick_base_term__/Proof/index.html new file mode 100644 index 00000000..c42d7d34 --- /dev/null +++ b/dev/sidekick-arith/Sidekick_base_term__/Proof/index.html @@ -0,0 +1,2 @@ + +Proof (sidekick-arith.Sidekick_base_term__.Proof)

Module Sidekick_base_term__.Proof

include Sidekick_core.PROOF with type term = Sidekick_base_term.Base_types.Term.t and type ty = Sidekick_base_term.Base_types.Ty.t
type term = Sidekick_base_term.Base_types.Term.t
type ty = Sidekick_base_term.Base_types.Ty.t
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
val isa_split : ty -> term Iter.t -> t
val isa_disj : ty -> term -> term -> t
val cstor_inj : Sidekick_base_term.Base_types.Cstor.t -> int -> term list -> term list -> t
val bool_eq : term -> term -> t
val bool_c : string -> term list -> t
val ite_true : term -> t
val ite_false : term -> t
val lra : lit Iter.t -> t
val lra_l : lit list -> t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__/index.html b/dev/sidekick-arith/Sidekick_base_term__/index.html index 0d15a47d..2c654b94 100644 --- a/dev/sidekick-arith/Sidekick_base_term__/index.html +++ b/dev/sidekick-arith/Sidekick_base_term__/index.html @@ -1,2 +1,2 @@ -Sidekick_base_term__ (sidekick-arith.Sidekick_base_term__)

Module Sidekick_base_term__

module Base_types : sig ... end
module CCHet : sig ... end
module Config : sig ... end
module Hashcons : sig ... end
module ID : sig ... end
module Model : sig ... end
\ No newline at end of file +Sidekick_base_term__ (sidekick-arith.Sidekick_base_term__)

Module Sidekick_base_term__

module Base_types : sig ... end
module CCHet : sig ... end
module Config : sig ... end
module Hashcons : sig ... end
module ID : sig ... end
module Model : sig ... end
module Proof : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__Base_types/Cstor/index.html b/dev/sidekick-arith/Sidekick_base_term__Base_types/Cstor/index.html index e13d93c2..5af4e490 100644 --- a/dev/sidekick-arith/Sidekick_base_term__Base_types/Cstor/index.html +++ b/dev/sidekick-arith/Sidekick_base_term__Base_types/Cstor/index.html @@ -1,2 +1,2 @@ -Cstor (sidekick-arith.Sidekick_base_term__Base_types.Cstor)

Module Sidekick_base_term__Base_types.Cstor

type t = cstor = {
cstor_id : Sidekick_base_term.ID.t;
cstor_is_a : Sidekick_base_term.ID.t;
mutable cstor_arity : int;
cstor_args : select list lazy_t;
cstor_ty_as_data : data;
cstor_ty : ty lazy_t;
}
val ty_args : t -> ty Iter.t
val equal : cstor -> cstor -> bool
val pp : CCFormat.t -> t -> unit
\ No newline at end of file +Cstor (sidekick-arith.Sidekick_base_term__Base_types.Cstor)

Module Sidekick_base_term__Base_types.Cstor

type t = cstor = {
cstor_id : Sidekick_base_term.ID.t;
cstor_is_a : Sidekick_base_term.ID.t;
mutable cstor_arity : int;
cstor_args : select list lazy_t;
cstor_ty_as_data : data;
cstor_ty : ty lazy_t;
}
val id : t -> Sidekick_base_term.ID.t
val ty_args : t -> ty Iter.t
val equal : cstor -> cstor -> bool
val pp : CCFormat.t -> t -> unit
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__Base_types/Proof/index.html b/dev/sidekick-arith/Sidekick_base_term__Base_types/Proof/index.html deleted file mode 100644 index fd08d565..00000000 --- a/dev/sidekick-arith/Sidekick_base_term__Base_types/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick-arith.Sidekick_base_term__Base_types.Proof)

Module Sidekick_base_term__Base_types.Proof

type t =
| Default
val default : t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__Base_types/Term/Iter_dag/index.html b/dev/sidekick-arith/Sidekick_base_term__Base_types/Term/Iter_dag/index.html index 5088de01..23eb281c 100644 --- a/dev/sidekick-arith/Sidekick_base_term__Base_types/Term/Iter_dag/index.html +++ b/dev/sidekick-arith/Sidekick_base_term__Base_types/Term/Iter_dag/index.html @@ -1,2 +1,2 @@ -Iter_dag (sidekick-arith.Sidekick_base_term__Base_types.Term.Iter_dag)

Module Term.Iter_dag

type t
val create : unit -> t
val iter_dag : t -> term -> term Iter.t
\ No newline at end of file +Iter_dag (sidekick-arith.Sidekick_base_term__Base_types.Term.Iter_dag)

Module Term.Iter_dag

type t
type order =
| Pre
| Post
val create : unit -> t
val iter_dag : ?⁠order:order -> t -> term -> term Iter.t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__Base_types/Term/index.html b/dev/sidekick-arith/Sidekick_base_term__Base_types/Term/index.html index d93a1e38..14b7873c 100644 --- a/dev/sidekick-arith/Sidekick_base_term__Base_types/Term/index.html +++ b/dev/sidekick-arith/Sidekick_base_term__Base_types/Term/index.html @@ -1,2 +1,2 @@ -Term (sidekick-arith.Sidekick_base_term__Base_types.Term)

Module Sidekick_base_term__Base_types.Term

type t = term = {
mutable term_id : int;
mutable term_ty : ty;
term_view : t term_view;
}
type 'a view = 'a term_view =
| Bool of bool
| App_fun of fun_ * 'a Sidekick_util.IArray.t
| Eq of 'a * 'a
| Not of 'a
| Ite of 'a * 'a * 'a
| LRA of 'a lra_view
val id : t -> int
val view : t -> term view
val ty : t -> Ty.t
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
type state
val create : ?⁠size:int -> unit -> state
val make : state -> t view -> t
val true_ : state -> t
val false_ : state -> t
val bool : state -> bool -> t
val const : state -> fun_ -> t
val app_fun : state -> fun_ -> t Sidekick_util.IArray.t -> t
val eq : state -> t -> t -> t
val not_ : state -> t -> t
val ite : state -> t -> t -> t -> t
val select : state -> select -> t -> t
val app_cstor : state -> cstor -> t Sidekick_util.IArray.t -> t
val is_a : state -> cstor -> t -> t
val lra : state -> t lra_view -> t
val abs : state -> t -> t * bool

Obtain unsigned version of t, + the sign as a boolean

module Iter_dag : sig ... end
val iter_dag : t -> t Iter.t
val map_shallow : state -> (t -> t) -> t -> t
val pp : t Fmt.printer
Views
val is_true : t -> bool
val is_false : t -> bool
val is_const : t -> bool
val cc_view : t -> (fun_tt Iter.t) CC_view.t
val as_fun_undef : t -> (fun_ * Ty.Fun.t) option
val as_bool : t -> bool option
Containers
module Tbl : CCHashtbl.S with type Tbl.key = t
module Map : CCMap.S with type Map.key = t
module Set : CCSet.S with type Set.elt = t
\ No newline at end of file +Term (sidekick-arith.Sidekick_base_term__Base_types.Term)

Module Sidekick_base_term__Base_types.Term

type t = term = {
mutable term_id : int;
mutable term_ty : ty;
term_view : t term_view;
}
type 'a view = 'a term_view =
| Bool of bool
| App_fun of fun_ * 'a Sidekick_util.IArray.t
| Eq of 'a * 'a
| Not of 'a
| Ite of 'a * 'a * 'a
| LRA of 'a lra_view
val id : t -> int
val view : t -> term view
val ty : t -> Ty.t
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
type state
val create : ?⁠size:int -> unit -> state
val make : state -> t view -> t
val true_ : state -> t
val false_ : state -> t
val bool : state -> bool -> t
val const : state -> fun_ -> t
val app_fun : state -> fun_ -> t Sidekick_util.IArray.t -> t
val eq : state -> t -> t -> t
val not_ : state -> t -> t
val ite : state -> t -> t -> t -> t
val select : state -> select -> t -> t
val app_cstor : state -> cstor -> t Sidekick_util.IArray.t -> t
val is_a : state -> cstor -> t -> t
val lra : state -> t lra_view -> t
val abs : state -> t -> t * bool

Obtain unsigned version of t, + the sign as a boolean

module Iter_dag : sig ... end
val iter_dag_with : order:Iter_dag.order -> t -> t Iter.t
val iter_dag : t -> t Iter.t
val map_shallow : state -> (t -> t) -> t -> t
val pp : t Fmt.printer
Views
val is_true : t -> bool
val is_false : t -> bool
val is_const : t -> bool
val cc_view : t -> (fun_tt Iter.t) CC_view.t
val as_fun_undef : t -> (fun_ * Ty.Fun.t) option
val as_bool : t -> bool option
Containers
module Tbl : CCHashtbl.S with type Tbl.key = t
module Map : CCMap.S with type Map.key = t
module Set : CCSet.S with type Set.elt = t
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__Base_types/Ty/index.html b/dev/sidekick-arith/Sidekick_base_term__Base_types/Ty/index.html index ebf82312..70c7505e 100644 --- a/dev/sidekick-arith/Sidekick_base_term__Base_types/Ty/index.html +++ b/dev/sidekick-arith/Sidekick_base_term__Base_types/Ty/index.html @@ -1,2 +1,2 @@ -Ty (sidekick-arith.Sidekick_base_term__Base_types.Ty)

Module Sidekick_base_term__Base_types.Ty

type t = ty
type state = unit
type view = ty_view =
| Ty_bool
| Ty_real
| Ty_atomic of {
def : ty_def;
args : ty list;
mutable finite : bool;
}
type def = ty_def =
| Ty_uninterpreted of Sidekick_base_term.ID.t
| Ty_data of {
data : data;
}
| Ty_def of {
id : Sidekick_base_term.ID.t;
pp : ty Fmt.printer -> ty list Fmt.printer;
default_val : value list -> value;
}
val id : t -> int
val view : t -> view
val bool : state -> t
val real : state -> t
val atomic : def -> t list -> t
val atomic_uninterpreted : Sidekick_base_term.ID.t -> t
val finite : t -> bool
val set_finite : t -> bool -> unit
val is_bool : t -> bool
val is_uninterpreted : t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
val pp : t CCFormat.printer
module Tbl : CCHashtbl.S with type Tbl.key = t
module Fun : sig ... end
\ No newline at end of file +Ty (sidekick-arith.Sidekick_base_term__Base_types.Ty)

Module Sidekick_base_term__Base_types.Ty

type t = ty
type state = unit
type view = ty_view =
| Ty_bool
| Ty_real
| Ty_atomic of {
def : ty_def;
args : ty list;
mutable finite : bool;
}
type def = ty_def =
| Ty_uninterpreted of Sidekick_base_term.ID.t
| Ty_data of {
data : data;
}
| Ty_def of {
id : Sidekick_base_term.ID.t;
pp : ty Fmt.printer -> ty list Fmt.printer;
default_val : value list -> value;
}
val id : t -> int
val view : t -> view
val bool : state -> t
val real : state -> t
val atomic : def -> t list -> t
val id_of_def : def -> Sidekick_base_term.ID.t
val atomic_uninterpreted : Sidekick_base_term.ID.t -> t
val finite : t -> bool
val set_finite : t -> bool -> unit
val is_bool : t -> bool
val is_uninterpreted : t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
val pp : t CCFormat.printer
module Tbl : CCHashtbl.S with type Tbl.key = t
module Fun : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__Base_types/index.html b/dev/sidekick-arith/Sidekick_base_term__Base_types/index.html index 881ac56e..3c765592 100644 --- a/dev/sidekick-arith/Sidekick_base_term__Base_types/index.html +++ b/dev/sidekick-arith/Sidekick_base_term__Base_types/index.html @@ -1,2 +1,2 @@ -Sidekick_base_term__Base_types (sidekick-arith.Sidekick_base_term__Base_types)

Module Sidekick_base_term__Base_types

module Vec = Msat.Vec
module Log = Msat.Log
module Fmt = CCFormat
module CC_view = Sidekick_core.CC_view
type lra_pred = Sidekick_arith_lra.Predicate.t =
| Leq
| Geq
| Lt
| Gt
| Eq
| Neq
type lra_op = Sidekick_arith_lra.op =
| Plus
| Minus
type 'a lra_view = 'a Sidekick_arith_lra.lra_view =
| LRA_pred of lra_pred * 'a * 'a
| LRA_op of lra_op * 'a * 'a
| LRA_mult of Q.t * 'a
| LRA_const of Q.t
| LRA_simplex_var of 'a
| LRA_simplex_pred of 'a * Sidekick_arith_lra.S_op.t * Q.t
| LRA_other of 'a
type term = {
mutable term_id : int;
mutable term_ty : ty;
term_view : term term_view;
}
and 'a term_view =
| Bool of bool
| App_fun of fun_ * 'a Sidekick_util.IArray.t
| Eq of 'a * 'a
| Not of 'a
| Ite of 'a * 'a * 'a
| LRA of 'a lra_view
and fun_ = {
fun_id : Sidekick_base_term.ID.t;
fun_view : fun_view;
}
and fun_view =
| Fun_undef of fun_ty
| Fun_select of select
| Fun_cstor of cstor
| Fun_is_a of cstor
| Fun_def of {
pp : a. ('a Fmt.printer -> 'a Sidekick_util.IArray.t Fmt.printer) option;
abs : self:term -> term Sidekick_util.IArray.t -> term * bool;
do_cc : bool;
relevant : a. Sidekick_base_term.ID.t -> 'a Sidekick_util.IArray.t -> int -> bool;
ty : Sidekick_base_term.ID.t -> term Sidekick_util.IArray.t -> ty;
eval : value Sidekick_util.IArray.t -> value;
}

Methods on the custom term view whose arguments are 'a. Terms must be printable, and provide some additional theory handles.

  • relevant must return a subset of args (possibly the same set). The terms it returns will be activated and evaluated whenever possible. Terms in args \ relevant args are considered for congruence but not for evaluation.
and fun_ty = {
fun_ty_args : ty list;
fun_ty_ret : ty;
}

Function type

and ty = {
mutable ty_id : int;
ty_view : ty_view;
}

Hashconsed type

and ty_view =
| Ty_bool
| Ty_real
| Ty_atomic of {
def : ty_def;
args : ty list;
mutable finite : bool;
}
and ty_def =
| Ty_uninterpreted of Sidekick_base_term.ID.t
| Ty_data of {
data : data;
}
| Ty_def of {
id : Sidekick_base_term.ID.t;
pp : ty Fmt.printer -> ty list Fmt.printer;
default_val : value list -> value;
}
and data = {
data_id : Sidekick_base_term.ID.t;
data_cstors : cstor Sidekick_base_term__.ID.Map.t lazy_t;
data_as_ty : ty lazy_t;
}
and cstor = {
cstor_id : Sidekick_base_term.ID.t;
cstor_is_a : Sidekick_base_term.ID.t;
mutable cstor_arity : int;
cstor_args : select list lazy_t;
cstor_ty_as_data : data;
cstor_ty : ty lazy_t;
}
and select = {
select_id : Sidekick_base_term.ID.t;
select_cstor : cstor;
select_ty : ty lazy_t;
select_i : int;
}
and value =
| V_bool of bool
| V_element of {
id : Sidekick_base_term.ID.t;
ty : ty;
}

a named constant, distinct from any other constant

| V_cstor of {
c : cstor;
args : value list;
}
| V_custom of {
view : value_custom_view;
pp : value_custom_view Fmt.printer;
eq : value_custom_view -> value_custom_view -> bool;
hash : value_custom_view -> int;
}

Custom value

| V_real of Q.t

Semantic values, used for models (and possibly model-constructing calculi)

and value_custom_view = ..
type definition = Sidekick_base_term.ID.t * ty * term
type statement =
| Stmt_set_logic of string
| Stmt_set_option of string list
| Stmt_set_info of string * string
| Stmt_data of data list
| Stmt_ty_decl of Sidekick_base_term.ID.t * int
| Stmt_decl of Sidekick_base_term.ID.t * ty list * ty
| Stmt_define of definition list
| Stmt_assert of term
| Stmt_assert_clause of term list
| Stmt_check_sat of (bool * term) list
| Stmt_exit
val term_equal_ : term -> term -> bool
val term_hash_ : term -> int
val term_cmp_ : term -> term -> int
val fun_compare : fun_ -> fun_ -> int
val pp_fun : CCFormat.t -> fun_ -> unit
val id_of_fun : fun_ -> Sidekick_base_term.ID.t
val eq_ty : ty -> ty -> bool
val eq_cstor : cstor -> cstor -> bool
val eq_value : value -> value -> bool
val hash_value : value Sidekick_util.Hash.t
val pp_value : value Sidekick_util.Util.printer
val pp_db : Stdlib.Format.formatter -> (int * 'a) -> unit
val pp_ty : ty Sidekick_util.Util.printer
val string_of_lra_pred : lra_pred -> string
val pp_pred : Fmt.t -> lra_pred -> unit
val string_of_lra_op : lra_op -> string
val pp_lra_op : Fmt.t -> lra_op -> unit
val pp_term_view_gen : pp_id:(Fmt.t -> Sidekick_base_term.ID.t -> unit) -> pp_t:'a Fmt.printer -> Fmt.t -> 'a term_view -> unit
val pp_term_top : ids:bool -> Fmt.t -> term -> unit
val pp_term : Fmt.t -> term -> unit
val pp_term_view : Fmt.t -> term term_view -> unit
module Ty : sig ... end
module Fun : sig ... end
module Term_cell : sig ... end
module Term : sig ... end
module Value : sig ... end
module Data : sig ... end
module Select : sig ... end
module Cstor : sig ... end
module Proof : sig ... end
module Statement : sig ... end
\ No newline at end of file +Sidekick_base_term__Base_types (sidekick-arith.Sidekick_base_term__Base_types)

Module Sidekick_base_term__Base_types

module Vec = Msat.Vec
module Log = Msat.Log
module Fmt = CCFormat
module CC_view = Sidekick_core.CC_view
type lra_pred = Sidekick_arith_lra.Predicate.t =
| Leq
| Geq
| Lt
| Gt
| Eq
| Neq
type lra_op = Sidekick_arith_lra.op =
| Plus
| Minus
type 'a lra_view = 'a Sidekick_arith_lra.lra_view =
| LRA_pred of lra_pred * 'a * 'a
| LRA_op of lra_op * 'a * 'a
| LRA_mult of Q.t * 'a
| LRA_const of Q.t
| LRA_simplex_var of 'a
| LRA_simplex_pred of 'a * Sidekick_arith_lra.S_op.t * Q.t
| LRA_other of 'a
type term = {
mutable term_id : int;
mutable term_ty : ty;
term_view : term term_view;
}
and 'a term_view =
| Bool of bool
| App_fun of fun_ * 'a Sidekick_util.IArray.t
| Eq of 'a * 'a
| Not of 'a
| Ite of 'a * 'a * 'a
| LRA of 'a lra_view
and fun_ = {
fun_id : Sidekick_base_term.ID.t;
fun_view : fun_view;
}
and fun_view =
| Fun_undef of fun_ty
| Fun_select of select
| Fun_cstor of cstor
| Fun_is_a of cstor
| Fun_def of {
pp : a. ('a Fmt.printer -> 'a Sidekick_util.IArray.t Fmt.printer) option;
abs : self:term -> term Sidekick_util.IArray.t -> term * bool;
do_cc : bool;
relevant : a. Sidekick_base_term.ID.t -> 'a Sidekick_util.IArray.t -> int -> bool;
ty : Sidekick_base_term.ID.t -> term Sidekick_util.IArray.t -> ty;
eval : value Sidekick_util.IArray.t -> value;
}

Methods on the custom term view whose arguments are 'a. Terms must be printable, and provide some additional theory handles.

  • relevant must return a subset of args (possibly the same set). The terms it returns will be activated and evaluated whenever possible. Terms in args \ relevant args are considered for congruence but not for evaluation.
and fun_ty = {
fun_ty_args : ty list;
fun_ty_ret : ty;
}

Function type

and ty = {
mutable ty_id : int;
ty_view : ty_view;
}

Hashconsed type

and ty_view =
| Ty_bool
| Ty_real
| Ty_atomic of {
def : ty_def;
args : ty list;
mutable finite : bool;
}
and ty_def =
| Ty_uninterpreted of Sidekick_base_term.ID.t
| Ty_data of {
data : data;
}
| Ty_def of {
id : Sidekick_base_term.ID.t;
pp : ty Fmt.printer -> ty list Fmt.printer;
default_val : value list -> value;
}
and data = {
data_id : Sidekick_base_term.ID.t;
data_cstors : cstor Sidekick_base_term__.ID.Map.t lazy_t;
data_as_ty : ty lazy_t;
}
and cstor = {
cstor_id : Sidekick_base_term.ID.t;
cstor_is_a : Sidekick_base_term.ID.t;
mutable cstor_arity : int;
cstor_args : select list lazy_t;
cstor_ty_as_data : data;
cstor_ty : ty lazy_t;
}
and select = {
select_id : Sidekick_base_term.ID.t;
select_cstor : cstor;
select_ty : ty lazy_t;
select_i : int;
}
and value =
| V_bool of bool
| V_element of {
id : Sidekick_base_term.ID.t;
ty : ty;
}

a named constant, distinct from any other constant

| V_cstor of {
c : cstor;
args : value list;
}
| V_custom of {
view : value_custom_view;
pp : value_custom_view Fmt.printer;
eq : value_custom_view -> value_custom_view -> bool;
hash : value_custom_view -> int;
}

Custom value

| V_real of Q.t

Semantic values, used for models (and possibly model-constructing calculi)

and value_custom_view = ..
type definition = Sidekick_base_term.ID.t * ty * term
type statement =
| Stmt_set_logic of string
| Stmt_set_option of string list
| Stmt_set_info of string * string
| Stmt_data of data list
| Stmt_ty_decl of Sidekick_base_term.ID.t * int
| Stmt_decl of Sidekick_base_term.ID.t * ty list * ty
| Stmt_define of definition list
| Stmt_assert of term
| Stmt_assert_clause of term list
| Stmt_check_sat of (bool * term) list
| Stmt_exit
val term_equal_ : term -> term -> bool
val term_hash_ : term -> int
val term_cmp_ : term -> term -> int
val fun_compare : fun_ -> fun_ -> int
val pp_fun : CCFormat.t -> fun_ -> unit
val id_of_fun : fun_ -> Sidekick_base_term.ID.t
val eq_ty : ty -> ty -> bool
val eq_cstor : cstor -> cstor -> bool
val eq_value : value -> value -> bool
val hash_value : value Sidekick_util.Hash.t
val pp_value : value Sidekick_util.Util.printer
val pp_db : Stdlib.Format.formatter -> (int * 'a) -> unit
val pp_ty : ty Sidekick_util.Util.printer
val string_of_lra_pred : lra_pred -> string
val pp_pred : Fmt.t -> lra_pred -> unit
val string_of_lra_op : lra_op -> string
val pp_lra_op : Fmt.t -> lra_op -> unit
val pp_term_view_gen : pp_id:(Fmt.t -> Sidekick_base_term.ID.t -> unit) -> pp_t:'a Fmt.printer -> Fmt.t -> 'a term_view -> unit
val pp_term_top : ids:bool -> Fmt.t -> term -> unit
val pp_term : Fmt.t -> term -> unit
val pp_term_view : Fmt.t -> term term_view -> unit
module Ty : sig ... end
module Fun : sig ... end
module Term_cell : sig ... end
module Term : sig ... end
module Value : sig ... end
module Data : sig ... end
module Select : sig ... end
module Cstor : sig ... end
module Statement : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__Proof/.dune-keep b/dev/sidekick-arith/Sidekick_base_term__Proof/.dune-keep new file mode 100644 index 00000000..e69de29b diff --git a/dev/sidekick-arith/Sidekick_base_term__Proof/Quip/index.html b/dev/sidekick-arith/Sidekick_base_term__Proof/Quip/index.html new file mode 100644 index 00000000..c3513afc --- /dev/null +++ b/dev/sidekick-arith/Sidekick_base_term__Proof/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick-arith.Sidekick_base_term__Proof.Quip)

Module Sidekick_base_term__Proof.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick-arith/Sidekick_base_term__Proof/index.html b/dev/sidekick-arith/Sidekick_base_term__Proof/index.html new file mode 100644 index 00000000..91a9a2fc --- /dev/null +++ b/dev/sidekick-arith/Sidekick_base_term__Proof/index.html @@ -0,0 +1,2 @@ + +Sidekick_base_term__Proof (sidekick-arith.Sidekick_base_term__Proof)

Module Sidekick_base_term__Proof

include Sidekick_core.PROOF with type term = Sidekick_base_term.Base_types.Term.t and type ty = Sidekick_base_term.Base_types.Ty.t
type term = Sidekick_base_term.Base_types.Term.t
type ty = Sidekick_base_term.Base_types.Ty.t
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
val isa_split : ty -> term Iter.t -> t
val isa_disj : ty -> term -> term -> t
val cstor_inj : Sidekick_base_term.Base_types.Cstor.t -> int -> term list -> term list -> t
val bool_eq : term -> term -> t
val bool_c : string -> term list -> t
val ite_true : term -> t
val ite_false : term -> t
val lra : lit Iter.t -> t
val lra_l : lit list -> t
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Lit/index.html b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Lit/index.html index 914487af..56adf381 100644 --- a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Lit/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick-bin.Sidekick_smtlib.Process.Solver.Lit)

Module Solver.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick-bin.Sidekick_smtlib.Process.Solver.Lit)

Module Solver.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/P/Quip/index.html b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/P/Quip/index.html new file mode 100644 index 00000000..e76e7ff6 --- /dev/null +++ b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick-bin.Sidekick_smtlib.Process.Solver.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/P/index.html b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/P/index.html index 74005d21..7ca4aec9 100644 --- a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/P/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/P/index.html @@ -1,2 +1,2 @@ -P (sidekick-bin.Sidekick_smtlib.Process.Solver.P)

Module Solver.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick-bin.Sidekick_smtlib.Process.Solver.P)

Module Solver.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Pre_proof/index.html b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Pre_proof/index.html new file mode 100644 index 00000000..620671d4 --- /dev/null +++ b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick-bin.Sidekick_smtlib.Process.Solver.Pre_proof)

Module Solver.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Proof/index.html b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Proof/index.html deleted file mode 100644 index 41a47c39..00000000 --- a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick-bin.Sidekick_smtlib.Process.Solver.Proof)

Module Solver.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/Actions/index.html b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/Actions/index.html index 570f28d1..5771742d 100644 --- a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick-bin.Sidekick_smtlib.Process.Solver.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick-bin.Sidekick_smtlib.Process.Solver.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/Expl/index.html b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/Expl/index.html index dd76202e..27068ace 100644 --- a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick-bin.Sidekick_smtlib.Process.Solver.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick-bin.Sidekick_smtlib.Process.Solver.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/index.html b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/index.html index 017ade43..a29ec2e2 100644 --- a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick-bin.Sidekick_smtlib.Process.Solver.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick-bin.Sidekick_smtlib.Process.Solver.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/Simplify/index.html b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/Simplify/index.html index 44a98085..0ebcc646 100644 --- a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/Simplify/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick-bin.Sidekick_smtlib.Process.Solver.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick-bin.Sidekick_smtlib.Process.Solver.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/index.html b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/index.html index 323a8387..6a40171d 100644 --- a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick-bin.Sidekick_smtlib.Process.Solver.Solver_internal)

Module Solver.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick-bin.Sidekick_smtlib.Process.Solver.Solver_internal)

Module Solver.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/index.html b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/index.html index c069a0c9..f257d8ff 100644 --- a/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/index.html @@ -1,2 +1,2 @@ -Solver (sidekick-bin.Sidekick_smtlib.Process.Solver)

Module Process.Solver

module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +Solver (sidekick-bin.Sidekick_smtlib.Process.Solver)

Module Process.Solver

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib/Process/index.html b/dev/sidekick-bin/Sidekick_smtlib/Process/index.html index 28c735c5..7459d840 100644 --- a/dev/sidekick-bin/Sidekick_smtlib/Process/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib/Process/index.html @@ -1,2 +1,2 @@ -Process (sidekick-bin.Sidekick_smtlib.Process)

Module Sidekick_smtlib.Process

Process Statements

val th_bool : Solver.theory
val th_data : Solver.theory
val th_lra : Solver.theory
type 'a or_error = ('a, string) CCResult.t
module Check_cc : sig ... end
val process_stmt : ?⁠hyps:Solver.Atom.t list Sidekick_util.Vec.t -> ?⁠gc:bool -> ?⁠restarts:bool -> ?⁠pp_cnf:bool -> ?⁠dot_proof:string -> ?⁠pp_model:bool -> ?⁠check:bool -> ?⁠time:float -> ?⁠memory:float -> ?⁠progress:bool -> Solver.t -> Sidekick_base_term.Statement.t -> unit or_error
\ No newline at end of file +Process (sidekick-bin.Sidekick_smtlib.Process)

Module Sidekick_smtlib.Process

Process Statements

val th_bool : Solver.theory
val th_data : Solver.theory
val th_lra : Solver.theory
type 'a or_error = ('a, string) CCResult.t
module Check_cc : sig ... end
val process_stmt : ?⁠hyps:Solver.Atom.t list Sidekick_util.Vec.t -> ?⁠gc:bool -> ?⁠restarts:bool -> ?⁠pp_cnf:bool -> ?⁠dot_proof:string -> ?⁠proof_file:string -> ?⁠pp_model:bool -> ?⁠check:bool -> ?⁠time:float -> ?⁠memory:float -> ?⁠progress:bool -> Solver.t -> Sidekick_base_term.Statement.t -> unit or_error
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Lit/index.html b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Lit/index.html index a1646054..51c4e721 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Lit/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick-bin.Sidekick_smtlib__.Process.Solver.Lit)

Module Solver.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick-bin.Sidekick_smtlib__.Process.Solver.Lit)

Module Solver.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/P/Quip/index.html b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/P/Quip/index.html new file mode 100644 index 00000000..7e12ffb2 --- /dev/null +++ b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick-bin.Sidekick_smtlib__.Process.Solver.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/P/index.html b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/P/index.html index 09fce30e..104df3e2 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/P/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/P/index.html @@ -1,2 +1,2 @@ -P (sidekick-bin.Sidekick_smtlib__.Process.Solver.P)

Module Solver.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick-bin.Sidekick_smtlib__.Process.Solver.P)

Module Solver.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Pre_proof/index.html b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Pre_proof/index.html new file mode 100644 index 00000000..7c816ce5 --- /dev/null +++ b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick-bin.Sidekick_smtlib__.Process.Solver.Pre_proof)

Module Solver.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Proof/index.html b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Proof/index.html deleted file mode 100644 index e774e291..00000000 --- a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick-bin.Sidekick_smtlib__.Process.Solver.Proof)

Module Solver.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/Actions/index.html b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/Actions/index.html index d13f3b0e..154814a0 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick-bin.Sidekick_smtlib__.Process.Solver.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick-bin.Sidekick_smtlib__.Process.Solver.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/Expl/index.html b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/Expl/index.html index 98f4cb6a..06a24a3f 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick-bin.Sidekick_smtlib__.Process.Solver.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick-bin.Sidekick_smtlib__.Process.Solver.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/index.html b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/index.html index c4195037..40aaaaaa 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick-bin.Sidekick_smtlib__.Process.Solver.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick-bin.Sidekick_smtlib__.Process.Solver.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/Simplify/index.html b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/Simplify/index.html index 2fba6f5b..a8cd544e 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/Simplify/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick-bin.Sidekick_smtlib__.Process.Solver.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick-bin.Sidekick_smtlib__.Process.Solver.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/index.html b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/index.html index 17648469..6a024843 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick-bin.Sidekick_smtlib__.Process.Solver.Solver_internal)

Module Solver.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick-bin.Sidekick_smtlib__.Process.Solver.Solver_internal)

Module Solver.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/index.html b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/index.html index 9b992178..29373542 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__/Process/Solver/index.html @@ -1,2 +1,2 @@ -Solver (sidekick-bin.Sidekick_smtlib__.Process.Solver)

Module Process.Solver

module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +Solver (sidekick-bin.Sidekick_smtlib__.Process.Solver)

Module Process.Solver

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__/Process/index.html b/dev/sidekick-bin/Sidekick_smtlib__/Process/index.html index b593cee5..20c13fbb 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__/Process/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__/Process/index.html @@ -1,2 +1,2 @@ -Process (sidekick-bin.Sidekick_smtlib__.Process)

Module Sidekick_smtlib__.Process

Process Statements

val th_bool : Solver.theory
val th_data : Solver.theory
val th_lra : Solver.theory
type 'a or_error = ('a, string) CCResult.t
module Check_cc : sig ... end
val process_stmt : ?⁠hyps:Solver.Atom.t list Sidekick_util.Vec.t -> ?⁠gc:bool -> ?⁠restarts:bool -> ?⁠pp_cnf:bool -> ?⁠dot_proof:string -> ?⁠pp_model:bool -> ?⁠check:bool -> ?⁠time:float -> ?⁠memory:float -> ?⁠progress:bool -> Solver.t -> Sidekick_base_term.Statement.t -> unit or_error
\ No newline at end of file +Process (sidekick-bin.Sidekick_smtlib__.Process)

Module Sidekick_smtlib__.Process

Process Statements

val th_bool : Solver.theory
val th_data : Solver.theory
val th_lra : Solver.theory
type 'a or_error = ('a, string) CCResult.t
module Check_cc : sig ... end
val process_stmt : ?⁠hyps:Solver.Atom.t list Sidekick_util.Vec.t -> ?⁠gc:bool -> ?⁠restarts:bool -> ?⁠pp_cnf:bool -> ?⁠dot_proof:string -> ?⁠proof_file:string -> ?⁠pp_model:bool -> ?⁠check:bool -> ?⁠time:float -> ?⁠memory:float -> ?⁠progress:bool -> Solver.t -> Sidekick_base_term.Statement.t -> unit or_error
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Lit/index.html b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Lit/index.html index 46fc7aa6..ef2da80c 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Lit/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick-bin.Sidekick_smtlib__Process.Solver.Lit)

Module Solver.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick-bin.Sidekick_smtlib__Process.Solver.Lit)

Module Solver.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/P/Quip/index.html b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/P/Quip/index.html new file mode 100644 index 00000000..191a43a2 --- /dev/null +++ b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick-bin.Sidekick_smtlib__Process.Solver.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/P/index.html b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/P/index.html index 282d7fe2..94da99a9 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/P/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/P/index.html @@ -1,2 +1,2 @@ -P (sidekick-bin.Sidekick_smtlib__Process.Solver.P)

Module Solver.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick-bin.Sidekick_smtlib__Process.Solver.P)

Module Solver.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Pre_proof/index.html b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Pre_proof/index.html new file mode 100644 index 00000000..3d122bd8 --- /dev/null +++ b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick-bin.Sidekick_smtlib__Process.Solver.Pre_proof)

Module Solver.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Proof/index.html b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Proof/index.html deleted file mode 100644 index f551777f..00000000 --- a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick-bin.Sidekick_smtlib__Process.Solver.Proof)

Module Solver.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/Actions/index.html b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/Actions/index.html index 5b530957..31ee6581 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick-bin.Sidekick_smtlib__Process.Solver.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick-bin.Sidekick_smtlib__Process.Solver.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/Expl/index.html b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/Expl/index.html index 9a8c7e81..ca21ba88 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick-bin.Sidekick_smtlib__Process.Solver.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick-bin.Sidekick_smtlib__Process.Solver.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/index.html b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/index.html index 9d6477c7..cec28982 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick-bin.Sidekick_smtlib__Process.Solver.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick-bin.Sidekick_smtlib__Process.Solver.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/Simplify/index.html b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/Simplify/index.html index 040fa591..472c60cd 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/Simplify/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick-bin.Sidekick_smtlib__Process.Solver.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick-bin.Sidekick_smtlib__Process.Solver.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/index.html b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/index.html index 541d791b..9c0ad11e 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick-bin.Sidekick_smtlib__Process.Solver.Solver_internal)

Module Solver.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick-bin.Sidekick_smtlib__Process.Solver.Solver_internal)

Module Solver.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/index.html b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/index.html index 84f864c1..f6c62ab0 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__Process/Solver/index.html @@ -1,2 +1,2 @@ -Solver (sidekick-bin.Sidekick_smtlib__Process.Solver)

Module Sidekick_smtlib__Process.Solver

module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +Solver (sidekick-bin.Sidekick_smtlib__Process.Solver)

Module Sidekick_smtlib__Process.Solver

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick-bin/Sidekick_smtlib__Process/index.html b/dev/sidekick-bin/Sidekick_smtlib__Process/index.html index dee2293f..168414e9 100644 --- a/dev/sidekick-bin/Sidekick_smtlib__Process/index.html +++ b/dev/sidekick-bin/Sidekick_smtlib__Process/index.html @@ -1,2 +1,2 @@ -Sidekick_smtlib__Process (sidekick-bin.Sidekick_smtlib__Process)

Module Sidekick_smtlib__Process

Process Statements

val th_bool : Solver.theory
val th_data : Solver.theory
val th_lra : Solver.theory
type 'a or_error = ('a, string) CCResult.t
module Check_cc : sig ... end
val process_stmt : ?⁠hyps:Solver.Atom.t list Sidekick_util.Vec.t -> ?⁠gc:bool -> ?⁠restarts:bool -> ?⁠pp_cnf:bool -> ?⁠dot_proof:string -> ?⁠pp_model:bool -> ?⁠check:bool -> ?⁠time:float -> ?⁠memory:float -> ?⁠progress:bool -> Solver.t -> Sidekick_base_term.Statement.t -> unit or_error
\ No newline at end of file +Sidekick_smtlib__Process (sidekick-bin.Sidekick_smtlib__Process)

Module Sidekick_smtlib__Process

Process Statements

val th_bool : Solver.theory
val th_data : Solver.theory
val th_lra : Solver.theory
type 'a or_error = ('a, string) CCResult.t
module Check_cc : sig ... end
val process_stmt : ?⁠hyps:Solver.Atom.t list Sidekick_util.Vec.t -> ?⁠gc:bool -> ?⁠restarts:bool -> ?⁠pp_cnf:bool -> ?⁠dot_proof:string -> ?⁠proof_file:string -> ?⁠pp_model:bool -> ?⁠check:bool -> ?⁠time:float -> ?⁠memory:float -> ?⁠progress:bool -> Solver.t -> Sidekick_base_term.Statement.t -> unit or_error
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/Make/Expl/index.html b/dev/sidekick/Sidekick_cc/Make/Expl/index.html index f736468a..32066290 100644 --- a/dev/sidekick/Sidekick_cc/Make/Expl/index.html +++ b/dev/sidekick/Sidekick_cc/Make/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_cc.Make.Expl)

Module Make.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_cc.Make.Expl)

Module Make.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/Make/argument-1-A/Actions/index.html b/dev/sidekick/Sidekick_cc/Make/argument-1-A/Actions/index.html index 8831b589..39879b66 100644 --- a/dev/sidekick/Sidekick_cc/Make/argument-1-A/Actions/index.html +++ b/dev/sidekick/Sidekick_cc/Make/argument-1-A/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_cc.Make.1-A.Actions)

Module 1-A.Actions

module T = T
module P = P
module Lit = Lit
type t

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_cc.Make.1-A.Actions)

Module 1-A.Actions

module T = T
module Lit = Lit
module P = P
type t

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/Make/argument-1-A/Lit/index.html b/dev/sidekick/Sidekick_cc/Make/argument-1-A/Lit/index.html index b3ae2940..63b4725c 100644 --- a/dev/sidekick/Sidekick_cc/Make/argument-1-A/Lit/index.html +++ b/dev/sidekick/Sidekick_cc/Make/argument-1-A/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_cc.Make.1-A.Lit)

Module 1-A.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_cc.Make.1-A.Lit)

Module 1-A.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/Make/argument-1-A/P/Quip/index.html b/dev/sidekick/Sidekick_cc/Make/argument-1-A/P/Quip/index.html new file mode 100644 index 00000000..7ecf0a00 --- /dev/null +++ b/dev/sidekick/Sidekick_cc/Make/argument-1-A/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_cc.Make.1-A.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/Make/argument-1-A/P/index.html b/dev/sidekick/Sidekick_cc/Make/argument-1-A/P/index.html index 30c426e5..5c5ad5d1 100644 --- a/dev/sidekick/Sidekick_cc/Make/argument-1-A/P/index.html +++ b/dev/sidekick/Sidekick_cc/Make/argument-1-A/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_cc.Make.1-A.P)

Module 1-A.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_cc.Make.1-A.P)

Module 1-A.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/Make/argument-1-A/index.html b/dev/sidekick/Sidekick_cc/Make/argument-1-A/index.html index 10866644..0fbc65ec 100644 --- a/dev/sidekick/Sidekick_cc/Make/argument-1-A/index.html +++ b/dev/sidekick/Sidekick_cc/Make/argument-1-A/index.html @@ -1,2 +1,2 @@ -1-A (sidekick.Sidekick_cc.Make.1-A)

Parameter Make.1-A

module Lit : Sidekick_core.LIT with module T = T
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module P = P and module Lit = Lit
val cc_view : T.Term.t -> (T.Fun.tT.Term.tT.Term.t Iter.t) Sidekick_core.CC_view.t

View the term through the lens of the congruence closure

\ No newline at end of file +1-A (sidekick.Sidekick_cc.Make.1-A)

Parameter Make.1-A

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module P = P and module Lit = Lit
val cc_view : T.Term.t -> (T.Fun.tT.Term.tT.Term.t Iter.t) Sidekick_core.CC_view.t

View the term through the lens of the congruence closure

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/Make/index.html b/dev/sidekick/Sidekick_cc/Make/index.html index 30e932e9..a1cb736b 100644 --- a/dev/sidekick/Sidekick_cc/Make/index.html +++ b/dev/sidekick/Sidekick_cc/Make/index.html @@ -1,2 +1,2 @@ -Make (sidekick.Sidekick_cc.Make)

Module Sidekick_cc.Make

Parameters

Signature

module T = A.T
module P = A.P
module Lit = A.Lit
module Actions = A.Actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +Make (sidekick.Sidekick_cc.Make)

Module Sidekick_cc.Make

Parameters

Signature

module T = A.T
module P = A.P
module Lit = A.Lit
module Actions = A.Actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/module-type-S/Actions/index.html b/dev/sidekick/Sidekick_cc/module-type-S/Actions/index.html index c0ba38fe..18356cc9 100644 --- a/dev/sidekick/Sidekick_cc/module-type-S/Actions/index.html +++ b/dev/sidekick/Sidekick_cc/module-type-S/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_cc.S.Actions)

Module S.Actions

module T = T
module P = P
module Lit = Lit
type t

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_cc.S.Actions)

Module S.Actions

module T = T
module Lit = Lit
module P = P
type t

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/module-type-S/Expl/index.html b/dev/sidekick/Sidekick_cc/module-type-S/Expl/index.html index af530f38..6362e8bd 100644 --- a/dev/sidekick/Sidekick_cc/module-type-S/Expl/index.html +++ b/dev/sidekick/Sidekick_cc/module-type-S/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_cc.S.Expl)

Module S.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_cc.S.Expl)

Module S.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/module-type-S/Lit/index.html b/dev/sidekick/Sidekick_cc/module-type-S/Lit/index.html index dc1cd6ea..91778e4f 100644 --- a/dev/sidekick/Sidekick_cc/module-type-S/Lit/index.html +++ b/dev/sidekick/Sidekick_cc/module-type-S/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_cc.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_cc.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/module-type-S/P/Quip/index.html b/dev/sidekick/Sidekick_cc/module-type-S/P/Quip/index.html new file mode 100644 index 00000000..be8c01e4 --- /dev/null +++ b/dev/sidekick/Sidekick_cc/module-type-S/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_cc.S.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/module-type-S/P/index.html b/dev/sidekick/Sidekick_cc/module-type-S/P/index.html index 1594c141..f7f90f93 100644 --- a/dev/sidekick/Sidekick_cc/module-type-S/P/index.html +++ b/dev/sidekick/Sidekick_cc/module-type-S/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_cc.S.P)

Module S.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_cc.S.P)

Module S.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_cc/module-type-S/index.html b/dev/sidekick/Sidekick_cc/module-type-S/index.html index dd3b2862..4b3551b6 100644 --- a/dev/sidekick/Sidekick_cc/module-type-S/index.html +++ b/dev/sidekick/Sidekick_cc/module-type-S/index.html @@ -1,2 +1,2 @@ -S (sidekick.Sidekick_cc.S)

Module type Sidekick_cc.S

module Lit : Sidekick_core.LIT with module T = T
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +S (sidekick.Sidekick_cc.S)

Module type Sidekick_cc.S

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/Actions/index.html b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/Actions/index.html index ced5aeba..87b03f53 100644 --- a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/Actions/index.html +++ b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

  • reason() should return a list of literals that are currently true.
  • lit should be a literal of interest (see CC_S.set_as_lit).

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

  • reason() should return a list of literals that are currently true.
  • lit should be a literal of interest (see CC_S.set_as_lit).

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/Expl/index.html b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/Expl/index.html index 7bd495e4..a9255834 100644 --- a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/Expl/index.html +++ b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/index.html b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/index.html index 3546cc83..f529bfa9 100644 --- a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/index.html +++ b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.CC)

Module SI.CC

module T = T
module P = P
module Lit = Lit
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.CC)

Module SI.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/Lit/index.html b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/Lit/index.html index 4a8621a3..6f5b9c8f 100644 --- a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/Lit/index.html +++ b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.Lit)

Module SI.Lit

Literals

A literal is a (preprocessed) term along with its sign. It is directly manipulated by the SAT solver.

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.Lit)

Module SI.Lit

Literals

A literal is a (preprocessed) term along with its sign. It is directly manipulated by the SAT solver.

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/P/Quip/index.html b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/P/Quip/index.html new file mode 100644 index 00000000..0f1ca5ba --- /dev/null +++ b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/P/index.html b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/P/index.html index 4ebd439f..615c1659 100644 --- a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/P/index.html +++ b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.P)

Module SI.P

type t
val pp : t Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.P)

Module SI.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/Simplify/index.html b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/Simplify/index.html index 1e286499..845a51aa 100644 --- a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/Simplify/index.html +++ b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.Simplify)

Module SI.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI.Simplify)

Module SI.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/index.html b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/index.html index da7adbf6..69a60957 100644 --- a/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/index.html +++ b/dev/sidekick/Sidekick_core/Monoid_of_repr/argument-1-M/SI/index.html @@ -1,2 +1,2 @@ -SI (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI)

Module 1-M.SI

module T : TERM
module P : PROOF
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit : LIT with module T = T
type lit = Lit.t

Congruence Closure

module CC : CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +SI (sidekick.Sidekick_core.Monoid_of_repr.1-M.SI)

Module 1-M.SI

module T : TERM
module P : PROOF with type term = T.Term.t
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit : LIT with module T = T
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/Lit/index.html b/dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/Lit/index.html index d4772774..588f9eb3 100644 --- a/dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/Lit/index.html +++ b/dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_core.CC_ACTIONS.Lit)

Module CC_ACTIONS.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_core.CC_ACTIONS.Lit)

Module CC_ACTIONS.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/P/Quip/index.html b/dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/P/Quip/index.html new file mode 100644 index 00000000..3c09283a --- /dev/null +++ b/dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_core.CC_ACTIONS.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/P/index.html b/dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/P/index.html index 53f54ebe..2a8e97cd 100644 --- a/dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/P/index.html +++ b/dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_core.CC_ACTIONS.P)

Module CC_ACTIONS.P

type t
val pp : t Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_core.CC_ACTIONS.P)

Module CC_ACTIONS.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/index.html b/dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/index.html index 4a832454..ebafe2a8 100644 --- a/dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/index.html +++ b/dev/sidekick/Sidekick_core/module-type-CC_ACTIONS/index.html @@ -1,2 +1,2 @@ -CC_ACTIONS (sidekick.Sidekick_core.CC_ACTIONS)

Module type Sidekick_core.CC_ACTIONS

Actions provided to the congruence closure.

The congruence closure must be able to propagate literals when it detects that they are true or false; it must also be able to create conflicts when the set of (dis)equalities is inconsistent

module T : TERM
module P : PROOF
module Lit : LIT with module T = T
type t

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

  • reason() should return a list of literals that are currently true.
  • lit should be a literal of interest (see CC_S.set_as_lit).

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +CC_ACTIONS (sidekick.Sidekick_core.CC_ACTIONS)

Module type Sidekick_core.CC_ACTIONS

Actions provided to the congruence closure.

The congruence closure must be able to propagate literals when it detects that they are true or false; it must also be able to create conflicts when the set of (dis)equalities is inconsistent

module T : TERM
module Lit : LIT with module T = T
module P : PROOF with type term = T.Term.t
type t

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

  • reason() should return a list of literals that are currently true.
  • lit should be a literal of interest (see CC_S.set_as_lit).

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_ARG/Actions/index.html b/dev/sidekick/Sidekick_core/module-type-CC_ARG/Actions/index.html index 58d96019..7ed0e716 100644 --- a/dev/sidekick/Sidekick_core/module-type-CC_ARG/Actions/index.html +++ b/dev/sidekick/Sidekick_core/module-type-CC_ARG/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_core.CC_ARG.Actions)

Module CC_ARG.Actions

module T = T
module P = P
module Lit = Lit
type t

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

  • reason() should return a list of literals that are currently true.
  • lit should be a literal of interest (see CC_S.set_as_lit).

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_core.CC_ARG.Actions)

Module CC_ARG.Actions

module T = T
module Lit = Lit
module P = P
type t

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

  • reason() should return a list of literals that are currently true.
  • lit should be a literal of interest (see CC_S.set_as_lit).

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_ARG/Lit/index.html b/dev/sidekick/Sidekick_core/module-type-CC_ARG/Lit/index.html index 9f40dbc8..018e6f17 100644 --- a/dev/sidekick/Sidekick_core/module-type-CC_ARG/Lit/index.html +++ b/dev/sidekick/Sidekick_core/module-type-CC_ARG/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_core.CC_ARG.Lit)

Module CC_ARG.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_core.CC_ARG.Lit)

Module CC_ARG.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_ARG/P/Quip/index.html b/dev/sidekick/Sidekick_core/module-type-CC_ARG/P/Quip/index.html new file mode 100644 index 00000000..01274370 --- /dev/null +++ b/dev/sidekick/Sidekick_core/module-type-CC_ARG/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_core.CC_ARG.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_ARG/P/index.html b/dev/sidekick/Sidekick_core/module-type-CC_ARG/P/index.html index 71196ec3..1c228b53 100644 --- a/dev/sidekick/Sidekick_core/module-type-CC_ARG/P/index.html +++ b/dev/sidekick/Sidekick_core/module-type-CC_ARG/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_core.CC_ARG.P)

Module CC_ARG.P

type t
val pp : t Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_core.CC_ARG.P)

Module CC_ARG.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_ARG/index.html b/dev/sidekick/Sidekick_core/module-type-CC_ARG/index.html index 4e029c32..ee17cdbf 100644 --- a/dev/sidekick/Sidekick_core/module-type-CC_ARG/index.html +++ b/dev/sidekick/Sidekick_core/module-type-CC_ARG/index.html @@ -1,2 +1,2 @@ -CC_ARG (sidekick.Sidekick_core.CC_ARG)

Module type Sidekick_core.CC_ARG

Arguments to a congruence closure's implementation

module T : TERM
module P : PROOF
module Lit : LIT with module T = T
module Actions : CC_ACTIONS with module T = T and module P = P and module Lit = Lit
val cc_view : T.Term.t -> (T.Fun.tT.Term.tT.Term.t Iter.t) CC_view.t

View the term through the lens of the congruence closure

\ No newline at end of file +CC_ARG (sidekick.Sidekick_core.CC_ARG)

Module type Sidekick_core.CC_ARG

Arguments to a congruence closure's implementation

module T : TERM
module P : PROOF with type term = T.Term.t
module Lit : LIT with module T = T
module Actions : CC_ACTIONS with module T = T and module P = P and module Lit = Lit
val cc_view : T.Term.t -> (T.Fun.tT.Term.tT.Term.t Iter.t) CC_view.t

View the term through the lens of the congruence closure

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_S/Actions/index.html b/dev/sidekick/Sidekick_core/module-type-CC_S/Actions/index.html index f8a327bb..3813a376 100644 --- a/dev/sidekick/Sidekick_core/module-type-CC_S/Actions/index.html +++ b/dev/sidekick/Sidekick_core/module-type-CC_S/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_core.CC_S.Actions)

Module CC_S.Actions

module T = T
module P = P
module Lit = Lit
type t

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

  • reason() should return a list of literals that are currently true.
  • lit should be a literal of interest (see CC_S.set_as_lit).

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_core.CC_S.Actions)

Module CC_S.Actions

module T = T
module Lit = Lit
module P = P
type t

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

  • reason() should return a list of literals that are currently true.
  • lit should be a literal of interest (see CC_S.set_as_lit).

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_S/Expl/index.html b/dev/sidekick/Sidekick_core/module-type-CC_S/Expl/index.html index 6e72af80..a296eeae 100644 --- a/dev/sidekick/Sidekick_core/module-type-CC_S/Expl/index.html +++ b/dev/sidekick/Sidekick_core/module-type-CC_S/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_core.CC_S.Expl)

Module CC_S.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_core.CC_S.Expl)

Module CC_S.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_S/Lit/index.html b/dev/sidekick/Sidekick_core/module-type-CC_S/Lit/index.html index b6d309cc..7528b77f 100644 --- a/dev/sidekick/Sidekick_core/module-type-CC_S/Lit/index.html +++ b/dev/sidekick/Sidekick_core/module-type-CC_S/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_core.CC_S.Lit)

Module CC_S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_core.CC_S.Lit)

Module CC_S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_S/P/Quip/index.html b/dev/sidekick/Sidekick_core/module-type-CC_S/P/Quip/index.html new file mode 100644 index 00000000..6c3102bc --- /dev/null +++ b/dev/sidekick/Sidekick_core/module-type-CC_S/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_core.CC_S.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_S/P/index.html b/dev/sidekick/Sidekick_core/module-type-CC_S/P/index.html index 5dab4a1d..a421a6c1 100644 --- a/dev/sidekick/Sidekick_core/module-type-CC_S/P/index.html +++ b/dev/sidekick/Sidekick_core/module-type-CC_S/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_core.CC_S.P)

Module CC_S.P

type t
val pp : t Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_core.CC_S.P)

Module CC_S.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-CC_S/index.html b/dev/sidekick/Sidekick_core/module-type-CC_S/index.html index 52b50ab6..05422c36 100644 --- a/dev/sidekick/Sidekick_core/module-type-CC_S/index.html +++ b/dev/sidekick/Sidekick_core/module-type-CC_S/index.html @@ -1,2 +1,2 @@ -CC_S (sidekick.Sidekick_core.CC_S)

Module type Sidekick_core.CC_S

Signature of the congruence closure

module T : TERM
module P : PROOF
module Lit : LIT with module T = T
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC_S (sidekick.Sidekick_core.CC_S)

Module type Sidekick_core.CC_S

Signature of the congruence closure

module T : TERM
module P : PROOF with type term = T.Term.t
module Lit : LIT with module T = T
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-LIT/index.html b/dev/sidekick/Sidekick_core/module-type-LIT/index.html index df136457..8866cdb0 100644 --- a/dev/sidekick/Sidekick_core/module-type-LIT/index.html +++ b/dev/sidekick/Sidekick_core/module-type-LIT/index.html @@ -1,2 +1,2 @@ -LIT (sidekick.Sidekick_core.LIT)

Module type Sidekick_core.LIT

Literals

Literals are a pair of a boolean-sorted term, and a sign. Positive literals are the same as their term, and negative literals are the negation of their term.

The SAT solver deals only in literals and clauses (sets of literals). Everything else belongs in the SMT solver.

module T : TERM

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
\ No newline at end of file +LIT (sidekick.Sidekick_core.LIT)

Module type Sidekick_core.LIT

Literals

Literals are a pair of a boolean-sorted term, and a sign. Positive literals are the same as their term, and negative literals are the negation of their term.

The SAT solver deals only in literals and clauses (sets of literals). Everything else belongs in the SMT solver.

module T : TERM

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/Actions/index.html b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/Actions/index.html index e82331b5..16f3f520 100644 --- a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/Actions/index.html +++ b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_core.MONOID_ARG.SI.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

  • reason() should return a list of literals that are currently true.
  • lit should be a literal of interest (see CC_S.set_as_lit).

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_core.MONOID_ARG.SI.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

  • reason() should return a list of literals that are currently true.
  • lit should be a literal of interest (see CC_S.set_as_lit).

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/Expl/index.html b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/Expl/index.html index f90a958e..15b0aa61 100644 --- a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/Expl/index.html +++ b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_core.MONOID_ARG.SI.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_core.MONOID_ARG.SI.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/index.html b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/index.html index 48387470..4d4c73a5 100644 --- a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/index.html +++ b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_core.MONOID_ARG.SI.CC)

Module SI.CC

module T = T
module P = P
module Lit = Lit
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_core.MONOID_ARG.SI.CC)

Module SI.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/Lit/index.html b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/Lit/index.html index ec5ed206..511c7218 100644 --- a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/Lit/index.html +++ b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_core.MONOID_ARG.SI.Lit)

Module SI.Lit

Literals

A literal is a (preprocessed) term along with its sign. It is directly manipulated by the SAT solver.

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_core.MONOID_ARG.SI.Lit)

Module SI.Lit

Literals

A literal is a (preprocessed) term along with its sign. It is directly manipulated by the SAT solver.

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/P/Quip/index.html b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/P/Quip/index.html new file mode 100644 index 00000000..9ec76687 --- /dev/null +++ b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_core.MONOID_ARG.SI.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/P/index.html b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/P/index.html index 7774e0ab..de9dda24 100644 --- a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/P/index.html +++ b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_core.MONOID_ARG.SI.P)

Module SI.P

type t
val pp : t Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_core.MONOID_ARG.SI.P)

Module SI.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/Simplify/index.html b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/Simplify/index.html index a25e8124..ae73b50e 100644 --- a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/Simplify/index.html +++ b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick.Sidekick_core.MONOID_ARG.SI.Simplify)

Module SI.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick.Sidekick_core.MONOID_ARG.SI.Simplify)

Module SI.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/index.html b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/index.html index 7922c2e7..25a4a068 100644 --- a/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/index.html +++ b/dev/sidekick/Sidekick_core/module-type-MONOID_ARG/SI/index.html @@ -1,2 +1,2 @@ -SI (sidekick.Sidekick_core.MONOID_ARG.SI)

Module MONOID_ARG.SI

module T : TERM
module P : PROOF
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit : LIT with module T = T
type lit = Lit.t

Congruence Closure

module CC : CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +SI (sidekick.Sidekick_core.MONOID_ARG.SI)

Module MONOID_ARG.SI

module T : TERM
module P : PROOF with type term = T.Term.t
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit : LIT with module T = T
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-PROOF/Quip/index.html b/dev/sidekick/Sidekick_core/module-type-PROOF/Quip/index.html new file mode 100644 index 00000000..14610b2b --- /dev/null +++ b/dev/sidekick/Sidekick_core/module-type-PROOF/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_core.PROOF.Quip)

Module PROOF.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-PROOF/index.html b/dev/sidekick/Sidekick_core/module-type-PROOF/index.html index 792ee38f..c5a73b97 100644 --- a/dev/sidekick/Sidekick_core/module-type-PROOF/index.html +++ b/dev/sidekick/Sidekick_core/module-type-PROOF/index.html @@ -1,2 +1,2 @@ -PROOF (sidekick.Sidekick_core.PROOF)

Module type Sidekick_core.PROOF

type t
val pp : t Fmt.printer
val default : t
\ No newline at end of file +PROOF (sidekick.Sidekick_core.PROOF)

Module type Sidekick_core.PROOF

type term
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER/Lit/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER/Lit/index.html index 660d41d6..a746f73b 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER/Lit/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_core.SOLVER.Lit)

Module SOLVER.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_core.SOLVER.Lit)

Module SOLVER.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER/P/Quip/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER/P/Quip/index.html new file mode 100644 index 00000000..530c4ad6 --- /dev/null +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_core.SOLVER.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER/P/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER/P/index.html index b80262ac..19c1a0e6 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER/P/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_core.SOLVER.P)

Module SOLVER.P

type t
val pp : t Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_core.SOLVER.P)

Module SOLVER.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER/Pre_proof/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER/Pre_proof/index.html new file mode 100644 index 00000000..70ba1c6d --- /dev/null +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick.Sidekick_core.SOLVER.Pre_proof)

Module SOLVER.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Fmt.printer
val pp_dot : t Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER/Proof/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER/Proof/index.html deleted file mode 100644 index 41eeb291..00000000 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick.Sidekick_core.SOLVER.Proof)

Module SOLVER.Proof

type t
val check : t -> unit
val pp_dot : t Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/Actions/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/Actions/index.html index 95cc3ea0..11cab0c9 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_core.SOLVER.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

  • reason() should return a list of literals that are currently true.
  • lit should be a literal of interest (see CC_S.set_as_lit).

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_core.SOLVER.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

  • reason() should return a list of literals that are currently true.
  • lit should be a literal of interest (see CC_S.set_as_lit).

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/Expl/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/Expl/index.html index a4fadcfd..604f50a4 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_core.SOLVER.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_core.SOLVER.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/index.html index 29c9b058..305ba936 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_core.SOLVER.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_core.SOLVER.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/Simplify/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/Simplify/index.html index c8fac7fd..25fd8fc8 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/Simplify/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick.Sidekick_core.SOLVER.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick.Sidekick_core.SOLVER.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/index.html index 2fc9b9e4..8259c2a9 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick.Sidekick_core.SOLVER.Solver_internal)

Module SOLVER.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick.Sidekick_core.SOLVER.Solver_internal)

Module SOLVER.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER/index.html index 57c86868..0cdcca56 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER/index.html @@ -1,2 +1,2 @@ -SOLVER (sidekick.Sidekick_core.SOLVER)

Module type Sidekick_core.SOLVER

User facing view of the solver

This is the solver a user of sidekick can see, after instantiating everything. The user can add some theories, clauses, etc. and asks the solver to check satisfiability.

Theory implementors will mostly interact with SOLVER_INTERNAL.

module T : TERM
module P : PROOF
module Lit : LIT with module T = T
module Solver_internal : SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +SOLVER (sidekick.Sidekick_core.SOLVER)

Module type Sidekick_core.SOLVER

User facing view of the solver

This is the solver a user of sidekick can see, after instantiating everything. The user can add some theories, clauses, etc. and asks the solver to check satisfiability.

Theory implementors will mostly interact with SOLVER_INTERNAL.

module T : TERM
module P : PROOF with type term = T.Term.t
module Lit : LIT with module T = T
module Solver_internal : SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/Actions/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/Actions/index.html index 5bfff607..c9b68e35 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/Actions/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_core.SOLVER_INTERNAL.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

  • reason() should return a list of literals that are currently true.
  • lit should be a literal of interest (see CC_S.set_as_lit).

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_core.SOLVER_INTERNAL.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

  • reason() should return a list of literals that are currently true.
  • lit should be a literal of interest (see CC_S.set_as_lit).

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/Expl/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/Expl/index.html index 3114e9ba..d86d0e11 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/Expl/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_core.SOLVER_INTERNAL.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_core.SOLVER_INTERNAL.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/index.html index cc3cba42..2c7191b9 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_core.SOLVER_INTERNAL.CC)

Module SOLVER_INTERNAL.CC

module T = T
module P = P
module Lit = Lit
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_core.SOLVER_INTERNAL.CC)

Module SOLVER_INTERNAL.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/Lit/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/Lit/index.html index 0e8679c4..b15477e6 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/Lit/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_core.SOLVER_INTERNAL.Lit)

Module SOLVER_INTERNAL.Lit

Literals

A literal is a (preprocessed) term along with its sign. It is directly manipulated by the SAT solver.

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_core.SOLVER_INTERNAL.Lit)

Module SOLVER_INTERNAL.Lit

Literals

A literal is a (preprocessed) term along with its sign. It is directly manipulated by the SAT solver.

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/P/Quip/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/P/Quip/index.html new file mode 100644 index 00000000..45371226 --- /dev/null +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_core.SOLVER_INTERNAL.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/P/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/P/index.html index d8ea345c..bc5fba09 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/P/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_core.SOLVER_INTERNAL.P)

Module SOLVER_INTERNAL.P

type t
val pp : t Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_core.SOLVER_INTERNAL.P)

Module SOLVER_INTERNAL.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/Simplify/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/Simplify/index.html index 299cfa59..edd0e11a 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/Simplify/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick.Sidekick_core.SOLVER_INTERNAL.Simplify)

Module SOLVER_INTERNAL.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick.Sidekick_core.SOLVER_INTERNAL.Simplify)

Module SOLVER_INTERNAL.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/index.html b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/index.html index abfea31d..1efe1816 100644 --- a/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/index.html +++ b/dev/sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/index.html @@ -1,2 +1,2 @@ -SOLVER_INTERNAL (sidekick.Sidekick_core.SOLVER_INTERNAL)

Module type Sidekick_core.SOLVER_INTERNAL

A view of the solver from a theory's point of view.

Theories should interact with the solver via this module, to assert new lemmas, propagate literals, access the congruence closure, etc.

module T : TERM
module P : PROOF
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit : LIT with module T = T
type lit = Lit.t

Congruence Closure

module CC : CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +SOLVER_INTERNAL (sidekick.Sidekick_core.SOLVER_INTERNAL)

Module type Sidekick_core.SOLVER_INTERNAL

A view of the solver from a theory's point of view.

Theories should interact with the solver via this module, to assert new lemmas, propagate literals, access the congruence closure, etc.

module T : TERM
module P : PROOF with type term = T.Term.t
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit : LIT with module T = T
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/Make/Lit/index.html b/dev/sidekick/Sidekick_msat_solver/Make/Lit/index.html index bc6acec4..b50aa61a 100644 --- a/dev/sidekick/Sidekick_msat_solver/Make/Lit/index.html +++ b/dev/sidekick/Sidekick_msat_solver/Make/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_msat_solver.Make.Lit)

Module Make.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_msat_solver.Make.Lit)

Module Make.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/Make/Pre_proof/index.html b/dev/sidekick/Sidekick_msat_solver/Make/Pre_proof/index.html new file mode 100644 index 00000000..62dbd16c --- /dev/null +++ b/dev/sidekick/Sidekick_msat_solver/Make/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick.Sidekick_msat_solver.Make.Pre_proof)

Module Make.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/Make/Proof/index.html b/dev/sidekick/Sidekick_msat_solver/Make/Proof/index.html deleted file mode 100644 index 33304cf2..00000000 --- a/dev/sidekick/Sidekick_msat_solver/Make/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick.Sidekick_msat_solver.Make.Proof)

Module Make.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/Actions/index.html b/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/Actions/index.html index bd99253b..7c07901e 100644 --- a/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_msat_solver.Make.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_msat_solver.Make.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/Expl/index.html b/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/Expl/index.html index 71a51b7d..ddb7f546 100644 --- a/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_msat_solver.Make.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_msat_solver.Make.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/index.html index 72c185ee..e1778afc 100644 --- a/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_msat_solver.Make.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_msat_solver.Make.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/Simplify/index.html b/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/Simplify/index.html index 7599108f..1b0bb915 100644 --- a/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/Simplify/index.html +++ b/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick.Sidekick_msat_solver.Make.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick.Sidekick_msat_solver.Make.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/index.html b/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/index.html index e1966bc0..9bd88b9a 100644 --- a/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/index.html +++ b/dev/sidekick/Sidekick_msat_solver/Make/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick.Sidekick_msat_solver.Make.Solver_internal)

Module Make.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick.Sidekick_msat_solver.Make.Solver_internal)

Module Make.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/Make/argument-1-A/P/Quip/index.html b/dev/sidekick/Sidekick_msat_solver/Make/argument-1-A/P/Quip/index.html new file mode 100644 index 00000000..9503892d --- /dev/null +++ b/dev/sidekick/Sidekick_msat_solver/Make/argument-1-A/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_msat_solver.Make.1-A.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/Make/argument-1-A/P/index.html b/dev/sidekick/Sidekick_msat_solver/Make/argument-1-A/P/index.html index 2fba7f84..54610786 100644 --- a/dev/sidekick/Sidekick_msat_solver/Make/argument-1-A/P/index.html +++ b/dev/sidekick/Sidekick_msat_solver/Make/argument-1-A/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_msat_solver.Make.1-A.P)

Module 1-A.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_msat_solver.Make.1-A.P)

Module 1-A.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/Make/argument-1-A/index.html b/dev/sidekick/Sidekick_msat_solver/Make/argument-1-A/index.html index d9cd44a6..3eb939c6 100644 --- a/dev/sidekick/Sidekick_msat_solver/Make/argument-1-A/index.html +++ b/dev/sidekick/Sidekick_msat_solver/Make/argument-1-A/index.html @@ -1,2 +1,2 @@ -1-A (sidekick.Sidekick_msat_solver.Make.1-A)

Parameter Make.1-A

val cc_view : T.Term.t -> (T.Fun.tT.Term.tT.Term.t Iter.t) Sidekick_core.CC_view.t
val is_valid_literal : T.Term.t -> bool

Is this a valid boolean literal? (e.g. is it a closed term, not inside a quantifier)

\ No newline at end of file +1-A (sidekick.Sidekick_msat_solver.Make.1-A)

Parameter Make.1-A

module P : Sidekick_core.PROOF with type term = T.Term.t
val cc_view : T.Term.t -> (T.Fun.tT.Term.tT.Term.t Iter.t) Sidekick_core.CC_view.t
val is_valid_literal : T.Term.t -> bool

Is this a valid boolean literal? (e.g. is it a closed term, not inside a quantifier)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/Make/index.html b/dev/sidekick/Sidekick_msat_solver/Make/index.html index 1ba63c41..12e13e19 100644 --- a/dev/sidekick/Sidekick_msat_solver/Make/index.html +++ b/dev/sidekick/Sidekick_msat_solver/Make/index.html @@ -1,2 +1,2 @@ -Make (sidekick.Sidekick_msat_solver.Make)

Module Sidekick_msat_solver.Make

Main functor to get a solver.

Parameters

Signature

module T = A.T
module P = A.P
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +Make (sidekick.Sidekick_msat_solver.Make)

Module Sidekick_msat_solver.Make

Main functor to get a solver.

Parameters

Signature

module T = A.T
module P = A.P
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/module-type-ARG/P/Quip/index.html b/dev/sidekick/Sidekick_msat_solver/module-type-ARG/P/Quip/index.html new file mode 100644 index 00000000..66b8ebf9 --- /dev/null +++ b/dev/sidekick/Sidekick_msat_solver/module-type-ARG/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_msat_solver.ARG.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/module-type-ARG/P/index.html b/dev/sidekick/Sidekick_msat_solver/module-type-ARG/P/index.html index 9d618465..39339b69 100644 --- a/dev/sidekick/Sidekick_msat_solver/module-type-ARG/P/index.html +++ b/dev/sidekick/Sidekick_msat_solver/module-type-ARG/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_msat_solver.ARG.P)

Module ARG.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_msat_solver.ARG.P)

Module ARG.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/module-type-ARG/index.html b/dev/sidekick/Sidekick_msat_solver/module-type-ARG/index.html index b80c94ce..3a824daf 100644 --- a/dev/sidekick/Sidekick_msat_solver/module-type-ARG/index.html +++ b/dev/sidekick/Sidekick_msat_solver/module-type-ARG/index.html @@ -1,2 +1,2 @@ -ARG (sidekick.Sidekick_msat_solver.ARG)

Module type Sidekick_msat_solver.ARG

Argument to pass to the functor Make in order to create a new Msat-based SMT solver.

val cc_view : T.Term.t -> (T.Fun.tT.Term.tT.Term.t Iter.t) Sidekick_core.CC_view.t
val is_valid_literal : T.Term.t -> bool

Is this a valid boolean literal? (e.g. is it a closed term, not inside a quantifier)

\ No newline at end of file +ARG (sidekick.Sidekick_msat_solver.ARG)

Module type Sidekick_msat_solver.ARG

Argument to pass to the functor Make in order to create a new Msat-based SMT solver.

module P : Sidekick_core.PROOF with type term = T.Term.t
val cc_view : T.Term.t -> (T.Fun.tT.Term.tT.Term.t Iter.t) Sidekick_core.CC_view.t
val is_valid_literal : T.Term.t -> bool

Is this a valid boolean literal? (e.g. is it a closed term, not inside a quantifier)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/module-type-S/Lit/index.html b/dev/sidekick/Sidekick_msat_solver/module-type-S/Lit/index.html index 377e0c8d..bdfc90e9 100644 --- a/dev/sidekick/Sidekick_msat_solver/module-type-S/Lit/index.html +++ b/dev/sidekick/Sidekick_msat_solver/module-type-S/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_msat_solver.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_msat_solver.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/module-type-S/P/Quip/index.html b/dev/sidekick/Sidekick_msat_solver/module-type-S/P/Quip/index.html new file mode 100644 index 00000000..d7f9df09 --- /dev/null +++ b/dev/sidekick/Sidekick_msat_solver/module-type-S/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_msat_solver.S.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/module-type-S/P/index.html b/dev/sidekick/Sidekick_msat_solver/module-type-S/P/index.html index 21c13532..58190425 100644 --- a/dev/sidekick/Sidekick_msat_solver/module-type-S/P/index.html +++ b/dev/sidekick/Sidekick_msat_solver/module-type-S/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_msat_solver.S.P)

Module S.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_msat_solver.S.P)

Module S.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/module-type-S/Pre_proof/index.html b/dev/sidekick/Sidekick_msat_solver/module-type-S/Pre_proof/index.html new file mode 100644 index 00000000..3a871868 --- /dev/null +++ b/dev/sidekick/Sidekick_msat_solver/module-type-S/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick.Sidekick_msat_solver.S.Pre_proof)

Module S.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/module-type-S/Proof/index.html b/dev/sidekick/Sidekick_msat_solver/module-type-S/Proof/index.html deleted file mode 100644 index 8d1ef99c..00000000 --- a/dev/sidekick/Sidekick_msat_solver/module-type-S/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick.Sidekick_msat_solver.S.Proof)

Module S.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/Actions/index.html b/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/Actions/index.html index 710bd13a..83e0a321 100644 --- a/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_msat_solver.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_msat_solver.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/Expl/index.html b/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/Expl/index.html index 49d1b416..49675d21 100644 --- a/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_msat_solver.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_msat_solver.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/index.html index 108e4294..61613902 100644 --- a/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_msat_solver.S.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_msat_solver.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/Simplify/index.html b/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/Simplify/index.html index 812548d9..60d7f84c 100644 --- a/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/Simplify/index.html +++ b/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick.Sidekick_msat_solver.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick.Sidekick_msat_solver.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/index.html b/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/index.html index a4a0cba2..cc61feba 100644 --- a/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/index.html +++ b/dev/sidekick/Sidekick_msat_solver/module-type-S/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick.Sidekick_msat_solver.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick.Sidekick_msat_solver.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_msat_solver/module-type-S/index.html b/dev/sidekick/Sidekick_msat_solver/module-type-S/index.html index ff8052db..2e429eea 100644 --- a/dev/sidekick/Sidekick_msat_solver/module-type-S/index.html +++ b/dev/sidekick/Sidekick_msat_solver/module-type-S/index.html @@ -1,2 +1,2 @@ -S (sidekick.Sidekick_msat_solver.S)

Module type Sidekick_msat_solver.S

module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +S (sidekick.Sidekick_msat_solver.S)

Module type Sidekick_msat_solver.S

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Lit/index.html b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Lit/index.html index c558cd06..7fcca7c8 100644 --- a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Lit/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_th_bool_static.Make.1-A.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_th_bool_static.Make.1-A.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/P/Quip/index.html b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/P/Quip/index.html new file mode 100644 index 00000000..990ff194 --- /dev/null +++ b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_th_bool_static.Make.1-A.S.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/P/index.html b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/P/index.html index 617f83cd..eeb2adee 100644 --- a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/P/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_th_bool_static.Make.1-A.S.P)

Module S.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_th_bool_static.Make.1-A.S.P)

Module S.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Pre_proof/index.html b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Pre_proof/index.html new file mode 100644 index 00000000..4354d0cf --- /dev/null +++ b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick.Sidekick_th_bool_static.Make.1-A.S.Pre_proof)

Module S.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Proof/index.html b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Proof/index.html deleted file mode 100644 index 01038b01..00000000 --- a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick.Sidekick_th_bool_static.Make.1-A.S.Proof)

Module S.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/Actions/index.html b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/Actions/index.html index 5afcf581..bd364e48 100644 --- a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_th_bool_static.Make.1-A.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_th_bool_static.Make.1-A.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/Expl/index.html b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/Expl/index.html index 0282f9ed..05bd6920 100644 --- a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_th_bool_static.Make.1-A.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_th_bool_static.Make.1-A.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/index.html index 0e7ec9d4..9285c49a 100644 --- a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_bool_static.Make.1-A.S.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_bool_static.Make.1-A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/Simplify/index.html b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/Simplify/index.html index f6dd2a40..630d98d8 100644 --- a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/Simplify/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick.Sidekick_th_bool_static.Make.1-A.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick.Sidekick_th_bool_static.Make.1-A.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/index.html b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/index.html index 6f51e166..02e9a4fd 100644 --- a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick.Sidekick_th_bool_static.Make.1-A.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick.Sidekick_th_bool_static.Make.1-A.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/index.html b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/index.html index 9df30c4e..9887cac4 100644 --- a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/S/index.html @@ -1,2 +1,2 @@ -S (sidekick.Sidekick_th_bool_static.Make.1-A.S)

Module 1-A.S

module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +S (sidekick.Sidekick_th_bool_static.Make.1-A.S)

Module 1-A.S

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/index.html b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/index.html index 43fdc5b1..ee1868b4 100644 --- a/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/Make/argument-1-A/index.html @@ -1,2 +1,2 @@ -1-A (sidekick.Sidekick_th_bool_static.Make.1-A)

Parameter Make.1-A

type term = S.T.Term.t
val view_as_bool : term -> (termterm Iter.t) bool_view

Project the term into the boolean view.

val mk_bool : S.T.Term.state -> (termterm Sidekick_util.IArray.t) bool_view -> term

Make a term from the given boolean view.

val check_congruence_classes : bool

Configuration: add final-check handler to verify if new boolean formulas are present in the congruence closure. Only enable if some theories are susceptible to create boolean formulas during the proof search.

module Gensym : sig ... end

Fresh symbol generator.

\ No newline at end of file +1-A (sidekick.Sidekick_th_bool_static.Make.1-A)

Parameter Make.1-A

type term = S.T.Term.t
val view_as_bool : term -> (termterm Iter.t) bool_view

Project the term into the boolean view.

val proof_ite_true : S.T.Term.t -> S.P.t

proof_ite_true (ite a b c) is a=true |- ite a b c = b

val proof_ite_false : S.T.Term.t -> S.P.t

proof_ite_false (ite a b c) is a=false |- ite a b c = c

val proof_bool_eq : S.T.Term.t -> S.T.Term.t -> S.P.t

Basic boolean logic for |- a=b

val proof_bool_c : string -> term list -> S.P.t

Basic boolean logic for a clause |- c

val mk_bool : S.T.Term.state -> (termterm Sidekick_util.IArray.t) bool_view -> term

Make a term from the given boolean view.

val check_congruence_classes : bool

Configuration: add final-check handler to verify if new boolean formulas are present in the congruence closure. Only enable if some theories are susceptible to create boolean formulas during the proof search.

module Gensym : sig ... end

Fresh symbol generator.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Lit/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Lit/index.html index 212df189..5f8b3ad1 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Lit/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_th_bool_static.ARG.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_th_bool_static.ARG.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/P/Quip/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/P/Quip/index.html new file mode 100644 index 00000000..801367b3 --- /dev/null +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_th_bool_static.ARG.S.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/P/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/P/index.html index a6488c37..e10264fc 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/P/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_th_bool_static.ARG.S.P)

Module S.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_th_bool_static.ARG.S.P)

Module S.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Pre_proof/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Pre_proof/index.html new file mode 100644 index 00000000..4c94c595 --- /dev/null +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick.Sidekick_th_bool_static.ARG.S.Pre_proof)

Module S.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Proof/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Proof/index.html deleted file mode 100644 index 80fc5443..00000000 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick.Sidekick_th_bool_static.ARG.S.Proof)

Module S.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/Actions/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/Actions/index.html index 91560772..d5e4d844 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_th_bool_static.ARG.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_th_bool_static.ARG.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/Expl/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/Expl/index.html index 939295c2..b79df1c4 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_th_bool_static.ARG.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_th_bool_static.ARG.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/index.html index 320ae0a7..30d9510d 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_bool_static.ARG.S.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_bool_static.ARG.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/Simplify/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/Simplify/index.html index 462f19c5..93d2a3da 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/Simplify/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick.Sidekick_th_bool_static.ARG.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick.Sidekick_th_bool_static.ARG.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/index.html index a5735dd8..27367bc0 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick.Sidekick_th_bool_static.ARG.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick.Sidekick_th_bool_static.ARG.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/index.html index 472b8075..72267e09 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/S/index.html @@ -1,2 +1,2 @@ -S (sidekick.Sidekick_th_bool_static.ARG.S)

Module ARG.S

module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +S (sidekick.Sidekick_th_bool_static.ARG.S)

Module ARG.S

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/index.html index 876923b3..72f732d6 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-ARG/index.html @@ -1,2 +1,2 @@ -ARG (sidekick.Sidekick_th_bool_static.ARG)

Module type Sidekick_th_bool_static.ARG

Argument to the theory

type term = S.T.Term.t
val view_as_bool : term -> (termterm Iter.t) bool_view

Project the term into the boolean view.

val mk_bool : S.T.Term.state -> (termterm Sidekick_util.IArray.t) bool_view -> term

Make a term from the given boolean view.

val check_congruence_classes : bool

Configuration: add final-check handler to verify if new boolean formulas are present in the congruence closure. Only enable if some theories are susceptible to create boolean formulas during the proof search.

module Gensym : sig ... end

Fresh symbol generator.

\ No newline at end of file +ARG (sidekick.Sidekick_th_bool_static.ARG)

Module type Sidekick_th_bool_static.ARG

Argument to the theory

type term = S.T.Term.t
val view_as_bool : term -> (termterm Iter.t) bool_view

Project the term into the boolean view.

val proof_ite_true : S.T.Term.t -> S.P.t

proof_ite_true (ite a b c) is a=true |- ite a b c = b

val proof_ite_false : S.T.Term.t -> S.P.t

proof_ite_false (ite a b c) is a=false |- ite a b c = c

val proof_bool_eq : S.T.Term.t -> S.T.Term.t -> S.P.t

Basic boolean logic for |- a=b

val proof_bool_c : string -> term list -> S.P.t

Basic boolean logic for a clause |- c

val mk_bool : S.T.Term.state -> (termterm Sidekick_util.IArray.t) bool_view -> term

Make a term from the given boolean view.

val check_congruence_classes : bool

Configuration: add final-check handler to verify if new boolean formulas are present in the congruence closure. Only enable if some theories are susceptible to create boolean formulas during the proof search.

module Gensym : sig ... end

Fresh symbol generator.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Lit/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Lit/index.html index c87504d5..8143ac61 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Lit/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_th_bool_static.S.A.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_th_bool_static.S.A.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/P/Quip/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/P/Quip/index.html new file mode 100644 index 00000000..e907578f --- /dev/null +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_th_bool_static.S.A.S.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/P/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/P/index.html index 9a40686d..5634dedf 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/P/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_th_bool_static.S.A.S.P)

Module S.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_th_bool_static.S.A.S.P)

Module S.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Pre_proof/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Pre_proof/index.html new file mode 100644 index 00000000..2d841d29 --- /dev/null +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick.Sidekick_th_bool_static.S.A.S.Pre_proof)

Module S.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Proof/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Proof/index.html deleted file mode 100644 index 9987fe66..00000000 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick.Sidekick_th_bool_static.S.A.S.Proof)

Module S.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/Actions/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/Actions/index.html index 1766358a..7713d839 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_th_bool_static.S.A.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_th_bool_static.S.A.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/Expl/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/Expl/index.html index da69dff5..f3a31133 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_th_bool_static.S.A.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_th_bool_static.S.A.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/index.html index 062d5752..b3779fcb 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_bool_static.S.A.S.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_bool_static.S.A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/Simplify/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/Simplify/index.html index 93b049d6..eb51c5ea 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/Simplify/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick.Sidekick_th_bool_static.S.A.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick.Sidekick_th_bool_static.S.A.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/index.html index b570bebd..7bf40e42 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick.Sidekick_th_bool_static.S.A.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick.Sidekick_th_bool_static.S.A.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/index.html index 4df8f18f..c28ea0b2 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/S/index.html @@ -1,2 +1,2 @@ -S (sidekick.Sidekick_th_bool_static.S.A.S)

Module A.S

module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +S (sidekick.Sidekick_th_bool_static.S.A.S)

Module A.S

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/index.html b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/index.html index b838cead..24a1302b 100644 --- a/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/index.html +++ b/dev/sidekick/Sidekick_th_bool_static/module-type-S/A/index.html @@ -1,2 +1,2 @@ -A (sidekick.Sidekick_th_bool_static.S.A)

Module S.A

type term = S.T.Term.t
val view_as_bool : term -> (termterm Iter.t) bool_view

Project the term into the boolean view.

val mk_bool : S.T.Term.state -> (termterm Sidekick_util.IArray.t) bool_view -> term

Make a term from the given boolean view.

val check_congruence_classes : bool

Configuration: add final-check handler to verify if new boolean formulas are present in the congruence closure. Only enable if some theories are susceptible to create boolean formulas during the proof search.

module Gensym : sig ... end

Fresh symbol generator.

\ No newline at end of file +A (sidekick.Sidekick_th_bool_static.S.A)

Module S.A

type term = S.T.Term.t
val view_as_bool : term -> (termterm Iter.t) bool_view

Project the term into the boolean view.

val proof_ite_true : S.T.Term.t -> S.P.t

proof_ite_true (ite a b c) is a=true |- ite a b c = b

val proof_ite_false : S.T.Term.t -> S.P.t

proof_ite_false (ite a b c) is a=false |- ite a b c = c

val proof_bool_eq : S.T.Term.t -> S.T.Term.t -> S.P.t

Basic boolean logic for |- a=b

val proof_bool_c : string -> term list -> S.P.t

Basic boolean logic for a clause |- c

val mk_bool : S.T.Term.state -> (termterm Sidekick_util.IArray.t) bool_view -> term

Make a term from the given boolean view.

val check_congruence_classes : bool

Configuration: add final-check handler to verify if new boolean formulas are present in the congruence closure. Only enable if some theories are susceptible to create boolean formulas during the proof search.

module Gensym : sig ... end

Fresh symbol generator.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Lit/index.html b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Lit/index.html index caa2346f..52eb680e 100644 --- a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Lit/index.html +++ b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_th_cstor.Make.1-A.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_th_cstor.Make.1-A.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/P/Quip/index.html b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/P/Quip/index.html new file mode 100644 index 00000000..a1b51e56 --- /dev/null +++ b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_th_cstor.Make.1-A.S.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/P/index.html b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/P/index.html index 2ff5b701..a142ccab 100644 --- a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/P/index.html +++ b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_th_cstor.Make.1-A.S.P)

Module S.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_th_cstor.Make.1-A.S.P)

Module S.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Pre_proof/index.html b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Pre_proof/index.html new file mode 100644 index 00000000..81188fec --- /dev/null +++ b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick.Sidekick_th_cstor.Make.1-A.S.Pre_proof)

Module S.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Proof/index.html b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Proof/index.html deleted file mode 100644 index ec3a898f..00000000 --- a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick.Sidekick_th_cstor.Make.1-A.S.Proof)

Module S.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/Actions/index.html b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/Actions/index.html index 4dd23f54..3afde425 100644 --- a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_th_cstor.Make.1-A.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_th_cstor.Make.1-A.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/Expl/index.html b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/Expl/index.html index 036a65f5..70c0f423 100644 --- a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_th_cstor.Make.1-A.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_th_cstor.Make.1-A.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/index.html index ae3cfbd9..113f8001 100644 --- a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_cstor.Make.1-A.S.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_cstor.Make.1-A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/Simplify/index.html b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/Simplify/index.html index 8e778cc4..d840c7f1 100644 --- a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/Simplify/index.html +++ b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick.Sidekick_th_cstor.Make.1-A.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick.Sidekick_th_cstor.Make.1-A.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/index.html b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/index.html index 1bd2351f..ae2f44a1 100644 --- a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/index.html +++ b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick.Sidekick_th_cstor.Make.1-A.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick.Sidekick_th_cstor.Make.1-A.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/index.html b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/index.html index 11be2628..41894b85 100644 --- a/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/index.html +++ b/dev/sidekick/Sidekick_th_cstor/Make/argument-1-A/S/index.html @@ -1,2 +1,2 @@ -S (sidekick.Sidekick_th_cstor.Make.1-A.S)

Module 1-A.S

module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +S (sidekick.Sidekick_th_cstor.Make.1-A.S)

Module 1-A.S

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Lit/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Lit/index.html index be85754b..ac14b2ed 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Lit/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_th_cstor.ARG.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_th_cstor.ARG.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/P/Quip/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/P/Quip/index.html new file mode 100644 index 00000000..2b129909 --- /dev/null +++ b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_th_cstor.ARG.S.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/P/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/P/index.html index 7f68a6d6..78e340ec 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/P/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_th_cstor.ARG.S.P)

Module S.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_th_cstor.ARG.S.P)

Module S.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Pre_proof/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Pre_proof/index.html new file mode 100644 index 00000000..3330d31b --- /dev/null +++ b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick.Sidekick_th_cstor.ARG.S.Pre_proof)

Module S.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Proof/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Proof/index.html deleted file mode 100644 index 41e3de83..00000000 --- a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick.Sidekick_th_cstor.ARG.S.Proof)

Module S.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/Actions/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/Actions/index.html index f4dedf06..dc3e32db 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_th_cstor.ARG.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_th_cstor.ARG.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/Expl/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/Expl/index.html index 8fd1f1ff..ea8f9193 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_th_cstor.ARG.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_th_cstor.ARG.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/index.html index 05c36921..2ee6a0ee 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_cstor.ARG.S.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_cstor.ARG.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/Simplify/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/Simplify/index.html index 67cabbed..85a55590 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/Simplify/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick.Sidekick_th_cstor.ARG.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick.Sidekick_th_cstor.ARG.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/index.html index dd808e5e..6eedb1bf 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick.Sidekick_th_cstor.ARG.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick.Sidekick_th_cstor.ARG.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/index.html index 9aac3fcc..688114b3 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-ARG/S/index.html @@ -1,2 +1,2 @@ -S (sidekick.Sidekick_th_cstor.ARG.S)

Module ARG.S

module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +S (sidekick.Sidekick_th_cstor.ARG.S)

Module ARG.S

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Lit/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Lit/index.html index ade1d22f..f18f9834 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Lit/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_th_cstor.S.A.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_th_cstor.S.A.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/P/Quip/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/P/Quip/index.html new file mode 100644 index 00000000..f29d1646 --- /dev/null +++ b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_th_cstor.S.A.S.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/P/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/P/index.html index c866d0d2..662698d3 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/P/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_th_cstor.S.A.S.P)

Module S.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_th_cstor.S.A.S.P)

Module S.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Pre_proof/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Pre_proof/index.html new file mode 100644 index 00000000..99032807 --- /dev/null +++ b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick.Sidekick_th_cstor.S.A.S.Pre_proof)

Module S.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Proof/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Proof/index.html deleted file mode 100644 index 2a9e064d..00000000 --- a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick.Sidekick_th_cstor.S.A.S.Proof)

Module S.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/Actions/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/Actions/index.html index d52a4178..223e2aa3 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_th_cstor.S.A.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_th_cstor.S.A.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/Expl/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/Expl/index.html index 2c24798f..34635f4e 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_th_cstor.S.A.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_th_cstor.S.A.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/index.html index 2120a624..da9769b7 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_cstor.S.A.S.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_cstor.S.A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/Simplify/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/Simplify/index.html index 08457e48..a189b28f 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/Simplify/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick.Sidekick_th_cstor.S.A.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick.Sidekick_th_cstor.S.A.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/index.html index 7d847274..d29c05ed 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick.Sidekick_th_cstor.S.A.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick.Sidekick_th_cstor.S.A.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/index.html b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/index.html index 236956c9..cea013c0 100644 --- a/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/index.html +++ b/dev/sidekick/Sidekick_th_cstor/module-type-S/A/S/index.html @@ -1,2 +1,2 @@ -S (sidekick.Sidekick_th_cstor.S.A.S)

Module A.S

module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +S (sidekick.Sidekick_th_cstor.S.A.S)

Module A.S

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Lit/index.html b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Lit/index.html index 5af98cca..4749410f 100644 --- a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Lit/index.html +++ b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_th_data.Make.1-A.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_th_data.Make.1-A.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/P/Quip/index.html b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/P/Quip/index.html new file mode 100644 index 00000000..9f1caaa3 --- /dev/null +++ b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_th_data.Make.1-A.S.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/P/index.html b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/P/index.html index 508e9689..a7938655 100644 --- a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/P/index.html +++ b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_th_data.Make.1-A.S.P)

Module S.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_th_data.Make.1-A.S.P)

Module S.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Pre_proof/index.html b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Pre_proof/index.html new file mode 100644 index 00000000..8b6692e0 --- /dev/null +++ b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick.Sidekick_th_data.Make.1-A.S.Pre_proof)

Module S.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Proof/index.html b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Proof/index.html deleted file mode 100644 index b3122f1e..00000000 --- a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick.Sidekick_th_data.Make.1-A.S.Proof)

Module S.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/Actions/index.html b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/Actions/index.html index 8ea32905..6598252e 100644 --- a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_th_data.Make.1-A.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_th_data.Make.1-A.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/Expl/index.html b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/Expl/index.html index 8519ce95..098bb0c0 100644 --- a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_th_data.Make.1-A.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_th_data.Make.1-A.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/index.html index ecf2aca6..a7be1c3a 100644 --- a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_data.Make.1-A.S.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_data.Make.1-A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/Simplify/index.html b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/Simplify/index.html index 8e1b97ad..f90c1606 100644 --- a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/Simplify/index.html +++ b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick.Sidekick_th_data.Make.1-A.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick.Sidekick_th_data.Make.1-A.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/index.html b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/index.html index a74a2b93..ff32004d 100644 --- a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/index.html +++ b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick.Sidekick_th_data.Make.1-A.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick.Sidekick_th_data.Make.1-A.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/index.html b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/index.html index 2a60ded2..b319450c 100644 --- a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/index.html +++ b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/S/index.html @@ -1,2 +1,2 @@ -S (sidekick.Sidekick_th_data.Make.1-A.S)

Module 1-A.S

module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +S (sidekick.Sidekick_th_data.Make.1-A.S)

Module 1-A.S

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/index.html b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/index.html index 7fdf6a54..1df4f206 100644 --- a/dev/sidekick/Sidekick_th_data/Make/argument-1-A/index.html +++ b/dev/sidekick/Sidekick_th_data/Make/argument-1-A/index.html @@ -1,2 +1,2 @@ -1-A (sidekick.Sidekick_th_data.Make.1-A)

Parameter Make.1-A

module Cstor : sig ... end

Constructor symbols.

val as_datatype : S.T.Ty.t -> (Cstor.t Iter.tS.T.Ty.t) data_ty_view

Try to view type as a datatype (with its constructors)

val view_as_data : S.T.Term.t -> (Cstor.tS.T.Term.t) data_view

Try to view term as a datatype term

val mk_cstor : S.T.Term.state -> Cstor.t -> S.T.Term.t Sidekick_util.IArray.t -> S.T.Term.t

Make a constructor application term

val mk_is_a : S.T.Term.state -> Cstor.t -> S.T.Term.t -> S.T.Term.t

Make a is-a term

val mk_sel : S.T.Term.state -> Cstor.t -> int -> S.T.Term.t -> S.T.Term.t

Make a selector term

val mk_eq : S.T.Term.state -> S.T.Term.t -> S.T.Term.t -> S.T.Term.t

Make a term equality

val ty_is_finite : S.T.Ty.t -> bool

Is the given type known to be finite? For example a finite datatype (an "enum" in C parlance), or Bool, or Array Bool Bool.

val ty_set_is_finite : S.T.Ty.t -> bool -> unit

Modify the "finite" field (see ty_is_finite)

\ No newline at end of file +1-A (sidekick.Sidekick_th_data.Make.1-A)

Parameter Make.1-A

module Cstor : sig ... end

Constructor symbols.

val as_datatype : S.T.Ty.t -> (Cstor.t Iter.tS.T.Ty.t) data_ty_view

Try to view type as a datatype (with its constructors)

val view_as_data : S.T.Term.t -> (Cstor.tS.T.Term.t) data_view

Try to view term as a datatype term

val mk_cstor : S.T.Term.state -> Cstor.t -> S.T.Term.t Sidekick_util.IArray.t -> S.T.Term.t

Make a constructor application term

val mk_is_a : S.T.Term.state -> Cstor.t -> S.T.Term.t -> S.T.Term.t

Make a is-a term

val mk_sel : S.T.Term.state -> Cstor.t -> int -> S.T.Term.t -> S.T.Term.t

Make a selector term

val mk_eq : S.T.Term.state -> S.T.Term.t -> S.T.Term.t -> S.T.Term.t

Make a term equality

val ty_is_finite : S.T.Ty.t -> bool

Is the given type known to be finite? For example a finite datatype (an "enum" in C parlance), or Bool, or Array Bool Bool.

val ty_set_is_finite : S.T.Ty.t -> bool -> unit

Modify the "finite" field (see ty_is_finite)

val proof_isa_split : S.T.Ty.t -> S.T.Term.t Iter.t -> S.P.t
val proof_isa_disj : S.T.Ty.t -> S.T.Term.t -> S.T.Term.t -> S.P.t
val proof_cstor_inj : Cstor.t -> int -> S.T.Term.t list -> S.T.Term.t list -> S.P.t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Lit/index.html b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Lit/index.html index 024e944c..fd8a8a9a 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Lit/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_th_data.ARG.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_th_data.ARG.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/P/Quip/index.html b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/P/Quip/index.html new file mode 100644 index 00000000..fb7fbd21 --- /dev/null +++ b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_th_data.ARG.S.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/P/index.html b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/P/index.html index 133b2162..0fa28d34 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/P/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_th_data.ARG.S.P)

Module S.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_th_data.ARG.S.P)

Module S.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Pre_proof/index.html b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Pre_proof/index.html new file mode 100644 index 00000000..56d071c7 --- /dev/null +++ b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick.Sidekick_th_data.ARG.S.Pre_proof)

Module S.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Proof/index.html b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Proof/index.html deleted file mode 100644 index 4fb6358c..00000000 --- a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick.Sidekick_th_data.ARG.S.Proof)

Module S.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/Actions/index.html b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/Actions/index.html index 384bc4fa..1b18d11e 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_th_data.ARG.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_th_data.ARG.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/Expl/index.html b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/Expl/index.html index 80375283..9749d9c4 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_th_data.ARG.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_th_data.ARG.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/index.html index 495fd686..6a1f6d61 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_data.ARG.S.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_data.ARG.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/Simplify/index.html b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/Simplify/index.html index b83fe424..abde52f3 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/Simplify/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick.Sidekick_th_data.ARG.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick.Sidekick_th_data.ARG.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/index.html b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/index.html index e8cb2e49..7684c3ac 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick.Sidekick_th_data.ARG.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick.Sidekick_th_data.ARG.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/index.html b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/index.html index 6e938a87..0183c744 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-ARG/S/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-ARG/S/index.html @@ -1,2 +1,2 @@ -S (sidekick.Sidekick_th_data.ARG.S)

Module ARG.S

module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +S (sidekick.Sidekick_th_data.ARG.S)

Module ARG.S

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-ARG/index.html b/dev/sidekick/Sidekick_th_data/module-type-ARG/index.html index 1c4369b9..67eaa662 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-ARG/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-ARG/index.html @@ -1,2 +1,2 @@ -ARG (sidekick.Sidekick_th_data.ARG)

Module type Sidekick_th_data.ARG

Argument to the functor

module Cstor : sig ... end

Constructor symbols.

val as_datatype : S.T.Ty.t -> (Cstor.t Iter.tS.T.Ty.t) data_ty_view

Try to view type as a datatype (with its constructors)

val view_as_data : S.T.Term.t -> (Cstor.tS.T.Term.t) data_view

Try to view term as a datatype term

val mk_cstor : S.T.Term.state -> Cstor.t -> S.T.Term.t Sidekick_util.IArray.t -> S.T.Term.t

Make a constructor application term

val mk_is_a : S.T.Term.state -> Cstor.t -> S.T.Term.t -> S.T.Term.t

Make a is-a term

val mk_sel : S.T.Term.state -> Cstor.t -> int -> S.T.Term.t -> S.T.Term.t

Make a selector term

val mk_eq : S.T.Term.state -> S.T.Term.t -> S.T.Term.t -> S.T.Term.t

Make a term equality

val ty_is_finite : S.T.Ty.t -> bool

Is the given type known to be finite? For example a finite datatype (an "enum" in C parlance), or Bool, or Array Bool Bool.

val ty_set_is_finite : S.T.Ty.t -> bool -> unit

Modify the "finite" field (see ty_is_finite)

\ No newline at end of file +ARG (sidekick.Sidekick_th_data.ARG)

Module type Sidekick_th_data.ARG

Argument to the functor

module Cstor : sig ... end

Constructor symbols.

val as_datatype : S.T.Ty.t -> (Cstor.t Iter.tS.T.Ty.t) data_ty_view

Try to view type as a datatype (with its constructors)

val view_as_data : S.T.Term.t -> (Cstor.tS.T.Term.t) data_view

Try to view term as a datatype term

val mk_cstor : S.T.Term.state -> Cstor.t -> S.T.Term.t Sidekick_util.IArray.t -> S.T.Term.t

Make a constructor application term

val mk_is_a : S.T.Term.state -> Cstor.t -> S.T.Term.t -> S.T.Term.t

Make a is-a term

val mk_sel : S.T.Term.state -> Cstor.t -> int -> S.T.Term.t -> S.T.Term.t

Make a selector term

val mk_eq : S.T.Term.state -> S.T.Term.t -> S.T.Term.t -> S.T.Term.t

Make a term equality

val ty_is_finite : S.T.Ty.t -> bool

Is the given type known to be finite? For example a finite datatype (an "enum" in C parlance), or Bool, or Array Bool Bool.

val ty_set_is_finite : S.T.Ty.t -> bool -> unit

Modify the "finite" field (see ty_is_finite)

val proof_isa_split : S.T.Ty.t -> S.T.Term.t Iter.t -> S.P.t
val proof_isa_disj : S.T.Ty.t -> S.T.Term.t -> S.T.Term.t -> S.P.t
val proof_cstor_inj : Cstor.t -> int -> S.T.Term.t list -> S.T.Term.t list -> S.P.t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Lit/index.html b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Lit/index.html index 8a5fe21a..6f2a43d1 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Lit/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Lit/index.html @@ -1,2 +1,2 @@ -Lit (sidekick.Sidekick_th_data.S.A.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file +Lit (sidekick.Sidekick_th_data.S.A.S.Lit)

Module S.Lit

module T = T

Literals depend on terms

type t

A literal

val term : t -> T.Term.t

Get the (positive) term

val sign : t -> bool

Get the sign. A negated literal has sign false.

val neg : t -> t

Take negation of literal. sign (neg lit) = not (sign lit).

val abs : t -> t

abs lit is like lit but always positive, i.e. sign (abs lit) = true

val signed_term : t -> T.Term.t * bool
val equal : t -> t -> bool
val hash : t -> int
val pp : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/P/Quip/index.html b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/P/Quip/index.html new file mode 100644 index 00000000..e87be2f7 --- /dev/null +++ b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/P/Quip/index.html @@ -0,0 +1,2 @@ + +Quip (sidekick.Sidekick_th_data.S.A.S.P.Quip)

Module P.Quip

val output : Stdlib.out_channel -> t -> unit

Printer in Quip format (experimental)

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/P/index.html b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/P/index.html index 4523d516..0e2d206a 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/P/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/P/index.html @@ -1,2 +1,2 @@ -P (sidekick.Sidekick_th_data.S.A.S.P)

Module S.P

type t
val pp : t Sidekick_core.Fmt.printer
val default : t
\ No newline at end of file +P (sidekick.Sidekick_th_data.S.A.S.P)

Module S.P

type term = T.Term.t
type ty
type t
type hres_step

hyper-resolution steps: resolution, unit resolution; bool paramodulation, unit bool paramodulation

val r : t -> pivot:term -> hres_step

Resolution step on given pivot term

val r1 : t -> hres_step

Unit resolution; pivot is obvious

val p : t -> lhs:term -> rhs:term -> hres_step

Paramodulation using proof whose conclusion has a literal lhs=rhs

val p1 : t -> hres_step

Unit paramodulation

type lit

Proof representation of literals

val pp_lit : lit Sidekick_core.Fmt.printer
val lit_a : term -> lit
val lit_na : term -> lit
val lit_mk : bool -> term -> lit
val lit_eq : term -> term -> lit
val lit_neq : term -> term -> lit
val lit_not : lit -> lit
val lit_sign : lit -> bool
type composite_step
val stepc : name:string -> lit list -> t -> composite_step
val deft : term -> term -> composite_step

define a (new) atomic term

val is_trivial_refl : t -> bool

is this a proof of |- t=t? This can be used to remove some trivial steps that would build on the proof (e.g. rewriting using refl t is useless).

val assertion : term -> t
val assertion_c : lit Iter.t -> t
val ref_by_name : string -> t
val assertion_c_l : lit list -> t
val hres_iter : t -> hres_step Iter.t -> t
val hres_l : t -> hres_step list -> t
val res : pivot:term -> t -> t -> t
val res1 : t -> t -> t
val refl : term -> t
val true_is_true : t
val true_neq_false : t
val nn : t -> t
val cc_lemma : lit list -> t
val cc_imply2 : t -> t -> term -> term -> t
val cc_imply_l : t list -> term -> term -> t
val composite_iter : ?⁠assms:(string * lit) list -> composite_step Iter.t -> t
val composite_l : ?⁠assms:(string * lit) list -> composite_step list -> t
val sorry : t
val sorry_c : lit Iter.t -> t
val sorry_c_l : lit list -> t
val default : t
val pp_debug : sharing:bool -> t Sidekick_core.Fmt.printer
module Quip : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Pre_proof/index.html b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Pre_proof/index.html new file mode 100644 index 00000000..837faf2c --- /dev/null +++ b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Pre_proof/index.html @@ -0,0 +1,2 @@ + +Pre_proof (sidekick.Sidekick_th_data.S.A.S.Pre_proof)

Module S.Pre_proof

Internal representation of proofs

A type or state convertible into P.t

type t
val output : Stdlib.out_channel -> t -> unit

Output onto a channel, efficiently

val pp_debug : t Sidekick_core.Fmt.printer
val pp_dot : t Sidekick_core.Fmt.printer option

Optional printer into DOT/graphviz

val check : t -> unit

Check the proof (to an unspecified level of confidence; this can be a no-op). May fail.

val to_proof : t -> P.t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Proof/index.html b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Proof/index.html deleted file mode 100644 index baa7054b..00000000 --- a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Proof/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Proof (sidekick.Sidekick_th_data.S.A.S.Proof)

Module S.Proof

type t
val check : t -> unit
val pp_dot : t Sidekick_core.Fmt.printer
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/Actions/index.html b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/Actions/index.html index 536b8f44..20bf9a68 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/Actions/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/Actions/index.html @@ -1,2 +1,2 @@ -Actions (sidekick.Sidekick_th_data.S.A.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module P = P
module Lit = Lit
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list) -> P.t -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file +Actions (sidekick.Sidekick_th_data.S.A.S.Solver_internal.CC.Actions)

Module CC.Actions

module T = T
module Lit = Lit
module P = P
type t = actions

An action handle. It is used by the congruence closure to perform the actions below. How it performs the actions is not specified and is solver-specific.

val raise_conflict : t -> Lit.t list -> P.t -> 'a

raise_conflict acts c pr declares that c is a tautology of the theory of congruence. This does not return (it should raise an exception).

parameter pr

the proof of c being a tautology

val propagate : t -> Lit.t -> reason:(unit -> Lit.t list * P.t) -> unit

propagate acts lit ~reason pr declares that reason() => lit is a tautology.

This function might never be called, a congruence closure has the right to not propagate and only trigger conflicts.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/Expl/index.html b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/Expl/index.html index b215cc06..c8d6d606 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/Expl/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/Expl/index.html @@ -1,2 +1,2 @@ -Expl (sidekick.Sidekick_th_data.S.A.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_theory : t -> t
\ No newline at end of file +Expl (sidekick.Sidekick_th_data.S.A.S.Solver_internal.CC.Expl)

Module CC.Expl

Explanations

Explanations are specialized proofs, created by the congruence closure when asked to justify why 2 terms are equal.

type t
val pp : t Sidekick_core.Fmt.printer
val mk_merge : N.t -> N.t -> t
val mk_merge_t : term -> term -> t
val mk_lit : lit -> t
val mk_list : t list -> t
val mk_proof : P.t -> t
val mk_theory : t -> t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/index.html b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/index.html index 3a2b10db..6e5b373f 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/CC/index.html @@ -1,2 +1,2 @@ -CC (sidekick.Sidekick_th_data.S.A.S.Solver_internal.CC)

Module Solver_internal.CC

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file +CC (sidekick.Sidekick_th_data.S.A.S.Solver_internal.CC)

Module Solver_internal.CC

Congruence closure instance

module T = T
module P = P
module Lit = Lit
module Actions : Sidekick_core.CC_ACTIONS with module T = T and module Lit = Lit and module P = P and type t = actions
type term_state = T.Term.state
type term = T.Term.t
type fun_ = T.Fun.t
type lit = Lit.t
type proof = P.t
type actions = Actions.t
type t

State of the congruence closure

module N : sig ... end

An equivalence class is a set of terms that are currently equal in the partial model built by the solver. The class is represented by a collection of nodes, one of which is distinguished and is called the "representative".

module Expl : sig ... end

Explanations

type node = N.t

A node of the congruence closure

type repr = N.t

Node that is currently a representative

type explanation = Expl.t

Accessors

val term_state : t -> term_state
val find : t -> node -> repr

Current representative

val add_term : t -> term -> node

Add the term to the congruence closure, if not present already. Will be backtracked.

val mem_term : t -> term -> bool

Returns true if the term is explicitly present in the congruence closure

Events

Events triggered by the congruence closure, to which other plugins can subscribe.

type ev_on_pre_merge = t -> actions -> N.t -> N.t -> Expl.t -> unit

ev_on_pre_merge cc acts n1 n2 expl is called right before n1 and n2 are merged with explanation expl.

type ev_on_post_merge = t -> actions -> N.t -> N.t -> unit

ev_on_post_merge cc acts n1 n2 is called right after n1 and n2 were merged. find cc n1 and find cc n2 will return the same node.

type ev_on_new_term = t -> N.t -> term -> unit

ev_on_new_term cc n t is called whenever a new term t is added to the congruence closure. Its node is n.

type ev_on_conflict = t -> th:bool -> lit list -> unit

ev_on_conflict acts ~th c is called when the congruence closure triggers a conflict by asserting the tautology c.

parameter th

true if the explanation for this conflict involves at least one "theory" explanation; i.e. some of the equations participating in the conflict are purely syntactic theories like injectivity of constructors.

type ev_on_propagate = t -> lit -> (unit -> lit list * P.t) -> unit

ev_on_propagate cc lit reason is called whenever reason() => lit is a propagated lemma. See Sidekick_core.CC_ACTIONS.propagate.

type ev_on_is_subterm = N.t -> term -> unit

ev_on_is_subterm n t is called when n is a subterm of another node for the first time. t is the term corresponding to the node n. This can be useful for theory combination.

val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠on_pre_merge:ev_on_pre_merge list -> ?⁠on_post_merge:ev_on_post_merge list -> ?⁠on_new_term:ev_on_new_term list -> ?⁠on_conflict:ev_on_conflict list -> ?⁠on_propagate:ev_on_propagate list -> ?⁠on_is_subterm:ev_on_is_subterm list -> ?⁠size:[ `Small | `Big ] -> term_state -> t

Create a new congruence closure.

parameter term_state

used to be able to create new terms. All terms interacting with this congruence closure must belong in this term state as well.

val allocate_bitfield : descr:string -> t -> N.bitfield

Allocate a new bitfield for the nodes. See N.bitfield.

val set_bitfield : t -> N.bitfield -> bool -> N.t -> unit

Set the bitfield for the node. This will be backtracked. See N.bitfield.

val on_pre_merge : t -> ev_on_pre_merge -> unit

Add a function to be called when two classes are merged

val on_post_merge : t -> ev_on_post_merge -> unit

Add a function to be called when two classes are merged

val on_new_term : t -> ev_on_new_term -> unit

Add a function to be called when a new node is created

val on_conflict : t -> ev_on_conflict -> unit

Called when the congruence closure finds a conflict

val on_propagate : t -> ev_on_propagate -> unit

Called when the congruence closure propagates a literal

val on_is_subterm : t -> ev_on_is_subterm -> unit

Called on terms that are subterms of function symbols

val set_as_lit : t -> N.t -> lit -> unit

map the given node to a literal.

val find_t : t -> term -> repr

Current representative of the term.

raises Not_found

if the term is not already add-ed.

val add_seq : t -> term Iter.t -> unit

Add a sequence of terms to the congruence closure

val all_classes : t -> repr Iter.t

All current classes. This is costly, only use if there is no other solution

val assert_lit : t -> lit -> unit

Given a literal, assume it in the congruence closure and propagate its consequences. Will be backtracked.

Useful for the theory combination or the SAT solver's functor

val assert_lits : t -> lit Iter.t -> unit

Addition of many literals

val explain_eq : t -> N.t -> N.t -> lit list

Explain why the two nodes are equal. Fails if they are not, in an unspecified way

val raise_conflict_from_expl : t -> actions -> Expl.t -> 'a

Raise a conflict with the given explanation it must be a theory tautology that expl ==> absurd. To be used in theories.

val n_true : t -> N.t

Node for true

val n_false : t -> N.t

Node for false

val n_bool : t -> bool -> N.t

Node for either true or false

val merge : t -> N.t -> N.t -> Expl.t -> unit

Merge these two nodes given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val merge_t : t -> term -> term -> Expl.t -> unit

Shortcut for adding + merging

val check : t -> actions -> unit

Perform all pending operations done via assert_eq, assert_lit, etc. Will use the actions to propagate literals, declare conflicts, etc.

val new_merges : t -> bool

Called after check, returns true if some pairs of classes were merged.

val push_level : t -> unit

Push backtracking level

val pop_levels : t -> int -> unit

Restore to state n calls to push_level earlier. Used during backtracking.

val get_model : t -> N.t Iter.t Iter.t

get all the equivalence classes so they can be merged in the model

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/Simplify/index.html b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/Simplify/index.html index 5f21952f..097b5b96 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/Simplify/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/Simplify/index.html @@ -1,2 +1,2 @@ -Simplify (sidekick.Sidekick_th_data.S.A.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> term option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> term

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

\ No newline at end of file +Simplify (sidekick.Sidekick_th_data.S.A.S.Solver_internal.Simplify)

Module Solver_internal.Simplify

Simplify terms

type t
val tst : t -> term_state
val ty_st : t -> ty_state
val clear : t -> unit

Reset internal cache, etc.

type hook = t -> term -> (term * proof) option

Given a term, try to simplify it. Return None if it didn't change.

A simple example could be a hook that takes a term t, and if t is app "+" (const x) (const y) where x and y are number, returns Some (const (x+y)), and None otherwise.

val normalize : t -> term -> (term * P.t) option

Normalize a term using all the hooks. This performs a fixpoint, i.e. it only stops when no hook applies anywhere inside the term.

val normalize_t : t -> term -> term * P.t

Normalize a term using all the hooks, along with a proof that the simplification is correct. returns t, refl t if no simplification occurred.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/index.html b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/index.html index 6504cc72..e16cbe58 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/Solver_internal/index.html @@ -1,2 +1,2 @@ -Solver_internal (sidekick.Sidekick_th_data.S.A.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions
val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simp_t : t -> term -> term

Simplify the term using the solver's simplifier (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list) -> proof -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> unit) -> term -> term

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> unit) -> term -> term option

Given a term, try to preprocess it. Return None if it didn't change. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file +Solver_internal (sidekick.Sidekick_th_data.S.A.S.Solver_internal)

Module S.Solver_internal

Internal solver, available to theories.

module T = T
module P = P
type ty = T.Ty.t
type term = T.Term.t
type term_state = T.Term.state
type ty_state = T.Ty.state
type proof = P.t
type t

Main type for a solver

type solver = t
val tst : t -> term_state
val ty_st : t -> ty_state
val stats : t -> Sidekick_util.Stat.t

Actions for the theories

type actions

Handle that the theories can use to perform actions.

module Lit = Lit
type lit = Lit.t

Proof helpers

val define_const : t -> const:term -> rhs:term -> unit

define_const si ~const ~rhs adds the definition const := rhs to the (future) proof. const should be a fresh constant that occurs nowhere else, and rhs a term defined without const.

Congruence Closure

module CC : Sidekick_core.CC_S with module T = T and module P = P and module Lit = Lit and type Actions.t = actions

Congruence closure instance

val cc : t -> CC.t

Congruence closure for this solver

Simplifiers

module Simplify : sig ... end

Simplify terms

type simplify_hook = Simplify.hook
val add_simplifier : t -> Simplify.hook -> unit

Add a simplifier hook for preprocessing.

val simplifier : t -> Simplify.t
val simplify_t : t -> term -> (term * proof) option

Simplify input term, returns Some (u, |- t=u) if some simplification occurred.

val simp_t : t -> term -> term * proof

simp_t si t returns u, |- t=u even if no simplification occurred (in which case t == u syntactically). (see simplifier)

hooks for the theory

val propagate : t -> actions -> lit -> reason:(unit -> lit list * proof) -> unit

Propagate a literal for a reason. This is similar to asserting the clause reason => lit, but more lightweight, and in a way that is backtrackable.

val raise_conflict : t -> actions -> lit list -> proof -> 'a

Give a conflict clause to the solver

val push_decision : t -> actions -> lit -> unit

Ask the SAT solver to decide the given literal in an extension of the current trail. This is useful for theory combination. If the SAT solver backtracks, this (potential) decision is removed and forgotten.

val propagate : t -> actions -> lit -> (unit -> lit list * proof) -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val propagate_l : t -> actions -> lit -> lit list -> proof -> unit

Propagate a boolean using a unit clause. expl => lit must be a theory lemma, that is, a T-tautology

val add_clause_temp : t -> actions -> lit list -> proof -> unit

Add local clause to the SAT solver. This clause will be removed when the solver backtracks.

val add_clause_permanent : t -> actions -> lit list -> proof -> unit

Add toplevel clause to the SAT solver. This clause will not be backtracked.

val mk_lit : t -> actions -> ?⁠sign:bool -> term -> lit

Create a literal. This automatically preprocesses the term.

val preprocess_term : t -> add_clause:(Lit.t list -> proof -> unit) -> term -> term * proof

Preprocess a term.

val add_lit : t -> actions -> lit -> unit

Add the given literal to the SAT solver, so it gets assigned a boolean value

val add_lit_t : t -> actions -> ?⁠sign:bool -> term -> unit

Add the given (signed) bool term to the SAT solver, so it gets assigned a boolean value

val cc_raise_conflict_expl : t -> actions -> CC.Expl.t -> 'a

Raise a conflict with the given congruence closure explanation. it must be a theory tautology that expl ==> absurd. To be used in theories.

val cc_find : t -> CC.N.t -> CC.N.t

Find representative of the node

val cc_are_equal : t -> term -> term -> bool

Are these two terms equal in the congruence closure?

val cc_merge : t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit

Merge these two nodes in the congruence closure, given this explanation. It must be a theory tautology that expl ==> n1 = n2. To be used in theories.

val cc_merge_t : t -> actions -> term -> term -> CC.Expl.t -> unit

Merge these two terms in the congruence closure, given this explanation. See cc_merge

val cc_add_term : t -> term -> CC.N.t

Add/retrieve congruence closure node for this term. To be used in theories

val cc_mem_term : t -> term -> bool

Return true if the term is explicitly in the congruence closure. To be used in theories

val on_cc_pre_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> CC.Expl.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called before)

val on_cc_post_merge : t -> (CC.t -> actions -> CC.N.t -> CC.N.t -> unit) -> unit

Callback for when two classes containing data for this key are merged (called after)

val on_cc_new_term : t -> (CC.t -> CC.N.t -> term -> unit) -> unit

Callback to add data on terms when they are added to the congruence closure

val on_cc_is_subterm : t -> (CC.N.t -> term -> unit) -> unit

Callback for when a term is a subterm of another term in the congruence closure

val on_cc_conflict : t -> (CC.t -> th:bool -> lit list -> unit) -> unit

Callback called on every CC conflict

val on_cc_propagate : t -> (CC.t -> lit -> (unit -> lit list * proof) -> unit) -> unit

Callback called on every CC propagation

val on_partial_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callbacked to be called with the slice of literals newly added on the trail.

This is called very often and should be efficient. It doesn't have to be complete, only correct. It's given only the slice of the trail consisting in new literals.

val on_final_check : t -> (t -> actions -> lit Iter.t -> unit) -> unit

Register callback to be called during the final check.

Must be complete (i.e. must raise a conflict if the set of literals is not satisfiable) and can be expensive. The function is given the whole trail.

Preprocessors

These preprocessors turn mixed, raw literals (possibly simplified) into literals suitable for reasoning. Typically some clauses are also added to the solver.

type preprocess_hook = t -> mk_lit:(term -> lit) -> add_clause:(lit list -> proof -> unit) -> term -> (term * proof) option

Given a term, try to preprocess it. Return None if it didn't change, or Some (u,p) if t=u and p is a proof of t=u. Can also add clauses to define new terms.

Preprocessing might transform terms to make them more amenable to reasoning, e.g. by removing boolean formulas via Tseitin encoding, adding clauses that encode their meaning in the same move.

parameter mk_lit

creates a new literal for a boolean term.

parameter add_clause

pushes a new clause into the SAT solver.

val on_preprocess : t -> preprocess_hook -> unit

Add a hook that will be called when terms are preprocessed

Model production

type model_hook = recurse:(t -> CC.N.t -> term) -> t -> CC.N.t -> term option

A model-production hook. It takes the solver, a class, and returns a term for this class. For example, an arithmetic theory might detect that a class contains a numeric constant, and return this constant as a model value.

If no hook assigns a value to a class, a fake value is created for it.

val on_model_gen : t -> model_hook -> unit

Add a hook that will be called when a model is being produced

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/index.html b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/index.html index e2654fb4..8030cd2c 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-S/A/S/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-S/A/S/index.html @@ -1,2 +1,2 @@ -S (sidekick.Sidekick_th_data.S.A.S)

Module A.S

module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type lemma = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end
module Proof : sig ... end
type proof = Proof.t

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t

Turn a literal into a SAT solver literal.

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t

Turn a boolean term, with a sign, into a SAT solver's literal.

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> unit

Same as add_clause but with a list of atoms.

type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : proof option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file +S (sidekick.Sidekick_th_data.S.A.S)

Module A.S

module P : Sidekick_core.PROOF with type term = T.Term.t
module Lit : Sidekick_core.LIT with module T = T
module Solver_internal : Sidekick_core.SOLVER_INTERNAL with module T = T and module P = P and module Lit = Lit

Internal solver, available to theories.

type t

The solver's state.

type solver = t
type term = T.Term.t
type ty = T.Ty.t
type lit = Lit.t
type proof = P.t
module type THEORY = sig ... end
type theory = (module THEORY)

A theory that can be used for this particular solver.

type 'a theory_p = (module THEORY with type t = 'a)

A theory that can be used for this particular solver, with state of type 'a.

val mk_theory : name:string -> create_and_setup:(Solver_internal.t -> 'th) -> ?⁠push_level:('th -> unit) -> ?⁠pop_levels:('th -> int -> unit) -> unit -> theory

Helper to create a theory.

module Atom : sig ... end
module Model : sig ... end

Models

module Unknown : sig ... end

Main API

val stats : t -> Sidekick_util.Stat.t
val tst : t -> T.Term.state
val ty_st : t -> T.Ty.state
val create : ?⁠stat:Sidekick_util.Stat.t -> ?⁠size:[ `Big | `Tiny | `Small ] -> ?⁠store_proof:bool -> theories:theory list -> T.Term.state -> T.Ty.state -> unit -> t

Create a new solver.

It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.

parameter store_proof

if true, proofs from the SAT solver and theories are retained and potentially accessible after solve returns UNSAT.

parameter size

influences the size of initial allocations.

parameter theories

theories to load from the start. Other theories can be added using add_theory.

val add_theory : t -> theory -> unit

Add a theory to the solver. This should be called before any call to solve or to add_clause and the likes (otherwise the theory will have a partial view of the problem).

val add_theory_p : t -> 'a theory_p -> 'a

Add the given theory and obtain its state

val add_theory_l : t -> theory list -> unit
val mk_atom_lit : t -> lit -> Atom.t * P.t

mk_atom_lit _ lit returns atom, pr where atom is an internal atom for the solver, and pr is a proof of |- lit = atom

val mk_atom_t : t -> ?⁠sign:bool -> term -> Atom.t * P.t

mk_atom_t _ ~sign t returns atom, pr where atom is an internal representation of ± t, and pr is a proof of |- atom = (± t)

val add_clause : t -> Atom.t Sidekick_util.IArray.t -> P.t -> unit

add_clause solver cs adds a boolean clause to the solver. Subsequent calls to solve will need to satisfy this clause.

val add_clause_l : t -> Atom.t list -> P.t -> unit

Add a clause to the solver, given as a list.

module Pre_proof : sig ... end
type res =
| Sat of Model.t

Satisfiable

| Unsat of {
proof : Pre_proof.t option lazy_t;

proof of unsat

unsat_core : Atom.t list lazy_t;

subset of assumptions responsible for unsat

}

Unsatisfiable

| Unknown of Unknown.t

Unknown, obtained after a timeout, memory limit, etc.

Result of solving for the current set of clauses

val solve : ?⁠on_exit:(unit -> unit) list -> ?⁠check:bool -> ?⁠on_progress:(t -> unit) -> assumptions:Atom.t list -> t -> res

solve s checks the satisfiability of the clauses added so far to s.

parameter check

if true, the model is checked before returning.

parameter on_progress

called regularly during solving.

parameter assumptions

a set of atoms held to be true. The unsat core, if any, will be a subset of assumptions.

parameter on_exit

functions to be run before this returns

val pp_stats : t CCFormat.printer

Print some statistics. What it prints exactly is unspecified.

\ No newline at end of file diff --git a/dev/sidekick/Sidekick_th_data/module-type-S/A/index.html b/dev/sidekick/Sidekick_th_data/module-type-S/A/index.html index 2b1757a5..3668db72 100644 --- a/dev/sidekick/Sidekick_th_data/module-type-S/A/index.html +++ b/dev/sidekick/Sidekick_th_data/module-type-S/A/index.html @@ -1,2 +1,2 @@ -A (sidekick.Sidekick_th_data.S.A)

Module S.A

module Cstor : sig ... end

Constructor symbols.

val as_datatype : S.T.Ty.t -> (Cstor.t Iter.tS.T.Ty.t) data_ty_view

Try to view type as a datatype (with its constructors)

val view_as_data : S.T.Term.t -> (Cstor.tS.T.Term.t) data_view

Try to view term as a datatype term

val mk_cstor : S.T.Term.state -> Cstor.t -> S.T.Term.t Sidekick_util.IArray.t -> S.T.Term.t

Make a constructor application term

val mk_is_a : S.T.Term.state -> Cstor.t -> S.T.Term.t -> S.T.Term.t

Make a is-a term

val mk_sel : S.T.Term.state -> Cstor.t -> int -> S.T.Term.t -> S.T.Term.t

Make a selector term

val mk_eq : S.T.Term.state -> S.T.Term.t -> S.T.Term.t -> S.T.Term.t

Make a term equality

val ty_is_finite : S.T.Ty.t -> bool

Is the given type known to be finite? For example a finite datatype (an "enum" in C parlance), or Bool, or Array Bool Bool.

val ty_set_is_finite : S.T.Ty.t -> bool -> unit

Modify the "finite" field (see ty_is_finite)

\ No newline at end of file +A (sidekick.Sidekick_th_data.S.A)

Module S.A

module Cstor : sig ... end

Constructor symbols.

val as_datatype : S.T.Ty.t -> (Cstor.t Iter.tS.T.Ty.t) data_ty_view

Try to view type as a datatype (with its constructors)

val view_as_data : S.T.Term.t -> (Cstor.tS.T.Term.t) data_view

Try to view term as a datatype term

val mk_cstor : S.T.Term.state -> Cstor.t -> S.T.Term.t Sidekick_util.IArray.t -> S.T.Term.t

Make a constructor application term

val mk_is_a : S.T.Term.state -> Cstor.t -> S.T.Term.t -> S.T.Term.t

Make a is-a term

val mk_sel : S.T.Term.state -> Cstor.t -> int -> S.T.Term.t -> S.T.Term.t

Make a selector term

val mk_eq : S.T.Term.state -> S.T.Term.t -> S.T.Term.t -> S.T.Term.t

Make a term equality

val ty_is_finite : S.T.Ty.t -> bool

Is the given type known to be finite? For example a finite datatype (an "enum" in C parlance), or Bool, or Array Bool Bool.

val ty_set_is_finite : S.T.Ty.t -> bool -> unit

Modify the "finite" field (see ty_is_finite)

val proof_isa_split : S.T.Ty.t -> S.T.Term.t Iter.t -> S.P.t
val proof_isa_disj : S.T.Ty.t -> S.T.Term.t -> S.T.Term.t -> S.P.t
val proof_cstor_inj : Cstor.t -> int -> S.T.Term.t list -> S.T.Term.t list -> S.P.t
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_util/IArray/index.html b/dev/sidekick/Sidekick_util/IArray/index.html index a0aa479c..f56389a8 100644 --- a/dev/sidekick/Sidekick_util/IArray/index.html +++ b/dev/sidekick/Sidekick_util/IArray/index.html @@ -1,2 +1,2 @@ -IArray (sidekick.Sidekick_util.IArray)

Module Sidekick_util.IArray

type 'a t = private 'a array

Array of values of type 'a. The underlying type really is an array, but it will never be modified.

It should be covariant but OCaml will not accept it.

val empty : 'a t
val is_empty : _ t -> bool
val length : _ t -> int
val sub : 'a t -> int -> int -> 'a t
val singleton : 'a -> 'a t
val doubleton : 'a -> 'a -> 'a t
val make : int -> 'a -> 'a t

make n x makes an array of n times x

val init : int -> (int -> 'a) -> 'a t

init n f makes the array [| f 0; f 1; ... ; f (n-1) |].

raises Invalid_argument

if n < 0

val get : 'a t -> int -> 'a

Access the element

val unsafe_get : 'a t -> int -> 'a

Unsafe access, not bound-checked. Use with caution

val set : 'a t -> int -> 'a -> 'a t

Copy the array and modify its copy

val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
val append : 'a t -> 'a t -> 'a t
val iter : ('a -> unit) -> 'a t -> unit
val iteri : (int -> 'a -> unit) -> 'a t -> unit
val foldi : ('a -> int -> 'b -> 'a) -> 'a -> 'b t -> 'a
val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
val for_all : ('a -> bool) -> 'a t -> bool
val exists : ('a -> bool) -> 'a t -> bool

Conversions

type 'a iter = ('a -> unit) -> unit
type 'a gen = unit -> 'a option
val of_list : 'a list -> 'a t
val to_list : 'a t -> 'a list
val of_list_map : ('a -> 'b) -> 'a list -> 'b t
val to_list_map : ('a -> 'b) -> 'a t -> 'b list
val of_array_map : ('a -> 'b) -> 'a array -> 'b t
val to_array_map : ('a -> 'b) -> 'a t -> 'b array
val of_array_unsafe : 'a array -> 'a t

Take ownership of the given array. Careful, the array must NOT be modified afterwards!

val to_iter : 'a t -> 'a iter
val to_iter_sub : 'a t -> int -> int -> 'a iter
val of_iter : 'a iter -> 'a t
val of_gen : 'a gen -> 'a t
val to_gen : 'a t -> 'a gen

IO

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
val print : ?⁠start:string -> ?⁠stop:string -> ?⁠sep:string -> 'a printer -> 'a t printer

Binary

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all2 : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val exists2 : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
val fold2 : ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a t -> 'b t -> 'acc
val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit
\ No newline at end of file +IArray (sidekick.Sidekick_util.IArray)

Module Sidekick_util.IArray

type 'a t = private 'a array

Array of values of type 'a. The underlying type really is an array, but it will never be modified.

It should be covariant but OCaml will not accept it.

val empty : 'a t
val is_empty : _ t -> bool
val length : _ t -> int
val sub : 'a t -> int -> int -> 'a t
val singleton : 'a -> 'a t
val doubleton : 'a -> 'a -> 'a t
val make : int -> 'a -> 'a t

make n x makes an array of n times x

val init : int -> (int -> 'a) -> 'a t

init n f makes the array [| f 0; f 1; ... ; f (n-1) |].

raises Invalid_argument

if n < 0

val get : 'a t -> int -> 'a

Access the element

val unsafe_get : 'a t -> int -> 'a

Unsafe access, not bound-checked. Use with caution

val set : 'a t -> int -> 'a -> 'a t

Copy the array and modify its copy

val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
val append : 'a t -> 'a t -> 'a t
val iter : ('a -> unit) -> 'a t -> unit
val iteri : (int -> 'a -> unit) -> 'a t -> unit
val foldi : ('a -> int -> 'b -> 'a) -> 'a -> 'b t -> 'a
val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
val for_all : ('a -> bool) -> 'a t -> bool
val exists : ('a -> bool) -> 'a t -> bool

Conversions

type 'a iter = ('a -> unit) -> unit
type 'a gen = unit -> 'a option
val of_list : 'a list -> 'a t
val to_list : 'a t -> 'a list
val of_list_map : ('a -> 'b) -> 'a list -> 'b t
val to_list_map : ('a -> 'b) -> 'a t -> 'b list
val of_array_map : ('a -> 'b) -> 'a array -> 'b t
val to_array_map : ('a -> 'b) -> 'a t -> 'b array
val of_array_unsafe : 'a array -> 'a t

Take ownership of the given array. Careful, the array must NOT be modified afterwards!

val to_iter : 'a t -> 'a iter
val to_iter_sub : 'a t -> int -> int -> 'a iter
val of_iter : 'a iter -> 'a t
val of_gen : 'a gen -> 'a t
val to_gen : 'a t -> 'a gen

IO

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
val print : ?⁠start:string -> ?⁠stop:string -> ?⁠sep:string -> 'a printer -> 'a t printer

Binary

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all2 : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val exists2 : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
val fold2 : ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a t -> 'b t -> 'acc
val iteri2 : (int -> 'a -> 'b -> unit) -> 'a t -> 'b t -> unit
val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_util/Profile/index.html b/dev/sidekick/Sidekick_util/Profile/index.html index a0556ec3..5c3897f3 100644 --- a/dev/sidekick/Sidekick_util/Profile/index.html +++ b/dev/sidekick/Sidekick_util/Profile/index.html @@ -1,2 +1,2 @@ -Profile (sidekick.Sidekick_util.Profile)

Module Sidekick_util.Profile

Profiling probes

type probe
val null_probe : probe
val enabled : unit -> bool
val instant : string -> unit
val begin_ : string -> probe
val exit : probe -> unit
val with_ : string -> (unit -> 'a) -> 'a
val with1 : string -> ('a -> 'b) -> 'a -> 'b
module type BACKEND = sig ... end
type backend = (module BACKEND)
module Control : sig ... end
\ No newline at end of file +Profile (sidekick.Sidekick_util.Profile)

Module Sidekick_util.Profile

Profiling probes

type probe
val null_probe : probe
val enabled : unit -> bool
val instant : string -> unit
val begin_ : string -> probe
val exit : probe -> unit
val with_ : string -> (unit -> 'a) -> 'a
val with1 : string -> ('a -> 'b) -> 'a -> 'b
val with2 : string -> ('a -> 'b -> 'c) -> 'a -> 'b -> 'c
module type BACKEND = sig ... end
type backend = (module BACKEND)
module Control : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_util__/IArray/index.html b/dev/sidekick/Sidekick_util__/IArray/index.html index 54c65e4e..a6cbcf39 100644 --- a/dev/sidekick/Sidekick_util__/IArray/index.html +++ b/dev/sidekick/Sidekick_util__/IArray/index.html @@ -1,2 +1,2 @@ -IArray (sidekick.Sidekick_util__.IArray)

Module Sidekick_util__.IArray

type 'a t = private 'a array

Array of values of type 'a. The underlying type really is an array, but it will never be modified.

It should be covariant but OCaml will not accept it.

val empty : 'a t
val is_empty : _ t -> bool
val length : _ t -> int
val sub : 'a t -> int -> int -> 'a t
val singleton : 'a -> 'a t
val doubleton : 'a -> 'a -> 'a t
val make : int -> 'a -> 'a t

make n x makes an array of n times x

val init : int -> (int -> 'a) -> 'a t

init n f makes the array [| f 0; f 1; ... ; f (n-1) |].

raises Invalid_argument

if n < 0

val get : 'a t -> int -> 'a

Access the element

val unsafe_get : 'a t -> int -> 'a

Unsafe access, not bound-checked. Use with caution

val set : 'a t -> int -> 'a -> 'a t

Copy the array and modify its copy

val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
val append : 'a t -> 'a t -> 'a t
val iter : ('a -> unit) -> 'a t -> unit
val iteri : (int -> 'a -> unit) -> 'a t -> unit
val foldi : ('a -> int -> 'b -> 'a) -> 'a -> 'b t -> 'a
val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
val for_all : ('a -> bool) -> 'a t -> bool
val exists : ('a -> bool) -> 'a t -> bool

Conversions

type 'a iter = ('a -> unit) -> unit
type 'a gen = unit -> 'a option
val of_list : 'a list -> 'a t
val to_list : 'a t -> 'a list
val of_list_map : ('a -> 'b) -> 'a list -> 'b t
val to_list_map : ('a -> 'b) -> 'a t -> 'b list
val of_array_map : ('a -> 'b) -> 'a array -> 'b t
val to_array_map : ('a -> 'b) -> 'a t -> 'b array
val of_array_unsafe : 'a array -> 'a t

Take ownership of the given array. Careful, the array must NOT be modified afterwards!

val to_iter : 'a t -> 'a iter
val to_iter_sub : 'a t -> int -> int -> 'a iter
val of_iter : 'a iter -> 'a t
val of_gen : 'a gen -> 'a t
val to_gen : 'a t -> 'a gen

IO

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
val print : ?⁠start:string -> ?⁠stop:string -> ?⁠sep:string -> 'a printer -> 'a t printer

Binary

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all2 : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val exists2 : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
val fold2 : ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a t -> 'b t -> 'acc
val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit
\ No newline at end of file +IArray (sidekick.Sidekick_util__.IArray)

Module Sidekick_util__.IArray

type 'a t = private 'a array

Array of values of type 'a. The underlying type really is an array, but it will never be modified.

It should be covariant but OCaml will not accept it.

val empty : 'a t
val is_empty : _ t -> bool
val length : _ t -> int
val sub : 'a t -> int -> int -> 'a t
val singleton : 'a -> 'a t
val doubleton : 'a -> 'a -> 'a t
val make : int -> 'a -> 'a t

make n x makes an array of n times x

val init : int -> (int -> 'a) -> 'a t

init n f makes the array [| f 0; f 1; ... ; f (n-1) |].

raises Invalid_argument

if n < 0

val get : 'a t -> int -> 'a

Access the element

val unsafe_get : 'a t -> int -> 'a

Unsafe access, not bound-checked. Use with caution

val set : 'a t -> int -> 'a -> 'a t

Copy the array and modify its copy

val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
val append : 'a t -> 'a t -> 'a t
val iter : ('a -> unit) -> 'a t -> unit
val iteri : (int -> 'a -> unit) -> 'a t -> unit
val foldi : ('a -> int -> 'b -> 'a) -> 'a -> 'b t -> 'a
val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
val for_all : ('a -> bool) -> 'a t -> bool
val exists : ('a -> bool) -> 'a t -> bool

Conversions

type 'a iter = ('a -> unit) -> unit
type 'a gen = unit -> 'a option
val of_list : 'a list -> 'a t
val to_list : 'a t -> 'a list
val of_list_map : ('a -> 'b) -> 'a list -> 'b t
val to_list_map : ('a -> 'b) -> 'a t -> 'b list
val of_array_map : ('a -> 'b) -> 'a array -> 'b t
val to_array_map : ('a -> 'b) -> 'a t -> 'b array
val of_array_unsafe : 'a array -> 'a t

Take ownership of the given array. Careful, the array must NOT be modified afterwards!

val to_iter : 'a t -> 'a iter
val to_iter_sub : 'a t -> int -> int -> 'a iter
val of_iter : 'a iter -> 'a t
val of_gen : 'a gen -> 'a t
val to_gen : 'a t -> 'a gen

IO

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
val print : ?⁠start:string -> ?⁠stop:string -> ?⁠sep:string -> 'a printer -> 'a t printer

Binary

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all2 : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val exists2 : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
val fold2 : ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a t -> 'b t -> 'acc
val iteri2 : (int -> 'a -> 'b -> unit) -> 'a t -> 'b t -> unit
val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_util__/Profile/index.html b/dev/sidekick/Sidekick_util__/Profile/index.html index 3831f730..7ecd07b2 100644 --- a/dev/sidekick/Sidekick_util__/Profile/index.html +++ b/dev/sidekick/Sidekick_util__/Profile/index.html @@ -1,2 +1,2 @@ -Profile (sidekick.Sidekick_util__.Profile)

Module Sidekick_util__.Profile

Profiling probes

type probe
val null_probe : probe
val enabled : unit -> bool
val instant : string -> unit
val begin_ : string -> probe
val exit : probe -> unit
val with_ : string -> (unit -> 'a) -> 'a
val with1 : string -> ('a -> 'b) -> 'a -> 'b
module type BACKEND = sig ... end
type backend = (module BACKEND)
module Control : sig ... end
\ No newline at end of file +Profile (sidekick.Sidekick_util__.Profile)

Module Sidekick_util__.Profile

Profiling probes

type probe
val null_probe : probe
val enabled : unit -> bool
val instant : string -> unit
val begin_ : string -> probe
val exit : probe -> unit
val with_ : string -> (unit -> 'a) -> 'a
val with1 : string -> ('a -> 'b) -> 'a -> 'b
val with2 : string -> ('a -> 'b -> 'c) -> 'a -> 'b -> 'c
module type BACKEND = sig ... end
type backend = (module BACKEND)
module Control : sig ... end
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_util__IArray/index.html b/dev/sidekick/Sidekick_util__IArray/index.html index 106078f1..69f23e08 100644 --- a/dev/sidekick/Sidekick_util__IArray/index.html +++ b/dev/sidekick/Sidekick_util__IArray/index.html @@ -1,2 +1,2 @@ -Sidekick_util__IArray (sidekick.Sidekick_util__IArray)

Module Sidekick_util__IArray

type 'a t = private 'a array

Array of values of type 'a. The underlying type really is an array, but it will never be modified.

It should be covariant but OCaml will not accept it.

val empty : 'a t
val is_empty : _ t -> bool
val length : _ t -> int
val sub : 'a t -> int -> int -> 'a t
val singleton : 'a -> 'a t
val doubleton : 'a -> 'a -> 'a t
val make : int -> 'a -> 'a t

make n x makes an array of n times x

val init : int -> (int -> 'a) -> 'a t

init n f makes the array [| f 0; f 1; ... ; f (n-1) |].

raises Invalid_argument

if n < 0

val get : 'a t -> int -> 'a

Access the element

val unsafe_get : 'a t -> int -> 'a

Unsafe access, not bound-checked. Use with caution

val set : 'a t -> int -> 'a -> 'a t

Copy the array and modify its copy

val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
val append : 'a t -> 'a t -> 'a t
val iter : ('a -> unit) -> 'a t -> unit
val iteri : (int -> 'a -> unit) -> 'a t -> unit
val foldi : ('a -> int -> 'b -> 'a) -> 'a -> 'b t -> 'a
val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
val for_all : ('a -> bool) -> 'a t -> bool
val exists : ('a -> bool) -> 'a t -> bool

Conversions

type 'a iter = ('a -> unit) -> unit
type 'a gen = unit -> 'a option
val of_list : 'a list -> 'a t
val to_list : 'a t -> 'a list
val of_list_map : ('a -> 'b) -> 'a list -> 'b t
val to_list_map : ('a -> 'b) -> 'a t -> 'b list
val of_array_map : ('a -> 'b) -> 'a array -> 'b t
val to_array_map : ('a -> 'b) -> 'a t -> 'b array
val of_array_unsafe : 'a array -> 'a t

Take ownership of the given array. Careful, the array must NOT be modified afterwards!

val to_iter : 'a t -> 'a iter
val to_iter_sub : 'a t -> int -> int -> 'a iter
val of_iter : 'a iter -> 'a t
val of_gen : 'a gen -> 'a t
val to_gen : 'a t -> 'a gen

IO

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
val print : ?⁠start:string -> ?⁠stop:string -> ?⁠sep:string -> 'a printer -> 'a t printer

Binary

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all2 : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val exists2 : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
val fold2 : ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a t -> 'b t -> 'acc
val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit
\ No newline at end of file +Sidekick_util__IArray (sidekick.Sidekick_util__IArray)

Module Sidekick_util__IArray

type 'a t = private 'a array

Array of values of type 'a. The underlying type really is an array, but it will never be modified.

It should be covariant but OCaml will not accept it.

val empty : 'a t
val is_empty : _ t -> bool
val length : _ t -> int
val sub : 'a t -> int -> int -> 'a t
val singleton : 'a -> 'a t
val doubleton : 'a -> 'a -> 'a t
val make : int -> 'a -> 'a t

make n x makes an array of n times x

val init : int -> (int -> 'a) -> 'a t

init n f makes the array [| f 0; f 1; ... ; f (n-1) |].

raises Invalid_argument

if n < 0

val get : 'a t -> int -> 'a

Access the element

val unsafe_get : 'a t -> int -> 'a

Unsafe access, not bound-checked. Use with caution

val set : 'a t -> int -> 'a -> 'a t

Copy the array and modify its copy

val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
val append : 'a t -> 'a t -> 'a t
val iter : ('a -> unit) -> 'a t -> unit
val iteri : (int -> 'a -> unit) -> 'a t -> unit
val foldi : ('a -> int -> 'b -> 'a) -> 'a -> 'b t -> 'a
val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
val for_all : ('a -> bool) -> 'a t -> bool
val exists : ('a -> bool) -> 'a t -> bool

Conversions

type 'a iter = ('a -> unit) -> unit
type 'a gen = unit -> 'a option
val of_list : 'a list -> 'a t
val to_list : 'a t -> 'a list
val of_list_map : ('a -> 'b) -> 'a list -> 'b t
val to_list_map : ('a -> 'b) -> 'a t -> 'b list
val of_array_map : ('a -> 'b) -> 'a array -> 'b t
val to_array_map : ('a -> 'b) -> 'a t -> 'b array
val of_array_unsafe : 'a array -> 'a t

Take ownership of the given array. Careful, the array must NOT be modified afterwards!

val to_iter : 'a t -> 'a iter
val to_iter_sub : 'a t -> int -> int -> 'a iter
val of_iter : 'a iter -> 'a t
val of_gen : 'a gen -> 'a t
val to_gen : 'a t -> 'a gen

IO

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
val print : ?⁠start:string -> ?⁠stop:string -> ?⁠sep:string -> 'a printer -> 'a t printer

Binary

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all2 : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val exists2 : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
val fold2 : ('acc -> 'a -> 'b -> 'acc) -> 'acc -> 'a t -> 'b t -> 'acc
val iteri2 : (int -> 'a -> 'b -> unit) -> 'a t -> 'b t -> unit
val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit
\ No newline at end of file diff --git a/dev/sidekick/Sidekick_util__Profile/index.html b/dev/sidekick/Sidekick_util__Profile/index.html index 7f151278..cf6a63b6 100644 --- a/dev/sidekick/Sidekick_util__Profile/index.html +++ b/dev/sidekick/Sidekick_util__Profile/index.html @@ -1,2 +1,2 @@ -Sidekick_util__Profile (sidekick.Sidekick_util__Profile)

Module Sidekick_util__Profile

Profiling probes

type probe
val null_probe : probe
val enabled : unit -> bool
val instant : string -> unit
val begin_ : string -> probe
val exit : probe -> unit
val with_ : string -> (unit -> 'a) -> 'a
val with1 : string -> ('a -> 'b) -> 'a -> 'b
module type BACKEND = sig ... end
type backend = (module BACKEND)
module Control : sig ... end
\ No newline at end of file +Sidekick_util__Profile (sidekick.Sidekick_util__Profile)

Module Sidekick_util__Profile

Profiling probes

type probe
val null_probe : probe
val enabled : unit -> bool
val instant : string -> unit
val begin_ : string -> probe
val exit : probe -> unit
val with_ : string -> (unit -> 'a) -> 'a
val with1 : string -> ('a -> 'b) -> 'a -> 'b
val with2 : string -> ('a -> 'b -> 'c) -> 'a -> 'b -> 'c
module type BACKEND = sig ... end
type backend = (module BACKEND)
module Control : sig ... end
\ No newline at end of file