Skip to main content
QUICK REVIEW

[Paper Review] Logic Programming with Satisfiability

Michael Codish, Vitaly Lagoon|arXiv (Cornell University)|Feb 13, 2007
Logic, programming, and type systemsComputer Science13 references4 citations
TL;DR

This paper presents a Prolog library that integrates the MiniSat SAT solver, enabling efficient logic programming with satisfiability. By combining Prolog's symbolic manipulation with MiniSat's powerful SAT solving, the approach allows concise, high-level encoding of complex search problems—demonstrated by solving Partial MAXSAT through a clean, declarative interface that maximizes satisfiable clauses while enforcing hard constraints.

ABSTRACT

This paper presents a Prolog interface to the MiniSat satisfiability solver. Logic program- ming with satisfiability combines the strengths of the two paradigms: logic programming for encoding search problems into satisfiability on the one hand and efficient SAT solving on the other. This synergy between these two exposes a programming paradigm which we propose here as a logic programming pearl. To illustrate logic programming with SAT solving we give an example Prolog program which solves instances of Partial MAXSAT.

Motivation & Objective

  • To bridge logic programming and SAT solving by creating a seamless Prolog interface to the MiniSat solver.
  • To enable concise, high-level encoding of complex search problems using Prolog’s symbolic manipulation capabilities.
  • To solve Partial MAXSAT problems efficiently by combining hard constraints (must be satisfied) and soft constraints (to be maximized).
  • To provide a practical, educational, and extensible tool for encoding and solving propositional logic problems.

Proposed method

  • The library uses approximately 190 lines of C code and 140 lines of Prolog code to interface SWI-Prolog with the MiniSat solver.
  • It employs the Tseitin transformation to convert arbitrary propositional formulas into conjunctive normal form (CNF) with linear blowup in size.
  • The library provides predicates like solve/1, sat/1, minimize/2, and maximize/2 to handle satisfiability and optimization over Boolean variables.
  • For Partial MAXSAT, it constructs a sum formula representing the number of satisfied soft clauses and uses maximize/2 to find the optimal assignment.
  • The maximize/2 predicate performs a binary search over the bits of the sum vector using repeated SAT queries, each of size O(|Cnf|).
  • The approach leverages Prolog's pattern matching and backtracking for formula construction, while offloading the actual search to MiniSat.

Experimental results

Research questions

  • RQ1How can Prolog be effectively combined with a modern SAT solver to solve complex logic-based search problems?
  • RQ2Can a high-level Prolog interface to MiniSat enable concise and readable encoding of problems such as Partial MAXSAT?
  • RQ3What is the performance and scalability of this Prolog-SAT integration for real-world logic problems?
  • RQ4How can optimization objectives (e.g., maximizing the number of satisfied clauses) be encoded and solved efficiently within this framework?

Key findings

  • The Prolog-MiniSat interface successfully enables the encoding of complex logic problems, such as LPO termination and dependency pair analysis, using clean, declarative code.
  • The Tseitin transformation ensures that CNF conversion remains efficient, with linear blowup relative to the input formula size.
  • The maximize/2 predicate correctly identifies the assignment that satisfies the maximum number of soft clauses in Partial MAXSAT, using O(log n) SAT queries.
  • The library supports both satisfiability checking and optimization, with minimize/2 and maximize/2 providing optimal assignments over variable vectors.
  • The approach was successfully applied to solve problems in term rewrite system termination analysis, demonstrating practical utility beyond theoretical interest.
  • The interface is effective as an educational tool, helping students learn logic programming, SAT encodings, and SAT solving techniques.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.