Search⌘ K

Understanding Logic Programming

Explore the logic programming paradigm to understand how programs use formal logic with facts, rules, and variables. Learn to define relationships and solve queries using predicates, and recognize key languages that support this unique paradigm.

We'll cover the following...

Logic programming

The logic programming paradigm is not as widely used as the ones we’ve discussed previously, but it has some interesting concepts. Logic programming is based on formal logic. A program written in a language that implements this paradigm is constructed of a set of sentences in a logical form that will express facts and rules about a specific problem domain. This might sound complicated and strange, but as we’ll see, the basic concepts of this paradigm are rather simple. Consider the following diagram:

A family tree
A family tree

In the diagram above, we can see a family tree. Looking at it, we can see the following:

  • Anna and Bob have a child, Lisa.
  • Lisa and Fred have a child, Karen.
  • Fred and Sue
...