├── .gitmodules ├── examples ├── tla │ ├── fsm.zf │ ├── fsm1.zf │ ├── fsm5.zf │ ├── fsm2.zf │ ├── fsm3.zf │ ├── time.zf │ ├── fsm4.zf │ ├── fsm_easy.zf │ ├── fsm_hard.zf │ └── fsm_uninterpreted.zf ├── verifast │ ├── .gitignore │ └── README.org ├── distinct.p ├── pelletier_problems │ ├── pb6.p │ ├── pb11.p │ ├── pb7.p │ ├── ax_b.ax │ ├── pb2.p │ ├── pb1.p │ ├── pb16.p │ ├── pb8.p │ ├── ax_c.ax │ ├── pb15.p │ ├── pb3.p │ ├── pb4.p │ ├── pb18.p │ ├── ax_a.ax │ ├── ax_logic_a.ax │ ├── ax_logic_c.ax │ ├── pb11.zf │ ├── pb12.p │ ├── pb13.p │ ├── pb14.p │ ├── pb2.zf │ ├── pb35.p │ ├── pb39.p │ ├── pb5.p │ ├── ax_logic_d.ax │ ├── pb22.p │ ├── pb23.p │ ├── pb6.zf │ ├── pb7.zf │ ├── ax_logic_b.ax │ ├── pb9.p │ ├── pb19.p │ ├── pb42.p │ ├── pb16.zf │ ├── pb50.p │ ├── pb8.zf │ ├── pb15.zf │ ├── pb17.p │ ├── pb3.zf │ ├── pb58.p │ ├── pb1.zf │ ├── pb4.zf │ ├── pb59.p │ ├── pb48.p │ ├── pb40.p │ ├── pb14.zf │ ├── pb18.zf │ ├── pb12.zf │ ├── pb13.zf │ ├── pb20.p │ ├── pb21.p │ ├── pb41.p │ ├── pb43.p │ ├── pb5.zf │ ├── pb63.p │ ├── pb39.zf │ ├── pb60.p │ ├── pb64.p │ ├── pb9.zf │ ├── pb10.p │ ├── pb23.zf │ ├── pb61.p │ ├── pb22.zf │ ├── pb33.p │ ├── pb56.p │ ├── pb65.p │ ├── pb30.p │ ├── pb49.p │ ├── pb66.p │ ├── pb67.p │ ├── pb51.p │ ├── pb52.p │ ├── pb10.zf │ ├── pb17.zf │ ├── pb59.zf │ ├── pb35.zf │ ├── pb21.zf │ ├── pb29.p │ ├── pb31.p │ ├── pb48.zf │ ├── pb57.p │ ├── pb19.zf │ ├── pb26.p │ ├── pb42.zf │ ├── pb50.zf │ ├── pb58.zf │ ├── pb56.zf │ ├── pb32.p │ ├── pb34.p │ ├── equivalence.p │ ├── pb41.zf │ ├── pb36.p │ ├── pb60.zf │ ├── pb68.p │ ├── pb40.zf │ ├── pb44.p │ ├── pb62.p │ ├── pb49.zf │ ├── pb24.p │ ├── pb43.zf │ ├── pb25.p │ ├── pb27.p │ ├── pb33.zf │ ├── pb30.zf │ ├── pb54.p │ ├── pb37.p │ ├── pb53.p │ ├── pb62.zf │ ├── pb61.zf │ ├── pb28.p │ ├── pb65.zf │ ├── pb34.zf │ ├── pb57.zf │ ├── pb31.zf │ ├── pb38.p │ ├── pb64.zf │ ├── pb51.zf │ ├── pb52.zf │ ├── equivalence.zf │ ├── pb26.zf │ ├── pb29.zf │ ├── pb20.zf │ ├── pb46.p │ ├── pb24.zf │ ├── pb32.zf │ ├── pb63.zf │ ├── pb44.zf │ ├── pb45.p │ ├── pb25.zf │ ├── pb36.zf │ ├── pb27.zf │ ├── pb28.zf │ ├── pb53.zf │ ├── pb66.zf │ ├── pb67.zf │ ├── pb68.zf │ ├── pb54.zf │ ├── pb46.zf │ ├── pb38.zf │ ├── pb37.zf │ ├── pb45.zf │ └── pb55.p ├── enum.p ├── arith1.p ├── arith3.p ├── ind │ ├── nat10.p │ ├── nat3.zf │ ├── nat_false1.p │ ├── nat_false2.p │ ├── nat_false2.zf │ ├── tree2.zf │ ├── nat23.zf │ ├── nat3.p │ ├── unit1.zf │ ├── nat10.zf │ ├── nat11.p │ ├── nat_false1.zf │ ├── list7.p │ ├── nat8.zf │ ├── nat9.zf │ ├── list7.zf │ ├── list8.p │ ├── nat11.zf │ ├── nat2.zf │ ├── nat2_easy.zf │ ├── tree2.p │ ├── nat5.zf │ ├── nat9.p │ ├── list8.zf │ ├── nat8.p │ ├── list12.p │ ├── list5.p │ ├── nat5.p │ ├── nat20.zf │ ├── nat25.zf │ ├── tree6.zf │ ├── list12.zf │ ├── nat1.p │ ├── list11.zf │ ├── list17.zf │ ├── list3.p │ ├── nat13.p │ ├── list1.zf │ ├── list1_false.zf │ ├── tree2_easy.zf │ ├── nat24.zf │ ├── list11.p │ ├── list3.zf │ ├── nat13.zf │ ├── nat18.zf │ ├── nat19.zf │ ├── nat_false3.zf │ ├── nat18.p │ ├── tree3.zf │ ├── list1_false.p │ ├── list9.p │ ├── nat21.zf │ ├── tree4.zf │ ├── tree_nat1.p │ ├── list1.p │ ├── list5.zf │ ├── nat14.p │ ├── nat22.zf │ ├── tree4.p │ ├── nat1.zf │ ├── nat14.zf │ ├── nat19.p │ ├── tree_nat1.zf │ ├── list13.p │ ├── nat_false3.p │ ├── tree3.p │ ├── list14.p │ ├── list16.zf │ ├── nat_check.zf │ ├── list15.zf │ ├── plist1.zf │ ├── tree3_easy.zf │ ├── plist1.p │ ├── list14.zf │ ├── list6.zf │ ├── nat2.p │ ├── nat4.zf │ ├── list6.p │ ├── nat2_easy.p │ ├── list7_easy2.zf │ ├── tree1.p │ ├── list4.p │ ├── nat20.p │ ├── nat16.zf │ ├── nat11_easy.zf │ ├── list4.zf │ ├── nat21_easy.zf │ ├── list15.p │ ├── list9.zf │ ├── list10.zf │ ├── list16_easy.zf │ ├── nat6.p │ ├── nat6.zf │ ├── nat15.zf │ ├── list13.zf │ ├── nat17.zf │ ├── tree4_easy.zf │ ├── nat15_def.zf │ ├── nat12_no_ax.zf │ ├── tree1.zf │ ├── list10.p │ ├── list2.zf │ ├── list7_easy.zf │ ├── nat4_easy.p │ ├── nat4_easy.zf │ ├── nat26.zf │ ├── list13.v │ ├── list17_easy.zf │ ├── nat15_easy.zf │ ├── nat16.p │ ├── nat1_easy.zf │ ├── nat15.p │ ├── nat12.zf │ ├── nat21.smt2 │ ├── nat4.p │ ├── nat4_bis.zf │ ├── list2.p │ ├── list11_easy.zf │ ├── nat12.p │ ├── nat_check.p │ ├── nat15_easy.p │ ├── nat21_easy.smt2 │ ├── tree2_easy.p │ ├── list7_bis.zf │ ├── list7_bis.p │ ├── tree5.zf │ ├── nat1_easy.p │ ├── nat7_hard.zf │ ├── nat17.p │ ├── nat12_no_ax.p │ ├── tree5.p │ ├── nat4_bis.p │ ├── weird_nat_add3acc_assoc1.smt2 │ ├── list10_medium.zf │ ├── list10_easy.zf │ ├── list7_bis_easy.zf │ ├── list7_join.zf │ ├── list7.smt2 │ ├── prop_10.smt2 │ ├── nat7.zf │ ├── demo_filter_length_lesseq.smt2 │ └── list15_arith.zf ├── arith2.p ├── diophantine.p ├── data │ ├── unit_eq2.zf │ ├── unit_eq.zf │ ├── pair.zf │ ├── unit_res.zf │ ├── find_bigger1.zf │ ├── plus.zf │ ├── find_bigger2.zf │ ├── unit_list_eq.zf │ ├── unit_list_eq2.zf │ ├── length.zf │ ├── mult.zf │ ├── mult_3.zf │ ├── fact_ax.zf │ └── plist.zf ├── fool │ ├── test_res.zf │ ├── test_not.zf │ ├── test_param2.zf │ ├── neq_to_xor.zf │ ├── test_param_var.zf │ ├── test_param.zf │ └── if_eq.zf ├── modulo3.p ├── ac.p ├── enum2.p ├── ho │ ├── thf_syntax.p │ ├── find_set_compl.zf │ ├── sum_int.zf │ ├── find_set_union.zf │ ├── find_not.zf │ ├── find_set_inter.zf │ ├── leo_ex_2.zf │ ├── leo_ex_3.zf │ ├── leo_ex_1.zf │ ├── unif1.zf │ ├── unif2.zf │ ├── unif3.zf │ ├── collect_or.zf │ ├── weird_ineq.p │ ├── leo_ex_5.zf │ ├── leo_ex_4.zf │ ├── neg_eq_unit.zf │ ├── neg_eq1.zf │ ├── unif4_easy.zf │ ├── unif5.p │ ├── weird_ineq2.p │ ├── find_set_inter_nary.zf │ ├── sum_unin.zf │ ├── unif4.zf │ ├── sum_nat.zf │ └── unif4_with_fun.zf ├── modulo2.p ├── regression │ ├── type_eq.zf │ ├── undeclared.zf │ ├── typing.zf │ ├── ho_pos.zf │ ├── overflow.zf │ ├── poly_bad.zf │ ├── ho_demod_partial_app.zf │ ├── typing_app.p │ └── gh_8.zf ├── modulo4.p ├── rewrite3.zf ├── mccarthy91_M2.smt2 ├── modulo5.p ├── modulo5bis.p ├── ac.zf ├── simple_case.zf ├── by_case.p ├── modulo1.p ├── chaining1.p ├── by_case2_false.p ├── loop.p ├── int_nat4_arith.p ├── by_case2.p ├── fun_ext.zf ├── chaining2.p ├── fun_update.zf ├── sep2.zf ├── modulo6.p ├── must_pass.txt ├── by_case3.p ├── sep1.zf ├── counter_ex_beagle.p ├── enum3.p ├── semi_group_inverse2.zf ├── semi_group_inverse.zf ├── don_t_use_omega.p ├── rewrite1.zf ├── rewrite1_def.zf ├── polymorph2.p ├── polymorph.p ├── enum4.p ├── cuts │ └── ntape3-css.tptp └── rewrite4.zf ├── old ├── doc │ └── old │ │ └── conf.py └── data │ └── rewriting │ ├── test1.p │ ├── unsat1.p │ ├── ski.p │ ├── peano.p │ ├── quotient_difference.p │ ├── group.p │ ├── ring.p │ ├── list.p │ └── comm_ring.p ├── .dockerignore ├── .ocp-indent ├── portfolio ├── .gitignore ├── ltb │ └── run_ltb.sh └── fo │ ├── fo10.sh │ ├── fo8.sh │ ├── fo20.sh │ ├── fo12.sh │ ├── fo5.sh │ ├── fo15.sh │ ├── fo4.sh │ ├── fo14.sh │ ├── fo2.sh │ └── fo7.sh ├── dune-project ├── utils ├── vim │ ├── ftdetect │ │ └── zf.vim │ └── README.md ├── cpulimit ├── profile.sh └── mk_lib_mli.py ├── src ├── core │ ├── JPFull.mli │ ├── arith │ │ ├── logtk_arith.zarith.ml │ │ └── dune │ ├── FixpointUnif.mli │ ├── SolidSubsumption.mli │ ├── Multisets.ml │ ├── Multiset.mli │ ├── PrefWeight.mli │ ├── SolidUnif.mli │ ├── util_stubs.h │ ├── dune │ ├── ZProf.mli │ ├── Flex_state.ml │ ├── NPDtree.mli │ ├── Flex_state.mli │ ├── Dtree.mli │ ├── Binder.mli │ └── Output_format.ml ├── parsers │ ├── logtk_parsers.mld │ └── dune ├── proofs │ ├── logtk_proofs.mld │ ├── LLProof_conv.mli │ ├── dune │ └── LLProver.mli ├── prover │ ├── libzipperposition.mld │ ├── sat_solver.mli │ ├── AC.mli │ ├── bool_lit.mli │ ├── Bool_clause.mli │ ├── proofState.mli │ ├── lift_lambdas.mli │ ├── eprover_interface.mli │ ├── stream.mli │ ├── env.mli │ ├── dune │ ├── signals.ml │ ├── ctx.mli │ └── clause.mli ├── prover_phases │ ├── libzipperposition_phases.mld │ ├── dune │ ├── libzipperposition_phases.ml │ └── libzipperposition_phases.mli ├── arbitrary │ ├── logtk_arbitrary.mld │ ├── dune │ ├── arLiteral.mli │ ├── arID.mli │ ├── arID.ml │ ├── arType.mli │ └── arForm.mli ├── demo │ └── resolution │ │ └── dune ├── solving │ └── dune ├── main │ └── dune ├── prover_calculi │ ├── avatar │ │ └── dune │ ├── dune │ ├── libzipperposition_calculi.mld │ ├── induction │ │ ├── dune │ │ ├── induction_intf.ml │ │ └── Libzipperposition_induction.mli │ ├── qle.mli │ ├── bce_pe_fixpoint.mli │ ├── bce.mli │ ├── pred_elim.mli │ ├── Rewriting.mli │ ├── lazy_cnf.mli │ └── heuristics.mli ├── test_must_pass.sh ├── dune └── tools │ └── dune ├── tests ├── run_tests.sh ├── test_theory_detect.p ├── dune └── testType.ml ├── data └── vim │ └── ftdetect │ └── theory.vim └── doc └── example.zf /.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/tla/fsm.zf: -------------------------------------------------------------------------------- 1 | fsm_uninterpreted.zf -------------------------------------------------------------------------------- /examples/verifast/.gitignore: -------------------------------------------------------------------------------- 1 | *_pb.* 2 | -------------------------------------------------------------------------------- /old/doc/old/conf.py: -------------------------------------------------------------------------------- 1 | project = "logtk" 2 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | examples 3 | _build 4 | -------------------------------------------------------------------------------- /.ocp-indent: -------------------------------------------------------------------------------- 1 | base=2 2 | type=2 3 | max_indent=4 4 | -------------------------------------------------------------------------------- /portfolio/.gitignore: -------------------------------------------------------------------------------- 1 | zipperposition 2 | eprover-ho -------------------------------------------------------------------------------- /dune-project: -------------------------------------------------------------------------------- 1 | (lang dune 1.11) 2 | (using menhir 2.0) 3 | -------------------------------------------------------------------------------- /examples/distinct.p: -------------------------------------------------------------------------------- 1 | 2 | fof(1, conjecture, "foo" != "bar"). 3 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb6.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, p | ~p). 3 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb11.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, p <=> p). 3 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb7.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, p | ~~~p). 3 | -------------------------------------------------------------------------------- /utils/vim/ftdetect/zf.vim: -------------------------------------------------------------------------------- 1 | 2 | au BufRead,BufNewFile *.zf set filetype=zf 3 | -------------------------------------------------------------------------------- /examples/enum.p: -------------------------------------------------------------------------------- 1 | 2 | fof(1,axiom, ![X]: (X=a | X=b)). 3 | % fof(2,axiom, a!=b). 4 | -------------------------------------------------------------------------------- /examples/pelletier_problems/ax_b.ax: -------------------------------------------------------------------------------- 1 | 2 | fof(ax_b, axiom, ! [X] : f(a,X) = X). 3 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb2.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, (~ ~ p) <=> p). 3 | -------------------------------------------------------------------------------- /old/data/rewriting/test1.p: -------------------------------------------------------------------------------- 1 | f X --> g X. 2 | g a --> g b. 3 | g (f c) --> f d. 4 | -------------------------------------------------------------------------------- /old/data/rewriting/unsat1.p: -------------------------------------------------------------------------------- 1 | a --> b. 2 | b --> c. 3 | c --> d. 4 | d --> a. 5 | -------------------------------------------------------------------------------- /examples/arith1.p: -------------------------------------------------------------------------------- 1 | 2 | tff(1, conjecture, ~ ![X:$int]:$less($sum(f(X), 1), f(a))). 3 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb1.p: -------------------------------------------------------------------------------- 1 | 2 | fof(pb, conjecture, (p => q) => (~q => ~p)). 3 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb16.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, (p => q) | (q => p)). 3 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb8.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, ((p => q) => p) => p). 3 | -------------------------------------------------------------------------------- /src/core/JPFull.mli: -------------------------------------------------------------------------------- 1 | module Make (S: sig val st: Flex_state.t end) : UnifFramework.US 2 | -------------------------------------------------------------------------------- /examples/arith3.p: -------------------------------------------------------------------------------- 1 | 2 | tff(1, conjecture, ~ (![X:$int]: $lesseq($product(2, X), a))). 3 | -------------------------------------------------------------------------------- /examples/pelletier_problems/ax_c.ax: -------------------------------------------------------------------------------- 1 | 2 | fof(ax_c, axiom, ! [X] : ? [Y] : f(Y,X) = a). 3 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb15.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, (p => q) <=> (~ p | q)). 3 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb3.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, (~ (p => q)) => (q => p)). 3 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb4.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, (~ p => q) <=> (~ q => p)). 3 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb18.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, ? [Y] : ! [X] : (f(Y) => f(X))). 3 | -------------------------------------------------------------------------------- /examples/ind/nat10.p: -------------------------------------------------------------------------------- 1 | include('nat.ax'). 2 | 3 | tff(the, conjecture, ![X:nat]: minus(X,X)=z). 4 | 5 | -------------------------------------------------------------------------------- /examples/pelletier_problems/ax_a.ax: -------------------------------------------------------------------------------- 1 | 2 | fof(ax_a, axiom, ! [X,Y,Z] : f(f(X,Y),Z) = f(X,f(Y,Z))). 3 | -------------------------------------------------------------------------------- /examples/pelletier_problems/ax_logic_a.ax: -------------------------------------------------------------------------------- 1 | 2 | fof(ax_logic_a, axiom, ! [X,Y] : t(i(X,i(Y,X)))). 3 | -------------------------------------------------------------------------------- /examples/arith2.p: -------------------------------------------------------------------------------- 1 | 2 | tff(1, conjecture, (a = $sum(b,1) => $product(a,2) = $sum($product(b,2),2))). 3 | -------------------------------------------------------------------------------- /examples/diophantine.p: -------------------------------------------------------------------------------- 1 | 2 | tff(1, conjecture, ?[X:$int,Y:$int]: $sum($product(2,X), $product(3,Y))=7). 3 | -------------------------------------------------------------------------------- /examples/ind/nat3.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | goal forall (X:nat). ((plus X z) = X). 4 | -------------------------------------------------------------------------------- /tests/run_tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | exec dune exec --profile=release -- tests/run_tests.exe $@ 4 | -------------------------------------------------------------------------------- /examples/ind/nat_false1.p: -------------------------------------------------------------------------------- 1 | 2 | include('nat.ax'). 3 | 4 | tff(the, conjecture, ![X:nat,Y:nat]: plus(X,Y)=X). 5 | -------------------------------------------------------------------------------- /examples/ind/nat_false2.p: -------------------------------------------------------------------------------- 1 | 2 | include('nat.ax'). 3 | 4 | tff(the, conjecture, ![X:nat]: plus(X,z) = s(X)). 5 | -------------------------------------------------------------------------------- /examples/ind/nat_false2.zf: -------------------------------------------------------------------------------- 1 | # expect: sat 2 | include "nat.zf". 3 | goal forall (X:nat). ((plus X z) = (s X)). 4 | -------------------------------------------------------------------------------- /examples/ind/tree2.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "tree.zf". 3 | goal forall (T:tree). ((rev (rev T)) = T). 4 | -------------------------------------------------------------------------------- /examples/pelletier_problems/ax_logic_c.ax: -------------------------------------------------------------------------------- 1 | 2 | fof(ax_logic_c, axiom, ! [X,Y] : t(i(i(n(X),n(Y)),i(Y,X)))). 3 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb11.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val p : prop. 4 | goal p <=> p. 5 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb12.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, ((p <=> q) <=> r) 3 | <=> (p <=> (q <=> r))). 4 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb13.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, (p | (q & r)) <=> 3 | ((p | q) & (p | r))). 4 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb14.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, (p <=> q) <=> ((q | ~ p) & 3 | (~ q | p))). 4 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb2.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val p : prop. 4 | goal p <=> p. 5 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb35.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, ? [X,Y] : (p(X,Y) => 3 | ! [X,Y] : p(X,Y))). 4 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb39.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, ~ ? [X] : ! [Y] : 3 | (f(X,Y) <=> ~ f(Y,Y))). 4 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb5.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, ((p | q) => (p | r)) => 3 | (p | (q => r))). 4 | -------------------------------------------------------------------------------- /examples/ind/nat23.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | include "nat.zf". 5 | 6 | goal forall x y. leq (minus x y) x. 7 | -------------------------------------------------------------------------------- /examples/ind/nat3.p: -------------------------------------------------------------------------------- 1 | % s(x) > x 2 | 3 | include('nat.ax'). 4 | 5 | tff(the, conjecture, ![X:nat]: plus(X,z) = X). 6 | -------------------------------------------------------------------------------- /examples/ind/unit1.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | data unit := One. 5 | 6 | goal forall (x y: unit). x = y. 7 | -------------------------------------------------------------------------------- /examples/pelletier_problems/ax_logic_d.ax: -------------------------------------------------------------------------------- 1 | 2 | fof(ax_logic_d, axiom, ! [X,Y] : ((t(i(X,Y)) & t(X)) => t(Y))). 3 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb22.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, ! [X] : (p <=> f(X)) => 3 | (p <=> ! [X] : f(X))). 4 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb23.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, ! [X] : (p | f(X)) <=> 3 | (p | ! [X] : f(X))). 4 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb6.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val p : prop. 4 | goal (~ p) || p. 5 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb7.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val p : prop. 4 | goal (~ p) || p. 5 | -------------------------------------------------------------------------------- /examples/data/unit_eq2.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | data unit := Unit. 4 | 5 | goal forall (x y:unit). x=y. 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/ind/nat10.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | include "nat.zf". 5 | 6 | goal forall (X:nat). ((minus X X) = z). 7 | -------------------------------------------------------------------------------- /examples/ind/nat11.p: -------------------------------------------------------------------------------- 1 | 2 | include('nat.ax'). 3 | 4 | tff(the, conjecture, ![X:nat, Y:nat]: minus(plus(X,Y),Y) = X). 5 | -------------------------------------------------------------------------------- /examples/pelletier_problems/ax_logic_b.ax: -------------------------------------------------------------------------------- 1 | 2 | fof(ax_logic_b, axiom, ! [X,Y,Z] : t(i(i(X,i(Y,Z)),i(i(X,Y),i(X,Z))))). 3 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb9.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, ((p | q) & (~ p | q) & 3 | (p | ~ q)) => ~ (~p | ~q)). 4 | -------------------------------------------------------------------------------- /examples/ind/nat_false1.zf: -------------------------------------------------------------------------------- 1 | # expect: sat 2 | include "nat.zf". 3 | goal forall (X:nat). (forall (Y:nat). ((plus X Y) = X)). 4 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb19.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, ? [X] : ! [Y, Z] : 3 | ((p(Y) => q(Z)) => (p(X) => q(X)))). 4 | -------------------------------------------------------------------------------- /old/data/rewriting/ski.p: -------------------------------------------------------------------------------- 1 | app (app k X) Y --> X. 2 | app i X --> X. 3 | app (app (app s X) Y) Z --> app (app X Z) (app Y Z). 4 | -------------------------------------------------------------------------------- /src/parsers/logtk_parsers.mld: -------------------------------------------------------------------------------- 1 | 2 | Parsers for diverse input formats, using menhir. 3 | 4 | {!modules: Logtk_parsers} 5 | 6 | -------------------------------------------------------------------------------- /examples/ind/list7.p: -------------------------------------------------------------------------------- 1 | 2 | include('list.ax'). 3 | 4 | % rev rev = id 5 | 6 | tff(the, conjecture, ![L:list]: rev(rev(L)) = L). 7 | -------------------------------------------------------------------------------- /examples/ind/nat8.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | goal forall (X:nat). (forall (Y:nat). ((minus X (plus X Y)) = z)). 4 | -------------------------------------------------------------------------------- /examples/ind/nat9.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | goal forall (X:nat). (forall (Y:nat). ((minus (plus X Y) X) = Y)). 4 | -------------------------------------------------------------------------------- /examples/ind/list7.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "nat.zf". 4 | include "list.zf". 5 | goal forall (L:list). ((rev (rev L)) = L). 6 | -------------------------------------------------------------------------------- /examples/ind/list8.p: -------------------------------------------------------------------------------- 1 | 2 | include('list.ax'). 3 | 4 | % append L nil = L 5 | 6 | tff(the, conjecture, ![L:list]: append(L,nil) = L). 7 | -------------------------------------------------------------------------------- /examples/ind/nat11.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | goal forall (X:nat). (forall (Y:nat). ((minus (plus X Y) Y) = X)). 4 | -------------------------------------------------------------------------------- /examples/ind/nat2.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | # commutativity 3 | 4 | include "nat.zf". 5 | goal forall (X Y:nat). plus X Y = plus Y X. 6 | -------------------------------------------------------------------------------- /examples/ind/nat2_easy.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | goal forall (X:nat). (forall (Y:nat). ((plus X Y) = (plus Y X))). 4 | -------------------------------------------------------------------------------- /examples/ind/tree2.p: -------------------------------------------------------------------------------- 1 | 2 | % rev o rev = id 3 | 4 | include('tree.ax'). 5 | 6 | tff(the, conjecture, ![T:tree]: rev(rev(T)) = T). 7 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb42.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, 3 | ~ ? [Y] : ! [X] : (f(X,Y) <=> ~ ? [Z] : (f(X,Z) & f(Z,X))) 4 | ). 5 | -------------------------------------------------------------------------------- /examples/tla/fsm1.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "fsm.zf". 4 | 5 | # S2 is reachable 6 | 7 | goal exists t. at_state t = S2. 8 | -------------------------------------------------------------------------------- /src/proofs/logtk_proofs.mld: -------------------------------------------------------------------------------- 1 | 2 | Low level proof format, plus a simple checker for some proof steps. 3 | 4 | {!modules: Logtk_proofs} 5 | -------------------------------------------------------------------------------- /data/vim/ftdetect/theory.vim: -------------------------------------------------------------------------------- 1 | 2 | au BufRead,BufNewFile *.theory set filetype=theory 3 | au BufRead,BufNewFile *.theory set syntax=theory 4 | -------------------------------------------------------------------------------- /examples/fool/test_res.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val p : prop -> prop. 5 | 6 | goal exists (x:prop) y. forall z. x=z || y=z. 7 | 8 | -------------------------------------------------------------------------------- /examples/ind/nat5.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | goal forall (X:nat). (forall (Y:nat). ((plus X (s Y)) = (s (plus X Y)))). 4 | -------------------------------------------------------------------------------- /examples/ind/nat9.p: -------------------------------------------------------------------------------- 1 | 2 | include('nat.ax'). 3 | 4 | % (X+Y)-X = Y 5 | 6 | tff(the, conjecture, ![X:nat, Y:nat]: minus(plus(X,Y),X) = Y). 7 | -------------------------------------------------------------------------------- /examples/modulo3.p: -------------------------------------------------------------------------------- 1 | 2 | % 3 a mod 3 = 0 3 | 4 | tff(ty_a, type, a : $int). 5 | tff(the, conjecture, $remainder_e($product(a, 3), 3) = 0). 6 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb16.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val q : prop. 4 | val p : prop. 5 | goal (q => p) || (p => q). 6 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb50.p: -------------------------------------------------------------------------------- 1 | fof(goal, conjecture, 2 | (! [X] : (f(a, X) | ! [Y] : f(X,Y))) => 3 | (? [X] : ! [Y] : f(X,Y))). 4 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb8.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val q : prop. 4 | val p : prop. 5 | goal ((p => q) => p) => p. 6 | -------------------------------------------------------------------------------- /examples/data/unit_eq.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | data unit := Unit. 4 | 5 | val a : unit. 6 | val b : unit. 7 | 8 | goal a=b. 9 | 10 | -------------------------------------------------------------------------------- /examples/ind/list8.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "nat.zf". 4 | include "list.zf". 5 | 6 | goal forall (L:list). ((append L nil) = L). 7 | -------------------------------------------------------------------------------- /examples/ind/nat8.p: -------------------------------------------------------------------------------- 1 | 2 | include('nat.ax'). 3 | 4 | % X - (X+Y) = 0 5 | 6 | tff(the, conjecture, ![X:nat, Y:nat]: minus(X,plus(X,Y)) = z). 7 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb15.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val q : prop. 4 | val p : prop. 5 | goal (p => q) <=> (q || (~ p)). 6 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb17.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, 3 | ((p & (q => r)) => s) <=> 4 | ((~ p | q | s) & 5 | (~ p | ~ r | s))). 6 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb3.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val q : prop. 4 | val p : prop. 5 | goal (~ (p => q)) => (q => p). 6 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb58.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ! [X,Y] : f(X) = g(Y)). 3 | 4 | fof(goal, conjecture, ! [X,Y] : f(f(X)) = f(g(Y))). 5 | -------------------------------------------------------------------------------- /examples/ind/list12.p: -------------------------------------------------------------------------------- 1 | 2 | % X in L@[X] 3 | 4 | include('list.ax'). 5 | 6 | tff(the, conjecture, ![X:nat, L:list]: mem(X, append(L, cons(X,nil)))). 7 | -------------------------------------------------------------------------------- /examples/ind/list5.p: -------------------------------------------------------------------------------- 1 | include('list.ax'). 2 | 3 | tff(the, conjecture, ![X:nat, L:list]: 4 | count(X, cons(X,L)) = plus(s(z), count(X,L))). 5 | 6 | -------------------------------------------------------------------------------- /examples/ind/nat5.p: -------------------------------------------------------------------------------- 1 | % x+ s y = s (x+y) 2 | 3 | include('nat.ax'). 4 | 5 | tff(the, conjecture, ![X:nat, Y:nat]: plus(X,s(Y)) = s(plus(X,Y))). 6 | 7 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb1.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val q : prop. 4 | val p : prop. 5 | goal (p => q) => ((~ q) => (~ p)). 6 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb4.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val q : prop. 4 | val p : prop. 5 | goal ((~ p) => q) <=> ((~ q) => p). 6 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb59.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ! [X] : (f(X) <=> ~f(g(X)))). 3 | 4 | fof(goal, conjecture, ? [X] : (f(X) & ~ f(g(X)))). 5 | -------------------------------------------------------------------------------- /utils/cpulimit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | MEMORY=512000 4 | TIME=$1 5 | shift 6 | 7 | ulimit -t "$TIME" -m "$MEMORY" 8 | 9 | exec $@ 10 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb48.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, a=b | c=d). 3 | 4 | fof(ax2, axiom, a=c | b=d). 5 | 6 | fof(goal, conjecture, a = d | b = c). 7 | -------------------------------------------------------------------------------- /examples/ac.p: -------------------------------------------------------------------------------- 1 | 2 | tff(1, axiom, f(X,Y) = f(Y,X)). 3 | tff(2, axiom, f(f(X,Y),Z) = f(X,f(Y,Z))). 4 | tff(3, conjecture, f(f(f(a,b),c),d) = f(b,f(d,f(a,c)))). 5 | -------------------------------------------------------------------------------- /examples/enum2.p: -------------------------------------------------------------------------------- 1 | 2 | fof(1,axiom, ![X]: (X=a | X=b | X=c)). 3 | fof(2,axiom, a!=b). 4 | fof(2,axiom, a!=c). 5 | fof(2,axiom, b!=c). 6 | % fof(2,axiom, a!=b). 7 | -------------------------------------------------------------------------------- /examples/ind/nat20.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | val term : type. 3 | data nat := z | s nat. 4 | val plus : nat -> nat -> nat. 5 | goal forall (X:nat). (X != (s X)). 6 | -------------------------------------------------------------------------------- /examples/ind/nat25.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # x-y <= x 5 | 6 | include "nat.zf". 7 | 8 | goal forall x y. leq (minus x y) x. 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/ind/tree6.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "tree.zf". 4 | 5 | goal 6 | forall L X R T. 7 | subtree (node L X R) T => 8 | subtree L T. 9 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb40.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, ? [Y] : ! [X] : (f(X,Y) <=> f(X,X)) 3 | => ~ ! [X] : ? [Y] : ! [Z] : (f(X,Y) <=> ~ f(Z,X))). 4 | -------------------------------------------------------------------------------- /src/core/arith/logtk_arith.zarith.ml: -------------------------------------------------------------------------------- 1 | 2 | module Z = struct 3 | include Z 4 | let to_int_exn = to_int 5 | end 6 | module Q = struct 7 | include Q 8 | end 9 | -------------------------------------------------------------------------------- /src/prover/libzipperposition.mld: -------------------------------------------------------------------------------- 1 | 2 | Library with the core data structures and algorithms for a Superposition prover. 3 | 4 | {!modules: Libzipperposition} 5 | -------------------------------------------------------------------------------- /examples/ind/list12.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | include "list.zf". 4 | goal forall (X:nat). (forall (L:list). (mem X (append L (cons X nil)))). 5 | -------------------------------------------------------------------------------- /examples/ind/nat1.p: -------------------------------------------------------------------------------- 1 | 2 | % associativity 3 | 4 | include('nat.ax'). 5 | 6 | tff(1, conjecture, ![X:nat, Y:nat, Z:nat]: plus(X,plus(Y,Z)) = plus(plus(X,Y),Z)). 7 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb14.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val q : prop. 4 | val p : prop. 5 | goal (p <=> q) <=> ((p || (~ q)) && ((~ p) || q)). 6 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb18.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val f : term -> prop. 4 | goal exists (Y:term). (forall (X:term). ((f Y) => (f X))). 5 | -------------------------------------------------------------------------------- /src/core/FixpointUnif.mli: -------------------------------------------------------------------------------- 1 | module T = Term 2 | module US = Unif_subst 3 | 4 | val unify_scoped : ?subst:US.t -> ?counter:int ref -> T.t Scoped.t -> T.t Scoped.t -> US.t -------------------------------------------------------------------------------- /examples/ho/thf_syntax.p: -------------------------------------------------------------------------------- 1 | % expect: unknown 2 | 3 | thf(1, axiom, ~ p). 4 | thf(2, axiom, (~) @ p). 5 | 6 | thf(3, axiom, | @ p @ q). 7 | thf(4, axiom, (|) @ p @ q). 8 | -------------------------------------------------------------------------------- /examples/ind/list11.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "nat.zf". 4 | include "list.zf". 5 | 6 | goal forall (X:nat). (forall (L:list). (leq (count X L) (length L))). 7 | -------------------------------------------------------------------------------- /examples/ind/list17.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # len (rev x) = len x 4 | 5 | include "list.zf". 6 | 7 | goal forall x. length x = length (rev x). 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/ind/list3.p: -------------------------------------------------------------------------------- 1 | 2 | include('list.ax'). 3 | 4 | % butlast(L @ [x]) = L 5 | 6 | tff(the, conjecture, ![X:nat, L:list]: (butlast(append(L,cons(X,nil))) = L)). 7 | 8 | -------------------------------------------------------------------------------- /examples/ind/nat13.p: -------------------------------------------------------------------------------- 1 | 2 | include('nat.ax'). 3 | 4 | tff(1, axiom, ![X:nat]: (p(X) => p(s(X)))). 5 | tff(2, axiom, p(z)). 6 | 7 | tff(the, conjecture, ![X:nat]: p(X)). 8 | -------------------------------------------------------------------------------- /examples/ind/list1.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "list.zf". 4 | 5 | goal 6 | forall (L:list). 7 | ((L != nil) => (L = (append (butlast L) (cons (last L) nil)))). 8 | -------------------------------------------------------------------------------- /examples/ind/list1_false.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "nat.zf". 4 | include "list.zf". 5 | 6 | goal forall (L:list). (L = (append (butlast L) (cons (last L) nil))). 7 | -------------------------------------------------------------------------------- /examples/ind/tree2_easy.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "tree.zf". 3 | 4 | # TODO: find proper lemma, fix precedence bug 5 | 6 | goal forall (T:tree). ((rev (rev T)) = T). 7 | -------------------------------------------------------------------------------- /examples/data/pair.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # deconstruct pairs 4 | 5 | data pair a b := Pair (fst: a) (snd: b). 6 | 7 | goal forall a b p. exists x y. p = Pair a b x y. 8 | 9 | -------------------------------------------------------------------------------- /examples/fool/test_not.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val not_ : prop -> prop. 5 | 6 | assert forall (x:prop). not_ x <=> (x=false). 7 | 8 | goal not_ false. 9 | 10 | -------------------------------------------------------------------------------- /examples/ind/nat24.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # right-injectivity of + 5 | 6 | include "nat.zf". 7 | 8 | goal forall x y z. y != z => plus x y != plus x z. 9 | 10 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb12.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val r : prop. 4 | val q : prop. 5 | val p : prop. 6 | goal ((p <=> q) <=> r) <=> (p <=> (q <=> r)). 7 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb13.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val r : prop. 4 | val q : prop. 5 | val p : prop. 6 | goal ((r && q) || p) <=> ((r || p) && (q || p)). 7 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb20.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, ! [X,Y] : ? [Z] : ! [W] : 3 | ((p(X) & q(Y)) => (r(Z) & s(W))) => 4 | (? [X,Y] : (p(X) & q(Y)) => ? [Z] : r(Z))). 5 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb21.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ? [X] : (p => f(X))). 3 | 4 | fof(ax2, axiom, ? [X] : (f(X) => p)). 5 | 6 | fof(goal, conjecture, ? [X] : (p <=> f(X))). 7 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb41.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ! [Z] : ? [Y] : ! [X] : 3 | (f(X,Y) <=> (f(X,Z) & ~ f(X,X)))). 4 | 5 | fof(goal, conjecture, ~ ? [Z] : ! [X] : f(X,Z)). 6 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb43.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ! [X,Y] : (q(X,Y) <=> 3 | ! [Z] : (f(Z,X) <=> f(Z,Y)))). 4 | 5 | fof(goal, conjecture, ! [X,Y] : (q(X,Y) <=> q(Y,X))). 6 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb5.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val r : prop. 4 | val q : prop. 5 | val p : prop. 6 | goal ((q || p) => (r || p)) => ((q => r) || p). 7 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb63.p: -------------------------------------------------------------------------------- 1 | 2 | include('ax_a.ax'). 3 | include('ax_b.ax'). 4 | include('ax_c.ax'). 5 | 6 | fof(goal, conjecture, ! [X,Y,Z] : (f(X,Y) = f(Z,Y) => X = Z)). 7 | -------------------------------------------------------------------------------- /examples/ind/list11.p: -------------------------------------------------------------------------------- 1 | % count(X,L) ≤ len(L) 2 | 3 | include('nat.ax'). 4 | include('list.ax'). 5 | 6 | tff(the, conjecture, ![X:nat, L:list]: 7 | leq(count(X,L), length(L))). 8 | -------------------------------------------------------------------------------- /examples/ind/list3.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "nat.zf". 4 | include "list.zf". 5 | 6 | goal 7 | forall (X:nat). (forall (L:list). ((butlast (append L (cons X nil))) = L)). 8 | -------------------------------------------------------------------------------- /examples/ind/nat13.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | val p : nat -> prop. 4 | assert forall (X:nat). ((p X) => (p (s X))). 5 | assert p z. 6 | goal forall (X:nat). (p X). 7 | -------------------------------------------------------------------------------- /examples/modulo2.p: -------------------------------------------------------------------------------- 1 | 2 | % a mod 4 = 1 ==> a mod 2 = 1 3 | 4 | tff(ty_a, type, a : $int). 5 | tff(1, axiom, $remainder_e(a, 4) = 1). 6 | tff(the, conjecture, $remainder_e(a, 2) = 1). 7 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb39.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val f : term -> term -> prop. 4 | goal ~ (exists (X:term). (forall (Y:term). ((f X Y) <=> (~ (f Y Y))))). 5 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb60.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, ! [X] : ( 3 | f(X,g(X)) 4 | <=> ? [Y] : ( 5 | ! [Z] : (f(Z,Y) => f(Z, g(X))) 6 | & f(X,Y) 7 | 8 | ))). 9 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb64.p: -------------------------------------------------------------------------------- 1 | 2 | 3 | include('ax_a.ax'). 4 | include('ax_b.ax'). 5 | include('ax_c.ax'). 6 | 7 | fof(goal, conjecture, ! [X,Y] : (f(Y,X) = a => f(X,Y) = a)). 8 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb9.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val q : prop. 4 | val p : prop. 5 | goal (((~ q) || p) && (q || p) && (q || (~ p))) => (~ ((~ q) || (~ p))). 6 | -------------------------------------------------------------------------------- /examples/regression/type_eq.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: error 3 | # check that equality between types is disallowed 4 | 5 | val a : type. 6 | val b : type. 7 | 8 | assert a=b. 9 | 10 | -------------------------------------------------------------------------------- /examples/ind/nat18.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | goal 4 | forall (X:nat). 5 | (forall (Y:nat). 6 | (forall (Z:nat). ((leq X Y) => (leq (plus Z X) (plus Z Y))))). 7 | -------------------------------------------------------------------------------- /examples/ind/nat19.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | goal 4 | forall (X:nat). 5 | (forall (Y:nat). 6 | (forall (Z:nat). ((leq X Y) => (leq (plus X Z) (plus Y Z))))). 7 | -------------------------------------------------------------------------------- /examples/ind/nat_false3.zf: -------------------------------------------------------------------------------- 1 | # expect: sat 2 | include "nat.zf". 3 | val p : nat -> prop. 4 | assert forall (N:nat). ((p N) => (p (s (s N)))). 5 | assert p z. 6 | goal forall (N:nat). (p N). 7 | -------------------------------------------------------------------------------- /examples/modulo4.p: -------------------------------------------------------------------------------- 1 | 2 | % 3 a mod 3 != 1 and != 2 3 | 4 | tff(ty_a, type, a : $int). 5 | tff(the, conjecture, $remainder_e($product(a, 3), 3) != 1 & $remainder_e($product(a, 3), 3) != 2). 6 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb10.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, q => r). 3 | 4 | fof(ax2, axiom, r => (p & q)). 5 | 6 | fof(ax3, axiom, p => (q | r)). 7 | 8 | fof(goal, conjecture, p <=> q). 9 | -------------------------------------------------------------------------------- /examples/rewrite3.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val unit : type. 5 | 6 | rewrite forall (x y: unit). x=y <=> true. 7 | 8 | goal exists (x:unit). forall y. x=y. 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/core/SolidSubsumption.mli: -------------------------------------------------------------------------------- 1 | exception UnsupportedLiteralKind 2 | 3 | module Make (S : sig val st : Flex_state.t end) : sig 4 | val subsumes : Literals.t -> Literals.t -> bool 5 | end 6 | -------------------------------------------------------------------------------- /src/proofs/LLProof_conv.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | open Logtk 5 | 6 | val conv : Proof.t -> LLProof.t 7 | -------------------------------------------------------------------------------- /examples/fool/test_param2.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val f : prop -> prop -> prop. 5 | 6 | val a : prop. 7 | val b : prop. 8 | 9 | goal f a a => (f b b || f (~b) (~b)). 10 | 11 | -------------------------------------------------------------------------------- /examples/ho/find_set_compl.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # find set complement 4 | 5 | val a : type. 6 | 7 | goal forall (P: a -> prop). exists (Q:a -> prop). forall x. (P x <=> ~ Q x). 8 | 9 | -------------------------------------------------------------------------------- /examples/ind/nat18.p: -------------------------------------------------------------------------------- 1 | % X ≤ Y => Z+X ≤ Z+Y 2 | 3 | include('nat.ax'). 4 | 5 | tff(the, conjecture, 6 | ![X:nat, Y:nat, Z:nat]: 7 | (leq(X,Y) => leq(plus(Z,X), plus(Z,Y)))). 8 | 9 | -------------------------------------------------------------------------------- /examples/ind/tree3.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "tree.zf". 3 | 4 | goal 5 | forall (X:term). 6 | forall (T1:tree). 7 | forall (T2:tree). (subtree T1 T2 && mem X T1) => mem X T2. 8 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb23.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val f : term -> prop. 4 | val p : prop. 5 | goal (forall (X:term). ((f X) || p)) <=> ((forall (X:term). (f X)) || p). 6 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb61.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ! [X,Y,Z] : 3 | f(X, f(Y,Z)) = f(f(X,Y),Z)). 4 | 5 | fof(goal, conjecture, ! [X,Y,Z,W] : 6 | f(X,f(Y,f(Z,W))) = f(f(f(X,Y),Z),W)). 7 | -------------------------------------------------------------------------------- /examples/ho/sum_int.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val sum : pi a. a -> (a -> int) -> int. 5 | 6 | goal 7 | forall a (s : a) f g. 8 | sum s (fun x. f x + g x) = sum s (fun x. g x + f x). 9 | -------------------------------------------------------------------------------- /examples/ind/list1_false.p: -------------------------------------------------------------------------------- 1 | 2 | include('list.ax'). 3 | 4 | % L = butlast L @ [last L] is false if L=[] 5 | 6 | tff(the, conjecture, ![L:list]: L = append(butlast(L), cons(last(L),nil))). 7 | 8 | -------------------------------------------------------------------------------- /examples/ind/list9.p: -------------------------------------------------------------------------------- 1 | include('list.ax'). 2 | 3 | % append associative 4 | 5 | tff(the, conjecture, ![L1:list, L2:list, L3:list]: 6 | append(append(L1,L2),L3) = append(L1, append(L2,L3))). 7 | 8 | -------------------------------------------------------------------------------- /examples/ind/nat21.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # transitivity of geq 4 | # x>=y, y>=z -> x>=y 5 | 6 | include "nat.zf". 7 | 8 | goal forall x y z. (leq x y && leq y z => leq x z). 9 | 10 | -------------------------------------------------------------------------------- /examples/ind/tree4.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "tree.zf". 3 | goal 4 | forall (T1:tree). 5 | forall (T2:tree). 6 | forall (T3:tree). 7 | (subtree T2 T3 && subtree T1 T2) => subtree T1 T3. 8 | -------------------------------------------------------------------------------- /examples/ind/tree_nat1.p: -------------------------------------------------------------------------------- 1 | 2 | include('tree.ax'). 3 | include('nat.ax'). 4 | 5 | % size(node(L,_,R)) > size(L) 6 | 7 | tff(the, conjecture, ![L:tree, R:tree, X]: lt(size(L), size(node(L,X,R)))). 8 | -------------------------------------------------------------------------------- /examples/mccarthy91_M2.smt2: -------------------------------------------------------------------------------- 1 | (define-fun-rec 2 | m ((x Int)) Int (ite (> x 100) (- x 10) (m (m (+ x 11))))) 3 | (assert-not (forall ((n Int)) (=> (>= n 101) (= (m n) (- n 10))))) 4 | (check-sat) 5 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb22.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val f : term -> prop. 4 | val p : prop. 5 | goal (forall (X:term). (p <=> (f X))) => (p <=> (forall (X:term). (f X))). 6 | -------------------------------------------------------------------------------- /examples/tla/fsm5.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | include "fsm.zf". 5 | 6 | # every other state is S2 7 | 8 | goal 9 | forall t1. 10 | (at_state t1 = S2 || at_state (Later t1) = S2). 11 | -------------------------------------------------------------------------------- /portfolio/ltb/run_ltb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | 5 | timeout -k 9 $2 python3 $DIR/../portfolio.sh.sequential.py $1 $2 $3 6 | -------------------------------------------------------------------------------- /src/prover_phases/libzipperposition_phases.mld: -------------------------------------------------------------------------------- 1 | 2 | Main procedure of Zipperposition, as a series of steps that are articulated in 3 | a type-safe way. 4 | 5 | {!modules: Libzipperposition_phases} 6 | -------------------------------------------------------------------------------- /examples/ind/list1.p: -------------------------------------------------------------------------------- 1 | 2 | include('list.ax'). 3 | 4 | % L != [] ==> L = butlast L @ [last L] 5 | 6 | tff(the, conjecture, ![L:list]: 7 | (L != nil => L = append(butlast(L), cons(last(L),nil)))). 8 | -------------------------------------------------------------------------------- /examples/ind/list5.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "nat.zf". 4 | include "list.zf". 5 | 6 | goal 7 | forall (X:nat). 8 | (forall (L:list). ((count X (cons X L)) = (plus (s z) (count X L)))). 9 | -------------------------------------------------------------------------------- /examples/ind/nat14.p: -------------------------------------------------------------------------------- 1 | include('nat.ax'). 2 | 3 | tff(1, axiom, ![X:nat]: (p(X) => p(s(s(X))))). 4 | tff(2, axiom, p(z)). 5 | tff(3, axiom, p(s(z))). 6 | 7 | tff(the, conjecture, ![X:nat]: p(X)). 8 | 9 | -------------------------------------------------------------------------------- /examples/ind/nat22.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # need generalization to work (to go back to associativity of +) 4 | 5 | include "nat.zf". 6 | 7 | goal forall X. plus X (plus X X) = plus (plus X X) X. 8 | -------------------------------------------------------------------------------- /examples/ind/tree4.p: -------------------------------------------------------------------------------- 1 | 2 | include('tree.ax'). 3 | 4 | % subtree is transitive 5 | 6 | tff(the, conjecture, ![T1:tree, T2:tree, T3:tree]: 7 | ((subtree(T1,T2) & subtree(T2,T3)) => subtree(T1, T3))). 8 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb33.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, 3 | ! [X] : ((p(a) & (p(X) => p(b))) => p(c)) <=> 4 | ! [X] : ((~ p(a) | p(X) | p(c)) & 5 | (~ p(a) | ~ p(b) | p(c))) 6 | ). 7 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb56.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, 3 | ! [X] : ( 4 | (? [Y] : (f(Y) & X = g(Y))) 5 | => 6 | f(X) 7 | ) 8 | <=> 9 | ! [X] : (f(X) => f(g(X))) 10 | ). 11 | -------------------------------------------------------------------------------- /old/data/rewriting/peano.p: -------------------------------------------------------------------------------- 1 | val zero : nat. 2 | 3 | plus zero X --> X. 4 | plus (succ X) Y --> succ (plus X Y). 5 | mult zero X --> zero. 6 | mult (succ X) Y --> plus Y (mult X Y). 7 | % vim:syntax=prolog 8 | -------------------------------------------------------------------------------- /examples/data/unit_res.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | data unit := Unit. 5 | 6 | val a : unit. 7 | val b : unit. 8 | val p : unit -> prop. 9 | 10 | assert p a. 11 | assert ~ (p b). 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/ind/nat1.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | # associativity 3 | include "nat.zf". 4 | goal 5 | forall (X:nat). 6 | (forall (Y:nat). 7 | (forall (Z:nat). ((plus X (plus Y Z)) = (plus (plus X Y) Z)))). 8 | -------------------------------------------------------------------------------- /examples/ind/nat14.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | val p : nat -> prop. 4 | assert forall (X:nat). ((p X) => (p (s (s X)))). 5 | assert p z. 6 | assert p (s z). 7 | goal forall (X:nat). (p X). 8 | -------------------------------------------------------------------------------- /examples/ind/nat19.p: -------------------------------------------------------------------------------- 1 | % X ≤ Y => X+Z ≤ Y+Z 2 | 3 | include('nat.ax'). 4 | 5 | tff(the, conjecture, 6 | ![X:nat, Y:nat, Z:nat]: 7 | (leq(X,Y) => leq(plus(X,Z), plus(Y,Z)))). 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/ind/tree_nat1.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | include "tree.zf". 4 | 5 | goal 6 | forall (L:tree). 7 | (forall (R:tree). (forall (X:term). (less (size L) (size (node L X R))))). 8 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb65.p: -------------------------------------------------------------------------------- 1 | 2 | include('ax_a.ax'). 3 | include('ax_b.ax'). 4 | 5 | fof(goal, conjecture, 6 | (! [X] : f(X,X) = a) 7 | => 8 | (! [X,Y] : f(X,Y) = f(Y,X)) 9 | ). 10 | 11 | -------------------------------------------------------------------------------- /old/data/rewriting/quotient_difference.p: -------------------------------------------------------------------------------- 1 | minus X z --> X. 2 | minus (s X) (s X) --> minus X Y. 3 | quot z (s Y) --> z. 4 | quot (s X) (s Y) --> s (quot (minus X Y) (s Y)). 5 | % vim:syntax=prolog 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/ho/find_set_union.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # find set union 4 | 5 | val a : type. 6 | 7 | goal forall (A B: a -> prop). 8 | exists (Q:a -> prop). forall x. ((A x || B x) <=> Q x). 9 | 10 | -------------------------------------------------------------------------------- /examples/ind/list13.p: -------------------------------------------------------------------------------- 1 | % X in L ==> X in L @ L' 2 | 3 | include('list.ax'). 4 | 5 | tff(the, conjecture, 6 | ![X:nat, L:list, L2:list]: 7 | (mem(X, L) => mem(X, append(L, L2))) 8 | ). 9 | 10 | -------------------------------------------------------------------------------- /examples/ind/nat_false3.p: -------------------------------------------------------------------------------- 1 | include('nat.ax'). 2 | 3 | tff(ty_p, type, p : nat > $o). 4 | 5 | tff(p1, axiom, ![N:nat]: (p(N) => p(s(s(N))))). 6 | tff(p2, axiom, p(z)). 7 | 8 | tff(the, conjecture, ![N:nat]: p(N)). 9 | -------------------------------------------------------------------------------- /examples/ind/tree3.p: -------------------------------------------------------------------------------- 1 | 2 | include('tree.ax'). 3 | 4 | % mem(X, T1) & subtree(T1, T2) => mem(X, T2) 5 | 6 | tff(the, conjecture, ![X, T1:tree, T2:tree]: 7 | ((mem(X, T1) & subtree(T1, T2)) => mem(X, T2))). 8 | -------------------------------------------------------------------------------- /examples/modulo5.p: -------------------------------------------------------------------------------- 1 | 2 | % Gauss theorem 3 | 4 | tff(ty_a, type, a : $int). 5 | tff(1, axiom, $remainder_e(a, 3) = 0). 6 | tff(2, axiom, $remainder_e(a, 2) = 0). 7 | tff(the, conjecture, $remainder_e(a, 6) = 0). 8 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb30.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ! [X] : ((f(X) | g(X)) => ~ h(X))). 3 | 4 | fof(ax2, axiom, ! [X] : ((g(X) => ~ i(X)) => 5 | (f(X) & h(X)))). 6 | 7 | fof(goal, conjecture, ! [X] : i(X)). 8 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb49.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ? [X,Y] : ! [Z] : (X = Z | Y = Z)). 3 | 4 | fof(ax2, axiom, p(a) & p(b)). 5 | 6 | fof(ax3, axiom, a != b). 7 | 8 | fof(goal, conjecture, ! [X] : p(X)). 9 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb66.p: -------------------------------------------------------------------------------- 1 | 2 | include('ax_logic_a.ax'). 3 | include('ax_logic_b.ax'). 4 | include('ax_logic_c.ax'). 5 | include('ax_logic_d.ax'). 6 | 7 | fof(goal, conjecture, ! [X] : t(i(X,n(n(X))))). 8 | -------------------------------------------------------------------------------- /examples/ind/list14.p: -------------------------------------------------------------------------------- 1 | % X in L ==> X in L' @ L 2 | 3 | include('list.ax'). 4 | 5 | tff(the, conjecture, 6 | ![X:nat, L:list, L2:list]: 7 | (mem(X, L) => mem(X, append(L2, L))) 8 | ). 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/ind/list16.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # P(len(x)) => P(len(rev x)) 5 | 6 | include "list.zf". 7 | 8 | val p : nat -> prop. 9 | 10 | goal forall x. p (length x) => p (length (rev x)). 11 | 12 | -------------------------------------------------------------------------------- /examples/ind/nat_check.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | val p : nat -> nat -> prop. 4 | val a : nat. 5 | val b : nat. 6 | assert forall (X:nat). (forall (Y:nat). ((p X Y) => ((s X) = Y))). 7 | assert p a b. 8 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb67.p: -------------------------------------------------------------------------------- 1 | 2 | include('ax_logic_a.ax'). 3 | include('ax_logic_b.ax'). 4 | include('ax_logic_c.ax'). 5 | include('ax_logic_d.ax'). 6 | 7 | fof(goal, conjecture, ! [X] : t(i(n(n(X)),X))). 8 | 9 | -------------------------------------------------------------------------------- /examples/ho/find_not.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val i:type. 5 | 6 | # not (f true), f false... so f=not should work 7 | goal 8 | exists (f: prop ->prop). 9 | (~ (f true) && f (forall (x:prop). x)). 10 | 11 | -------------------------------------------------------------------------------- /examples/ho/find_set_inter.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # find set intersection 4 | 5 | val a : type. 6 | 7 | goal forall (A B: a -> prop). 8 | exists (Q:a -> prop). forall x. ((A x && B x) <=> Q x). 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/ho/leo_ex_2.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # example 2 from "extensional higher order resolution" 5 | 6 | val a : prop. 7 | val b : prop. 8 | 9 | goal forall P. 10 | P (a && b) => 11 | P (b && a). 12 | -------------------------------------------------------------------------------- /examples/ind/list15.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | include "list.zf". 4 | 5 | goal 6 | forall (L1:list). 7 | (forall (L2:list). 8 | ((length (append L1 L2)) = (plus (length L1) (length L2)))). 9 | -------------------------------------------------------------------------------- /examples/ind/plist1.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "plist.zf". 4 | 5 | goal 6 | forall a (l : list a). 7 | l != nil a 8 | => 9 | l = append _ (butlast _ l) (cons _ (last _ l) (nil _)). 10 | 11 | -------------------------------------------------------------------------------- /examples/ind/tree3_easy.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | include "tree.zf". 5 | 6 | goal 7 | forall (X:term). 8 | forall (T1:tree). 9 | forall (T2:tree). (subtree T1 T2 && mem X T1) => mem X T2. 10 | 11 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb51.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ? [Z,W] : ! [X,Y] : 3 | (f(X,Y) <=> (X=Z & Y=W))). 4 | 5 | fof(goal, conjecture, ? [Z] : ! [X] : ( 6 | (? [W] : ! [Y] : (f(X,Y) <=> Y=W)) <=> 7 | X=Z) 8 | ). 9 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb52.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ? [Z,W] : ! [X,Y] : 3 | (f(X,Y) <=> (X=Z & Y=W))). 4 | 5 | fof(goal, conjecture, ? [W] : ! [Y] : ( 6 | (? [Z] : ! [X] : (f(X,Y) <=> X=Z)) <=> 7 | Y=W) 8 | ). 9 | -------------------------------------------------------------------------------- /examples/ho/leo_ex_3.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # example 3 from "extensional higher order resolution" 5 | 6 | val a : prop. 7 | val b : prop. 8 | 9 | goal forall P. ((P a && P b) => P (a && b)). 10 | 11 | 12 | -------------------------------------------------------------------------------- /examples/ind/plist1.p: -------------------------------------------------------------------------------- 1 | 2 | include('plist.ax'). 3 | 4 | % L != [] ==> L = butlast L @ [last L] 5 | 6 | tff(the, conjecture, ![A:$tType,L:list(A)]: 7 | (L != nil(A) => L = append(A,butlast(A,L), cons(A,last(A,L),nil(A))))). 8 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb10.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val r : prop. 4 | val q : prop. 5 | assert q => r. 6 | val p : prop. 7 | assert r => (q && p). 8 | assert p => (r || q). 9 | goal p <=> q. 10 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb17.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val s : prop. 4 | val r : prop. 5 | val q : prop. 6 | val p : prop. 7 | goal (((q => r) && p) => s) <=> ((s || (~ p) || (~ r)) && (s || (~ p) || q)). 8 | -------------------------------------------------------------------------------- /examples/tla/fsm2.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "fsm.zf". 4 | 5 | 6 | # S2 is reachable from 2 distinct states 7 | 8 | goal exists t1 t2. 9 | t1 != t2 && 10 | at_state t1 = S2 && 11 | at_state t2 = S2. 12 | -------------------------------------------------------------------------------- /examples/fool/neq_to_xor.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # FIXME: find a way to test this while avoiding trivial CNF… 4 | 5 | val a : prop. 6 | val b : prop. 7 | 8 | goal 9 | ((a && b) || (~ a && ~ b)) => 10 | (a = b). 11 | -------------------------------------------------------------------------------- /examples/ind/list14.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "nat.zf". 4 | include "list.zf". 5 | 6 | goal 7 | forall (X:nat). 8 | (forall (L:list). 9 | (forall (L2:list). ((mem X L) => (mem X (append L2 L))))). 10 | -------------------------------------------------------------------------------- /examples/ind/list6.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "nat.zf". 4 | include "list.zf". 5 | 6 | goal 7 | forall (N:nat). 8 | (forall (L:list). 9 | ((leq N (length L)) => ((append (take N L) (drop N L)) = L))). 10 | -------------------------------------------------------------------------------- /examples/ind/nat2.p: -------------------------------------------------------------------------------- 1 | 2 | % commutativity 3 | 4 | include('nat.ax'). 5 | 6 | % helper 7 | %tff(yolo, axiom, ![X:nat, Y:nat]: plus(X,s(Y)) = s(plus(X,Y))). 8 | 9 | tff(1, conjecture, ![X:nat, Y:nat]: plus(X,Y)=plus(Y,X)). 10 | -------------------------------------------------------------------------------- /examples/ind/nat4.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | val double : nat -> nat. 4 | assert forall (X:nat). ((double (s X)) = (s (s (double X)))). 5 | assert (double z) = z. 6 | goal forall (X:nat). ((double X) = (plus X X)). 7 | -------------------------------------------------------------------------------- /examples/modulo5bis.p: -------------------------------------------------------------------------------- 1 | 2 | % Gauss theorem 3 | 4 | tff(ty_a, type, a : $int). 5 | tff(1, axiom, $remainder_e(a, 1024) = 0). 6 | tff(2, axiom, $remainder_e(a, 243) = 0). % 3^5 7 | tff(the, conjecture, $remainder_e(a, 248832) = 0). 8 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb59.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val g : term -> term. 4 | val f : term -> prop. 5 | assert forall (X:term). ((f X) <=> (~ (f (g X)))). 6 | goal exists (X:term). ((~ (f (g X))) && (f X)). 7 | -------------------------------------------------------------------------------- /src/arbitrary/logtk_arbitrary.mld: -------------------------------------------------------------------------------- 1 | 2 | Logtk_arbitrary contains random generators for terms, clauses, formulas. These 3 | are to be used in property tests (see {b qcheck}) or perhaps benchmarks. 4 | 5 | {!modules: Logtk_arbitrary} 6 | -------------------------------------------------------------------------------- /src/demo/resolution/dune: -------------------------------------------------------------------------------- 1 | 2 | (executable 3 | (name resolution1) 4 | (flags :standard -warn-error -a+8) 5 | (modes native) 6 | (promote (until-clean) (into ../../..)) 7 | (libraries logtk logtk.parsers containers iter)) 8 | 9 | -------------------------------------------------------------------------------- /examples/fool/test_param_var.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val a : prop. 5 | val b : prop. 6 | 7 | goal 8 | ( (forall P. (a != P || P)) && 9 | (forall P. (b != P || ~ P)) && 10 | (a=b) ) 11 | => false. 12 | 13 | -------------------------------------------------------------------------------- /examples/ho/leo_ex_1.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # example 1 from "extensional higher order resolution" 5 | 6 | val a : prop. 7 | val b : prop. 8 | 9 | goal 10 | (a <=> b) => 11 | (forall P. P a => P b). 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/ind/list6.p: -------------------------------------------------------------------------------- 1 | 2 | include('list.ax'). 3 | include('nat.ax'). 4 | 5 | % N <= length(L) => take N L @ drop N L = L 6 | 7 | tff(the, conjecture, ![N:nat, L:list]: 8 | (leq(N, length(L)) => append(take(N,L), drop(N,L)) = L)). 9 | -------------------------------------------------------------------------------- /examples/ind/nat2_easy.p: -------------------------------------------------------------------------------- 1 | 2 | % commutativity 3 | 4 | include('nat.ax'). 5 | 6 | % helper 7 | tff(yolo, axiom, ![X:nat, Y:nat]: plus(X,s(Y)) = s(plus(X,Y))). 8 | 9 | tff(1, conjecture, ![X:nat, Y:nat]: plus(X,Y)=plus(Y,X)). 10 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb35.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val p : term -> term -> prop. 4 | goal 5 | exists (X:term). 6 | (exists (Y:term). 7 | ((p X Y) => (forall (X:term). (forall (Y:term). (p X Y))))). 8 | -------------------------------------------------------------------------------- /src/solving/dune: -------------------------------------------------------------------------------- 1 | 2 | (library 3 | (name logtk_solving) 4 | (public_name logtk.solving) 5 | (synopsis "solving constraints") 6 | (optional) 7 | (libraries containers logtk msat msat.tseitin iter) 8 | (flags :standard -w -32)) 9 | -------------------------------------------------------------------------------- /examples/ho/unif1.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val i : type. 5 | 6 | val f : i -> i -> i. 7 | val g : i -> i. 8 | val a : i. 9 | val b : i. 10 | 11 | goal exists F. 12 | F a = f a (g a) && 13 | F b = f b (g b). 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/ho/unif2.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val i : type. 5 | 6 | val f : i -> i -> i. 7 | val g : i -> i. 8 | val a : i. 9 | val b : i. 10 | 11 | goal exists F. 12 | F a = f (g a) a && 13 | F b = f (g b) b. 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/ind/list7_easy2.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "nat.zf". 4 | include "list.zf". 5 | 6 | # NOTE: lemmas 7 | lemma forall L X. rev (append L (cons X nil)) = cons X (rev L). 8 | 9 | goal forall (L:list). rev (rev L) = L. 10 | -------------------------------------------------------------------------------- /examples/ind/tree1.p: -------------------------------------------------------------------------------- 1 | 2 | include('tree.ax'). 3 | 4 | tff(0, axiom, ![X]: q(X)). 5 | tff(1, axiom, ![X:tree, Y:tree, Z]: ((p(X) & p(Y) & q(Z)) => p(node(X,Z,Y)))). 6 | tff(2, axiom, p(empty)). 7 | 8 | tff(the, conjecture, ![X:tree]: p(X)). 9 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb21.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val f : term -> prop. 4 | val p : prop. 5 | assert exists (X:term). (p => (f X)). 6 | assert exists (X:term). ((f X) => p). 7 | goal exists (X:term). (p <=> (f X)). 8 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb29.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ? [X] : f(X) & ? [X] : g(X)). 3 | 4 | fof(goal, conjecture, 5 | ( ! [X] : (f(X) => h(X)) & 6 | ! [X] : (g(X) => j(X))) <=> 7 | ( ! [X,Y] : ((f(X) & g(Y)) => (h(X) & j(Y)))) 8 | ). 9 | -------------------------------------------------------------------------------- /src/core/Multisets.ml: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Several Multisets} *) 5 | 6 | module MT = Multiset.Make(Term) 7 | 8 | module MMT = Multiset.Make(MT) 9 | -------------------------------------------------------------------------------- /doc/example.zf: -------------------------------------------------------------------------------- 1 | val i : type. 2 | val a : i. 3 | 4 | val f : i -> i. # a function 5 | val p : i -> i -> prop. # a binary predicate 6 | 7 | assert forall x y. p x y => p y x. 8 | assert p a (f a). 9 | 10 | goal exists (x:i). p (f x) x. 11 | -------------------------------------------------------------------------------- /examples/ac.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val term : type. 5 | val[infix "·", AC] f : term -> term -> term. 6 | val d : term. 7 | val c : term. 8 | val b : term. 9 | val a : term. 10 | goal (f (f (f a b) c) d) = (f b (f d (f a c))). 11 | -------------------------------------------------------------------------------- /examples/ind/list4.p: -------------------------------------------------------------------------------- 1 | 2 | include('list.ax'). 3 | include('nat.ax'). 4 | 5 | % count X L1 + count X L2 = count X (L1 @ L2) 6 | 7 | tff(the, conjecture, ![X:nat, L1:list, L2:list]: 8 | plus(count(X,L1), count(X,L2)) = count(X,append(L1,L2))). 9 | -------------------------------------------------------------------------------- /examples/ind/nat20.p: -------------------------------------------------------------------------------- 1 | tff(nat_ind, type, nat : $tType, inductive(s, z)). 2 | 3 | tff(ty_s, type, s:nat > nat). 4 | tff(ty_z, type, z:nat). 5 | tff(ty_plus, type, plus : (nat*nat) > nat). 6 | 7 | 8 | tff(the, conjecture, ![X:nat]: (X != s(X))). 9 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb31.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ~ ? [X] : (f(X) & (g(X) | h(X)))). 3 | 4 | fof(ax2, axiom, ? [X] : (i(X) & f(X))). 5 | 6 | fof(ax3, axiom, ! [X] : (~ h(X) => j(X))). 7 | 8 | fof(goal, conjecture, ? [X] : (i(X) & j(X))). 9 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb48.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val d : term. 4 | val c : term. 5 | val b : term. 6 | val a : term. 7 | assert (c = d) || (a = b). 8 | assert (b = d) || (a = c). 9 | goal (b = c) || (a = d). 10 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb57.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, f(g(a,b), g(b,c))). 3 | 4 | fof(ax2, axiom, f(g(b,c), g(a,c))). 5 | 6 | fof(transitivity, axiom, ! [X,Y,Z] : ((f(X,Y) & f(Y,Z)) => f(X,Z))). 7 | 8 | fof(goal, conjecture, f(g(a,b), g(a,c))). 9 | -------------------------------------------------------------------------------- /examples/tla/fsm3.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "fsm.zf". 4 | 5 | # there are two timestamps t1, t1+t2, where state = S2 6 | 7 | goal exists t1 t2. 8 | t2 != Now && 9 | at_state t1 = S2 && 10 | at_state (add_time t2 t1) = S2. 11 | -------------------------------------------------------------------------------- /examples/ind/nat16.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | val p : nat -> prop. 4 | val q : nat -> prop. 5 | assert (q z) || (p z). 6 | assert forall (N:nat). (((q N) || (p N)) => ((q (s N)) || (p (s N)))). 7 | goal forall (N:nat). ((q N) || (p N)). 8 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb19.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val q : term -> prop. 4 | val p : term -> prop. 5 | goal 6 | exists (X:term). 7 | (forall (Y:term). 8 | (forall (Z:term). (((p Y) => (q Z)) => ((p X) => (q X))))). 9 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb26.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ? [X] : p(X) <=> ? [X] : q(X)). 3 | 4 | fof(ax2, axiom, ! [X,Y] : 5 | ((p(X) & q(Y)) => (r(X) <=> s(Y)))). 6 | 7 | fof(goal, conjecture, ! [X] : (p(X) => r(X)) <=> 8 | ! [X] : (q(X) => s(X))). 9 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb42.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val f : term -> term -> prop. 4 | goal 5 | ~ 6 | (exists (Y:term). 7 | (forall (X:term). 8 | ((f X Y) <=> (~ (exists (Z:term). ((f Z X) && (f X Z))))))). 9 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb50.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val a : term. 4 | val f : term -> term -> prop. 5 | goal 6 | (forall (X:term). ((forall (Y:term). (f X Y)) || (f a X))) 7 | => (exists (X:term). (forall (Y:term). (f X Y))). 8 | -------------------------------------------------------------------------------- /examples/regression/undeclared.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: error 3 | 4 | # undeclared identifiers should fail 5 | 6 | goal forall (a b : type) (p : set (tup a b)) (y : (tup a b)) (x : a). 7 | mem _ y p && x = fst _ _ y => mem _ (pair _ _ x (snd _ _ y)) p. 8 | -------------------------------------------------------------------------------- /src/main/dune: -------------------------------------------------------------------------------- 1 | ; main binary 2 | (executable 3 | (name zipperposition) 4 | (package zipperposition) 5 | (public_name zipperposition) 6 | (promote (until-clean) (into ../..)) 7 | (modes native) 8 | (libraries logtk libzipperposition.phases)) 9 | -------------------------------------------------------------------------------- /src/proofs/dune: -------------------------------------------------------------------------------- 1 | 2 | (library 3 | (name logtk_proofs) 4 | (public_name logtk.proofs) 5 | (synopsis "proofs for logtk") 6 | (libraries containers logtk logtk.arith) 7 | (flags :standard -w -32 -open Logtk_arith) 8 | ) 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /examples/fool/test_param.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val f : prop -> prop -> prop. 5 | 6 | val a : prop. 7 | val b : prop. 8 | val not_b : prop. 9 | 10 | assert (b <=> ~not_b). 11 | 12 | goal f a a => (f b b || f not_b not_b). 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/ho/unif3.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val i : type. 5 | 6 | val f : i -> i -> i. 7 | val g : i -> i. 8 | val a : i. 9 | val b : i. 10 | 11 | goal exists F. 12 | F (g a) = g (f (g (g a)) a) && 13 | F b = g (f (g b) a). 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/ind/nat11_easy.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | 4 | lemma forall X. minus X z = X. 5 | lemma forall X. plus X z = X. 6 | lemma forall X Y. plus X (s Y) = s (plus X Y). 7 | 8 | goal forall (X:nat). forall (Y:nat). minus (plus X Y) Y = X. 9 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb58.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val g : term -> term. 4 | val f : term -> term. 5 | assert forall (X:term). (forall (Y:term). ((f X) = (g Y))). 6 | goal forall (X:term). (forall (Y:term). ((f (f X)) = (f (g Y)))). 7 | -------------------------------------------------------------------------------- /examples/simple_case.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val term : type. 5 | val p : term -> prop. 6 | val a : term. 7 | val b : term. 8 | 9 | assert p a. 10 | assert p b. 11 | assert forall x. x = a || x = b. 12 | 13 | goal forall x. p x. 14 | 15 | -------------------------------------------------------------------------------- /src/core/Multiset.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Logtk. See file "license" for more details. *) 3 | 4 | (** {1 Generic multisets} *) 5 | 6 | module type S = Multiset_intf.S 7 | 8 | module Make(X : Map.OrderedType) : S with type elt = X.t 9 | -------------------------------------------------------------------------------- /examples/fool/if_eq.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | val term : type. 4 | val a : term. 5 | val b : term. 6 | 7 | assert a != b. 8 | 9 | def f : term -> term where 10 | forall x. f x = (if x=a then f b else x). 11 | 12 | goal forall x. f x != a. 13 | 14 | -------------------------------------------------------------------------------- /examples/ind/list4.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | include "list.zf". 4 | 5 | goal 6 | forall (X:nat). 7 | (forall (L1:list). 8 | (forall (L2:list). 9 | ((plus (count X L1) (count X L2)) = (count X (append L1 L2))))). 10 | -------------------------------------------------------------------------------- /examples/ind/nat21_easy.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # transitivity of geq 4 | # x>=y, y>=z -> x>=y 5 | 6 | include "nat.zf". 7 | 8 | # NOTE: helps 9 | lemma forall x. leq x z => x=z. 10 | 11 | goal forall x y z. (leq x y && leq y z => leq x z). 12 | 13 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb56.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val g : term -> term. 4 | val f : term -> prop. 5 | goal 6 | (forall (X:term). ((exists (Y:term). ((X = (g Y)) && (f Y))) => (f X))) 7 | <=> (forall (X:term). ((f X) => (f (g X)))). 8 | -------------------------------------------------------------------------------- /examples/ho/collect_or.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val set : type -> type. 5 | 6 | val collect: pi a. (a -> prop) -> set a. 7 | 8 | goal 9 | forall a (P Q: a -> prop). 10 | collect (fun x. P x || Q x) = 11 | collect (fun x. Q x || P x). 12 | 13 | -------------------------------------------------------------------------------- /examples/ind/list15.p: -------------------------------------------------------------------------------- 1 | 2 | % len (l1 @ l2) = len(l1) + len(l2) 3 | 4 | include('list.ax'). 5 | include('nat.ax'). 6 | 7 | tff(the, conjecture, 8 | ![L1:list, L2:list]: 9 | ( length(append(L1, L2)) = plus(length(L1), length(L2)) ) 10 | ). 11 | -------------------------------------------------------------------------------- /examples/ind/list9.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "nat.zf". 4 | include "list.zf". 5 | 6 | goal 7 | forall (L1:list). 8 | (forall (L2:list). 9 | (forall (L3:list). 10 | ((append (append L1 L2) L3) = (append L1 (append L2 L3))))). 11 | -------------------------------------------------------------------------------- /src/core/PrefWeight.mli: -------------------------------------------------------------------------------- 1 | 2 | module type S = sig 3 | val insert_term : Term.t -> unit 4 | val calc_pref_weight : Term.t -> int 5 | end 6 | 7 | module Make(PARAMETERS : sig 8 | val match_weight : float 9 | val miss_weight : float 10 | end) : S 11 | -------------------------------------------------------------------------------- /src/prover_calculi/avatar/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name libzipperposition_avatar) 3 | (public_name libzipperposition.avatar) 4 | (synopsis "Avatar calculus for the Zipperposition theorem prover") 5 | (libraries libzipperposition) 6 | (flags :standard -w -32) 7 | ) 8 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb32.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ! [X] : ((f(X) & (g(X) | h(X))) => i(X))). 3 | 4 | fof(ax2, axiom, ! [X] : ((i(X) & h(X)) => j(X))). 5 | 6 | fof(ax3, axiom, ! [X] : (k(X) => h(X))). 7 | 8 | fof(goal, conjecture, ! [X] : ((f(X) & k(X)) => j(X))). 9 | -------------------------------------------------------------------------------- /src/arbitrary/dune: -------------------------------------------------------------------------------- 1 | 2 | ; main lib 3 | (library 4 | (name logtk_arbitrary) 5 | (public_name logtk.arbitrary) 6 | (synopsis "random generators for logtk") 7 | (optional) 8 | (libraries containers logtk qcheck-core iter) 9 | ) 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/by_case.p: -------------------------------------------------------------------------------- 1 | 2 | % thanks to Andrei and Jean-Christophe for this simple example 3 | 4 | tff(0, type, p : $int > $o). 5 | tff(1, axiom, p(0) & p(1)). 6 | tff(2, conjecture, 7 | ![X:$int]: 8 | (($lesseq(0,X) & 9 | $lesseq(X,1)) => 10 | p(X))). 11 | -------------------------------------------------------------------------------- /examples/ho/weird_ineq.p: -------------------------------------------------------------------------------- 1 | 2 | % expect: sat 3 | 4 | % example from Martin 5 | 6 | thf(a1,axiom, ?[X:$i>$o] : ?[Y:$i>$o] : ?[Z:$i>$o] : 7 | ~ (![U:($i>$o)>$o] : ((U@X) => (U@Y))) ). 8 | 9 | thf(c1,conjecture,?[X:$i>$o]: ?[A:$i] : ?[B:$i] : ((X @ A) & ~(X @ B)) ). 10 | -------------------------------------------------------------------------------- /examples/modulo1.p: -------------------------------------------------------------------------------- 1 | 2 | % 2 a + 2 mod 3 = 0 ==> a +1 mod 3 = 0 ==> a mod 3 = 2 3 | % slightly harder variation on modulo3.p 4 | 5 | tff(ty_a, type, a : $int). 6 | tff(1, axiom, $remainder_e($sum($product(a, 2), +2), 3) = 0). 7 | tff(the, conjecture, $remainder_e(a, 3) = 2). 8 | -------------------------------------------------------------------------------- /examples/ind/list10.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "list.zf". 4 | 5 | def[prefix "Σ"] sum : list -> nat where 6 | (sum nil) = z; 7 | forall (N:nat). (forall (L:list). ((sum (cons N L)) = (plus N (sum L)))). 8 | 9 | goal forall (L:list). ((sum (rev L)) = (sum L)). 10 | -------------------------------------------------------------------------------- /examples/ind/list16_easy.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # P(len(x)) => P(len(rev x)) 5 | 6 | include "list.zf". 7 | 8 | val p : nat -> prop. 9 | 10 | lemma forall x. length x = length (rev x). 11 | 12 | goal forall x. p (length x) => p (length (rev x)). 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/ind/nat6.p: -------------------------------------------------------------------------------- 1 | 2 | % Kersani & Peltier 3 | 4 | include('nat.ax'). 5 | 6 | tff(ty_p, type, p : (nat * $i) > $o). 7 | 8 | tff(1, axiom, ![N:nat, X:$i]: (p(N,X) => p(s(N), f(X)))). 9 | tff(2, axiom, p(z, a)). 10 | 11 | tff(the, conjecture, ![N:nat]: ?[X:$i]: p(N,X)). 12 | -------------------------------------------------------------------------------- /examples/ind/nat6.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | val p : nat -> term -> prop. 4 | val f : term -> term. 5 | assert forall (N:nat). (forall (X:term). ((p N X) => (p (s N) (f X)))). 6 | val a : term. 7 | assert p z a. 8 | goal forall (N:nat). (exists (X:term). (p N X)). 9 | -------------------------------------------------------------------------------- /examples/regression/typing.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: sat 3 | 4 | val set : type -> type. 5 | val mem : pi a. a -> set a -> prop. 6 | val pow : pi a. set a -> set (set a). 7 | 8 | rewrite 9 | forall a S T. 10 | mem (set a) S (pow a T) <=> (forall x. (mem a x S) => (mem a x T)). 11 | -------------------------------------------------------------------------------- /src/prover_calculi/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name libzipperposition_calculi) 3 | (public_name libzipperposition.calculi) 4 | (synopsis "calculi for the Zipperposition theorem prover") 5 | (libraries libzipperposition libzipperposition.avatar) 6 | (flags :standard -w -32) 7 | ) 8 | -------------------------------------------------------------------------------- /src/test_must_pass.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ZIPPER=$1 3 | set -e 4 | while read i ; do 5 | echo "must pass: ../$i"; 6 | (${ZIPPER} ../${i} -t 5 -o none | grep "SZS status Theorem" > /dev/null) \ 7 | || (echo "must-pass failed on ${i}" && exit 1) 8 | done < "../examples/must_pass.txt" 9 | -------------------------------------------------------------------------------- /examples/chaining1.p: -------------------------------------------------------------------------------- 1 | 2 | tff(t1, type, a : $int). 3 | tff(t2, type, b : $int). 4 | tff(t3, type, c : $int). 5 | tff(t4, type, d : $int). 6 | 7 | tff(1, axiom, $less(a, b)). 8 | tff(2, axiom, $less(b, c)). 9 | tff(3, axiom, $less(c, d)). 10 | tff(4, conjecture, $less(a, d)). 11 | -------------------------------------------------------------------------------- /examples/ind/nat15.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | 4 | def odd : nat -> prop where 5 | forall N. odd (s N) = even N 6 | and even : nat -> prop where 7 | even z = true; 8 | forall (N:nat). even (s N) = odd N. 9 | 10 | goal forall (N:nat). even (plus N N). 11 | -------------------------------------------------------------------------------- /src/core/arith/dune: -------------------------------------------------------------------------------- 1 | 2 | (library 3 | (name logtk_arith) 4 | (public_name logtk.arith) 5 | (libraries 6 | (select logtk_arith.ml from 7 | (zarith -> logtk_arith.zarith.ml) 8 | (num -> logtk_arith.num.ml))) 9 | (flags :standard -warn-error -a+8) 10 | ) 11 | -------------------------------------------------------------------------------- /src/prover_calculi/libzipperposition_calculi.mld: -------------------------------------------------------------------------------- 1 | 2 | Superposition calculus (in {!Libzipperposition_calculi.Superposition}) 3 | and other calculi for Zipperposition. A calculus is a set of inference rules 4 | and simplification rules. 5 | 6 | {!modules: Libzipperposition_calculi} 7 | 8 | -------------------------------------------------------------------------------- /examples/ho/leo_ex_5.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # example 5 from "extensional higher order resolution" 5 | 6 | val i : type. 7 | 8 | val m : i -> i. 9 | val n : i -> i. 10 | 11 | goal 12 | (forall x P. P (m x) => P (n x)) => 13 | (forall Q. Q m => Q n). 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb34.p: -------------------------------------------------------------------------------- 1 | 2 | % Andrew`s Challenge 3 | 4 | fof(goal, conjecture, 5 | ((? [X] : ! [Y] : (p(X) <=> p(Y))) <=> 6 | ((? [X] : q(X)) <=> ! [Y] : p(Y))) 7 | <=> 8 | ((? [X] : ! [Y] : (q(X) <=> q(Y))) <=> 9 | ((? [X] : p(X)) <=> ! [Y] : q(Y))) 10 | ). 11 | -------------------------------------------------------------------------------- /examples/pelletier_problems/equivalence.p: -------------------------------------------------------------------------------- 1 | % example problem in the paper "delayed equivalence reasoning in superposition" 2 | 3 | fof(a1, axiom, ![A,B]: (equ(A, B) <=> ![C]: (contains(A, C) <=> contains(B, C)))). 4 | 5 | fof(goal, conjecture, ! [A, B, C]: ((equ(C, B) & equ(B, A)) => equ(C, A))). 6 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb41.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val f : term -> term -> prop. 4 | assert 5 | forall (Z:term). 6 | (exists (Y:term). 7 | (forall (X:term). ((f X Y) <=> ((~ (f X X)) && (f X Z))))). 8 | goal ~ (exists (Z:term). (forall (X:term). (f X Z))). 9 | -------------------------------------------------------------------------------- /examples/tla/time.zf: -------------------------------------------------------------------------------- 1 | # expect: sat 2 | 3 | # axioms 4 | 5 | data time := 6 | | Now 7 | | Later time. 8 | 9 | # addition 10 | val add_time : time -> time -> time. 11 | rewrite forall t. add_time Now t = t. 12 | rewrite forall t1 t2. add_time (Later t1) t2 = Later (add_time t1 t2). 13 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb36.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ! [X] : ? [Y] : f(X,Y)). 3 | 4 | fof(ax2, axiom, ! [X] : ? [Y] : g(X,Y)). 5 | 6 | fof(ax3, axiom, ! [X,Y] : ((f(X,Y) | g(X,Y)) => 7 | ! [Z] : ((f(Y,Z) | g(Y,Z)) => h(X,Z)))). 8 | 9 | fof(goal, conjecture, ! [X] : ? [Y] : h(X,Y)). 10 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb60.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val g : term -> term. 4 | val f : term -> term -> prop. 5 | goal 6 | forall (X:term). 7 | ((f X (g X)) 8 | <=> (exists (Y:term). 9 | ((f X Y) && (forall (Z:term). ((f Z Y) => (f Z (g X))))))). 10 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb68.p: -------------------------------------------------------------------------------- 1 | 2 | % hard one! 3 | 4 | include('ax_logic_a.ax'). 5 | include('ax_logic_b.ax'). 6 | 7 | fof(ax_logic_c_bis, axiom, ! [X,Y] : t(i(i(Y,X),i(n(X),n(Y))))). 8 | 9 | include('ax_logic_d.ax'). 10 | 11 | fof(goal, conjecture, ! [X] : t(i(X,n(n(X))))). 12 | 13 | -------------------------------------------------------------------------------- /examples/tla/fsm4.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "fsm.zf". 4 | 5 | # liveness: forall t where state=S2, there is a later t' + t where state=S2 again 6 | 7 | goal 8 | forall t1. 9 | at_state t1 = S2 => 10 | (exists t2. 11 | t2 != Now && 12 | at_state (add_time t2 t1) = S2). 13 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb40.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val f : term -> term -> prop. 4 | goal 5 | (exists (Y:term). (forall (X:term). ((f X Y) <=> (f X X)))) 6 | => (~ 7 | (forall (X:term). 8 | (exists (Y:term). (forall (Z:term). ((f X Y) <=> (~ (f Z X))))))). 9 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb44.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ! [X] : 3 | (f(X) => ( 4 | (? [Y] : (g(Y) & h(X,Y))) & 5 | (? [Y] : (g(Y) & ~ h(X,Y)))) 6 | ) 7 | ). 8 | 9 | fof(ax2, axiom, ? [X] : (j(X) & ! [Y] : (g(Y) => h(X,Y)))). 10 | 11 | fof(goal, conjecture, ? [X] : (j(X) & ~ f(X))). 12 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb62.p: -------------------------------------------------------------------------------- 1 | 2 | % not a theorem (SPASS finds a completion) 3 | % expect: sat 4 | 5 | fof(goal, conjecture, 6 | (f(a) & ! [X] : (f(X) => f(g(X)))) 7 | <=> 8 | ! [X] : ( 9 | (~ f(a) | f(X) | f(g(g(X)))) & 10 | (~ f(a) | ~ f(g(X)) | f(g(g(X)))) 11 | ) 12 | ). 13 | -------------------------------------------------------------------------------- /examples/regression/ho_pos.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # positions should be stable under substitution 5 | 6 | val i : type. 7 | 8 | val a : i. 9 | val f : i -> i -> i. 10 | val g : i -> i . 11 | 12 | assert (forall X. X (g (X a)) = a). 13 | assert f a a = a. 14 | 15 | goal f a (g a) = a. 16 | -------------------------------------------------------------------------------- /examples/ho/leo_ex_4.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # example 4 from "extensional higher order resolution" 5 | 6 | val i : type. 7 | 8 | val m : i -> i. 9 | val n : i -> i. 10 | 11 | goal 12 | (forall P x. P (m x) => P (n x)) => 13 | (forall Q. Q (fun x. m x) => Q (fun y. n y)). 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/ho/neg_eq_unit.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # some extensionality here 5 | 6 | val i : type. 7 | 8 | data unit := U. 9 | 10 | val f : unit -> i. 11 | val g : unit -> i. 12 | 13 | assert f = g. 14 | 15 | val map : i -> i. 16 | 17 | goal forall x y. map (f x) = map (g y). 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/ind/list13.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | # NOTE: requires --induction-depth 1, and a change to the definition of mem 3 | 4 | include "nat.zf". 5 | include "list.zf". 6 | 7 | goal 8 | forall (X:nat). 9 | (forall (L:list). 10 | (forall (L2:list). ((mem X L) => (mem X (append L L2))))). 11 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb49.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | assert exists (X:term). (exists (Y:term). (forall (Z:term). ((Y = Z) || (X = Z)))). 4 | val b : term. 5 | val a : term. 6 | val p : term -> prop. 7 | assert (p b) && (p a). 8 | assert a != b. 9 | goal forall (X:term). (p X). 10 | -------------------------------------------------------------------------------- /tests/test_theory_detect.p: -------------------------------------------------------------------------------- 1 | 2 | 3 | % looks like associativity? 4 | 5 | tff(a, axiom, ![X]: f(X,f(X,X)) = f(f(X,X),X)). % wrong! 6 | 7 | tff(b, axiom, ![Z,Y,X]: g(X,g(Y,Z)) = g(g(X,Y),Z)). 8 | 9 | tff(c, axiom, ![Z,Y,X]: h(h(X,Y),Z) = h(X,h(Y,Z))). 10 | 11 | tff(d, axiom, ![Y,X]: h(X,Y) = h(Y,X)). 12 | -------------------------------------------------------------------------------- /examples/data/find_bigger1.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # find an integer whose factorial is bigger than some bound 4 | 5 | include "fact_ax.zf". 6 | 7 | def three : nat := S (S (S Z)). 8 | 9 | # bound: 6 10 | def bound : nat := plus three three. 11 | 12 | goal exists n. leq bound (fact n). 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/core/SolidUnif.mli: -------------------------------------------------------------------------------- 1 | module T = Term 2 | module US = Unif_subst 3 | 4 | module Make(S : sig val st : Flex_state.t end): 5 | sig 6 | val solidify : ?limit:bool -> ?exception_on_error:bool -> T.t -> T.t 7 | val unify_scoped : ?subst:US.t -> ?counter:int ref -> 8 | T.t Scoped.t -> T.t Scoped.t -> US.t list 9 | end -------------------------------------------------------------------------------- /examples/pelletier_problems/pb24.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ~ ? [X] : (s(X) & q(X))). 3 | 4 | fof(ax2, axiom, ! [X] : (p(X) => (q(X) | r(X)))). 5 | 6 | fof(ax3, axiom, (~ (? [X] : p(X))) => ? [X] : q(X)). 7 | 8 | fof(ax4, axiom, ! [X] : ((q(X) | r(X)) => s(X))). 9 | 10 | fof(goal, conjecture, ? [X] : (p(X) & r(X))). 11 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb43.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val f : term -> term -> prop. 4 | val q : term -> term -> prop. 5 | assert 6 | forall (X:term). 7 | (forall (Y:term). ((q X Y) <=> (forall (Z:term). ((f Z X) <=> (f Z Y))))). 8 | goal forall (X:term). (forall (Y:term). ((q X Y) <=> (q Y X))). 9 | -------------------------------------------------------------------------------- /examples/ind/nat17.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | val term : type. 3 | data nat := z | s nat. 4 | val p : nat -> prop. 5 | val q : nat -> prop. 6 | assert p z. 7 | assert q z. 8 | assert forall (N:nat). (((q N) && (p N)) => (q (s N))). 9 | assert forall (N:nat). (((q N) && (p N)) => (p (s N))). 10 | goal forall (N:nat). (p N). 11 | -------------------------------------------------------------------------------- /examples/ind/tree4_easy.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | include "tree.zf". 5 | 6 | lemma 7 | forall L X R T. 8 | subtree (node L X R) T => 9 | subtree L T. 10 | 11 | goal 12 | forall (T1:tree). 13 | forall (T2:tree). 14 | forall (T3:tree). 15 | (subtree T2 T3 && subtree T1 T2) => subtree T1 T3. 16 | 17 | -------------------------------------------------------------------------------- /examples/by_case2_false.p: -------------------------------------------------------------------------------- 1 | 2 | % false version of by_case2 3 | 4 | tff(ty_a, type, a : $int). 5 | tff(ty_t, type, t : $int). 6 | tff(ty_p, type, p : $int > $o). 7 | 8 | tff(1, axiom, $lesseq(a, t)). 9 | tff(2, axiom, $lesseq(t, $sum(a,3))). 10 | tff(3, axiom, p(a) & p($sum(a,1)) & p($sum(a,2))). 11 | tff(4, conjecture, p(t)). 12 | -------------------------------------------------------------------------------- /examples/ho/neg_eq1.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # some extensionality here 5 | 6 | val i : type. 7 | 8 | val f : i -> i -> i. 9 | val g : i -> i -> i. 10 | 11 | val a : i. 12 | val b : i. 13 | 14 | val map : (i -> i) -> i. 15 | 16 | assert a = b. 17 | assert f = g. 18 | 19 | goal map (f a) = map (g b). 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/ind/nat15_def.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | 4 | # use definitions 5 | 6 | def odd : nat -> prop where 7 | odd (s z); 8 | forall (N:nat). odd (s N) = even N 9 | and even : nat -> prop where 10 | even z; 11 | forall (N:nat). even (s N) = odd N. 12 | 13 | goal forall (N:nat). even (plus N N). 14 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb25.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ? [X] : p(X)). 3 | 4 | fof(ax2, axiom, ! [X] : (f(X) => (~ g(X) & r(X)))). 5 | 6 | fof(ax3, axiom, ! [X] : (p(X) => (g(X) & f(X)))). 7 | 8 | fof(ax4, axiom, ! [X] : (p(X) => q(X)) | 9 | ? [X] : (p(X) & r(X))). 10 | 11 | fof(goal, conjecture, ? [X] : (q(X) & p(X))). 12 | -------------------------------------------------------------------------------- /examples/regression/overflow.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: error 3 | 4 | #goal forall (a b : type) (p : set (tup a b)) (y : (tup a b)). 5 | # mem _ y p => mem _ (pair _ _ (fst _ _ y) (snd _ _ y)) p. 6 | 7 | goal forall (a b : type) (p : set (tup a b)) (y : (tup a b)) (x : a). 8 | mem _ y p && x = fst _ _ y => mem _ (pair _ _ x (snd _ _ y)) p. 9 | -------------------------------------------------------------------------------- /src/prover_calculi/induction/dune: -------------------------------------------------------------------------------- 1 | 2 | (library 3 | (name libzipperposition_induction) 4 | (public_name libzipperposition.induction) 5 | (synopsis "Induction calculus for the Zipperposition theorem prover") 6 | (libraries libzipperposition libzipperposition.avatar logtk.arith) 7 | (flags :standard -w -32 -open Logtk_arith)) 8 | -------------------------------------------------------------------------------- /examples/ind/nat12_no_ax.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | val term : type. 3 | data nat := z | s nat. 4 | val p : nat -> prop. 5 | val q : nat -> prop. 6 | assert p z. 7 | assert q z. 8 | assert forall (N:nat). (((q N) && (p N)) => (q (s N))). 9 | assert forall (N:nat). (((q (s N)) && (p N)) => (p (s N))). 10 | goal forall (N:nat). (p N). 11 | -------------------------------------------------------------------------------- /examples/loop.p: -------------------------------------------------------------------------------- 1 | 2 | % typical loop invariant conservation property 3 | 4 | tff(ty1, type, k: $int). 5 | tff(ty2, type, p: $int > $o). 6 | 7 | tff(1, axiom, ![I: $int]: (($lesseq(0,I) & $lesseq(I,k)) => p(I))). 8 | tff(2, axiom, p($sum(k,1))). 9 | tff(3, conjecture, ![I: $int]: (($lesseq(0,I) & $lesseq(I,$sum(k,1))) => p(I))). 10 | -------------------------------------------------------------------------------- /utils/profile.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | perf record --call-graph=dwarf $@ 4 | 5 | perf script \ 6 | | stackcollapse-perf --kernel \ 7 | | sed 's/caml//g; 8 | s/Libzipperposition_prover//g; 9 | s/Libzipperposition_core//g; 10 | s/Libzipperposition__//g' \ 11 | | flamegraph > perf.svg 12 | 13 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb27.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ? [X] : (f(X) & ~ g(X))). 3 | 4 | fof(ax2, axiom, ! [X] : (f(X) => h(X))). 5 | 6 | fof(ax3, axiom, ! [X] : ((j(X) & i(X)) => f(X))). 7 | 8 | fof(ax4, axiom, ? [X] : (h(X) & ~ g(X)) => 9 | ! [X] : (i(X) => ~ h(X))). 10 | 11 | fof(goal, conjecture, ! [X] : (j(X) => ~ i(X))). 12 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb33.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val c : term. 4 | val b : term. 5 | val a : term. 6 | val p : term -> prop. 7 | goal 8 | (forall (X:term). ((((p X) => (p b)) && (p a)) => (p c))) 9 | <=> (forall (X:term). 10 | (((p c) || (~ (p a)) || (~ (p b))) && ((p c) || (~ (p a)) || (p X)))). 11 | -------------------------------------------------------------------------------- /src/prover_phases/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name libzipperposition_phases) 3 | (public_name libzipperposition.phases) 4 | (synopsis "main for the Zipperposition theorem prover") 5 | (libraries libzipperposition libzipperposition.calculi 6 | libzipperposition.avatar libzipperposition.induction) 7 | (flags :standard -w -32) 8 | ) 9 | -------------------------------------------------------------------------------- /examples/data/plus.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # Example for exercizing `data` 4 | # Here, 2+2=4 5 | 6 | data nat := 7 | | Z 8 | | S nat. 9 | 10 | val plus : nat -> nat -> nat. 11 | 12 | assert forall x. plus Z x = x. 13 | assert forall x y. plus (S x) y = S (plus x y). 14 | 15 | goal plus (S (S Z)) (S (S Z)) = S (S (S (S Z))). 16 | 17 | -------------------------------------------------------------------------------- /examples/ho/unif4_easy.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val i : type. 5 | 6 | val map : (i -> i) -> i. 7 | 8 | val f : i -> i. 9 | val g : i -> i. 10 | 11 | val a : i. 12 | val b : i. 13 | 14 | assert a != b. 15 | assert f != g. 16 | 17 | goal exists (F:(i->i)->i->i). 18 | F f a = f (f a) && 19 | F g b = g (g b). 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /examples/int_nat4_arith.p: -------------------------------------------------------------------------------- 1 | % encoding ind/nat4.p into arith 2 | 3 | tff(ty_double, type, double : $int > $int). 4 | 5 | tff(double1, axiom, ![X:$int]: ($greater(X, 0) => double($sum(1,X)) = $sum(2, double(X)))). 6 | tff(double2, axiom, double(0) = 0). 7 | 8 | tff(the, conjecture, 9 | ![X:$int]: ($greatereq(X,0) => double(X) = $sum(X,X))). 10 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb30.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val h : term -> prop. 4 | val g : term -> prop. 5 | val f : term -> prop. 6 | assert forall (X:term). (((g X) || (f X)) => (~ (h X))). 7 | val i : term -> prop. 8 | assert forall (X:term). (((g X) => (~ (i X))) => ((h X) && (f X))). 9 | goal forall (X:term). (i X). 10 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb54.p: -------------------------------------------------------------------------------- 1 | 2 | 3 | % not theorem, bad retranscription? 4 | 5 | fof(ax1, axiom, ! [Y] : ? [Z] : ! [X] : (f(X,Z) <=> X = Y)). 6 | 7 | fof(goal, conjecture, ~ ( 8 | ? [W] : ! [X] : ( 9 | f(X,W) <=> (! [U] : ( 10 | f(X,U) => (? [Y] : (f(Y,U) & ~ (? [Z] : (f(X,U) & f(Z,Y))))) 11 | )) 12 | ) 13 | )). 14 | -------------------------------------------------------------------------------- /portfolio/fo/fo10.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # $1: File name 4 | # $2: Extra options 5 | 6 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 7 | 8 | ulimit -t $2 9 | 10 | $DIR/../zipperposition ${1:+"$1"} \ 11 | --timeout "$2" --avatar=off --mode=fo-complete-basic \ 12 | -i tptp \ 13 | -o tptp \ 14 | "${@:3}" 15 | -------------------------------------------------------------------------------- /examples/by_case2.p: -------------------------------------------------------------------------------- 1 | 2 | % let's try to make a more interesting case analysis 3 | 4 | tff(ty_a, type, a : $int). 5 | tff(ty_t, type, t : $int). 6 | tff(ty_p, type, p : $int > $o). 7 | 8 | tff(1, axiom, $lesseq(a, t)). 9 | tff(2, axiom, $lesseq(t, $sum(a,2))). 10 | tff(3, axiom, p(a) & p($sum(a,1)) & p($sum(a,2))). 11 | tff(4, conjecture, p(t)). 12 | -------------------------------------------------------------------------------- /examples/data/find_bigger2.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # find an integer whose factorial is bigger than some bound 4 | 5 | include "fact_ax.zf". 6 | 7 | def three : nat := S (S (S Z)). 8 | def ten : nat := S (mult three three). 9 | 10 | # bound: 100 11 | def bound : nat := mult ten ten. 12 | 13 | goal exists n. leq bound (fact n). 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/fun_ext.zf: -------------------------------------------------------------------------------- 1 | 2 | val u : type. 3 | 4 | # type of cardinality one 5 | assert forall (x y : u). x = y. 6 | 7 | # functional update axiom 8 | assert forall (f: u->u) (d r : u). 9 | exists (g: u -> u). 10 | (forall x. g x = (if x = d then r else f x)). 11 | 12 | # goal: all functions are the same 13 | goal forall (a b: u -> u). a = b. 14 | -------------------------------------------------------------------------------- /examples/ind/tree1.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "tree.zf". 3 | 4 | val q : term -> prop. 5 | assert forall (X:term). (q X). 6 | val p : tree -> prop. 7 | assert 8 | forall (X:tree). 9 | (forall (Y:tree). 10 | (forall (Z:term). (((q Z) && (p X) && (p Y)) => (p (node X Z Y))))). 11 | assert p empty. 12 | goal forall (X:tree). (p X). 13 | -------------------------------------------------------------------------------- /old/data/rewriting/group.p: -------------------------------------------------------------------------------- 1 | mult X e --> X. 2 | mult e X --> X. 3 | mult X (inv X) --> e. 4 | mult (inv X) X --> e. 5 | inv e --> e. 6 | inv (inv X) --> X. 7 | inv (mult X Y) --> mult (inv Y) (inv X). 8 | mult (mult X Y) Z --> mult X (mult Y Z). 9 | mult X (mult (inv X) Y) --> Y. 10 | mult (inv X) (mult X Y) --> Y. 11 | 12 | % vim:syntax=prolog 13 | -------------------------------------------------------------------------------- /examples/chaining2.p: -------------------------------------------------------------------------------- 1 | 2 | tff(t1, type, a : $int). 3 | tff(t2, type, b : $int). 4 | tff(t3, type, c : $int). 5 | tff(t4, type, d : $int). 6 | tff(tf, type, (f : $int > $int)). 7 | 8 | tff(1, axiom, $less(f(a), f(b))). 9 | tff(2, axiom, $less(f(b), f(c))). 10 | tff(3, axiom, $less(f(c), f(d))). 11 | tff(4, conjecture, ?[X:$int]: $less(f(X), f(d))). 12 | -------------------------------------------------------------------------------- /examples/fun_update.zf: -------------------------------------------------------------------------------- 1 | 2 | val u : type. 3 | 4 | # type of cardinality >= 2 5 | assert exists (x y : u). x != y. 6 | 7 | # all functions are the same 8 | assert forall (a b: u -> u). a = b. 9 | 10 | # functional update axiom 11 | assert forall (f: u->u) (d r : u). 12 | exists (g: u -> u). 13 | (forall x. g x = (if x = d then r else f x)). 14 | -------------------------------------------------------------------------------- /examples/ind/list10.p: -------------------------------------------------------------------------------- 1 | 2 | % from paper on CVC4: sum(rev(L)) = sum(L) 3 | 4 | include('nat.ax'). 5 | include('list.ax'). 6 | 7 | tff(ty_sum, type, sum : list > nat). 8 | 9 | tff(sum1, axiom, sum(nil) = z). 10 | tff(sum2, axiom, ![N:nat, L:list]: sum(cons(N,L)) = plus(N, sum(L))). 11 | 12 | tff(the, conjecture, ![L:list]: sum(rev(L)) = sum(L)). 13 | -------------------------------------------------------------------------------- /examples/ind/list2.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "nat.zf". 4 | include "list.zf". 5 | 6 | val p : nat -> prop. 7 | val q : list -> prop. 8 | assert p z. 9 | assert forall (N:nat). ((p N) => (p (s N))). 10 | assert q nil. 11 | assert 12 | forall (N:nat). (forall (L:list). (((q L) && (p N)) => (q (cons N L)))). 13 | goal forall (L:list). (q L). 14 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb37.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ! [Z] : ? [W] : ! [X] : ? [Y] : 3 | ((p(X,Z) => p(Y,W)) & 4 | p(Y,Z) & 5 | (p(Y,W) => ? [U] : q(U,W)))). 6 | 7 | fof(ax2, axiom, ! [X,Z] : (~ p(X,Z) => ? [Y] : q(Y,Z))). 8 | 9 | fof(ax3, axiom, ? [X,Y] : q(X,Y) => ! [X] : r(X,X)). 10 | 11 | fof(goal, conjecture, ! [X] : ? [Y] : r(X,Y)). 12 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb53.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ? [X,Y] : ( 3 | X != Y & 4 | ! [Z] : (Z = X | Z = Y))). 5 | 6 | 7 | fof(goal, conjecture, 8 | (? [Z] : ! [X] : 9 | ((? [W] : ! [Y] : (f(X,Y) <=> Y = W)) 10 | <=> X = Z)) 11 | <=> 12 | (? [W] : ! [Y] : 13 | ((? [Z] : ! [X] : (f(X,Y) <=> X = Z)) 14 | <=> Y = W)) 15 | ). 16 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb62.zf: -------------------------------------------------------------------------------- 1 | # expect: SAT 2 | val term : type. 3 | val g : term -> term. 4 | val a : term. 5 | val f : term -> prop. 6 | goal 7 | ((forall (X:term). ((f X) => (f (g X)))) && (f a)) 8 | <=> (forall (X:term). 9 | (((f (g (g X))) || (~ (f a)) || (~ (f (g X)))) && 10 | ((f (g (g X))) || (~ (f a)) || (f X)))). 11 | -------------------------------------------------------------------------------- /examples/ind/list7_easy.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "nat.zf". 4 | include "list.zf". 5 | 6 | # NOTE: lemmas 7 | lemma forall L. append L nil = L. 8 | lemma forall L1 L2 L3. append L1 (append L2 L3) = append (append L1 L2) L3. 9 | lemma forall L1 L2. rev (append L1 L2) = append (rev L2) (rev L1). 10 | 11 | goal forall (L:list). rev (rev L) = L. 12 | -------------------------------------------------------------------------------- /examples/ind/nat4_easy.p: -------------------------------------------------------------------------------- 1 | 2 | include('nat.ax'). 3 | 4 | tff(ty_double, type, double : nat > nat). 5 | 6 | tff(helper, axiom, ![X:nat, Y:nat]: plus(X,s(Y)) = s(plus(X,Y))). 7 | 8 | tff(double1, axiom, ![X:nat]: double(s(X)) = s(s(double(X)))). 9 | tff(double2, axiom, double(z) = z). 10 | 11 | tff(the, conjecture, ![X:nat]: double(X) = plus(X,X)). 12 | 13 | -------------------------------------------------------------------------------- /examples/ind/nat4_easy.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | val double : nat -> nat. 4 | assert forall (X:nat). ((double (s X)) = (s (s (double X)))). 5 | assert (double z) = z. 6 | 7 | # NOTE: this lemma should help 8 | lemma forall (X:nat). (forall (Y:nat). ((plus X (s Y)) = (s (plus X Y)))). 9 | 10 | goal forall (X:nat). ((double X) = (plus X X)). 11 | -------------------------------------------------------------------------------- /examples/sep2.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # separation logic 5 | # SWW417-1.p 6 | 7 | include "sep_ax.zf". 8 | 9 | val x1:ptr. 10 | val x2:ptr. 11 | 12 | assert x1 != nil. 13 | 14 | assert x1 != x2. 15 | 16 | assert heap (sep (lseg x2 nil) (sep (next x1 x2) emp)). 17 | 18 | goal heap (sep (lseg x1 nil) emp). 19 | 20 | 21 | # separation logic 22 | 23 | -------------------------------------------------------------------------------- /examples/ho/unif5.p: -------------------------------------------------------------------------------- 1 | 2 | % expect: UNSAT 3 | 4 | % type declarations 5 | % constant type declarations 6 | thf(1, type, g: ($i > $i) > $i ). 7 | thf(2, type, f: $i > $i ). 8 | thf(3, type, p: $i > $o ). 9 | % sequents 10 | 11 | % formula: ∃x (p(x(g(f:i>i))) ⊃ p(f(g(x)))) 12 | thf(4, conjecture, (?[X : $i > $i] : (((p @ (X @ (g @ f))) => (p @ (f @ (g @ X)))))) ). 13 | -------------------------------------------------------------------------------- /examples/ind/nat26.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # ack(m,n) > 0 5 | 6 | include "nat.zf". 7 | 8 | def ack : nat -> nat -> nat where 9 | forall m. ack z m = s m; 10 | forall n m. ack (s n) m = 11 | match m with 12 | | z -> ack n (s z) 13 | | s m2 -> ack n (ack (s n) m2) 14 | end. 15 | 16 | goal forall x y. less z (ack x y). 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/ind/list13.v: -------------------------------------------------------------------------------- 1 | 2 | Require Import List. 3 | 4 | Lemma mem_append : forall {A:Type} (x:A) l1 l2, In x l1 -> In x (app l1 l2). 5 | intros a x l1 l2 H. 6 | induction l1. 7 | generalize dependent H. 8 | - intro H. inversion H. 9 | - simpl. 10 | destruct H. 11 | * rewrite -> H. simpl. left. trivial. 12 | * right. apply IHl1. assumption. 13 | Qed. 14 | -------------------------------------------------------------------------------- /examples/ho/weird_ineq2.p: -------------------------------------------------------------------------------- 1 | % expect: unsat 2 | 3 | thf(a1,axiom, ?[X:$i>$o] : ?[Y:$i>$o] : ?[Z:$i>$o] : 4 | ( 5 | (~ (![U:($i>$o)>$o] : ((U@X) => (U@Y)))) & 6 | (~ (![U:($i>$o)>$o] : ((U@X) => (U@Z)))) & 7 | (~ (![U:($i>$o)>$o] : ((U@Y) => (U@Z)))) 8 | ) 9 | ). 10 | 11 | thf(c1,conjecture,?[X:$i>$o]: ?[A:$i] : ?[B:$i] : ((X @ A) & ~(X @ B)) ). 12 | -------------------------------------------------------------------------------- /examples/ind/list17_easy.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # len (rev x) = len x 4 | 5 | include "nat.zf". 6 | include "list.zf". 7 | 8 | # NOTE: why isn't this sufficient? 9 | #lemma forall x l. length (cons x l) = s (length l). 10 | 11 | lemma forall l1 l2. length (append l1 l2) = plus (length l2) (length l1). 12 | 13 | goal forall x. length x = length (rev x). 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/ind/nat15_easy.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | lemma 4 | forall (N1:nat). (forall (N2:nat). ((plus N1 (s N2)) = (s (plus N1 N2)))). 5 | 6 | def odd : nat -> prop where 7 | forall N. odd (s N) = even N 8 | and even : nat -> prop where 9 | even z = true; 10 | forall (N:nat). even (s N) = odd N. 11 | 12 | goal forall (N:nat). (even (plus N N)). 13 | -------------------------------------------------------------------------------- /examples/ind/nat16.p: -------------------------------------------------------------------------------- 1 | 2 | include('nat.ax'). 3 | 4 | % p(n) | q(n) => q(n+1) | p(n+1) 5 | % p0 | q0 6 | % prove: !n: p(n) | q(n) 7 | 8 | tff(ty_p, type, p:nat > $o). 9 | tff(ty_q, type, q:nat > $o). 10 | 11 | tff(p_q_0, axiom, p(z) | q(z)). 12 | tff(p_q_s, axiom, ![N:nat]: ((p(N) | q(N)) => (p(s(N)) | q(s(N))))). 13 | 14 | tff(the, conjecture, ![N:nat]: (p(N) | q(N))). 15 | -------------------------------------------------------------------------------- /src/prover/sat_solver.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Interface to MSat} *) 5 | 6 | include module type of Sat_solver_intf 7 | 8 | module Make() : S 9 | 10 | val set_compact : bool -> unit 11 | (** Toggle compact proofs. 12 | if true, collapse internal resolution nodes in proofs *) 13 | -------------------------------------------------------------------------------- /src/prover_calculi/induction/induction_intf.ml: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {2 Induction} *) 5 | 6 | open Libzipperposition 7 | 8 | module type S = sig 9 | module Env : Env.S 10 | 11 | val register : unit -> unit 12 | (** Register the inference rules for inductive reasoning *) 13 | end 14 | -------------------------------------------------------------------------------- /examples/ho/find_set_inter_nary.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # find set intersection on a set of sets 4 | # Given a set of sets `I`, we seek the intersection of all these sets, i.e. 5 | # `λx. ∀y. (y ∈ I ⇒ x ∈ y)` 6 | 7 | val a : type. 8 | 9 | goal forall (I: (a -> prop) -> prop). 10 | exists (Q:a -> prop). 11 | forall x. (Q x <=> (forall Y. (I Y => Y x))). 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/ind/nat1_easy.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | val term : type. 3 | data nat := z | s nat. 4 | val plus : nat -> nat -> nat. 5 | assert forall (X:nat). ((plus z X) = X). 6 | assert forall (X:nat). (forall (Y:nat). ((plus (s X) Y) = (s (plus X Y)))). 7 | goal 8 | forall (X:nat). 9 | (forall (Y:nat). 10 | (forall (Z:nat). ((plus X (plus Y Z)) = (plus (plus X Y) Z)))). 11 | -------------------------------------------------------------------------------- /utils/vim/README.md: -------------------------------------------------------------------------------- 1 | # vim-zf 2 | 3 | Very basic vim syntax file for the 4 | new native language of [Zipperposition](https://github.com/c-cube/zipperposition). 5 | 6 | ## Installation 7 | 8 | Copy the files into `~/.vim` 9 | 10 | or, with [vim-plug](https://github.com/junegunn/vim-plug): 11 | 12 | ```vim 13 | Plug 'sneeuwballen/zipperposition', { 'rtp': 'utils/vim/' } 14 | ``` 15 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb61.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val f : term -> term -> term. 4 | assert 5 | forall (X:term). 6 | (forall (Y:term). (forall (Z:term). ((f X (f Y Z)) = (f (f X Y) Z)))). 7 | goal 8 | forall (X:term). 9 | (forall (Y:term). 10 | (forall (Z:term). 11 | (forall (W:term). ((f X (f Y (f Z W))) = (f (f (f X Y) Z) W))))). 12 | -------------------------------------------------------------------------------- /examples/modulo6.p: -------------------------------------------------------------------------------- 1 | 2 | % harder problem: 3|a & a=2b => a mod 6 = 0 3 | 4 | tff(ty_a, type, a : $int). 5 | tff(ty_divisible, type, divisible : ($int * $int) > $o). 6 | 7 | tff(1, axiom, ![X:$int, Y:$int]: (divisible(X, Y) <=> $remainder_e(X,Y) = 0)). 8 | tff(2, axiom, divisible(a, 3)). 9 | tff(3, axiom, ?[X:$int]: (a = $product(2,X))). 10 | tff(the, conjecture, $remainder_e(a, 6) = 0). 11 | -------------------------------------------------------------------------------- /examples/must_pass.txt: -------------------------------------------------------------------------------- 1 | examples/ac.zf 2 | examples/pelletier_problems/pb34.zf 3 | examples/polymorph.p 4 | examples/regression/bad_set_avatar.zf --avatar=eager 5 | examples/regression/contextual_narrow1.zf 6 | examples/set_fancy.zf 7 | examples/simple_case.zf 8 | examples/regression/npdtree_fail.zf 9 | examples/regression/ho_pos.zf 10 | examples/ho/neg_eq1.zf 11 | examples/data/length.zf 12 | -------------------------------------------------------------------------------- /src/prover/AC.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 AC redundancy} *) 5 | 6 | open Logtk 7 | 8 | type spec = AC_intf.spec 9 | 10 | module type S = AC_intf.S 11 | 12 | module Make(Env: Env.S) : S with module Env = Env 13 | 14 | val key_ac : (module S) Flex_state.key 15 | 16 | val extension : Extensions.t 17 | -------------------------------------------------------------------------------- /examples/ho/sum_unin.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # variant of sum_int.zf without `int` 5 | 6 | val nat : type. 7 | 8 | val sum : pi a. a -> (a -> nat) -> nat. 9 | 10 | val [infix "+"] plus : nat -> nat -> nat. 11 | 12 | assert forall x y. plus x y = plus y x. 13 | 14 | goal 15 | forall a (s : a) f g. 16 | sum s (fun x. plus (f x) (g x)) = sum s (fun x. plus (g x) (f x)). 17 | 18 | -------------------------------------------------------------------------------- /examples/ind/nat15.p: -------------------------------------------------------------------------------- 1 | 2 | % even(X+X) 3 | 4 | include('nat.ax'). 5 | 6 | tff(type_odd, type, odd: nat > $o). 7 | tff(type_even, type, even: nat > $o). 8 | 9 | tff(odd1, axiom, odd(s(z))). 10 | tff(odd2, axiom, ![N:nat]: (even(N) => odd(s(N)))). 11 | tff(even1, axiom, even(z)). 12 | tff(even2, axiom, ![N:nat]: (odd(N) => even(s(N)))). 13 | 14 | tff(the, conjecture, ![N:nat]: even(plus(N,N))). 15 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb28.p: -------------------------------------------------------------------------------- 1 | 2 | % expect: sat 3 | % this should be a theorem, but SPASS finds a completion... 4 | 5 | fof(ax1, axiom, (! [X] : p(X)) => (! [X] : q(X))). 6 | 7 | fof(ax2, axiom, (! [X] : (q(X) | r(X))) => 8 | (? [X] : (q(X) & s(X)))). 9 | 10 | fof(ax3, axiom, (? [X] : s(X)) => (! [X] : (f(X) => g(X)))). 11 | 12 | fof(goal, conjecture, ! [X] : ((p(X) & f(X)) => g(X))). 13 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb65.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val f : term -> term -> term. 4 | assert 5 | forall (X:term). 6 | (forall (Y:term). (forall (Z:term). ((f (f X Y) Z) = (f X (f Y Z))))). 7 | val a : term. 8 | assert forall (X:term). ((f a X) = X). 9 | goal 10 | (forall (X:term). ((f X X) = a)) 11 | => (forall (X:term). (forall (Y:term). ((f X Y) = (f Y X)))). 12 | -------------------------------------------------------------------------------- /examples/regression/poly_bad.zf: -------------------------------------------------------------------------------- 1 | # expect: error 2 | 3 | data nat := Z | S nat. 4 | data pair a b := Pair a b. 5 | 6 | data list a := 7 | | nil 8 | | cons a (list a). 9 | 10 | def fst : pi (a b : type). pair a b -> a where 11 | forall x y. fst (Pair x y) = x. 12 | 13 | # WRONG: head does not match 14 | def snd : pi (a b : type). pair a b -> b where 15 | forall x y. fst (Pair x y) = y. 16 | -------------------------------------------------------------------------------- /examples/by_case3.p: -------------------------------------------------------------------------------- 1 | 2 | % declinaison of by_case2 3 | 4 | tff(ty_a, type, a : $int). 5 | tff(ty_u, type, u : $int). 6 | tff(ty_t, type, t : $int). 7 | tff(ty_p, type, p : $int > $o). 8 | 9 | tff(1, axiom, $lesseq($sum(a,u), t)). 10 | tff(2, axiom, $lesseq($difference(t,u), $sum(a,2))). 11 | tff(3, axiom, p($sum(a,u)) & p($sum($sum(a,u),1)) & p($sum($sum(a,u),2))). 12 | tff(4, conjecture, p(t)). 13 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb34.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val q : term -> prop. 4 | val p : term -> prop. 5 | goal 6 | ((exists (X:term). (forall (Y:term). ((p X) <=> (p Y)))) 7 | <=> ((exists (X:term). (q X)) <=> (forall (Y:term). (p Y)))) 8 | <=> ((exists (X:term). (forall (Y:term). ((q X) <=> (q Y)))) 9 | <=> ((exists (X:term). (p X)) <=> (forall (Y:term). (q Y)))). 10 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb57.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val c : term. 4 | val b : term. 5 | val a : term. 6 | val g : term -> term -> term. 7 | val f : term -> term -> prop. 8 | assert f (g a b) (g b c). 9 | assert f (g b c) (g a c). 10 | assert 11 | forall (X:term). 12 | (forall (Y:term). (forall (Z:term). (((f Y Z) && (f X Y)) => (f X Z)))). 13 | goal f (g a b) (g a c). 14 | -------------------------------------------------------------------------------- /examples/ind/nat12.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "nat.zf". 3 | 4 | # p(n) & q(n) => q(n+1) 5 | # p(n) & q(n+1) => p(n+1) 6 | # p0 et q0 7 | # prove: !n: p(n) 8 | 9 | val p : nat -> prop. 10 | val q : nat -> prop. 11 | assert p z. 12 | assert q z. 13 | assert forall (N:nat). (((q N) && (p N)) => (q (s N))). 14 | assert forall (N:nat). (((q (s N)) && (p N)) => (p (s N))). 15 | goal forall (N:nat). (p N). 16 | -------------------------------------------------------------------------------- /examples/ind/nat21.smt2: -------------------------------------------------------------------------------- 1 | (declare-datatypes () ((Nat (Z) (S (p Nat))))) 2 | (define-fun-rec 3 | ge 4 | ((x Nat) (y Nat)) Bool 5 | (match y 6 | (case Z true) 7 | (case (S z) 8 | (match x 9 | (case Z false) 10 | (case (S x2) (ge x2 z)))))) 11 | (assert-not 12 | (forall ((x Nat) (y Nat) (z Nat)) 13 | (=> (ge x y) (=> (ge y z) (ge x z))))) 14 | (check-sat) 15 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb31.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val h : term -> prop. 4 | val g : term -> prop. 5 | val f : term -> prop. 6 | assert ~ (exists (X:term). (((h X) || (g X)) && (f X))). 7 | val i : term -> prop. 8 | assert exists (X:term). ((f X) && (i X)). 9 | val j : term -> prop. 10 | assert forall (X:term). ((~ (h X)) => (j X)). 11 | goal exists (X:term). ((j X) && (i X)). 12 | -------------------------------------------------------------------------------- /tests/dune: -------------------------------------------------------------------------------- 1 | 2 | (executable 3 | (name run_tests) 4 | (libraries logtk logtk.parsers logtk.arbitrary logtk.arith 5 | iter qcheck-core qcheck-alcotest alcotest) 6 | (flags :standard -warn-error -3 -w -3-50 -color always -open Logtk_arith)) 7 | 8 | (alias 9 | (name runtest) 10 | (package logtk) 11 | (locks /tlock) 12 | (deps run_tests.exe) 13 | (action (run %{deps}))) 14 | 15 | -------------------------------------------------------------------------------- /examples/ho/unif4.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val i : type. 5 | 6 | val map : (i -> i) -> i. 7 | 8 | val f : i -> i. 9 | val g : i -> i. 10 | 11 | val a : i. 12 | val b : i. 13 | 14 | val f1: i->i. 15 | val f2: i->i. 16 | 17 | assert f1 (f1 a) != f2 (f2 b). 18 | 19 | goal exists (F:(i->i)->i->i). 20 | F f a = f (f a) && 21 | F g b = g (g b) && 22 | F f1 a != F f2 b. # not identity 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/ind/nat4.p: -------------------------------------------------------------------------------- 1 | % double(X) = X+X 2 | 3 | % NOTE: this is solvable using 4 | % ./zipperposition.native -theory src/builtin.theory examples/ind/nat4.p 5 | 6 | include('nat.ax'). 7 | 8 | tff(ty_double, type, double : nat > nat). 9 | 10 | tff(double1, axiom, ![X:nat]: double(s(X)) = s(s(double(X)))). 11 | tff(double2, axiom, double(z) = z). 12 | 13 | tff(the, conjecture, ![X:nat]: double(X) = plus(X,X)). 14 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb38.p: -------------------------------------------------------------------------------- 1 | 2 | fof(goal, conjecture, 3 | (! [X] : ( 4 | (p(a) & (p(X) => ? [Y] : (p(Y) & r(X,Y)))) => 5 | (? [Z,W] : (p(Z) & r(X,W) & r(W,Z))) 6 | ) 7 | ) <=> 8 | (! [X] : ( 9 | (~ p(a) | p(X) | ? [Z,W] : (p(Z) & r(X,W) & r(W,Z))) & 10 | (~ p(a) | (~ (? [Y] : (p(Y) & r(X,Y)))) 11 | | ? [Z,W] : (p(Z) & r(X,W) & r(W,Z))) 12 | ) 13 | ) 14 | ). 15 | -------------------------------------------------------------------------------- /src/prover_calculi/qle.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Quasipure Literal Elimination} *) 5 | open Logtk 6 | open Libzipperposition 7 | 8 | module type S = sig 9 | module Env : Env.S 10 | val setup : unit -> unit 11 | end 12 | 13 | module Make(E : Env.S) : S with module Env = E 14 | 15 | val extension : Extensions.t 16 | -------------------------------------------------------------------------------- /examples/regression/ho_demod_partial_app.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # see #25 5 | 6 | 7 | val list : type -> type. 8 | 9 | val map : pi a b. (a -> b) -> list a -> list b. 10 | 11 | val a : type. 12 | val b : type. 13 | 14 | def f : a -> a := fun x. x. 15 | def g : a -> a := fun x. x. 16 | 17 | # The goal is not proved without this lemma 18 | # lemma f = g. 19 | 20 | goal forall l. map f l = map g l. 21 | -------------------------------------------------------------------------------- /examples/ind/nat4_bis.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | val term : type. 3 | data nat := z | s nat. 4 | val plus : nat -> nat -> nat. 5 | val double : nat -> nat. 6 | assert forall (X:nat). ((plus z X) = X). 7 | assert forall (X:nat). (forall (Y:nat). ((plus (s X) Y) = (s (plus X Y)))). 8 | assert forall (X:nat). ((double (s X)) = (s (s (double X)))). 9 | assert (double z) = z. 10 | goal forall (X:nat). ((double X) = (plus X X)). 11 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb64.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val f : term -> term -> term. 4 | assert 5 | forall (X:term). 6 | (forall (Y:term). (forall (Z:term). ((f (f X Y) Z) = (f X (f Y Z))))). 7 | val a : term. 8 | assert forall (X:term). ((f a X) = X). 9 | assert forall (X:term). (exists (Y:term). ((f Y X) = a)). 10 | goal forall (X:term). (forall (Y:term). (((f Y X) = a) => ((f X Y) = a))). 11 | -------------------------------------------------------------------------------- /src/core/util_stubs.h: -------------------------------------------------------------------------------- 1 | /* C Stubs */ 2 | 3 | #include "caml/mlvalues.h" 4 | 5 | /** Limit memory usage to the given amount of megabytes, using setrlimit. 6 | * Type: int -> unit */ 7 | CAMLprim value logtk_set_memory_limit(CAMLprim megabytes); 8 | 9 | /** Limit CPU time usage to the given amount of seconds, using setrlimit. 10 | * Type: int -> unit */ 11 | CAMLprim value logtk_set_time_limit(CAMLprim megabytes); 12 | -------------------------------------------------------------------------------- /src/prover/bool_lit.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Boolean Literal} 5 | 6 | The boolean literal carries a payload of type ['a] *) 7 | 8 | module type S = Bool_lit_intf.S 9 | 10 | module type PAYLOAD = sig 11 | type t 12 | val dummy : t 13 | end 14 | 15 | module Make(Payload : PAYLOAD) : S with type payload = Payload.t 16 | -------------------------------------------------------------------------------- /src/prover_calculi/bce_pe_fixpoint.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Blocked Clause Elimination} *) 5 | open Logtk 6 | open Libzipperposition 7 | 8 | module type S = sig 9 | module Env : Env.S 10 | val setup : unit -> unit 11 | end 12 | 13 | module Make(E : Env.S) : S with module Env = E 14 | 15 | val extension : Extensions.t 16 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb51.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val f : term -> term -> prop. 4 | assert 5 | exists (Z:term). 6 | (exists (W:term). 7 | (forall (X:term). 8 | (forall (Y:term). ((f X Y) <=> ((Y = W) && (X = Z)))))). 9 | goal 10 | exists (Z:term). 11 | (forall (X:term). 12 | ((exists (W:term). (forall (Y:term). ((f X Y) <=> (Y = W)))) 13 | <=> (X = Z))). 14 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb52.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val f : term -> term -> prop. 4 | assert 5 | exists (Z:term). 6 | (exists (W:term). 7 | (forall (X:term). 8 | (forall (Y:term). ((f X Y) <=> ((Y = W) && (X = Z)))))). 9 | goal 10 | exists (W:term). 11 | (forall (Y:term). 12 | ((exists (Z:term). (forall (X:term). ((f X Y) <=> (X = Z)))) 13 | <=> (Y = W))). 14 | -------------------------------------------------------------------------------- /examples/pelletier_problems/equivalence.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val contains : term -> term -> prop. 4 | val equ : term -> term -> prop. 5 | assert 6 | forall (A:term). 7 | (forall (B:term). 8 | ((equ A B) <=> (forall (C:term). ((contains A C) <=> (contains B C))))). 9 | goal 10 | forall (A:term). 11 | (forall (B:term). 12 | (forall (C:term). (((equ B A) && (equ C B)) => (equ C A)))). 13 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb26.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val q : term -> prop. 4 | val p : term -> prop. 5 | assert (exists (X:term). (p X)) <=> (exists (X:term). (q X)). 6 | val s : term -> prop. 7 | val r : term -> prop. 8 | assert 9 | forall (X:term). (forall (Y:term). (((q Y) && (p X)) => ((r X) <=> (s Y)))). 10 | goal 11 | (forall (X:term). ((p X) => (r X))) <=> (forall (X:term). ((q X) => (s X))). 12 | -------------------------------------------------------------------------------- /examples/ind/list2.p: -------------------------------------------------------------------------------- 1 | 2 | include('list.ax'). 3 | include('nat.ax'). 4 | 5 | % very simple double-induction 6 | 7 | tff(ty_p, type, p : nat > $o). 8 | tff(ty_q, type, q : list > $o). 9 | 10 | tff(p_1, axiom, p(z)). 11 | tff(p_2, axiom, ![N:nat]: (p(N) => p(s(N)))). 12 | 13 | tff(q_1, axiom, q(nil)). 14 | tff(q_2, axiom, ![N:nat, L:list]: 15 | ((p(N) & q(L)) => q(cons(N,L)))). 16 | 17 | tff(the, conjecture, ![L:list]: q(L)). 18 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb29.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val g : term -> prop. 4 | val f : term -> prop. 5 | assert (exists (X:term). (g X)) && (exists (X:term). (f X)). 6 | val j : term -> prop. 7 | val h : term -> prop. 8 | goal 9 | ((forall (X:term). ((g X) => (j X))) && (forall (X:term). ((f X) => (h X)))) 10 | <=> (forall (X:term). 11 | (forall (Y:term). (((g Y) && (f X)) => ((j Y) && (h X))))). 12 | -------------------------------------------------------------------------------- /src/prover/Bool_clause.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Boolean Clause} *) 5 | 6 | open Logtk 7 | 8 | type bool_lit = BBox.Lit.t 9 | 10 | type t = bool_lit list 11 | 12 | val proof_tc : t Proof.Result.tc 13 | 14 | val mk_proof_res : t -> Proof.Result.t 15 | 16 | exception E_proof of t 17 | 18 | val proof_res_as_bc : Proof.Result.t -> t option 19 | -------------------------------------------------------------------------------- /examples/ind/list11_easy.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | include "nat.zf". 5 | include "list.zf". 6 | 7 | # TODO: find the right lemmas 8 | 9 | lemma forall A B C. leq A B => leq (plus C A) (plus C B). 10 | lemma forall X L1 L2. count X (append L1 L2) = plus (count X L1) (count X L2). 11 | lemma forall L1 L2. length (append L1 L2) = plus (length L1) (length L2). 12 | 13 | goal forall (X:nat). forall (L:list). leq (count X L) (length L). 14 | -------------------------------------------------------------------------------- /examples/sep1.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # separation logic 5 | # SWW413-1.p 6 | 7 | include "sep_ax.zf". 8 | 9 | val x1:ptr. 10 | val x2:ptr. 11 | val x3:ptr. 12 | val x4:ptr. 13 | 14 | assert x1 != nil. 15 | assert x2 != nil. 16 | 17 | assert x1 != x2. 18 | assert x2 != x3. 19 | assert x1 != x4. 20 | assert x2 != x4. 21 | 22 | assert heap (sep (lseg x3 nil) (sep (next x2 x3) emp)). 23 | 24 | goal heap (sep (lseg x2 nil) emp). 25 | 26 | -------------------------------------------------------------------------------- /src/core/dune: -------------------------------------------------------------------------------- 1 | 2 | ; main lib 3 | (library 4 | (name logtk) 5 | (public_name logtk) 6 | (synopsis "core data structures and algorithms for Logtk") 7 | (libraries containers containers-data iter oseq 8 | unix mtime mtime.clock.os logtk.arith) 9 | (flags :standard -w -32-50 -open Logtk_arith) 10 | (c_names util_stubs) 11 | (c_flags -Wextra -Wno-unused-parameter) 12 | ) 13 | 14 | (documentation 15 | (package logtk)) 16 | -------------------------------------------------------------------------------- /examples/counter_ex_beagle.p: -------------------------------------------------------------------------------- 1 | 2 | % problem exposed in paper on beagle 3 | 4 | tff(ty_p, type, p : ($int * $i) > $o). 5 | tff(g, conjecture, 6 | ( 7 | (![I:$int, J:$int, X:$i]: 8 | ( $lesseq(I,J) 9 | | p($sum(I,1), X) 10 | | p($sum(J,2), X))) 11 | & 12 | (![I:$int, J:$int, X:$i]: 13 | ( $lesseq(I,J) 14 | | ~ p($sum(I,3), X) 15 | | ~ p($sum(J,4), X))) 16 | 17 | ) => $false). 18 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb20.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val s : term -> prop. 4 | val r : term -> prop. 5 | val q : term -> prop. 6 | val p : term -> prop. 7 | goal 8 | (forall (X:term). 9 | (forall (Y:term). 10 | (exists (Z:term). 11 | (forall (W:term). (((q Y) && (p X)) => ((s W) && (r Z))))))) 12 | => ((exists (X:term). (exists (Y:term). ((q Y) && (p X)))) 13 | => (exists (Z:term). (r Z))). 14 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb46.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ! [X] : 3 | ((f(X) & 4 | ! [Y] : ((f(Y) & h(X,Y)) => g(Y))) 5 | => g(X)) 6 | ). 7 | 8 | fof(ax2, axiom, 9 | (? [X] : (f(X) & ~ g(X))) => 10 | (? [X] : (f(X) & ~ g(X) & 11 | ! [Y] : ((f(Y) & ~g(Y)) => j(X,Y)))) 12 | ). 13 | 14 | fof(ax3, axiom, ! [X,Y] : 15 | ( (f(X) & f(Y) & h(X,Y)) 16 | => ~ j(X,Y)) 17 | ). 18 | 19 | fof(goal, conjecture, ! [X] : (f(X) => g(X))). 20 | -------------------------------------------------------------------------------- /examples/data/unit_list_eq.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # not that easy… 4 | 5 | data unit := Unit. 6 | data nat := Z | S nat. 7 | data list a := Nil | Cons a (list a). 8 | 9 | def length : pi a. list a -> nat where 10 | length (Nil _) = Z; 11 | forall x l. length (Cons x l) = S (length l). 12 | 13 | lemma forall (l1 l2:list unit). length l1 != length l2 => l1 != l2. 14 | 15 | goal forall (l1 l2 : list unit). (length l1=length l2 => l1=l2). 16 | 17 | -------------------------------------------------------------------------------- /examples/ind/nat12.p: -------------------------------------------------------------------------------- 1 | 2 | include('nat.ax'). 3 | 4 | % p(n) & q(n) => q(n+1) 5 | % p(n) & q(n+1) => p(n+1) 6 | % p0 et q0 7 | % prove: !n: p(n) 8 | 9 | tff(ty_p, type, p:nat > $o). 10 | tff(ty_q, type, q:nat > $o). 11 | 12 | tff(p_1, axiom, p(z)). 13 | tff(q_1, axiom, q(z)). 14 | tff(succ_1, axiom, ![N:nat]: ((p(N) & q(N)) => q(s(N)))). 15 | tff(succ_2, axiom, ![N:nat]: ((p(N) & q(s(N))) => p(s(N)))). 16 | 17 | tff(the, conjecture, ![N:nat]: p(N)). 18 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb24.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val q : term -> prop. 4 | val s : term -> prop. 5 | assert ~ (exists (X:term). ((q X) && (s X))). 6 | val r : term -> prop. 7 | val p : term -> prop. 8 | assert forall (X:term). ((p X) => ((r X) || (q X))). 9 | assert (~ (exists (X:term). (p X))) => (exists (X:term). (q X)). 10 | assert forall (X:term). (((r X) || (q X)) => (s X)). 11 | goal exists (X:term). ((r X) && (p X)). 12 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb32.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val i : term -> prop. 4 | val h : term -> prop. 5 | val g : term -> prop. 6 | val f : term -> prop. 7 | assert forall (X:term). ((((h X) || (g X)) && (f X)) => (i X)). 8 | val j : term -> prop. 9 | assert forall (X:term). (((h X) && (i X)) => (j X)). 10 | val k : term -> prop. 11 | assert forall (X:term). ((k X) => (h X)). 12 | goal forall (X:term). (((k X) && (f X)) => (j X)). 13 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb63.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val f : term -> term -> term. 4 | assert 5 | forall (X:term). 6 | (forall (Y:term). (forall (Z:term). ((f (f X Y) Z) = (f X (f Y Z))))). 7 | val a : term. 8 | assert forall (X:term). ((f a X) = X). 9 | assert forall (X:term). (exists (Y:term). ((f Y X) = a)). 10 | goal 11 | forall (X:term). 12 | (forall (Y:term). (forall (Z:term). (((f X Y) = (f Z Y)) => (X = Z)))). 13 | -------------------------------------------------------------------------------- /examples/regression/typing_app.p: -------------------------------------------------------------------------------- 1 | 2 | % expect: sat 3 | 4 | tff(zf_stmt_0, type, term : $tType). 5 | tff(zf_stmt_1, type, app_encode_fun : ($tType * $tType) > $tType). 6 | tff(zf_stmt_2, type, app : !> [Alpha:$tType,Beta:$tType]: (app_encode_fun(Alpha,Beta) * Alpha) > Beta). 7 | tff(zf_stmt_3, type, f : app_encode_fun($i,app_encode_fun($i,$i))). 8 | tff(zf_stmt_4, axiom, 9 | (app($i,$i,app($i,$_,f,X),Y) = 10 | app($i,$i,app($i,$_,f,Y),X))). 11 | 12 | -------------------------------------------------------------------------------- /examples/ind/nat_check.p: -------------------------------------------------------------------------------- 1 | 2 | % test consistency of theory 3 | 4 | include('nat.ax'). 5 | 6 | tff(ty_p, type, p:(nat * nat) > $o). 7 | tff(ty_a, type, a:nat). 8 | tff(ty_b, type, b:nat). 9 | 10 | % a minimal model 11 | %tff(axiom_a, axiom, a=z). 12 | %tff(axiom_b, axiom, b=s(z)). 13 | 14 | tff(axiom_1, axiom, ![X:nat, Y:nat]: (p(X,Y) => s(X)=Y)). 15 | 16 | tff(axiom_2, axiom, p(a,b)). 17 | % similar to conjecture ![X,Y]: ~p(X,Y) which is false 18 | 19 | -------------------------------------------------------------------------------- /src/prover_phases/libzipperposition_phases.ml: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | module Phases = Phases 5 | module Phases_impl = Phases_impl 6 | 7 | let main_cli ?setup_gc () = 8 | Phases.run (Phases_impl.main_cli ?setup_gc ()) 9 | |> CCResult.map snd 10 | 11 | let main ?setup_gc ?params file = 12 | Phases.run (Phases_impl.main ?setup_gc ?params file) 13 | |> CCResult.map snd 14 | 15 | -------------------------------------------------------------------------------- /src/prover_phases/libzipperposition_phases.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | module Phases = Phases 5 | module Phases_impl = Phases_impl 6 | 7 | val main_cli : 8 | ?setup_gc:bool -> 9 | unit -> 10 | Phases.errcode Phases.or_error 11 | 12 | val main : 13 | ?setup_gc:bool -> 14 | ?params:Libzipperposition.Params.t -> 15 | string -> 16 | Phases.errcode Phases.or_error 17 | 18 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb44.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val h : term -> term -> prop. 4 | val g : term -> prop. 5 | val f : term -> prop. 6 | assert 7 | forall (X:term). 8 | ((f X) 9 | => ((exists (Y:term). ((~ (h X Y)) && (g Y))) && 10 | (exists (Y:term). ((h X Y) && (g Y))))). 11 | val j : term -> prop. 12 | assert exists (X:term). ((forall (Y:term). ((g Y) => (h X Y))) && (j X)). 13 | goal exists (X:term). ((~ (f X)) && (j X)). 14 | -------------------------------------------------------------------------------- /examples/ho/sum_nat.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # variant of sum_int.zf without `int` 5 | 6 | data nat := Z | S nat. 7 | 8 | val sum : pi a. a -> (a -> nat) -> nat. 9 | 10 | def [infix "+"] plus : nat -> nat -> nat where 11 | forall x. plus Z x = x; 12 | forall x y. plus (S x) y = S (plus x y). 13 | 14 | lemma forall x y. plus x y = plus y x. 15 | 16 | goal 17 | forall a (s : a) f g. 18 | sum s (fun x. plus (f x) (g x)) = sum s (fun x. plus (g x) (f x)). 19 | 20 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb45.p: -------------------------------------------------------------------------------- 1 | 2 | fof(ax1, axiom, ! [X] : 3 | ( (f(X) & 4 | ! [Y] : ((g(Y) & h(X,Y)) => j(X,Y))) 5 | => ! [Y] : (((g(Y) & h(X,Y)) => k(Y)))) 6 | ). 7 | 8 | fof(ax2, axiom, ~ ? [Y] : (l(Y) & k(Y))). 9 | 10 | fof(ax3, axiom, ? [X] : 11 | (f(X) & 12 | ! [Y] : (h(X,Y) => l(Y)) & 13 | ! [Y] : ((g(Y) & h(X,Y)) => j(X,Y)) 14 | ) 15 | ). 16 | 17 | fof(goal, conjecture, ? [X] : 18 | (f(X) & 19 | (~ (? [Y] : (g(Y) & h(X,Y))))) 20 | ). 21 | -------------------------------------------------------------------------------- /examples/ind/nat15_easy.p: -------------------------------------------------------------------------------- 1 | 2 | % even(X+X) 3 | 4 | include('nat.ax'). 5 | 6 | tff(type_odd, type, odd: nat > $o). 7 | tff(type_even, type, even: nat > $o). 8 | 9 | tff(help, axiom, ![N1:nat, N2:nat]: plus(N1, s(N2)) = s(plus(N1,N2))). 10 | 11 | tff(odd1, axiom, odd(s(z))). 12 | tff(odd2, axiom, ![N:nat]: (even(N) => odd(s(N)))). 13 | tff(even1, axiom, even(z)). 14 | tff(even2, axiom, ![N:nat]: (odd(N) => even(s(N)))). 15 | 16 | tff(the, conjecture, ![N:nat]: even(plus(N,N))). 17 | -------------------------------------------------------------------------------- /examples/ind/nat21_easy.smt2: -------------------------------------------------------------------------------- 1 | (declare-datatypes () ((Nat (Z) (S (p Nat))))) 2 | (define-fun-rec 3 | ge 4 | ((x Nat) (y Nat)) Bool 5 | (match y 6 | (case Z true) 7 | (case (S z) 8 | (match x 9 | (case Z false) 10 | (case (S x2) (ge x2 z)))))) 11 | (assert 12 | (forall ((x Nat)) 13 | (=> (ge Z x) (= x Z)))) 14 | (assert-not 15 | (forall ((x Nat) (y Nat) (z Nat)) 16 | (=> (ge x y) (=> (ge y z) (ge x z))))) 17 | (check-sat) 18 | -------------------------------------------------------------------------------- /examples/ind/tree2_easy.p: -------------------------------------------------------------------------------- 1 | 2 | % rev o rev = id 3 | 4 | %include('tree.ax'). 5 | 6 | tff(tree_ind, type, tree : $tType, inductive(node, empty)). 7 | tff(ty_empty, type, empty:tree). 8 | tff(ty_node, type, node:(tree * $i * tree)> tree). 9 | tff(ty_rev, type, rev:tree > tree). 10 | 11 | tff(rev1, axiom, rev(empty) = empty). 12 | tff(rev2, axiom, ![L:tree, R:tree, X:$i]: 13 | rev(node(L,X,R)) = node(rev(R),X,rev(L))). 14 | 15 | tff(the, conjecture, ![T:tree]: rev(rev(T)) = T). 16 | -------------------------------------------------------------------------------- /src/arbitrary/arLiteral.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Arbitrary Literals} *) 5 | 6 | open Logtk 7 | 8 | type 'a arbitrary = 'a QCheck.arbitrary 9 | type 'a gen = 'a QCheck.Gen.t 10 | type lit = Literal.t 11 | type clause = Literals.t 12 | 13 | val lit_g : lit gen 14 | 15 | val lit : lit arbitrary 16 | 17 | val clause_g : clause gen 18 | 19 | val clause : clause arbitrary 20 | (** clause *) 21 | -------------------------------------------------------------------------------- /examples/tla/fsm_easy.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # Simple state machine with 2 states 4 | 5 | include "time.zf". 6 | 7 | data state := 8 | | S1 9 | | S2. 10 | 11 | val step : state -> state. 12 | rewrite step S1 = S2. 13 | rewrite step S2 = S1. 14 | 15 | # current state 16 | val at_state : time -> state. 17 | 18 | # initial state is S1 19 | assert at_state Now = S1. 20 | 21 | # transition function 22 | assert forall t s. at_state t = s => at_state (Later t) = step s. 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/tla/fsm_hard.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # Simple state machine with 2 states 4 | 5 | include "time.zf". 6 | 7 | data state := 8 | | S1 9 | | S2. 10 | 11 | val step : state -> state. 12 | rewrite step S1 = S2. 13 | rewrite step S2 = S1. 14 | 15 | # current state 16 | val at_state : time -> state. 17 | 18 | # initial state is S1 19 | assert at_state Now = S1. 20 | 21 | # transition function 22 | assert forall t s. at_state t = s => at_state (Later t) = step s. 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/arbitrary/arID.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Arbitrary generation of Identifiers} *) 5 | 6 | open Logtk 7 | 8 | type 'a arbitrary = 'a QCheck.arbitrary 9 | type 'a gen = 'a QCheck.Gen.t 10 | 11 | val default_g : ID.t gen 12 | val default : ID.t arbitrary 13 | (** Set of symbols *) 14 | 15 | val set_g : ID.Set.t gen 16 | val set : ID.Set.t arbitrary 17 | (** Arbitrary set of various symbols *) 18 | -------------------------------------------------------------------------------- /src/prover_calculi/induction/Libzipperposition_induction.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Induction through Cut} *) 5 | 6 | open Libzipperposition 7 | 8 | module type S = Induction_intf.S 9 | module type AVATAR = Libzipperposition_avatar.S 10 | 11 | module Make 12 | (E: Env.S) 13 | (A : AVATAR with module E = E) 14 | : S 15 | with module Env = E 16 | 17 | val extension : Extensions.t 18 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb25.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val p : term -> prop. 4 | assert exists (X:term). (p X). 5 | val r : term -> prop. 6 | val g : term -> prop. 7 | val f : term -> prop. 8 | assert forall (X:term). ((f X) => ((r X) && (~ (g X)))). 9 | assert forall (X:term). ((p X) => ((f X) && (g X))). 10 | val q : term -> prop. 11 | assert 12 | (exists (X:term). ((r X) && (p X))) || (forall (X:term). ((p X) => (q X))). 13 | goal exists (X:term). ((p X) && (q X)). 14 | -------------------------------------------------------------------------------- /old/data/rewriting/ring.p: -------------------------------------------------------------------------------- 1 | % abelian group 2 | sum X zero --> X. 3 | sum X (minus X) --> zero. 4 | minus zero --> zero. 5 | minus (minus X) --> X. 6 | minus (sum X Y) --> sum (minus X) (minus Y). % abelian group 7 | 8 | prod X (sum Y Z) --> sum (prod X Y) (prod X Z). 9 | prod (sum X Y) Z --> sum (prod X Z) (prod Y Z). 10 | prod X zero --> zero. 11 | prod X (minus Y) --> minus (prod X Y). 12 | prod zero X --> zero. 13 | prod (minus X) Y --> minus (prod X Y). 14 | 15 | 16 | % vim:syntax=prolog 17 | -------------------------------------------------------------------------------- /src/core/ZProf.mli: -------------------------------------------------------------------------------- 1 | 2 | (** {1 Profiler interface} *) 3 | 4 | type t 5 | 6 | val enable_profiling : bool -> unit (** Enable/disable profiling *) 7 | 8 | val make : string -> t (** Create a named profiler *) 9 | 10 | type span 11 | 12 | val enter_prof : t -> span (** Enter the profiler *) 13 | 14 | val exit_prof : span -> unit (** Exit the profiler *) 15 | 16 | val with_prof : t -> ('a -> 'b) -> 'a -> 'b 17 | 18 | val message : (unit -> string) -> unit 19 | 20 | val setup : unit -> unit 21 | -------------------------------------------------------------------------------- /src/prover/proofState.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 The state of a proof, contains a set of active clauses (processed), 5 | a set of passive clauses (to be processed), and an ordering 6 | that is used for redundancy elimination.} *) 7 | 8 | module type S = ProofState_intf.S 9 | 10 | (** {2 Create a Proof State} *) 11 | 12 | module Make(C : Clause.S) : S with module C = C and module Ctx = C.Ctx 13 | -------------------------------------------------------------------------------- /examples/data/unit_list_eq2.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | data unit := Unit. 4 | data nat := Z | S nat. 5 | data list a := Nil | Cons a (list a). 6 | 7 | def same_len : pi a. list a -> list a -> prop where 8 | same_len (Nil _) (Nil _); 9 | forall x l. ~ same_len (Nil _) (Cons x l); 10 | forall x l. ~ same_len (Cons x l) (Nil _); 11 | forall x y l1 l2. 12 | same_len (Cons x l1) (Cons x l2) = same_len l1 l2. 13 | 14 | goal forall (l1 l2 : list unit). (same_len l1 l2 => l1=l2). 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/enum3.p: -------------------------------------------------------------------------------- 1 | 2 | tff(ty_nil,type, nil: !>[A:$tType]: list(A)). 3 | tff(ty_cons,type, cons: !>[A:$tType]: (A * list(A)) > list(A)). 4 | tff(ty_f,type, f : !>[A:$tType]: A > $i). 5 | tff(ty_mapf,type, map_f : !>[A:$tType]: list(A) > list($i)). 6 | tff(0,axiom, ![L:list(A)]: (L = nil(A) | (?[X:A, L2:list(A)]: L=cons(A,X,L2)))). 7 | % tff(1,axiom, ![X:A,L:list(A)]: (map_f(A, nil(A)) = nil($i) & map_f(A, cons(A,X,L)) = cons($i,f(A,X),map_f(A,L)))). 8 | tff(2,axiom, ![X:A,L:list(A)]: (nil(A) != cons(A,X,L))). 9 | -------------------------------------------------------------------------------- /src/core/Flex_state.ml: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {2 Extensible Map for State} *) 5 | 6 | module M = CCHet.Map 7 | 8 | type 'a key = 'a CCHet.Key.t 9 | 10 | let create_key () = CCHet.Key.create() 11 | 12 | type t = M.t 13 | 14 | let add = M.add 15 | let get = M.find 16 | let get_exn = M.find_exn 17 | let get_or ~or_ k m = 18 | try M.find_exn k m 19 | with Not_found -> or_ 20 | 21 | let empty = M.empty 22 | -------------------------------------------------------------------------------- /src/prover/lift_lambdas.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | module type S = sig 5 | module Env : Env.S 6 | module C : module type of Env.C 7 | 8 | (** {5 Registration} *) 9 | 10 | val setup : unit -> unit 11 | (** Register rules in the environment *) 12 | 13 | val lift_lambdas : Env.C.t -> Env.C.t list 14 | end 15 | 16 | module Make(E : Env.S) : S with module Env = E 17 | 18 | val extension : Extensions.t 19 | -------------------------------------------------------------------------------- /examples/ind/list7_bis.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "nat.zf". 4 | include "list.zf". 5 | 6 | val rev2 : list -> list. 7 | val rev_append : list -> list -> list. 8 | assert forall (L:list). ((rev2 L) = (rev_append L nil)). 9 | assert 10 | forall (X:nat). 11 | (forall (L1:list). 12 | (forall (L2:list). 13 | ((rev_append (cons X L1) L2) = (rev_append L1 (cons X L2))))). 14 | assert forall (L:list). ((rev_append nil L) = L). 15 | goal forall (L:list). ((rev2 (rev2 L)) = L). 16 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb36.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val f : term -> term -> prop. 4 | assert forall (X:term). (exists (Y:term). (f X Y)). 5 | val g : term -> term -> prop. 6 | assert forall (X:term). (exists (Y:term). (g X Y)). 7 | val h : term -> term -> prop. 8 | assert 9 | forall (X:term). 10 | (forall (Y:term). 11 | (((g X Y) || (f X Y)) 12 | => (forall (Z:term). (((g Y Z) || (f Y Z)) => (h X Z))))). 13 | goal forall (X:term). (exists (Y:term). (h X Y)). 14 | -------------------------------------------------------------------------------- /examples/ind/list7_bis.p: -------------------------------------------------------------------------------- 1 | 2 | include('list.ax'). 3 | 4 | % rev rev = id 5 | 6 | tff(ty_rev2, type, rev2 : list > list). 7 | tff(ty_rev_append, type, rev_append : (list * list) > list). 8 | 9 | tff(rev2, axiom, ![L:list]: rev2(L) = rev_append(L, nil)). 10 | 11 | tff(rev_append_1, axiom, ![X:nat, L1:list, L2:list]: 12 | rev_append(cons(X,L1), L2) = rev_append(L1, cons(X,L2))). 13 | tff(rev_append_2, axiom, ![L:list]: rev_append(nil, L) = L). 14 | 15 | tff(the, conjecture, ![L:list]: rev2(rev2(L)) = L). 16 | -------------------------------------------------------------------------------- /examples/ind/tree5.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | include "tree.zf". 3 | val p : tree -> prop. 4 | val q : tree -> prop. 5 | assert p empty. 6 | assert q empty. 7 | assert 8 | forall (L:tree). 9 | (forall (X:term). 10 | (forall (R:tree). 11 | (((q R) && (q L) && (p L) && (p R)) => (q (node L X R))))). 12 | assert 13 | forall (L:tree). 14 | (forall (X:term). 15 | (forall (R:tree). 16 | (((q R) && (q L) && (p L) && (p R)) => (p (node L X R))))). 17 | goal forall (T:tree). (p T). 18 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb27.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val g : term -> prop. 4 | val f : term -> prop. 5 | assert exists (X:term). ((~ (g X)) && (f X)). 6 | val h : term -> prop. 7 | assert forall (X:term). ((f X) => (h X)). 8 | val i : term -> prop. 9 | val j : term -> prop. 10 | assert forall (X:term). (((i X) && (j X)) => (f X)). 11 | assert 12 | (exists (X:term). ((~ (g X)) && (h X))) 13 | => (forall (X:term). ((i X) => (~ (h X)))). 14 | goal forall (X:term). ((j X) => (~ (i X))). 15 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb28.zf: -------------------------------------------------------------------------------- 1 | # expect: SAT 2 | val term : type. 3 | val q : term -> prop. 4 | val p : term -> prop. 5 | assert (forall (X:term). (p X)) => (forall (X:term). (q X)). 6 | val s : term -> prop. 7 | val r : term -> prop. 8 | assert 9 | (forall (X:term). ((r X) || (q X))) => (exists (X:term). ((s X) && (q X))). 10 | val g : term -> prop. 11 | val f : term -> prop. 12 | assert (exists (X:term). (s X)) => (forall (X:term). ((f X) => (g X))). 13 | goal forall (X:term). (((f X) && (p X)) => (g X)). 14 | -------------------------------------------------------------------------------- /examples/ind/nat1_easy.p: -------------------------------------------------------------------------------- 1 | 2 | % associativity 3 | 4 | %include('nat.ax'). 5 | tff(nat_ind, type, nat : $tType, inductive(s, z)). 6 | 7 | tff(ty_s, type, s:nat > nat). 8 | tff(ty_z, type, z:nat). 9 | tff(ty_plus, type, plus : (nat*nat) > nat). 10 | 11 | % tff(test, axiom, ![X:nat]: s(X) != z). 12 | 13 | tff(plus_1, axiom, ![X:nat]: plus(z,X) = X). 14 | tff(plus_2, axiom, ![X:nat, Y:nat]: plus(s(X),Y) = s(plus(X,Y))). 15 | 16 | 17 | tff(1, conjecture, ![X:nat, Y:nat, Z:nat]: plus(X,plus(Y,Z)) = plus(plus(X,Y),Z)). 18 | -------------------------------------------------------------------------------- /examples/data/length.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # example with most features, including polymorphism 4 | 5 | val i : type. 6 | val foo : i. 7 | 8 | data nat := 9 | | Z 10 | | S nat 11 | and list a := 12 | | Nil 13 | | Cons a (list a). # note: polymorphisme explicite, pas de @ 14 | 15 | def three : nat := S (S (S Z)). 16 | 17 | val length : pi a. list a -> nat. 18 | 19 | assert length _ (Nil _) = Z. 20 | assert forall x l. length _ (Cons _ x l) = S (length _ l). 21 | 22 | goal exists a l. length a l = three. 23 | -------------------------------------------------------------------------------- /examples/ind/nat7_hard.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | val term : type. 3 | data nat := z | s nat. 4 | val plus : nat -> nat -> nat. 5 | assert forall (X:nat). ((plus z X) = X). 6 | assert forall (X:nat). (forall (Y:nat). ((plus (s X) Y) = (s (plus X Y)))). 7 | val x : nat -> nat. 8 | val p : nat -> nat. 9 | assert (p z) = z. 10 | assert forall (N:nat). ((p (s N)) = (plus (p N) (x N))). 11 | val q : nat -> nat. 12 | assert (q z) = z. 13 | assert forall (N:nat). ((q (s N)) = (plus (x N) (q N))). 14 | goal forall (N:nat). ((p N) = (q N)). 15 | -------------------------------------------------------------------------------- /examples/semi_group_inverse2.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val i : type. 5 | 6 | val[infix "*"] prod : i -> i -> i. 7 | val[prefix "-"] inv : i -> i. 8 | 9 | assert forall x y z. prod (prod x y) z = prod x (prod y z). 10 | 11 | assert forall x. prod x (prod (inv x) x) = x. 12 | 13 | assert forall x. prod (inv x) (prod x (inv x)) = inv x. 14 | 15 | assert forall x y. 16 | prod x (prod y x) = x && prod y (prod x y) = y => y = inv x. 17 | 18 | goal 19 | forall a b. 20 | inv (prod a b) = prod (inv b) (inv a). 21 | 22 | -------------------------------------------------------------------------------- /src/dune: -------------------------------------------------------------------------------- 1 | (env 2 | (_ 3 | (flags :standard -warn-error -3+8 -w -3 -color always -safe-string) 4 | (ocamlopt_flags :standard -O3 -unbox-closures -unbox-closures-factor 20))) 5 | 6 | (alias 7 | (name runtest) 8 | (package zipperposition) 9 | (locks /tlock) 10 | (enabled_if (= %{ocaml-config:os_type} Unix)) 11 | (deps main/zipperposition.exe test_must_pass.sh (source_tree ../examples/)) 12 | (action (run ./test_must_pass.sh ./main/zipperposition.exe))) 13 | 14 | ;(documentation 15 | ; (package logtk)) 16 | -------------------------------------------------------------------------------- /src/prover/eprover_interface.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Interfacing with E} *) 5 | 6 | module type S = sig 7 | module Env : Env.S 8 | 9 | (** {5 Registration} *) 10 | 11 | val set_e_bin : string -> unit 12 | val try_e : Env.C.t Iter.t -> Env.C.t Iter.t -> Env.C.t option 13 | 14 | 15 | val setup : unit -> unit 16 | (** Register rules in the environment *) 17 | 18 | end 19 | 20 | module Make(E : Env.S) : S with module Env = E 21 | -------------------------------------------------------------------------------- /examples/semi_group_inverse.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val i : type. 5 | 6 | val[infix "*"] prod : i -> i -> i. 7 | val[prefix "-"] inv : i -> i. 8 | 9 | assert forall x y z. prod (prod x y) z = prod x (prod y z). 10 | 11 | assert forall x. prod x (prod (inv x) x) = x. 12 | 13 | assert forall x. prod (inv x) (prod x (inv x)) = inv x. 14 | 15 | assert forall x y. 16 | prod x (prod y x) = x && prod y (prod x y) = y => y = inv x. 17 | 18 | goal 19 | forall a b. 20 | prod a a = a && prod b b = b => prod a b = prod b a. 21 | 22 | -------------------------------------------------------------------------------- /examples/don_t_use_omega.p: -------------------------------------------------------------------------------- 1 | % Comments : 2 | %------------------------------------------------------------------------------ 3 | tff(test,conjecture,( 4 | ! [X : $int, Y : $int] : ( 5 | $greater(27, $sum($product(11, X), $product(13, Y))) | 6 | $greater($sum($product(11, X), $product(13, Y)), 45) | 7 | $greater(-10, $sum($product(7, X), $product(-9, Y))) | 8 | $greater($sum($product(7, X), $product(-9, Y)), 4) 9 | ))). 10 | %------------------------------------------------------------------------------ 11 | -------------------------------------------------------------------------------- /old/data/rewriting/list.p: -------------------------------------------------------------------------------- 1 | val cons : i -> list -> list. 2 | 3 | append X nil --> X. 4 | append (append X Y) Z --> append X (append Y Z). 5 | append nil L --> L. 6 | append (cons X L) L2 --> cons X (append L L2). 7 | 8 | % flatten nil --> nil. 9 | % flatten (cons X L) --> append X (flatten L). 10 | % flatten (append X Y) --> append (flatten X) (flatten Y). 11 | 12 | rev nil --> nil. 13 | rev (cons X L) --> append (rev L) (cons X nil). 14 | rev (append X Y) --> append (rev Y) (rev X). 15 | rev (rev X) --> X. 16 | 17 | % vim:syntax=prolog 18 | -------------------------------------------------------------------------------- /src/prover/stream.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Stream} *) 5 | 6 | (** Streams are potentially infinite lists of clauses *) 7 | 8 | open Logtk 9 | 10 | val stat_stream_create : Util.stat 11 | 12 | module type S = Stream_intf.S 13 | 14 | module type ARG = sig 15 | module Ctx : Ctx.S 16 | module C : Clause.S with module Ctx = Ctx 17 | end 18 | 19 | (** {2 Build a new Stream} *) 20 | module Make(A : ARG) : S with module Ctx = A.Ctx and module C = A.C 21 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb53.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | assert 4 | exists (X:term). 5 | (exists (Y:term). ((forall (Z:term). ((Z = Y) || (Z = X))) && (X != Y))). 6 | val f : term -> term -> prop. 7 | goal 8 | (exists (Z:term). 9 | (forall (X:term). 10 | ((exists (W:term). (forall (Y:term). ((f X Y) <=> (Y = W)))) 11 | <=> (X = Z)))) 12 | <=> (exists (W:term). 13 | (forall (Y:term). 14 | ((exists (Z:term). (forall (X:term). ((f X Y) <=> (X = Z)))) 15 | <=> (Y = W)))). 16 | -------------------------------------------------------------------------------- /utils/mk_lib_mli.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | 3 | """Build lib.mli from build.mllib""" 4 | 5 | def generate(mllib, mli): 6 | mllib = open(mllib, 'r') 7 | mli = open(mli, 'w') 8 | for line in mllib.xreadlines(): 9 | line2 = 'module {0} : module type of {0}\n'.format(line.strip()) 10 | mli.write(line2) 11 | mli.close() 12 | mllib.close() 13 | 14 | 15 | if __name__ == '__main__': 16 | mllib = 'src/lib.mllib' 17 | mli = 'src/lib.mli' 18 | print "generate", mli, "from", mllib 19 | generate(mllib, mli) 20 | -------------------------------------------------------------------------------- /examples/data/mult.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # Example for exercizing `data` 4 | # Here, 2*3 = 6 5 | 6 | data nat := 7 | | Z 8 | | S nat. 9 | 10 | def plus (x y:nat) : nat := 11 | match x with 12 | | Z -> y 13 | | S x2 -> S (plus x2 y) 14 | end. 15 | 16 | val mult : nat -> nat -> nat. 17 | rewrite forall x. mult Z x = Z. 18 | rewrite forall x y. mult (S x) y = plus y (mult x y). 19 | 20 | def two : nat := S (S Z). 21 | def three : nat := S two. 22 | def six : nat := S (S (S (S (S (S Z))))). 23 | 24 | goal mult two three = six. 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/parsers/dune: -------------------------------------------------------------------------------- 1 | 2 | (library 3 | (name logtk_parsers) 4 | (public_name logtk.parsers) 5 | (synopsis "parsers for logtk") 6 | (optional) 7 | (libraries containers logtk logtk.arith) 8 | (flags :standard -warn-error -32 -open Logtk_arith) 9 | (ocamlopt_flags :standard -Oclassic) 10 | ) 11 | 12 | (menhir 13 | (modules Parse_tptp Parse_zf Parse_dk Tip_parser)) 14 | 15 | (ocamllex 16 | (modules Lex_tptp Lex_zf Lex_dk Tip_lexer)) 17 | 18 | ;(ocamllex (Lex_tptp)) 19 | ;(ocamllex (Lex_zf)) 20 | ;(ocamllex (Lex_dk)) 21 | ;(ocamllex (Tip_lexer)) 22 | -------------------------------------------------------------------------------- /src/prover/env.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Global environment for an instance of the prover} *) 5 | 6 | open Logtk 7 | 8 | (** {2 Signature} *) 9 | module type S = Env_intf.S 10 | 11 | type 'a packed = (module S with type C.t = 'a) 12 | 13 | (** {2 Build a new Environment} *) 14 | module Make(X : sig 15 | module Ctx : Ctx.S 16 | val params : Params.t 17 | val flex_state : Flex_state.t 18 | end) : sig 19 | include S with module Ctx = X.Ctx 20 | end 21 | -------------------------------------------------------------------------------- /examples/data/mult_3.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # Example for exercizing rewriting 4 | # Here, 2 * 3 = (2 + 2) + 2 5 | 6 | data nat := 7 | | Z 8 | | S nat. 9 | 10 | val plus : nat -> nat -> nat. 11 | rewrite forall x. plus Z x = x. 12 | rewrite forall x y. plus (S x) y = S (plus x y). 13 | 14 | val mult : nat -> nat -> nat. 15 | rewrite forall x. mult Z x = Z. 16 | rewrite forall x y. mult (S x) y = plus y (mult x y). 17 | 18 | def two : nat := S (S Z). 19 | def three : nat := S (S (S Z)). 20 | 21 | goal mult two three = plus (plus two two) two. 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb66.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val i : term -> term -> term. 4 | val t : term -> prop. 5 | assert forall (X:term). (forall (Y:term). (t (i X (i Y X)))). 6 | assert 7 | forall (X:term). 8 | (forall (Y:term). 9 | (forall (Z:term). (t (i (i X (i Y Z)) (i (i X Y) (i X Z)))))). 10 | val n : term -> term. 11 | assert forall (X:term). (forall (Y:term). (t (i (i (n X) (n Y)) (i Y X)))). 12 | assert forall (X:term). (forall (Y:term). (((t X) && (t (i X Y))) => (t Y))). 13 | goal forall (X:term). (t (i X (n (n X)))). 14 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb67.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val i : term -> term -> term. 4 | val t : term -> prop. 5 | assert forall (X:term). (forall (Y:term). (t (i X (i Y X)))). 6 | assert 7 | forall (X:term). 8 | (forall (Y:term). 9 | (forall (Z:term). (t (i (i X (i Y Z)) (i (i X Y) (i X Z)))))). 10 | val n : term -> term. 11 | assert forall (X:term). (forall (Y:term). (t (i (i (n X) (n Y)) (i Y X)))). 12 | assert forall (X:term). (forall (Y:term). (((t X) && (t (i X Y))) => (t Y))). 13 | goal forall (X:term). (t (i (n (n X)) X)). 14 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb68.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val i : term -> term -> term. 4 | val t : term -> prop. 5 | assert forall (X:term). (forall (Y:term). (t (i X (i Y X)))). 6 | assert 7 | forall (X:term). 8 | (forall (Y:term). 9 | (forall (Z:term). (t (i (i X (i Y Z)) (i (i X Y) (i X Z)))))). 10 | val n : term -> term. 11 | assert forall (X:term). (forall (Y:term). (t (i (i Y X) (i (n X) (n Y))))). 12 | assert forall (X:term). (forall (Y:term). (((t X) && (t (i X Y))) => (t Y))). 13 | goal forall (X:term). (t (i X (n (n X)))). 14 | -------------------------------------------------------------------------------- /examples/regression/gh_8.zf: -------------------------------------------------------------------------------- 1 | 2 | # issue #8 3 | 4 | # expect: unsat 5 | 6 | data list a := nil | cons a (list a). 7 | 8 | def[infix "∈"] mem : pi a. a -> list a -> prop where 9 | forall x. mem x nil = false; 10 | forall x hd tl. mem x (cons hd tl) = (x = hd || mem x tl). 11 | 12 | def count : pi a. list a -> (a -> prop) -> int where 13 | forall p. count nil p = 0; 14 | forall hd tl p. count (cons hd tl) p = count tl p + (if p hd then 1 else 0). 15 | 16 | goal forall a (l : list a) p (x : a). count l p != 0 => (exists result. mem result l && p result). 17 | -------------------------------------------------------------------------------- /old/data/rewriting/comm_ring.p: -------------------------------------------------------------------------------- 1 | % Commutative rings 2 | 3 | val zero : carrier. 4 | val plus : carrier -> carrier -> carrier. 5 | val minus : carrier -> carrier. 6 | val mult : carrier -> carrier -> carrier. 7 | 8 | plus X (minus X) --> zero. 9 | plus X zero --> X. 10 | minus (minus X) --> X. 11 | minus zero --> zero. 12 | minus (plus X Y) --> plus (minus X) (minus Y). 13 | mult X one --> X. 14 | mult X zero --> zero. 15 | mult X (plus Y Z) --> plus (mult X Y) (mult X Z). 16 | mult X (minus Y) --> minus (mult X Y). 17 | 18 | 19 | % vim:syntax=prolog 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb54.zf: -------------------------------------------------------------------------------- 1 | # expect: sat 2 | # bad retranscription? 3 | 4 | val term : type. 5 | val f : term -> term -> prop. 6 | assert 7 | forall (Y:term). 8 | (exists (Z:term). (forall (X:term). ((f X Z) <=> (X = Y)))). 9 | goal 10 | ~ 11 | (exists (W:term). 12 | (forall (X:term). 13 | ((f X W) 14 | <=> (forall (U:term). 15 | ((f X U) 16 | => (exists (Y:term). 17 | ((~ (exists (Z:term). ((f Z Y) && (f X U)))) && 18 | (f Y U)))))))). 19 | -------------------------------------------------------------------------------- /portfolio/fo/fo8.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # $1: File name 4 | # $2: Extra options 5 | 6 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 7 | 8 | ulimit -t $2 9 | 10 | $DIR/../zipperposition ${1:+"$1"} \ 11 | -i tptp \ 12 | -o tptp \ 13 | --timeout "$2" \ 14 | --mode=fo-complete-basic --kbo-weight-fun=invfreqrank --simultaneous-sup=true --prec-gen-fun=invfreq \ 15 | -q "10|const|conjecture-relative-e(0.1,1.0,100,100,100,100,1.5,1.5,1.5)" \ 16 | -q "1|const|fifo" \ 17 | --select=e-selection14 --kbo-const-weight=1 \ 18 | "${@:3}" 19 | -------------------------------------------------------------------------------- /portfolio/fo/fo20.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # $1: File name 4 | # $2: Extra options 5 | 6 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 7 | 8 | ulimit -t $2 9 | 10 | $DIR/../zipperposition ${1:+"$1"} \ 11 | -i tptp \ 12 | -o tptp \ 13 | --timeout "$2" \ 14 | --mode=fo-complete-basic --kbo-weight-fun=invfreqrank --simultaneous-sup=true --prec-gen-fun=invfreq \ 15 | -q "50|prefer-goals|conjecture-relative-e(0.1,1.0,100,100,100,100,1.5,1.5,1.5)" \ 16 | -q "1|const|fifo" \ 17 | --select=e-selection --kbo-const-weight=1 \ 18 | "${@:3}" 19 | -------------------------------------------------------------------------------- /src/arbitrary/arID.ml: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Arbitrary generation of Identifiers} *) 5 | 6 | open Logtk 7 | 8 | type 'a arbitrary = 'a QCheck.arbitrary 9 | type 'a gen = 'a QCheck.Gen.t 10 | 11 | let default_g = 12 | let l = List.map ID.make ["f"; "g"; "h"; "a"; "b"; "c"; "d"] in 13 | QCheck.Gen.oneofl l 14 | 15 | let default = QCheck.make ~print:ID.to_string default_g 16 | 17 | let set_g = 18 | QCheck.Gen.(list default_g >|= ID.Set.of_list) 19 | let set = QCheck.make set_g 20 | -------------------------------------------------------------------------------- /src/arbitrary/arType.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Arbitrary Generation of Types} *) 5 | 6 | open Logtk 7 | 8 | type 'a arbitrary = 'a QCheck.arbitrary 9 | type 'a gen = 'a QCheck.Gen.t 10 | 11 | val base_g : Type.t gen 12 | val base : Type.t arbitrary 13 | (** Random base symbol *) 14 | 15 | val ground_g : Type.t gen 16 | val ground : Type.t arbitrary 17 | (** Ground type *) 18 | 19 | val default_g : Type.t gen 20 | val default : Type.t arbitrary 21 | (** Any type (polymorphic) *) 22 | -------------------------------------------------------------------------------- /src/prover/dune: -------------------------------------------------------------------------------- 1 | (rule 2 | (targets const.ml) 3 | (deps (glob_files ../../*.opam)) 4 | (action 5 | (with-stdout-to 6 | %{targets} 7 | (progn 8 | (echo "let version = \"%{version:libzipperposition}\"\n") 9 | (echo "let section = Logtk.Util.Section.make \"zip\"\n"))))) 10 | 11 | (library 12 | (name libzipperposition) 13 | (public_name libzipperposition) 14 | (synopsis "library for the Zipperposition theorem prover") 15 | (libraries containers msat logtk logtk.arith logtk.proofs logtk.parsers str) 16 | (flags :standard -w -32-50 -open Logtk_arith)) 17 | -------------------------------------------------------------------------------- /examples/ind/nat17.p: -------------------------------------------------------------------------------- 1 | 2 | %include('nat.ax'). 3 | 4 | % p(n) & q(n) => q(n+1) 5 | % p(n) & q(n) => p(n+1) 6 | % p0 et q0 7 | % prove: !n: p(n) 8 | 9 | tff(nat_ind, type, nat : $tType, inductive(s, z)). 10 | 11 | tff(ty_s, type, s:nat > nat). 12 | tff(ty_z, type, z:nat). 13 | 14 | tff(ty_p, type, p:nat > $o). 15 | tff(ty_q, type, q:nat > $o). 16 | 17 | tff(p_1, axiom, p(z)). 18 | tff(q_1, axiom, q(z)). 19 | tff(succ_1, axiom, ![N:nat]: ((p(N) & q(N)) => q(s(N)))). 20 | tff(succ_2, axiom, ![N:nat]: ((p(N) & q(N)) => p(s(N)))). 21 | 22 | tff(the, conjecture, ![N:nat]: p(N)). 23 | -------------------------------------------------------------------------------- /examples/rewrite1.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | # exercize rewriting 3 | 4 | val set : type -> type. 5 | 6 | val[infix "∈"] mem : pi a. a -> set a -> prop. 7 | val[infix "∪"] union : pi a. set a -> set a -> set a. 8 | val[infix "⊆"] subeq : pi a. set a -> set a -> prop. 9 | 10 | rewrite 11 | forall a s1 s2 x. 12 | mem a x (union a s1 s2) <=> mem a x s1 || mem a x s2. 13 | 14 | rewrite 15 | forall a s1 s2. 16 | subeq a s1 s2 <=> (forall x. mem a x s1 => mem a x s2). 17 | 18 | goal 19 | forall a A B C. 20 | subeq a (union _ A B) C => subeq _ A C && subeq _ B C. 21 | 22 | -------------------------------------------------------------------------------- /examples/rewrite1_def.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: error 3 | # definitions are wrong! 4 | 5 | # exercize rewriting 6 | 7 | val set : type -> type. 8 | 9 | val mem : pi a. a -> set a -> prop. 10 | 11 | def union : pi a. set a -> set a -> set a where 12 | forall a s1 s2 x. 13 | mem a x (union a s1 s2) <=> mem a x s1 || mem a x s2 . 14 | 15 | def subeq : pi a. set a -> set a -> prop where 16 | forall a s1 s2. 17 | subeq a s1 s2 <=> (forall x. mem a x s1 => mem a x s2). 18 | 19 | goal 20 | forall a A B C. 21 | subeq a (union _ A B) C => subeq _ A C && subeq _ B C. 22 | 23 | -------------------------------------------------------------------------------- /examples/tla/fsm_uninterpreted.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # Simple state machine with 2 states 4 | 5 | include "time.zf". 6 | 7 | val state : type. 8 | val S1 : state. 9 | val S2 : state. 10 | 11 | assert forall s. s = S1 || s = S2. 12 | assert S1 != S2. 13 | 14 | val step : state -> state. 15 | rewrite step S1 = S2. 16 | rewrite step S2 = S1. 17 | 18 | # current state 19 | val at_state : time -> state. 20 | 21 | # initial state is S1 22 | #assert at_state Now = S1. 23 | 24 | # transition function 25 | assert forall t s. at_state t = s => at_state (Later t) = step s. 26 | 27 | 28 | -------------------------------------------------------------------------------- /examples/ind/nat12_no_ax.p: -------------------------------------------------------------------------------- 1 | 2 | %include('nat.ax'). 3 | 4 | % p(n) & q(n) => q(n+1) 5 | % p(n) & q(n+1) => p(n+1) 6 | % p0 et q0 7 | % prove: !n: p(n) 8 | 9 | tff(nat_ind, type, nat : $tType, inductive(s, z)). 10 | 11 | tff(ty_s, type, s:nat > nat). 12 | tff(ty_z, type, z:nat). 13 | 14 | tff(ty_p, type, p:nat > $o). 15 | tff(ty_q, type, q:nat > $o). 16 | 17 | tff(p_1, axiom, p(z)). 18 | tff(q_1, axiom, q(z)). 19 | tff(succ_1, axiom, ![N:nat]: ((p(N) & q(N)) => q(s(N)))). 20 | tff(succ_2, axiom, ![N:nat]: ((p(N) & q(s(N))) => p(s(N)))). 21 | 22 | tff(the, conjecture, ![N:nat]: p(N)). 23 | -------------------------------------------------------------------------------- /examples/ind/tree5.p: -------------------------------------------------------------------------------- 1 | 2 | include('tree.ax'). 3 | 4 | % p(l) & q(l) & p(r) & q(r) => q(node(l,_,r)) 5 | % p(l) & q(l) & p(r) & q(r) => p(node(l,_,r)) 6 | % p(empty) et q(empty) 7 | % prove: !t: p(t) 8 | 9 | tff(ty_p, type, p:tree > $o). 10 | tff(ty_q, type, q:tree > $o). 11 | 12 | tff(p_1, axiom, p(empty)). 13 | tff(q_1, axiom, q(empty)). 14 | tff(node_1, axiom, ![L:tree, X, R:tree]: 15 | ((p(L) & q(L) & p(R) & q(R)) => q(node(L,X,R)))). 16 | tff(node_2, axiom, ![L:tree, X, R:tree]: 17 | ((p(L) & q(L) & p(R) & q(R)) => p(node(L,X,R)))). 18 | 19 | tff(the, conjecture, ![T:tree]: p(T)). 20 | -------------------------------------------------------------------------------- /src/prover_calculi/bce.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Blocked Clause Elimination} *) 5 | open Logtk 6 | open Libzipperposition 7 | 8 | val k_enabled : bool Logtk.Flex_state.key 9 | 10 | module type S = sig 11 | module Env : Env.S 12 | val setup : ?in_fp_mode:bool -> unit -> unit 13 | val begin_fixpoint : unit -> unit 14 | val fixpoint_step : unit -> bool 15 | val end_fixpoint : unit -> unit 16 | end 17 | 18 | module Make(E : Env.S) : S with module Env = E 19 | 20 | val extension : Extensions.t 21 | -------------------------------------------------------------------------------- /src/prover_calculi/pred_elim.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Blocked Clause Elimination} *) 5 | open Logtk 6 | open Libzipperposition 7 | 8 | val k_enabled : bool Logtk.Flex_state.key 9 | 10 | module type S = sig 11 | module Env : Env.S 12 | val setup : ?in_fp_mode:bool -> unit -> unit 13 | val begin_fixpoint : unit -> unit 14 | val fixpoint_step : unit -> bool 15 | val end_fixpoint : unit -> unit 16 | end 17 | 18 | module Make(E : Env.S) : S with module Env = E 19 | 20 | val extension : Extensions.t 21 | -------------------------------------------------------------------------------- /examples/polymorph2.p: -------------------------------------------------------------------------------- 1 | 2 | tff(ty_selected, type, select : (map(A,B) * A) > B). 3 | tff(ty_update, type, update : (map(A, B) * A * B) > map(A,B)). 4 | tff(ty_empty, type, empty_map : map(A,B)). 5 | tff(ty_k1, type, k1 : list(A)). 6 | tff(ty_k2, type, k2 : list(A)). 7 | tff(ty_a, type, a : array($int)). 8 | tff(1, axiom, ![M: map(A,B), K:A, V:B]: select(update(M, K, V), K) = V). 9 | tff(2, axiom, ![M: map(A,B), K:A, K2:A, V:B]: (K != K2 => select(update(M,K,V), K2) = select(M, K2))). 10 | tff(3, hypothesis, k1 != k2). 11 | tff(4, conjecture, select(update(update(empty_map, k1, a), k2, b), k1) = a). 12 | 13 | -------------------------------------------------------------------------------- /portfolio/fo/fo12.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # $1: File name 4 | # $2: Extra options 5 | 6 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 7 | 8 | 9 | ulimit -t $2 10 | 11 | $DIR/../zipperposition ${1:+"$1"} \ 12 | -i tptp\ 13 | -o tptp\ 14 | --timeout "$2" --mode=fo-complete-basic \ 15 | --recognize-injectivity=true --ho-unif-level=pragmatic-framework \ 16 | -q "6|prefer-goals|default" \ 17 | -q "6|prefer-non-goals|explore" \ 18 | -q "2|prefer-sos|conjecture-relative-var(1.05,s,f)"\ 19 | -q "1|const|fifo" --select=e-selection3 --avatar=off \ 20 | "${@:3}" 21 | -------------------------------------------------------------------------------- /src/tools/dune: -------------------------------------------------------------------------------- 1 | 2 | (executables 3 | (names 4 | type_check cnf_of tptp_to_zf 5 | proof_check_tstp fo_detector fool_detector check_finite_domain 6 | problem_features) 7 | (public_names 8 | zipper_type_check zipper_cnf_of zipper_tptp_to_zf 9 | zipper_proof_check_tstp zipper_fo_detector zipper_fool_detector zipper_fd_detector 10 | zipper_categorize_problem) 11 | (modes native) 12 | (promote (until-clean) (into ../..)) 13 | (libraries logtk logtk.parsers) 14 | (package zipperposition-tools) 15 | (flags :standard -w -32) 16 | (ocamlopt_flags :standard -Oclassic) 17 | ) 18 | -------------------------------------------------------------------------------- /examples/ind/nat4_bis.p: -------------------------------------------------------------------------------- 1 | % double(X) = X+X 2 | 3 | 4 | % declare that "nat" is an inductive type 5 | tff(nat_ind, type, nat : $tType, inductive(s, z)). 6 | tff(ty_s, type, s:nat > nat). 7 | tff(ty_z, type, z:nat). 8 | tff(ty_plus, type, plus : (nat*nat) > nat). 9 | 10 | tff(ty_double, type, double : nat > nat). 11 | 12 | tff(plus_1, axiom, ![X:nat]: plus(z,X) = X). 13 | tff(plus_2, axiom, ![X:nat, Y:nat]: plus(s(X),Y) = s(plus(X,Y))). 14 | 15 | tff(double1, axiom, ![X:nat]: double(s(X)) = s(s(double(X)))). 16 | tff(double2, axiom, double(z) = z). 17 | 18 | tff(the, conjecture, ![X:nat]: double(X) = plus(X,X)). 19 | -------------------------------------------------------------------------------- /tests/testType.ml: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** Test typing *) 5 | 6 | open Logtk 7 | open Logtk_arbitrary 8 | 9 | module PT = TypedSTerm 10 | 11 | let check_cmp = 12 | let gen = QCheck.(pair ArType.default ArType.default) in 13 | let name = "type_cmp_compatible_eq" in 14 | (* comparison of two types is 0 iff they are equal *) 15 | let prop (ty1, ty2) = 16 | let c = Type.compare ty1 ty2 in 17 | (c = 0) = (Type.equal ty1 ty2) 18 | in 19 | QCheck.Test.make ~name gen prop 20 | 21 | let props = 22 | [ check_cmp 23 | ] 24 | -------------------------------------------------------------------------------- /examples/data/fact_ax.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: sat 3 | 4 | data nat := Z | S nat. 5 | 6 | val[infix "+"] plus : nat -> nat -> nat. 7 | rewrite forall x. plus Z x = x. 8 | rewrite forall x y. plus (S x) y = S (plus x y). 9 | 10 | val[infix "×"] mult : nat -> nat -> nat. 11 | rewrite forall x. mult Z x = Z. 12 | rewrite forall x y. mult (S x) y = plus y (mult x y). 13 | 14 | val[prefix "!"] fact : nat -> nat. 15 | rewrite fact Z = S Z. 16 | rewrite forall n. fact (S n) = mult (S n) (fact n). 17 | 18 | val[infix "≤"] leq : nat -> nat -> prop. 19 | rewrite forall n. leq Z n <=> true. 20 | rewrite forall m n. leq (S m) (S n) <=> leq m n. 21 | 22 | -------------------------------------------------------------------------------- /src/prover/signals.ml: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Useful signals} *) 5 | 6 | open Logtk 7 | 8 | let (on_print_stats : unit Signal.t) = Signal.create () 9 | (** Called when/if it's time to print statistics *) 10 | 11 | let (on_before_process_file : string Signal.t) = Signal.create () 12 | (** Called before starting solving a problem *) 13 | 14 | let (on_exit : int Signal.t) = Signal.create () 15 | (** Called before exit *) 16 | 17 | let (on_dot_output : unit Signal.t) = Signal.create () 18 | (** Called when dot printers should activate *) 19 | 20 | -------------------------------------------------------------------------------- /examples/ind/weird_nat_add3acc_assoc1.smt2: -------------------------------------------------------------------------------- 1 | ; Weird functions over natural numbers 2 | ; 3 | ; Property about accumulative trinary addition function 4 | (declare-datatypes () ((Nat (Z) (S (p Nat))))) 5 | (define-fun-rec 6 | add3acc 7 | ((x Nat) (y Nat) (z Nat)) Nat 8 | (match x 9 | (case Z 10 | (match y 11 | (case Z z) 12 | (case (S y2) (add3acc Z y2 (S z))))) 13 | (case (S x2) (add3acc x2 (S y) z)))) 14 | (assert-not 15 | (forall ((x1 Nat) (x2 Nat) (x3 Nat) (x4 Nat) (x5 Nat)) 16 | (= (add3acc (add3acc x1 x2 x3) x4 x5) 17 | (add3acc x1 x2 (add3acc x3 x4 x5))))) 18 | (check-sat) 19 | -------------------------------------------------------------------------------- /src/arbitrary/arForm.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Arbitrary Basic Terms} *) 5 | 6 | open Logtk 7 | 8 | type 'a arbitrary = 'a QCheck.arbitrary 9 | type 'a gen = 'a QCheck.Gen.t 10 | type form = TypedSTerm.t 11 | 12 | val atom_g : form gen 13 | 14 | val atom : form arbitrary 15 | (** Atomic formula *) 16 | 17 | val clause_g : form list gen 18 | 19 | val clause : form list arbitrary 20 | (** clause *) 21 | 22 | val default : form arbitrary 23 | (** polymorphic formula with connectives (DB-closed) *) 24 | 25 | val default_fuel : int -> form gen 26 | -------------------------------------------------------------------------------- /src/core/NPDtree.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Non-Perfect Discrimination Tree} *) 5 | 6 | (** This module provides a simplification index and a term index, based on a 7 | non-perfect discrimination tree (see "the handbook of automated reasoning", 8 | chapter "term indexing", for instance). It should be more compact 9 | in memory than {!Dtree}, and maybe more optimized too. 10 | *) 11 | 12 | module Make(E : Index.EQUATION) : Index.UNIT_IDX with module E = E 13 | 14 | module MakeTerm(X : Set.OrderedType) : Index.TERM_IDX with type elt = X.t 15 | -------------------------------------------------------------------------------- /src/prover/ctx.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Basic context for literals, clauses...} *) 5 | 6 | open Logtk 7 | 8 | (** {2 Context for a Proof} *) 9 | module type S = Ctx_intf.S 10 | 11 | module Key : sig 12 | val lost_completeness : bool Flex_state.key 13 | end 14 | 15 | module type PARAMETERS = sig 16 | val signature : Signature.t 17 | val ord : Ordering.t 18 | val select : Selection.t 19 | val bool_select : Bool_selection.t 20 | val sk_ctx : Skolem.ctx 21 | end 22 | 23 | (** {2 Create a new context} *) 24 | module Make(X : PARAMETERS) : S 25 | -------------------------------------------------------------------------------- /src/prover_calculi/Rewriting.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Rewriting} 5 | 6 | Deal with definitions as rewrite rules *) 7 | open Libzipperposition 8 | 9 | module Make(E : Env_intf.S) : sig 10 | val setup : ?ctx_narrow:bool -> narrowing:bool -> has_rw:bool -> unit -> unit 11 | end 12 | 13 | val unfold_def_before_cnf : ((Logtk.TypedSTerm.t, Logtk.TypedSTerm.t, Logtk.TypedSTerm.t) Logtk.Statement.t, 'c) CCVector.t -> 14 | ((Logtk.TypedSTerm.t, Logtk.TypedSTerm.t, Logtk.TypedSTerm.t) Logtk.Statement.t, 'c) CCVector.t 15 | val extension : Extensions.t 16 | -------------------------------------------------------------------------------- /examples/ind/list10_medium.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "list.zf". 4 | 5 | # not trivial, because of the subproof of `a+b=b+a` 6 | 7 | def[prefix "Σ"] sum : list -> nat where 8 | (sum nil) = z; 9 | forall (N:nat). (forall (L:list). ((sum (cons N L)) = (plus N (sum L)))). 10 | 11 | lemma forall X. plus X z = X. 12 | lemma forall X Y Z. plus X (plus Y Z) = plus (plus X Y) Z. 13 | lemma forall X Y. plus X Y = plus Y X. 14 | lemma forall L1 X L2. append (append L1 (cons X nil)) L2 = append L1 (cons X L2). 15 | lemma forall L1 L2. sum (append L1 L2) = plus (sum L1) (sum L2). 16 | 17 | goal forall (L:list). ((sum (rev L)) = (sum L)). 18 | 19 | -------------------------------------------------------------------------------- /src/core/Flex_state.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {2 Extensible Map for State} *) 5 | 6 | (** This data structure maps keys to values of any type (although the 7 | type is fixed for a given key). Useful for configuration. 8 | *) 9 | 10 | type t 11 | 12 | val empty : t 13 | 14 | type 'a key 15 | val create_key : unit -> 'a key 16 | 17 | val add : 'a key -> 'a -> t -> t 18 | 19 | val get : 'a key -> t -> 'a option 20 | 21 | val get_exn : 'a key -> t -> 'a 22 | (** @raise Not_found if the key is not present *) 23 | 24 | val get_or : or_:'a -> 'a key -> t -> 'a 25 | -------------------------------------------------------------------------------- /src/proofs/LLProver.mli: -------------------------------------------------------------------------------- 1 | 2 | (** {1 Low Level Prover} *) 3 | 4 | (** A small theorem prover that checks entailment of ground formulas, 5 | with higher order terms and some theories *) 6 | 7 | type form = LLTerm.Form.t 8 | 9 | type res = 10 | | R_ok 11 | | R_fail 12 | 13 | type final_state 14 | 15 | val can_check : LLProof.tag list -> bool 16 | (** Is this set of tags accepted by the tableau prover? *) 17 | 18 | val prove : form list -> form -> res * final_state 19 | (** [prove a b] returns [R_ok] if [a => b] is a tautology. *) 20 | 21 | val pp_stats : final_state CCFormat.printer 22 | 23 | val pp_dot : final_state CCFormat.printer 24 | 25 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb46.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val g : term -> prop. 4 | val h : term -> term -> prop. 5 | val f : term -> prop. 6 | assert 7 | forall (X:term). 8 | (((forall (Y:term). (((h X Y) && (f Y)) => (g Y))) && (f X)) => (g X)). 9 | val j : term -> term -> prop. 10 | assert 11 | (exists (X:term). ((~ (g X)) && (f X))) 12 | => (exists (X:term). 13 | ((forall (Y:term). (((~ (g Y)) && (f Y)) => (j X Y))) && 14 | (f X) && 15 | (~ (g X)))). 16 | assert 17 | forall (X:term). 18 | (forall (Y:term). (((h X Y) && (f X) && (f Y)) => (~ (j X Y)))). 19 | goal forall (X:term). ((f X) => (g X)). 20 | -------------------------------------------------------------------------------- /examples/ho/unif4_with_fun.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | # NOTE: very similar to unif4, but we add the solution explicitely. However, 5 | # it seems to hurt the prover for now (2017-05-22) 6 | 7 | val i : type. 8 | 9 | val map : (i -> i) -> i. 10 | 11 | val f : i -> i. 12 | val g : i -> i. 13 | 14 | val a : i. 15 | val b : i. 16 | 17 | val f1: i->i. 18 | val f2: i->i. 19 | 20 | assert f1 (f1 a) != f2 (f2 b). 21 | 22 | goal exists (F:(i->i)->i->i). 23 | F f a = f (f a) && 24 | F g b = g (g b) && 25 | (F = (fun f x. f (f x))) && # FIXME: this kills the prover, by getting it stuck… HO unif should deal with it 26 | F f1 a != F f2 b. # not identity 27 | 28 | 29 | -------------------------------------------------------------------------------- /examples/ind/list10_easy.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "list.zf". 4 | 5 | # not trivial! proof of `a+b=b+a` is not so easy 6 | 7 | def[prefix "Σ"] sum : list -> nat where 8 | (sum nil) = z; 9 | forall (N:nat). (forall (L:list). ((sum (cons N L)) = (plus N (sum L)))). 10 | 11 | lemma forall X. plus X z = X. 12 | lemma forall X Y Z. plus X (plus Y Z) = plus (plus X Y) Z. 13 | assert forall X Y. plus X Y = plus Y X. # NOTE: proof too deep otherwise 14 | lemma forall L1 X L2. append (append L1 (cons X nil)) L2 = append L1 (cons X L2). 15 | lemma forall L1 L2. sum (append L1 L2) = plus (sum L1) (sum L2). 16 | 17 | goal forall (L:list). ((sum (rev L)) = (sum L)). 18 | 19 | -------------------------------------------------------------------------------- /examples/polymorph.p: -------------------------------------------------------------------------------- 1 | 2 | tff(ty_selected, type, select : !>[A:$tType, B:$tType]: (map(A,B) * A) > B). 3 | tff(ty_update, type, update : !>[A:$tType, B:$tType]: (map(A, B) * A * B) > map(A,B)). 4 | tff(ty_empty, type, empty_map : !>[A:$tType, B:$tType]: map(A,B)). 5 | tff(1, axiom, ![A:$tType, B:$tType, M: map(A,B), K:A, V:B]: 6 | select($_, $_, update($_, $_, M, K, V), K) = V). 7 | tff(2, axiom, ![A:$tType, B:$tType, M: map(A,B), K:A, K2:A, V:B]: 8 | (K != K2 => select($_, $_, update(A,B, M,K,V), K2) = select($_, $_, M, K2))). 9 | tff(3, hypothesis, k1 != k2). 10 | tff(4, conjecture, select($_, $_, update($_, $_, update($_, $_, empty_map($_, $_), k1, a), k2, b), k1) = a). 11 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb38.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val r : term -> term -> prop. 4 | val a : term. 5 | val p : term -> prop. 6 | goal 7 | (forall (X:term). 8 | ((((p X) => (exists (Y:term). ((r X Y) && (p Y)))) && (p a)) 9 | => (exists (Z:term). (exists (W:term). ((r W Z) && (p Z) && (r X W)))))) 10 | <=> (forall (X:term). 11 | (((exists (Z:term). (exists (W:term). ((r W Z) && (p Z) && (r X W)))) || 12 | (~ (p a)) || 13 | (~ (exists (Y:term). ((r X Y) && (p Y))))) && 14 | ((exists (Z:term). (exists (W:term). ((r W Z) && (p Z) && (r X W)))) || 15 | (~ (p a)) || 16 | (p X)))). 17 | -------------------------------------------------------------------------------- /examples/enum4.p: -------------------------------------------------------------------------------- 1 | 2 | tff(ty_nil,type, nil: !>[A:$tType]: list(A)). 3 | tff(ty_cons,type, cons: !>[A:$tType]: (A * list(A)) > list(A)). 4 | tff(ty_f,type, f : !>[A:$tType]: A > $i). 5 | tff(ty_mapf,type, map_f : !>[A:$tType]: list(A) > list($i)). 6 | tff(0,axiom, ![L:list(A)]: (L = nil(A) | (?[X:A, L2:list(A)]: L=cons(A,X,L2)))). 7 | tff(1,axiom, ![X:A,L:list(A)]: (map_f(A, nil(A)) = nil($i) & map_f(A, cons(A,X,L)) = cons($i,f(A,X),map_f(A,L)))). 8 | tff(2,axiom, ![X:A,L:list(A)]: (nil(A) != cons(A,X,L))). 9 | 10 | tff(the, conjecture, 11 | (![X:foo]: f(foo,X)=bar) 12 | => 13 | (map_f(foo, cons(foo, a, cons(foo, b, nil(foo)))) = cons($i, bar, cons($i, bar, nil($i)))) 14 | ). 15 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb37.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val q : term -> term -> prop. 4 | val p : term -> term -> prop. 5 | assert 6 | forall (Z:term). 7 | (exists (W:term). 8 | (forall (X:term). 9 | (exists (Y:term). 10 | (((p Y W) => (exists (U:term). (q U W))) && 11 | ((p X Z) => (p Y W)) && 12 | (p Y Z))))). 13 | assert 14 | forall (X:term). 15 | (forall (Z:term). ((~ (p X Z)) => (exists (Y:term). (q Y Z)))). 16 | val r : term -> term -> prop. 17 | assert 18 | (exists (X:term). (exists (Y:term). (q X Y))) => (forall (X:term). (r X X)). 19 | goal forall (X:term). (exists (Y:term). (r X Y)). 20 | -------------------------------------------------------------------------------- /portfolio/fo/fo5.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # $1: File name 4 | # $2: Extra options 5 | 6 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 7 | 8 | ulimit -t $2 9 | 10 | $DIR/../zipperposition ${1:+"$1"} \ 11 | -i tptp \ 12 | -o tptp \ 13 | --timeout "$2" \ 14 | --kbo-weight-fun=invdocc --mode=fo-complete-basic \ 15 | -q "6|prefer-sos|conjecture-relative-var(1.02,l,f)" \ 16 | -q "4|const|pnrefined(1,1,1,2,2,2,0.5)" \ 17 | -q "1|prefer-processed|fifo" \ 18 | -q "1|prefer-short-trail|conjecture-relative-var(1,l,f)" \ 19 | -q "6|defer-sos|conjecture-relative-var(1.03,s,f)" \ 20 | --select=e-selection4 --recognize-injectivity=true \ 21 | "${@:3}" 22 | 23 | -------------------------------------------------------------------------------- /examples/ind/list7_bis_easy.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | include "nat.zf". 4 | include "list.zf". 5 | 6 | val rev2 : list -> list. 7 | val rev_append : list -> list -> list. 8 | 9 | assert 10 | forall (X:nat). 11 | forall (L1:list). 12 | forall (L2:list). 13 | rev_append (cons X L1) L2 = rev_append L1 (cons X L2). 14 | 15 | assert forall (L:list). rev_append nil L = L. 16 | 17 | assert forall (L:list). rev2 L = rev_append L nil. 18 | 19 | # NOTE: introduce explicit lemmas 20 | 21 | lemma forall L. append L nil = L. 22 | 23 | lemma 24 | forall L1 L2 L3. 25 | rev_append (rev_append L1 L2) L3 = rev_append L2 (append L1 L3). 26 | 27 | goal forall (L:list). rev2 (rev2 L) = L. 28 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb45.zf: -------------------------------------------------------------------------------- 1 | # expect: UNSAT 2 | val term : type. 3 | val k : term -> prop. 4 | val j : term -> term -> prop. 5 | val h : term -> term -> prop. 6 | val g : term -> prop. 7 | val f : term -> prop. 8 | assert 9 | forall (X:term). 10 | (((forall (Y:term). (((h X Y) && (g Y)) => (j X Y))) && (f X)) 11 | => (forall (Y:term). (((h X Y) && (g Y)) => (k Y)))). 12 | val l : term -> prop. 13 | assert ~ (exists (Y:term). ((k Y) && (l Y))). 14 | assert 15 | exists (X:term). 16 | ((forall (Y:term). (((h X Y) && (g Y)) => (j X Y))) && 17 | (f X) && 18 | (forall (Y:term). ((h X Y) => (l Y)))). 19 | goal exists (X:term). ((~ (exists (Y:term). ((h X Y) && (g Y)))) && (f X)). 20 | -------------------------------------------------------------------------------- /src/prover_calculi/lazy_cnf.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Booleans} *) 5 | open Libzipperposition 6 | open Logtk 7 | 8 | val enabled : bool ref 9 | 10 | val k_pa_renaming : bool Flex_state.key 11 | 12 | module type S = sig 13 | module Env : Env.S 14 | module C : module type of Env.C with type t = Env.C.t 15 | 16 | (** {5 Registration} *) 17 | 18 | val setup : unit -> unit 19 | (** Register rules in the environment *) 20 | 21 | val update_form_counter: action:[< `Decrease | `Increase ] -> C.t -> unit 22 | end 23 | 24 | module Make(E : Env.S) : S with module Env = E 25 | 26 | val extension : Extensions.t 27 | -------------------------------------------------------------------------------- /examples/pelletier_problems/pb55.p: -------------------------------------------------------------------------------- 1 | 2 | % who killed aunt Agatha? 3 | 4 | fof(ax1, axiom, ? [X] : (l(X) & k(X,a))). 5 | 6 | fof(ax2, axiom, l(a) & l(b) & l(c)). 7 | 8 | fof(ax3, axiom, ! [X] : ( 9 | l(X) => (X = a | X = b | X = c)) 10 | ). 11 | 12 | fof(ax4, axiom, ! [Y,X] : (k(X,Y) => h(X,Y))). 13 | 14 | fof(ax5, axiom, ! [X,Y] : (k(X,Y) => ~ r(X,Y))). 15 | 16 | fof(ax6, axiom, ! [X] : (h(a,X) => ~ h(c,X))). 17 | 18 | fof(ax7, axiom, ! [X] : (X != b => h(a,X))). 19 | 20 | fof(ax8, axiom, ! [X] : ((~ r(X,a)) => h(b,X))). 21 | 22 | fof(ax9, axiom, ! [X] : (h(a,X) => h(b,X))). 23 | 24 | fof(ax10, axiom, ! [X] : ? [Y] : ~ h(X,Y)). 25 | 26 | fof(ax11, axiom, a != b). 27 | 28 | fof(goal, conjecture, k(a,a)). 29 | -------------------------------------------------------------------------------- /examples/ind/list7_join.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | # correlate "rev" and "rev_append" 3 | 4 | include "list.zf". 5 | 6 | val rev_append : list -> list -> list. 7 | 8 | assert 9 | forall (X:nat). 10 | forall (L1:list). 11 | forall (L2:list). 12 | rev_append (cons X L1) L2 = rev_append L1 (cons X L2). 13 | 14 | assert forall (L:list). rev_append nil L = L. 15 | 16 | lemma forall L. append L nil = L. 17 | lemma forall L1 L2 L3. append L1 (append L2 L3) = append (append L1 L2) L3. 18 | lemma forall L1 X L2. append (append L1 (cons X nil)) L2 = append L1 (cons X L2). 19 | lemma forall L1 L2. rev (append L1 L2) = append (rev L2) (rev L1). 20 | 21 | goal forall L1 L2. rev_append L1 L2 = append (rev L1) L2. 22 | -------------------------------------------------------------------------------- /portfolio/fo/fo15.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # $1: File name 4 | # $2: Extra options 5 | 6 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 7 | 8 | ulimit -t $2 9 | 10 | $DIR/../zipperposition ${1:+"$1"} \ 11 | -i tptp \ 12 | -o tptp \ 13 | --timeout "$2" \ 14 | --mode=fo-complete-basic --kbo-weight-fun=invfreqrank --simultaneous-sup=true\ 15 | -q "10|prefer-sos|rel_lvl_weight(1,2,1,2,100,100,100,400,1.5,1.5,1)"\ 16 | -q "3|prefer-non-goals|conjecture-relative-e(0.1,1,200,100,200,100,1.5,1.5,1.5)"\ 17 | -q "1|prefer-processed|clauseweight(1,1,1)"\ 18 | -q "1|prefer-processed|fifo"\ 19 | --select=e-selection --ord=lambdafree_kbo --prec-gen-fun=invfreq --kbo-const-weight=1 "${@:3}" 20 | -------------------------------------------------------------------------------- /examples/cuts/ntape3-css.tptp: -------------------------------------------------------------------------------- 1 | fof(seq_0, axiom, ![N_1]: '+'('0', N_1) = N_1). 2 | fof(seq_1, axiom, ![N_1,N_0]: '+'(N_1, N_0) = '+'(N_0, N_1)). 3 | fof(seq_2, axiom, ![N_1,N_0]: '+'(N_1, '+'(N_0, '1')) = '+'('+'(N_1, N_0), '1')). 4 | fof(seq_3, axiom, ![X,X_0,X_1]: (f(X) != X_0 | ~ '<'(s_7('q_{1}'(X_0)), '+'(s_7('q_{1}'(X_0)), '1')) | ~ '<'(s_8('q_{1}'(X_0), X_0, s_7('q_{1}'(X_0))), X_1) | f(X_1) != X_0)). 5 | fof(seq_4, axiom, ![X,X_0,X_1,N_2]: (f(X) != X_0 | ~ '<'(s_8('q_{1}'(X_0), X_0, s_7('q_{1}'(X_0))), X_1) | f(X_1) != X_0 | '<'(N_2, '+'(N_2, '1')))). 6 | fof(seq_5, axiom, ![N_0,N_1]: (f('+'('+'(N_0, N_1), '1')) = '0' | f('+'('+'(N_0, N_1), '1')) = '1')). 7 | fof(seq_6, axiom, ![N_1,N_0]: '<'('+'('0', N_1), '+'('+'(N_0, '1'), N_1))). 8 | -------------------------------------------------------------------------------- /src/core/Dtree.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Perfect Discrimination Tree} *) 5 | 6 | (** This module provides a simplification index, based on a 7 | perfect discrimination tree (see "the handbook of automated reasoning", 8 | chapter "term indexing", for instance). 9 | 10 | The simplification index can only retrieve {b generalizations} 11 | of a given query term, but it does it efficiently. 12 | 13 | It is used for demodulation (rewriting) in Superposition. 14 | *) 15 | 16 | module Make(E : Index.EQUATION) : Index.UNIT_IDX with module E = E 17 | 18 | module Default : Index.UNIT_IDX with module E = Index.BasicEquation 19 | -------------------------------------------------------------------------------- /examples/ind/list7.smt2: -------------------------------------------------------------------------------- 1 | ; Property from "Productive Use of Failure in Inductive Proof", 2 | ; Andrew Ireland and Alan Bundy, JAR 1996 3 | (declare-datatypes (a) 4 | ((list (nil) (cons (head a) (tail (list a)))))) 5 | (define-fun-rec 6 | (par (a) 7 | (append 8 | ((x (list a)) (y (list a))) (list a) 9 | (match x 10 | (case nil y) 11 | (case (cons z xs) (cons z (append xs y))))))) 12 | (define-fun-rec 13 | (par (a) 14 | (rev 15 | ((x (list a))) (list a) 16 | (match x 17 | (case nil (as nil (list a))) 18 | (case (cons y xs) (append (rev xs) (cons y (as nil (list a))))))))) 19 | (assert-not (par (a) (forall ((x (list a))) (= (rev (rev x)) x)))) 20 | (check-sat) 21 | -------------------------------------------------------------------------------- /examples/ind/prop_10.smt2: -------------------------------------------------------------------------------- 1 | ; Property from "Productive Use of Failure in Inductive Proof", 2 | ; Andrew Ireland and Alan Bundy, JAR 1996 3 | (declare-datatypes (a) 4 | ((list (nil) (cons (head a) (tail (list a)))))) 5 | (define-fun-rec 6 | (par (a) 7 | (append 8 | ((x (list a)) (y (list a))) (list a) 9 | (match x 10 | (case nil y) 11 | (case (cons z xs) (cons z (append xs y))))))) 12 | (define-fun-rec 13 | (par (a) 14 | (rev 15 | ((x (list a))) (list a) 16 | (match x 17 | (case nil (as nil (list a))) 18 | (case (cons y xs) (append (rev xs) (cons y (as nil (list a))))))))) 19 | (assert-not (par (a) (forall ((x (list a))) (= (rev (rev x)) x)))) 20 | (check-sat) 21 | -------------------------------------------------------------------------------- /src/core/Binder.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Logtk. See file "license" for more details. *) 3 | 4 | (** {1 Binders for Logic} *) 5 | 6 | (** The classic binders for the internal AST and various term representations. 7 | 8 | @since 1.5 *) 9 | 10 | type t = 11 | | Exists 12 | | Forall 13 | | ForallTy 14 | | Lambda 15 | 16 | include Interfaces.HASH with type t := t 17 | include Interfaces.ORD with type t := t 18 | include Interfaces.PRINT with type t := t 19 | 20 | val exists : t 21 | val forall : t 22 | val lambda : t 23 | val forall_ty : t 24 | 25 | module TPTP : sig 26 | include Interfaces.PRINT with type t := t 27 | end 28 | 29 | module ZF : sig 30 | include Interfaces.PRINT with type t := t 31 | end 32 | -------------------------------------------------------------------------------- /examples/ind/nat7.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | val term : type. 3 | data nat := z | s nat. 4 | val plus : nat -> nat -> nat. 5 | assert forall (X:nat). ((plus z X) = X). 6 | assert forall (X:nat). (forall (Y:nat). ((plus (s X) Y) = (s (plus X Y)))). 7 | val x : nat -> nat. 8 | val p : nat -> nat. 9 | assert (p z) = z. 10 | assert forall (N:nat). ((p (s N)) = (plus (p N) (x N))). 11 | val q : nat -> nat. 12 | assert (q z) = z. 13 | assert forall (N:nat). ((q (s N)) = (plus (x N) (q N))). 14 | 15 | lemma 16 | forall (X:nat). 17 | (forall (Y:nat). 18 | (forall (Z:nat). ((plus X (plus Y Z)) = (plus (plus X Y) Z)))). 19 | lemma forall (N1:nat). (forall (N2:nat). ((plus N1 N2) = (plus N2 N1))). 20 | 21 | goal forall (N:nat). ((p N) = (q N)). 22 | -------------------------------------------------------------------------------- /examples/data/plist.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # Example to exercize data 4 | # polymorphic list: specialized map on list 5 | 6 | data list a := 7 | | Nil 8 | | Cons a (list a). 9 | 10 | data nat := 11 | | Z 12 | | S nat. 13 | 14 | val f : nat -> nat. 15 | 16 | val map_f : list nat -> list nat. 17 | 18 | assert forall n. f n = S n. 19 | 20 | rewrite map_f (Nil _) = Nil _. 21 | rewrite forall x l. map_f (Cons _ x l) = Cons _ (f x) (map_f l). 22 | 23 | def two : nat := S (S Z). 24 | def three : nat := S two. 25 | def four : nat := S three. 26 | def five: nat := S four. 27 | def six : nat := S five. 28 | 29 | goal 30 | map_f (Cons _ two (Cons _ three (Cons _ four (Nil _)))) = 31 | Cons _ three (Cons _ four (Cons _ five (Nil _))). 32 | 33 | 34 | -------------------------------------------------------------------------------- /portfolio/fo/fo4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # $1: File name 4 | # $2: Extra options 5 | 6 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 7 | 8 | ulimit -t $2 9 | 10 | $DIR/../zipperposition ${1:+"$1"} \ 11 | -i tptp \ 12 | -o tptp \ 13 | --timeout "$2" \ 14 | --kbo-weight-fun=docc --mode=fo-complete-basic \ 15 | -q "7|prefer-sos|pnrefined(2,1,1,1,2,2,2)" \ 16 | -q "4|prefer-short-trail|orient-lmax(2,1,2,1,1)" \ 17 | -q "1|prefer-processed|fifo" \ 18 | -q "7|prefer-ground|conjecture-relative-var(1,l,f)" \ 19 | -q "6|defer-sos|conjecture-relative-var(1.03,s,f)" \ 20 | --select=e-selection7 --recognize-injectivity=true \ 21 | --sine=50 --sine-tolerance=1.5 --sine-depth-max=2 --sine-depth-min=1 \ 22 | "${@:3}" 23 | -------------------------------------------------------------------------------- /examples/ind/demo_filter_length_lesseq.smt2: -------------------------------------------------------------------------------- 1 | 2 | ; expect: unsat 3 | 4 | (declare-datatypes (a) 5 | ((list (nil) (cons (head a) (tail (list a)))))) 6 | 7 | (define-fun-rec 8 | (par (a) 9 | (filter 10 | ((x (=> a Bool)) (y (list a))) (list a) 11 | (match y 12 | (case nil (as nil (list a))) 13 | (case (cons z xs) 14 | (ite (@ x z) (cons z (filter x xs)) (filter x xs))))))) 15 | 16 | (define-fun-rec 17 | (par (a) 18 | (length 19 | ((l (list a))) Int 20 | (match l 21 | (case nil 0) 22 | (case (cons x l2) (+ 1 (length l2))))))) 23 | 24 | (assert-not 25 | (par (a) 26 | (forall ((p (=> a Bool)) (xs (list a))) 27 | (<= (length (filter p xs)) (length xs))))) 28 | 29 | (check-sat) 30 | -------------------------------------------------------------------------------- /src/prover_calculi/heuristics.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Heuristics} *) 5 | 6 | open Libzipperposition 7 | 8 | val enable_depth_limit : int -> unit 9 | (** Set a maximal depth for terms. Any clause with a term deeper than 10 | this limit will be dismissed. 11 | 12 | This breaks completeness in general, but can be very useful in 13 | practice. *) 14 | 15 | (** {2 Rules} *) 16 | 17 | module type S = sig 18 | module Env : Env.S 19 | module C : module type of Env.C 20 | module PS : module type of Env.ProofState 21 | 22 | val register : unit -> unit 23 | end 24 | 25 | module Make(E : Env.S) : S with module Env = E 26 | 27 | val extension : Extensions.t 28 | -------------------------------------------------------------------------------- /examples/ind/list15_arith.zf: -------------------------------------------------------------------------------- 1 | 2 | # expect: unsat 3 | 4 | val term : type. 5 | data list := nil | cons term list. 6 | val append : list -> list -> list. 7 | val length : list -> int. 8 | assert (length nil) = 0. 9 | assert 10 | forall (X:term). 11 | (forall (L:list). ((length (cons X L)) = (1 + (length L)))). 12 | assert forall (L:list). ((append nil L) = L). 13 | assert 14 | forall (X:term). 15 | (forall (L:list). 16 | (forall (L2:list). ((append (cons X L) L2) = (cons X (append L L2))))). 17 | assert (length nil) = 0. 18 | assert 19 | forall (X:term). 20 | (forall (L:list). ((length (cons X L)) = (1 + (length L)))). 21 | goal 22 | forall (L1:list). 23 | (forall (L2:list). 24 | ((length (append L1 L2)) = ((length L1) + (length L2)))). 25 | -------------------------------------------------------------------------------- /portfolio/fo/fo14.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # $1: File name 4 | # $2: Extra options 5 | 6 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 7 | 8 | ulimit -t $2 9 | 10 | $DIR/../zipperposition ${1:+"$1"} \ 11 | -i tptp \ 12 | -o tptp \ 13 | --timeout "$2" \ 14 | --mode=fo-complete-basic --simultaneous-sup=true --prec-gen-fun=invfreq\ 15 | -q "1|prefer-sos|conjecture-relative-e(0.5,0.5,100,100,100,100,1.5,1.5,1.0)"\ 16 | -q "4|const|conjecture-relative-e(0.1,0.5,100,100,100,100,1.5,1.5,1.5)"\ 17 | -q "1|prefer-processed|fifo"\ 18 | -q "1|prefer-non-goals|conjecture-relative-e(0.5,0.5,100,100,100,100,1.5,1.5,1.0)"\ 19 | -q "4|prefer-sos|pnrefined(3,2,3,2,2,1.5,2)"\ 20 | --select=e-selection12 --ord=derived_ho_rpo -o tptp "${@:3}" 21 | -------------------------------------------------------------------------------- /portfolio/fo/fo2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # $1: File name 4 | # $2: Extra options 5 | 6 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 7 | 8 | ulimit -t $2 9 | 10 | $DIR/../zipperposition ${1:+"$1"} \ 11 | -i tptp \ 12 | -o tptp \ 13 | --timeout "$2" \ 14 | --mode=fo-complete-basic --kbo-weight-fun-from-precedence=true --simultaneous-sup=true --prec-gen-fun=invfreq_conj \ 15 | -q "10|prefer-sos|pnrefined(1,1,1,2,2,2,0.5)" \ 16 | -q "10|prefer-non-goals|pnrefined(2,1,1,1,2,2,2)" \ 17 | -q "5|const|orient-lmax(2,1,2,1,1)" \ 18 | -q "1|const|fifo" \ 19 | --select=e-selection11 \ 20 | --sine=100 --sine-tolerance=3 --sine-depth-max=3 --sine-depth-min=1 \ 21 | --ord=lambdafree_rpo --local-rw=green-context \ 22 | "${@:3}" 23 | 24 | -------------------------------------------------------------------------------- /portfolio/fo/fo7.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # $1: File name 4 | # $2: Extra options 5 | 6 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 7 | 8 | ulimit -t $2 9 | 10 | $DIR/../zipperposition ${1:+"$1"} \ 11 | -i tptp \ 12 | -o tptp \ 13 | --timeout "$2" \ 14 | --mode=fo-complete-basic --prec-gen-fun=invfreq_conj \ 15 | -q "5|prefer-goals|pnrefined(1,1,1,2,2,2,0.5)" \ 16 | -q "10|prefer-non-goals|pnrefined(2,1,1,1,2,2,2)" \ 17 | -q "5|const|orient-lmax(2,1,2,1,1)" \ 18 | -q "4|const|diversity-weight(1,1,1.5,1,1,-1.000000,0.000000,1.000000,1.000000)" \ 19 | --select=e-selection15 \ 20 | --sine=100 --sine-tolerance=3 --sine-depth-max=3 --sine-depth-min=1 \ 21 | --ord=lambdafree_rpo --local-rw=green-context \ 22 | "${@:3}" 23 | 24 | -------------------------------------------------------------------------------- /src/core/Output_format.ml: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Output Format} *) 5 | 6 | type t = 7 | | O_none 8 | | O_normal 9 | | O_tptp 10 | | O_zf 11 | 12 | let normal : t = O_normal 13 | let tptp : t = O_tptp 14 | let zf : t = O_zf 15 | let none : t = O_none 16 | let default : t = normal 17 | 18 | let pp out (i:t) = match i with 19 | | O_tptp -> CCFormat.string out "tptp" 20 | | O_zf -> CCFormat.string out "zf" 21 | | O_none -> CCFormat.string out "none" 22 | | O_normal -> CCFormat.string out "normal" 23 | 24 | (** Prefix to use for line comments *) 25 | let comment_prefix = function 26 | | O_tptp -> "% " 27 | | O_normal 28 | | O_zf -> "# " 29 | | O_none -> "" 30 | -------------------------------------------------------------------------------- /examples/rewrite4.zf: -------------------------------------------------------------------------------- 1 | # expect: unsat 2 | 3 | # exercize rewriting 4 | 5 | val set : type -> type. 6 | 7 | val[infix "∈"] mem : pi a. a -> set a -> prop. 8 | val[infix "∪"] union : pi a. set a -> set a -> set a. 9 | val[infix "⊆"] subeq : pi a. set a -> set a -> prop. 10 | 11 | rewrite 12 | forall a s1 s2 x. 13 | mem a x (union a s1 s2) <=> mem a x s1 || mem a x s2. 14 | 15 | rewrite 16 | forall a s1 s2. 17 | subeq a s1 s2 <=> (forall x. mem a x s1 => mem a x s2). 18 | 19 | rewrite 20 | forall a (s1 s2 : set a). 21 | s1 = s2 <=> (subeq s1 s2 && subeq s2 s1). 22 | 23 | goal 24 | forall a (S1 S2 S3 S4 S5 S6 : set a). 25 | (union S1 (union S2 (union S3 (union S4 (union S5 S6))))) = 26 | (union S6 (union S5 (union S4 (union S3 (union S2 S1))))). 27 | 28 | -------------------------------------------------------------------------------- /examples/verifast/README.org: -------------------------------------------------------------------------------- 1 | These inductive problems have been manually translated from the files 2 | [[https://github.com/verifast/verifast/blob/master/bin/list.gh][list.gh]] and [[https://github.com/verifast/verifast/blob/master/bin/listex.gh][listex.gh]] from Verifast standard library. 3 | 4 | Usage: $ make | grep -v make 5 | 6 | The definitions of the inductive datatype of lists and of some 7 | recursive functions on lists are in file [[./list.zf][list.zf]]. The various lemmas 8 | are listed in file [[./goals.org][goals.org]]. For each lemma =foo=, the [[./Makefile][Makefile]] generates 9 | two problems: 10 | - =foo_hard_pb.zf=: prove lemma =foo= from the definitions only, 11 | - =foo_easy_pb.zf=: prove lemma =foo= from the definitions and assuming all previous lemmas. 12 | -------------------------------------------------------------------------------- /src/prover/clause.mli: -------------------------------------------------------------------------------- 1 | 2 | (* This file is free software, part of Zipperposition. See file "license" for more details. *) 3 | 4 | (** {1 Clauses} *) 5 | 6 | (** The clauses are hashconsed within a context (an application of {!Make}). 7 | Now clauses also have a {b trail}, that is, a set of boolean literals 8 | that it depends upon as a conditional guard. *) 9 | 10 | open Logtk 11 | 12 | val stat_clause_create : Util.stat 13 | 14 | module type S = Clause_intf.S 15 | 16 | (** Bundle of clause sets *) 17 | type 'c sets = { 18 | c_set: 'c CCVector.ro_vector; (** main set of clauses *) 19 | c_sos: 'c CCVector.ro_vector; (** set of support *) 20 | } 21 | 22 | (** {2 Clauses that depend on a Context} *) 23 | 24 | module Make(Ctx : Ctx.S) : S with module Ctx = Ctx 25 | --------------------------------------------------------------------------------