├── .github └── workflows │ ├── gh-pages.yml │ └── main.yml ├── .gitignore ├── .ocamlformat ├── .ocp-indent ├── LICENSE ├── Makefile ├── README.md ├── doc ├── dune ├── guide.md ├── mdx_runner.ml └── papers │ ├── mcsat-vmcai2013.pdf │ ├── mcsat_design.pdf │ └── minisat.pdf ├── dune ├── dune-project ├── examples └── sudoku │ ├── dune │ ├── sudoku_solve.ml │ └── tests │ ├── Makefile │ ├── dune │ ├── head15_top1465.expected │ ├── head15_top1465.txt │ ├── sudoku.txt │ └── top1465.txt ├── proof-trace-dump.sh ├── sidekick-base.opam ├── sidekick-bin.opam ├── sidekick.opam ├── sidekick.sh ├── src ├── abstract-solver │ ├── asolver.ml │ ├── check_res.ml │ ├── dune │ ├── sidekick_abstract_solver.ml │ ├── unknown.ml │ └── unknown.mli ├── algos │ └── simplex │ │ ├── binary_op.ml │ │ ├── dune │ │ ├── linear_expr.ml │ │ ├── linear_expr.mli │ │ ├── linear_expr_intf.ml │ │ ├── predicate.ml │ │ ├── sidekick_simplex.ml │ │ └── tests │ │ ├── dune │ │ └── test_simplex.real.ml ├── arith │ ├── dune │ └── sidekick_arith.ml ├── base │ ├── Config.ml │ ├── Config.mli │ ├── Data_ty.ml │ ├── Data_ty.mli │ ├── Form.ml │ ├── Form.mli │ ├── Het.ml │ ├── Het.mli │ ├── ID.ml │ ├── ID.mli │ ├── LIA_term.ml │ ├── LRA_term.ml │ ├── LRA_term.mli │ ├── Proof_quip.ml.tmp │ ├── Proof_quip.mli.tmp │ ├── Proof_storage.ml.tmp │ ├── Proof_storage.mli.tmp │ ├── Sidekick_base.ml │ ├── Solver.ml │ ├── Statement.ml │ ├── Statement.mli │ ├── Term.ml │ ├── Ty.ml │ ├── Ty.mli │ ├── Uconst.ml │ ├── Uconst.mli │ ├── dune │ ├── th_bool.ml │ ├── th_data.ml │ ├── th_lra.ml │ ├── th_ty_unin.ml │ └── types_.ml ├── bencode │ ├── Sidekick_bencode.ml │ ├── Sidekick_bencode.mli │ └── dune ├── bin-lib │ ├── Dimacs_lexer.mll │ ├── Dimacs_parser.ml │ ├── Dimacs_parser.mli │ ├── Drup_lexer.mll │ ├── Drup_parser.ml │ ├── Drup_parser.mli │ ├── Sidekick_bin_lib.ml │ ├── dune │ ├── trace_setup.dummy.ml │ ├── trace_setup.fuchsia.ml │ ├── trace_setup.mli │ └── trace_setup.tef.ml ├── cc │ ├── CC.ml │ ├── CC.mli │ ├── Sidekick_cc.ml │ ├── Sidekick_cc.mli │ ├── bits.ml │ ├── bits.mli │ ├── dune │ ├── e_node.ml │ ├── e_node.mli │ ├── expl.ml │ ├── expl.mli │ ├── plugin.ml │ ├── plugin.mli │ ├── plugin │ │ └── dune │ ├── resolved_expl.ml │ ├── resolved_expl.mli │ ├── signature.ml │ ├── sigs_plugin.ml │ └── types_.ml ├── checker │ ├── drup_check.ml │ ├── dune │ └── main.ml ├── core-logic │ ├── Hashcons.ml │ ├── bvar.ml │ ├── bvar.mli │ ├── const.ml │ ├── const.mli │ ├── dune │ ├── sidekick_core_logic.ml │ ├── str_const.ml │ ├── str_const.mli │ ├── subst.ml │ ├── subst.mli │ ├── t_builtins.ml │ ├── t_builtins.mli │ ├── term.ml │ ├── term.mli │ ├── types_.ml │ ├── var.ml │ └── var.mli ├── core │ ├── CC_view.ml │ ├── CC_view.mli │ ├── LRU.ml │ ├── Sidekick_core.ml │ ├── bool_view.ml │ ├── box.ml │ ├── box.mli │ ├── default_cc_view.ml │ ├── default_cc_view.mli │ ├── dune │ ├── gensym.ml │ ├── gensym.mli │ ├── lit.ml │ ├── lit.mli │ ├── t_printer.ml │ ├── t_printer.mli │ ├── t_ref.ml │ ├── t_ref.mli │ ├── t_trace_reader.ml │ ├── t_trace_reader.mli │ ├── t_tracer.ml │ └── t_tracer.mli ├── drup │ ├── dune │ └── sidekick_drup.ml ├── main │ ├── dune │ ├── main.ml │ ├── pure_sat_solver.ml │ └── show_trace.ml ├── memtrace │ ├── dune │ ├── sidekick_memtrace.dummy.ml │ ├── sidekick_memtrace.mli │ └── sidekick_memtrace.real.ml ├── mini-cc │ ├── Sidekick_mini_cc.ml │ ├── Sidekick_mini_cc.mli │ └── dune ├── proof │ ├── core_rules.ml │ ├── core_rules.mli │ ├── dune │ ├── pterm.ml │ ├── pterm.mli │ ├── sat_rules.ml │ ├── sat_rules.mli │ ├── sidekick_proof.ml │ ├── step.ml │ ├── step_vec.ml │ ├── step_vec.mli │ ├── trace_reader.ml │ ├── trace_reader.mli │ ├── tracer.ml │ └── tracer.mli ├── quip │ ├── Proof.ml │ ├── Sidekick_quip.ml │ ├── Sidekick_quip.mli │ └── dune ├── sat │ ├── .gitignore │ ├── README.md │ ├── Sidekick_sat.ml │ ├── base_types_.ml │ ├── dune │ ├── heap.ml │ ├── heap.mli │ ├── heap_intf.ml │ ├── sigs.ml │ ├── solver.ml │ ├── solver.mli │ ├── store.ml │ ├── store.mli │ ├── tracer.ml │ └── tracer.mli ├── sigs │ ├── dune │ └── sidekick_sigs.ml ├── simplify │ ├── dune │ ├── sidekick_simplify.ml │ └── sidekick_simplify.mli ├── smt │ ├── Sidekick_smt_solver.ml │ ├── dune │ ├── find_foreign.ml │ ├── find_foreign.mli │ ├── model.ml │ ├── model_builder.ml │ ├── model_builder.mli │ ├── preprocess.ml │ ├── preprocess.mli │ ├── registry.ml │ ├── registry.mli │ ├── sigs.ml │ ├── solver.ml │ ├── solver.mli │ ├── solver_internal.ml │ ├── solver_internal.mli │ ├── th_combination.ml │ ├── th_combination.mli │ ├── theory.ml │ ├── theory_id.ml │ ├── theory_id.mli │ ├── trace_reader.ml │ ├── trace_reader.mli │ ├── tracer.ml │ └── tracer.mli ├── smtlib │ ├── Driver.ml │ ├── Driver.mli │ ├── Sidekick_smtlib.ml │ ├── Sidekick_smtlib.mli │ ├── Typecheck.ml │ ├── Typecheck.mli │ ├── build_model.ml │ ├── build_model.mli │ ├── check_cc.ml │ ├── check_cc.mli │ ├── common_.ml │ ├── dune │ ├── model.ml │ ├── model.mli │ ├── progress_bar.ml │ ├── progress_bar.mli │ └── solver.ml ├── th-bool-dyn │ ├── Sidekick_th_bool_dyn.ml │ ├── Sidekick_th_bool_dyn.mli │ ├── dune │ ├── intf.ml │ ├── proof_rules.ml │ └── proof_rules.mli ├── th-bool-static │ ├── Sidekick_th_bool_static.ml │ ├── Sidekick_th_bool_static.mli │ ├── dune │ ├── intf.ml │ ├── proof_rules.ml │ └── proof_rules.mli ├── th-cstor │ ├── Sidekick_th_cstor.ml │ ├── Sidekick_th_cstor.mli │ └── dune ├── th-data │ ├── Sidekick_th_data.ml │ ├── Sidekick_th_data.mli │ ├── dune │ ├── proof_rules.ml │ ├── proof_rules.mli │ └── th_intf.ml ├── th-lra │ ├── dune │ ├── intf.ml │ ├── proof_rules.ml │ ├── proof_rules.mli │ ├── sidekick_th_lra.ml │ └── sidekick_th_lra.mli ├── th-unin-ty │ ├── dune │ ├── sidekick_th_ty_unin.ml │ └── sidekick_th_ty_unin.mli ├── tools │ ├── README.md │ ├── analyze.py │ ├── ddsmt_driver_sat.py │ ├── ddsmt_driver_unsat.py │ └── profile.sh ├── trace │ ├── dune │ ├── entry_id.ml │ ├── sidekick_trace.ml │ ├── sink.ml │ ├── sink.mli │ ├── source.ml │ └── source.mli ├── util │ ├── Backtrack_stack.ml │ ├── Backtrack_stack.mli │ ├── Backtrackable_ref.ml │ ├── Backtrackable_ref.mli │ ├── Backtrackable_tbl.ml │ ├── Backtrackable_tbl.mli │ ├── Bag.ml │ ├── Bag.mli │ ├── Bitvec.ml │ ├── Bitvec.mli │ ├── Chunk_stack.ml │ ├── Chunk_stack.mli │ ├── Error.ml │ ├── Error.mli │ ├── Event.ml │ ├── Event.mli │ ├── Hash.ml │ ├── Hash.mli │ ├── Int_id.ml │ ├── Log.ml │ ├── Log.mli │ ├── Profile.ml │ ├── Sidekick_util.ml │ ├── Stat.ml │ ├── Stat.mli │ ├── Util.ml │ ├── Util.mli │ ├── Vec.ml │ ├── Vec.mli │ ├── Vec_float.ml │ ├── Vec_float.mli │ ├── Vec_sig.ml │ ├── Veci.ml │ ├── Veci.mli │ ├── dune │ ├── gen │ │ ├── dune │ │ └── gen_vec.ml.tmp │ ├── ser_decode.ml │ ├── ser_decode.mli │ ├── ser_value.ml │ ├── ser_value.mli │ └── tests │ │ ├── dune │ │ ├── sidekick_test_util.ml │ │ ├── test_bitvec.ml │ │ └── test_chunk_stack.ml └── zarith │ ├── dune │ ├── sidekick_zarith.ml │ └── sidekick_zarith.mli ├── sudoku_solve.sh ├── tests ├── acycl-diamond │ ├── acycl_data_10.smt2 │ ├── acycl_data_100.smt2 │ ├── acycl_data_15.smt2 │ ├── acycl_data_20.smt2 │ └── gen_acycl_data.lua ├── benchpress.sexp ├── bf │ ├── README │ ├── bf0432-007.cnf │ ├── bf1355-075.cnf │ ├── bf1355-638.cnf │ └── bf2670-001.cnf ├── bugs │ ├── double_atom.cnf │ └── undecided.icnf ├── dubois │ ├── README │ ├── dubois100.cnf │ ├── dubois20.cnf │ ├── dubois21.cnf │ ├── dubois22.cnf │ ├── dubois23.cnf │ ├── dubois24.cnf │ ├── dubois25.cnf │ ├── dubois26.cnf │ ├── dubois27.cnf │ ├── dubois28.cnf │ ├── dubois29.cnf │ ├── dubois30.cnf │ └── dubois50.cnf ├── dune ├── hanoi │ ├── README │ ├── hanoi4.cnf │ └── hanoi5.cnf ├── jnh │ ├── README │ ├── jnh1.cnf │ ├── jnh10.cnf │ ├── jnh11.cnf │ ├── jnh12.cnf │ ├── jnh13.cnf │ ├── jnh14.cnf │ ├── jnh15.cnf │ ├── jnh16.cnf │ ├── jnh17.cnf │ ├── jnh18.cnf │ ├── jnh19.cnf │ ├── jnh2.cnf │ ├── jnh20.cnf │ ├── jnh201.cnf │ ├── jnh202.cnf │ ├── jnh203.cnf │ ├── jnh204.cnf │ ├── jnh205.cnf │ ├── jnh206.cnf │ ├── jnh207.cnf │ ├── jnh208.cnf │ ├── jnh209.cnf │ ├── jnh210.cnf │ ├── jnh211.cnf │ ├── jnh212.cnf │ ├── jnh213.cnf │ ├── jnh214.cnf │ ├── jnh215.cnf │ ├── jnh216.cnf │ ├── jnh217.cnf │ ├── jnh218.cnf │ ├── jnh219.cnf │ ├── jnh220.cnf │ ├── jnh3.cnf │ ├── jnh301.cnf │ ├── jnh302.cnf │ ├── jnh303.cnf │ ├── jnh304.cnf │ ├── jnh305.cnf │ ├── jnh306.cnf │ ├── jnh307.cnf │ ├── jnh308.cnf │ ├── jnh309.cnf │ ├── jnh310.cnf │ ├── jnh4.cnf │ ├── jnh5.cnf │ ├── jnh6.cnf │ ├── jnh7.cnf │ ├── jnh8.cnf │ └── jnh9.cnf ├── pigeon │ ├── README │ ├── hole10.cnf │ ├── hole6.cnf │ ├── hole7.cnf │ ├── hole8.cnf │ ├── hole9.cnf │ └── results ├── pret │ ├── README │ ├── pret150_25.cnf │ ├── pret150_40.cnf │ ├── pret150_60.cnf │ ├── pret150_75.cnf │ ├── pret60_25.cnf │ ├── pret60_40.cnf │ ├── pret60_60.cnf │ └── pret60_75.cnf ├── run ├── sat │ ├── Carpark2-ausgabe-8-reduced.smt2 │ ├── Carpark2-ausgabe-8.smt2 │ ├── QF_UF_schedule_world.2.prop1_ab_cti_max.smt2 │ ├── SEQ050_size4.smt2 │ ├── broydn.c.i.broydn.pl.t2.fixed.t2.c_Iteration8_Loop_7-phaseTemplate.smt2 │ ├── cpachecker-induction.1_3.c_false-unreach-call.i.smt2 │ ├── cpachecker-induction.32_1_cilled_true-unreach-call_ok_nondet_linux-3.4-32_1-drivers--input--joystick--magellan.ko-ldv_main0_sequence_infinite_withcheck_stateful.cil.out.c.smt2 │ ├── cpachecker-induction.minepump_spec1_product33_false-unreach-call.cil.c.smt2 │ ├── disj_nightmare.t2.c_Iteration1_Loop_3-pieceTemplate.smt2 │ ├── gensys_brn_sk020.smt2 │ ├── hanoi4.cnf │ ├── iso_brn099.smt2 │ ├── polypaver-bench-exp-3d-chunk-0032.smt2 │ ├── reg_2022-09-10.smt2 │ ├── smtlib.620524.smt2 │ ├── ssa1.cnf │ ├── ssa2.cnf │ ├── ssa3.cnf │ ├── ssa4.cnf │ ├── test-000.cnf │ ├── test-002.smt2 │ ├── test-006.smt2 │ ├── test-007.smt2 │ ├── test-010.smt2 │ ├── test-014.cnf │ ├── typed_v2l20091.cvc.smt2 │ ├── typed_v3l30001.cvc.smt2 │ ├── typed_v3l60005.cvc.smt2 │ ├── typed_v5l90027.cvc.smt2 │ ├── uart-10.induction.cvc.smt2 │ ├── v1l20001.cvc.smt2 │ ├── v1l20035.cvc.smt2 │ ├── v1l20060.cvc.smt2 │ ├── v1l40032.cvc.smt2 │ ├── v1l60008.cvc.smt2 │ ├── v3l20077.cvc.smt2 │ ├── v3l30062.cvc.smt2 │ └── v5l90073.cvc.smt2 ├── ssa │ ├── README │ ├── ssa0432-003.cnf │ ├── ssa2670-130.cnf │ ├── ssa2670-141.cnf │ ├── ssa6288-047.cnf │ ├── ssa7552-038.cnf │ ├── ssa7552-158.cnf │ ├── ssa7552-159.cnf │ └── ssa7552-160.cnf ├── unsat │ ├── NEQ004_size4.smt2 │ ├── NEQ032_size5.smt2 │ ├── NEQ041_size7.smt2 │ ├── PEQ011_size7.smt2 │ ├── PEQ012_size3.smt2 │ ├── QF_UF_brp2.1.prop3_ab_reg_max.smt2 │ ├── QF_UF_cambridge.7.prop2_ab_reg_max.smt2 │ ├── SEQ017_size5.smt2 │ ├── SEQ035_size4.smt2 │ ├── bug-01.cnf │ ├── clocksynchro_2clocks.worst_case_skew.base.smt2 │ ├── clocksynchro_9clocks.main_invar.base.smt2 │ ├── cong_fff.smt2 │ ├── cong_fff_conditional.smt2 │ ├── cong_fff_conditional4.smt2 │ ├── cong_fff_conditional6.smt2 │ ├── data_acycl1.smt2 │ ├── data_acycl_if.smt2 │ ├── data_card1.smt2 │ ├── diamond2_cong_if.smt2 │ ├── eq_diamond10.smt2 │ ├── eq_diamond100.smt2 │ ├── eq_diamond15.smt2 │ ├── eq_diamond17.smt2 │ ├── eq_diamond2.smt2 │ ├── eq_diamond20.smt2 │ ├── eq_diamond3.smt2 │ ├── eq_diamond30.smt2 │ ├── eq_diamond4.smt2 │ ├── eq_diamond50.smt2 │ ├── eq_diamond70.smt2 │ ├── gensys_brn105.smt2 │ ├── gensys_icl015.smt2 │ ├── gensys_icl1272.smt2 │ ├── hole6.cnf │ ├── hole7.cnf │ ├── if_ff_fg.smt2 │ ├── iso_icl527.smt2 │ ├── iso_icl_nogen_sk002.smt2 │ ├── named_term.smt2 │ ├── nested_if.smt2 │ ├── pb_real_30_0600_10_18.smt2 │ ├── pb_real_40_80_60_01.smt2 │ ├── pb_real_50_150_30_47.smt2 │ ├── pursuit-safety-1-reduced.smt2 │ ├── pursuit-safety-1.smt2 │ ├── reg_dt.smt2 │ ├── reg_lra_2_ite.smt2 │ ├── reg_lra_3.smt2 │ ├── reg_lra_4.smt2 │ ├── reg_lra_fm1.smt2 │ ├── reg_uflra.smt2 │ ├── sc-6.base.cvc.smt2 │ ├── simple_example_1-node2318.smt2 │ ├── smtlib.624898.smt2 │ ├── smtlib.624916.smt2 │ ├── smtlib.626179.smt2 │ ├── ssa5.cnf │ ├── ssa6.cnf │ ├── ssa7.cnf │ ├── ssa8.cnf │ ├── t_cstor1.smt2.tmp │ ├── t_subform.smt2 │ ├── test-000.cnf │ ├── test-001.cnf │ ├── test-003.smt2 │ ├── test-004.smt2 │ ├── test-005.smt2 │ ├── test-008.smt2 │ ├── test-009.smt2 │ ├── test-010.smt2 │ ├── test-011.smt2 │ ├── test-012.smt2 │ ├── test-013.smt2 │ ├── test-016.smt2 │ ├── test-017.smt2 │ ├── test-018.smt2 │ ├── test_ite_1.smt2 │ ├── typed_v10l40007.cvc.smt2 │ ├── typed_v1l90014.cvc.smt2 │ ├── typed_v2l20025.cvc.smt2 │ ├── typed_v3l20047.cvc.smt2 │ ├── typed_v3l30091.cvc.smt2 │ ├── typed_v3l40070.cvc.smt2 │ ├── typed_v3l60024.cvc.smt2 │ ├── typed_v3l90060.cvc.smt2 │ ├── typed_v5l50010.cvc.smt2 │ ├── typed_v5l90068.cvc.smt2 │ ├── uart-10.base.cvc.smt2 │ ├── uart-7.base.cvc.smt2 │ ├── v1l50092.cvc.smt2 │ ├── v1l90033.cvc.smt2 │ ├── v3l60049.cvc.smt2 │ └── v3l90003.cvc.smt2 ├── uuf100 │ ├── mean │ ├── uuf100-01.cnf │ ├── uuf100-010.cnf │ ├── uuf100-0100.cnf │ ├── uuf100-01000.cnf │ ├── uuf100-0101.cnf │ ├── uuf100-0102.cnf │ ├── uuf100-0103.cnf │ ├── uuf100-0104.cnf │ ├── uuf100-0105.cnf │ ├── uuf100-0106.cnf │ ├── uuf100-0107.cnf │ ├── uuf100-0108.cnf │ ├── uuf100-0109.cnf │ ├── uuf100-011.cnf │ ├── uuf100-0110.cnf │ ├── uuf100-0111.cnf │ ├── uuf100-0112.cnf │ ├── uuf100-0113.cnf │ ├── uuf100-0114.cnf │ ├── uuf100-0115.cnf │ ├── uuf100-0116.cnf │ ├── uuf100-0117.cnf │ ├── uuf100-0118.cnf │ ├── uuf100-0119.cnf │ ├── uuf100-012.cnf │ ├── uuf100-0120.cnf │ ├── uuf100-0121.cnf │ ├── uuf100-0122.cnf │ ├── uuf100-0123.cnf │ ├── uuf100-0124.cnf │ ├── uuf100-0125.cnf │ ├── uuf100-0126.cnf │ ├── uuf100-0127.cnf │ ├── uuf100-0128.cnf │ ├── uuf100-0129.cnf │ ├── uuf100-013.cnf │ ├── uuf100-0130.cnf │ ├── uuf100-0131.cnf │ ├── uuf100-0132.cnf │ ├── uuf100-0133.cnf │ ├── uuf100-0134.cnf │ ├── uuf100-0135.cnf │ ├── uuf100-0136.cnf │ ├── uuf100-0137.cnf │ ├── uuf100-0138.cnf │ ├── uuf100-0139.cnf │ ├── uuf100-014.cnf │ ├── uuf100-0140.cnf │ ├── uuf100-0141.cnf │ ├── uuf100-0142.cnf │ ├── uuf100-0143.cnf │ ├── uuf100-0144.cnf │ ├── uuf100-0145.cnf │ ├── uuf100-0146.cnf │ ├── uuf100-0147.cnf │ ├── uuf100-0148.cnf │ ├── uuf100-0149.cnf │ ├── uuf100-015.cnf │ ├── uuf100-0150.cnf │ ├── uuf100-0151.cnf │ ├── uuf100-0152.cnf │ ├── uuf100-0153.cnf │ ├── uuf100-0154.cnf │ ├── uuf100-0155.cnf │ ├── uuf100-0156.cnf │ ├── uuf100-0157.cnf │ ├── uuf100-0158.cnf │ ├── uuf100-0159.cnf │ ├── uuf100-016.cnf │ ├── uuf100-0160.cnf │ ├── uuf100-0161.cnf │ ├── uuf100-0162.cnf │ ├── uuf100-0163.cnf │ ├── uuf100-0164.cnf │ ├── uuf100-0165.cnf │ ├── uuf100-0166.cnf │ ├── uuf100-0167.cnf │ ├── uuf100-0168.cnf │ ├── uuf100-0169.cnf │ ├── uuf100-017.cnf │ ├── uuf100-0170.cnf │ ├── uuf100-0171.cnf │ ├── uuf100-0172.cnf │ ├── uuf100-0173.cnf │ ├── uuf100-0174.cnf │ ├── uuf100-0175.cnf │ ├── uuf100-0176.cnf │ ├── uuf100-0177.cnf │ ├── uuf100-0178.cnf │ ├── uuf100-0179.cnf │ ├── uuf100-018.cnf │ ├── uuf100-0180.cnf │ ├── uuf100-0181.cnf │ ├── uuf100-0182.cnf │ ├── uuf100-0183.cnf │ ├── uuf100-0184.cnf │ ├── uuf100-0185.cnf │ ├── uuf100-0186.cnf │ ├── uuf100-0187.cnf │ ├── uuf100-0188.cnf │ ├── uuf100-0189.cnf │ ├── uuf100-019.cnf │ ├── uuf100-0190.cnf │ ├── uuf100-0191.cnf │ ├── uuf100-0192.cnf │ ├── uuf100-0193.cnf │ ├── uuf100-0194.cnf │ ├── uuf100-0195.cnf │ ├── uuf100-0196.cnf │ ├── uuf100-0197.cnf │ ├── uuf100-0198.cnf │ ├── uuf100-0199.cnf │ ├── uuf100-02.cnf │ ├── uuf100-020.cnf │ ├── uuf100-0200.cnf │ ├── uuf100-0201.cnf │ ├── uuf100-0202.cnf │ ├── uuf100-0203.cnf │ ├── uuf100-0204.cnf │ ├── uuf100-0205.cnf │ ├── uuf100-0206.cnf │ ├── uuf100-0207.cnf │ ├── uuf100-0208.cnf │ ├── uuf100-0209.cnf │ ├── uuf100-021.cnf │ ├── uuf100-0210.cnf │ ├── uuf100-0211.cnf │ ├── uuf100-0212.cnf │ ├── uuf100-0213.cnf │ ├── uuf100-0214.cnf │ ├── uuf100-0215.cnf │ ├── uuf100-0216.cnf │ ├── uuf100-0217.cnf │ ├── uuf100-0218.cnf │ ├── uuf100-0219.cnf │ ├── uuf100-022.cnf │ ├── uuf100-0220.cnf │ ├── uuf100-0221.cnf │ ├── uuf100-0222.cnf │ ├── uuf100-0223.cnf │ ├── uuf100-0224.cnf │ ├── uuf100-0225.cnf │ ├── uuf100-0226.cnf │ ├── uuf100-0227.cnf │ ├── uuf100-0228.cnf │ ├── uuf100-0229.cnf │ ├── uuf100-023.cnf │ ├── uuf100-0230.cnf │ ├── uuf100-0231.cnf │ ├── uuf100-0232.cnf │ ├── uuf100-0233.cnf │ ├── uuf100-0234.cnf │ ├── uuf100-0235.cnf │ ├── uuf100-0236.cnf │ ├── uuf100-0237.cnf │ ├── uuf100-0238.cnf │ ├── uuf100-0239.cnf │ ├── uuf100-024.cnf │ ├── uuf100-0240.cnf │ ├── uuf100-0241.cnf │ ├── uuf100-0242.cnf │ ├── uuf100-0243.cnf │ ├── uuf100-0244.cnf │ ├── uuf100-0245.cnf │ ├── uuf100-0246.cnf │ ├── uuf100-0247.cnf │ ├── uuf100-0248.cnf │ ├── uuf100-0249.cnf │ ├── uuf100-025.cnf │ ├── uuf100-0250.cnf │ ├── uuf100-0251.cnf │ ├── uuf100-0252.cnf │ ├── uuf100-0253.cnf │ ├── uuf100-0254.cnf │ ├── uuf100-0255.cnf │ ├── uuf100-0256.cnf │ ├── uuf100-0257.cnf │ ├── uuf100-0258.cnf │ ├── uuf100-0259.cnf │ ├── uuf100-026.cnf │ ├── uuf100-0260.cnf │ ├── uuf100-0261.cnf │ ├── uuf100-0262.cnf │ ├── uuf100-0263.cnf │ ├── uuf100-0264.cnf │ ├── uuf100-0265.cnf │ ├── uuf100-0266.cnf │ ├── uuf100-0267.cnf │ ├── uuf100-0268.cnf │ ├── uuf100-0269.cnf │ ├── uuf100-027.cnf │ ├── uuf100-0270.cnf │ ├── uuf100-0271.cnf │ ├── uuf100-0272.cnf │ ├── uuf100-0273.cnf │ ├── uuf100-0274.cnf │ ├── uuf100-0275.cnf │ ├── uuf100-0276.cnf │ ├── uuf100-0277.cnf │ ├── uuf100-0278.cnf │ ├── uuf100-0279.cnf │ ├── uuf100-028.cnf │ ├── uuf100-0280.cnf │ ├── uuf100-0281.cnf │ ├── uuf100-0282.cnf │ ├── uuf100-0283.cnf │ ├── uuf100-0284.cnf │ ├── uuf100-0285.cnf │ ├── uuf100-0286.cnf │ ├── uuf100-0287.cnf │ ├── uuf100-0288.cnf │ ├── uuf100-0289.cnf │ ├── uuf100-029.cnf │ ├── uuf100-0290.cnf │ ├── uuf100-0291.cnf │ ├── uuf100-0292.cnf │ ├── uuf100-0293.cnf │ ├── uuf100-0294.cnf │ ├── uuf100-0295.cnf │ ├── uuf100-0296.cnf │ ├── uuf100-0297.cnf │ ├── uuf100-0298.cnf │ ├── uuf100-0299.cnf │ ├── uuf100-03.cnf │ ├── uuf100-030.cnf │ ├── uuf100-0300.cnf │ ├── uuf100-0301.cnf │ ├── uuf100-0302.cnf │ ├── uuf100-0303.cnf │ ├── uuf100-0304.cnf │ ├── uuf100-0305.cnf │ ├── uuf100-0306.cnf │ ├── uuf100-0307.cnf │ ├── uuf100-0308.cnf │ ├── uuf100-0309.cnf │ ├── uuf100-031.cnf │ ├── uuf100-0310.cnf │ ├── uuf100-0311.cnf │ ├── uuf100-0312.cnf │ ├── uuf100-0313.cnf │ ├── uuf100-0314.cnf │ ├── uuf100-0315.cnf │ ├── uuf100-0316.cnf │ ├── uuf100-0317.cnf │ ├── uuf100-0318.cnf │ ├── uuf100-0319.cnf │ ├── uuf100-032.cnf │ ├── uuf100-0320.cnf │ ├── uuf100-0321.cnf │ ├── uuf100-0322.cnf │ ├── uuf100-0323.cnf │ ├── uuf100-0324.cnf │ ├── uuf100-0325.cnf │ ├── uuf100-0326.cnf │ ├── uuf100-0327.cnf │ ├── uuf100-0328.cnf │ ├── uuf100-0329.cnf │ ├── uuf100-033.cnf │ ├── uuf100-0330.cnf │ ├── uuf100-0331.cnf │ ├── uuf100-0332.cnf │ ├── uuf100-0333.cnf │ ├── uuf100-0334.cnf │ ├── uuf100-0335.cnf │ ├── uuf100-0336.cnf │ ├── uuf100-0337.cnf │ ├── uuf100-0338.cnf │ ├── uuf100-0339.cnf │ ├── uuf100-034.cnf │ ├── uuf100-0340.cnf │ ├── uuf100-0341.cnf │ ├── uuf100-0342.cnf │ ├── uuf100-0343.cnf │ ├── uuf100-0344.cnf │ ├── uuf100-0345.cnf │ ├── uuf100-0346.cnf │ ├── uuf100-0347.cnf │ ├── uuf100-0348.cnf │ ├── uuf100-0349.cnf │ ├── uuf100-035.cnf │ ├── uuf100-0350.cnf │ ├── uuf100-0351.cnf │ ├── uuf100-0352.cnf │ ├── uuf100-0353.cnf │ ├── uuf100-0354.cnf │ ├── uuf100-0355.cnf │ ├── uuf100-0356.cnf │ ├── uuf100-0357.cnf │ ├── uuf100-0358.cnf │ ├── uuf100-0359.cnf │ ├── uuf100-036.cnf │ ├── uuf100-0360.cnf │ ├── uuf100-0361.cnf │ ├── uuf100-0362.cnf │ ├── uuf100-0363.cnf │ ├── uuf100-0364.cnf │ ├── uuf100-0365.cnf │ ├── uuf100-0366.cnf │ ├── uuf100-0367.cnf │ ├── uuf100-0368.cnf │ ├── uuf100-0369.cnf │ ├── uuf100-037.cnf │ ├── uuf100-0370.cnf │ ├── uuf100-0371.cnf │ ├── uuf100-0372.cnf │ ├── uuf100-0373.cnf │ ├── uuf100-0374.cnf │ ├── uuf100-0375.cnf │ ├── uuf100-0376.cnf │ ├── uuf100-0377.cnf │ ├── uuf100-0378.cnf │ ├── uuf100-0379.cnf │ ├── uuf100-038.cnf │ ├── uuf100-0380.cnf │ ├── uuf100-0381.cnf │ ├── uuf100-0382.cnf │ ├── uuf100-0383.cnf │ ├── uuf100-0384.cnf │ ├── uuf100-0385.cnf │ ├── uuf100-0386.cnf │ ├── uuf100-0387.cnf │ ├── uuf100-0388.cnf │ ├── uuf100-0389.cnf │ ├── uuf100-039.cnf │ ├── uuf100-0390.cnf │ ├── uuf100-0391.cnf │ ├── uuf100-0392.cnf │ ├── uuf100-0393.cnf │ ├── uuf100-0394.cnf │ ├── uuf100-0395.cnf │ ├── uuf100-0396.cnf │ ├── uuf100-0397.cnf │ ├── uuf100-0398.cnf │ ├── uuf100-0399.cnf │ ├── uuf100-04.cnf │ ├── uuf100-040.cnf │ ├── uuf100-0400.cnf │ ├── uuf100-0401.cnf │ ├── uuf100-0402.cnf │ ├── uuf100-0403.cnf │ ├── uuf100-0404.cnf │ ├── uuf100-0405.cnf │ ├── uuf100-0406.cnf │ ├── uuf100-0407.cnf │ ├── uuf100-0408.cnf │ ├── uuf100-0409.cnf │ ├── uuf100-041.cnf │ ├── uuf100-0410.cnf │ ├── uuf100-0411.cnf │ ├── uuf100-0412.cnf │ ├── uuf100-0413.cnf │ ├── uuf100-0414.cnf │ ├── uuf100-0415.cnf │ ├── uuf100-0416.cnf │ ├── uuf100-0417.cnf │ ├── uuf100-0418.cnf │ ├── uuf100-0419.cnf │ ├── uuf100-042.cnf │ ├── uuf100-0420.cnf │ ├── uuf100-0421.cnf │ ├── uuf100-0422.cnf │ ├── uuf100-0423.cnf │ ├── uuf100-0424.cnf │ ├── uuf100-0425.cnf │ ├── uuf100-0426.cnf │ ├── uuf100-0427.cnf │ ├── uuf100-0428.cnf │ ├── uuf100-0429.cnf │ ├── uuf100-043.cnf │ ├── uuf100-0430.cnf │ ├── uuf100-0431.cnf │ ├── uuf100-0432.cnf │ ├── uuf100-0433.cnf │ ├── uuf100-0434.cnf │ ├── uuf100-0435.cnf │ ├── uuf100-0436.cnf │ ├── uuf100-0437.cnf │ ├── uuf100-0438.cnf │ ├── uuf100-0439.cnf │ ├── uuf100-044.cnf │ ├── uuf100-0440.cnf │ ├── uuf100-0441.cnf │ ├── uuf100-0442.cnf │ ├── uuf100-0443.cnf │ ├── uuf100-0444.cnf │ ├── uuf100-0445.cnf │ ├── uuf100-0446.cnf │ ├── uuf100-0447.cnf │ ├── uuf100-0448.cnf │ ├── uuf100-0449.cnf │ ├── uuf100-045.cnf │ ├── uuf100-0450.cnf │ ├── uuf100-0451.cnf │ ├── uuf100-0452.cnf │ ├── uuf100-0453.cnf │ ├── uuf100-0454.cnf │ ├── uuf100-0455.cnf │ ├── uuf100-0456.cnf │ ├── uuf100-0457.cnf │ ├── uuf100-0458.cnf │ ├── uuf100-0459.cnf │ ├── uuf100-046.cnf │ ├── uuf100-0460.cnf │ ├── uuf100-0461.cnf │ ├── uuf100-0462.cnf │ ├── uuf100-0463.cnf │ ├── uuf100-0464.cnf │ ├── uuf100-0465.cnf │ ├── uuf100-0466.cnf │ ├── uuf100-0467.cnf │ ├── uuf100-0468.cnf │ ├── uuf100-0469.cnf │ ├── uuf100-047.cnf │ ├── uuf100-0470.cnf │ ├── uuf100-0471.cnf │ ├── uuf100-0472.cnf │ ├── uuf100-0473.cnf │ ├── uuf100-0474.cnf │ ├── uuf100-0475.cnf │ ├── uuf100-0476.cnf │ ├── uuf100-0477.cnf │ ├── uuf100-0478.cnf │ ├── uuf100-0479.cnf │ ├── uuf100-048.cnf │ ├── uuf100-0480.cnf │ ├── uuf100-0481.cnf │ ├── uuf100-0482.cnf │ ├── uuf100-0483.cnf │ ├── uuf100-0484.cnf │ ├── uuf100-0485.cnf │ ├── uuf100-0486.cnf │ ├── uuf100-0487.cnf │ ├── uuf100-0488.cnf │ ├── uuf100-0489.cnf │ ├── uuf100-049.cnf │ ├── uuf100-0490.cnf │ ├── uuf100-0491.cnf │ ├── uuf100-0492.cnf │ ├── uuf100-0493.cnf │ ├── uuf100-0494.cnf │ ├── uuf100-0495.cnf │ ├── uuf100-0496.cnf │ ├── uuf100-0497.cnf │ ├── uuf100-0498.cnf │ ├── uuf100-0499.cnf │ ├── uuf100-05.cnf │ ├── uuf100-050.cnf │ ├── uuf100-0500.cnf │ ├── uuf100-0501.cnf │ ├── uuf100-0502.cnf │ ├── uuf100-0503.cnf │ ├── uuf100-0504.cnf │ ├── uuf100-0505.cnf │ ├── uuf100-0506.cnf │ ├── uuf100-0507.cnf │ ├── uuf100-0508.cnf │ ├── uuf100-0509.cnf │ ├── uuf100-051.cnf │ ├── uuf100-0510.cnf │ ├── uuf100-0511.cnf │ ├── uuf100-0512.cnf │ ├── uuf100-0513.cnf │ ├── uuf100-0514.cnf │ ├── uuf100-0515.cnf │ ├── uuf100-0516.cnf │ ├── uuf100-0517.cnf │ ├── uuf100-0518.cnf │ ├── uuf100-0519.cnf │ ├── uuf100-052.cnf │ ├── uuf100-0520.cnf │ ├── uuf100-0521.cnf │ ├── uuf100-0522.cnf │ ├── uuf100-0523.cnf │ ├── uuf100-0524.cnf │ ├── uuf100-0525.cnf │ ├── uuf100-0526.cnf │ ├── uuf100-0527.cnf │ ├── uuf100-0528.cnf │ ├── uuf100-0529.cnf │ ├── uuf100-053.cnf │ ├── uuf100-0530.cnf │ ├── uuf100-0531.cnf │ ├── uuf100-0532.cnf │ ├── uuf100-0533.cnf │ ├── uuf100-0534.cnf │ ├── uuf100-0535.cnf │ ├── uuf100-0536.cnf │ ├── uuf100-0537.cnf │ ├── uuf100-0538.cnf │ ├── uuf100-0539.cnf │ ├── uuf100-054.cnf │ ├── uuf100-0540.cnf │ ├── uuf100-0541.cnf │ ├── uuf100-0542.cnf │ ├── uuf100-0543.cnf │ ├── uuf100-0544.cnf │ ├── uuf100-0545.cnf │ ├── uuf100-0546.cnf │ ├── uuf100-0547.cnf │ ├── uuf100-0548.cnf │ ├── uuf100-0549.cnf │ ├── uuf100-055.cnf │ ├── uuf100-0550.cnf │ ├── uuf100-0551.cnf │ ├── uuf100-0552.cnf │ ├── uuf100-0553.cnf │ ├── uuf100-0554.cnf │ ├── uuf100-0555.cnf │ ├── uuf100-0556.cnf │ ├── uuf100-0557.cnf │ ├── uuf100-0558.cnf │ ├── uuf100-0559.cnf │ ├── uuf100-056.cnf │ ├── uuf100-0560.cnf │ ├── uuf100-0561.cnf │ ├── uuf100-0562.cnf │ ├── uuf100-0563.cnf │ ├── uuf100-0564.cnf │ ├── uuf100-0565.cnf │ ├── uuf100-0566.cnf │ ├── uuf100-0567.cnf │ ├── uuf100-0568.cnf │ ├── uuf100-0569.cnf │ ├── uuf100-057.cnf │ ├── uuf100-0570.cnf │ ├── uuf100-0571.cnf │ ├── uuf100-0572.cnf │ ├── uuf100-0573.cnf │ ├── uuf100-0574.cnf │ ├── uuf100-0575.cnf │ ├── uuf100-0576.cnf │ ├── uuf100-0577.cnf │ ├── uuf100-0578.cnf │ ├── uuf100-0579.cnf │ ├── uuf100-058.cnf │ ├── uuf100-0580.cnf │ ├── uuf100-0581.cnf │ ├── uuf100-0582.cnf │ ├── uuf100-0583.cnf │ ├── uuf100-0584.cnf │ ├── uuf100-0585.cnf │ ├── uuf100-0586.cnf │ ├── uuf100-0587.cnf │ ├── uuf100-0588.cnf │ ├── uuf100-0589.cnf │ ├── uuf100-059.cnf │ ├── uuf100-0590.cnf │ ├── uuf100-0591.cnf │ ├── uuf100-0592.cnf │ ├── uuf100-0593.cnf │ ├── uuf100-0594.cnf │ ├── uuf100-0595.cnf │ ├── uuf100-0596.cnf │ ├── uuf100-0597.cnf │ ├── uuf100-0598.cnf │ ├── uuf100-0599.cnf │ ├── uuf100-06.cnf │ ├── uuf100-060.cnf │ ├── uuf100-0600.cnf │ ├── uuf100-0601.cnf │ ├── uuf100-0602.cnf │ ├── uuf100-0603.cnf │ ├── uuf100-0604.cnf │ ├── uuf100-0605.cnf │ ├── uuf100-0606.cnf │ ├── uuf100-0607.cnf │ ├── uuf100-0608.cnf │ ├── uuf100-0609.cnf │ ├── uuf100-061.cnf │ ├── uuf100-0610.cnf │ ├── uuf100-0611.cnf │ ├── uuf100-0612.cnf │ ├── uuf100-0613.cnf │ ├── uuf100-0614.cnf │ ├── uuf100-0615.cnf │ ├── uuf100-0616.cnf │ ├── uuf100-0617.cnf │ ├── uuf100-0618.cnf │ ├── uuf100-0619.cnf │ ├── uuf100-062.cnf │ ├── uuf100-0620.cnf │ ├── uuf100-0621.cnf │ ├── uuf100-0622.cnf │ ├── uuf100-0623.cnf │ ├── uuf100-0624.cnf │ ├── uuf100-0625.cnf │ ├── uuf100-0626.cnf │ ├── uuf100-0627.cnf │ ├── uuf100-0628.cnf │ ├── uuf100-0629.cnf │ ├── uuf100-063.cnf │ ├── uuf100-0630.cnf │ ├── uuf100-0631.cnf │ ├── uuf100-0632.cnf │ ├── uuf100-0633.cnf │ ├── uuf100-0634.cnf │ ├── uuf100-0635.cnf │ ├── uuf100-0636.cnf │ ├── uuf100-0637.cnf │ ├── uuf100-0638.cnf │ ├── uuf100-0639.cnf │ ├── uuf100-064.cnf │ ├── uuf100-0640.cnf │ ├── uuf100-0641.cnf │ ├── uuf100-0642.cnf │ ├── uuf100-0643.cnf │ ├── uuf100-0644.cnf │ ├── uuf100-0645.cnf │ ├── uuf100-0646.cnf │ ├── uuf100-0647.cnf │ ├── uuf100-0648.cnf │ ├── uuf100-0649.cnf │ ├── uuf100-065.cnf │ ├── uuf100-0650.cnf │ ├── uuf100-0651.cnf │ ├── uuf100-0652.cnf │ ├── uuf100-0653.cnf │ ├── uuf100-0654.cnf │ ├── uuf100-0655.cnf │ ├── uuf100-0656.cnf │ ├── uuf100-0657.cnf │ ├── uuf100-0658.cnf │ ├── uuf100-0659.cnf │ ├── uuf100-066.cnf │ ├── uuf100-0660.cnf │ ├── uuf100-0661.cnf │ ├── uuf100-0662.cnf │ ├── uuf100-0663.cnf │ ├── uuf100-0664.cnf │ ├── uuf100-0665.cnf │ ├── uuf100-0666.cnf │ ├── uuf100-0667.cnf │ ├── uuf100-0668.cnf │ ├── uuf100-0669.cnf │ ├── uuf100-067.cnf │ ├── uuf100-0670.cnf │ ├── uuf100-0671.cnf │ ├── uuf100-0672.cnf │ ├── uuf100-0673.cnf │ ├── uuf100-0674.cnf │ ├── uuf100-0675.cnf │ ├── uuf100-0676.cnf │ ├── uuf100-0677.cnf │ ├── uuf100-0678.cnf │ ├── uuf100-0679.cnf │ ├── uuf100-068.cnf │ ├── uuf100-0680.cnf │ ├── uuf100-0681.cnf │ ├── uuf100-0682.cnf │ ├── uuf100-0683.cnf │ ├── uuf100-0684.cnf │ ├── uuf100-0685.cnf │ ├── uuf100-0686.cnf │ ├── uuf100-0687.cnf │ ├── uuf100-0688.cnf │ ├── uuf100-0689.cnf │ ├── uuf100-069.cnf │ ├── uuf100-0690.cnf │ ├── uuf100-0691.cnf │ ├── uuf100-0692.cnf │ ├── uuf100-0693.cnf │ ├── uuf100-0694.cnf │ ├── uuf100-0695.cnf │ ├── uuf100-0696.cnf │ ├── uuf100-0697.cnf │ ├── uuf100-0698.cnf │ ├── uuf100-0699.cnf │ ├── uuf100-07.cnf │ ├── uuf100-070.cnf │ ├── uuf100-0700.cnf │ ├── uuf100-0701.cnf │ ├── uuf100-0702.cnf │ ├── uuf100-0703.cnf │ ├── uuf100-0704.cnf │ ├── uuf100-0705.cnf │ ├── uuf100-0706.cnf │ ├── uuf100-0707.cnf │ ├── uuf100-0708.cnf │ ├── uuf100-0709.cnf │ ├── uuf100-071.cnf │ ├── uuf100-0710.cnf │ ├── uuf100-0711.cnf │ ├── uuf100-0712.cnf │ ├── uuf100-0713.cnf │ ├── uuf100-0714.cnf │ ├── uuf100-0715.cnf │ ├── uuf100-0716.cnf │ ├── uuf100-0717.cnf │ ├── uuf100-0718.cnf │ ├── uuf100-0719.cnf │ ├── uuf100-072.cnf │ ├── uuf100-0720.cnf │ ├── uuf100-0721.cnf │ ├── uuf100-0722.cnf │ ├── uuf100-0723.cnf │ ├── uuf100-0724.cnf │ ├── uuf100-0725.cnf │ ├── uuf100-0726.cnf │ ├── uuf100-0727.cnf │ ├── uuf100-0728.cnf │ ├── uuf100-0729.cnf │ ├── uuf100-073.cnf │ ├── uuf100-0730.cnf │ ├── uuf100-0731.cnf │ ├── uuf100-0732.cnf │ ├── uuf100-0733.cnf │ ├── uuf100-0734.cnf │ ├── uuf100-0735.cnf │ ├── uuf100-0736.cnf │ ├── uuf100-0737.cnf │ ├── uuf100-0738.cnf │ ├── uuf100-0739.cnf │ ├── uuf100-074.cnf │ ├── uuf100-0740.cnf │ ├── uuf100-0741.cnf │ ├── uuf100-0742.cnf │ ├── uuf100-0743.cnf │ ├── uuf100-0744.cnf │ ├── uuf100-0745.cnf │ ├── uuf100-0746.cnf │ ├── uuf100-0747.cnf │ ├── uuf100-0748.cnf │ ├── uuf100-0749.cnf │ ├── uuf100-075.cnf │ ├── uuf100-0750.cnf │ ├── uuf100-0751.cnf │ ├── uuf100-0752.cnf │ ├── uuf100-0753.cnf │ ├── uuf100-0754.cnf │ ├── uuf100-0755.cnf │ ├── uuf100-0756.cnf │ ├── uuf100-0757.cnf │ ├── uuf100-0758.cnf │ ├── uuf100-0759.cnf │ ├── uuf100-076.cnf │ ├── uuf100-0760.cnf │ ├── uuf100-0761.cnf │ ├── uuf100-0762.cnf │ ├── uuf100-0763.cnf │ ├── uuf100-0764.cnf │ ├── uuf100-0765.cnf │ ├── uuf100-0766.cnf │ ├── uuf100-0767.cnf │ ├── uuf100-0768.cnf │ ├── uuf100-0769.cnf │ ├── uuf100-077.cnf │ ├── uuf100-0770.cnf │ ├── uuf100-0771.cnf │ ├── uuf100-0772.cnf │ ├── uuf100-0773.cnf │ ├── uuf100-0774.cnf │ ├── uuf100-0775.cnf │ ├── uuf100-0776.cnf │ ├── uuf100-0777.cnf │ ├── uuf100-0778.cnf │ ├── uuf100-0779.cnf │ ├── uuf100-078.cnf │ ├── uuf100-0780.cnf │ ├── uuf100-0781.cnf │ ├── uuf100-0782.cnf │ ├── uuf100-0783.cnf │ ├── uuf100-0784.cnf │ ├── uuf100-0785.cnf │ ├── uuf100-0786.cnf │ ├── uuf100-0787.cnf │ ├── uuf100-0788.cnf │ ├── uuf100-0789.cnf │ ├── uuf100-079.cnf │ ├── uuf100-0790.cnf │ ├── uuf100-0791.cnf │ ├── uuf100-0792.cnf │ ├── uuf100-0793.cnf │ ├── uuf100-0794.cnf │ ├── uuf100-0795.cnf │ ├── uuf100-0796.cnf │ ├── uuf100-0797.cnf │ ├── uuf100-0798.cnf │ ├── uuf100-0799.cnf │ ├── uuf100-08.cnf │ ├── uuf100-080.cnf │ ├── uuf100-0800.cnf │ ├── uuf100-0801.cnf │ ├── uuf100-0802.cnf │ ├── uuf100-0803.cnf │ ├── uuf100-0804.cnf │ ├── uuf100-0805.cnf │ ├── uuf100-0806.cnf │ ├── uuf100-0807.cnf │ ├── uuf100-0808.cnf │ ├── uuf100-0809.cnf │ ├── uuf100-081.cnf │ ├── uuf100-0810.cnf │ ├── uuf100-0811.cnf │ ├── uuf100-0812.cnf │ ├── uuf100-0813.cnf │ ├── uuf100-0814.cnf │ ├── uuf100-0815.cnf │ ├── uuf100-0816.cnf │ ├── uuf100-0817.cnf │ ├── uuf100-0818.cnf │ ├── uuf100-0819.cnf │ ├── uuf100-082.cnf │ ├── uuf100-0820.cnf │ ├── uuf100-0821.cnf │ ├── uuf100-0822.cnf │ ├── uuf100-0823.cnf │ ├── uuf100-0824.cnf │ ├── uuf100-0825.cnf │ ├── uuf100-0826.cnf │ ├── uuf100-0827.cnf │ ├── uuf100-0828.cnf │ ├── uuf100-0829.cnf │ ├── uuf100-083.cnf │ ├── uuf100-0830.cnf │ ├── uuf100-0831.cnf │ ├── uuf100-0832.cnf │ ├── uuf100-0833.cnf │ ├── uuf100-0834.cnf │ ├── uuf100-0835.cnf │ ├── uuf100-0836.cnf │ ├── uuf100-0837.cnf │ ├── uuf100-0838.cnf │ ├── uuf100-0839.cnf │ ├── uuf100-084.cnf │ ├── uuf100-0840.cnf │ ├── uuf100-0841.cnf │ ├── uuf100-0842.cnf │ ├── uuf100-0843.cnf │ ├── uuf100-0844.cnf │ ├── uuf100-0845.cnf │ ├── uuf100-0846.cnf │ ├── uuf100-0847.cnf │ ├── uuf100-0848.cnf │ ├── uuf100-0849.cnf │ ├── uuf100-085.cnf │ ├── uuf100-0850.cnf │ ├── uuf100-0851.cnf │ ├── uuf100-0852.cnf │ ├── uuf100-0853.cnf │ ├── uuf100-0854.cnf │ ├── uuf100-0855.cnf │ ├── uuf100-0856.cnf │ ├── uuf100-0857.cnf │ ├── uuf100-0858.cnf │ ├── uuf100-0859.cnf │ ├── uuf100-086.cnf │ ├── uuf100-0860.cnf │ ├── uuf100-0861.cnf │ ├── uuf100-0862.cnf │ ├── uuf100-0863.cnf │ ├── uuf100-0864.cnf │ ├── uuf100-0865.cnf │ ├── uuf100-0866.cnf │ ├── uuf100-0867.cnf │ ├── uuf100-0868.cnf │ ├── uuf100-0869.cnf │ ├── uuf100-087.cnf │ ├── uuf100-0870.cnf │ ├── uuf100-0871.cnf │ ├── uuf100-0872.cnf │ ├── uuf100-0873.cnf │ ├── uuf100-0874.cnf │ ├── uuf100-0875.cnf │ ├── uuf100-0876.cnf │ ├── uuf100-0877.cnf │ ├── uuf100-0878.cnf │ ├── uuf100-0879.cnf │ ├── uuf100-088.cnf │ ├── uuf100-0880.cnf │ ├── uuf100-0881.cnf │ ├── uuf100-0882.cnf │ ├── uuf100-0883.cnf │ ├── uuf100-0884.cnf │ ├── uuf100-0885.cnf │ ├── uuf100-0886.cnf │ ├── uuf100-0887.cnf │ ├── uuf100-0888.cnf │ ├── uuf100-0889.cnf │ ├── uuf100-089.cnf │ ├── uuf100-0890.cnf │ ├── uuf100-0891.cnf │ ├── uuf100-0892.cnf │ ├── uuf100-0893.cnf │ ├── uuf100-0894.cnf │ ├── uuf100-0895.cnf │ ├── uuf100-0896.cnf │ ├── uuf100-0897.cnf │ ├── uuf100-0898.cnf │ ├── uuf100-0899.cnf │ ├── uuf100-09.cnf │ ├── uuf100-090.cnf │ ├── uuf100-0900.cnf │ ├── uuf100-0901.cnf │ ├── uuf100-0902.cnf │ ├── uuf100-0903.cnf │ ├── uuf100-0904.cnf │ ├── uuf100-0905.cnf │ ├── uuf100-0906.cnf │ ├── uuf100-0907.cnf │ ├── uuf100-0908.cnf │ ├── uuf100-0909.cnf │ ├── uuf100-091.cnf │ ├── uuf100-0910.cnf │ ├── uuf100-0911.cnf │ ├── uuf100-0912.cnf │ ├── uuf100-0913.cnf │ ├── uuf100-0914.cnf │ ├── uuf100-0915.cnf │ ├── uuf100-0916.cnf │ ├── uuf100-0917.cnf │ ├── uuf100-0918.cnf │ ├── uuf100-0919.cnf │ ├── uuf100-092.cnf │ ├── uuf100-0920.cnf │ ├── uuf100-0921.cnf │ ├── uuf100-0922.cnf │ ├── uuf100-0923.cnf │ ├── uuf100-0924.cnf │ ├── uuf100-0925.cnf │ ├── uuf100-0926.cnf │ ├── uuf100-0927.cnf │ ├── uuf100-0928.cnf │ ├── uuf100-0929.cnf │ ├── uuf100-093.cnf │ ├── uuf100-0930.cnf │ ├── uuf100-0931.cnf │ ├── uuf100-0932.cnf │ ├── uuf100-0933.cnf │ ├── uuf100-0934.cnf │ ├── uuf100-0935.cnf │ ├── uuf100-0936.cnf │ ├── uuf100-0937.cnf │ ├── uuf100-0938.cnf │ ├── uuf100-0939.cnf │ ├── uuf100-094.cnf │ ├── uuf100-0940.cnf │ ├── uuf100-0941.cnf │ ├── uuf100-0942.cnf │ ├── uuf100-0943.cnf │ ├── uuf100-0944.cnf │ ├── uuf100-0945.cnf │ ├── uuf100-0946.cnf │ ├── uuf100-0947.cnf │ ├── uuf100-0948.cnf │ ├── uuf100-0949.cnf │ ├── uuf100-095.cnf │ ├── uuf100-0950.cnf │ ├── uuf100-0951.cnf │ ├── uuf100-0952.cnf │ ├── uuf100-0953.cnf │ ├── uuf100-0954.cnf │ ├── uuf100-0955.cnf │ ├── uuf100-0956.cnf │ ├── uuf100-0957.cnf │ ├── uuf100-0958.cnf │ ├── uuf100-0959.cnf │ ├── uuf100-096.cnf │ ├── uuf100-0960.cnf │ ├── uuf100-0961.cnf │ ├── uuf100-0962.cnf │ ├── uuf100-0963.cnf │ ├── uuf100-0964.cnf │ ├── uuf100-0965.cnf │ ├── uuf100-0966.cnf │ ├── uuf100-0967.cnf │ ├── uuf100-0968.cnf │ ├── uuf100-0969.cnf │ ├── uuf100-097.cnf │ ├── uuf100-0970.cnf │ ├── uuf100-0971.cnf │ ├── uuf100-0972.cnf │ ├── uuf100-0973.cnf │ ├── uuf100-0974.cnf │ ├── uuf100-0975.cnf │ ├── uuf100-0976.cnf │ ├── uuf100-0977.cnf │ ├── uuf100-0978.cnf │ ├── uuf100-0979.cnf │ ├── uuf100-098.cnf │ ├── uuf100-0980.cnf │ ├── uuf100-0981.cnf │ ├── uuf100-0982.cnf │ ├── uuf100-0983.cnf │ ├── uuf100-0984.cnf │ ├── uuf100-0985.cnf │ ├── uuf100-0986.cnf │ ├── uuf100-0987.cnf │ ├── uuf100-0988.cnf │ ├── uuf100-0989.cnf │ ├── uuf100-099.cnf │ ├── uuf100-0990.cnf │ ├── uuf100-0991.cnf │ ├── uuf100-0992.cnf │ ├── uuf100-0993.cnf │ ├── uuf100-0994.cnf │ ├── uuf100-0995.cnf │ ├── uuf100-0996.cnf │ ├── uuf100-0997.cnf │ ├── uuf100-0998.cnf │ └── uuf100-0999.cnf ├── uuf125 │ ├── mean │ ├── uuf125-01.cnf │ ├── uuf125-010.cnf │ ├── uuf125-0100.cnf │ ├── uuf125-011.cnf │ ├── uuf125-012.cnf │ ├── uuf125-013.cnf │ ├── uuf125-014.cnf │ ├── uuf125-015.cnf │ ├── uuf125-016.cnf │ ├── uuf125-017.cnf │ ├── uuf125-018.cnf │ ├── uuf125-019.cnf │ ├── uuf125-02.cnf │ ├── uuf125-020.cnf │ ├── uuf125-021.cnf │ ├── uuf125-022.cnf │ ├── uuf125-023.cnf │ ├── uuf125-024.cnf │ ├── uuf125-025.cnf │ ├── uuf125-026.cnf │ ├── uuf125-027.cnf │ ├── uuf125-028.cnf │ ├── uuf125-029.cnf │ ├── uuf125-03.cnf │ ├── uuf125-030.cnf │ ├── uuf125-031.cnf │ ├── uuf125-032.cnf │ ├── uuf125-033.cnf │ ├── uuf125-034.cnf │ ├── uuf125-035.cnf │ ├── uuf125-036.cnf │ ├── uuf125-037.cnf │ ├── uuf125-038.cnf │ ├── uuf125-039.cnf │ ├── uuf125-04.cnf │ ├── uuf125-040.cnf │ ├── uuf125-041.cnf │ ├── uuf125-042.cnf │ ├── uuf125-043.cnf │ ├── uuf125-044.cnf │ ├── uuf125-045.cnf │ ├── uuf125-046.cnf │ ├── uuf125-047.cnf │ ├── uuf125-048.cnf │ ├── uuf125-049.cnf │ ├── uuf125-05.cnf │ ├── uuf125-050.cnf │ ├── uuf125-051.cnf │ ├── uuf125-052.cnf │ ├── uuf125-053.cnf │ ├── uuf125-054.cnf │ ├── uuf125-055.cnf │ ├── uuf125-056.cnf │ ├── uuf125-057.cnf │ ├── uuf125-058.cnf │ ├── uuf125-059.cnf │ ├── uuf125-06.cnf │ ├── uuf125-060.cnf │ ├── uuf125-061.cnf │ ├── uuf125-062.cnf │ ├── uuf125-063.cnf │ ├── uuf125-064.cnf │ ├── uuf125-065.cnf │ ├── uuf125-066.cnf │ ├── uuf125-067.cnf │ ├── uuf125-068.cnf │ ├── uuf125-069.cnf │ ├── uuf125-07.cnf │ ├── uuf125-070.cnf │ ├── uuf125-071.cnf │ ├── uuf125-072.cnf │ ├── uuf125-073.cnf │ ├── uuf125-074.cnf │ ├── uuf125-075.cnf │ ├── uuf125-076.cnf │ ├── uuf125-077.cnf │ ├── uuf125-078.cnf │ ├── uuf125-079.cnf │ ├── uuf125-08.cnf │ ├── uuf125-080.cnf │ ├── uuf125-081.cnf │ ├── uuf125-082.cnf │ ├── uuf125-083.cnf │ ├── uuf125-084.cnf │ ├── uuf125-085.cnf │ ├── uuf125-086.cnf │ ├── uuf125-087.cnf │ ├── uuf125-088.cnf │ ├── uuf125-089.cnf │ ├── uuf125-09.cnf │ ├── uuf125-090.cnf │ ├── uuf125-091.cnf │ ├── uuf125-092.cnf │ ├── uuf125-093.cnf │ ├── uuf125-094.cnf │ ├── uuf125-095.cnf │ ├── uuf125-096.cnf │ ├── uuf125-097.cnf │ ├── uuf125-098.cnf │ └── uuf125-099.cnf ├── uuf150 │ ├── mean │ ├── uuf150-01.cnf │ ├── uuf150-010.cnf │ ├── uuf150-0100.cnf │ ├── uuf150-011.cnf │ ├── uuf150-012.cnf │ ├── uuf150-013.cnf │ ├── uuf150-014.cnf │ ├── uuf150-015.cnf │ ├── uuf150-016.cnf │ ├── uuf150-017.cnf │ ├── uuf150-018.cnf │ ├── uuf150-019.cnf │ ├── uuf150-02.cnf │ ├── uuf150-020.cnf │ ├── uuf150-021.cnf │ ├── uuf150-022.cnf │ ├── uuf150-023.cnf │ ├── uuf150-024.cnf │ ├── uuf150-025.cnf │ ├── uuf150-026.cnf │ ├── uuf150-027.cnf │ ├── uuf150-028.cnf │ ├── uuf150-029.cnf │ ├── uuf150-03.cnf │ ├── uuf150-030.cnf │ ├── uuf150-031.cnf │ ├── uuf150-032.cnf │ ├── uuf150-033.cnf │ ├── uuf150-034.cnf │ ├── uuf150-035.cnf │ ├── uuf150-036.cnf │ ├── uuf150-037.cnf │ ├── uuf150-038.cnf │ ├── uuf150-039.cnf │ ├── uuf150-04.cnf │ ├── uuf150-040.cnf │ ├── uuf150-041.cnf │ ├── uuf150-042.cnf │ ├── uuf150-043.cnf │ ├── uuf150-044.cnf │ ├── uuf150-045.cnf │ ├── uuf150-046.cnf │ ├── uuf150-047.cnf │ ├── uuf150-048.cnf │ ├── uuf150-049.cnf │ ├── uuf150-05.cnf │ ├── uuf150-050.cnf │ ├── uuf150-051.cnf │ ├── uuf150-052.cnf │ ├── uuf150-053.cnf │ ├── uuf150-054.cnf │ ├── uuf150-055.cnf │ ├── uuf150-056.cnf │ ├── uuf150-057.cnf │ ├── uuf150-058.cnf │ ├── uuf150-059.cnf │ ├── uuf150-06.cnf │ ├── uuf150-060.cnf │ ├── uuf150-061.cnf │ ├── uuf150-062.cnf │ ├── uuf150-063.cnf │ ├── uuf150-064.cnf │ ├── uuf150-065.cnf │ ├── uuf150-066.cnf │ ├── uuf150-067.cnf │ ├── uuf150-068.cnf │ ├── uuf150-069.cnf │ ├── uuf150-07.cnf │ ├── uuf150-070.cnf │ ├── uuf150-071.cnf │ ├── uuf150-072.cnf │ ├── uuf150-073.cnf │ ├── uuf150-074.cnf │ ├── uuf150-075.cnf │ ├── uuf150-076.cnf │ ├── uuf150-077.cnf │ ├── uuf150-078.cnf │ ├── uuf150-079.cnf │ ├── uuf150-08.cnf │ ├── uuf150-080.cnf │ ├── uuf150-081.cnf │ ├── uuf150-082.cnf │ ├── uuf150-083.cnf │ ├── uuf150-084.cnf │ ├── uuf150-085.cnf │ ├── uuf150-086.cnf │ ├── uuf150-087.cnf │ ├── uuf150-088.cnf │ ├── uuf150-089.cnf │ ├── uuf150-09.cnf │ ├── uuf150-090.cnf │ ├── uuf150-091.cnf │ ├── uuf150-092.cnf │ ├── uuf150-093.cnf │ ├── uuf150-094.cnf │ ├── uuf150-095.cnf │ ├── uuf150-096.cnf │ ├── uuf150-097.cnf │ ├── uuf150-098.cnf │ └── uuf150-099.cnf ├── uuf175 │ ├── mean │ ├── uuf175-01.cnf │ ├── uuf175-010.cnf │ ├── uuf175-0100.cnf │ ├── uuf175-011.cnf │ ├── uuf175-012.cnf │ ├── uuf175-013.cnf │ ├── uuf175-014.cnf │ ├── uuf175-015.cnf │ ├── uuf175-016.cnf │ ├── uuf175-017.cnf │ ├── uuf175-018.cnf │ ├── uuf175-019.cnf │ ├── uuf175-02.cnf │ ├── uuf175-020.cnf │ ├── uuf175-021.cnf │ ├── uuf175-022.cnf │ ├── uuf175-023.cnf │ ├── uuf175-024.cnf │ ├── uuf175-025.cnf │ ├── uuf175-026.cnf │ ├── uuf175-027.cnf │ ├── uuf175-028.cnf │ ├── uuf175-029.cnf │ ├── uuf175-03.cnf │ ├── uuf175-030.cnf │ ├── uuf175-031.cnf │ ├── uuf175-032.cnf │ ├── uuf175-033.cnf │ ├── uuf175-034.cnf │ ├── uuf175-035.cnf │ ├── uuf175-036.cnf │ ├── uuf175-037.cnf │ ├── uuf175-038.cnf │ ├── uuf175-039.cnf │ ├── uuf175-04.cnf │ ├── uuf175-040.cnf │ ├── uuf175-041.cnf │ ├── uuf175-042.cnf │ ├── uuf175-043.cnf │ ├── uuf175-044.cnf │ ├── uuf175-045.cnf │ ├── uuf175-046.cnf │ ├── uuf175-047.cnf │ ├── uuf175-048.cnf │ ├── uuf175-049.cnf │ ├── uuf175-05.cnf │ ├── uuf175-050.cnf │ ├── uuf175-051.cnf │ ├── uuf175-052.cnf │ ├── uuf175-053.cnf │ ├── uuf175-054.cnf │ ├── uuf175-055.cnf │ ├── uuf175-056.cnf │ ├── uuf175-057.cnf │ ├── uuf175-058.cnf │ ├── uuf175-059.cnf │ ├── uuf175-06.cnf │ ├── uuf175-060.cnf │ ├── uuf175-061.cnf │ ├── uuf175-062.cnf │ ├── uuf175-063.cnf │ ├── uuf175-064.cnf │ ├── uuf175-065.cnf │ ├── uuf175-066.cnf │ ├── uuf175-067.cnf │ ├── uuf175-068.cnf │ ├── uuf175-069.cnf │ ├── uuf175-07.cnf │ ├── uuf175-070.cnf │ ├── uuf175-071.cnf │ ├── uuf175-072.cnf │ ├── uuf175-073.cnf │ ├── uuf175-074.cnf │ ├── uuf175-075.cnf │ ├── uuf175-076.cnf │ ├── uuf175-077.cnf │ ├── uuf175-078.cnf │ ├── uuf175-079.cnf │ ├── uuf175-08.cnf │ ├── uuf175-080.cnf │ ├── uuf175-081.cnf │ ├── uuf175-082.cnf │ ├── uuf175-083.cnf │ ├── uuf175-084.cnf │ ├── uuf175-085.cnf │ ├── uuf175-086.cnf │ ├── uuf175-087.cnf │ ├── uuf175-088.cnf │ ├── uuf175-089.cnf │ ├── uuf175-09.cnf │ ├── uuf175-090.cnf │ ├── uuf175-091.cnf │ ├── uuf175-092.cnf │ ├── uuf175-093.cnf │ ├── uuf175-094.cnf │ ├── uuf175-095.cnf │ ├── uuf175-096.cnf │ ├── uuf175-097.cnf │ ├── uuf175-098.cnf │ └── uuf175-099.cnf └── uuf250 │ ├── README │ ├── uuf250-01.cnf │ ├── uuf250-010.cnf │ ├── uuf250-0100.cnf │ ├── uuf250-011.cnf │ ├── uuf250-012.cnf │ ├── uuf250-013.cnf │ ├── uuf250-014.cnf │ ├── uuf250-015.cnf │ ├── uuf250-016.cnf │ ├── uuf250-017.cnf │ ├── uuf250-018.cnf │ ├── uuf250-019.cnf │ ├── uuf250-02.cnf │ ├── uuf250-020.cnf │ ├── uuf250-021.cnf │ ├── uuf250-022.cnf │ ├── uuf250-023.cnf │ ├── uuf250-024.cnf │ ├── uuf250-025.cnf │ ├── uuf250-026.cnf │ ├── uuf250-027.cnf │ ├── uuf250-028.cnf │ ├── uuf250-029.cnf │ ├── uuf250-03.cnf │ ├── uuf250-030.cnf │ ├── uuf250-031.cnf │ ├── uuf250-032.cnf │ ├── uuf250-033.cnf │ ├── uuf250-034.cnf │ ├── uuf250-035.cnf │ ├── uuf250-036.cnf │ ├── uuf250-037.cnf │ ├── uuf250-038.cnf │ ├── uuf250-039.cnf │ ├── uuf250-04.cnf │ ├── uuf250-040.cnf │ ├── uuf250-041.cnf │ ├── uuf250-042.cnf │ ├── uuf250-043.cnf │ ├── uuf250-044.cnf │ ├── uuf250-045.cnf │ ├── uuf250-046.cnf │ ├── uuf250-047.cnf │ ├── uuf250-048.cnf │ ├── uuf250-049.cnf │ ├── uuf250-05.cnf │ ├── uuf250-050.cnf │ ├── uuf250-051.cnf │ ├── uuf250-052.cnf │ ├── uuf250-053.cnf │ ├── uuf250-054.cnf │ ├── uuf250-055.cnf │ ├── uuf250-056.cnf │ ├── uuf250-057.cnf │ ├── uuf250-058.cnf │ ├── uuf250-059.cnf │ ├── uuf250-06.cnf │ ├── uuf250-060.cnf │ ├── uuf250-061.cnf │ ├── uuf250-062.cnf │ ├── uuf250-063.cnf │ ├── uuf250-064.cnf │ ├── uuf250-065.cnf │ ├── uuf250-066.cnf │ ├── uuf250-067.cnf │ ├── uuf250-068.cnf │ ├── uuf250-069.cnf │ ├── uuf250-07.cnf │ ├── uuf250-070.cnf │ ├── uuf250-071.cnf │ ├── uuf250-072.cnf │ ├── uuf250-073.cnf │ ├── uuf250-074.cnf │ ├── uuf250-075.cnf │ ├── uuf250-076.cnf │ ├── uuf250-077.cnf │ ├── uuf250-078.cnf │ ├── uuf250-079.cnf │ ├── uuf250-08.cnf │ ├── uuf250-080.cnf │ ├── uuf250-081.cnf │ ├── uuf250-082.cnf │ ├── uuf250-083.cnf │ ├── uuf250-084.cnf │ ├── uuf250-085.cnf │ ├── uuf250-086.cnf │ ├── uuf250-087.cnf │ ├── uuf250-088.cnf │ ├── uuf250-089.cnf │ ├── uuf250-09.cnf │ ├── uuf250-090.cnf │ ├── uuf250-091.cnf │ ├── uuf250-092.cnf │ ├── uuf250-093.cnf │ ├── uuf250-094.cnf │ ├── uuf250-095.cnf │ ├── uuf250-096.cnf │ ├── uuf250-097.cnf │ ├── uuf250-098.cnf │ └── uuf250-099.cnf └── unittest ├── core-logic ├── dune ├── t1.expected └── t1.ml ├── core ├── dune ├── t_trace.expected └── t_trace.ml ├── mini-cc ├── dune └── sidekick_test_minicc.ml └── old ├── basic.cnf ├── basic.drup.expected ├── dune ├── regression ├── dune ├── reg_model_lra1.out.expected └── reg_model_lra1.smt2 └── run_tests.ml /.github/workflows/gh-pages.yml: -------------------------------------------------------------------------------- 1 | name: github pages 2 | 3 | on: 4 | push: 5 | branches: 6 | - master # Set a branch name to trigger deployment 7 | 8 | jobs: 9 | deploy: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@main 13 | 14 | - name: Cache opam 15 | id: cache-opam 16 | uses: actions/cache@v2 17 | with: 18 | path: ~/.opam 19 | key: opam-ubuntu-latest-4.12.0 20 | 21 | - uses: ocaml/setup-ocaml@v3 22 | with: 23 | ocaml-compiler: '5.03' 24 | 25 | - name: Pin 26 | run: opam pin -n . 27 | 28 | - name: Depext 29 | run: opam depext -yt sidekick sidekick-base 30 | 31 | - name: Deps 32 | run: opam install -d . --deps-only 33 | 34 | - name: Build 35 | run: opam exec -- dune build @doc --ignore-promoted-rules 36 | 37 | - name: Deploy 38 | uses: peaceiris/actions-gh-pages@v3 39 | with: 40 | github_token: ${{ secrets.GITHUB_TOKEN }} 41 | publish_dir: ./_build/default/_doc/_html/ 42 | destination_dir: dev 43 | enable_jekyll: true 44 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | jobs: 8 | run: 9 | name: build 10 | strategy: 11 | matrix: 12 | os: 13 | - ubuntu-latest 14 | #- windows-latest # see https://github.com/ocaml/setup-ocaml/issues/361 15 | #- macos-latest # clogs CI 16 | ocaml-compiler: 17 | - 4.08 18 | - 4.14 19 | - 5.03 20 | runs-on: ${{ matrix.os }} 21 | steps: 22 | - uses: actions/checkout@v3 23 | - uses: ocaml/setup-ocaml@master 24 | with: 25 | ocaml-compiler: ${{ matrix.ocaml-compiler }} 26 | allow-prerelease-opam: true 27 | - run: opam pin -n . 28 | - run: opam depext -yt sidekick sidekick-base sidekick-bin 29 | - run: opam install -t . --deps-only 30 | - run: opam exec -- dune build --ignore-promoted-rules 31 | - run: opam exec -- dune runtest --ignore-promoted-rules 32 | if: ${{ matrix.os == 'ubuntu-latest' && matrix.ocaml-compiler == '5.03' }} 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _build/ 2 | *.annot 3 | *.native 4 | *.log 5 | *.status 6 | .*.swp 7 | .session 8 | *.docdir 9 | src/util/log.ml 10 | doc/index.html 11 | *.exe 12 | .merlin 13 | *.install 14 | papers/ 15 | snapshots/ 16 | perf.* 17 | .mypy_cache 18 | *.gz 19 | .git-blame-ignore-revs 20 | *.json 21 | -------------------------------------------------------------------------------- /.ocamlformat: -------------------------------------------------------------------------------- 1 | version = 0.26.2 2 | profile=conventional 3 | margin=80 4 | if-then-else=k-r 5 | parens-ite=true 6 | parens-tuple=multi-line-only 7 | sequence-style=terminator 8 | type-decl=compact 9 | break-cases=toplevel 10 | cases-exp-indent=2 11 | field-space=tight-decl 12 | leading-nested-match-parens=true 13 | module-item-spacing=compact 14 | quiet=true 15 | ocaml-version=4.08.0 16 | -------------------------------------------------------------------------------- /.ocp-indent: -------------------------------------------------------------------------------- 1 | base=2 2 | with=0 3 | type=2 4 | max_indent=4 5 | -------------------------------------------------------------------------------- /doc/dune: -------------------------------------------------------------------------------- 1 | (rule 2 | (targets guide.md.corrected) 3 | (deps 4 | (package sidekick) 5 | (package sidekick-base) 6 | ./mdx_runner.exe 7 | (:file guide.md)) 8 | (action 9 | (run ./mdx_runner.exe %{file} %{targets}))) 10 | 11 | (rule 12 | (alias runtest) 13 | (package sidekick-base) 14 | (action 15 | (diff guide.md guide.md.corrected))) 16 | 17 | (executable 18 | (name mdx_runner) 19 | (modes native)) 20 | -------------------------------------------------------------------------------- /doc/mdx_runner.ml: -------------------------------------------------------------------------------- 1 | open Printf 2 | 3 | let just_copy f1 f2 = 4 | let ic = open_in f1 in 5 | let len = in_channel_length ic in 6 | let buf = Bytes.create len in 7 | really_input ic buf 0 len; 8 | close_in_noerr ic; 9 | 10 | let oc = open_out f2 in 11 | output oc buf 0 len; 12 | flush oc; 13 | close_out_noerr oc 14 | 15 | let () = 16 | let f1 = Sys.argv.(1) in 17 | let f2 = Sys.argv.(2) in 18 | 19 | (* annoying changes in the typechecking output *) 20 | if Sys.ocaml_version < "4.08" then ( 21 | just_copy f1 f2; 22 | exit 0 23 | ); 24 | try 25 | let e = Sys.command @@ Printf.sprintf "ocaml-mdx test '%s' -o '%s'" f1 f2 in 26 | if e <> 0 then ( 27 | printf "warning: ocaml-mdx exited with code %d\n" e; 28 | just_copy f1 f2 29 | ) else 30 | print_endline "ocaml-mdx returned 0" 31 | with Sys_error e -> 32 | printf "error when running mdx: %s\n" e; 33 | just_copy f1 f2; 34 | () 35 | -------------------------------------------------------------------------------- /doc/papers/mcsat-vmcai2013.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/c-cube/sidekick/6c8d6840f82bcac146700e08ad012d64edfd569c/doc/papers/mcsat-vmcai2013.pdf -------------------------------------------------------------------------------- /doc/papers/mcsat_design.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/c-cube/sidekick/6c8d6840f82bcac146700e08ad012d64edfd569c/doc/papers/mcsat_design.pdf -------------------------------------------------------------------------------- /doc/papers/minisat.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/c-cube/sidekick/6c8d6840f82bcac146700e08ad012d64edfd569c/doc/papers/minisat.pdf -------------------------------------------------------------------------------- /dune: -------------------------------------------------------------------------------- 1 | (data_only_dirs tests) 2 | 3 | (env 4 | (_ 5 | (flags :standard -warn-error -a+8+9 -w +a-4-32-40-41-42-44-48-70 -color 6 | always -strict-sequence -safe-string -short-paths) 7 | (ocamlopt_flags :standard -O3 -color always -inline 30 -unbox-closures 8 | -unbox-closures-factor 20))) 9 | -------------------------------------------------------------------------------- /examples/sudoku/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name sudoku_solve) 3 | (modes native) 4 | (libraries 5 | sidekick.core 6 | sidekick.util 7 | sidekick.sat 8 | trace-tef ; for profiling 9 | iter 10 | containers) 11 | (flags :standard -warn-error -a+8 -color always -safe-string 12 | -strict-sequence) 13 | (ocamlopt_flags :standard -O3 -bin-annot -unbox-closures 14 | -unbox-closures-factor 20)) 15 | -------------------------------------------------------------------------------- /examples/sudoku/tests/Makefile: -------------------------------------------------------------------------------- 1 | 2 | sudoku17.txt: 3 | wget https://github.com/attractivechaos/plb/releases/download/v0/sudoku17.txt.gz -O sudoku17.txt.gz 4 | gunzip -f sudoku17.txt.gz 5 | 6 | top50k.txt: 7 | wget https://github.com/attractivechaos/plb/releases/download/v0/sudoku.top50k.gz -O top50k.txt.gz 8 | gunzip -f top50k.txt.gz 9 | 10 | fetch-all: sudoku17.txt top50k.txt 11 | -------------------------------------------------------------------------------- /examples/sudoku/tests/dune: -------------------------------------------------------------------------------- 1 | (rule 2 | (targets head15_top1465.out) 3 | (deps head15_top1465.txt) 4 | (action 5 | (with-stdout-to 6 | %{targets} 7 | (run ../sudoku_solve.exe --no-time %{deps})))) 8 | 9 | (rule 10 | (alias runtest) 11 | (package sidekick) 12 | (action 13 | (diff head15_top1465.expected head15_top1465.out))) 14 | -------------------------------------------------------------------------------- /examples/sudoku/tests/head15_top1465.txt: -------------------------------------------------------------------------------- 1 | 4...3.......6..8..........1....5..9..8....6...7.2........1.27..5.3....4.9........ 2 | 7.8...3.....2.1...5.........4.....263...8.......1...9..9.6....4....7.5........... 3 | 7.8...3.....6.1...5.........4.....263...8.......1...9..9.2....4....7.5........... 4 | 3.7.4...........918........4.....7.....16.......25..........38..9....5...2.6..... 5 | 5..7..6....38...........2..62.4............917............35.8.4.....1......9.... 6 | 4..7..6....38...........2..62.5............917............43.8.5.....1......9.... 7 | .4..1.2.......9.7..1..........43.6..8......5....2.....7.5..8......6..3..9........ 8 | 7.5.....2...4.1...3.........1.6..4..2...5...........9....37.....8....6...9.....8. 9 | ......41.9..3.....3...5.....48..7..........62.1.......6..2....5.7....8......9.... 10 | 7.5.....2...4.1...3.........1.6..4..2...5...........9....37.....9....8...8.....6. 11 | .8..1......5....3.......4.....6.5.7.89....2.....3.....2.....1.9..67........4..... 12 | 8.9...3.....7.1...5.........7.....263...9.......1...4..6.2....4....8.5........... 13 | 6.9.....8...7.1...4............6...4.2.....3..3....5...1.5...7.8...9..........2.. 14 | ......41.9..3.....3...2.....48..7..........52.1.......5..2....6.7....8......9.... 15 | 1...48....5....9....6...3.....57.2..8.3.........9............4167..........2..... 16 | -------------------------------------------------------------------------------- /proof-trace-dump.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | exec dune exec --profile=release src/proof-trace-dump/proof_trace_dump.exe -- $@ 3 | -------------------------------------------------------------------------------- /sidekick-base.opam: -------------------------------------------------------------------------------- 1 | # This file is generated by dune, edit dune-project instead 2 | opam-version: "2.0" 3 | version: "dev" 4 | synopsis: "Concrete terms and theories for sidekick" 5 | maintainer: ["simon.cruanes.2007@m4x.org"] 6 | authors: ["Simon Cruanes" "Guillaume Bury"] 7 | license: "Apache" 8 | homepage: "https://github.com/c-cube/sidekick" 9 | bug-reports: "https://github.com/c-cube/sidekick/issues/" 10 | depends: [ 11 | "dune" {>= "2.0"} 12 | "zarith" 13 | "smtlib-utils" {>= "0.1" & < "0.5"} 14 | "sidekick" {= version} 15 | "qcheck" {with-test & >= "0.16"} 16 | "mdx" {with-test} 17 | "odoc" {with-doc} 18 | "menhir" 19 | ] 20 | build: [ 21 | ["dune" "subst"] {pinned} 22 | [ 23 | "dune" 24 | "build" 25 | "-p" 26 | name 27 | "-j" 28 | jobs 29 | "@install" 30 | "@runtest" {with-test} 31 | "@doc" {with-doc} 32 | ] 33 | ] 34 | dev-repo: "git+https://github.com/c-cube/sidekick.git" 35 | -------------------------------------------------------------------------------- /sidekick-bin.opam: -------------------------------------------------------------------------------- 1 | # This file is generated by dune, edit dune-project instead 2 | opam-version: "2.0" 3 | version: "dev" 4 | synopsis: "SMT solver based on msat and CDCL(T) (standalone binary)" 5 | maintainer: ["simon.cruanes.2007@m4x.org"] 6 | authors: ["Simon Cruanes" "Guillaume Bury"] 7 | license: "Apache" 8 | homepage: "https://github.com/c-cube/sidekick" 9 | bug-reports: "https://github.com/c-cube/sidekick/issues/" 10 | depends: [ 11 | "dune" {>= "2.0"} 12 | "zarith" 13 | "sidekick" {= version} 14 | "sidekick-base" {= version} 15 | "menhir" 16 | ] 17 | depopts: [ 18 | "trace-tef" {>= "0.3"} 19 | ] 20 | build: [ 21 | ["dune" "subst"] {pinned} 22 | [ 23 | "dune" 24 | "build" 25 | "-p" 26 | name 27 | "-j" 28 | jobs 29 | "@install" 30 | "@runtest" {with-test} 31 | "@doc" {with-doc} 32 | ] 33 | ] 34 | dev-repo: "git+https://github.com/c-cube/sidekick.git" 35 | -------------------------------------------------------------------------------- /sidekick.opam: -------------------------------------------------------------------------------- 1 | # This file is generated by dune, edit dune-project instead 2 | opam-version: "2.0" 3 | version: "dev" 4 | synopsis: "SMT solver based on msat and CDCL(T) (core library)" 5 | maintainer: ["simon.cruanes.2007@m4x.org"] 6 | authors: ["Simon Cruanes" "Guillaume Bury"] 7 | license: "Apache" 8 | tags: ["sat" "smt"] 9 | homepage: "https://github.com/c-cube/sidekick" 10 | bug-reports: "https://github.com/c-cube/sidekick/issues/" 11 | depends: [ 12 | "dune" {>= "2.0"} 13 | "containers" {>= "3.6" & < "4.0"} 14 | "ocaml" {>= "4.08"} 15 | "iter" {>= "1.0"} 16 | "trace" {>= "0.3"} 17 | "zarith" {with-test} 18 | "alcotest" {with-test} 19 | "trace-tef" {with-test & >= "0.3"} 20 | "odoc" {with-doc} 21 | ] 22 | depopts: [ 23 | "mtime" {>= "2.0"} 24 | "memtrace" 25 | "zarith" 26 | ] 27 | conflicts: [ 28 | "zarith" {< "1.8"} 29 | ] 30 | build: [ 31 | ["dune" "subst"] {pinned} 32 | [ 33 | "dune" 34 | "build" 35 | "-p" 36 | name 37 | "-j" 38 | jobs 39 | "@install" 40 | "@runtest" {with-test} 41 | "@doc" {with-doc} 42 | ] 43 | ] 44 | dev-repo: "git+https://github.com/c-cube/sidekick.git" 45 | -------------------------------------------------------------------------------- /sidekick.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | OPTS="--profile=release --display=quiet" 3 | exec dune exec $OPTS ./src/main/main.exe -- $@ 4 | -------------------------------------------------------------------------------- /src/abstract-solver/check_res.ml: -------------------------------------------------------------------------------- 1 | (** Result of solving for the current set of clauses *) 2 | 3 | type value = Term.t 4 | 5 | type sat_result = { 6 | get_value: Term.t -> value option; (** Value for this term *) 7 | iter_classes: (Term.t Iter.t * value) Iter.t; 8 | (** All equivalence classes in the congruence closure *) 9 | eval_lit: Lit.t -> bool option; (** Evaluate literal *) 10 | iter_true_lits: Lit.t Iter.t; 11 | (** Iterate on literals that are true in the trail *) 12 | } 13 | (** Satisfiable *) 14 | 15 | type unsat_result = { 16 | unsat_core: unit -> Lit.t Iter.t; 17 | (** Unsat core (subset of assumptions), or empty *) 18 | unsat_proof: unit -> Sidekick_proof.Step.id option; 19 | (** Proof step for the empty clause *) 20 | } 21 | (** Unsatisfiable *) 22 | 23 | (** Result of calling "check" *) 24 | type t = 25 | | Sat of sat_result 26 | | Unsat of unsat_result 27 | | Unknown of Unknown.t 28 | (** Unknown, obtained after a timeout, memory limit, etc. *) 29 | 30 | let pp out (self : t) = 31 | match self with 32 | | Sat _ -> Fmt.string out "Sat" 33 | | Unsat _ -> Fmt.string out "Unsat" 34 | | Unknown u -> Fmt.fprintf out "Unknown(%a)" Unknown.pp u 35 | -------------------------------------------------------------------------------- /src/abstract-solver/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_abstract_solver) 3 | (public_name sidekick.abstract-solver) 4 | (flags :standard -open Sidekick_util -open Sidekick_core) 5 | (libraries containers iter sidekick.core sidekick.proof)) 6 | -------------------------------------------------------------------------------- /src/abstract-solver/sidekick_abstract_solver.ml: -------------------------------------------------------------------------------- 1 | (** Abstract interface for a solver *) 2 | 3 | module Unknown = Unknown 4 | module Check_res = Check_res 5 | module Asolver = Asolver 6 | 7 | class type t = Asolver.t 8 | (** Main abstract solver type *) 9 | -------------------------------------------------------------------------------- /src/abstract-solver/unknown.ml: -------------------------------------------------------------------------------- 1 | type t = U_timeout | U_max_depth | U_incomplete | U_asked_to_stop 2 | 3 | let pp out = function 4 | | U_timeout -> Fmt.string out {|"timeout"|} 5 | | U_max_depth -> Fmt.string out {|"max depth reached"|} 6 | | U_incomplete -> Fmt.string out {|"incomplete fragment"|} 7 | | U_asked_to_stop -> Fmt.string out {|"asked to stop by callback"|} 8 | -------------------------------------------------------------------------------- /src/abstract-solver/unknown.mli: -------------------------------------------------------------------------------- 1 | type t = U_timeout | U_max_depth | U_incomplete | U_asked_to_stop 2 | 3 | val pp : t Fmt.printer 4 | -------------------------------------------------------------------------------- /src/algos/simplex/binary_op.ml: -------------------------------------------------------------------------------- 1 | type t = Plus | Minus 2 | 3 | let to_string = function 4 | | Plus -> "+" 5 | | Minus -> "-" 6 | -------------------------------------------------------------------------------- /src/algos/simplex/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_simplex) 3 | (public_name sidekick.simplex) 4 | (synopsis "Simplex algorithm") 5 | (flags :standard -warn-error -a+8 -w -32 -open Sidekick_util) 6 | (libraries containers sidekick.core sidekick.arith)) 7 | -------------------------------------------------------------------------------- /src/algos/simplex/linear_expr.mli: -------------------------------------------------------------------------------- 1 | (* 2 | copyright (c) 2014-2018, Guillaume Bury, Simon Cruanes 3 | *) 4 | 5 | (** Arithmetic expressions *) 6 | 7 | module type COEFF = Linear_expr_intf.COEFF 8 | module type VAR = Linear_expr_intf.VAR 9 | module type S = Linear_expr_intf.S 10 | 11 | type nonrec bool_op = Linear_expr_intf.bool_op = 12 | | Leq 13 | | Geq 14 | | Lt 15 | | Gt 16 | | Eq 17 | | Neq 18 | 19 | module Make (C : COEFF) (Var : VAR) : 20 | S with module C = C and module Var = Var and module Var_map = CCMap.Make(Var) 21 | -------------------------------------------------------------------------------- /src/algos/simplex/predicate.ml: -------------------------------------------------------------------------------- 1 | type t = Leq | Geq | Lt | Gt | Eq | Neq 2 | 3 | let neg = function 4 | | Leq -> Gt 5 | | Lt -> Geq 6 | | Eq -> Neq 7 | | Neq -> Eq 8 | | Geq -> Lt 9 | | Gt -> Leq 10 | 11 | let neg_sign = function 12 | | Leq -> Geq 13 | | Lt -> Gt 14 | | Geq -> Leq 15 | | Gt -> Lt 16 | | Neq -> Neq 17 | | Eq -> Eq 18 | 19 | let to_string = function 20 | | Leq -> "=<" 21 | | Geq -> ">=" 22 | | Lt -> "<" 23 | | Gt -> ">" 24 | | Eq -> "=" 25 | | Neq -> "!=" 26 | 27 | let pp out (self : t) = Fmt.string out (to_string self) 28 | -------------------------------------------------------------------------------- /src/algos/simplex/tests/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_test_simplex) 3 | (libraries zarith sidekick.simplex sidekick.util sidekick.zarith qcheck 4 | alcotest)) 5 | 6 | (rule 7 | (targets sidekick_test_simplex.ml) 8 | (enabled_if 9 | (>= %{ocaml_version} 4.08.0)) 10 | (action 11 | (copy test_simplex.real.ml %{targets}))) 12 | 13 | (rule 14 | (targets sidekick_test_simplex.ml) 15 | (enabled_if 16 | (< %{ocaml_version} 4.08.0)) 17 | (action 18 | (with-stdout-to 19 | %{targets} 20 | (echo "let props=[];; let tests=\"simplex\",[]")))) 21 | -------------------------------------------------------------------------------- /src/arith/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_arith) 3 | (public_name sidekick.arith) 4 | (flags :standard -warn-error -a+8) 5 | (libraries sidekick.core sidekick.sigs)) 6 | -------------------------------------------------------------------------------- /src/base/Config.ml: -------------------------------------------------------------------------------- 1 | (** Configuration *) 2 | 3 | module Key = Het.Key 4 | 5 | type pair = Het.pair = Pair : 'a Key.t * 'a -> pair 6 | 7 | include Het.Map 8 | -------------------------------------------------------------------------------- /src/base/Config.mli: -------------------------------------------------------------------------------- 1 | (** Configuration *) 2 | 3 | module Key : sig 4 | type 'a t 5 | 6 | val create : unit -> 'a t 7 | 8 | val equal : 'a t -> 'a t -> bool 9 | (** Compare two keys that have compatible types *) 10 | end 11 | 12 | type t 13 | 14 | val empty : t 15 | val mem : _ Key.t -> t -> bool 16 | val add : 'a Key.t -> 'a -> t -> t 17 | val length : t -> int 18 | val cardinal : t -> int 19 | val find : 'a Key.t -> t -> 'a option 20 | 21 | val find_exn : 'a Key.t -> t -> 'a 22 | (** @raise Not_found if the key is not in the table *) 23 | 24 | type pair = Pair : 'a Key.t * 'a -> pair 25 | 26 | val iter : (pair -> unit) -> t -> unit 27 | val to_iter : t -> pair Iter.t 28 | val of_iter : pair Iter.t -> t 29 | val add_iter : t -> pair Iter.t -> t 30 | val add_list : t -> pair list -> t 31 | val of_list : pair list -> t 32 | val to_list : t -> pair list 33 | -------------------------------------------------------------------------------- /src/base/Data_ty.mli: -------------------------------------------------------------------------------- 1 | open Types_ 2 | 3 | type select = Types_.select = { 4 | select_id: ID.t; 5 | select_cstor: cstor; 6 | select_ty: ty lazy_t; 7 | select_i: int; 8 | } 9 | 10 | type cstor = Types_.cstor = { 11 | cstor_id: ID.t; 12 | cstor_is_a: ID.t; 13 | mutable cstor_arity: int; 14 | cstor_args: select list lazy_t; 15 | cstor_ty_as_data: data; 16 | cstor_ty: ty lazy_t; 17 | } 18 | 19 | type t = data = { 20 | data_id: ID.t; 21 | data_cstors: cstor ID.Map.t lazy_t; 22 | data_as_ty: ty lazy_t; 23 | } 24 | 25 | type Const.view += 26 | private 27 | | Data of data 28 | | Cstor of cstor 29 | | Select of select 30 | | Is_a of cstor 31 | 32 | include Sidekick_sigs.EQ_HASH_PRINT with type t := t 33 | 34 | module Select : sig 35 | type t = select 36 | 37 | include Sidekick_sigs.EQ_HASH_PRINT with type t := t 38 | end 39 | 40 | module Cstor : sig 41 | type t = cstor 42 | 43 | val ty_args : t -> ty list 44 | val select_idx : t -> int -> select 45 | 46 | include Sidekick_sigs.EQ_HASH_PRINT with type t := t 47 | end 48 | 49 | val data : Term.store -> t -> Term.t 50 | val cstor : Term.store -> cstor -> Term.t 51 | val select : Term.store -> select -> Term.t 52 | val is_a : Term.store -> cstor -> Term.t 53 | val data_as_ty : t -> ty 54 | 55 | (* TODO: select_ : store -> cstor -> int -> term *) 56 | 57 | val as_data : ty -> data option 58 | val as_select : term -> select option 59 | val as_cstor : term -> cstor option 60 | val as_is_a : term -> cstor option 61 | -------------------------------------------------------------------------------- /src/base/Het.mli: -------------------------------------------------------------------------------- 1 | (** {1 Associative containers with Heterogeneous Values} 2 | 3 | This is similar to {!CCMixtbl}, but the injection is directly used as 4 | a key. 5 | 6 | @since 0.17 *) 7 | 8 | type 'a iter = ('a -> unit) -> unit 9 | type 'a gen = unit -> 'a option 10 | 11 | module Key : sig 12 | type 'a t 13 | 14 | val create : unit -> 'a t 15 | 16 | val equal : 'a t -> 'a t -> bool 17 | (** Compare two keys that have compatible types. *) 18 | end 19 | 20 | type pair = Pair : 'a Key.t * 'a -> pair 21 | 22 | (** {2 Immutable map} *) 23 | module Map : sig 24 | type t 25 | 26 | val empty : t 27 | val mem : _ Key.t -> t -> bool 28 | val add : 'a Key.t -> 'a -> t -> t 29 | val remove : _ Key.t -> t -> t 30 | val length : t -> int 31 | val cardinal : t -> int 32 | val find : 'a Key.t -> t -> 'a option 33 | 34 | val find_exn : 'a Key.t -> t -> 'a 35 | (** @raise Not_found if the key is not in the table. *) 36 | 37 | val iter : (pair -> unit) -> t -> unit 38 | val to_iter : t -> pair iter 39 | val of_iter : pair iter -> t 40 | val add_iter : t -> pair iter -> t 41 | val add_list : t -> pair list -> t 42 | val of_list : pair list -> t 43 | val to_list : t -> pair list 44 | end 45 | -------------------------------------------------------------------------------- /src/base/ID.ml: -------------------------------------------------------------------------------- 1 | (* This file is free software. See file "license" for more details. *) 2 | 3 | type t = { id: int; name: string } 4 | 5 | let make = 6 | let n = ref 0 in 7 | fun name -> 8 | let x = { id = !n; name } in 9 | incr n; 10 | x 11 | 12 | let makef fmt = CCFormat.ksprintf ~f:make fmt 13 | let copy { name; _ } = make name 14 | let id { id; _ } = id 15 | let to_string id = id.name 16 | let equal a b = a.id = b.id 17 | let compare a b = CCInt.compare a.id b.id 18 | let hash a = CCHash.int a.id 19 | let pp_full out a = Format.fprintf out "%s/%d" a.name a.id 20 | let pp_name out a = CCFormat.string out a.name 21 | let pp = pp_name 22 | let to_string_full a = Printf.sprintf "%s/%d" a.name a.id 23 | 24 | let ser (self : t) = 25 | Ser_value.(dict_of_list [ "id", int self.id; "n", string self.name ]) 26 | 27 | let deser = 28 | Ser_decode.( 29 | let+ id = dict_field "id" int and+ name = dict_field "n" string in 30 | { id; name }) 31 | 32 | module AsKey = struct 33 | type nonrec t = t 34 | 35 | let equal = equal 36 | let compare = compare 37 | let hash = hash 38 | end 39 | 40 | module Map = CCMap.Make (AsKey) 41 | module Set = CCSet.Make (AsKey) 42 | module Tbl = CCHashtbl.Make (AsKey) 43 | -------------------------------------------------------------------------------- /src/base/Proof_quip.mli.tmp: -------------------------------------------------------------------------------- 1 | (** Export to Quip from {!module:Proof}. 2 | 3 | We use {!Sidekick_quip} but do not export anything from it. *) 4 | 5 | type t 6 | 7 | val of_proof : Proof.t -> unsat:Proof.step_id -> t 8 | 9 | type out_format = Sidekick_quip.out_format = Sexp | CSexp 10 | 11 | val output : ?fmt:out_format -> out_channel -> t -> unit 12 | -------------------------------------------------------------------------------- /src/base/Solver.ml: -------------------------------------------------------------------------------- 1 | include Sidekick_smt_solver.Solver 2 | 3 | let default_arg = 4 | (module struct 5 | let view_as_cc = Term.view_as_cc 6 | end : Sidekick_smt_solver.Sigs.ARG) 7 | 8 | let create_default ?stat ?size ~tracer ~theories tst : t = 9 | create default_arg ?stat ?size ~tracer ~theories tst () 10 | -------------------------------------------------------------------------------- /src/base/Statement.mli: -------------------------------------------------------------------------------- 1 | (** Statements. 2 | 3 | A statement is an instruction for the SMT solver to do something, 4 | like asserting that a formula is true, declaring a new constant, 5 | or checking satisfiabilty of the current set of assertions. *) 6 | 7 | open Types_ 8 | 9 | type t = statement = 10 | | Stmt_set_logic of string 11 | | Stmt_set_option of string list 12 | | Stmt_set_info of string * string 13 | | Stmt_data of data list 14 | | Stmt_ty_decl of { name: ID.t; arity: int; ty_const: ty } 15 | (** new atomic cstor *) 16 | | Stmt_decl of { name: ID.t; ty_args: ty list; ty_ret: ty; const: term } 17 | | Stmt_define of definition list 18 | | Stmt_assert of term 19 | | Stmt_assert_clause of term list 20 | | Stmt_check_sat of (bool * term) list 21 | | Stmt_get_model 22 | | Stmt_get_value of term list 23 | | Stmt_exit 24 | 25 | include Sidekick_sigs.PRINT with type t := t 26 | -------------------------------------------------------------------------------- /src/base/Term.ml: -------------------------------------------------------------------------------- 1 | include Sidekick_core.Term 2 | 3 | let view_as_cc = Sidekick_core.Default_cc_view.view_as_cc 4 | -------------------------------------------------------------------------------- /src/base/Ty.mli: -------------------------------------------------------------------------------- 1 | open Types_ 2 | 3 | include module type of struct 4 | include Term 5 | end 6 | 7 | type t = ty 8 | type data = Types_.data 9 | 10 | include Sidekick_sigs.EQ_ORD_HASH_PRINT with type t := t 11 | 12 | val const_decoders : Const.decoders 13 | val bool : store -> t 14 | val real : store -> t 15 | val int : store -> t 16 | val uninterpreted : store -> ID.t -> t 17 | val uninterpreted_str : store -> string -> t 18 | val is_uninterpreted : t -> bool 19 | val is_real : t -> bool 20 | val is_int : t -> bool 21 | 22 | (* TODO: separate functor? 23 | val finite : t -> bool 24 | val set_finite : t -> bool -> unit 25 | val args : t -> ty list 26 | val ret : t -> ty 27 | val arity : t -> int 28 | val unfold : t -> ty list * ty 29 | *) 30 | -------------------------------------------------------------------------------- /src/base/Uconst.mli: -------------------------------------------------------------------------------- 1 | (** Uninterpreted constants *) 2 | 3 | open Types_ 4 | 5 | type ty = Term.t 6 | type t = Types_.uconst = { uc_id: ID.t; uc_ty: ty } 7 | 8 | val id : t -> ID.t 9 | val ty : t -> ty 10 | 11 | type Const.view += private Uconst of t 12 | 13 | include Sidekick_sigs.EQ_ORD_HASH_PRINT with type t := t 14 | 15 | val const_decoders : Const.decoders 16 | 17 | val make : ID.t -> ty -> t 18 | (** Make a new uninterpreted function. *) 19 | 20 | val uconst : Term.store -> t -> Term.t 21 | val uconst_of_id : Term.store -> ID.t -> ty -> Term.t 22 | val uconst_of_id' : Term.store -> ID.t -> ty list -> ty -> Term.t 23 | val uconst_of_str : Term.store -> string -> ty list -> ty -> Term.t 24 | 25 | module Map : CCMap.S with type key = t 26 | module Tbl : CCHashtbl.S with type key = t 27 | -------------------------------------------------------------------------------- /src/base/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_base) 3 | (public_name sidekick-base) 4 | (synopsis "Base term definitions for the standalone SMT solver and library") 5 | (libraries containers iter sidekick.core sidekick.util sidekick.smt-solver 6 | sidekick.cc sidekick.quip sidekick.th-lra sidekick.th-bool-static 7 | sidekick.th-ty-unin sidekick.th-bool-dyn sidekick.th-data sidekick.zarith 8 | zarith) 9 | (flags :standard -w +32 -open Sidekick_util)) 10 | -------------------------------------------------------------------------------- /src/base/th_bool.ml: -------------------------------------------------------------------------------- 1 | (** Reducing boolean formulas to clauses *) 2 | 3 | let k_config : [ `Dyn | `Static ] Config.Key.t = Config.Key.create () 4 | 5 | let theory_static : Solver.theory = 6 | Sidekick_th_bool_static.theory 7 | (module struct 8 | let view_as_bool = Form.view 9 | let mk_bool = Form.mk_of_view 10 | end : Sidekick_th_bool_static.ARG) 11 | 12 | let theory_dyn : Solver.theory = 13 | Sidekick_th_bool_dyn.theory 14 | (module struct 15 | let view_as_bool = Form.view 16 | let mk_bool = Form.mk_of_view 17 | end : Sidekick_th_bool_static.ARG) 18 | 19 | let theory (conf : Config.t) : Solver.theory = 20 | match Config.find k_config conf with 21 | | Some `Dyn -> theory_dyn 22 | | Some `Static -> theory_static 23 | | None -> 24 | (* default *) 25 | theory_static 26 | -------------------------------------------------------------------------------- /src/base/th_lra.ml: -------------------------------------------------------------------------------- 1 | (** Theory of Linear Rational Arithmetic *) 2 | 3 | open Sidekick_core 4 | module T = Term 5 | module Q = Sidekick_zarith.Rational 6 | 7 | let mk_eq = Form.eq 8 | let mk_bool = T.bool 9 | 10 | let theory : Solver.theory = 11 | Sidekick_th_lra.theory 12 | (module struct 13 | module Z = Sidekick_zarith.Int 14 | module Q = Sidekick_zarith.Rational 15 | 16 | let ty_real = LRA_term.real 17 | let has_ty_real = LRA_term.has_ty_real 18 | let view_as_lra = LRA_term.view 19 | let mk_lra = LRA_term.term_of_view 20 | end : Sidekick_th_lra.ARG) 21 | -------------------------------------------------------------------------------- /src/base/th_ty_unin.ml: -------------------------------------------------------------------------------- 1 | let theory : Solver.theory = 2 | Sidekick_th_ty_unin.theory 3 | (module struct 4 | let ty_is_unin = Ty.is_uninterpreted 5 | end : Sidekick_th_ty_unin.ARG) 6 | -------------------------------------------------------------------------------- /src/bencode/Sidekick_bencode.mli: -------------------------------------------------------------------------------- 1 | type t = Ser_value.t 2 | 3 | module Encode : sig 4 | val to_buffer : Buffer.t -> t -> unit 5 | val to_string : t -> string 6 | end 7 | 8 | module Decode : sig 9 | val of_string : ?idx:int -> string -> (int * t) option 10 | (** Decode string, and also return how many bytes were consumed. 11 | @param idx initial index (default 0) *) 12 | 13 | val of_string_exn : ?idx:int -> string -> int * t 14 | (** Parse string. 15 | @raise Error.Error if the string is not valid bencode. *) 16 | end 17 | -------------------------------------------------------------------------------- /src/bencode/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_bencode) 3 | (public_name sidekick.bencode) 4 | (synopsis "basic Bencode serialization") 5 | (flags :standard -open Sidekick_util) 6 | (libraries containers sidekick.util)) 7 | -------------------------------------------------------------------------------- /src/bin-lib/Dimacs_lexer.mll: -------------------------------------------------------------------------------- 1 | { 2 | type token = EOF | P | CNF | ZERO | LIT of int 3 | } 4 | 5 | let number = ['1' - '9'] ['0' - '9']* 6 | 7 | rule token = parse 8 | | eof { EOF } 9 | | "c" { comment lexbuf } 10 | | [' ' '\t' '\r'] { token lexbuf } 11 | | 'p' { P } 12 | | "cnf" { CNF } 13 | | '\n' { Lexing.new_line lexbuf; token lexbuf } 14 | | '0' { ZERO } 15 | | '-'? number { LIT (int_of_string (Lexing.lexeme lexbuf)) } 16 | | _ { Error.errorf "dimacs.lexer: unexpected char `%s`" (Lexing.lexeme lexbuf) } 17 | 18 | and comment = parse 19 | | '\n' { Lexing.new_line lexbuf; token lexbuf } 20 | | [^'\n'] { comment lexbuf } 21 | -------------------------------------------------------------------------------- /src/bin-lib/Dimacs_parser.ml: -------------------------------------------------------------------------------- 1 | module L = Dimacs_lexer 2 | 3 | type t = { buf: Lexing.lexbuf; mutable header: (int * int) option } 4 | 5 | let create (ic : in_channel) : t = 6 | let buf = Lexing.from_channel ic in 7 | { buf; header = None } 8 | 9 | let parse_header self = 10 | match self.header with 11 | | Some tup -> tup 12 | | None -> 13 | let i, j = 14 | try 15 | match L.token self.buf with 16 | | L.P -> 17 | (match L.token self.buf with 18 | | L.CNF -> 19 | (match L.token self.buf with 20 | | L.LIT i -> 21 | (match L.token self.buf with 22 | | L.LIT j -> i, j 23 | | _ -> raise Exit) 24 | | _ -> raise Exit) 25 | | _ -> raise Exit) 26 | | _ -> raise Exit 27 | with Exit -> Error.errorf "expected file to start with header" 28 | in 29 | self.header <- Some (i, j); 30 | i, j 31 | 32 | let next_clause self : _ option = 33 | let rec loop acc = 34 | match L.token self.buf with 35 | | L.EOF when acc = [] -> None 36 | | L.EOF -> Error.errorf "unexpected EOF in a clause" 37 | | L.ZERO -> Some (List.rev acc) 38 | | L.LIT i -> loop (i :: acc) 39 | | _ -> Error.errorf "expected clause" 40 | in 41 | loop [] 42 | 43 | let iter self k = 44 | ignore (parse_header self : _ * _); 45 | let rec loop () = 46 | match next_clause self with 47 | | None -> () 48 | | Some c -> 49 | k c; 50 | loop () 51 | in 52 | loop () 53 | -------------------------------------------------------------------------------- /src/bin-lib/Dimacs_parser.mli: -------------------------------------------------------------------------------- 1 | (** {1 DIMACS parser} *) 2 | 3 | type t 4 | 5 | val create : in_channel -> t 6 | val parse_header : t -> int * int 7 | val next_clause : t -> int list option 8 | val iter : t -> int list Iter.t 9 | -------------------------------------------------------------------------------- /src/bin-lib/Drup_lexer.mll: -------------------------------------------------------------------------------- 1 | 2 | { 3 | type token = EOF | ZERO | LIT of int | D | R | I 4 | } 5 | 6 | let number = ['1' - '9'] ['0' - '9']* 7 | 8 | rule token = parse 9 | | eof { EOF } 10 | | "c" { comment lexbuf } 11 | | [' ' '\t' '\r'] { token lexbuf } 12 | | "d" { D } 13 | | "r" { R } 14 | | "i" { I } 15 | | '\n' { Lexing.new_line lexbuf; token lexbuf } 16 | | '0' { ZERO } 17 | | '-'? number { LIT (int_of_string (Lexing.lexeme lexbuf)) } 18 | | _ { Error.errorf "dimacs.lexer: unexpected char `%s`" (Lexing.lexeme lexbuf) } 19 | 20 | and comment = parse 21 | | '\n' { Lexing.new_line lexbuf; token lexbuf } 22 | | [^'\n'] { comment lexbuf } 23 | -------------------------------------------------------------------------------- /src/bin-lib/Drup_parser.ml: -------------------------------------------------------------------------------- 1 | module L = Drup_lexer 2 | 3 | type event = Input of int list | Add of int list | Delete of int list 4 | type t = { buf: Lexing.lexbuf } 5 | 6 | let create_string s : t = { buf = Lexing.from_string s } 7 | let create_chan (ic : in_channel) : t = { buf = Lexing.from_channel ic } 8 | 9 | let next self : _ option = 10 | let rec get_clause acc = 11 | match L.token self.buf with 12 | | L.EOF -> Error.errorf "unexpected EOF in a clause" 13 | | L.ZERO -> List.rev acc 14 | | L.LIT i -> get_clause (i :: acc) 15 | | _ -> Error.errorf "expected clause" 16 | in 17 | match L.token self.buf with 18 | | L.EOF -> None 19 | | L.I -> 20 | let c = get_clause [] in 21 | Some (Input c) 22 | | L.D -> 23 | let c = get_clause [] in 24 | Some (Delete c) 25 | | L.R -> 26 | let c = get_clause [] in 27 | Some (Add c) 28 | | L.ZERO -> Some (Add []) 29 | | L.LIT i -> 30 | let c = get_clause [ i ] in 31 | Some (Add c) 32 | 33 | let iter self k = 34 | let rec loop () = 35 | match next self with 36 | | None -> () 37 | | Some ev -> 38 | k ev; 39 | loop () 40 | in 41 | loop () 42 | -------------------------------------------------------------------------------- /src/bin-lib/Drup_parser.mli: -------------------------------------------------------------------------------- 1 | (** {1 DRUP parser} *) 2 | 3 | type t 4 | type event = Input of int list | Add of int list | Delete of int list 5 | 6 | val create_chan : in_channel -> t 7 | val create_string : string -> t 8 | val next : t -> event option 9 | val iter : t -> event Iter.t 10 | -------------------------------------------------------------------------------- /src/bin-lib/Sidekick_bin_lib.ml: -------------------------------------------------------------------------------- 1 | (** Library for the Sidekick executables *) 2 | 3 | module Dimacs_lexer = Dimacs_lexer 4 | module Dimacs_parser = Dimacs_parser 5 | module Drup_lexer = Drup_lexer 6 | module Drup_parser = Drup_parser 7 | module Trace_setup = Trace_setup 8 | -------------------------------------------------------------------------------- /src/bin-lib/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_bin_lib) 3 | (public_name sidekick-bin.lib) 4 | (synopsis "Utils for the sidekick binaries") 5 | (libraries containers sidekick.util 6 | (select trace_setup.ml from 7 | (trace-fuchsia -> trace_setup.fuchsia.ml) 8 | (trace-tef -> trace_setup.tef.ml) 9 | (-> trace_setup.dummy.ml))) 10 | (flags :standard -warn-error -a+8 -open Sidekick_util)) 11 | 12 | (ocamllex 13 | (modules Dimacs_lexer Drup_lexer)) 14 | -------------------------------------------------------------------------------- /src/bin-lib/trace_setup.dummy.ml: -------------------------------------------------------------------------------- 1 | let with_trace f = f () 2 | -------------------------------------------------------------------------------- /src/bin-lib/trace_setup.fuchsia.ml: -------------------------------------------------------------------------------- 1 | let with_trace f = Trace_fuchsia.with_setup () f 2 | -------------------------------------------------------------------------------- /src/bin-lib/trace_setup.mli: -------------------------------------------------------------------------------- 1 | 2 | val with_trace : (unit -> 'a) -> 'a 3 | -------------------------------------------------------------------------------- /src/bin-lib/trace_setup.tef.ml: -------------------------------------------------------------------------------- 1 | let with_trace f = Trace_tef.with_setup () f 2 | -------------------------------------------------------------------------------- /src/cc/Sidekick_cc.ml: -------------------------------------------------------------------------------- 1 | open Sidekick_core 2 | module View = CC_view 3 | module E_node = E_node 4 | module Expl = Expl 5 | module Signature = Signature 6 | module Resolved_expl = Resolved_expl 7 | module Plugin = Plugin 8 | module CC = CC 9 | 10 | module type DYN_MONOID_PLUGIN = Sigs_plugin.DYN_MONOID_PLUGIN 11 | module type MONOID_PLUGIN_ARG = Sigs_plugin.MONOID_PLUGIN_ARG 12 | module type MONOID_PLUGIN_BUILDER = Sigs_plugin.MONOID_PLUGIN_BUILDER 13 | 14 | include CC 15 | -------------------------------------------------------------------------------- /src/cc/Sidekick_cc.mli: -------------------------------------------------------------------------------- 1 | (** Congruence Closure Implementation *) 2 | 3 | module type DYN_MONOID_PLUGIN = Sigs_plugin.DYN_MONOID_PLUGIN 4 | module type MONOID_PLUGIN_ARG = Sigs_plugin.MONOID_PLUGIN_ARG 5 | module type MONOID_PLUGIN_BUILDER = Sigs_plugin.MONOID_PLUGIN_BUILDER 6 | 7 | module View = Sidekick_core.CC_view 8 | module E_node = E_node 9 | module Expl = Expl 10 | module Signature = Signature 11 | module Resolved_expl = Resolved_expl 12 | module Plugin = Plugin 13 | module CC = CC 14 | 15 | include module type of struct 16 | include CC 17 | end 18 | -------------------------------------------------------------------------------- /src/cc/bits.ml: -------------------------------------------------------------------------------- 1 | type bitfield_gen = int ref 2 | 3 | let max_width = Sys.word_size - 2 4 | let mk_gen () = ref 0 5 | 6 | type t = int 7 | type field = int 8 | 9 | let empty : t = 0 10 | 11 | let mk_field (gen : bitfield_gen) : field = 12 | let n = !gen in 13 | if n > max_width then Error.errorf "maximum number of CC bitfields reached"; 14 | incr gen; 15 | 1 lsl n 16 | 17 | let[@inline] get field x = x land field <> 0 18 | 19 | let[@inline] set field b x = 20 | if b then 21 | x lor field 22 | else 23 | x land lnot field 24 | 25 | let merge = ( lor ) 26 | let equal : t -> t -> bool = CCEqual.poly 27 | -------------------------------------------------------------------------------- /src/cc/bits.mli: -------------------------------------------------------------------------------- 1 | (** Basic bitfield *) 2 | 3 | type t = private int 4 | type field 5 | type bitfield_gen 6 | 7 | val empty : t 8 | val equal : t -> t -> bool 9 | val mk_field : bitfield_gen -> field 10 | val mk_gen : unit -> bitfield_gen 11 | val get : field -> t -> bool 12 | val set : field -> bool -> t -> t 13 | val merge : t -> t -> t 14 | -------------------------------------------------------------------------------- /src/cc/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name Sidekick_cc) 3 | (public_name sidekick.cc) 4 | (synopsis "main congruence closure implementation") 5 | (private_modules signature) 6 | (libraries containers iter sidekick.sigs sidekick.core sidekick.util 7 | sidekick.proof) 8 | (flags :standard -open Sidekick_util)) 9 | -------------------------------------------------------------------------------- /src/cc/e_node.ml: -------------------------------------------------------------------------------- 1 | open Types_ 2 | 3 | type t = e_node 4 | 5 | let[@inline] equal (n1 : t) n2 = n1 == n2 6 | let[@inline] hash n = Term.hash n.n_term 7 | let[@inline] term n = n.n_term 8 | let[@inline] pp out n = Term.pp out n.n_term 9 | let[@inline] as_lit n = n.n_as_lit 10 | 11 | let make (t : Term.t) : t = 12 | let rec n = 13 | { 14 | n_term = t; 15 | n_sig0 = None; 16 | n_bits = Bits.empty; 17 | n_parents = Bag.empty; 18 | n_as_lit = None; 19 | (* TODO: provide a method to do it *) 20 | n_root = n; 21 | n_expl = FL_none; 22 | n_next = n; 23 | n_size = 1; 24 | } 25 | in 26 | n 27 | 28 | let[@inline] is_root (n : e_node) : bool = n.n_root == n 29 | 30 | (* traverse the equivalence class of [n] *) 31 | let iter_class_ (n_start : e_node) : e_node Iter.t = 32 | fun yield -> 33 | let rec aux u = 34 | yield u; 35 | if u.n_next != n_start then aux u.n_next 36 | in 37 | aux n_start 38 | 39 | let[@inline] iter_class n = iter_class_ n 40 | 41 | let[@inline] iter_parents (n : e_node) : e_node Iter.t = 42 | assert (is_root n); 43 | Bag.to_iter n.n_parents 44 | 45 | let[@inline] swap_next n1 n2 : unit = 46 | let tmp = n1.n_next in 47 | n1.n_next <- n2.n_next; 48 | n2.n_next <- tmp 49 | 50 | module Internal_ = struct 51 | let iter_class_ = iter_class_ 52 | let make = make 53 | end 54 | -------------------------------------------------------------------------------- /src/cc/plugin.mli: -------------------------------------------------------------------------------- 1 | (** Congruence Closure Plugin *) 2 | 3 | open Sigs_plugin 4 | 5 | module type EXTENDED_PLUGIN_BUILDER = sig 6 | include MONOID_PLUGIN_BUILDER 7 | 8 | val mem : t -> E_node.t -> bool 9 | (** Does the CC.E_node.t have a monoid value? *) 10 | 11 | val get : t -> E_node.t -> M.t option 12 | (** Get monoid value for this CC.E_node.t, if any *) 13 | 14 | val iter_all : t -> (CC.repr * M.t) Iter.t 15 | 16 | include Sidekick_sigs.BACKTRACKABLE0 with type t := t 17 | include Sidekick_sigs.PRINT with type t := t 18 | end 19 | 20 | (** Create a plugin builder from the given per-class monoid *) 21 | module Make (M : MONOID_PLUGIN_ARG) : EXTENDED_PLUGIN_BUILDER with module M = M 22 | -------------------------------------------------------------------------------- /src/cc/plugin/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name Sidekick_cc_plugin) 3 | (public_name sidekick.cc.plugin) 4 | (libraries containers iter sidekick.sigs sidekick.cc sidekick.util) 5 | (flags :standard -w +32 -open Sidekick_util)) 6 | -------------------------------------------------------------------------------- /src/cc/resolved_expl.ml: -------------------------------------------------------------------------------- 1 | open Types_ 2 | 3 | type t = { lits: Lit.t list; pr: Proof.Pterm.delayed } 4 | 5 | let pp out (self : t) = 6 | Fmt.fprintf out "(@[resolved-expl@ %a@])" (Util.pp_list Lit.pp) self.lits 7 | -------------------------------------------------------------------------------- /src/cc/resolved_expl.mli: -------------------------------------------------------------------------------- 1 | (** Resolved explanations. 2 | 3 | The congruence closure keeps explanations for why terms are in the same 4 | class. However these are represented in a compact, cheap form. 5 | To use these explanations we need to {b resolve} them into a 6 | resolved explanation, typically a list of 7 | literals that are true in the current trail and are responsible for 8 | merges. 9 | 10 | However, we can also have merged classes because they have the same value 11 | in the current model. *) 12 | 13 | open Types_ 14 | 15 | type t = { lits: Lit.t list; pr: Proof.Pterm.delayed } 16 | 17 | include Sidekick_sigs.PRINT with type t := t 18 | -------------------------------------------------------------------------------- /src/checker/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name main) 3 | (public_name sidekick-checker) 4 | (package sidekick-bin) 5 | (libraries containers sidekick-bin.lib sidekick.util 6 | sidekick.drup) 7 | (flags :standard -warn-error -a+8 -open Sidekick_util)) 8 | -------------------------------------------------------------------------------- /src/core-logic/Hashcons.ml: -------------------------------------------------------------------------------- 1 | module type ARG = sig 2 | type t 3 | 4 | val equal : t -> t -> bool 5 | val hash : t -> int 6 | val set_id : t -> int -> unit 7 | end 8 | 9 | module Make (A : ARG) : sig 10 | type t 11 | 12 | val create : ?size:int -> unit -> t 13 | val hashcons : t -> A.t -> A.t 14 | val size : t -> int 15 | val to_iter : t -> A.t Iter.t 16 | end = struct 17 | module W = Weak.Make (A) 18 | 19 | type t = { tbl: W.t; mutable n: int } 20 | 21 | let create ?(size = 1024) () : t = { tbl = W.create size; n = 0 } 22 | 23 | (* hashcons terms *) 24 | let hashcons st t = 25 | let t' = W.merge st.tbl t in 26 | if t == t' then ( 27 | st.n <- 1 + st.n; 28 | A.set_id t' st.n 29 | ); 30 | t' 31 | 32 | let size st = W.count st.tbl 33 | let to_iter st yield = W.iter yield st.tbl 34 | end 35 | -------------------------------------------------------------------------------- /src/core-logic/bvar.ml: -------------------------------------------------------------------------------- 1 | open Types_ 2 | 3 | type t = bvar = { bv_idx: int; bv_ty: term } 4 | 5 | let equal (v1 : t) v2 = v1.bv_idx = v2.bv_idx && Term_.equal v1.bv_ty v2.bv_ty 6 | let hash v = H.combine2 (H.int v.bv_idx) (Term_.hash v.bv_ty) 7 | let pp out v = Fmt.fprintf out "bv[%d]" v.bv_idx 8 | let[@inline] idx self = self.bv_idx 9 | let[@inline] ty self = self.bv_ty 10 | let make i ty : t = { bv_idx = i; bv_ty = ty } 11 | -------------------------------------------------------------------------------- /src/core-logic/bvar.mli: -------------------------------------------------------------------------------- 1 | (** Bound variable *) 2 | 3 | open Types_ 4 | 5 | type t = bvar = { bv_idx: int; bv_ty: term } 6 | 7 | include EQ_HASH_PRINT with type t := t 8 | 9 | val make : int -> term -> t 10 | val idx : t -> int 11 | val ty : t -> term 12 | -------------------------------------------------------------------------------- /src/core-logic/const.ml: -------------------------------------------------------------------------------- 1 | open Types_ 2 | 3 | type view = const_view = .. 4 | 5 | module Ops = struct 6 | type t = const_ops = { 7 | pp: const_view Fmt.printer; (** Pretty-print constant *) 8 | equal: const_view -> const_view -> bool; 9 | hash: const_view -> int; (** Hash constant *) 10 | ser: (term -> Ser_value.t) -> const_view -> string * Ser_value.t; 11 | } 12 | end 13 | 14 | type t = const = { c_view: view; c_ops: Ops.t; c_ty: term } 15 | 16 | let[@inline] view self = self.c_view 17 | let[@inline] ty self = self.c_ty 18 | 19 | let[@inline] equal (a : t) b = 20 | a.c_ops.equal a.c_view b.c_view && Term_.equal a.c_ty b.c_ty 21 | 22 | let[@inline] hash (a : t) : int = 23 | H.combine2 (a.c_ops.hash a.c_view) (Term_.hash a.c_ty) 24 | 25 | let pp out (a : t) = a.c_ops.pp out a.c_view 26 | let ser ~ser_t (self : t) = self.c_ops.ser ser_t self.c_view 27 | let make c_view c_ops ~ty:c_ty : t = { c_view; c_ops; c_ty } 28 | 29 | type decoders = 30 | (string * Ops.t * (term Ser_decode.t -> view Ser_decode.t)) list 31 | -------------------------------------------------------------------------------- /src/core-logic/const.mli: -------------------------------------------------------------------------------- 1 | (** Constants. 2 | 3 | Constants are logical symbols, defined by the user thanks to an open type *) 4 | 5 | open Types_ 6 | 7 | type view = const_view = .. 8 | 9 | module Ops : sig 10 | type t = const_ops = { 11 | pp: const_view Fmt.printer; (** Pretty-print constant *) 12 | equal: const_view -> const_view -> bool; 13 | (** Equality of constant with any other constant *) 14 | hash: const_view -> int; (** Hash constant *) 15 | ser: (term -> Ser_value.t) -> const_view -> string * Ser_value.t; 16 | (** Serialize a constant, along with a tag to recognize it. *) 17 | } 18 | end 19 | 20 | type t = const = { c_view: view; c_ops: Ops.t; c_ty: term } 21 | 22 | val view : t -> view 23 | val make : view -> Ops.t -> ty:term -> t 24 | val ser : ser_t:(term -> Ser_value.t) -> t -> string * Ser_value.t 25 | val ty : t -> term 26 | 27 | type decoders = 28 | (string * Ops.t * (term Ser_decode.t -> view Ser_decode.t)) list 29 | (** Decoders for constants: given a term store, return a list 30 | of supported tags, and for each tag, a decoder for constants 31 | that have this particular tag. *) 32 | 33 | include EQ_HASH_PRINT with type t := t 34 | -------------------------------------------------------------------------------- /src/core-logic/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_core_logic) 3 | (public_name sidekick.core-logic) 4 | (synopsis "Core AST for logic terms in the calculus of constructions") 5 | (private_modules types_) 6 | (flags :standard -w +32 -open Sidekick_sigs -open Sidekick_util) 7 | (libraries containers iter sidekick.sigs sidekick.util)) 8 | -------------------------------------------------------------------------------- /src/core-logic/sidekick_core_logic.ml: -------------------------------------------------------------------------------- 1 | module Term = Term 2 | module Var = Var 3 | module Bvar = Bvar 4 | module Const = Const 5 | module Subst = Subst 6 | module T_builtins = T_builtins 7 | module Store = Term.Store 8 | 9 | (* TODO: move to separate library? *) 10 | module Str_const = Str_const 11 | -------------------------------------------------------------------------------- /src/core-logic/str_const.ml: -------------------------------------------------------------------------------- 1 | open Types_ 2 | 3 | type const_view += Str of string 4 | 5 | let ops = 6 | let pp out = function 7 | | Str s -> Fmt.string out s 8 | | _ -> assert false 9 | in 10 | 11 | let equal a b = 12 | match a, b with 13 | | Str s1, Str s2 -> s1 = s2 14 | | _ -> false 15 | in 16 | 17 | let hash = function 18 | | Str s -> CCHash.string s 19 | | _ -> assert false 20 | in 21 | 22 | let ser _sink = function 23 | | Str s -> "c.str", Ser_value.string s 24 | | _ -> assert false 25 | in 26 | { Const.Ops.pp; equal; hash; ser } 27 | 28 | let const_decoders : Const.decoders = 29 | [ 30 | ( "c.str", 31 | ops, 32 | fun _dec_term -> 33 | Ser_decode.( 34 | let+ s = string in 35 | Str s) ); 36 | ] 37 | 38 | let make name ~ty : Const.t = Const.make (Str name) ops ~ty 39 | -------------------------------------------------------------------------------- /src/core-logic/str_const.mli: -------------------------------------------------------------------------------- 1 | (** Basic string constants. 2 | 3 | These constants are a string name, coupled with a type. 4 | *) 5 | 6 | open Types_ 7 | 8 | type const_view += private Str of string 9 | 10 | val const_decoders : Const.decoders 11 | val make : string -> ty:term -> const 12 | -------------------------------------------------------------------------------- /src/core-logic/subst.ml: -------------------------------------------------------------------------------- 1 | open Types_ 2 | module M = Var_.Map 3 | 4 | type t = subst 5 | 6 | let empty = { m = M.empty } 7 | let is_empty self = M.is_empty self.m 8 | let add v t self = { m = M.add v t self.m } 9 | 10 | let pp out (self : t) = 11 | if is_empty self then 12 | Fmt.string out "(subst)" 13 | else ( 14 | let pp_pair out (v, t) = 15 | Fmt.fprintf out "(@[%a := %a@])" Var.pp v !Term_.pp_debug_ t 16 | in 17 | Fmt.fprintf out "(@[subst@ %a@])" (Util.pp_iter pp_pair) (M.to_iter self.m) 18 | ) 19 | 20 | let of_list l = { m = M.of_list l } 21 | let of_iter it = { m = M.of_iter it } 22 | let to_iter self = M.to_iter self.m 23 | 24 | let apply (store : Term.store) ~recursive (self : t) (e : term) : term = 25 | Term.Internal_.subst_ store ~recursive e self 26 | -------------------------------------------------------------------------------- /src/core-logic/subst.mli: -------------------------------------------------------------------------------- 1 | (** Substitutions *) 2 | 3 | open Types_ 4 | 5 | type t = subst 6 | 7 | include PRINT with type t := t 8 | 9 | val empty : t 10 | val is_empty : t -> bool 11 | val of_list : (var * term) list -> t 12 | val of_iter : (var * term) Iter.t -> t 13 | val to_iter : t -> (var * term) Iter.t 14 | val add : var -> term -> t -> t 15 | val apply : Term.store -> recursive:bool -> t -> term -> term 16 | -------------------------------------------------------------------------------- /src/core-logic/t_builtins.mli: -------------------------------------------------------------------------------- 1 | (** Core builtins *) 2 | 3 | open Types_ 4 | open Term 5 | 6 | type const_view += C_bool | C_eq | C_ite | C_not | C_true | C_false | C_proof 7 | 8 | val bool : store -> t 9 | val proof : store -> t 10 | val c_not : store -> t 11 | val c_eq : store -> t 12 | val c_ite : store -> t 13 | val true_ : store -> t 14 | val false_ : store -> t 15 | val bool_val : store -> bool -> t 16 | val const_decoders : Const.decoders 17 | 18 | val eq : store -> t -> t -> t 19 | (** [eq a b] is [a = b] *) 20 | 21 | val not : store -> t -> t 22 | 23 | val ite : store -> t -> t -> t -> t 24 | (** [ite a b c] is [if a then b else c] *) 25 | 26 | val is_eq : t -> bool 27 | val is_bool : t -> bool 28 | 29 | val abs : store -> t -> bool * t 30 | (** [abs t] returns an "absolute value" for the term, along with the 31 | sign of [t]. 32 | 33 | The idea is that we want to turn [not a] into [(false, a)], 34 | or [(a != b)] into [(false, a=b)]. For terms without a negation this 35 | should return [(true, t)]. *) 36 | 37 | val as_bool_val : t -> bool option 38 | 39 | val open_eq : t -> (t * t) option 40 | (** [open_eq (a=b)] returns [Some (a,b)], [None] for other terms. *) 41 | -------------------------------------------------------------------------------- /src/core-logic/var.ml: -------------------------------------------------------------------------------- 1 | open Types_ 2 | 3 | type t = var = { v_name: string; v_ty: term } 4 | 5 | include Var_ 6 | 7 | let[@inline] name v = v.v_name 8 | let[@inline] ty self = self.v_ty 9 | let[@inline] pp out v1 = Fmt.string out v1.v_name 10 | let make v_name v_ty : t = { v_name; v_ty } 11 | let makef fmt ty = Fmt.kasprintf (fun s -> make s ty) fmt 12 | 13 | let pp_with_ty out v = 14 | Fmt.fprintf out "(@[%s :@ %a@])" v.v_name !Term_.pp_debug_ v.v_ty 15 | -------------------------------------------------------------------------------- /src/core-logic/var.mli: -------------------------------------------------------------------------------- 1 | (** Free variable *) 2 | 3 | open Types_ 4 | 5 | type t = var = { v_name: string; v_ty: term } 6 | 7 | include EQ_ORD_HASH_PRINT with type t := t 8 | 9 | val pp_with_ty : t Fmt.printer 10 | val make : string -> term -> t 11 | val makef : ('a, Format.formatter, unit, t) format4 -> term -> 'a 12 | val name : t -> string 13 | val ty : t -> term 14 | 15 | include WITH_SET_MAP_TBL with type t := t 16 | -------------------------------------------------------------------------------- /src/core/CC_view.ml: -------------------------------------------------------------------------------- 1 | type ('f, 't, 'ts) t = 2 | | Bool of bool 3 | | App_fun of 'f * 'ts 4 | | App_ho of 't * 't 5 | | If of 't * 't * 't 6 | | Eq of 't * 't 7 | | Not of 't 8 | | Opaque of 't 9 | (* do not enter *) 10 | 11 | let[@inline] map_view ~f_f ~f_t ~f_ts (v : _ t) : _ t = 12 | match v with 13 | | Bool b -> Bool b 14 | | App_fun (f, args) -> App_fun (f_f f, f_ts args) 15 | | App_ho (f, a) -> App_ho (f_t f, f_t a) 16 | | Not t -> Not (f_t t) 17 | | If (a, b, c) -> If (f_t a, f_t b, f_t c) 18 | | Eq (a, b) -> Eq (f_t a, f_t b) 19 | | Opaque t -> Opaque (f_t t) 20 | 21 | let[@inline] iter_view ~f_f ~f_t ~f_ts (v : _ t) : unit = 22 | match v with 23 | | Bool _ -> () 24 | | App_fun (f, args) -> 25 | f_f f; 26 | f_ts args 27 | | App_ho (f, a) -> 28 | f_t f; 29 | f_t a 30 | | Not t -> f_t t 31 | | If (a, b, c) -> 32 | f_t a; 33 | f_t b; 34 | f_t c 35 | | Eq (a, b) -> 36 | f_t a; 37 | f_t b 38 | | Opaque t -> f_t t 39 | -------------------------------------------------------------------------------- /src/core/CC_view.mli: -------------------------------------------------------------------------------- 1 | (** View terms through the lens of a Congruence Closure *) 2 | 3 | (** A view of a term fron the point of view of a congruence closure. 4 | 5 | - ['f] is the type of function symbols 6 | - ['t] is the type of terms 7 | - ['ts] is the type of sequences of terms (arguments of function application) 8 | *) 9 | type ('f, 't, 'ts) t = 10 | | Bool of bool 11 | | App_fun of 'f * 'ts 12 | | App_ho of 't * 't 13 | | If of 't * 't * 't 14 | | Eq of 't * 't 15 | | Not of 't 16 | | Opaque of 't (** do not enter *) 17 | 18 | val map_view : 19 | f_f:('a -> 'b) -> 20 | f_t:('c -> 'd) -> 21 | f_ts:('e -> 'f) -> 22 | ('a, 'c, 'e) t -> 23 | ('b, 'd, 'f) t 24 | (** Map function over a view, one level deep. 25 | Each function maps over a different type, e.g. [f_t] maps over terms *) 26 | 27 | val iter_view : 28 | f_f:('a -> unit) -> 29 | f_t:('b -> unit) -> 30 | f_ts:('c -> unit) -> 31 | ('a, 'b, 'c) t -> 32 | unit 33 | (** Iterate over a view, one level deep. *) 34 | -------------------------------------------------------------------------------- /src/core/Sidekick_core.ml: -------------------------------------------------------------------------------- 1 | (** Main Signatures. 2 | 3 | Theories and concrete solvers rely on an environment that defines 4 | several important types: 5 | 6 | - types 7 | - terms (to represent logic expressions and formulas) 8 | - a congruence closure instance 9 | - a bridge to some SAT solver 10 | 11 | In this module we define most of the main signatures used 12 | throughout Sidekick. 13 | *) 14 | 15 | module Fmt = CCFormat 16 | 17 | (** {2 Re-exports from core-logic} *) 18 | 19 | module Const = Sidekick_core_logic.Const 20 | module Str_const = Sidekick_core_logic.Str_const 21 | 22 | module Term = struct 23 | include Sidekick_core_logic.Term 24 | include Sidekick_core_logic.T_builtins 25 | include T_printer 26 | module Tracer = T_tracer 27 | module Trace_reader = T_trace_reader 28 | module Ref = T_ref 29 | end 30 | 31 | (** {2 view} *) 32 | 33 | module Bool_view = Bool_view 34 | module CC_view = CC_view 35 | module Default_cc_view = Default_cc_view 36 | 37 | (** {2 Main modules} *) 38 | 39 | module Bvar = Sidekick_core_logic.Bvar 40 | module Lit = Lit 41 | module Subst = Sidekick_core_logic.Subst 42 | module Var = Sidekick_core_logic.Var 43 | module Box = Box 44 | module Gensym = Gensym 45 | 46 | exception Resource_exhausted 47 | 48 | (** {2 Const decoders for traces} *) 49 | 50 | let const_decoders = 51 | List.flatten 52 | [ 53 | Sidekick_core_logic.T_builtins.const_decoders; 54 | T_ref.const_decoders; 55 | Box.const_decoders; 56 | ] 57 | -------------------------------------------------------------------------------- /src/core/bool_view.ml: -------------------------------------------------------------------------------- 1 | (** Boolean-oriented view of terms *) 2 | 3 | (** View *) 4 | type 'a t = 5 | | B_bool of bool 6 | | B_not of 'a 7 | | B_and of 'a list 8 | | B_or of 'a list 9 | | B_imply of 'a * 'a 10 | | B_equiv of 'a * 'a 11 | | B_xor of 'a * 'a 12 | | B_eq of 'a * 'a 13 | | B_neq of 'a * 'a 14 | | B_ite of 'a * 'a * 'a 15 | | B_atom of 'a 16 | -------------------------------------------------------------------------------- /src/core/box.ml: -------------------------------------------------------------------------------- 1 | open Sidekick_core_logic 2 | 3 | type Const.view += Box of Term.t 4 | 5 | let ops = 6 | let pp out = function 7 | | Box t -> Fmt.fprintf out "(@[box@ %a@])" Term.pp_debug t 8 | | _ -> assert false 9 | in 10 | 11 | let equal a b = 12 | match a, b with 13 | | Box a, Box b -> Term.equal a b 14 | | _ -> false 15 | in 16 | 17 | let hash = function 18 | | Box t -> Hash.(combine2 10 (Term.hash t)) 19 | | _ -> assert false 20 | in 21 | 22 | let ser ser_t = function 23 | | Box t -> "box", ser_t t 24 | | _ -> assert false 25 | in 26 | { Const.Ops.pp; equal; hash; ser } 27 | 28 | let const_decoders : Const.decoders = 29 | [ 30 | ( "box", 31 | ops, 32 | Ser_decode.( 33 | fun dec_t -> 34 | let+ t = dec_t in 35 | Box t) ); 36 | ] 37 | 38 | let as_box t = 39 | match Term.view t with 40 | | Term.E_const { Const.c_view = Box u; _ } -> Some u 41 | | _ -> None 42 | 43 | let is_box t = 44 | match Term.view t with 45 | | Term.E_const { Const.c_view = Box _; _ } -> true 46 | | _ -> false 47 | 48 | let box tst t : Term.t = 49 | match Term.view t with 50 | | Term.E_const { Const.c_view = _; _ } -> t 51 | | _ -> 52 | let c = Const.make (Box t) ~ty:(Term.ty t) ops in 53 | Term.const tst c 54 | -------------------------------------------------------------------------------- /src/core/box.mli: -------------------------------------------------------------------------------- 1 | open Sidekick_core_logic 2 | 3 | type Const.view += private Box of Term.t 4 | 5 | val box : Term.store -> Term.t -> Term.t 6 | (** [box tst t] makes a new constant that "boxes" [t]. 7 | This way it will be opaque. *) 8 | 9 | val const_decoders : Const.decoders 10 | val as_box : Term.t -> Term.t option 11 | val is_box : Term.t -> bool 12 | -------------------------------------------------------------------------------- /src/core/default_cc_view.ml: -------------------------------------------------------------------------------- 1 | open Sidekick_core_logic 2 | module View = CC_view 3 | 4 | let view_as_cc (t : Term.t) : _ CC_view.t = 5 | let f, args = Term.unfold_app t in 6 | match Term.view f, args with 7 | | Term.E_const { Const.c_view = T_builtins.C_eq; _ }, [ _; t; u ] -> 8 | View.Eq (t, u) 9 | | Term.E_const { Const.c_view = T_builtins.C_ite; _ }, [ _ty; a; b; c ] -> 10 | View.If (a, b, c) 11 | | Term.E_const { Const.c_view = T_builtins.C_not; _ }, [ a ] -> View.Not a 12 | | _ -> 13 | (match Term.view t with 14 | | Term.E_app (f, a) -> View.App_ho (f, a) 15 | | Term.E_const { Const.c_view = T_builtins.C_true; _ } -> View.Bool true 16 | | Term.E_const { Const.c_view = T_builtins.C_false; _ } -> View.Bool false 17 | | Term.E_app_fold _ -> View.Opaque t 18 | | _ -> View.Opaque t) 19 | -------------------------------------------------------------------------------- /src/core/default_cc_view.mli: -------------------------------------------------------------------------------- 1 | open Sidekick_core_logic 2 | 3 | val view_as_cc : Term.t -> (Const.t, Term.t, Term.t list) CC_view.t 4 | -------------------------------------------------------------------------------- /src/core/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name Sidekick_core) 3 | (public_name sidekick.core) 4 | (flags :standard -open Sidekick_util) 5 | (libraries containers iter sidekick.util sidekick.sigs sidekick.core-logic 6 | sidekick.trace)) 7 | -------------------------------------------------------------------------------- /src/core/gensym.mli: -------------------------------------------------------------------------------- 1 | (** Fresh symbol generation *) 2 | 3 | open Sidekick_core_logic 4 | 5 | type term = Term.t 6 | type ty = Term.t 7 | 8 | type t 9 | (** Fresh symbol generator. 10 | 11 | The theory needs to be able to create new terms with fresh names, 12 | to be used as placeholders for complex formulas during Tseitin 13 | encoding. *) 14 | 15 | val create : Term.store -> t 16 | (** New (stateful) generator instance. *) 17 | 18 | val const_decoders : Const.decoders 19 | 20 | val fresh_term : t -> pre:string -> ty -> term 21 | (** Make a fresh term of the given type *) 22 | 23 | val reset : t -> unit 24 | (** Reset to initial state *) 25 | -------------------------------------------------------------------------------- /src/core/t_printer.mli: -------------------------------------------------------------------------------- 1 | (** Extensible printer for {!Sidekick_core_logic.Term.t} *) 2 | 3 | type term = Sidekick_core_logic.Term.t 4 | 5 | type hook = recurse:term Fmt.printer -> Fmt.t -> term -> bool 6 | (** Printing hook, responsible for printing certain subterms *) 7 | 8 | module Hooks : sig 9 | type t 10 | 11 | val empty : t 12 | val add : hook -> t -> t 13 | end 14 | 15 | val default_hooks : Hooks.t ref 16 | 17 | val pp_with : Hooks.t -> term Fmt.printer 18 | (** Print using the hooks *) 19 | 20 | val pp : term Fmt.printer 21 | (** Print using {!default_hooks} *) 22 | 23 | val pp_limit : max_depth:int -> max_nodes:int -> term Fmt.printer 24 | (** Print with a limit on the number of nodes printed. An ellipsis is 25 | displayed otherwise. *) 26 | -------------------------------------------------------------------------------- /src/core/t_ref.ml: -------------------------------------------------------------------------------- 1 | (** Term reference *) 2 | 3 | open Sidekick_core_logic 4 | 5 | open struct 6 | module Tr = Sidekick_trace 7 | end 8 | 9 | type t = Tr.entry_id 10 | type Const.view += Ref of t 11 | 12 | let ops : Const.Ops.t = 13 | let pp out = function 14 | | Ref x -> Fmt.fprintf out "(@[ref %a@])" Tr.Entry_id.pp x 15 | | _ -> assert false 16 | in 17 | 18 | let equal a b = 19 | match a, b with 20 | | Ref a, Ref b -> Tr.Entry_id.equal a b 21 | | _ -> false 22 | in 23 | let hash = function 24 | | Ref a -> Hash.combine2 519 (Tr.Entry_id.hash a) 25 | | _ -> assert false 26 | in 27 | 28 | let ser _sink = function 29 | | Ref a -> "!", Ser_value.(int a) 30 | | _ -> assert false 31 | in 32 | { Const.Ops.equal; pp; hash; ser } 33 | 34 | let ref (tst : Term.store) (r : t) ~ty : Term.t = 35 | Term.const tst @@ Const.make (Ref r) ops ~ty 36 | 37 | let[@inline] as_ref t : t option = 38 | match Term.view t with 39 | | Term.E_const { Const.c_view = Ref r; _ } -> Some r 40 | | _ -> None 41 | 42 | let const_decoders : Const.decoders = 43 | [ 44 | ( "!", 45 | ops, 46 | Ser_decode.( 47 | fun _dec_term -> 48 | let+ i = int in 49 | Ref i) ); 50 | ] 51 | -------------------------------------------------------------------------------- /src/core/t_ref.mli: -------------------------------------------------------------------------------- 1 | (** Term reference *) 2 | 3 | open Sidekick_core_logic 4 | 5 | type t = Sidekick_trace.entry_id 6 | (** Reference to another term, by a unique ID in a trace. 7 | 8 | This allows a trace to contain terms with explicit references 9 | to other terms, but where these references have to be followed explicitly. 10 | Thus, each term can be deserialized separately. 11 | 12 | For example, a proof term for a given lemma might use references to previous 13 | lemmas, instead of their direct proof terms; this allows a checker or 14 | proof GUI to only read this particular lemma's proof into a term. 15 | *) 16 | 17 | type Const.view += private Ref of t 18 | 19 | val ref : Term.store -> t -> ty:Term.t -> Term.t 20 | (** [ref tst id ~ty] is the reference to entry [id] in a trace, 21 | which must be 22 | a term of type [ty]. *) 23 | 24 | val as_ref : Term.t -> t option 25 | (** [as_ref (ref tst id ~ty)] is [Some id]. *) 26 | 27 | val const_decoders : Const.decoders 28 | -------------------------------------------------------------------------------- /src/core/t_trace_reader.mli: -------------------------------------------------------------------------------- 1 | open Sidekick_core_logic 2 | module Tr = Sidekick_trace 3 | module Dec = Ser_decode 4 | 5 | type term_ref = Tr.entry_id 6 | type const_decoders = Const.decoders 7 | type t 8 | 9 | val create : 10 | ?const_decoders:const_decoders list -> source:Tr.Source.t -> Term.store -> t 11 | 12 | val store : t -> Term.store 13 | val add_const_decoders : t -> const_decoders -> unit 14 | val read_term : t -> term_ref -> (Term.t, string) result 15 | val read_term_err : t -> term_ref -> (Term.t, Ser_decode.Error.t) result 16 | 17 | val read_term_exn : t -> term_ref -> Term.t 18 | (** @raise Error.Error if it fails *) 19 | 20 | val deref_term : t -> Term.t -> Term.t 21 | (** [deref_term reader t] dereferences the root node of [t]. 22 | If [t] is [Ref id], this returns the term at [id] instead. 23 | @raise Error.Error if it fails *) 24 | -------------------------------------------------------------------------------- /src/core/t_tracer.mli: -------------------------------------------------------------------------------- 1 | (** Emit terms in traces. 2 | 3 | Traces will contains terms, encoded as a DAG. Each subterm is its own 4 | event, and gets a term identifier used in other subsequent entries 5 | to refer to it. 6 | *) 7 | 8 | open Sidekick_core_logic 9 | module Tr = Sidekick_trace 10 | 11 | type term_ref = T_ref.t 12 | 13 | class type t = 14 | object 15 | method emit_term : Term.t -> term_ref 16 | end 17 | 18 | (** Dummy implementation, returns {!Tr.Entry_id.dummy} *) 19 | class dummy : 20 | object 21 | inherit t 22 | method emit_term : Term.t -> term_ref 23 | end 24 | 25 | class concrete : sink:Tr.Sink.t -> t 26 | (** Concrete implementation of [t] *) 27 | 28 | val create : sink:Tr.Sink.t -> unit -> t 29 | (** [create ~sink ()] makes a tracer that will write terms 30 | into the given sink. *) 31 | 32 | val emit : #t -> Term.t -> term_ref 33 | val emit' : #t -> Term.t -> unit 34 | -------------------------------------------------------------------------------- /src/drup/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_drup) 3 | (public_name sidekick.drup) 4 | (synopsis "Checker for DRUP (propositional) proofs") 5 | (libraries sidekick.util containers iter) 6 | (flags :standard -warn-error -a+8 -open Sidekick_util)) 7 | -------------------------------------------------------------------------------- /src/main/dune: -------------------------------------------------------------------------------- 1 | ; main binary 2 | 3 | (executable 4 | (name main) 5 | (public_name sidekick) 6 | (package sidekick-bin) 7 | (modules main pure_sat_solver) 8 | (modes native) 9 | (libraries containers iter result sidekick.sat sidekick.core sidekick-base 10 | sidekick.smt-solver sidekick-base.smtlib sidekick.drup 11 | sidekick.memtrace sidekick-bin.lib) 12 | (flags :standard -safe-string -color always -open Sidekick_util)) 13 | 14 | (executable 15 | (name show_trace) 16 | (modules show_trace) 17 | (modes native) 18 | (libraries containers sidekick.util sidekick.core sidekick.trace 19 | sidekick.smt-solver sidekick.proof sidekick-base) 20 | (flags :standard -safe-string -color always -open Sidekick_util)) 21 | -------------------------------------------------------------------------------- /src/memtrace/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_memtrace) 3 | (public_name sidekick.memtrace) 4 | (synopsis "optional interface to memtrace") 5 | (libraries 6 | (select 7 | sidekick_memtrace.ml 8 | from 9 | (memtrace -> sidekick_memtrace.real.ml) 10 | (-> sidekick_memtrace.dummy.ml))) 11 | (flags :standard -warn-error -a+8)) 12 | -------------------------------------------------------------------------------- /src/memtrace/sidekick_memtrace.dummy.ml: -------------------------------------------------------------------------------- 1 | let trace_if_requested ?context:_ ?sampling_rate:_ () = () 2 | -------------------------------------------------------------------------------- /src/memtrace/sidekick_memtrace.mli: -------------------------------------------------------------------------------- 1 | val trace_if_requested : ?context:string -> ?sampling_rate:float -> unit -> unit 2 | -------------------------------------------------------------------------------- /src/memtrace/sidekick_memtrace.real.ml: -------------------------------------------------------------------------------- 1 | let trace_if_requested = Memtrace.trace_if_requested 2 | -------------------------------------------------------------------------------- /src/mini-cc/Sidekick_mini_cc.mli: -------------------------------------------------------------------------------- 1 | (** Mini congruence closure 2 | 3 | This implementation is as simple as possible, and doesn't provide 4 | backtracking, theories, or explanations. 5 | It just decides the satisfiability of a set of (dis)equations. 6 | *) 7 | 8 | open Sidekick_core 9 | 10 | (** Argument for the functor {!Make} 11 | 12 | It only requires a Term.t structure, and a congruence-oriented view. *) 13 | module type ARG = sig 14 | val view_as_cc : Term.t -> (Const.t, Term.t, Term.t list) CC_view.t 15 | end 16 | 17 | type t 18 | (** An instance of the congruence closure. Mutable *) 19 | 20 | val create : arg:(module ARG) -> Term.store -> t 21 | (** Instantiate the congruence closure for the given argument structure. *) 22 | 23 | val create_default : Term.store -> t 24 | (** Use the default cc view *) 25 | 26 | val clear : t -> unit 27 | (** Fully reset the congruence closure's state *) 28 | 29 | val add_lit : t -> Term.t -> bool -> unit 30 | (** [add_lit cc p sign] asserts that [p] is true if [sign], 31 | or [p] is false if [not sign]. If [p] is an equation and [sign] 32 | is [true], this adds a new equation to the congruence relation. *) 33 | 34 | val check_sat : t -> bool 35 | (** [check_sat cc] returns [true] if the current state is satisfiable, [false] 36 | if it's unsatisfiable. *) 37 | 38 | val classes : t -> Term.t Iter.t Iter.t 39 | (** Traverse the set of classes in the congruence closure. 40 | This should be called only if {!check} returned [Sat]. *) 41 | -------------------------------------------------------------------------------- /src/mini-cc/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name Sidekick_mini_cc) 3 | (public_name sidekick.mini-cc) 4 | (libraries containers iter sidekick.cc sidekick.core sidekick.util) 5 | (flags :standard -warn-error -a+8 -w -32 -open Sidekick_util)) 6 | -------------------------------------------------------------------------------- /src/proof/core_rules.ml: -------------------------------------------------------------------------------- 1 | (* FIXME 2 | open Proof_trace 3 | 4 | type lit = Lit.t 5 | *) 6 | 7 | type lit = Lit.t 8 | 9 | let lemma_cc lits : Pterm.t = Pterm.apply_rule ~lits "core.lemma-cc" 10 | let define_term t1 t2 = Pterm.apply_rule ~terms:[ t1; t2 ] "core.define-term" 11 | let proof_r1 p1 p2 = Pterm.apply_rule ~premises:[ p1; p2 ] "core.r1" 12 | let proof_p1 p1 p2 = Pterm.apply_rule ~premises:[ p1; p2 ] "core.p1" 13 | 14 | let proof_res ~pivot p1 p2 = 15 | Pterm.apply_rule ~terms:[ pivot ] ~premises:[ p1; p2 ] "core.res" 16 | 17 | let with_defs pr defs = Pterm.apply_rule ~premises:(pr :: defs) "core.with-defs" 18 | let lemma_true t = Pterm.apply_rule ~terms:[ t ] "core.true" 19 | 20 | let lemma_preprocess t1 t2 ~using = 21 | Pterm.apply_rule ~terms:[ t1; t2 ] ~premises:using "core.preprocess" 22 | 23 | let lemma_rw_clause pr ~res ~using = 24 | Pterm.apply_rule ~premises:(pr :: using) ~lits:res "core.rw-clause" 25 | -------------------------------------------------------------------------------- /src/proof/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_proof) 3 | (public_name sidekick.proof) 4 | (flags :standard -open Sidekick_util -open Sidekick_core) 5 | (libraries sidekick.core sidekick.trace)) 6 | -------------------------------------------------------------------------------- /src/proof/pterm.mli: -------------------------------------------------------------------------------- 1 | (** Proof terms. 2 | 3 | A proof term is the description of a reasoning step, that yields a clause. *) 4 | 5 | type step_id = Step.id 6 | type lit = Lit.t 7 | 8 | type local_ref = Step.id 9 | (** A local reference is a step id that is only valid in the scope 10 | of a {!P_let}. Typically one can use negative integers to avoid 11 | accidental shadowing. *) 12 | 13 | type rule_apply = { 14 | rule_name: string; 15 | lit_args: lit list; 16 | term_args: Term.t list; 17 | subst_args: Subst.t list; 18 | premises: step_id list; 19 | indices: int list; 20 | } 21 | 22 | type t = 23 | | P_ref of step_id 24 | | P_local of local_ref (** Local reference, in a let *) 25 | | P_let of (local_ref * t) list * t 26 | | P_apply of rule_apply 27 | 28 | type delayed = unit -> t 29 | 30 | include Sidekick_sigs.PRINT with type t := t 31 | 32 | val ref : step_id -> t 33 | val local_ref : local_ref -> t 34 | val let_ : (local_ref * t) list -> t -> t 35 | val delay : (unit -> t) -> delayed 36 | 37 | val dummy : t 38 | (** Reference to the dummy step *) 39 | 40 | val apply_rule : 41 | ?lits:lit list -> 42 | ?terms:Term.t list -> 43 | ?substs:Subst.t list -> 44 | ?premises:step_id list -> 45 | ?indices:int list -> 46 | string -> 47 | t 48 | 49 | val to_ser : Term.Tracer.t -> t -> Ser_value.t 50 | (** Serialize *) 51 | 52 | val deser : Term.Trace_reader.t -> t Ser_decode.t 53 | -------------------------------------------------------------------------------- /src/proof/sat_rules.ml: -------------------------------------------------------------------------------- 1 | let name_sat_input = "sat.input" 2 | let name_redundant_clause = "sat.rc" 3 | let name_unsat_core = "sat.uc" 4 | 5 | type lit = Lit.t 6 | 7 | let sat_input_clause lits : Pterm.t = Pterm.apply_rule name_sat_input ~lits 8 | 9 | let sat_redundant_clause lits ~hyps : Pterm.t = 10 | Pterm.apply_rule name_redundant_clause ~lits ~premises:(Iter.to_rev_list hyps) 11 | 12 | let sat_unsat_core lits : Pterm.t = Pterm.apply_rule ~lits name_unsat_core 13 | -------------------------------------------------------------------------------- /src/proof/sat_rules.mli: -------------------------------------------------------------------------------- 1 | (** SAT-solver proof emission. *) 2 | 3 | type lit = Lit.t 4 | 5 | val sat_input_clause : lit list -> Pterm.t 6 | (** Emit an input clause. *) 7 | 8 | val sat_redundant_clause : lit list -> hyps:Step.id Iter.t -> Pterm.t 9 | (** Emit a clause deduced by the SAT solver, redundant wrt previous clauses. 10 | The clause must be RUP wrt [hyps]. *) 11 | 12 | val sat_unsat_core : lit list -> Pterm.t 13 | (** TODO: is this relevant here? *) 14 | -------------------------------------------------------------------------------- /src/proof/sidekick_proof.ml: -------------------------------------------------------------------------------- 1 | module Step = Step 2 | module Step_vec = Step_vec 3 | module Sat_rules = Sat_rules 4 | module Core_rules = Core_rules 5 | module Pterm = Pterm 6 | module Tracer = Tracer 7 | module Trace_reader = Trace_reader 8 | module Arg = Arg 9 | 10 | type term = Pterm.t 11 | type term_ref = Step.id 12 | type step_id = Step.id 13 | -------------------------------------------------------------------------------- /src/proof/step.ml: -------------------------------------------------------------------------------- 1 | type id = Sidekick_trace.Entry_id.t 2 | 3 | let equal (a : id) (b : id) = a = b 4 | let dummy : id = Sidekick_trace.Entry_id.dummy 5 | let pp : id Fmt.printer = Fmt.int 6 | -------------------------------------------------------------------------------- /src/proof/step_vec.ml: -------------------------------------------------------------------------------- 1 | type elt = Step.id 2 | type t = elt Vec.t 3 | 4 | let get = Vec.get 5 | let size = Vec.size 6 | let iter = Vec.iter 7 | let iteri = Vec.iteri 8 | let create ?cap:_ () = Vec.create () 9 | let clear = Vec.clear 10 | let copy = Vec.copy 11 | let is_empty = Vec.is_empty 12 | let push = Vec.push 13 | let fast_remove = Vec.fast_remove 14 | let filter_in_place = Vec.filter_in_place 15 | let ensure_size v len = Vec.ensure_size v ~elt:0 len 16 | let pop = Vec.pop_exn 17 | let set = Vec.set 18 | let shrink = Vec.shrink 19 | let to_iter = Vec.to_iter 20 | -------------------------------------------------------------------------------- /src/proof/step_vec.mli: -------------------------------------------------------------------------------- 1 | (** A vector indexed by steps. *) 2 | 3 | include Vec_sig.BASE with type elt = Step.id 4 | -------------------------------------------------------------------------------- /src/proof/trace_reader.ml: -------------------------------------------------------------------------------- 1 | open Sidekick_core 2 | module Tr = Sidekick_trace 3 | module Dec = Ser_decode 4 | open Dec.Infix 5 | 6 | type step_id = Step.id 7 | type t = { src: Tr.Source.t; t_reader: Term.Trace_reader.t } 8 | 9 | let create ~src t_reader : t = { src; t_reader } 10 | 11 | let rec read_step ?(fix = false) (self : t) (id : step_id) : _ result = 12 | match Tr.Source.get_entry self.src id with 13 | | Some ("Pt", v) -> 14 | let res = Dec.run (Pterm.deser self.t_reader) v in 15 | (match res with 16 | | Ok (Pterm.P_ref id') when fix -> 17 | (* read reference recursively *) 18 | read_step ~fix self id' 19 | | _ -> res) 20 | | None -> 21 | Error (Dec.Error.of_string "unknown source entry" (Ser_value.int id)) 22 | | Some (tag, _) -> 23 | Error 24 | (Dec.Error.of_string "expected proof term, wrong tag" 25 | (Ser_value.string tag)) 26 | 27 | let dec_step_id ?fix (self : t) = 28 | let* id = Dec.int in 29 | read_step ?fix self id |> Dec.return_result_err 30 | -------------------------------------------------------------------------------- /src/proof/trace_reader.mli: -------------------------------------------------------------------------------- 1 | open Sidekick_core 2 | module Tr = Sidekick_trace 3 | module Dec = Ser_decode 4 | 5 | type step_id = Step.id 6 | type t 7 | 8 | val create : src:Tr.Source.t -> Term.Trace_reader.t -> t 9 | 10 | val read_step : ?fix:bool -> t -> step_id -> (Pterm.t, Dec.Error.t) result 11 | (** Read a step from the source at the given step id, using the trace reader. 12 | @param fix if true, dereferences in a loop so the returned proof term is 13 | not a Ref. *) 14 | 15 | val dec_step_id : ?fix:bool -> t -> Pterm.t Dec.t 16 | (** Reads an integer, decodes the corresponding entry *) 17 | -------------------------------------------------------------------------------- /src/quip/Sidekick_quip.mli: -------------------------------------------------------------------------------- 1 | (** Proofs of unsatisfiability in the Quip proof format.. 2 | 3 | This targets {{: https://c-cube.github.io/quip-book/ } Quip} 4 | as an {b experimental} proof backend. 5 | *) 6 | 7 | module Proof = Proof 8 | 9 | type t = Proof.t 10 | (** The state holding the whole proof. *) 11 | 12 | (** What format to use to serialize the proof? *) 13 | type out_format = 14 | | Sexp (** S-expressions *) 15 | | CSexp (** Canonical S-expressions *) 16 | 17 | val pp_out_format : out_format Fmt.printer 18 | val output : ?fmt:out_format -> out_channel -> t -> unit 19 | val pp_debug : t Fmt.printer 20 | -------------------------------------------------------------------------------- /src/quip/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_quip) 3 | (public_name sidekick.quip) 4 | (libraries sidekick.util) 5 | (flags :standard -warn-error -a+8 -w -37 -open Sidekick_util)) 6 | -------------------------------------------------------------------------------- /src/sat/.gitignore: -------------------------------------------------------------------------------- 1 | _build/ 2 | *.annot 3 | *.native 4 | *.log 5 | *.status 6 | .*.swp 7 | .session 8 | *.docdir 9 | src/util/log.ml 10 | doc/index.html 11 | *.exe 12 | .merlin 13 | *.install 14 | -------------------------------------------------------------------------------- /src/sat/Sidekick_sat.ml: -------------------------------------------------------------------------------- 1 | (** Main API *) 2 | 3 | include Sigs 4 | module Solver = Solver 5 | module Tracer = Tracer 6 | include Solver 7 | -------------------------------------------------------------------------------- /src/sat/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_sat) 3 | (public_name sidekick.sat) 4 | (synopsis "Pure OCaml SAT solver implementation for sidekick") 5 | (private_modules heap heap_intf base_types_) 6 | (libraries iter sidekick.util sidekick.core sidekick.proof) 7 | (flags :standard -w +32 -open Sidekick_util)) 8 | -------------------------------------------------------------------------------- /src/sat/heap.mli: -------------------------------------------------------------------------------- 1 | module type RANKED = Heap_intf.RANKED 2 | module type S = Heap_intf.S 3 | 4 | module Make (X : RANKED) : S with type elt = X.t and type elt_store = X.store 5 | -------------------------------------------------------------------------------- /src/sat/tracer.ml: -------------------------------------------------------------------------------- 1 | open Sidekick_core 2 | module Tr = Sidekick_trace 3 | module Proof = Sidekick_proof 4 | 5 | class type t = 6 | object 7 | inherit Proof.Tracer.t 8 | 9 | method sat_assert_clause : 10 | id:int -> Lit.t Iter.t -> Proof.Step.id -> Tr.Entry_id.t 11 | 12 | method sat_delete_clause : id:int -> Lit.t Iter.t -> unit 13 | method sat_unsat_clause : id:int -> Tr.Entry_id.t 14 | method sat_encode_lit : Lit.t -> Ser_value.t 15 | end 16 | 17 | class dummy : t = 18 | object 19 | inherit Proof.Tracer.dummy 20 | method sat_assert_clause ~id:_ _ _ = Tr.Entry_id.dummy 21 | method sat_delete_clause ~id:_ _ = () 22 | method sat_unsat_clause ~id:_ = Tr.Entry_id.dummy 23 | method sat_encode_lit _ = Ser_value.null 24 | end 25 | 26 | let dummy : t = new dummy 27 | 28 | let assert_clause (self : #t) ~id c p : Tr.Entry_id.t = 29 | self#sat_assert_clause ~id c p 30 | 31 | let assert_clause' (self : #t) ~id c p : unit = 32 | ignore (self#sat_assert_clause ~id c p : Tr.Entry_id.t) 33 | 34 | let unsat_clause (self : #t) ~id : Tr.Entry_id.t = self#sat_unsat_clause ~id 35 | 36 | let unsat_clause' (self : #t) ~id : unit = 37 | ignore (self#sat_unsat_clause ~id : Tr.Entry_id.t) 38 | 39 | let delete_clause (self : #t) ~id c = self#sat_delete_clause ~id c 40 | let encode_lit (self : #t) lit = self#sat_encode_lit lit 41 | -------------------------------------------------------------------------------- /src/sat/tracer.mli: -------------------------------------------------------------------------------- 1 | (** Tracer for clauses and literals *) 2 | 3 | open Sidekick_core 4 | module Tr = Sidekick_trace 5 | module Proof = Sidekick_proof 6 | 7 | (** Tracer for the SAT solver. *) 8 | class type t = 9 | object 10 | inherit Proof.Tracer.t 11 | 12 | method sat_assert_clause : 13 | id:int -> Lit.t Iter.t -> Proof.Step.id -> Tr.Entry_id.t 14 | 15 | method sat_delete_clause : id:int -> Lit.t Iter.t -> unit 16 | method sat_unsat_clause : id:int -> Tr.Entry_id.t 17 | method sat_encode_lit : Lit.t -> Ser_value.t 18 | end 19 | 20 | class dummy : t 21 | 22 | val dummy : t 23 | (** Dummy tracer, recording nothing. *) 24 | 25 | val assert_clause : 26 | #t -> id:int -> Lit.t Iter.t -> Proof.Step.id -> Tr.Entry_id.t 27 | 28 | val assert_clause' : #t -> id:int -> Lit.t Iter.t -> Proof.Step.id -> unit 29 | val delete_clause : #t -> id:int -> Lit.t Iter.t -> unit 30 | val unsat_clause : #t -> id:int -> Tr.Entry_id.t 31 | val unsat_clause' : #t -> id:int -> unit 32 | val encode_lit : #t -> Lit.t -> Ser_value.t 33 | -------------------------------------------------------------------------------- /src/sigs/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_sigs) 3 | (public_name sidekick.sigs) 4 | (libraries containers iter)) 5 | -------------------------------------------------------------------------------- /src/simplify/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name Sidekick_simplify) 3 | (public_name sidekick.simplify) 4 | (synopsis "Simplifier") 5 | (libraries containers iter sidekick.core sidekick.util sidekick.proof) 6 | (flags :standard -w +32 -open Sidekick_util)) 7 | -------------------------------------------------------------------------------- /src/simplify/sidekick_simplify.mli: -------------------------------------------------------------------------------- 1 | (** Term simplifier *) 2 | 3 | open Sidekick_core 4 | 5 | type t 6 | 7 | val tst : t -> Term.store 8 | 9 | val create : Term.store -> proof:#Sidekick_proof.Tracer.t -> t 10 | (** Create a simplifier *) 11 | 12 | val clear : t -> unit 13 | (** Reset internal cache, etc. *) 14 | 15 | val proof : t -> Sidekick_proof.Tracer.t 16 | (** Access proof *) 17 | 18 | type hook = t -> Term.t -> (Term.t * Sidekick_proof.Step.id Iter.t) option 19 | (** Given a Term.t, try to simplify it. Return [None] if it didn't change. 20 | 21 | A simple example could be a hook that takes a Term.t [t], 22 | and if [t] is [app "+" (const x) (const y)] where [x] and [y] are number, 23 | returns [Some (const (x+y))], and [None] otherwise. 24 | 25 | The simplifier will take care of simplifying the resulting Term.t further, 26 | caching (so that work is not duplicated in subterms), etc. 27 | *) 28 | 29 | val add_hook : t -> hook -> unit 30 | 31 | val normalize : t -> Term.t -> (Term.t * Sidekick_proof.Step.id) option 32 | (** Normalize a Term.t using all the hooks. This performs 33 | a fixpoint, i.e. it only stops when no hook applies anywhere inside 34 | the Term.t. *) 35 | 36 | val normalize_t : t -> Term.t -> Term.t * Sidekick_proof.Step.id option 37 | (** Normalize a Term.t using all the hooks, along with a proof that the 38 | simplification is correct. 39 | returns [t, ø] if no simplification occurred. *) 40 | -------------------------------------------------------------------------------- /src/smt/Sidekick_smt_solver.ml: -------------------------------------------------------------------------------- 1 | (** Core of the SMT solver using Sidekick_sat 2 | 3 | Sidekick_sat (in src/sat/) is a modular SAT solver in 4 | pure OCaml. 5 | 6 | This builds a SMT solver on top of it. 7 | *) 8 | 9 | module Sigs = Sigs 10 | module Model_builder = Model_builder 11 | module Registry = Registry 12 | module Solver_internal = Solver_internal 13 | module Solver = Solver 14 | module Model = Model 15 | module Theory = Theory 16 | module Theory_id = Theory_id 17 | module Preprocess = Preprocess 18 | module Find_foreign = Find_foreign 19 | module Tracer = Tracer 20 | module Trace_reader = Trace_reader 21 | 22 | type theory = Theory.t 23 | type solver = Solver.t 24 | -------------------------------------------------------------------------------- /src/smt/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name Sidekick_smt_solver) 3 | (public_name sidekick.smt-solver) 4 | (synopsis "main SMT solver") 5 | (libraries containers iter sidekick.core sidekick.util sidekick.cc 6 | sidekick.sat sidekick.abstract-solver sidekick.simplify sidekick.proof 7 | sidekick.trace) 8 | (flags :standard -w +32 -open Sidekick_util)) 9 | -------------------------------------------------------------------------------- /src/smt/find_foreign.mli: -------------------------------------------------------------------------------- 1 | (** Find foreign variables. 2 | 3 | This module is a modular discoverer of foreign variables (and boolean terms). 4 | It should run after preprocessing of terms. 5 | *) 6 | 7 | open Sidekick_core 8 | 9 | module type ACTIONS = sig 10 | val declare_need_th_combination : Term.t -> unit 11 | (** Declare that this term is a foreign variable in some other subterm. *) 12 | 13 | val add_lit_for_bool_term : ?default_pol:bool -> Term.t -> unit 14 | (** Add the (boolean) term to the SAT solver *) 15 | end 16 | 17 | type actions = (module ACTIONS) 18 | type t 19 | type hook = actions -> is_sub:bool -> Term.t -> unit 20 | 21 | val create : unit -> t 22 | 23 | val add_hook : t -> hook -> unit 24 | (** Register a hook to detect foreign subterms *) 25 | 26 | val traverse_term : t -> actions -> Term.t -> unit 27 | (** Traverse subterms of this term to detect foreign variables 28 | and boolean subterms. *) 29 | -------------------------------------------------------------------------------- /src/smt/model.ml: -------------------------------------------------------------------------------- 1 | (** SMT models. 2 | 3 | The solver models are partially evaluated; the frontend might ask 4 | for values for terms not explicitly present in them. 5 | 6 | *) 7 | 8 | open Sigs 9 | 10 | type t = { eval: Term.t -> value option; map: value Term.Map.t } 11 | 12 | let is_empty self = Term.Map.is_empty self.map 13 | 14 | let eval (self : t) (t : Term.t) : value option = 15 | try Some (Term.Map.find t self.map) with Not_found -> self.eval t 16 | 17 | let pp out (self : t) = 18 | if is_empty self then 19 | Fmt.string out "(model)" 20 | else ( 21 | let pp_pair out (t, v) = 22 | Fmt.fprintf out "(@[<1>%a@ := %a@])" Term.pp t Term.pp v 23 | in 24 | Fmt.fprintf out "(@[model@ %a@])" (Util.pp_iter pp_pair) 25 | (Term.Map.to_iter self.map) 26 | ) 27 | -------------------------------------------------------------------------------- /src/smt/model_builder.mli: -------------------------------------------------------------------------------- 1 | (** Model Builder. 2 | 3 | This contains a partial model, in construction. It is accessible to every 4 | theory, so they can contribute partial values. 5 | 6 | TODO: seen values? 7 | *) 8 | 9 | open Sigs 10 | 11 | type t 12 | 13 | include Sidekick_sigs.PRINT with type t := t 14 | 15 | val create : Term.store -> t 16 | val mem : t -> Term.t -> bool 17 | 18 | val require_eval : t -> Term.t -> unit 19 | (** Require that this term gets a value, and assign it to all terms 20 | in the given class. *) 21 | 22 | val add : t -> ?subs:Term.t list -> Term.t -> value -> unit 23 | (** Add a value to the model. 24 | @param subs if provided, these terms will be passed to {!require_eval} 25 | to ensure they map to a value. *) 26 | 27 | val gensym : t -> pre:string -> ty:Term.t -> Term.t 28 | (** New fresh constant *) 29 | 30 | type eval_cache = Term.Internal_.cache 31 | 32 | val create_cache : int -> eval_cache 33 | val eval : ?cache:eval_cache -> t -> Term.t -> value 34 | val eval_opt : ?cache:eval_cache -> t -> Term.t -> value option 35 | 36 | val pop_required : t -> Term.t option 37 | (** gives the next subterm that is required but has no value yet *) 38 | 39 | val to_map : ?cache:eval_cache -> t -> value Term.Map.t 40 | -------------------------------------------------------------------------------- /src/smt/registry.ml: -------------------------------------------------------------------------------- 1 | (* registry keys *) 2 | module type KEY = sig 3 | type elt 4 | 5 | val id : int 6 | 7 | exception E of elt 8 | end 9 | 10 | type 'a key = (module KEY with type elt = 'a) 11 | type t = { tbl: exn Util.Int_tbl.t } [@@unboxed] 12 | 13 | let create () : t = { tbl = Util.Int_tbl.create 8 } 14 | 15 | (* TODO: use atomic *) 16 | let n_ = ref 0 17 | 18 | let create_key (type a) () : a key = 19 | let id = !n_ in 20 | incr n_; 21 | let module K = struct 22 | type elt = a 23 | 24 | exception E of a 25 | 26 | let id = id 27 | end in 28 | (module K) 29 | 30 | let get (type a) (self : t) (k : a key) : _ option = 31 | let (module K : KEY with type elt = a) = k in 32 | match Util.Int_tbl.get self.tbl K.id with 33 | | Some (K.E x) -> Some x 34 | | _ -> None 35 | 36 | let set (type a) (self : t) (k : a key) (v : a) : unit = 37 | let (module K) = k in 38 | Util.Int_tbl.replace self.tbl K.id (K.E v) 39 | -------------------------------------------------------------------------------- /src/smt/registry.mli: -------------------------------------------------------------------------------- 1 | (** Registry to extract values *) 2 | 3 | type t 4 | type 'a key 5 | 6 | val create_key : unit -> 'a key 7 | (** Call this statically, typically at program initialization, for 8 | each distinct key. *) 9 | 10 | val create : unit -> t 11 | val get : t -> 'a key -> 'a option 12 | val set : t -> 'a key -> 'a -> unit 13 | -------------------------------------------------------------------------------- /src/smt/sigs.ml: -------------------------------------------------------------------------------- 1 | (** Signature for the main SMT solver types. 2 | 3 | Theories and concrete solvers rely on an environment that defines 4 | several important types: 5 | 6 | - sorts 7 | - terms (to represent logic expressions and formulas) 8 | - a congruence closure instance 9 | - a bridge to some SAT solver 10 | 11 | In this module we collect signatures defined elsewhere and define 12 | the module types for the main SMT solver. 13 | *) 14 | 15 | include Sidekick_core 16 | module Simplify = Sidekick_simplify 17 | module CC = Sidekick_cc.CC 18 | module E_node = Sidekick_cc.E_node 19 | module CC_expl = Sidekick_cc.Expl 20 | module Proof = Sidekick_proof 21 | 22 | type term = Term.t 23 | type ty = term 24 | type value = Term.t 25 | type lit = Lit.t 26 | type term_store = Term.store 27 | type step_id = Sidekick_proof.Step.id 28 | 29 | (* actions from the sat solver *) 30 | type sat_acts = Sidekick_sat.acts 31 | 32 | type th_combination_conflict = { 33 | lits: lit list; 34 | semantic: (bool * term * term) list; 35 | (* set of semantic eqns/diseqns (ie true only in current model) *) 36 | } 37 | (** Conflict obtained during theory combination. It involves equalities 38 | merged because of the current model so it's not a "true" conflict 39 | and doesn't need to kill the current trail. *) 40 | 41 | (** Argument to pass to the functor {!Make} in order to create a 42 | new Msat-based SMT solver. *) 43 | module type ARG = sig 44 | val view_as_cc : Sidekick_cc.view_as_cc 45 | end 46 | -------------------------------------------------------------------------------- /src/smt/th_combination.mli: -------------------------------------------------------------------------------- 1 | (** Delayed Theory Combination *) 2 | 3 | open Sidekick_core 4 | 5 | type t 6 | 7 | val create : ?stat:Stat.t -> Term.store -> t 8 | 9 | val add_term_needing_combination : t -> Term.t -> unit 10 | (** [add_term_needing_combination self t] means that [t] occurs as a foreign 11 | variable in another term, so it is important that its theory, and the 12 | theory in which it occurs, agree on it being equal to other 13 | foreign terms. *) 14 | 15 | val pop_new_lits : t -> Lit.t list 16 | (** Get the new literals that the solver needs to decide, so that the 17 | SMT solver gives each theory the same partition of interface equalities. *) 18 | -------------------------------------------------------------------------------- /src/smt/theory_id.ml: -------------------------------------------------------------------------------- 1 | include CCInt 2 | 3 | type state = int ref 4 | 5 | let create () = ref 1 6 | 7 | let fresh (self : state) = 8 | let n = !self in 9 | incr self; 10 | n 11 | 12 | module Set = Util.Int_set 13 | -------------------------------------------------------------------------------- /src/smt/theory_id.mli: -------------------------------------------------------------------------------- 1 | type t = private int 2 | 3 | include Sidekick_sigs.EQ_ORD_HASH_PRINT with type t := t 4 | 5 | type state 6 | 7 | val create : unit -> state 8 | val fresh : state -> t 9 | 10 | module Set : CCSet.S with type elt = t 11 | -------------------------------------------------------------------------------- /src/smt/trace_reader.mli: -------------------------------------------------------------------------------- 1 | (** Read trace *) 2 | 3 | open Sidekick_core 4 | module Proof = Sidekick_proof 5 | module Tr = Sidekick_trace 6 | 7 | type entry = 8 | | Assert of Term.t 9 | | Assert_clause of { id: int; c: Lit.t list; p: Proof.Pterm.t option } 10 | 11 | val pp_entry : entry Fmt.printer 12 | 13 | type t 14 | 15 | val create : 16 | ?const_decoders:Const.decoders list -> Term.store -> Tr.Source.t -> t 17 | 18 | val add_const_decoders : t -> Const.decoders -> unit 19 | val term_trace_reader : t -> Term.Trace_reader.t 20 | val decode : t -> tag:string -> Ser_value.t -> entry option 21 | val decode_entry : t -> Tr.Entry_id.t -> entry option 22 | -------------------------------------------------------------------------------- /src/smt/tracer.mli: -------------------------------------------------------------------------------- 1 | (** Tracer for SMT solvers. 2 | 3 | The tracer is used to track clauses and terms used or deduced during proof 4 | search. *) 5 | 6 | open Sidekick_core 7 | module Tr = Sidekick_trace 8 | module Proof = Sidekick_proof 9 | 10 | class type t = 11 | object 12 | inherit Term.Tracer.t 13 | inherit Sidekick_sat.Tracer.t 14 | inherit Sidekick_proof.Tracer.t 15 | 16 | method emit_assert_term : Term.t -> Tr.Entry_id.t 17 | (** Emit an assertion *) 18 | end 19 | 20 | class dummy : t 21 | (** Dummy tracer *) 22 | 23 | class concrete : Tr.Sink.t -> t 24 | (** Tracer emitting to a sink *) 25 | 26 | val dummy : t 27 | val make : sink:Tr.Sink.t -> unit -> t 28 | val assert_term : #t -> Term.t -> Tr.Entry_id.t 29 | val assert_term' : #t -> Term.t -> unit 30 | 31 | val assert_clause : 32 | #t -> id:int -> Lit.t Iter.t -> Proof.Step.id -> Tr.Entry_id.t 33 | 34 | val assert_clause' : #t -> id:int -> Lit.t Iter.t -> Proof.Step.id -> unit 35 | val delete_clause : #t -> id:int -> Lit.t Iter.t -> unit 36 | val unsat_clause : #t -> id:int -> Tr.Entry_id.t 37 | val unsat_clause' : #t -> id:int -> unit 38 | val encode_lit : #t -> Lit.t -> Ser_value.t 39 | -------------------------------------------------------------------------------- /src/smtlib/Driver.mli: -------------------------------------------------------------------------------- 1 | (** Driver. 2 | 3 | The driver is responsible for processing statements from a SMTLIB file, 4 | and interacting with the solver based on the statement (asserting formulas, 5 | calling "solve", etc.) 6 | *) 7 | 8 | module Asolver = Solver.Asolver 9 | open Sidekick_base 10 | 11 | val th_bool_dyn : Solver.theory 12 | val th_bool_static : Solver.theory 13 | val th_bool : Config.t -> Solver.theory 14 | val th_data : Solver.theory 15 | val th_lra : Solver.theory 16 | val th_ty_unin : Solver.theory 17 | 18 | type 'a or_error = ('a, string) CCResult.t 19 | 20 | type t 21 | (** The SMTLIB driver *) 22 | 23 | val create : 24 | ?pp_cnf:bool -> 25 | ?proof_file:string -> 26 | ?pp_model:bool -> 27 | ?check:bool -> 28 | ?time:float -> 29 | ?memory:float -> 30 | ?progress:bool -> 31 | Asolver.t -> 32 | t 33 | 34 | val process_stmt : t -> Statement.t -> unit or_error 35 | -------------------------------------------------------------------------------- /src/smtlib/Sidekick_smtlib.ml: -------------------------------------------------------------------------------- 1 | module Loc = Smtlib_utils.V_2_6.Loc 2 | module Parse_ast = Smtlib_utils.V_2_6.Ast 3 | module Driver = Driver 4 | module Solver = Solver 5 | module Term = Sidekick_base.Term 6 | module Stmt = Sidekick_base.Statement 7 | module Check_cc = Check_cc 8 | module Model = Model 9 | 10 | type 'a or_error = ('a, string) CCResult.t 11 | 12 | module Parse = struct 13 | let parse_chan_exn ?(filename = "") ic = 14 | let lexbuf = Lexing.from_channel ic in 15 | Loc.set_file lexbuf filename; 16 | Smtlib_utils.V_2_6.(Parser.parse_list Lexer.token) lexbuf 17 | 18 | let parse_file_exn file : Parse_ast.statement list = 19 | CCIO.with_in file (parse_chan_exn ~filename:file) 20 | 21 | let parse_file_exn ctx file : Stmt.t list = 22 | (* delegate parsing to [Tip_parser] *) 23 | parse_file_exn file |> CCList.flat_map (Typecheck.conv_statement ctx) 24 | 25 | let parse tst file = 26 | let ctx = Typecheck.Ctx.create tst in 27 | try Result.Ok (parse_file_exn ctx file) 28 | with e -> Result.Error (Printexc.to_string e) 29 | 30 | let parse_stdin tst = 31 | let ctx = Typecheck.Ctx.create tst in 32 | try 33 | parse_chan_exn ~filename:"" stdin 34 | |> CCList.flat_map (Typecheck.conv_statement ctx) 35 | |> CCResult.return 36 | with e -> Result.Error (Printexc.to_string e) 37 | end 38 | 39 | let parse = Parse.parse 40 | let parse_stdin = Parse.parse_stdin 41 | -------------------------------------------------------------------------------- /src/smtlib/Sidekick_smtlib.mli: -------------------------------------------------------------------------------- 1 | (** SMTLib-2.6 Driver *) 2 | 3 | (** This library provides a parser, a type-checker, and a driver 4 | for processing SMTLib-2 problems. 5 | *) 6 | 7 | type 'a or_error = ('a, string) CCResult.t 8 | 9 | module Term = Sidekick_base.Term 10 | module Stmt = Sidekick_base.Statement 11 | module Driver = Driver 12 | module Solver = Solver 13 | module Check_cc = Check_cc 14 | module Model = Model 15 | 16 | val parse : Term.store -> string -> Stmt.t list or_error 17 | val parse_stdin : Term.store -> Stmt.t list or_error 18 | -------------------------------------------------------------------------------- /src/smtlib/Typecheck.mli: -------------------------------------------------------------------------------- 1 | (** Typing AST *) 2 | 3 | module Loc = Smtlib_utils.V_2_6.Loc 4 | module PA = Smtlib_utils.V_2_6.Ast 5 | module T = Sidekick_base.Term 6 | module Stmt = Sidekick_base.Statement 7 | 8 | type 'a or_error = ('a, string) CCResult.t 9 | 10 | (** {2 Type-checking and type inference} *) 11 | 12 | (** Typing context *) 13 | module Ctx : sig 14 | type t 15 | 16 | val set_default_num_real : t -> unit 17 | val set_default_num_int : t -> unit 18 | val create : T.store -> t 19 | end 20 | 21 | (** {2 Conversion from smtlib-utils} *) 22 | 23 | val conv_term : Ctx.t -> PA.term -> T.t 24 | val conv_statement : Ctx.t -> PA.statement -> Stmt.t list 25 | -------------------------------------------------------------------------------- /src/smtlib/build_model.mli: -------------------------------------------------------------------------------- 1 | open! Sidekick_base 2 | 3 | type t 4 | 5 | val create : unit -> t 6 | val add_ty : t -> Term.t -> unit 7 | val add_fun : t -> Term.t -> unit 8 | val build : t -> Solver.sat_result -> Model.t 9 | -------------------------------------------------------------------------------- /src/smtlib/check_cc.mli: -------------------------------------------------------------------------------- 1 | val theory : Solver.cdcl_theory 2 | (** theory that check validity of EUF conflicts, on the fly *) 3 | -------------------------------------------------------------------------------- /src/smtlib/common_.ml: -------------------------------------------------------------------------------- 1 | (** Current timestamp *) 2 | let now () : float = Unix.gettimeofday () 3 | 4 | (** Timestamp at the beginning of the program *) 5 | let time_start = now () 6 | 7 | (** write to file, possibly with compression *) 8 | let with_file_out (file : string) (f : out_channel -> 'a) : 'a = 9 | if Filename.extension file = ".gz" then ( 10 | let p = 11 | Unix.open_process_out 12 | (Printf.sprintf "gzip -c - > \"%s\"" (String.escaped file)) 13 | in 14 | CCFun.finally1 ~h:(fun () -> Unix.close_process_out p) f p 15 | ) else 16 | CCIO.with_out file f 17 | -------------------------------------------------------------------------------- /src/smtlib/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_smtlib) 3 | (public_name sidekick-base.smtlib) 4 | (synopsis "SMTLIB 2.6 driver for Sidekick") 5 | (private_modules Common_) 6 | (libraries containers zarith sidekick.core sidekick.util sidekick-base 7 | sidekick.abstract-solver sidekick.mini-cc smtlib-utils) 8 | (flags :standard -warn-error -a+8 -open Sidekick_util)) 9 | -------------------------------------------------------------------------------- /src/smtlib/model.mli: -------------------------------------------------------------------------------- 1 | (** Models 2 | 3 | A model can be produced when the solver is found to be in a 4 | satisfiable state after a call to {!solve}. *) 5 | 6 | open Sidekick_core 7 | 8 | type t 9 | type value = Term.t 10 | type fun_ = Term.t 11 | 12 | module TL_map : CCMap.S with type key = value list 13 | 14 | val empty : t 15 | val is_empty : t -> bool 16 | val add_fun_entry : fun_ -> value list -> value -> t -> t 17 | val get_fun_entry : fun_ -> value list -> t -> value option 18 | val get_fun_entries : fun_ -> t -> value TL_map.t option 19 | val iter_fun_entries : t -> (fun_ * value TL_map.t) Iter.t 20 | val eval : Term.t -> t -> value option 21 | 22 | include Sidekick_sigs.PRINT with type t := t 23 | -------------------------------------------------------------------------------- /src/smtlib/progress_bar.ml: -------------------------------------------------------------------------------- 1 | open Common_ 2 | 3 | let reset_line = "\x1b[2K\r" 4 | let start = now () 5 | 6 | type t = unit -> unit 7 | 8 | let tick (self : t) = self () 9 | let clear_line _ : unit = Printf.printf "%s%!" reset_line 10 | 11 | let create () : t = 12 | let n = ref 0 in 13 | let syms = "|\\-/" in 14 | fun () -> 15 | let diff = now () -. start in 16 | incr n; 17 | (* TODO: print some core stats in the progress bar 18 | let n_cl = Solver.pp_stats 19 | *) 20 | (* limit frequency *) 21 | if float !n > 6. *. diff then ( 22 | let sym = String.get syms (!n mod String.length syms) in 23 | Printf.printf "%s[%.2fs %c]" reset_line diff sym; 24 | n := 0; 25 | flush stdout 26 | ) 27 | -------------------------------------------------------------------------------- /src/smtlib/progress_bar.mli: -------------------------------------------------------------------------------- 1 | (** Super simple progress bar *) 2 | 3 | type t 4 | 5 | val create : unit -> t 6 | val tick : t -> unit 7 | val clear_line : t -> unit 8 | -------------------------------------------------------------------------------- /src/smtlib/solver.ml: -------------------------------------------------------------------------------- 1 | module Asolver = Sidekick_abstract_solver.Asolver 2 | module Smt_solver = Sidekick_smt_solver 3 | 4 | type t = Asolver.t 5 | type cdcl_theory = Smt_solver.theory 6 | -------------------------------------------------------------------------------- /src/th-bool-dyn/Sidekick_th_bool_dyn.mli: -------------------------------------------------------------------------------- 1 | (** Theory of boolean formulas. 2 | 3 | This handles formulas containing "and", "or", "=>", "if-then-else", etc. 4 | 5 | The difference with {!Sidekick_th_bool_static} is that here, clausification 6 | of a formula [F] is done only when [F] is on the trail. 7 | *) 8 | 9 | module Intf = Intf 10 | module Proof_rules = Proof_rules 11 | open Intf 12 | 13 | module type ARG = Intf.ARG 14 | 15 | val theory : (module ARG) -> SMT.Theory.t 16 | -------------------------------------------------------------------------------- /src/th-bool-dyn/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name Sidekick_th_bool_dyn) 3 | (public_name sidekick.th-bool-dyn) 4 | (libraries containers sidekick.core sidekick.smt-solver sidekick.util 5 | sidekick.simplify) 6 | (flags :standard -open Sidekick_util)) 7 | -------------------------------------------------------------------------------- /src/th-bool-dyn/intf.ml: -------------------------------------------------------------------------------- 1 | open Sidekick_core 2 | module Proof = Sidekick_proof 3 | module SMT = Sidekick_smt_solver 4 | module Simplify = Sidekick_simplify 5 | 6 | type term = Term.t 7 | type ty = Term.t 8 | 9 | (** Boolean-oriented view of terms *) 10 | type 'a bool_view = 'a Bool_view.t = 11 | | B_bool of bool 12 | | B_not of 'a 13 | | B_and of 'a list 14 | | B_or of 'a list 15 | | B_imply of 'a * 'a 16 | | B_equiv of 'a * 'a 17 | | B_xor of 'a * 'a 18 | | B_eq of 'a * 'a 19 | | B_neq of 'a * 'a 20 | | B_ite of 'a * 'a * 'a 21 | | B_atom of 'a 22 | 23 | (** Argument to the theory *) 24 | module type ARG = sig 25 | val view_as_bool : term -> term bool_view 26 | (** Project the term into the boolean view. *) 27 | 28 | val mk_bool : Term.store -> term bool_view -> term 29 | (** Make a term from the given boolean view. *) 30 | end 31 | -------------------------------------------------------------------------------- /src/th-bool-dyn/proof_rules.ml: -------------------------------------------------------------------------------- 1 | open Sidekick_core 2 | module Proof = Sidekick_proof 3 | 4 | type term = Term.t 5 | type lit = Lit.t 6 | 7 | let lemma_bool_tauto lits : Proof.Pterm.t = 8 | Proof.Pterm.apply_rule "bool.tauto" ~lits 9 | 10 | let lemma_bool_c name terms : Proof.Pterm.t = 11 | Proof.Pterm.apply_rule ("bool.c." ^ name) ~terms 12 | 13 | let lemma_bool_equiv t u : Proof.Pterm.t = 14 | Proof.Pterm.apply_rule "bool.equiv" ~terms:[ t; u ] 15 | 16 | let lemma_ite_true ~ite : Proof.Pterm.t = 17 | Proof.Pterm.apply_rule "bool.ite.true" ~terms:[ ite ] 18 | 19 | let lemma_ite_false ~ite : Proof.Pterm.t = 20 | Proof.Pterm.apply_rule "bool.ite.false" ~terms:[ ite ] 21 | -------------------------------------------------------------------------------- /src/th-bool-dyn/proof_rules.mli: -------------------------------------------------------------------------------- 1 | open Sidekick_core 2 | module Proof = Sidekick_proof 3 | 4 | type term = Term.t 5 | type lit = Lit.t 6 | 7 | val lemma_bool_tauto : lit list -> Proof.Pterm.t 8 | (** Boolean tautology lemma (clause) *) 9 | 10 | val lemma_bool_c : string -> term list -> Proof.Pterm.t 11 | (** Basic boolean logic lemma for a clause [|- c]. 12 | [proof_bool_c b name cs] is the Proof.Pterm.t designated by [name]. *) 13 | 14 | val lemma_bool_equiv : term -> term -> Proof.Pterm.t 15 | (** Boolean tautology lemma (equivalence) *) 16 | 17 | val lemma_ite_true : ite:term -> Proof.Pterm.t 18 | (** lemma [a ==> ite a b c = b] *) 19 | 20 | val lemma_ite_false : ite:term -> Proof.Pterm.t 21 | (** lemma [¬a ==> ite a b c = c] *) 22 | -------------------------------------------------------------------------------- /src/th-bool-static/Sidekick_th_bool_static.mli: -------------------------------------------------------------------------------- 1 | (** Theory of boolean formulas. 2 | 3 | This handles formulas containing "and", "or", "=>", "if-then-else", etc. 4 | *) 5 | 6 | module Intf = Intf 7 | module Proof_rules = Proof_rules 8 | open Intf 9 | 10 | module type ARG = Intf.ARG 11 | 12 | val theory : (module ARG) -> SMT.Theory.t 13 | -------------------------------------------------------------------------------- /src/th-bool-static/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_th_bool_static) 3 | (public_name sidekick.th-bool-static) 4 | (flags :standard -open Sidekick_util) 5 | (libraries sidekick.core sidekick.smt-solver sidekick.util sidekick.simplify 6 | sidekick.cc)) 7 | -------------------------------------------------------------------------------- /src/th-bool-static/intf.ml: -------------------------------------------------------------------------------- 1 | open Sidekick_core 2 | module Proof = Sidekick_proof 3 | module SMT = Sidekick_smt_solver 4 | module Simplify = Sidekick_simplify 5 | 6 | type term = Term.t 7 | type ty = Term.t 8 | 9 | (** Boolean-oriented view of terms *) 10 | type 'a bool_view = 'a Bool_view.t = 11 | | B_bool of bool 12 | | B_not of 'a 13 | | B_and of 'a list 14 | | B_or of 'a list 15 | | B_imply of 'a * 'a 16 | | B_equiv of 'a * 'a 17 | | B_xor of 'a * 'a 18 | | B_eq of 'a * 'a 19 | | B_neq of 'a * 'a 20 | | B_ite of 'a * 'a * 'a 21 | | B_atom of 'a 22 | 23 | (** Argument to the theory *) 24 | module type ARG = sig 25 | val view_as_bool : term -> term bool_view 26 | (** Project the term into the boolean view. *) 27 | 28 | val mk_bool : Term.store -> term bool_view -> term 29 | (** Make a term from the given boolean view. *) 30 | end 31 | -------------------------------------------------------------------------------- /src/th-bool-static/proof_rules.ml: -------------------------------------------------------------------------------- 1 | open Sidekick_core 2 | module Proof = Sidekick_proof 3 | 4 | type term = Term.t 5 | type lit = Lit.t 6 | 7 | let lemma_bool_tauto lits : Proof.Pterm.t = 8 | Proof.Pterm.apply_rule "bool.tauto" ~lits 9 | 10 | let lemma_bool_c name terms : Proof.Pterm.t = 11 | Proof.Pterm.apply_rule ("bool.c." ^ name) ~terms 12 | 13 | let lemma_bool_equiv t u : Proof.Pterm.t = 14 | Proof.Pterm.apply_rule "bool.equiv" ~terms:[ t; u ] 15 | 16 | let lemma_ite_true ~ite : Proof.Pterm.t = 17 | Proof.Pterm.apply_rule "bool.ite.true" ~terms:[ ite ] 18 | 19 | let lemma_ite_false ~ite : Proof.Pterm.t = 20 | Proof.Pterm.apply_rule "bool.ite.false" ~terms:[ ite ] 21 | -------------------------------------------------------------------------------- /src/th-bool-static/proof_rules.mli: -------------------------------------------------------------------------------- 1 | open Sidekick_core 2 | module Proof = Sidekick_proof 3 | 4 | type term = Term.t 5 | type lit = Lit.t 6 | 7 | val lemma_bool_tauto : lit list -> Proof.Pterm.t 8 | (** Boolean tautology lemma (clause) *) 9 | 10 | val lemma_bool_c : string -> term list -> Proof.Pterm.t 11 | (** Basic boolean logic lemma for a clause [|- c]. 12 | [proof_bool_c b name cs] is the Proof_term.t designated by [name]. *) 13 | 14 | val lemma_bool_equiv : term -> term -> Proof.Pterm.t 15 | (** Boolean tautology lemma (equivalence) *) 16 | 17 | val lemma_ite_true : ite:term -> Proof.Pterm.t 18 | (** lemma [a ==> ite a b c = b] *) 19 | 20 | val lemma_ite_false : ite:term -> Proof.Pterm.t 21 | (** lemma [¬a ==> ite a b c = c] *) 22 | -------------------------------------------------------------------------------- /src/th-cstor/Sidekick_th_cstor.mli: -------------------------------------------------------------------------------- 1 | (** Theory for constructors *) 2 | 3 | open Sidekick_core 4 | module SMT = Sidekick_smt_solver 5 | 6 | type ('c, 't) cstor_view = T_cstor of 'c * 't array | T_other of 't 7 | 8 | module type ARG = sig 9 | val view_as_cstor : Term.t -> (Const.t, Term.t) cstor_view 10 | val lemma_cstor : Lit.t list -> Sidekick_proof.Pterm.t 11 | end 12 | 13 | val make : (module ARG) -> SMT.theory 14 | -------------------------------------------------------------------------------- /src/th-cstor/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name Sidekick_th_cstor) 3 | (public_name sidekick.th-cstor) 4 | (libraries containers sidekick.core sidekick.smt-solver sidekick.util 5 | sidekick.cc) 6 | (flags :standard -open Sidekick_util)) 7 | -------------------------------------------------------------------------------- /src/th-data/Sidekick_th_data.mli: -------------------------------------------------------------------------------- 1 | (** Theory for datatypes. *) 2 | 3 | include module type of Th_intf 4 | 5 | val make : (module ARG) -> SMT.theory 6 | -------------------------------------------------------------------------------- /src/th-data/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name Sidekick_th_data) 3 | (public_name sidekick.th-data) 4 | (libraries containers sidekick.core sidekick.util sidekick.cc 5 | sidekick.smt-solver) 6 | (flags :standard -open Sidekick_util -w +32)) 7 | 8 | ; TODO get warning back 9 | -------------------------------------------------------------------------------- /src/th-data/proof_rules.ml: -------------------------------------------------------------------------------- 1 | module Proof = Sidekick_proof 2 | 3 | let lemma_isa_cstor ~cstor_t t : Proof.Pterm.t = 4 | Proof.Pterm.apply_rule ~terms:[ cstor_t; t ] "data.isa-cstor" 5 | 6 | let lemma_select_cstor ~cstor_t t : Proof.Pterm.t = 7 | Proof.Pterm.apply_rule ~terms:[ cstor_t; t ] "data.select-cstor" 8 | 9 | let lemma_isa_split t lits : Proof.Pterm.t = 10 | Proof.Pterm.apply_rule ~terms:[ t ] ~lits "data.isa-split" 11 | 12 | let lemma_isa_sel t : Proof.Pterm.t = 13 | Proof.Pterm.apply_rule ~terms:[ t ] "data.isa-sel" 14 | 15 | let lemma_isa_disj l1 l2 : Proof.Pterm.t = 16 | Proof.Pterm.apply_rule ~lits:[ l1; l2 ] "data.isa-disj" 17 | 18 | let lemma_cstor_inj t1 t2 i : Proof.Pterm.t = 19 | Proof.Pterm.apply_rule ~terms:[ t1; t2 ] ~indices:[ i ] "data.cstor-inj" 20 | 21 | let lemma_cstor_distinct t1 t2 : Proof.Pterm.t = 22 | Proof.Pterm.apply_rule ~terms:[ t1; t2 ] "data.cstor-distinct" 23 | 24 | let lemma_acyclicity ts : Proof.Pterm.t = 25 | Proof.Pterm.apply_rule 26 | ~terms:(CCList.flat_map (fun (t1, t2) -> [ t1; t2 ]) ts) 27 | "data.acyclicity" 28 | -------------------------------------------------------------------------------- /src/th-data/proof_rules.mli: -------------------------------------------------------------------------------- 1 | open Sidekick_core 2 | module Proof = Sidekick_proof 3 | 4 | val lemma_isa_cstor : cstor_t:Term.t -> Term.t -> Proof.Pterm.t 5 | (** [lemma_isa_cstor (d …) (is-c t)] returns the clause 6 | [(c …) = t |- is-c t] or [(d …) = t |- ¬ (is-c t)] *) 7 | 8 | val lemma_select_cstor : cstor_t:Term.t -> Term.t -> Proof.Pterm.t 9 | (** [lemma_select_cstor (c t1…tn) (sel-c-i t)] 10 | returns a proof of [t = c t1…tn |- (sel-c-i t) = ti] *) 11 | 12 | val lemma_isa_split : Term.t -> Lit.t list -> Proof.Pterm.t 13 | (** [lemma_isa_split t lits] is the proof of 14 | [is-c1 t \/ is-c2 t \/ … \/ is-c_n t] *) 15 | 16 | val lemma_isa_sel : Term.t -> Proof.Pterm.t 17 | (** [lemma_isa_sel (is-c t)] is the proof of 18 | [is-c t |- t = c (sel-c-1 t)…(sel-c-n t)] *) 19 | 20 | val lemma_isa_disj : Lit.t -> Lit.t -> Proof.Pterm.t 21 | (** [lemma_isa_disj (is-c t) (is-d t)] is the proof 22 | of [¬ (is-c t) \/ ¬ (is-c t)] *) 23 | 24 | val lemma_cstor_inj : Term.t -> Term.t -> int -> Proof.Pterm.t 25 | (** [lemma_cstor_inj (c t1…tn) (c u1…un) i] is the proof of 26 | [c t1…tn = c u1…un |- ti = ui] *) 27 | 28 | val lemma_cstor_distinct : Term.t -> Term.t -> Proof.Pterm.t 29 | (** [lemma_isa_distinct (c …) (d …)] is the proof 30 | of the unit clause [|- (c …) ≠ (d …)] *) 31 | 32 | val lemma_acyclicity : (Term.t * Term.t) list -> Proof.Pterm.t 33 | (** [lemma_acyclicity pairs] is a proof of [t1=u1, …, tn=un |- false] 34 | by acyclicity. *) 35 | -------------------------------------------------------------------------------- /src/th-lra/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_th_lra) 3 | (public_name sidekick.th-lra) 4 | (synopsis "Solver for LRA (real arithmetic)") 5 | (flags :standard -warn-error -a+8 -w -32 -open Sidekick_util) 6 | (libraries containers sidekick.arith sidekick.simplex sidekick.cc 7 | sidekick.smt-solver)) 8 | -------------------------------------------------------------------------------- /src/th-lra/intf.ml: -------------------------------------------------------------------------------- 1 | open Sidekick_core 2 | module SMT = Sidekick_smt_solver 3 | module Proof = Sidekick_proof 4 | module Predicate = Sidekick_simplex.Predicate 5 | module Linear_expr = Sidekick_simplex.Linear_expr 6 | module Linear_expr_intf = Sidekick_simplex.Linear_expr_intf 7 | 8 | module type INT = Sidekick_arith.INT 9 | module type RATIONAL = Sidekick_arith.RATIONAL 10 | 11 | module S_op = Sidekick_simplex.Op 12 | 13 | type term = Term.t 14 | type ty = Term.t 15 | type pred = Linear_expr_intf.bool_op = Leq | Geq | Lt | Gt | Eq | Neq 16 | type op = Linear_expr_intf.op = Plus | Minus 17 | 18 | type ('num, 'a) lra_view = 19 | | LRA_pred of pred * 'a * 'a 20 | | LRA_op of op * 'a * 'a 21 | | LRA_mult of 'num * 'a 22 | | LRA_const of 'num 23 | | LRA_other of 'a 24 | 25 | let map_view f (l : _ lra_view) : _ lra_view = 26 | match l with 27 | | LRA_pred (p, a, b) -> LRA_pred (p, f a, f b) 28 | | LRA_op (p, a, b) -> LRA_op (p, f a, f b) 29 | | LRA_mult (n, a) -> LRA_mult (n, f a) 30 | | LRA_const q -> LRA_const q 31 | | LRA_other x -> LRA_other (f x) 32 | 33 | module type ARG = sig 34 | module Z : INT 35 | module Q : RATIONAL with type bigint = Z.t 36 | 37 | val view_as_lra : Term.t -> (Q.t, Term.t) lra_view 38 | (** Project the Term.t into the theory view *) 39 | 40 | val mk_lra : Term.store -> (Q.t, Term.t) lra_view -> Term.t 41 | (** Make a Term.t from the given theory view *) 42 | 43 | val ty_real : Term.store -> ty 44 | (** Build the type Q *) 45 | 46 | val has_ty_real : Term.t -> bool 47 | (** Does this term have the type [Real] *) 48 | end 49 | -------------------------------------------------------------------------------- /src/th-lra/proof_rules.ml: -------------------------------------------------------------------------------- 1 | module Proof = Sidekick_proof 2 | 3 | let lemma_lra lits : Proof.Pterm.t = Proof.Pterm.apply_rule "lra.lemma" ~lits 4 | -------------------------------------------------------------------------------- /src/th-lra/proof_rules.mli: -------------------------------------------------------------------------------- 1 | open Sidekick_core 2 | module Proof = Sidekick_proof 3 | 4 | val lemma_lra : Lit.t list -> Proof.Pterm.t 5 | (** List of literals [l1…ln] where [¬l1 /\ … /\ ¬ln] is LRA-unsat *) 6 | -------------------------------------------------------------------------------- /src/th-lra/sidekick_th_lra.mli: -------------------------------------------------------------------------------- 1 | (** Linear Rational Arithmetic *) 2 | 3 | open Sidekick_core 4 | module Intf = Intf 5 | module Predicate = Intf.Predicate 6 | module SMT = Sidekick_smt_solver 7 | 8 | module type INT = Intf.INT 9 | module type RATIONAL = Intf.RATIONAL 10 | 11 | module S_op = Sidekick_simplex.Op 12 | 13 | type term = Term.t 14 | type ty = Term.t 15 | type pred = Intf.pred = Leq | Geq | Lt | Gt | Eq | Neq 16 | type op = Intf.op = Plus | Minus 17 | 18 | type ('num, 'a) lra_view = ('num, 'a) Intf.lra_view = 19 | | LRA_pred of pred * 'a * 'a 20 | | LRA_op of op * 'a * 'a 21 | | LRA_mult of 'num * 'a 22 | | LRA_const of 'num 23 | | LRA_other of 'a 24 | 25 | val map_view : ('a -> 'b) -> ('c, 'a) lra_view -> ('c, 'b) lra_view 26 | 27 | module type ARG = Intf.ARG 28 | 29 | (* TODO 30 | type state 31 | 32 | val k_state : state SMT.Registry.key 33 | (** Key to access the state from outside, 34 | available when the theory has been setup *) 35 | 36 | val create : (module ARG) -> ?stat:Stat.t -> SMT.Solver_internal.t -> state 37 | 38 | (* TODO: be able to declare some variables as ints *) 39 | 40 | (* 41 | val simplex : state -> Simplex.t 42 | *) 43 | 44 | val theory_of_state : state -> SMT.Theory.t 45 | *) 46 | 47 | val theory : (module ARG) -> SMT.Theory.t 48 | -------------------------------------------------------------------------------- /src/th-unin-ty/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_th_ty_unin) 3 | (public_name sidekick.th-ty-unin) 4 | (synopsis "Theory for uninterpreted types") 5 | (flags :standard -warn-error -a+8 -w -32 -open Sidekick_util) 6 | (libraries containers sidekick.cc sidekick.smt-solver)) 7 | -------------------------------------------------------------------------------- /src/th-unin-ty/sidekick_th_ty_unin.ml: -------------------------------------------------------------------------------- 1 | open Sidekick_core 2 | open Sidekick_smt_solver 3 | 4 | open struct 5 | module SI = Solver_internal 6 | end 7 | 8 | type ty = Term.t 9 | 10 | module type ARG = sig 11 | val ty_is_unin : ty -> bool 12 | end 13 | 14 | module Make (A : ARG) = struct 15 | open A 16 | 17 | type t = { gensym: Gensym.t } 18 | 19 | let create (tst : Term.store) : t = 20 | let gensym = Gensym.create tst in 21 | { gensym } 22 | 23 | let pop_levels (self : t) n = if n > 0 then Gensym.reset self.gensym 24 | 25 | let model_ask_ (self : t) (_solver : SI.t) (_m : Model_builder.t) (t : Term.t) 26 | : _ option = 27 | if ty_is_unin (Term.ty t) then ( 28 | let s = Gensym.fresh_term self.gensym ~pre:"@c" (Term.ty t) in 29 | Some (s, []) 30 | ) else 31 | None 32 | 33 | let create_and_setup ~id:_ (solver : SI.t) : t = 34 | let state = create (SI.tst solver) in 35 | SI.on_model solver ~ask:(model_ask_ state); 36 | state 37 | 38 | let theory = Solver.mk_theory ~name:"ty-unin" ~create_and_setup ~pop_levels () 39 | end 40 | 41 | let theory (arg : (module ARG)) : Theory.t = 42 | let module M = Make ((val arg)) in 43 | M.theory 44 | -------------------------------------------------------------------------------- /src/th-unin-ty/sidekick_th_ty_unin.mli: -------------------------------------------------------------------------------- 1 | open Sidekick_core 2 | 3 | type ty = Term.t 4 | 5 | module type ARG = sig 6 | val ty_is_unin : ty -> bool 7 | end 8 | 9 | val theory : (module ARG) -> Sidekick_smt_solver.Theory.t 10 | (** Theory of uninterpreted types *) 11 | -------------------------------------------------------------------------------- /src/tools/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## ddSMT 3 | 4 | to use ddSMT (from https://github.com/ddsmt/ddSMT/): 5 | 6 | Assuming `bad_file.smt2` is UNSAT but sidekick returns SAT: 7 | ```sh 8 | ddsmt.py -vv bad_file.smt2 foo.smt2 ./src/tools/ddsmt_driver_unsat.py 9 | ``` 10 | 11 | Once it's done, `foo.smt2` should contain a minimal problematic file. 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/tools/ddsmt_driver_sat.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import subprocess, sys 4 | 5 | filename: str = sys.argv[1] 6 | 7 | z3_out = subprocess.run([b'z3', filename], capture_output=True).stdout 8 | if b'sat' not in z3_out or b'unsat' in z3_out or b'error' in z3_out: 9 | sys.exit(0) 10 | 11 | b_out = subprocess.run([b'./sidekick', filename], capture_output=True).stdout 12 | if b_out.startswith(b'unsat') and b'Error' not in b_out: 13 | print('ohno', file=sys.stderr) 14 | sys.exit(1) 15 | 16 | -------------------------------------------------------------------------------- /src/tools/ddsmt_driver_unsat.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # minimize unsat problem 4 | 5 | import subprocess, sys 6 | 7 | filename: str = sys.argv[1] 8 | 9 | z3_out = subprocess.run([b'z3', filename], capture_output=True).stdout 10 | if b'unsat' not in z3_out or b'error' in z3_out: 11 | print("z3 failed") 12 | sys.exit(1) 13 | 14 | b_out = subprocess.run([b'./sidekick', filename], capture_output=True).stdout 15 | if b'Sat' not in b_out or b'Error' in b_out: 16 | print('ohno', file=sys.stderr) 17 | print(b_out, sys.stderr) 18 | sys.exit(2) 19 | 20 | sys.exit(0) 21 | 22 | -------------------------------------------------------------------------------- /src/tools/profile.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -z "$FREQ" ] ; then FREQ=300 ; fi 4 | 5 | perf record -F "$FREQ" --call-graph=dwarf $@ 6 | 7 | perf script \ 8 | | stackcollapse-perf --kernel \ 9 | | sed 's/caml//g' \ 10 | | flamegraph > perf.svg 11 | 12 | -------------------------------------------------------------------------------- /src/trace/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name Sidekick_trace) 3 | (public_name sidekick.trace) 4 | (synopsis "Trace system for sidekick.") 5 | (flags :standard -open Sidekick_util) 6 | (libraries containers iter sidekick.util sidekick.bencode sidekick.sigs 7 | sidekick.core-logic)) 8 | -------------------------------------------------------------------------------- /src/trace/entry_id.ml: -------------------------------------------------------------------------------- 1 | (** Entry in the sink. 2 | 3 | This integer tag represent a single entry in a trace, for example 4 | a line if we serialized using line-separate json values. 5 | In general each entry has its own unique ID that is monotonically 6 | increasing with time. *) 7 | 8 | include Int_id.Make () 9 | 10 | (** Dummy id *) 11 | let dummy : t = of_int_unsafe (-1) 12 | -------------------------------------------------------------------------------- /src/trace/sidekick_trace.ml: -------------------------------------------------------------------------------- 1 | (** Tracing. 2 | 3 | Sidekick should be able to emit traces of some or all of the events 4 | happening inside its components (SAT solver, SMT solver, theories, 5 | etc.). 6 | 7 | Traces can be written to disk and read back later from another 8 | process. 9 | 10 | The two initial intended use cases are: 11 | 12 | - proof production (trace all inferences; reconstruct a proof from them 13 | starting from the inference of [false]) 14 | - debugging (trace some inferences/internal states/partial models; 15 | double check them later) 16 | 17 | *) 18 | 19 | (** {2 Exports} *) 20 | 21 | module Sink = Sink 22 | module Source = Source 23 | module Entry_id = Entry_id 24 | 25 | type entry_id = Entry_id.t 26 | -------------------------------------------------------------------------------- /src/trace/sink.mli: -------------------------------------------------------------------------------- 1 | (** An IO sink for serialization/tracing 2 | 3 | A trace is emitted on the fly into a sink. The sink collects or 4 | writes entries that are emitted into it. 5 | *) 6 | 7 | type tag = string 8 | 9 | module type S = sig 10 | val emit : tag:tag -> Ser_value.t -> Entry_id.t 11 | end 12 | 13 | type t = (module S) 14 | (** Trace sink *) 15 | 16 | val emit : t -> tag:tag -> Ser_value.t -> Entry_id.t 17 | val emit' : t -> tag:tag -> Ser_value.t -> unit 18 | 19 | val null : t 20 | (** Sink that writes nowhere, just eats bytes. *) 21 | 22 | val of_out_channel_using_bencode : out_channel -> t 23 | (** A sink that emits entries using Bencode into the given channel *) 24 | 25 | val of_buffer_using_bencode : Buffer.t -> t 26 | (** Emit entries into the given buffer, in Bencode. *) 27 | -------------------------------------------------------------------------------- /src/trace/source.mli: -------------------------------------------------------------------------------- 1 | (** Source to read a trace. 2 | 3 | A source is an IO input source that allows the read of individual 4 | entries of the trace, by providing their entry ID. It also allows to 5 | iterate on entries in chronological order. 6 | *) 7 | 8 | type tag = string 9 | 10 | module type S = sig 11 | val get_entry : Entry_id.t -> tag * Ser_value.t 12 | (** @raise Not_found if there is no such entry *) 13 | 14 | val iter_all : (Entry_id.t -> tag:tag -> Ser_value.t -> unit) -> unit 15 | (** Iterate on all entries *) 16 | end 17 | 18 | type t = (module S) 19 | 20 | val get_entry : t -> Entry_id.t -> (tag * Ser_value.t) option 21 | val get_entry_exn : t -> Entry_id.t -> tag * Ser_value.t 22 | val iter_all : t -> (Entry_id.t -> tag:tag -> Ser_value.t -> unit) -> unit 23 | 24 | val of_string_using_bencode : string -> t 25 | (** Decode string, where entries are offsets *) 26 | -------------------------------------------------------------------------------- /src/util/Backtrack_stack.ml: -------------------------------------------------------------------------------- 1 | type 'a t = { vec: 'a Vec.t; lvls: int Vec.t } 2 | 3 | let create () : _ t = { vec = Vec.create (); lvls = Vec.create () } 4 | let[@inline] n_levels self : int = Vec.size self.lvls 5 | let[@inline] push self x : unit = Vec.push self.vec x 6 | 7 | let[@inline] push_if_nonzero_level self x : unit = 8 | if n_levels self > 0 then Vec.push self.vec x 9 | 10 | let[@inline] push_level (self : _ t) : unit = 11 | Vec.push self.lvls (Vec.size self.vec) 12 | 13 | let pop_levels (self : _ t) (n : int) ~f : unit = 14 | if n > n_levels self then 15 | Error.errorf "Backtrack_stack.pop_levels %d (size: %d)" n (n_levels self); 16 | if n > 0 then ( 17 | let new_lvl = n_levels self - n in 18 | let i = Vec.get self.lvls new_lvl in 19 | while Vec.size self.vec > i do 20 | let x = Vec.pop_exn self.vec in 21 | f x 22 | done; 23 | Vec.shrink self.lvls new_lvl 24 | ) 25 | 26 | let iter ~f self = Vec.iter ~f self.vec 27 | -------------------------------------------------------------------------------- /src/util/Backtrack_stack.mli: -------------------------------------------------------------------------------- 1 | (** {1 A backtracking stack} *) 2 | 3 | type 'a t 4 | 5 | val create : unit -> 'a t 6 | 7 | val push : 'a t -> 'a -> unit 8 | (** Push an element onto the stack *) 9 | 10 | val push_if_nonzero_level : 'a t -> 'a -> unit 11 | (** Push an element onto the stack if level > 0 *) 12 | 13 | include Sidekick_sigs.BACKTRACKABLE1_CB with type 'a t := 'a t 14 | 15 | val iter : f:('a -> unit) -> 'a t -> unit 16 | -------------------------------------------------------------------------------- /src/util/Backtrackable_ref.ml: -------------------------------------------------------------------------------- 1 | type 'a t = { mutable cur: 'a; stack: 'a Vec.t; copy: ('a -> 'a) option } 2 | 3 | let create ?copy x : _ t = { cur = x; stack = Vec.create (); copy } 4 | let[@inline] get self = self.cur 5 | let[@inline] set self x = self.cur <- x 6 | let[@inline] update self f = self.cur <- f self.cur 7 | let[@inline] n_levels self = Vec.size self.stack 8 | 9 | let[@inline] push_level self : unit = 10 | let x = self.cur in 11 | let x = 12 | match self.copy with 13 | | None -> x 14 | | Some f -> f x 15 | in 16 | Vec.push self.stack x 17 | 18 | let pop_levels self n : unit = 19 | assert (n >= 0); 20 | if n > Vec.size self.stack then invalid_arg "Backtrackable_ref.pop_levels"; 21 | let i = Vec.size self.stack - n in 22 | let x = Vec.get self.stack i in 23 | self.cur <- x; 24 | Vec.shrink self.stack i; 25 | () 26 | -------------------------------------------------------------------------------- /src/util/Backtrackable_ref.mli: -------------------------------------------------------------------------------- 1 | (** {1 Backtrackable ref} *) 2 | 3 | type 'a t 4 | 5 | val create : ?copy:('a -> 'a) -> 'a -> 'a t 6 | (** Create a backtrackable reference holding the given value initially. 7 | @param copy if provided, will be used to copy the value when [push_level] 8 | is called. *) 9 | 10 | val set : 'a t -> 'a -> unit 11 | (** Set the reference's current content *) 12 | 13 | val get : 'a t -> 'a 14 | (** Get the reference's current content *) 15 | 16 | val update : 'a t -> ('a -> 'a) -> unit 17 | (** Update the reference's current content *) 18 | 19 | include Sidekick_sigs.BACKTRACKABLE1 with type 'a t := 'a t 20 | -------------------------------------------------------------------------------- /src/util/Backtrackable_tbl.mli: -------------------------------------------------------------------------------- 1 | (** {1 A backtrackable hashtable} *) 2 | 3 | module type S = sig 4 | type key 5 | type 'a t 6 | 7 | val create : ?size:int -> unit -> 'a t 8 | 9 | val find : 'a t -> key -> 'a 10 | (** @raise Not_found if the key is not present *) 11 | 12 | val get : 'a t -> key -> 'a option 13 | val mem : _ t -> key -> bool 14 | val length : _ t -> int 15 | val iter : (key -> 'a -> unit) -> 'a t -> unit 16 | val to_iter : 'a t -> (key * 'a) Iter.t 17 | val add : 'a t -> key -> 'a -> unit 18 | val remove : _ t -> key -> unit 19 | 20 | include Sidekick_sigs.BACKTRACKABLE1 with type 'a t := 'a t 21 | end 22 | 23 | module type ARG = sig 24 | type t 25 | 26 | val equal : t -> t -> bool 27 | val hash : t -> int 28 | end 29 | 30 | module Make (A : ARG) : S with type key = A.t 31 | -------------------------------------------------------------------------------- /src/util/Bag.mli: -------------------------------------------------------------------------------- 1 | (* This file is free software. See file "license" for more details. *) 2 | 3 | (** {1 Ordered Bag of Elements} 4 | 5 | A data structure where we can have duplicate elements, optimized for 6 | fast concatenation and size. *) 7 | 8 | type +'a t = private E | L of 'a | N of 'a t * 'a t 9 | 10 | val empty : 'a t 11 | val is_empty : _ t -> bool 12 | val return : 'a -> 'a t 13 | val cons : 'a -> 'a t -> 'a t 14 | val snoc : 'a t -> 'a -> 'a t 15 | val append : 'a t -> 'a t -> 'a t 16 | val of_iter : 'a Iter.t -> 'a t 17 | val to_iter : 'a t -> 'a Iter.t 18 | val to_list : 'a t -> 'a list 19 | val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a 20 | val iter : ('a -> unit) -> 'a t -> unit 21 | 22 | val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool 23 | (** Are the two bags equal, element wise? *) 24 | -------------------------------------------------------------------------------- /src/util/Bitvec.ml: -------------------------------------------------------------------------------- 1 | type t = { mutable chunks: bytes } 2 | 3 | let create () : t = { chunks = Bytes.make 32 '\x00' } 4 | let i2c = Char.unsafe_chr 5 | let c2i = Char.code 6 | 7 | (* from index to offset in bytes *) 8 | let[@inline] idx_bytes_ (i : int) : int = i lsr 3 9 | 10 | (* from index to offset in a single char *) 11 | let mask_ = 0b111 12 | 13 | (* number of bytes *) 14 | let[@inline] len_ (self : t) : int = Bytes.length self.chunks 15 | 16 | let[@inline never] resize_ self idx : unit = 17 | let new_size = 18 | min Sys.max_string_length 19 | (max (idx + 2) 20 | (let l = len_ self in 21 | l + 10 + (l / 2))) 22 | in 23 | let new_chunks = Bytes.make new_size (i2c 0) in 24 | Bytes.blit self.chunks 0 new_chunks 0 (len_ self); 25 | self.chunks <- new_chunks; 26 | assert (len_ self > idx) 27 | 28 | let[@inline] ensure_size self i = 29 | let idx = idx_bytes_ i in 30 | if idx >= len_ self then resize_ self idx 31 | 32 | let[@inline] get self i : bool = 33 | let idx = idx_bytes_ i in 34 | let c = c2i (Bytes.get self.chunks idx) in 35 | c land (1 lsl (i land mask_)) <> 0 36 | 37 | let set self i b : unit = 38 | let idx = idx_bytes_ i in 39 | let c = c2i (Bytes.get self.chunks idx) in 40 | let c = 41 | if b then 42 | c lor (1 lsl (i land mask_)) 43 | else 44 | c land lnot (1 lsl (i land mask_)) 45 | in 46 | Bytes.set self.chunks idx (i2c c) 47 | 48 | let clear_all self = Bytes.fill self.chunks 0 (len_ self) '\x00' 49 | -------------------------------------------------------------------------------- /src/util/Bitvec.mli: -------------------------------------------------------------------------------- 1 | (** Bitvector. 2 | 3 | This provides compact storage with O(1) access to a range of bits, 4 | like [bool Vec.t] but packed better. *) 5 | 6 | type t 7 | 8 | val create : unit -> t 9 | 10 | val ensure_size : t -> int -> unit 11 | (** [ensure_size bv i] ensures that [i] is a valid index in [bv] *) 12 | 13 | val get : t -> int -> bool 14 | val set : t -> int -> bool -> unit 15 | val clear_all : t -> unit 16 | -------------------------------------------------------------------------------- /src/util/Error.ml: -------------------------------------------------------------------------------- 1 | module Fmt = CCFormat 2 | 3 | exception Error of string 4 | 5 | let () = 6 | Printexc.register_printer (function 7 | | Error msg -> Some ("internal error: " ^ msg) 8 | | _ -> None) 9 | 10 | let errorf msg = Fmt.ksprintf msg ~f:(fun s -> raise (Error s)) 11 | 12 | type nonrec 'a result = ('a, string) result 13 | 14 | let try_ f = try Ok (f ()) with Error s -> Error s 15 | -------------------------------------------------------------------------------- /src/util/Error.mli: -------------------------------------------------------------------------------- 1 | exception Error of string 2 | 3 | val errorf : ('a, Format.formatter, unit, 'b) format4 -> 'a 4 | (** @raise Error when called *) 5 | 6 | type nonrec 'a result = ('a, string) result 7 | 8 | val try_ : (unit -> 'a) -> 'a result 9 | -------------------------------------------------------------------------------- /src/util/Event.ml: -------------------------------------------------------------------------------- 1 | type ('a, 'b) handler = 'a -> 'b 2 | type ('a, 'b) t = { h: ('a, 'b) handler Vec.t } [@@unboxed] 3 | 4 | let nop_handler_ _ = assert false 5 | 6 | module Emitter = struct 7 | type nonrec ('a, 'b) t = ('a, 'b) t 8 | 9 | let emit (self : (_, unit) t) x = 10 | if not (Vec.is_empty self.h) then Vec.iter self.h ~f:(fun h -> h x) 11 | 12 | let emit_collect (self : _ t) x : _ list = 13 | if Vec.is_empty self.h then 14 | [] 15 | else ( 16 | let l = ref [] in 17 | Vec.iter self.h ~f:(fun h -> l := h x :: !l); 18 | !l 19 | ) 20 | 21 | let emit_iter self x ~f = 22 | if not (Vec.is_empty self.h) then 23 | Vec.iter self.h ~f:(fun h -> 24 | let y = h x in 25 | f y) 26 | 27 | let create () : _ t = { h = Vec.make 3 nop_handler_ } 28 | end 29 | 30 | let on self ~f = Vec.push self.h f 31 | let of_emitter x = x 32 | let emit = Emitter.emit 33 | let emit_collect = Emitter.emit_collect 34 | let emit_iter = Emitter.emit_iter 35 | -------------------------------------------------------------------------------- /src/util/Event.mli: -------------------------------------------------------------------------------- 1 | (** Event pattern. 2 | 3 | This provides a basic observer pattern, where events are emitted 4 | from some source (with an attached value), and callbacks that were 5 | registered will receive this value. 6 | *) 7 | 8 | type ('a, 'b) t 9 | (** An event emitting values of type ['a], where subscribers 10 | return values of type ['b]. *) 11 | 12 | module Emitter : sig 13 | type ('a, 'b) t 14 | 15 | val create : unit -> ('a, 'b) t 16 | val emit : ('a, unit) t -> 'a -> unit 17 | val emit_collect : ('a, 'b) t -> 'a -> 'b list 18 | val emit_iter : ('a, 'b) t -> 'a -> f:('b -> unit) -> unit 19 | end 20 | 21 | val on : ('a, 'b) t -> f:('a -> 'b) -> unit 22 | val of_emitter : ('a, 'b) Emitter.t -> ('a, 'b) t 23 | val emit : ('a, unit) Emitter.t -> 'a -> unit 24 | val emit_collect : ('a, 'b) Emitter.t -> 'a -> 'b list 25 | val emit_iter : ('a, 'b) Emitter.t -> 'a -> f:('b -> unit) -> unit 26 | -------------------------------------------------------------------------------- /src/util/Hash.mli: -------------------------------------------------------------------------------- 1 | (* This file is free software. See file "license" for more details. *) 2 | 3 | type 'a t = 'a -> int 4 | 5 | val bool : bool t 6 | val int : int t 7 | val string : string t 8 | val combine : 'a t -> int -> 'a -> int 9 | val pair : 'a t -> 'b t -> ('a * 'b) t 10 | val opt : 'a t -> 'a option t 11 | val list : 'a t -> 'a list t 12 | val array : 'a t -> 'a array t 13 | val iarray : 'a t -> 'a array t 14 | val seq : 'a t -> 'a Iter.t t 15 | val combine2 : int -> int -> int 16 | val combine3 : int -> int -> int -> int 17 | val combine4 : int -> int -> int -> int -> int 18 | 19 | val poly : 'a t 20 | (** the regular polymorphic hash function *) 21 | -------------------------------------------------------------------------------- /src/util/Int_id.ml: -------------------------------------------------------------------------------- 1 | (** Integer-based identifiers. *) 2 | 3 | module type S = sig 4 | type t = private int 5 | 6 | include Sidekick_sigs.EQ_ORD_HASH_PRINT with type t := t 7 | 8 | val to_int : t -> int 9 | val of_int_unsafe : int -> t 10 | end 11 | 12 | (** Generate a new type for integer identifiers *) 13 | module Make () = struct 14 | type t = int 15 | 16 | let equal : t -> t -> bool = ( = ) 17 | let compare : t -> t -> int = compare 18 | let hash = CCHash.int 19 | let pp = CCFormat.int 20 | let[@inline] to_int i = i 21 | 22 | external of_int_unsafe : int -> t = "%identity" 23 | end 24 | -------------------------------------------------------------------------------- /src/util/Log.ml: -------------------------------------------------------------------------------- 1 | (** {1 Logging functions, real version} *) 2 | 3 | let enabled = true (* NOTE: change here for 0-overhead? *) 4 | let debug_level_ = ref 0 5 | let set_debug l = debug_level_ := l 6 | let get_debug () = !debug_level_ 7 | let debug_fmt_ = ref Format.err_formatter 8 | let set_debug_out f = debug_fmt_ := f 9 | let buf_ = Buffer.create 128 10 | let buf_fmt_ = Format.formatter_of_buffer buf_ 11 | let start_ = Unix.gettimeofday () 12 | 13 | (* does the printing, inconditionally *) 14 | let[@inline never] debug_real_ l k = 15 | k (fun fmt -> 16 | let now = Unix.gettimeofday () -. start_ in 17 | Buffer.clear buf_; 18 | let once_done _fmt = 19 | Format.fprintf _fmt "@]@?"; 20 | let msg = Buffer.contents buf_ in 21 | (* forward to profiling *) 22 | if Profile.enabled () then Profile.message msg; 23 | Format.fprintf !debug_fmt_ "@[<2>@{[%d|%.3f]@}@ %s@]@." l now msg 24 | in 25 | 26 | Format.fprintf buf_fmt_ "@[<2>"; 27 | Format.kfprintf once_done buf_fmt_ fmt) 28 | 29 | let[@inline] debugf l k = if enabled && l <= !debug_level_ then debug_real_ l k 30 | let[@inline] debug l msg = debugf l (fun k -> k "%s" msg) 31 | -------------------------------------------------------------------------------- /src/util/Log.mli: -------------------------------------------------------------------------------- 1 | (** Logging function, for debugging *) 2 | 3 | val enabled : bool 4 | 5 | val set_debug : int -> unit 6 | (** Set debug level *) 7 | 8 | val get_debug : unit -> int 9 | (** Current debug level *) 10 | 11 | val debugf : 12 | int -> ((('a, Format.formatter, unit, unit) format4 -> 'a) -> unit) -> unit 13 | (** Emit a debug message at the given level. If the level is lower 14 | than [get_debug ()], the message will indeed be emitted *) 15 | 16 | val debug : int -> string -> unit 17 | (** Simpler version of {!debug}, without formatting *) 18 | 19 | val set_debug_out : Format.formatter -> unit 20 | (** Change the output formatter. *) 21 | -------------------------------------------------------------------------------- /src/util/Profile.ml: -------------------------------------------------------------------------------- 1 | include Trace_core 2 | -------------------------------------------------------------------------------- /src/util/Sidekick_util.ml: -------------------------------------------------------------------------------- 1 | (* re-exports *) 2 | module Fmt = CCFormat 3 | module Util = Util 4 | module Vec = Vec 5 | module Veci = Veci 6 | module Vec_float = Vec_float 7 | module Vec_sig = Vec_sig 8 | module Bitvec = Bitvec 9 | module Int_id = Int_id 10 | 11 | (* TODO: a specialized representation *) 12 | module Int_tbl = Util.Int_tbl 13 | module Int_set = Util.Int_set 14 | module Int_map = Util.Int_map 15 | module Event = Event 16 | module Backtrack_stack = Backtrack_stack 17 | module Backtrackable_tbl = Backtrackable_tbl 18 | module Backtrackable_ref = Backtrackable_ref 19 | module Log = Log 20 | module Error = Error 21 | module Bag = Bag 22 | module Stat = Stat 23 | module Hash = Hash 24 | module Profile = Profile 25 | module Chunk_stack = Chunk_stack 26 | module Ser_value = Ser_value 27 | module Ser_decode = Ser_decode 28 | 29 | let ( let@ ) = ( @@ ) 30 | -------------------------------------------------------------------------------- /src/util/Stat.mli: -------------------------------------------------------------------------------- 1 | (** {1 Statistics} *) 2 | 3 | module Fmt = CCFormat 4 | 5 | type t 6 | 7 | val create : unit -> t 8 | 9 | type 'a counter 10 | 11 | val mk_int : t -> string -> int counter 12 | val mk_float : t -> string -> float counter 13 | val incr : int counter -> unit 14 | val incr_f : float counter -> float -> unit 15 | val set : 'a counter -> 'a -> unit 16 | 17 | type ex_counter 18 | (** Existential counter *) 19 | 20 | val all : t -> ex_counter Iter.t 21 | val pp_counters : ex_counter Iter.t Fmt.printer 22 | val pp : t Fmt.printer 23 | 24 | val global : t 25 | (** Global statistics, by default *) 26 | -------------------------------------------------------------------------------- /src/util/Util.mli: -------------------------------------------------------------------------------- 1 | (* This file is free software. See file "license" for more details. *) 2 | 3 | (** {1 Utils} *) 4 | 5 | type 'a printer = 'a CCFormat.printer 6 | 7 | val pp_list : ?sep:string -> 'a printer -> 'a list printer 8 | val pp_iter : ?sep:string -> 'a printer -> 'a Iter.t printer 9 | val pp_array : ?sep:string -> 'a printer -> 'a array printer 10 | val pp_pair : ?sep:string -> 'a printer -> 'b printer -> ('a * 'b) printer 11 | val flat_map_l_arr : ('a -> 'b array) -> 'a list -> 'b list 12 | 13 | val array_of_list_map : ('a -> 'b) -> 'a list -> 'b array 14 | (** [array_of_list_map f l] is the same as [Array.of_list @@ List.map f l] *) 15 | 16 | val array_to_list_map : ('a -> 'b) -> 'a array -> 'b list 17 | val lazy_map : ('a -> 'b) -> 'a lazy_t -> 'b lazy_t 18 | val lazy_map2 : ('a -> 'b -> 'c) -> 'a lazy_t -> 'b lazy_t -> 'c lazy_t 19 | val array_iteri2 : f:(int -> 'a -> 'b -> unit) -> 'a array -> 'b array -> unit 20 | 21 | val setup_gc : unit -> unit 22 | (** Change parameters of the GC *) 23 | 24 | module Int_set : CCSet.S with type elt = int 25 | module Int_map : CCMap.S with type key = int 26 | module Int_tbl : CCHashtbl.S with type key = int 27 | module Str_tbl : CCHashtbl.S with type key = string 28 | module Str_map : CCMap.S with type key = string 29 | -------------------------------------------------------------------------------- /src/util/Vec_float.mli: -------------------------------------------------------------------------------- 1 | (** Vectors of floats 2 | 3 | These vectors are more optimized than {!Vec}. *) 4 | 5 | include Vec_sig.S with type elt := float 6 | -------------------------------------------------------------------------------- /src/util/Veci.mli: -------------------------------------------------------------------------------- 1 | (** Vectors of int32 integers 2 | 3 | These vectors are more optimized than {!Vec}. *) 4 | 5 | include Vec_sig.S with type elt := int 6 | 7 | val push_i32 : t -> int32 -> unit 8 | val get_i32 : t -> int -> int32 9 | val set_i32 : t -> int -> int32 -> unit 10 | -------------------------------------------------------------------------------- /src/util/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_util) 3 | (public_name sidekick.util) 4 | (flags :standard -warn-error -a+8) 5 | (libraries containers iter sidekick.sigs bigarray unix trace.core)) 6 | -------------------------------------------------------------------------------- /src/util/gen/dune: -------------------------------------------------------------------------------- 1 | ;(executable 2 | ;(name gen_vec)) 3 | -------------------------------------------------------------------------------- /src/util/gen/gen_vec.ml.tmp: -------------------------------------------------------------------------------- 1 | 2 | let () = 3 | -------------------------------------------------------------------------------- /src/util/ser_value.ml: -------------------------------------------------------------------------------- 1 | module Fmt = CCFormat 2 | 3 | type t = 4 | | Null 5 | | Bool of bool 6 | | Str of string 7 | | Bytes of string 8 | | Int of int 9 | | List of t list 10 | | Dict of t Util.Str_map.t 11 | 12 | let null = Null 13 | let bool b : t = Bool b 14 | let int i : t = Int i 15 | let string x : t = Str x 16 | let bytes x : t = Bytes x 17 | let list x : t = List x 18 | let dict x : t = Dict x 19 | let dict_of_list l = dict (Util.Str_map.of_list l) 20 | 21 | let is_null = function 22 | | Null -> true 23 | | _ -> false 24 | 25 | let rec pp out (self : t) = 26 | match self with 27 | | Null -> Fmt.string out "null" 28 | | Bool b -> Fmt.bool out b 29 | | Int i -> Fmt.int out i 30 | | Str s -> Fmt.Dump.string out s 31 | | Bytes s -> Fmt.fprintf out "(bytes %S)" s 32 | | List l -> Fmt.Dump.list pp out l 33 | | Dict m -> 34 | Fmt.fprintf out "{@[%a@]}" 35 | (Util.pp_iter ~sep:", " Fmt.Dump.(pair string pp)) 36 | (Util.Str_map.to_iter m) 37 | -------------------------------------------------------------------------------- /src/util/ser_value.mli: -------------------------------------------------------------------------------- 1 | (** Serialization representation. 2 | 3 | A [Ser_value.t] describes how to serialized some structured 4 | data into bytes. 5 | It reflects the shape of the structured data but does not commit to a 6 | particular serialization format. 7 | *) 8 | 9 | type t = private 10 | | Null 11 | | Bool of bool 12 | | Str of string 13 | | Bytes of string 14 | | Int of int 15 | | List of t list 16 | | Dict of t Util.Str_map.t 17 | 18 | val null : t 19 | val bool : bool -> t 20 | val int : int -> t 21 | val string : string -> t 22 | val bytes : string -> t 23 | val list : t list -> t 24 | val dict : t Util.Str_map.t -> t 25 | val dict_of_list : (string * t) list -> t 26 | val is_null : t -> bool 27 | 28 | include Sidekick_sigs.PRINT with type t := t 29 | -------------------------------------------------------------------------------- /src/util/tests/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_test_util) 3 | (flags :standard -warn-error -a+8 -open Sidekick_util) 4 | (libraries qcheck alcotest sidekick.util)) 5 | -------------------------------------------------------------------------------- /src/util/tests/sidekick_test_util.ml: -------------------------------------------------------------------------------- 1 | let tests = [ Test_bitvec.tests; Test_chunk_stack.tests ] 2 | let props = [] 3 | -------------------------------------------------------------------------------- /src/util/tests/test_bitvec.ml: -------------------------------------------------------------------------------- 1 | module A = Alcotest 2 | 3 | let spf = Printf.sprintf 4 | let msgline line = spf "test at line %d" line 5 | let alco_mk name f = name, `Quick, f 6 | 7 | module BV = Bitvec 8 | 9 | let t1 = 10 | alco_mk "mkgetset" @@ fun () -> 11 | let bv = BV.create () in 12 | BV.ensure_size bv 200; 13 | A.(check bool) (msgline __LINE__) false (BV.get bv 0); 14 | A.(check bool) (msgline __LINE__) false (BV.get bv 1); 15 | for i = 30 to 150 do 16 | A.(check bool) (msgline __LINE__) false (BV.get bv i) 17 | done; 18 | 19 | BV.set bv 25 true; 20 | BV.set bv 1 true; 21 | BV.set bv 127 true; 22 | BV.set bv 126 true; 23 | BV.set bv 126 false; 24 | 25 | for i = 0 to 150 do 26 | A.(check bool) (msgline __LINE__) (i = 1 || i = 25 || i = 127) (BV.get bv i) 27 | done; 28 | () 29 | 30 | let tests = "bitvec", [ t1 ] 31 | -------------------------------------------------------------------------------- /src/zarith/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name sidekick_zarith) 3 | (public_name sidekick.zarith) 4 | (synopsis "Interface to zarith (optional) for arithmetic") 5 | (optional) ; dep on zarith 6 | (flags :standard -warn-error -a+8) 7 | (libraries sidekick.core sidekick.arith zarith)) 8 | -------------------------------------------------------------------------------- /src/zarith/sidekick_zarith.ml: -------------------------------------------------------------------------------- 1 | module Int : Sidekick_arith.INT_FULL with type t = Z.t = struct 2 | include Z 3 | include Z.Compare 4 | 5 | let pp = pp_print 6 | let divexact = divexact 7 | let ( / ) = div 8 | 9 | let probab_prime x = 10 | match probab_prime x 10 with 11 | | 0 -> false 12 | | 1 | 2 -> true 13 | | _ -> assert false 14 | 15 | let of_string s = try Some (of_string s) with _ -> None 16 | end 17 | 18 | module Rational : 19 | Sidekick_arith.RATIONAL with type t = Q.t and type bigint = Z.t = struct 20 | type bigint = Z.t 21 | 22 | include Q 23 | 24 | let denum = den 25 | let pp = pp_print 26 | let hash a = CCHash.combine2 (Z.hash (num a)) (Z.hash (den a)) 27 | let infinity = Q.inf 28 | let minus_infinity = Q.minus_inf 29 | let is_real = Q.is_real 30 | let is_int q = is_real q && Z.(equal (denum q) one) 31 | 32 | let as_int q = 33 | if is_int q then 34 | Some (to_bigint q) 35 | else 36 | None 37 | 38 | let floor q = Q.to_bigint q 39 | 40 | let ceil q = 41 | let n = Q.to_bigint q in 42 | if is_int q then 43 | n 44 | else 45 | Z.(n + one) 46 | 47 | let pp_approx n out q = Format.fprintf out "%*.1f" n (Q.to_float q) 48 | let of_string s = try Some (of_string s) with _ -> None 49 | end 50 | -------------------------------------------------------------------------------- /src/zarith/sidekick_zarith.mli: -------------------------------------------------------------------------------- 1 | module Int : Sidekick_arith.INT_FULL with type t = Z.t 2 | 3 | module Rational : 4 | Sidekick_arith.RATIONAL with type t = Q.t and type bigint = Z.t 5 | -------------------------------------------------------------------------------- /sudoku_solve.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | OPTS="--profile=release --display=quiet" 3 | exec dune exec $OPTS examples/sudoku/sudoku_solve.exe -- $@ 4 | -------------------------------------------------------------------------------- /tests/acycl-diamond/acycl_data_10.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_UFDT) 2 | (declare-datatypes ((t 0)) 3 | (((T0) (T1 (prev1 t)) (T2 (prev2 t))))) 4 | 5 | (declare-const c1 t) 6 | (declare-const c2 t) 7 | (declare-const c3 t) 8 | (declare-const c4 t) 9 | (declare-const c5 t) 10 | (declare-const c6 t) 11 | (declare-const c7 t) 12 | (declare-const c8 t) 13 | (declare-const c9 t) 14 | (declare-const c10 t) 15 | (assert (= c1 c10)) 16 | (assert (not (= c1 T0))) 17 | (assert (not (= c2 T0))) 18 | (assert (not (= c3 T0))) 19 | (assert (not (= c4 T0))) 20 | (assert (not (= c5 T0))) 21 | (assert (not (= c6 T0))) 22 | (assert (not (= c7 T0))) 23 | (assert (not (= c8 T0))) 24 | (assert (not (= c9 T0))) 25 | (assert (not (= c10 T0))) 26 | (assert (or (= c1 (T1 c2)) (= c1 (T2 c2)))) 27 | (assert (or (= c2 (T1 c3)) (= c2 (T2 c3)))) 28 | (assert (or (= c3 (T1 c4)) (= c3 (T2 c4)))) 29 | (assert (or (= c4 (T1 c5)) (= c4 (T2 c5)))) 30 | (assert (or (= c5 (T1 c6)) (= c5 (T2 c6)))) 31 | (assert (or (= c6 (T1 c7)) (= c6 (T2 c7)))) 32 | (assert (or (= c7 (T1 c8)) (= c7 (T2 c8)))) 33 | (assert (or (= c8 (T1 c9)) (= c8 (T2 c9)))) 34 | (assert (or (= c9 (T1 c10)) (= c9 (T2 c10)))) 35 | (check-sat) 36 | (exit) 37 | 38 | -------------------------------------------------------------------------------- /tests/acycl-diamond/gen_acycl_data.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env lua 2 | 3 | header = [[ 4 | (set-logic QF_UFDT) 5 | (declare-datatypes ((t 0)) 6 | (((T0) (T1 (prev1 t)) (T2 (prev2 t))))) 7 | ]] 8 | 9 | footer = [[ 10 | (check-sat) 11 | (exit) 12 | ]] 13 | 14 | function printf(...) 15 | print(string.format(...)) 16 | end 17 | 18 | function mkdiamond(n) 19 | -- decls 20 | for i=1,n do 21 | printf("(declare-const c%d t)", i) 22 | end 23 | printf("(assert (= c1 c%d))", n) 24 | 25 | -- now for the diamond itself 26 | for i=1,n do 27 | printf("(assert (not (= c%d T0)))",i) 28 | end 29 | for i=1, n-1 do 30 | local s = "c" .. i 31 | local next_ = "c" .. (i+1) 32 | 33 | printf("(assert (or (= %s (T1 %s)) (= %s (T2 %s))))", s, next_, s, next_) 34 | end 35 | end 36 | 37 | n = tonumber(arg[1]) 38 | 39 | print(header) 40 | mkdiamond(n) 41 | print(footer) 42 | -------------------------------------------------------------------------------- /tests/bf/README: -------------------------------------------------------------------------------- 1 | Source: http://www.cs.ubc.ca/~hoos/SATLIB/Benchmarks/SAT/DIMACS/BF/bf.tar.gz 2 | Description: http://www.cs.ubc.ca/~hoos/SATLIB/Benchmarks/SAT/DIMACS/BF/descr.html 3 | -------------------------------------------------------------------------------- /tests/bugs/double_atom.cnf: -------------------------------------------------------------------------------- 1 | p cnf 2 3 2 | c Local assumptions 3 | 4 | c Hypotheses 5 | -2 -2 -1 -1 0 6 | 1 0 7 | 2 0 8 | c Lemmas 9 | 10 | c :status unsat 11 | -------------------------------------------------------------------------------- /tests/dubois/README: -------------------------------------------------------------------------------- 1 | Source: http://www.cs.ubc.ca/~hoos/SATLIB/Benchmarks/SAT/DIMACS/DUBOIS/dubois.tar.gz 2 | Description: http://www.cs.ubc.ca/~hoos/SATLIB/Benchmarks/SAT/DIMACS/DUBOIS/descr.html 3 | -------------------------------------------------------------------------------- /tests/dune: -------------------------------------------------------------------------------- 1 | (data_only_dirs .) 2 | -------------------------------------------------------------------------------- /tests/hanoi/README: -------------------------------------------------------------------------------- 1 | Source : http://www.cs.ubc.ca/~hoos/SATLIB/Benchmarks/SAT/DIMACS/HANOI/hanoi.tar.gz 2 | Description : http://www.cs.ubc.ca/~hoos/SATLIB/Benchmarks/SAT/DIMACS/HANOI/descr.html 3 | -------------------------------------------------------------------------------- /tests/jnh/README: -------------------------------------------------------------------------------- 1 | Source: http://www.cs.ubc.ca/~hoos/SATLIB/Benchmarks/SAT/DIMACS/JNH/jnh.tar.gz 2 | Description: http://www.cs.ubc.ca/~hoos/SATLIB/Benchmarks/SAT/DIMACS/JNH/descr.html 3 | -------------------------------------------------------------------------------- /tests/pigeon/README: -------------------------------------------------------------------------------- 1 | Source : http://www.cs.ubc.ca/~hoos/SATLIB/Benchmarks/SAT/DIMACS/PHOLE/pigeon-hole.tar.gz 2 | Description : http://www.cs.ubc.ca/~hoos/SATLIB/Benchmarks/SAT/DIMACS/PHOLE/descr.html 3 | c status: unsat 4 | -------------------------------------------------------------------------------- /tests/pret/README: -------------------------------------------------------------------------------- 1 | Source: http://www.cs.ubc.ca/~hoos/SATLIB/Benchmarks/SAT/DIMACS/PRET/pret.tar.gz 2 | Description: http://www.cs.ubc.ca/~hoos/SATLIB/Benchmarks/SAT/DIMACS/PRET/descr.html 3 | -------------------------------------------------------------------------------- /tests/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CURDIR=`dirname $0` 4 | SOLVER="$CURDIR/../main.exe" 5 | 6 | solvertest () { 7 | # FIXME 8 | #for f in `find -L $1 -type f -name '*.cnf' -o -name '*.smt2'` 9 | for f in `find -L $1 -type f -name '*.cnf'` 10 | do 11 | echo -ne "\r\033[KTesting $f..." 12 | "$SOLVER" -s $3 -time 30s -size 1G -check $f | grep $2 13 | RET=$? 14 | if [ $RET -ne 0 ]; 15 | then 16 | echo -e "\r\033[K\e[31m[KO]\e[0m $3 - $f" 17 | exit 2 18 | fi 19 | done 20 | echo -e "\r\033[K\e[32m[OK]\e[0m $3/$2" 21 | } 22 | 23 | solvertest "$CURDIR/sat/" "Sat" $1 24 | solvertest "$CURDIR/unsat/" "Unsat" $1 25 | -------------------------------------------------------------------------------- /tests/sat/Carpark2-ausgabe-8-reduced.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun _9 () Real) 2 | (assert (= 0.0 (+ _9 1))) 3 | (check-sat) 4 | -------------------------------------------------------------------------------- /tests/sat/hanoi4.cnf: -------------------------------------------------------------------------------- 1 | ../hanoi/hanoi4.cnf -------------------------------------------------------------------------------- /tests/sat/polypaver-bench-exp-3d-chunk-0032.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_LRA) 3 | (set-info :source | 4 | These benchmarks used in the paper: 5 | 6 | Dejan Jovanovic and Leonardo de Moura. Solving Non-Linear Arithmetic. 7 | In IJCAR 2012, published as LNCS volume 7364, pp. 339--354. 8 | 9 | The meti-tarski benchmarks are proof obligations extracted from the 10 | Meti-Tarski project, see: 11 | 12 | B. Akbarpour and L. C. Paulson. MetiTarski: An automatic theorem prover 13 | for real-valued special functions. Journal of Automated Reasoning, 14 | 44(3):175-205, 2010. 15 | 16 | Submitted by Dejan Jovanovic for SMT-LIB. 17 | 18 | 19 | |) 20 | (set-info :category "industrial") 21 | (set-info :status sat) 22 | (declare-fun skoZ () Real) 23 | (declare-fun skoY () Real) 24 | (declare-fun skoX () Real) 25 | (assert (let ((?v_0 (* skoX (- 1))) (?v_1 (* skoY (- 1)))) (and (<= (+ ?v_0 ?v_1) skoZ) (and (not (<= skoZ (+ (+ (/ 3 2) ?v_0) ?v_1))) (and (<= skoZ 1) (and (<= skoY 1) (and (<= skoX 1) (and (<= 0 skoZ) (and (<= 0 skoY) (<= 0 skoX)))))))))) 26 | (check-sat) 27 | (exit) 28 | -------------------------------------------------------------------------------- /tests/sat/reg_2022-09-10.smt2: -------------------------------------------------------------------------------- 1 | 2 | ; falsly declared unsat. minimized 3 | ; from tests/sat/QF_UF_schedule_world.2.prop1_ab_cti_max.smt2 using ddSMT . 4 | (declare-fun p () Bool) 5 | (declare-fun y () Bool) 6 | (assert (= false (not p))) 7 | (assert p) 8 | (assert (= y p)) 9 | (assert y) 10 | (check-sat) 11 | -------------------------------------------------------------------------------- /tests/sat/smtlib.620524.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_UFLRA) 3 | (set-info :source |Benchmarks from the paper: "Extending Sledgehammer with SMT Solvers" by Jasmin Blanchette, Sascha Bohme, and Lawrence C. Paulson, CADE 2011. Translated to SMT2 by Andrew Reynolds and Morgan Deters.|) 4 | (set-info :category "industrial") 5 | (set-info :status sat) 6 | (declare-sort S1 0) 7 | (declare-fun f1 () S1) 8 | (declare-fun f2 () S1) 9 | (declare-fun f3 (Real) Real) 10 | (declare-fun f4 () Real) 11 | (declare-fun f5 () Real) 12 | (assert (not (= f1 f2))) 13 | (assert (not (= (f3 (- f4 f5)) (- (f3 f4))))) 14 | (check-sat) 15 | (exit) 16 | -------------------------------------------------------------------------------- /tests/sat/ssa1.cnf: -------------------------------------------------------------------------------- 1 | ../ssa/ssa7552-038.cnf -------------------------------------------------------------------------------- /tests/sat/ssa2.cnf: -------------------------------------------------------------------------------- 1 | ../ssa/ssa7552-158.cnf -------------------------------------------------------------------------------- /tests/sat/ssa3.cnf: -------------------------------------------------------------------------------- 1 | ../ssa/ssa7552-159.cnf -------------------------------------------------------------------------------- /tests/sat/ssa4.cnf: -------------------------------------------------------------------------------- 1 | ../ssa/ssa7552-160.cnf -------------------------------------------------------------------------------- /tests/sat/test-000.cnf: -------------------------------------------------------------------------------- 1 | c Status: SAT 2 | p cnf 2 1 3 | 1 2 0 4 | -------------------------------------------------------------------------------- /tests/sat/test-002.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () Bool) 2 | (declare-fun b () Bool) 3 | (assert (or a b)) 4 | (check-sat) 5 | -------------------------------------------------------------------------------- /tests/sat/test-006.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () Bool) 2 | (declare-fun b () Bool) 3 | (assert (or (and a b) true (not a) (not b))) 4 | (check-sat) 5 | -------------------------------------------------------------------------------- /tests/sat/test-007.smt2: -------------------------------------------------------------------------------- 1 | (declare-sort $i 0) 2 | (declare-fun a () $i) 3 | (declare-fun b () $i) 4 | (declare-fun c () $i) 5 | (assert (and (= a b) (= b c))) 6 | (check-sat) 7 | -------------------------------------------------------------------------------- /tests/sat/test-010.smt2: -------------------------------------------------------------------------------- 1 | (declare-sort $i 0) 2 | (declare-fun a () $i) 3 | (declare-fun b () $i) 4 | (declare-fun c () $i) 5 | (declare-fun d () $i) 6 | (assert (and (= a b) (= b c) (or (not (= a c)) (= a d)))) 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/sat/test-014.cnf: -------------------------------------------------------------------------------- 1 | c Doublons test 2 | p cnf 2 3 3 | 4 | c dummy clause that might cause a bug 5 | -1 1 0 6 | 7 | c Clearly SAT clauses 8 | 2 0 9 | -1 -2 0 10 | -------------------------------------------------------------------------------- /tests/sat/typed_v2l20091.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status sat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () nat) 22 | (declare-fun x3 () list) 23 | (declare-fun x4 () list) 24 | (declare-fun x5 () tree) 25 | (declare-fun x6 () tree) 26 | 27 | (assert (and (= (ite ((_ is cons) x4) (cdr x4) null) null) (not (= (cons (leaf (ite ((_ is leaf) (leaf x2)) (data (leaf x2)) zero)) (cons x6 (ite ((_ is node) (leaf zero)) (children (leaf zero)) null))) null)))) 28 | (check-sat) 29 | (exit) 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/sat/typed_v3l30001.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status sat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () nat) 22 | (declare-fun x3 () nat) 23 | (declare-fun x4 () list) 24 | (declare-fun x5 () list) 25 | (declare-fun x6 () list) 26 | (declare-fun x7 () tree) 27 | (declare-fun x8 () tree) 28 | (declare-fun x9 () tree) 29 | 30 | (assert (and (and (not ((_ is node) (leaf zero))) ((_ is succ) x1)) (= (leaf x1) (ite ((_ is cons) x5) (car x5) (leaf zero))))) 31 | (check-sat) 32 | (exit) 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/sat/v1l20001.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status sat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () list) 22 | (declare-fun x3 () tree) 23 | 24 | (assert (and (not ((_ is leaf) (node (cdr (cons (leaf (data (leaf zero))) x2))))) ((_ is cons) (cons x3 (cdr (cons (node x2) (cons x3 (cdr (cdr (cdr (children (car (cons (car null) null))))))))))))) 25 | (check-sat) 26 | (exit) 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/sat/v1l20035.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status sat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () list) 22 | (declare-fun x3 () tree) 23 | 24 | (assert (and (= (cons x3 (cdr x2)) (cons x3 (cdr (children (node (cdr x2)))))) (not (= (pred (pred (data (node (cdr (children (leaf (data (car (children (leaf zero))))))))))) (pred (pred x1)))))) 25 | (check-sat) 26 | (exit) 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/sat/v1l20060.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status sat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () list) 22 | (declare-fun x3 () tree) 23 | 24 | (assert (and (not ((_ is cons) x2)) (not (= (leaf (data (leaf x1))) x3)))) 25 | (check-sat) 26 | (exit) 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/sat/v1l40032.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status sat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () list) 22 | (declare-fun x3 () tree) 23 | 24 | (assert (and (and (and ((_ is zero) (pred (succ (data (node x2))))) (not (= (node (children x3)) x3))) ((_ is cons) (cdr (cons (leaf (succ (succ (pred (succ (data (car null))))))) (children (car null)))))) ((_ is zero) zero))) 25 | (check-sat) 26 | (exit) 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/sat/v1l60008.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status sat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () list) 22 | (declare-fun x3 () tree) 23 | 24 | (assert (and (and (and (and (and (not (= (cdr x2) null)) (= (children (leaf zero)) (children x3))) (not ((_ is zero) (succ x1)))) ((_ is zero) zero)) ((_ is zero) (pred (succ (data (car null)))))) (= (leaf (succ (data (car (cdr (cdr (cdr (cdr (cdr (cdr x2)))))))))) (car (cdr null))))) 25 | (check-sat) 26 | (exit) 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/sat/v3l20077.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status sat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () nat) 22 | (declare-fun x3 () nat) 23 | (declare-fun x4 () list) 24 | (declare-fun x5 () list) 25 | (declare-fun x6 () list) 26 | (declare-fun x7 () tree) 27 | (declare-fun x8 () tree) 28 | (declare-fun x9 () tree) 29 | 30 | (assert (and (not ((_ is zero) x1)) (= (cdr x6) x6))) 31 | (check-sat) 32 | (exit) 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/sat/v3l30062.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status sat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () nat) 22 | (declare-fun x3 () nat) 23 | (declare-fun x4 () list) 24 | (declare-fun x5 () list) 25 | (declare-fun x6 () list) 26 | (declare-fun x7 () tree) 27 | (declare-fun x8 () tree) 28 | (declare-fun x9 () tree) 29 | 30 | (assert (and (and (not (= x5 null)) ((_ is leaf) x8)) (not (= x2 (pred x1))))) 31 | (check-sat) 32 | (exit) 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/ssa/README: -------------------------------------------------------------------------------- 1 | Source : http://www.cs.ubc.ca/~hoos/SATLIB/Benchmarks/SAT/DIMACS/SSA/ssa.tar.gz 2 | Description : http://www.cs.ubc.ca/~hoos/SATLIB/Benchmarks/SAT/DIMACS/BF/descr.html 3 | -------------------------------------------------------------------------------- /tests/unsat/bug-01.cnf: -------------------------------------------------------------------------------- 1 | ../bugs/double_atom.cnf -------------------------------------------------------------------------------- /tests/unsat/clocksynchro_2clocks.worst_case_skew.base.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_LRA) 3 | (set-info :source | Clock Synchronization. Bruno Dutertre (bruno@csl.sri.com) |) 4 | (set-info :category "industrial") 5 | (set-info :status unsat) 6 | (declare-fun x_0 () Real) 7 | (declare-fun x_1 () Real) 8 | (declare-fun x_2 () Real) 9 | (declare-fun x_3 () Real) 10 | (declare-fun x_4 () Real) 11 | (declare-fun x_5 () Real) 12 | (declare-fun x_6 () Real) 13 | (declare-fun x_7 () Real) 14 | (assert (let ((?v_0 (+ x_0 (/ 999 1000))) (?v_1 (+ x_0 (/ 1001 1000))) (?v_2 (not (<= (- 1 1) (+ (+ (+ x_5 x_6) (* (* (+ x_7 x_4) 2) (/ 1 999))) (/ 2335 666)))))) (and (and (and (and (and (and (and (and (and (and (and (not (<= x_3 0)) (not (<= x_4 0))) (not (<= x_5 0))) (not (< x_6 (+ x_5 (* (* (+ (* (* x_4 1) (/ 1 2)) 1) 1001) (/ 1 999)))))) (< x_7 (- (* (* (- (- x_4 x_6) 1) 999) (/ 1 2)) 1))) (not (< x_7 (* (* (+ (+ (+ x_3 x_5) x_6) (/ 1501 1000)) 1001) (/ 1 999))))) (= x_0 0)) (<= ?v_0 x_1)) (<= x_1 ?v_1)) (<= ?v_0 x_2)) (<= x_2 ?v_1)) (or (or (or ?v_2 ?v_2) ?v_2) ?v_2)))) 15 | (check-sat) 16 | (exit) 17 | -------------------------------------------------------------------------------- /tests/unsat/cong_fff.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-sort a 0) 3 | (declare-fun x () a) 4 | (declare-fun f (a) a) 5 | (assert (= x (f x))) 6 | (assert (not (= x (f (f (f x)))))) 7 | (check-sat) 8 | -------------------------------------------------------------------------------- /tests/unsat/cong_fff_conditional.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-sort a 0) 3 | (declare-fun x () a) 4 | (declare-fun y () a) 5 | (declare-fun f (a) a) 6 | (declare-fun p1 () Bool) 7 | (declare-fun p2 () Bool) 8 | (assert (or p1 (= x y))) 9 | (assert (or p1 (= y (f x)))) 10 | (assert (not (= x (f (f (f x)))))) 11 | (assert (or (not p1) p2)) 12 | (assert (or (not p1) (not p2))) 13 | (check-sat) 14 | -------------------------------------------------------------------------------- /tests/unsat/cong_fff_conditional4.smt2: -------------------------------------------------------------------------------- 1 | 2 | 3 | (declare-sort a 0) 4 | (declare-fun x () a) 5 | (declare-fun y () a) 6 | (declare-fun f (a) a) 7 | (declare-fun p1 () Bool) 8 | (assert (= x y)) 9 | (assert (or p1 (= y (f x)))) 10 | (assert (or (not p1) (= y (f (f x))))) 11 | (assert (not (= x (f (f (f (f x))))))) 12 | (check-sat) 13 | -------------------------------------------------------------------------------- /tests/unsat/cong_fff_conditional6.smt2: -------------------------------------------------------------------------------- 1 | 2 | 3 | (declare-sort a 0) 4 | (declare-fun x () a) 5 | (declare-fun y () a) 6 | (declare-fun f (a) a) 7 | (declare-fun p1 () Bool) 8 | (assert (= x y)) 9 | (assert (or p1 (= y (f x)))) 10 | (assert (or (not p1) (= y (f (f x))))) 11 | (assert (not (= x (f (f (f (f (f (f x))))))))) 12 | (check-sat) 13 | -------------------------------------------------------------------------------- /tests/unsat/data_acycl1.smt2: -------------------------------------------------------------------------------- 1 | 2 | (set-info :status unsat) 3 | (declare-datatypes ((nat 0)) (((Z) (S (pred nat))))) 4 | (declare-const n nat) 5 | 6 | (assert (= n (S (S n)))) 7 | 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/unsat/data_acycl_if.smt2: -------------------------------------------------------------------------------- 1 | 2 | (set-info :status unsat) 3 | (declare-datatypes ((nat 0)) (((Z) (S (pred nat))))) 4 | (declare-const p Bool) 5 | (declare-const n nat) 6 | (declare-const n_t nat) 7 | (declare-const n_f nat) 8 | 9 | (assert (= n_t (S n))) 10 | (assert (= n_f (S (S n)))) 11 | (assert (=> p (= n (S n_t)))) 12 | (assert (=> (not p) (= n (S n_f)))) 13 | 14 | (check-sat) 15 | -------------------------------------------------------------------------------- /tests/unsat/data_card1.smt2: -------------------------------------------------------------------------------- 1 | 2 | (set-info :status unsat) 3 | (declare-datatypes ((three 0)) (((A) (B) (C)))) 4 | (declare-const t1 three) 5 | (declare-const t2 three) 6 | (declare-const t3 three) 7 | (declare-const t4 three) 8 | 9 | (assert (distinct t1 t2 t3 t4)) 10 | 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/unsat/diamond2_cong_if.smt2: -------------------------------------------------------------------------------- 1 | 2 | ; see diamond2_cong, but using "if" 3 | ; diamond based on congruence, not just transitivity 4 | (declare-sort a 0) 5 | (declare-fun x0 () a) 6 | (declare-fun y0 () a) 7 | (declare-fun z0 () a) 8 | (declare-fun p0 () Bool) 9 | (declare-fun x1 () a) 10 | (declare-fun y1 () a) 11 | (declare-fun z1 () a) 12 | (declare-fun p1 () Bool) 13 | (declare-fun x2 () a) 14 | (declare-fun f (a) a) 15 | (assert (not (= x2 (f (f x0))))) 16 | (assert (= x1 (f y0))) 17 | (assert (= x1 (f z0))) 18 | (assert (= x0 (ite p0 y0 z0))) 19 | (assert (= x2 (f y1))) 20 | (assert (= x2 (f z1))) 21 | (assert (= x1 (ite p1 y1 z1))) 22 | (check-sat) 23 | -------------------------------------------------------------------------------- /tests/unsat/eq_diamond2.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_UF) 3 | (set-info :source | 4 | Generating minimum transitivity constraints in P-time for deciding Equality Logic, 5 | Ofer Strichman and Mirron Rozanov, 6 | SMT Workshop 2005. 7 | 8 | Translator: Leonardo de Moura. |) 9 | (set-info :category "crafted") 10 | (set-info :status unsat) 11 | (declare-sort U 0) 12 | (declare-fun x0 () U) 13 | (declare-fun y0 () U) 14 | (declare-fun z0 () U) 15 | (declare-fun x1 () U) 16 | (declare-fun y1 () U) 17 | (declare-fun z1 () U) 18 | (assert (and (or (and (= x0 y0) (= y0 x1)) (and (= x0 z0) (= z0 x1))) (not (= x0 x1)))) 19 | (check-sat) 20 | (exit) 21 | -------------------------------------------------------------------------------- /tests/unsat/eq_diamond3.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_UF) 2 | (set-info :source | 3 | Generating minimum transitivity constraints in P-time for deciding Equality Logic, 4 | Ofer Strichman and Mirron Rozanov, 5 | SMT Workshop 2005. 6 | 7 | Translator: Leonardo de Moura. |) 8 | (set-info :smt-lib-version 2.0) 9 | (set-info :category "crafted") 10 | (set-info :status unsat) 11 | (declare-sort U 0) 12 | (declare-fun x0 () U) 13 | (declare-fun y0 () U) 14 | (declare-fun z0 () U) 15 | (declare-fun x1 () U) 16 | (declare-fun y1 () U) 17 | (declare-fun z1 () U) 18 | (declare-fun x2 () U) 19 | (declare-fun y2 () U) 20 | (declare-fun z2 () U) 21 | (declare-fun x3 () U) 22 | (declare-fun y3 () U) 23 | (declare-fun z3 () U) 24 | (assert 25 | (and 26 | (or (and (= x0 y0) (= y0 x1)) (and (= x0 z0) (= z0 x1))) 27 | (or (and (= x1 y1) (= y1 x2)) (and (= x1 z1) (= z1 x2))) 28 | (or (and (= x2 y2) (= y2 x3)) (and (= x2 z2) (= z2 x3))) 29 | (not (= x0 x3)))) 30 | (check-sat) 31 | (exit) 32 | ; :status unsat 33 | -------------------------------------------------------------------------------- /tests/unsat/eq_diamond4.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_UF) 2 | (set-info :source | 3 | Generating minimum transitivity constraints in P-time for deciding Equality Logic, 4 | Ofer Strichman and Mirron Rozanov, 5 | SMT Workshop 2005. 6 | 7 | Translator: Leonardo de Moura. |) 8 | (set-info :smt-lib-version 2.0) 9 | (set-info :category "crafted") 10 | (set-info :status unsat) 11 | (declare-sort U 0) 12 | (declare-fun x0 () U) 13 | (declare-fun y0 () U) 14 | (declare-fun z0 () U) 15 | (declare-fun x1 () U) 16 | (declare-fun y1 () U) 17 | (declare-fun z1 () U) 18 | (declare-fun x2 () U) 19 | (declare-fun y2 () U) 20 | (declare-fun z2 () U) 21 | (declare-fun x3 () U) 22 | (declare-fun y3 () U) 23 | (declare-fun z3 () U) 24 | (declare-fun x4 () U) 25 | (declare-fun y4 () U) 26 | (declare-fun z4 () U) 27 | (assert 28 | (and 29 | (or (and (= x0 y0) (= y0 x1)) (and (= x0 z0) (= z0 x1))) 30 | (or (and (= x1 y1) (= y1 x2)) (and (= x1 z1) (= z1 x2))) 31 | (or (and (= x2 y2) (= y2 x3)) (and (= x2 z2) (= z2 x3))) 32 | (or (and (= x3 y3) (= y3 x4)) (and (= x3 z3) (= z3 x4))) 33 | (not (= x1 x4)))) 34 | (check-sat) 35 | (exit) 36 | ; :status unsat 37 | -------------------------------------------------------------------------------- /tests/unsat/hole6.cnf: -------------------------------------------------------------------------------- 1 | ../pigeon/hole6.cnf -------------------------------------------------------------------------------- /tests/unsat/hole7.cnf: -------------------------------------------------------------------------------- 1 | ../pigeon/hole7.cnf -------------------------------------------------------------------------------- /tests/unsat/if_ff_fg.smt2: -------------------------------------------------------------------------------- 1 | 2 | ; if + congruence 3 | (declare-sort u 0) 4 | (declare-fun p0 () Bool) 5 | (declare-fun a () u) 6 | (declare-fun b1 () u) 7 | (declare-fun b2 () u) 8 | (declare-fun c () u) 9 | (declare-fun f (u) u) 10 | (assert (= a (ite p0 b1 b2))) 11 | (assert (= (f b1) c)) 12 | (assert (= (f b2) c)) 13 | (assert (not (= (f a) c))) 14 | (check-sat) 15 | -------------------------------------------------------------------------------- /tests/unsat/named_term.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-sort u 0) 3 | (declare-fun p0 () Bool) 4 | (declare-fun a () u) 5 | (declare-fun b () u) 6 | (declare-fun c () u) 7 | (declare-fun f (u) u) 8 | (assert (= (! (f b) :named fb) c)) 9 | (assert (= b a)) 10 | (assert (not (! (= (f a) c) :named goal))) 11 | (check-sat) 12 | -------------------------------------------------------------------------------- /tests/unsat/nested_if.smt2: -------------------------------------------------------------------------------- 1 | 2 | ; nested ifs 3 | (declare-sort u 0) 4 | (declare-fun a () u) 5 | (declare-fun b () u) 6 | (declare-fun c () u) 7 | (declare-fun d () u) 8 | (declare-fun q0 () Bool) 9 | (declare-fun q1 () Bool) 10 | (declare-fun q2 () Bool) 11 | (declare-fun p (u) Bool) 12 | (assert (p a)) 13 | (assert (p b)) 14 | (assert (p c)) 15 | (assert (p d)) 16 | (assert (not (p (ite q0 (ite q1 a b) (ite q2 c d))))) 17 | (check-sat) 18 | -------------------------------------------------------------------------------- /tests/unsat/pursuit-safety-1-reduced.smt2: -------------------------------------------------------------------------------- 1 | (declare-const p Bool) 2 | (declare-const x Real) 3 | (assert (and (= x (ite p 1 0.0)) (= 0.0 (ite p 1 (+ 1 x))))) 4 | (check-sat) 5 | -------------------------------------------------------------------------------- /tests/unsat/reg_dt.smt2: -------------------------------------------------------------------------------- 1 | 2 | ; expect: unsat 3 | 4 | (set-logic QF_UFDT) 5 | (declare-datatypes 6 | ((foo 0)) 7 | (((A) (B) (C)))) 8 | 9 | (declare-datatypes 10 | ((tup 0)) 11 | (((mk_tup (x foo) (y foo))))) 12 | 13 | (declare-datatypes 14 | ((bar 0)) 15 | (((mk_bar (b1 tup) (b2 Bool))))) 16 | 17 | (declare-fun x0 () bar) 18 | (declare-fun f (bar) bar) 19 | 20 | (assert 21 | (= (f x0) 22 | (mk_bar (b1 x0) (not (b2 x0))))) 23 | 24 | (assert 25 | (let ((x1 (f x0))) 26 | (= (f x1) 27 | (mk_bar (b1 x1) (not (b2 x1)))))) 28 | 29 | ; the goal: f(f(x0))=x0 30 | (assert (not (= x0 (f (f x0))))) 31 | 32 | (check-sat) 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/unsat/reg_lra_2_ite.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_LRA) 2 | (set-info :status unsat) 3 | (declare-fun x_39 () Bool) 4 | (declare-fun x_83 () Bool) 5 | (assert (not (<= (ite x_39 0.0 0.0) (ite x_83 0.0 0.0)))) 6 | (check-sat) 7 | (exit) 8 | -------------------------------------------------------------------------------- /tests/unsat/reg_lra_3.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_UFLRA) 3 | (set-info :source |modified from smtlib.626179.smt2|) 4 | (set-info :status unsat) 5 | (declare-fun f3 () Real) 6 | (declare-fun f4 () Real) 7 | (assert (not (=> (< f3 f4) (=> (< f4 (* 2.0 f3)) (< 0.0 (- f4 f3)))))) 8 | (check-sat) 9 | (exit) 10 | -------------------------------------------------------------------------------- /tests/unsat/reg_lra_4.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_LRA) 2 | (set-info :status unsat) 3 | (declare-fun a () Real) 4 | (declare-fun b () Real) 5 | (declare-fun p1 () Bool) 6 | (declare-fun p2 () Bool) 7 | 8 | (assert (<= a b)) 9 | (assert (= p1 (>= a 1))) 10 | (assert (= p2 (<= b (/ 1 2)))) 11 | (check-sat-assuming (p1 p2)) 12 | (exit) 13 | -------------------------------------------------------------------------------- /tests/unsat/reg_lra_fm1.smt2: -------------------------------------------------------------------------------- 1 | 2 | ; expect: unsat 3 | ; intermediate problem in tests/unsat/clocksynchro_2clocks.worst_case_skew.base.smt2 4 | 5 | (set-logic QF_LRA) 6 | (declare-fun x_0 () Real) 7 | (declare-fun x_1 () Real) 8 | (declare-fun x_2 () Real) 9 | (declare-fun x_3 () Real) 10 | (declare-fun x_4 () Real) 11 | (declare-fun x_5 () Real) 12 | (declare-fun x_6 () Real) 13 | (declare-fun x_7 () Real) 14 | 15 | (assert (< (+ (/ 2335 666) x_5 x_6 (* (/ 2 999) x_7) (* (/ 2 999) x_4)) 0)) 16 | (assert (<= (+ (- (/ 1001 1000)) (* -1 x_0) x_2) 0)) 17 | (assert (<= (+ (/ 999 1000) x_0 (* -1 x_2)) 0)) 18 | (assert (<= (+ (- (/ 1001 1000)) (* -1 x_0) x_1) 0)) 19 | (assert (<= (+ (/ 999 1000) x_0 (- 0 x_1)) 0)) 20 | (assert (= x_0 0)) 21 | (assert 22 | (<= (+ 23 | (/ 1502501 999000) 24 | (* (/ 1001 999) x_5) 25 | (* (/ 1001 999) x_6) 26 | (* -1 x_7) 27 | (* (/ 1001 999) x_3)) 28 | 0)) 29 | 30 | (assert (< (+ (/ 1001 2) (* (/ 999 2) x_6) x_7 (* (/ -999 2) x_4)) 0)) 31 | (assert (<= (+ (/ 1001 999) x_5 (* -1 x_6) (* (/ 1001 1998) x_4)) 0)) 32 | (assert (< (* -1 x_5) 0)) 33 | (assert (< (* -1 x_4) 0)) 34 | (assert (< (* -1 x_3) 0)) 35 | 36 | (check-sat) 37 | -------------------------------------------------------------------------------- /tests/unsat/reg_uflra.smt2: -------------------------------------------------------------------------------- 1 | (set-logic QF_UFLRA) 2 | (set-info :status unsat) 3 | (declare-fun f0_2 (Real Real) Real) 4 | (assert (and (not (< (f0_2 (- 0.0 0.0) 0.0) 10)) (< (f0_2 0.0 0.0) 0))) 5 | (check-sat) 6 | (exit) 7 | -------------------------------------------------------------------------------- /tests/unsat/simple_example_1-node2318.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_LRA) 3 | (set-info :source | 4 | These benchmarks used in the paper: 5 | 6 | Dejan Jovanovic and Leonardo de Moura. Solving Non-Linear Arithmetic. 7 | In IJCAR 2012, published as LNCS volume 7364, pp. 339--354. 8 | 9 | The keymaera family contains VCs from Keymaera verification, see: 10 | 11 | A. Platzer, J.-D. Quesel, and P. Rummer. Real world verification. 12 | In CADE 2009, pages 485-501. Springer, 2009. 13 | 14 | Submitted by Dejan Jovanovic for SMT-LIB. 15 | 16 | KeYmaera example: simple_example_1, node 2318 For more info see: No further information available. 17 | |) 18 | (set-info :category "industrial") 19 | (set-info :status unsat) 20 | (declare-fun e () Real) 21 | (declare-fun buscore2dollarskuscore1 () Real) 22 | (declare-fun duscore2dollarskuscore1 () Real) 23 | (declare-fun cuscore2dollarskuscore1 () Real) 24 | (declare-fun auscore2dollarskuscore1 () Real) 25 | (assert (not (=> (and (and (= e 0) (= (* 2 auscore2dollarskuscore1) buscore2dollarskuscore1)) (= cuscore2dollarskuscore1 duscore2dollarskuscore1)) (= (+ cuscore2dollarskuscore1 1) (+ duscore2dollarskuscore1 1))))) 26 | (check-sat) 27 | (exit) 28 | -------------------------------------------------------------------------------- /tests/unsat/smtlib.624898.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_UFLRA) 3 | (set-info :source |Benchmarks from the paper: "Extending Sledgehammer with SMT Solvers" by Jasmin Blanchette, Sascha Bohme, and Lawrence C. Paulson, CADE 2011. Translated to SMT2 by Andrew Reynolds and Morgan Deters.|) 4 | (set-info :category "industrial") 5 | (set-info :status unsat) 6 | (declare-sort S1 0) 7 | (declare-fun f1 () S1) 8 | (declare-fun f2 () S1) 9 | (declare-fun f3 (Real) Real) 10 | (declare-fun f4 () Real) 11 | (declare-fun f5 () Real) 12 | (assert (not (= f1 f2))) 13 | (assert (not (not (= (f3 f4) 1.0)))) 14 | (assert (= f4 f5)) 15 | (assert (= (f3 f5) (- 1))) 16 | (check-sat) 17 | (exit) 18 | -------------------------------------------------------------------------------- /tests/unsat/smtlib.624916.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_UFLRA) 3 | (set-info :source |Benchmarks from the paper: "Extending Sledgehammer with SMT Solvers" by Jasmin Blanchette, Sascha Bohme, and Lawrence C. Paulson, CADE 2011. Translated to SMT2 by Andrew Reynolds and Morgan Deters.|) 4 | (set-info :category "industrial") 5 | (set-info :status unsat) 6 | (declare-sort S1 0) 7 | (declare-fun f1 () S1) 8 | (declare-fun f2 () S1) 9 | (declare-fun f3 (Real) Real) 10 | (declare-fun f4 () Real) 11 | (declare-fun f5 () Real) 12 | (assert (not (= f1 f2))) 13 | (assert (= (f3 f4) (- 1))) 14 | (assert (not (=> (= f5 f4) (not (= (f3 f5) 1.0))))) 15 | (check-sat) 16 | (exit) 17 | -------------------------------------------------------------------------------- /tests/unsat/smtlib.626179.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_UFLRA) 3 | (set-info :source |Benchmarks from the paper: "Extending Sledgehammer with SMT Solvers" by Jasmin Blanchette, Sascha Bohme, and Lawrence C. Paulson, CADE 2011. Translated to SMT2 by Andrew Reynolds and Morgan Deters.|) 4 | (set-info :category "industrial") 5 | (set-info :status unsat) 6 | (declare-sort S1 0) 7 | (declare-fun f1 () S1) 8 | (declare-fun f2 () S1) 9 | (declare-fun f3 () Real) 10 | (declare-fun f4 () Real) 11 | (assert (not (= f1 f2))) 12 | (assert (not (=> (< f3 f4) (=> (< f4 (* 2.0 f3)) (< 0.0 (- f4 f3)))))) 13 | (check-sat) 14 | (exit) 15 | -------------------------------------------------------------------------------- /tests/unsat/ssa5.cnf: -------------------------------------------------------------------------------- 1 | ../ssa/ssa0432-003.cnf -------------------------------------------------------------------------------- /tests/unsat/ssa6.cnf: -------------------------------------------------------------------------------- 1 | ../ssa/ssa2670-130.cnf -------------------------------------------------------------------------------- /tests/unsat/ssa7.cnf: -------------------------------------------------------------------------------- 1 | ../ssa/ssa2670-141.cnf -------------------------------------------------------------------------------- /tests/unsat/ssa8.cnf: -------------------------------------------------------------------------------- 1 | ../ssa/ssa6288-047.cnf -------------------------------------------------------------------------------- /tests/unsat/t_cstor1.smt2.tmp: -------------------------------------------------------------------------------- 1 | 2 | ; test for constructors 3 | ; :status unsat 4 | 5 | (declare-sort nat 0) 6 | (declare-cstor zero () nat) 7 | (declare-cstor succ (nat) nat) 8 | 9 | (declare-fun n0 () nat) 10 | (declare-fun n1 () nat) 11 | (declare-fun n2 () nat) 12 | 13 | (assert (= n0 (succ (succ (succ (succ zero)))))) 14 | (assert (= n1 (succ (succ n2)))) 15 | (assert (not (= n1 (succ (succ (succ (succ zero))))))) 16 | 17 | ; (check-sat) ; sat 18 | 19 | (assert (= n2 (succ (succ zero)))) 20 | 21 | (check-sat) ; unsat 22 | 23 | (exit) 24 | -------------------------------------------------------------------------------- /tests/unsat/t_subform.smt2: -------------------------------------------------------------------------------- 1 | 2 | (set-info :status "unsat") 3 | (declare-fun p () Bool) 4 | (declare-sort u 0) 5 | (declare-fun f (Bool) u) 6 | (declare-const a u) 7 | (declare-const b u) 8 | (assert (distinct a b)) 9 | 10 | (assert (= (f p) a)) 11 | (assert (= (f (and p (or p p))) b)) 12 | (check-sat) 13 | -------------------------------------------------------------------------------- /tests/unsat/test-000.cnf: -------------------------------------------------------------------------------- 1 | c First test 2 | p cnf 2 3 3 | 1 0 4 | -1 2 0 5 | -1 -2 0 6 | c :status unsat 7 | -------------------------------------------------------------------------------- /tests/unsat/test-001.cnf: -------------------------------------------------------------------------------- 1 | c First test 2 | p cnf 5 6 3 | 1 2 0 4 | -1 3 0 5 | -2 3 0 6 | 4 5 0 7 | -4 -3 0 8 | -5 -3 0 9 | c :status unsat 10 | -------------------------------------------------------------------------------- /tests/unsat/test-003.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () Bool) 2 | (declare-fun b () Bool) 3 | (assert (and (or a b) (and (not a) (not b)))) 4 | (check-sat) 5 | ; :status unsat 6 | -------------------------------------------------------------------------------- /tests/unsat/test-004.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () Bool) 2 | (declare-fun b () Bool) 3 | (assert (and (or a b) (not a) (not b))) 4 | (check-sat) 5 | ; :status unsat 6 | -------------------------------------------------------------------------------- /tests/unsat/test-005.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () Bool) 2 | (declare-fun b () Bool) 3 | (assert (and (or a b) false (not a) (not b))) 4 | (check-sat) 5 | ; :status unsat 6 | -------------------------------------------------------------------------------- /tests/unsat/test-008.smt2: -------------------------------------------------------------------------------- 1 | (declare-sort U 0) 2 | (declare-fun a () U) 3 | (declare-fun b () U) 4 | (declare-fun c () U) 5 | (assert (and (= a b) (= b c) (not (= a c)))) 6 | (check-sat) 7 | ; :status unsat 8 | -------------------------------------------------------------------------------- /tests/unsat/test-009.smt2: -------------------------------------------------------------------------------- 1 | (declare-sort U 0) 2 | (declare-fun a () U) 3 | (declare-fun b () U) 4 | (declare-fun c () U) 5 | (declare-fun d () U) 6 | (assert (and (= a b) (or (= b c) (= b d)) (not (= a d)) (not (= a c)))) 7 | (check-sat) 8 | ; :status unsat 9 | -------------------------------------------------------------------------------- /tests/unsat/test-010.smt2: -------------------------------------------------------------------------------- 1 | (declare-fun a () Bool) 2 | (declare-fun b () Bool) 3 | (assert (and a (=> a b) (not b))) 4 | (check-sat) 5 | ; :status unsat 6 | -------------------------------------------------------------------------------- /tests/unsat/test-011.smt2: -------------------------------------------------------------------------------- 1 | (declare-sort U 0) 2 | (declare-fun a () U) 3 | (declare-fun b () U) 4 | (declare-fun c () U) 5 | (declare-fun d () U) 6 | (assert (and (= a b) (= b c) (= c d) (or (not (= a c)) (not (= a a))))) 7 | (check-sat) 8 | ; :status unsat 9 | -------------------------------------------------------------------------------- /tests/unsat/test-012.smt2: -------------------------------------------------------------------------------- 1 | (declare-sort U 0) 2 | (declare-fun a () U) 3 | (declare-fun b () U) 4 | (declare-fun f (U) U) 5 | (assert (and (= a b) (not (= (f a) (f b))))) 6 | (check-sat) 7 | ; :status unsat 8 | -------------------------------------------------------------------------------- /tests/unsat/test-013.smt2: -------------------------------------------------------------------------------- 1 | (declare-sort U 0) 2 | (declare-fun a () U) 3 | (declare-fun b () U) 4 | (declare-fun p (U) Bool) 5 | (assert (and (= a b) (not (p a)) (p b))) 6 | (check-sat) 7 | ; :status unsat 8 | -------------------------------------------------------------------------------- /tests/unsat/test-016.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-sort U 0) 3 | (declare-fun p () Bool) 4 | (declare-fun q () Bool) 5 | (declare-fun a () U) 6 | (declare-fun b () U) 7 | (assert 8 | (and 9 | (= p (= a b)) 10 | (= q (= b a)) 11 | (or (not p) (not q)) 12 | (or p q))) 13 | (check-sat) 14 | ; :status unsat 15 | -------------------------------------------------------------------------------- /tests/unsat/test-017.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-sort U 0) 3 | (declare-fun p () Bool) 4 | (declare-fun a () U) 5 | (declare-fun b () U) 6 | (assert 7 | (and 8 | (= p (= a b)) 9 | (= (not p) (= b a)))) 10 | (check-sat) 11 | ; :status unsat 12 | -------------------------------------------------------------------------------- /tests/unsat/test-018.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-sort U 0) 3 | (declare-fun f (Bool) U) 4 | (declare-fun a () Bool) 5 | (declare-fun b () Bool) 6 | (declare-fun c () Bool) 7 | (assert 8 | (distinct (f a) (f b) (f c))) 9 | (check-sat) 10 | ; :status unsat 11 | -------------------------------------------------------------------------------- /tests/unsat/test_ite_1.smt2: -------------------------------------------------------------------------------- 1 | 2 | (declare-sort U 0) 3 | (declare-fun a () U) 4 | (declare-fun b () U) 5 | (declare-fun cond () Bool) 6 | (declare-fun p (U) Bool) 7 | (assert (and (= a b) (p a) (not (p (ite cond a b))))) 8 | (check-sat) 9 | -------------------------------------------------------------------------------- /tests/unsat/typed_v2l20025.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status unsat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () nat) 22 | (declare-fun x3 () list) 23 | (declare-fun x4 () list) 24 | (declare-fun x5 () tree) 25 | (declare-fun x6 () tree) 26 | 27 | (assert (and ((_ is cons) x4) (= (cons (node x4) x3) (ite ((_ is cons) x4) (cdr x4) null)))) 28 | (check-sat) 29 | (exit) 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/unsat/typed_v3l20047.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status unsat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () nat) 22 | (declare-fun x3 () nat) 23 | (declare-fun x4 () list) 24 | (declare-fun x5 () list) 25 | (declare-fun x6 () list) 26 | (declare-fun x7 () tree) 27 | (declare-fun x8 () tree) 28 | (declare-fun x9 () tree) 29 | 30 | (assert (and (not ((_ is zero) (ite ((_ is succ) (ite ((_ is leaf) x8) (data x8) zero)) (pred (ite ((_ is leaf) x8) (data x8) zero)) zero))) (= (ite ((_ is cons) x4) (car x4) (leaf zero)) (node x4)))) 31 | (check-sat) 32 | (exit) 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/unsat/typed_v3l30091.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status unsat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () nat) 22 | (declare-fun x3 () nat) 23 | (declare-fun x4 () list) 24 | (declare-fun x5 () list) 25 | (declare-fun x6 () list) 26 | (declare-fun x7 () tree) 27 | (declare-fun x8 () tree) 28 | (declare-fun x9 () tree) 29 | 30 | (assert (and (and ((_ is null) x4) (not ((_ is zero) zero))) (not (= x3 x1)))) 31 | (check-sat) 32 | (exit) 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/unsat/typed_v3l40070.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status unsat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () nat) 22 | (declare-fun x3 () nat) 23 | (declare-fun x4 () list) 24 | (declare-fun x5 () list) 25 | (declare-fun x6 () list) 26 | (declare-fun x7 () tree) 27 | (declare-fun x8 () tree) 28 | (declare-fun x9 () tree) 29 | 30 | (assert (and (and (and (not (= zero (ite ((_ is leaf) (node x4)) (data (node x4)) zero))) ((_ is node) x7)) (= x9 x8)) (not (= (ite ((_ is cons) (ite ((_ is cons) x4) (cdr x4) null)) (cdr (ite ((_ is cons) x4) (cdr x4) null)) null) null)))) 31 | (check-sat) 32 | (exit) 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/unsat/typed_v5l50010.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status unsat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () nat) 22 | (declare-fun x3 () nat) 23 | (declare-fun x4 () nat) 24 | (declare-fun x5 () nat) 25 | (declare-fun x6 () list) 26 | (declare-fun x7 () list) 27 | (declare-fun x8 () list) 28 | (declare-fun x9 () list) 29 | (declare-fun x10 () list) 30 | (declare-fun x11 () tree) 31 | (declare-fun x12 () tree) 32 | (declare-fun x13 () tree) 33 | (declare-fun x14 () tree) 34 | (declare-fun x15 () tree) 35 | 36 | (assert (and (and (and (and (= (succ x3) (ite ((_ is succ) x3) (pred x3) zero)) (not ((_ is node) x11))) (not ((_ is leaf) x13))) (not (= (ite ((_ is node) x12) (children x12) null) x6))) (= (ite ((_ is node) x14) (children x14) null) x8))) 37 | (check-sat) 38 | (exit) 39 | 40 | 41 | -------------------------------------------------------------------------------- /tests/unsat/typed_v5l90068.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status unsat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () nat) 22 | (declare-fun x3 () nat) 23 | (declare-fun x4 () nat) 24 | (declare-fun x5 () nat) 25 | (declare-fun x6 () list) 26 | (declare-fun x7 () list) 27 | (declare-fun x8 () list) 28 | (declare-fun x9 () list) 29 | (declare-fun x10 () list) 30 | (declare-fun x11 () tree) 31 | (declare-fun x12 () tree) 32 | (declare-fun x13 () tree) 33 | (declare-fun x14 () tree) 34 | (declare-fun x15 () tree) 35 | 36 | (assert (and (and (and (and (and (and (and (and ((_ is node) x13) (not ((_ is succ) x1))) (= zero (succ x5))) ((_ is null) x8)) ((_ is zero) x1)) (= x11 x15)) (not (= x10 x9))) (not (= (leaf x2) x13))) (= x15 (leaf x5)))) 37 | (check-sat) 38 | (exit) 39 | 40 | 41 | -------------------------------------------------------------------------------- /tests/unsat/v1l50092.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status unsat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () list) 22 | (declare-fun x3 () tree) 23 | 24 | (assert (and (and (and (and (= (node (cons x3 (cdr null))) x3) (= (cdr (cdr (cons (car x2) (cdr null)))) (children (leaf (pred (succ zero)))))) (not (= x2 (cons (leaf x1) x2)))) (= (car x2) x3)) (not ((_ is succ) zero)))) 25 | (check-sat) 26 | (exit) 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/unsat/v1l90033.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status unsat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () list) 22 | (declare-fun x3 () tree) 23 | 24 | (assert (and (and (and (and (and (and (and (and (not ((_ is cons) x2)) (not ((_ is node) (car (cdr (cdr (cdr null))))))) (= null (cons (car x2) null))) (not ((_ is cons) null))) (= (node null) (leaf zero))) (not ((_ is zero) (data x3)))) ((_ is cons) null)) ((_ is zero) x1)) (not (= (pred zero) (data (leaf x1)))))) 25 | (check-sat) 26 | (exit) 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/unsat/v3l60049.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status unsat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () nat) 22 | (declare-fun x3 () nat) 23 | (declare-fun x4 () list) 24 | (declare-fun x5 () list) 25 | (declare-fun x6 () list) 26 | (declare-fun x7 () tree) 27 | (declare-fun x8 () tree) 28 | (declare-fun x9 () tree) 29 | 30 | (assert (and (and (and (and (and (not ((_ is leaf) x7)) ((_ is zero) x3)) (not ((_ is cons) x6))) (not ((_ is succ) zero))) (not (= x6 x5))) (not ((_ is cons) x5)))) 31 | (check-sat) 32 | (exit) 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/unsat/v3l90003.cvc.smt2: -------------------------------------------------------------------------------- 1 | (set-info :smt-lib-version 2.6) 2 | (set-logic QF_DT) 3 | (set-info :source | 4 | Generated by: Andrew Reynolds 5 | Generated on: 2017-04-28 6 | Generator: Random, converted to v2.6 by CVC4 7 | Application: Regressions for datatypes decision procedure. 8 | Target solver: CVC3 9 | Publications: "An Abstract Decision Procedure for Satisfiability in the Theory of Inductive Data Types" by Clark Barrett, Igor Shikanian, and Cesare Tinelli, Journal on Satisfiability, Boolean Modeling and Computation 2007. 10 | |) 11 | (set-info :license "https://creativecommons.org/licenses/by/4.0/") 12 | (set-info :category "random") 13 | (set-info :status unsat) 14 | 15 | 16 | (declare-datatypes ((nat 0)(list 0)(tree 0)) (((succ (pred nat)) (zero)) 17 | ((cons (car tree) (cdr list)) (null)) 18 | ((node (children list)) (leaf (data nat))) 19 | )) 20 | (declare-fun x1 () nat) 21 | (declare-fun x2 () nat) 22 | (declare-fun x3 () nat) 23 | (declare-fun x4 () list) 24 | (declare-fun x5 () list) 25 | (declare-fun x6 () list) 26 | (declare-fun x7 () tree) 27 | (declare-fun x8 () tree) 28 | (declare-fun x9 () tree) 29 | 30 | (assert (and (and (and (and (and (and (and (and (= x4 null) (not (= x5 (children x7)))) (not ((_ is leaf) (car null)))) (not ((_ is node) x8))) (= (data (leaf zero)) x3)) (not (= x9 x7))) (not (= (pred x2) (data x9)))) ((_ is null) (cdr x6))) (= (car null) (leaf (succ x1))))) 31 | (check-sat) 32 | (exit) 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/uuf250/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/c-cube/sidekick/6c8d6840f82bcac146700e08ad012d64edfd569c/tests/uuf250/README -------------------------------------------------------------------------------- /unittest/core-logic/dune: -------------------------------------------------------------------------------- 1 | (tests 2 | (names t1) 3 | (flags :standard -open Sidekick_util) 4 | (libraries containers sidekick.util sidekick.core-logic)) 5 | -------------------------------------------------------------------------------- /unittest/core-logic/t1.expected: -------------------------------------------------------------------------------- 1 | type0 : Type 2 | typeof(type0) : Type(1) 3 | type tower: [Type;Type(1);Type(2);Type(3);Type(4)] 4 | Bool: [true, false] 5 | a: a, b: b, typeof(a): Bool 6 | b2b: (Bool -> Bool) 7 | p(a): (p a) 8 | p(b): (p b) 9 | q(a): (q a) 10 | q(b): (q b) 11 | typeof(p a): Bool 12 | lxy_px: (\x:Bool. (\y:Bool. (p x[1]))) 13 | type: (Bool -> (Bool -> Bool)) 14 | type of type: Type 15 | lxy_px a b: ((\x:Bool. (\y:Bool. (p x[1]))) a b) 16 | type: Bool 17 | (=): = 18 | type: (Pi A:Type. (Pi _:A[0]. (A[1] -> Bool))) 19 | p2: p2 20 | type: (tau -> (tau -> Bool)) 21 | t2: (= (tau -> (tau -> Bool)) (\x:tau. (\y:tau. (p2 x[1] y[0]))) (= tau)) 22 | type: Bool 23 | f_vec: vec 24 | type: (Type -> (nat -> Type)) 25 | type of type: Type(1) 26 | -------------------------------------------------------------------------------- /unittest/core/dune: -------------------------------------------------------------------------------- 1 | (tests 2 | (names t_trace) 3 | (flags :standard -open Sidekick_core -open Sidekick_util) 4 | (libraries containers sidekick.core sidekick.trace)) 5 | -------------------------------------------------------------------------------- /unittest/core/t_trace.expected: -------------------------------------------------------------------------------- 1 | buf containing pa: li0e2:Tyi0ee 2 | li13e2:Tcd3:tag1:B2:tyi0e1:v4:Boolee 3 | li50e2:Tcd3:tag5:c.str2:tyi13e1:v1:aee 4 | li89e2:Tpl0:i13ei13eee 5 | li112e2:Tcd3:tag5:c.str2:tyi89e1:v1:pee 6 | li152e2:T@li112ei50eee 7 | li175e2:Tcd3:tag5:c.str2:tyi13e1:v1:bee 8 | li215e2:Tcd3:tag5:c.str2:tyi89e1:v1:qee 9 | li255e2:T@li215ei175eee 10 | 11 | (len 279) 12 | read pa: (p a) 13 | read qb: (q b) 14 | -------------------------------------------------------------------------------- /unittest/mini-cc/dune: -------------------------------------------------------------------------------- 1 | (test 2 | (name sidekick_test_minicc) 3 | (libraries sidekick.mini-cc sidekick-base alcotest) 4 | (flags :standard -warn-error -a+8)) 5 | -------------------------------------------------------------------------------- /unittest/old/basic.cnf: -------------------------------------------------------------------------------- 1 | p cnf 4 8 2 | 1 2 -3 0 3 | -1 -2 3 0 4 | 2 3 -4 0 5 | -2 -3 4 0 6 | 1 3 4 0 7 | -1 -3 -4 0 8 | -1 2 4 0 9 | 1 -2 -4 0 10 | 11 | -------------------------------------------------------------------------------- /unittest/old/basic.drup.expected: -------------------------------------------------------------------------------- 1 | i 1 2 -3 0 2 | i -1 -2 3 0 3 | i 2 3 -4 0 4 | i -2 -3 4 0 5 | i 1 3 4 0 6 | i -1 -3 -4 0 7 | i -1 2 4 0 8 | i 1 -2 -4 0 9 | r -4 -1 0 10 | r -1 0 11 | r -3 0 12 | r 4 0 13 | r -2 0 14 | r 0 15 | -------------------------------------------------------------------------------- /unittest/old/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name run_tests) 3 | (modules run_tests) 4 | (modes native) 5 | (libraries containers alcotest qcheck sidekick.util sidekick_test_simplex 6 | sidekick_test_util) 7 | (flags :standard -warn-error -a+8 -color always)) 8 | 9 | (rule 10 | (alias runtest) 11 | (locks /test) 12 | (package sidekick) 13 | (action 14 | (progn 15 | (run ./run_tests.exe alcotest) ; run regressions first 16 | (run ./run_tests.exe qcheck --verbose)))) 17 | 18 | ; FIXME 19 | ;(rule 20 | ; (targets basic.drup) 21 | ; (deps 22 | ; (:pb basic.cnf) 23 | ; (:solver ../../src/main/main.exe)) 24 | ; (action 25 | ; (run %{solver} %{pb} -t 2 -o %{targets}))) 26 | ; 27 | ;(rule 28 | ; (alias runtest) 29 | ; (locks /test) 30 | ; (package sidekick-bin) 31 | ; (action 32 | ; (diff basic.drup.expected basic.drup))) 33 | -------------------------------------------------------------------------------- /unittest/old/regression/dune: -------------------------------------------------------------------------------- 1 | ; FIXME 2 | ;(rule 3 | ; (targets reg_model_lra1.out) 4 | ; (deps 5 | ; (:file reg_model_lra1.smt2) 6 | ; (:main ../../../src/main/main.exe)) 7 | ; (action 8 | ; (with-stdout-to 9 | ; %{targets} 10 | ; (bash "%{main} %{file} | tail -n +2")))) 11 | ; 12 | ;(rule 13 | ; (alias runtest) 14 | ; (locks /test) 15 | ; (package sidekick-bin) 16 | ; (action 17 | ; (diff reg_model_lra1.out.expected reg_model_lra1.out))) 18 | -------------------------------------------------------------------------------- /unittest/old/regression/reg_model_lra1.out.expected: -------------------------------------------------------------------------------- 1 | (model 2 | (true := true) 3 | (false := false) 4 | (a := 5/3) 5 | ((* 3 a) := 5) 6 | (5 := 5) 7 | ((= (* 3 a) 5) := true) 8 | ((<= (* 3 a) 5) := true) 9 | ((>= (* 3 a) 5) := true)) 10 | -------------------------------------------------------------------------------- /unittest/old/regression/reg_model_lra1.smt2: -------------------------------------------------------------------------------- 1 | 2 | (set-logic QF_LRA) 3 | (declare-const a Real) 4 | (assert (= (* 3 a) 5)) 5 | (check-sat) 6 | (get-model) 7 | -------------------------------------------------------------------------------- /unittest/old/run_tests.ml: -------------------------------------------------------------------------------- 1 | let tests : unit Alcotest.test list = 2 | List.flatten @@ [ [ Sidekick_test_simplex.tests ]; Sidekick_test_util.tests ] 3 | 4 | let props = 5 | List.flatten [ Sidekick_test_simplex.props; Sidekick_test_util.props ] 6 | 7 | let () = 8 | (*Sidekick_util.Log.set_debug 10;*) 9 | match Array.to_list Sys.argv with 10 | | a0 :: "alcotest" :: tl -> 11 | let argv = Array.of_list (a0 :: tl) in 12 | Alcotest.run ~argv ~and_exit:true "arith tests" tests 13 | | a0 :: "qcheck" :: tl -> 14 | let argv = Array.of_list (a0 :: tl) in 15 | CCFormat.set_color_default true; 16 | QCheck_runner.run_tests_main ~argv props 17 | | _ -> failwith "expected (qcheck|alcotest) as first arg" 18 | --------------------------------------------------------------------------------