Logic Programming

Logic Programming

Alfred TarskiAll logic programming languages can be generalised into a category of programming languages, called declarative languages. They share the same idea of analysing computations. The computation is satisfied by specifying the properties of the correct answer. Logic programs can be interpreted using two main concepts: truth and logical deduction.

Truth derives whether or not the computation in the program is true, under the implementation of the program symbols.

Logical Deduction determines whether a logical clause is a consequence of the program. All logical programming languages have exact operational meaning and most support the processing of finite sets. The programs themselves are instructions for execution by a compiler. These instructions are always interpreted as logical statements and clauses, and the result of the execution is a logical consequence of the computations in it. Using logical languages and any other declarative language offers three main advantages:

  • Logic programming languages are classified as high level languages as they implement computation's logic rather than mechanics. They have a powerful pattern matching mechanism as well as good memory management (stacks and pointers). This makes them ideal for expressing complex ideas and algorithms.
  • Logical programming languages allow data to be represented both extensionally and intentionally. Intentional representation can also generate related representations for example adjacency lists for easy access of the following data elements. These can be derived dynamically from configuration rules.
  • Another advantage of logic programming languages is that they are well suited for rapid interpretation of the data structure and the code to implement very complicated ideas. Due to their compact syntax and logical nature experienced programmers find the code simple to read and debug. From the programmers point of view the difficulty of coding is vagueness in human thinking. However Prolog coding is easier as the syntax is very short and precise.