A Logic Programming and Verification System for Recursive Quantificational Logic

Frank M. Brown, Peiya LiuIJCAI 1985

Abstract

This paper presents Quantified Computational Logic (QCL), a logic programming system designed to overcome the limitations of standard unification-based languages like Prolog. By replacing traditional unification with quantifier elimination and integrating formal axiomatization, QCL provides a unified environment for both program execution and formal verification. The system supports recursive data structures through the Shell Principle and ensures consistency via the Safe Definition Principle. We demonstrate that QCL correctly handles logical negation and enables automated verification of program properties through generalized Noetherian induction, allowing for the development of programs that are correct by construction.

1. Introduction

In the early 1980s, logic programming was synonymous with Prolog, a language built upon the Herbrand-Prawitz-Robinson unification algorithm. While Prolog revolutionized the field by treating logic as a programming language, it introduced several technical compromises—most notably "negation as failure"—that created a gap between logical specifications and executable code. Furthermore, the process of verifying that a logic program met its formal specification remained a separate, often arduous task.

Quantified Computational Logic (QCL) was developed to bridge this gap. By utilizing a single symbolic evaluator for both execution and verification, QCL allows developers to write programs where the act of execution is indistinguishable from the act of logical deduction. This paper outlines the theoretical foundations of QCL and its implementation as a functional-relational hybrid system.

2. The Limitations of the Prolog Paradigm

The motivation for QCL stems from three primary "sharp edges" in traditional logic programming:

  1. Negation as Failure: Prolog assumes a statement is false if it cannot be proven true. This non-monotonic reasoning often leads to incorrect results when dealing with non-ground terms (variables not yet bound to specific values).
  2. The Verification Gap: There is typically no formal link between a program's source code and its mathematical specification, making automated proof of correctness difficult.
  3. Rigid Paradigms: Developers are often forced to choose between functional programming (ideal for deterministic tasks) and relational programming (ideal for non-deterministic search), even though many problems require a mixture of both.

3. The QCL Framework: Methods and Principles

The core of QCL is a symbolic evaluator that replaces standard unification with a more robust logical framework. The system is built on several key technical components:

3.1 Quantifier Elimination and Symmetric Logic

Rather than matching terms via unification, QCL employs "Symmetric Logic" to push quantifiers (such as "for all" or "there exists") to their lowest possible scope. This allows the system to eliminate quantifiers during evaluation, providing a more mathematically sound treatment of variables.

3.2 The Shell Principle and Safe Definitions

Borrowed from the Boyer-Moore theorem prover, the Shell Principle allows users to define recursive data structures (e.g., Lists, Trees) with built-in axioms for construction and recognition. To prevent the definition of infinite loops or logical contradictions, the Safe Definition Principle performs logic checking during the definition phase to ensure termination and consistency.

3.3 Generalized Noetherian Induction

To facilitate verification, QCL utilizes a robust mathematical framework for induction. This allows the system to automatically prove properties about recursive functions, even when those functions contain complex quantifiers in their definitions.

4. Execution as Deduction

In QCL, running a program is literally the same process as deducing a result from axioms. This unified approach provides several advantages:

  • True Logical Negation: QCL handles the NOT operator correctly. When queried about a variable that is not equal to a certain value, QCL can return a logical constraint (e.g., "Z is any value except 'MANY'") rather than simply failing.
  • Functional-Relational Hybridization: Deterministic tasks (like arithmetic) can be written as functions, while non-deterministic tasks (like linguistic parsing) are written as relations. QCL allows these to interoperate without the "assembler-like" clutter of temporary variables required in pure relational logic.
  • Quantifiers in Code: Developers can use ALL and EXISTS directly within function definitions, with the system's induction principle handling the subsequent verification.

5. Evaluation and Results

The QCL prototype, implemented in Interlisp, was evaluated using classic logic programming benchmarks and recursive data structure challenges, such as the ADJDL (adjective different list) and DIFFL functions.

Key results include:

  • Soundness: QCL correctly processed queries involving negation and variables that caused Prolog's negation-as-failure mechanism to produce errors or incorrect proofs.
  • Automated Verification: The system successfully generated mechanical proofs for program properties, such as the equivalence of different list-processing functions, by unrolling definitions and applying automated induction schemes.
  • Unified Specification: The authors demonstrated that high-level specifications and executable programs can exist within the same logical framework, allowing for direct object-level deduction between the two.

6. Conclusion and Future Work

QCL represents a significant step toward a "correct by construction" programming environment. By unifying the interpreter and the verification engine, it removes the traditional barriers between writing code and proving its correctness. However, this logical rigor comes with increased computational complexity; quantifier elimination is more expensive than simple unification. Future work focuses on developing more efficient inference systems and compilers to make this formal approach practical for large-scale applications, as well as refining the heuristics used in automated induction proofs.

Summary updated

BibTeX
@inproceedings{brown1985logic,
  author = {Frank M. Brown and Peiya Liu},
  title = {{A Logic Programming and Verification System for Recursive Quantificational Logic}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {1985},
}
Figure