We present the interactions with an LLM (Large Language Model) aiming at proving that the square root of 2 is not a rational number in an LP (Logic Programming) context. We start from a few basic pure logic programming predicate definitions. We rely on the LPTP (Logic Program Theorem Prover) system for stating and proving properties about logic programs. As the proof language of LPTP is based on natural deduction, the proofs are human readable. In our case study, we sketch in LPTP the usual proof showing the irrationality of the square root of 2. Then we describe the interactions we had with the LLM. We end up with a complete formal proof, partially generated by an LLM and fully proof-checked by LPTP.
Abstract interpretation-based verification is a central component of the Ciao Prolog system, enabling expressive specifications of properties of programs, predicates, and execution states. Independently, the LPTP (Logic Programming Theorem Proving) framework offers a first-order logical formalism for expressing and proving properties of predicates. In this paper, we address a fundamental issue in relating these two frameworks: studying the translation of Ciao assertions into LPTP formulae and identifying a partial correspondence between assertion-based and logic-based specifications. We introduce a systematic translation scheme, characterize assertion classes according to their logical encodability, and propose approximation strategies and auxiliary constructs for non-translatable cases, and finally analyze the resulting soundness and completeness trade-offs. We argue that our proposal enables a tight integration of Ciao's assertion checking with LPTP-based deductive verification, thereby leveraging their complementary capabilities.
Ninety-Nine Prolog Problems (P-99) is a famous set of Prolog exercises. We solved the first thirty three just by prompting an LLM (Large Language Model). We used Claude from Anthropic. By solved we mean: generate the Prolog code and a test file, run the tests and check whether they pass, then formally prove types, groundness, termination, uniqueness, existence and also sometimes functional correctness with LPTP (Logic Program Theorem Prover). Hence our approach is an experiment in vibe-coding/vericoding of P-99. It is a vibe-coding experiment because we started from informal specifications written in English and let Claude generate the Prolog code. It also fits within vericoding because the LLM proved reliability guarantees on the generated Prolog code. Claude wrote 58 logic procedures, 508 tests, 257 lemmas for a total of 11800 proof lines. We manually checked each file generated by the LLM. We checked the Prolog code, ran the tests, examined the logical statements generated by Claude and proof-checked Claude's proofs with LPTP. This paper describes this experiment and provides the main details so that it can be reproduced by the interested reader.
In this paper, we are interested in the combination of abstract interpretation and interactive theorem proving, which stand at the opposite ends of the program verification automation spectrum. Our idea is to take advantage of the respective strengths of these two techniques. As a first case study, we focus on groundness analysis of logic programs. Using the proof assistant LPTP (Logic Program Theorem Prover), we automate the formal certification of groundness invariants generated by abstract interpretation. We present an experimental evaluation of our approach by applying it to a set of logic programs. Our experiments are twofold. On the one hand, to certify groundness invariants we use automated theorem provers drawing on the theoretical framework of LPTP. On the other hand, we generate and certify natural deduction proofs of groundness invariants with the proof checker of LPTP.
LPTP (Logic Program Theorem Prover) is an interactive natural-deduction-based the- orem prover for pure Prolog programs with negation as failure, unification with the occurs check, and a restricted but extensible set of built-in predicates. With LPTP, one can formally prove termination and partial correctness of such Prolog programs. LPTP was designed in the mid 90’s by Robert F. Sta ̈rk. It is written in ISO-Prolog and comes with an Emacs user-interface.From a theoretical point of view, in his publications about LPTP, Sta ̈rk associates a set of first-order axioms IND(P) to the considered Prolog program P. IND(P) contains the Clark’s equality theory for P, definitions of success, failure and termination for each user-defined logic procedure in P , axioms relating these three points of view, and an axiom schema for proving inductive properties. LPTP is thus a dedicated proof editor where these axioms are hard-wired.We propose to explicit these axioms as first-order formulas (FOFs), and apply auto- mated theorem provers to check the property of interest. Using FOF as an intermediary language, we experiment the use of automated theorem provers for Prolog program veri- fication. We evaluate the approach over a benchmark of about 400 properties of Prolog programs from the library available with LPTP. Both the compiler which generates a set of FOF files from a given input Prolog program together with its properties and the benchmark are publicly available.
This report contains the proceedings of the 19th International Workshop on Termination (WST 2023), which was held in Obergurgl during August 24--25 as part of Obergurgl Summer on Rewriting (OSR 2023).
Concolic testing combines symbolic and concrete execution to generate test cases that achieve a good program coverage. Its benefits have been demonstrated for more than 15 years in the case of imperative programs. In this work, we present a concolic-based test generation tool for logic programs which exploits SMT-solving for constraint resolution.
Concolic testing is a popular software verification technique based on a combination of concrete and symbolic execution. Its main focus is finding bugs and generating test cases with the aim of maximizing code coverage. A previous approach to concolic testing in logic programming was not sound because it only dealt with positive constraints (by means of substitutions) but could not represent negative constraints. In this paper, we present a novel framework for concolic testing of CLP programs that generalizes the previous technique. In the CLP setting, one can represent both positive and negative constraints in a natural way, thus giving rise to a sound and (potentially) more efficient technique. Defining verification and testing techniques for CLP programs is increasingly relevant since this framework is becoming popular as an intermediate representation to analyze programs written in other programming paradigms.
Concolic testing is a popular dynamic validation technique that can be used for both model checking and automatic test case generation. We have recently introduced concolic testing in the context of logic programming. In contrast to previous approaches, the key ingredient in this setting is a technique to generate appropriate run-time goals by considering all possible ways an atom can unify with the heads of some program clauses. This is called "selective" unification. In this paper, we show that the existing algorithm is not complete and explore different alternatives in order to have a sound and complete algorithm for selective unification.
Floating-point numbers are used in a wide variety of programs, from numerical analysis programs to control command programs. However floating-point computations are affected by rounding errors that render them hard to be verified efficiently. We address in this paper termination proving of an important class of programs that manipulate floating-point numbers: the simple floating-point loops. Our main contribution is an optimal approximation to the rationals that allows us to efficiently analyze their termination.
This book constitutes the thoroughly refereed post-conference proceedings of the 26th International Symposium on Logic-Based Program Synthesis and
Termination of loops can be inferred from the existence of linear ranking functions. We already know that the existence of these functions is PTIME decidable for simple rational loops. Since very recently, we know that the problem is coNP-complete for simple integer loops. We continue along this path by investigating programs dealing with floating-point computations. First, we show that the problem is at least in coNP for simple floating-point loops. Then, in order to work around that theoretical limitation we present an algorithm which remains polynomial by sacrificing completeness. The algorithm, based on the Podelski-Rybalchenko algorithm, can also synthesize in polynomial time the linear ranking functions it detects. To our knowledge, our work is the first adaptation of this well-known algorithm to floating-points.
Algorithm recognition, which is the problem of verifying whether a program implements a given algorithm, is an important topic in program analysis. We propose an approach for algorithm recognition in binary code. For this paper, we have chosen the Dalvik Virtual Machine (DVM) bytecode. Given an algorithm A that is compiled into a DVM method M0, and a DVM program P that includes a series of methods {M1,..., Mn}, the approach is able to identify those blocks Mi from P that essentially implement the algorithm A. The technique we propose first translates binary code into Horn clauses. Then we consider programs as implementing the same algorithm if their Horn clause representations can be reduced to a single common set of Horn clauses by means of a sequence of transformations.
Analysis of oating-point programs is a topic that received an increasing attention the past few years. However, only very few works have been done regarding their termination analysis. We address that problem in this paper. We present a technique that takes advantage of the already existing works on termination analysis of rational programs. Our approach consists in translating the oating-point programs into rational ones by means of sound approximations. We approximate the oating-point expressions using piecewise linear functions. Our approximation differs from the already existing ones in the sense that it can be as precise as needed.
In this section, we show a summary of our preliminary research on extending concolic execution to deal with full Prolog. First, we consider the extension of the concrete semantics. Here, we mostly follow the linear semantics of (Ströder et al. 2011), being the main differences that we consider built-ins explicitly, we excluded dynamic predicates for simplicity —but could be added along the lines of (Ströder et al. 2011)— and that, analogously to what we did in Section 2, only the first answer for the initial goal is considered. In the following, we let the Boolean function defined return true when its argument is an atom rooted by a defined predicate symbol, and false otherwise (i.e., a built-in). Moreover, for evaluating relational and arithmetic expressions, we assume a function eval such that, given an expression e, eval(e) either returns the evaluation of e (typically a number or a Boolean value) or the special constant error when the expression is not instantiated enough to be evaluated. E.g., eval(2 + 2) = 4, eval(3 > 1) = true, but eval(X > 0) = error. The transitions rules are shown in Figure A 1. In the following, we briefly explain the novelties w.r.t. the rules of Section 2:
We consider the termination/non-termination property of a class of loops. Such loops are commonly used abstractions of real program pieces. Second-order logic is a convenient language to express non-termination. Of course, such property is generally undecidable. However, by restricting the language to known decidable cases, we exhibit new classes of loops, the non-termination of which is decidable. We present a bunch of examples.
The termination competition focuses on automated termination analysis for all kinds of programming paradigms, including categories for term rewriting, imperative programming, logic programming, and functional programming. Moreover, the competition also features categories for automated complexity analysis. In all categories, the competition also welcomes the participation of tools providing certified proofs. The goal of the termination competition is to demonstrate the power of the leading tools in each of these areas.
Peter Stuckey合作论文数Faculty of Information Technology, Monash University3
Pedro López合作论文数IMDEA Software Institute1