O'Reilly logo

Logic for Computer Science and Artificial Intelligence by Ricardo Caferra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6

Foundations of Logic Programming

6.1. Specifications and programming

The most important task of a programmer (at least till now) can be characterized as filling the gap g below:

Specification of a problem (Cannot be run) ← g → Program (Can be run)

Logic programming (LP) tends to reduce this gap (and possibly obtain g = 0) when the specification is given in a logical language (or a language close to a logical one).

It envisions calculus as a controlled deduction. This is related to the paradigm:

equ213_01.gif

In LP, the emphasis is put on what the program computes and paying as little attention as possible to how it computes. It is a declarative form of programming (as opposed to imperative programming).

We give a first glimpse of such a type of programming.

EXAMPLE 6.1.– Imagine that in the following graph, we want to know whether there are paths from A to I, and if so, which ones.

equ214_01.gif

a) We describe the graph using a unary predicate (which corresponds to a property).

Att(x): x is attainable

Premises

Att(A); % Must not be forgotten!

equ214_02.gif

The conclusion:

equ214_03.gif

Two essential questions:

i) which inference ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required