Logic programming – Computing Reference – eLook.org


Logic programming



<artificial intelligence, programming, language> A declarative, relational style of programming based on first-order logic.

The original logic programming language was Prolog.

The concept is based on Horn clauses.

The programmer writes a “database” of “facts”, e.g.

wet(water).

(“water is wet”) and “rules”, e.g.

mortal(X) :- human(X).

(“X is mortal is implied by X is human”).

Facts and rules are collectively known as “clauses”.

The user supplies a “goal” which the system attempts to prove using “resolution” or “backward chaining“.

This involves matching the current goal against each fact or the left hand side of each rule using “unification“.

If the goal matches a fact, the goal succeeds; if it matches a rule then the process recurses, taking each sub-goal on the right hand side of the rule as the current goal.

If all sub-goals succeed then the rule succeeds.

Each time a possible clause is chosen, a “choice point” is created on a stack.

If subsequent resolution fails then control eventually returns to the choice point and subsequent clauses are tried.

This is known as “backtracking“.

Clauses may contain logic variables which take on any value necessary to make the fact or the left hand side of the rule match a goal.

Unification binds these variables to the corresponding subterms of the goal.

Such bindings are associated with the choice point at which the clause was chosen and are undone when backtracking reaches that choice point.

The user is informed of the success or failure of his first goal and if it succeeds and contains variables he is told what values of those variables caused it to succeed.

He can then ask for alternative solutions.

< Previous Terms Terms Containing logic programming Next Terms >
logic bomb
Logic Design Language
logic emulator
Logic for Computable Functions
logic gate
abduction
Algebraic Logic Functional language
ALLOY
Andorra-I
Andorra Kernel Language
Logic Replacement Technology
logic variable
LOGIN
login
LOGISCOPE

Best casinos
Glory Casino is one of Bangladesh's most prominent and generous online casinos, with 3,000+ slots and live games from top providers. Beginner-friendly and mobile-ready, it offers big welcome bonuses, fast payouts, and fair winning odds.
Wintomic Casino offers a calm, well-structured gaming experience with a wide range of quality slots and live games from trusted providers. With secure SSL encryption, fair RNG play, and clear bonus terms, it's built for smooth, reliable fun.
Play the best casino games on Banger Casino across mobile and desktop and win real money! Enjoy a massive slots library, live dealers, and table games, plus a 125% welcome bonus up to €250 under a valid Curaçao license. Sign up today.
Divine Casino delivers a secure, stylish gaming experience with thousands of slots, live dealers, crash games, and sports betting. Claim a generous welcome bonus with free spins, enjoy fast withdrawals, and play with 24/7 support.

© Copyright 2026 elook.games
Powered by WordPress | Mercury Theme