The logic programming language that thinks in relations, not instructions

The logic programming language that thinks in relations, not instructions
Image: Intellect (generated)

In short: Most programming languages tell a computer exactly what steps to take. Prolog is different. It uses first-order logic to define facts and rules, allowing you to simply ask questions. By describing what is true, you let the engine discover the answers through a process of logical deduction.

Developed around 1972 by Alain Colmerauer and Philippe Roussel at the University of France's Aix-Marseille II, Prolog (an abbreviation for Programmation en logique) was designed to bridge the gap between declarative knowledge and procedural execution. While many modern languages are imperative, Prolog is primarily declarative. Instead of writing a sequence of commands, a programmer defines a set of relations using facts and rules. A computation is then triggered by running a query over these relations.

The engine operates through a mechanism called SLD resolution, utilizing a strategy known as chronological backtracking. When the system encounters a goal, it searches for matching clause heads. If a path fails, the system undo and reverts variable bindings to the most recent choice-point to try an alternative. This allows for powerful, non-deterministic evaluation, where a single query can return multiple valid answers by enumerating all possibilities through the search process.

Despite its power in fields like natural language processing and expert systems, Prolog faces practical hurdles. It has been criticized for a performance penalty compared to conventional languages, often requiring 'cuts'—constructs that break the language's pure logic to improve efficiency. While it has not dominated the general computer industry, its influence persists in specialized domains. For instance, IBM's Watson utilized Prolog for pattern matching over natural language parse trees, leveraging the language's ability to express complex rules with simplicity and expressiveness.

Opens the Intellect+ feed with this card first. Swipe up for the next one.

Sources

  • Summary by Intellect · source: Prolog

To cite this card, link to https://intellectplus.co.uk/app/culture-prolog.

How we source, check and correct cards: Editorial standards.

General information, not professional advice. Spotted an error? Flag the card or see corrections and complaints.

Intellect Plus is a visual educational discovery platform for exploring fascinating facts and ideas. Brain Food, Not Brain Rot. What is Intellect Plus?

Related

Finding something worth knowing…