Nanocop: Natural Non-Clausal Theorem Proving
Total Page:16
File Type:pdf, Size:1020Kb
Proceedings of the Twenty-Sixth International Joint Conference on Artificial Intelligence (IJCAI-17) nanoCoP: Natural Non-clausal Theorem Proving Jens Otten Department of Informatics, University of Oslo, Norway jeotten@ifi.uio.no Abstract has the disjunctive normal form (quantifiers are eliminated) Most efficient fully automated theorem provers im- :P (a) _ (P (y)^:P (g(y))^Q^R) _ (P (y)^:P (g(y))^Q^:R) plement proof search calculi that require the in- _ (P (y)^:P (g(y))^:Q^R) _ (P (y)^:P (g(y))^:Q^:R) put formula to be in a clausal form, i.e. disjunc- _ P (g(g(a))) . tive or conjunctive normal form. The translation While the use of a clausal form technically simplifies the into clausal form introduces a significant overhead proof calculi and their implementations, it has some funda- to the proof search and modifies the structure of mental disadvantages. The standard translation into clausal the original formula. Translating a proof in clausal form as well as the definitional translation [Plaisted and form back into a more readable non-clausal proof Greenbaum, 1986; Eder, 1992], which introduces definitions of the original formula is not straightforward. This for subformulae, cause a significant overhead for the proof paper presents a non-clausal automated theorem search [Otten, 2010]. For example, the disjunctive normal prover for classical first-order logic. It is based on form of F#, in which some parts of the formula are copied, a non-clausal connection calculus and implemented has more than twice the size of the original formula. Further- with a few lines of Prolog code. Working entirely more, a translation into clausal form modifies the structure on the original structure of the input formula yields of the formula, hence, a translation of the clausal proof back not only a speed up of the proof search, but the re- into one of the original formula is not straightforward [Reis, sulting non-clausal proofs are also shorter. 2015]. On the other hand, proof search with more “natural” non-clausal calculi, such as sequent or standard tableau cal- 1 Introduction culi [Gentzen, 1935; Hahnle,¨ 2001] is less efficient. This paper describes the non-clausal prover nanoCoP for Automated Theorem Proving (ATP) in classical first-order classical first-order logic [Otten, 2016]. By performing the logic is a core research area in the field of Automated Rea- proof search on the original structure of the input formula, soning (see [Robinson and Voronkov, 2001] for an overview). it combines the advantages of more natural non-clausal cal- It is concerned with the question whether a conjecture H is culi with the efficiency of a goal-oriented connection-based a logical consequence of a given set of axioms G1;:::;Gn, proof search. The prover is based on a non-clausal connec- written G1;:::;Gn j= H, in which G1;:::;Gn;H are first- tion calculus [Otten, 2011] (Section 2) that generalizes the order formulae. More specifically the objective in ATP is clausal connection calculus [Bibel, 1983; 1987] and is im- to find a proof for the validity of a given formula F .A plemented in a very compact way (Section 3). It follows formula F is valid if and only if it evaluates to true for all the lean methodology already used for the clausal connec- possible interpretation of its function and predicate symbols. tion prover leanCoP, whose minimal Prolog source code is According to the Deduction Theorem (for classical logic), shown in Figure 1. An experimental evaluation (Section 4) G1;:::;Gn j= H holds if and only if there is a proof for indicates a solid performance of nanoCoP. the validity of the formula (G1 ^ ::: ^ Gn) ) H.A formal description of the proof search algorithm is usually specified prove(I,S):- \+member(scut,S) -> prove([-(#)],[],I,[],S) ; in form of a proof (search) calculus consisting of axioms and lit(#,C,_) -> prove(C,[-(#)],I,[],S). rules. Implementations of such proof calculi are called ATP prove(I,S):- member(comp(L),S), I=L -> prove(1,[]) ; (member(comp(_),S);retract(p)) -> J is I+1, prove(J,S). systems or (automated theorem) provers. prove([],_,_,_,_). Most efficient fully automated theorem provers implement prove([L|C],P,I,Q,S):- \+ (member(A,[L|C]), member(B,P), proof calculi that require the input formula to be in a clausal A==B), (-N=L;-L=N) -> ( member(D,Q), L==D ; member(E,P), unify_with_occurs_check(E,N) ; lit(N,F,H), form, i.e. disjunctive or conjunctive normal form. Formulae (H=g -> true ; length(P,K), K<I -> true ; that are not in clausal form are translated into clausal form in \+p -> assert(p), fail), prove(F,[L|P],I,Q,S) ), (member(cut,S) -> ! ; true), prove(C,P,I,[L|Q],S). a preprocessing step. For example, the formula F# P (a)^(8y(P (y))P (g(y)))_(Q)Q)_(R)R)) ) P (g(g(a))) Figure 1: Source code of the leanCoP 2.0 core prover 4924 Proceedings of the Twenty-Sixth International Joint Conference on Artificial Intelligence (IJCAI-17) 2 The Non-clausal Connection Calculus copy 2 2 z }| { 3 3 The standard notation for first-order formulae is used. Terms P (y)0 P (y0)0 (denoted by t) are built up from functions (f; g; h; i), con- 6 6 P (g(y))1 P (g(y0))1 7 7 6 1 6 7 07 stants (a; b; c), and variables (x; y; z). An atomic formula (A) 6 P (a) 6 0 1 7 P (g(g(a))) 7 6 6 Q Q 7 7 is built up from predicate symbols (P; Q; R; S) and terms; a 4 4 5 5 (first-order) formula (F; G; H) is built up from atomic formu- R0 R1 lae, the connectives :, ^, _, ), and the first-order quantifiers 8 and 9.A literal L has the form A or :A. Its complement L is A if L is of the form :A; otherwise L is :L. Figure 2: Graphical representation of a non-clausal matrix and its A term substitution σ assigns terms to variables. A for- non-clausal connection proof mula in clausal form has the form 9x1 ::: 9xn(C1 _:::_Cn), where each clause Ci is a conjunction of literals L1;:::;Lmi . A clause C contains a literal L if and only if (iff) L 2 C or It is represented as a set of clauses fC1;:::;Cng, called a C0 contains L for M 0 2 C, C02 M 0. A clause C is α-related (clausal) matrix.A polarity 0 or 1 is used to represent nega- L M 0 fC0;C00}⊆M 0 0 to a literal iff it contains a matrix with tion, i.e. literals of the form A and :A are represented by A C0;C00 C0 L C00 1 0 1 for clauses , such that contains and contains and A , respectively, A connection is a set fA ;A g of liter- C (or C=C00). A copy of the clause C in the matrix M is als with the same predicate symbol but different polarities. made by renaming all free variables in C. M[C1nC2] denotes In a non-clausal matrix, a clause consists of literals and 0 the matrix M, in which the clause C1 is replaced by C2. C (sub)matrices. Let F be a formula and pol be a polarity. The parent clause C M 0 2 C0 C 2 M 0 M 0 pol pol is a of iff and for some . non-clausal matrix M(F ) of a formula F is a set of Let M be a matrix and P ath be a set of literals. C is an clauses, in which a clause is a set of literals and matrices, and extension clause (e-clause) of the matrix M with respect to a is defined according to Table 1. In Table 1, x∗ is a new vari- ∗ ∗ ∗ set of literals P ath iff either (a) C contains a literal of P ath, able, t is the skolem term f (x1; : : : ; xn) in which f is a or (b) C is α-related to all literals of P ath occurring in M and new function symbol and x1; : : : ; xn are the free variables in if C has a parent clause, it contains a literal of P ath. In the β- 8xG or 9xG. In G[xnt] all free occurrences of x in G are clause of C2 with respect to L2, denoted by β-clauseL (C2), replaced by t. The non-clausal matrix M(F ) of a formula 2 0 L2 and clauses that are α-related to L2 are deleted from C2. F is the matrix M(F ). In the graphical representation its The non-clausal connection calculus [Otten, 2011], which clauses are arranged horizontally, while the literals and ma- is sound and complete, is shown in Figure 3. Therein, M is trices of each clause are arranged vertically. For example, the a non-clausal matrix, C is a (subgoal) clause or " (a special formula F# of Section 1 has the simplified (i.e. redundant empty symbol) and (the active) P ath is a set of literals or "; brackets are removed) non-clausal matrix M# = M(F#): σ is a term substitution. A non-clausal connection proof of ffP (a)1g; fffP (y)0;P (g(y))1gg; ffQ0g; fQ1gg; M is a non-clausal connection proof of "; M; ". ffR0g; fR1ggg; fP (g(g(a)))0gg . The analytic, i.e. bottom-up, proof search is carried out in the same way as in the clausal calculus.