Logic Programming

Online Computer Science Degree Guide: Logic Programming

Computer science relies on programming to allow for software to accomplish its desired functions. There are numerous programming methods for setting the guidelines for software to operate. One of the most prolific methods is logic programming. This programming method involves giving software parameters to following logical reasoning, derived largely from simple if, then statements.

Instructions are given to the software in the form of computational logic, which allows the software to determine the appropriate action to make. Instead of defining the action for the program to take, it is given rules to apply to a given situation. The program then tests  functions against these rules as it attempts to reach its built in goals. This type of method follows the declarative language, and allows greater freedom for the software. The ability to have programs make decisions is one of the main reasons why logic programming is prevalent in artificial intelligence software. Prolog is a logic programming language that is widely used in artificial intelligence and other computational procedures.

One of the first uses of mathematical logic applied to programming was in 1959, when John McCarthy wrote a paper entitled Programs with Common Sense, proposing the use of logic in machines to have them perform ‘elementary verbal reading processes’. For accomplishing this he intended to use logic stating, “The basic program will draw immediate conclusions from a list of premises. These conclusions will be either declarative or imperative sentences. When an imperative sentence is deduced the program takes a corresponding action.” Since then, logical programming has been applied in largely the manner described by McCarthy. This field of study is largely overseen and developed by academics.

As an ongoing effort to provide the best resources on logic programming, compiled below is a guide for learning how this programming language operates. The following resources include articles and research from this field of study, as well as detailed tutorials for specific, more advanced operations.

Beginner Materials

The following references are included to help the reader attain a better understanding of how logic programming, and mathematical logic work.  These sites will help to explain the reasoning and benefits of using logic for programming. Included are descriptions and overviews of logic programming, as well as resources for better understanding where logic programming fits in the field of computer science.

  • Association for Logic Programming – An organization that aims to promote the expansion of the use of logic programming. Provides a brief history and overview of logic programming.
  • Programming Language Research – A collection of resources that give an overview of programming languages. Includes a section on logic programming.

Tutorials

Beyond the simple understanding of how logic programming functions, there is a lot of code to learn. Logic programming operates largely off of set rules and facts, which are combined with functions. Tutorials can provide necessary guidelines and walkthroughs for proper coding and logical equations. The following are a selection of tutorials for chosen programming languages.

  • Tutorial for Curry – Contains advice and methodology for using the declarative programming language, ‘Curry’. This hybrid language system combines functional programming and logic programming.
  • Prolog Tutorial – A comprehensive guide to using and operating the Prolog programming system.
  • Pyke Tutorial – Pyke is an interference engine that uses Python to accomplish logic programming, operating off rules and facts. This tutorial explains how Pyke is used and includes walkthroughs of various operations.

Basic Information

As well as the basic methods and operations of logic programming it is also beneficial to learn about the background of the field. Logic programming involves more than just code, involving creativity on the part of the programmer.  These resources give perspective on how logic programming fits into programming as a whole.

  • ALP Newsletter – Features scientific articles and news from the leading logic programming association.
  • Declarative Programming – An overview of declarative programming, the category of language that logic programming is a part of.
  • Logic Programming – A detailed look at the processes and workflow of creating logic programming operations. Includes example and walkthroughs of coding processes.

Prolog

Prolog is the most widely used logic programming language and has been extensively used in artificial intelligence. This program runs a query against selected rules and facts to determine the appropriate outcome to a given input proposition. Prolog was developed by French scientist Alain Colmerauer in 1972, and has since seen a wide variety of applications. The use of Prolog is largely small scale, and its impact on the computer industry has been minimal, yet the system remains prolific due to its ability to utilize logic programming.

  • Prolog FAQ Index – Features answers to frequently asked questions about the Prolog system and logic programming in general.
  • Ciao Prolog System – Ciao is a Prolog system that features module designs, allowing for fully declarative statements and simultaneous running of multiple extensions.
  • Prolog – A comprehensive guide to programming with Prolog that covers beginner as well as advanced topics
  • Planet Prolog – A collaborative blog with advice and news for Prolog users, including coding examples and conference reports.
  • Prologomenon – Analysis and walkthroughs of interesting projects and subjects involving Prolog and logic programming.

Other Systems

While Prolog is the most popular logic programming language, there is a good deal of other systems that also prove useful for programmers. Some of these systems provide unique additions to declarative programming, while others are hybrids of several languages and systems. Below are some additional declarative based systems, which have been selected for their unique capabilities.

  • Introduction to Mercury – An overview of the logical programming language Mercury. Mercury adds advanced static analysis and error detection to declarative programming.
  • Adventures in Mercury – A companion blog for the declarative logic language Mercury. Includes walkthroughs of exercises and projects based in the language.
  • λProlog – Lambda prolog is a system developed in the 1980’s and relies on higher- intuitionistic theory. This system explores higher-order potentials of logic programming.
  • Castor: Logic Paradigm for C++ – Castor is a program that supports logic programming integrated into the C++ language, allowing for it to work alongside other language systems that operate on C++.
  • Multi-paradigm Declarative Languages – A look at the various classes of declarative programming languages, and looks into how these might be combined into a single standard language.