English

On correctness of an n queens program

Logic in Computer Science 2020-07-21 v5 Programming Languages Software Engineering

Abstract

Thom Fr\"uhwirth presented a short, elegant and efficient Prolog program for the n queens problem. However the program may be seen as rather tricky and one may be not convinced about its correctness. This paper explains the program in a declarative way, and provides proofs of its correctness and completeness. The specification and the proofs are declarative, i.e. they abstract from any operational semantics. The specification is approximate, it is unnecessary to describe the program's semantics exactly. Despite the program works on non-ground terms, this work employs the standard semantics, based on logical consequence and Herbrand interpretations. Another purpose of the paper is to present an example of precise declarative reasoning about the semantics of a logic program.

Keywords

Cite

@article{arxiv.1909.07479,
  title  = {On correctness of an n queens program},
  author = {Włodzimierz Drabent},
  journal= {arXiv preprint arXiv:1909.07479},
  year   = {2020}
}

Comments

14 pages, 1 figure. This version: various modifications, mainly in Section 3

R2 v1 2026-06-23T11:17:16.136Z