Abstract
AbstractThom Frühwirth presented a short, elegant, and efficient Prolog program for thenqueens problem. However, the program may be seen as rather tricky and one may not be 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, that is 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.
Highlights
Thom Fruhwirth (1991) presented a short, elegant, and efficient Prolog program for the n queens problem
This paper provides proofs of correctness and completeness of the n queens program; the proofs are declarative, that is they abstract from any operational semantics
We show that the head is as described by the specification, that is, it is in (9)
Summary
Thom Fruhwirth (1991) presented a short, elegant, and efficient Prolog program for the n queens problem. It should be useful to explain the program declaratively and to provide formal proof that it is correct. One needs the program to be complete, that is to produce all the results required by the specification. (In particular, the empty program producing no answers is correct whatever the specification is.). This paper provides proofs of correctness and completeness of the n queens program; the proofs are declarative, that is they abstract from any operational semantics. Proofs of correctness and completeness of the program are subjects of, respectively, Sections 5 and 6.
Published Version (Free)
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have