C H A P T E R  1
Introduction

1.1 Introduction

Logic Programming is a style of programming based on Symbolic Logic, and programs written in this style are called logic programs. A logic program is a set of logical sentences that describe an application environment and, where appropriate, the desired behavior of a system operating in that environment.

Logic Programming is often said to be declarative or descriptive and contrasts with the imperative or prescriptive approach to programming associated with traditional programming languages.

In imperative / prescriptive programming, the programmer provides a detailed operational program for a system in terms of internal processing details (such as data declarations, variable assignments, explicit loops, and so forth). In traditional programming, programmers typically take into account information about the intended environment and desired behavior of their programs but that information is rarely recorded explicitly in the resulting programs.

In declarative / descriptive programming, programmers explicitly encode information about the environment and the desired behavior, but they do not specify details of internal operation, leaving it to the systems that execute those programs to decide on those details on their own.

In this regard, a logic program is more of a specification than an implementation. This has various benefits. Logic programs are usually easier to understand than traditional programs. Moreover, they are easier to produce and to modify. In writing or modifying logic programs, programmers can get by with little or no knowledge of the capabilities and limitations of the systems executing those programs.

1.2 Types of Logic Programming

Over the years, numerous variations of Logic Programming have been explored (e.g. Abductive Logic Programming, Inductive Logic Programming, and Answer Set Programming), and a variety of different Logic Programming languages have been developed (e.g. Datalog and Prolog and Golog). In this paper, we focus on an elementary form of Logic Programming, called Basic Logic Programming, and we describe a corresponding language, called Epilog.

In Basic Logic Programming, the states of the application environment are modeled as instances of a database, and logic programs take the form of rules that can be applied to these instances. The program's rules define views of these instances, static constraints that specify which instances are possible, and dynamic constraints that specify how the database changes over time or in response to external inputs.

1.3 Reading Guide

This volume is a brief introduction to Basic Logic Programming. In the next chapter, we talk about datasets, i.e. sets of simple facts. After that, we introduce logic programs, i.e. definitions of relations in terms of other relations. We then show how to combine datasets and view definitions to form deductive databases. Finally, we introduce transition rules and dynamic logic programs.