A Verified Simple Prover for First-Order Logic Jørgen Villadsen, Anders Schlichtkrull, and Andreas Halkjær From DTU Compute, AlgoLoG, Technical University of Denmark, 2800 Kongens Lyngby, Denmark jovi@dtu.dk Abstract. We present a simple prover for first-order logic with certified soundness and completeness in Isabelle/HOL, taking formalizations by Tom Ridge and others as the starting point, but with the aim of using the approach for teaching logic and verification to computer science stu- dents at the bachelor level. The prover is simple in the following sense: It is purely functional and can be executed with rewriting rules or as code generation to a number of functional programming languages. The prover uses no higher-order functions, that is, no function takes a function as argument or returns a function as its result. This is advantageous when students perform rewriting steps by hand. The prover uses the logic of first-order logic on negation normal form with a term language consist- ing of only variables. This subset of the full syntax of first-order logic allows for a simple proof system without resorting to the much weaker propositional logic. 1 Introduction Our motivation is in some ways similar to the development of lean theorem provers like leanTAP and leanCoP [4], although with more focus on the use in teaching and less focus on reaching considerable performance. In contrast to leanTAP and leanCoP we also require formal verification of the soundness and completeness of the prover, in our case in Isabelle/HOL [3]. The development described in this paper is available online: https://bitbucket.org/isafol/isafol/src/master/Simple_Prover/ Let us recall the following conclusions concerning leanCoP [4, p. 159]: Lean provers can easily be integrated and modified by people who do not have a deep knowledge about fully automatic provers. Since it is much easier (and faster) to understand a few lines of Prolog code than several thousand lines of, e.g., C code, lean theorem provers are also very well suited for teaching purposes. Finally, for the same reason it is also much easier to verify completeness and correctness of lean theorem provers. Using ISO Prolog the compact code for leanCoP amounts to the following clauses: prove(M,I) :- append(Q,[C|R],M), \+member(-_,C), append(Q,R,S), prove([!],[[-!|C]|S],[],I). prove([],_,_,_). prove([L|C],M,P,I) :- (-N=L; -L=N) -> (member(U,P), unify_with_occurs_check(U,N); append(Q,[D|R],M), copy_term(D,E), append(A,[U|B],E), unify_with_occurs_check(U,N), append(A,B,F), (D==E -> append(R,Q,S); length(P,K), K