DELAPARRA
Index
Color
NL
Category: Programming paradigms

Logic Programming

Explained by Updated

What is Logic Programming?

Logic Programming: Instead of writing an algorithm, you declare facts and rules of inference. You then pose a query, and the runtime performs an automatic search (with backtracking) to find bindings that make the query true. Logic programming describes a problem as facts and rules, then asks questions. The system searches for answers automatically, trying possibilities and backtracking when one fails. Prolog is the classic logic language.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about Logic Programming

How is Logic Programming used in practice?

You say what is true, such as "a grandparent is a parent of a parent", and the engine works out who is whose grandparent. You do not write the search yourself.

What should you keep in mind with Logic Programming?

It suits problems full of rules and relationships: configuration checking, scheduling, type systems and expert systems. Mainstream web development rarely uses Prolog directly, but the ideas appear in SQL, in rule engines for pricing and permissions, and in tools like Datalog. When business rules become a tangle of nested if statements, a rule-based approach is worth considering.

At a glance

CategoryProgramming paradigms
Explained by
Updated

More Programming paradigms terms

All terms starting with L

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.