Questions tagged [prolog]

Prolog is the most commonly used logic programming language. It supports non-deterministic programming through chronological backtracking and pattern matching through unification. Do not use this tag like Prologue and Epilogue.

Prolog is the oldest and most popular logic programming language. Its built-in features include non-deterministic programming through backtracking and a powerful parser formalism called Definite Clause Grammars (DCG) . Modern variants often support some form of constraint programming. It is used for automated reasoning, deductive databases, planning and scheduling tasks, natural language processing, engines for web/business rules and is often used to introduce the declarative paradigm in school.

There is an ISO/IEC standard for Prolog .

Further efforts in harmonizing implementations can be found at Prolog Commons.

Prolog-related tags

Core language:

Modules:

Environment:

Arithmetics:

Puzzles:

Problems:

Implementations:

  1. SWI (free)
  2. SICStus (commercial)
  3. GNU (free)
  4. XSB (free)
  5. B (commercial, discontinued, now Picat)
  6. IF (commercial)
  7. Ciao (free)
  8. Minerva (commercial)
  9. ECLiPSe-CLP (free)
  10. Prolog IV (free)
  11. Tau (free)
  12. Scryer (free)
  13. C-Prolog
  14. trealla

free = allows commercial use without royality

Forums

Free Prolog Programming Books

Languages influenced by Prolog

Microsoft Guan

Historical Archive

Prolog and Logic Programming Historical Sources Archive

Useful links

13358 questions
147
votes
2 answers

What are the main technical differences between Prolog and miniKanren, with respect to logic programming?

When I want to read up on logic programming I always stumble over two "main" ways to do it nowadays: miniKanren, a minilanguage introduced in The Reasoned Schemer and popular at the moment due to core.logic. Prolog, the first "big" logic…
Profpatsch
  • 4,918
  • 5
  • 27
  • 32
83
votes
8 answers

Comparing SQL and Prolog

I've started learning Prolog and wondering about the theoretical difference from the SQL language. For example: both are declarative languages both support a fact-driven knowledge database both support question-styled data-retrieving both support…
user240401
78
votes
7 answers

Difference between logic programming and functional programming

I have been reading many articles trying to understand the difference between functional and logic programming, but the only deduction I have been able to make so far is that logic programming defines programs through mathematical expressions. But…
Heshan Perera
  • 4,592
  • 8
  • 44
  • 57
76
votes
10 answers

'if' in prolog?

Is there a way to do an if in prolog, e.g. if a variable is 0, then to do some actions (write text to the terminal). An else isn't even needed, but I can't find any documentation of if.
jreid9001
  • 1,207
  • 2
  • 10
  • 8
70
votes
11 answers

Good beginners material on Prolog

I am looking for good beginners material on Prolog, both online and printed. I am not only interested in 'learning the language' but also in background and scientific information.
meelow
  • 861
  • 1
  • 7
  • 10
59
votes
5 answers

Haskell vs. Prolog comparison

What kind of problems is better solved in Prolog than in Haskell? What are the main differences between these two languages? Edit Is there a Haskell library (kind of a logical solver) that can mimic Prolog functionality?
danatel
  • 4,844
  • 11
  • 48
  • 62
57
votes
2 answers

What is the difference between ' and " in Prolog?

I am new to Prolog and noticed that ' and " give different behavior, but am curious as to why. Specifically, when loading a file, ?- ['test1.pl']. works, while ?- ["test1.pl"]. doesn't.
astay13
  • 6,857
  • 10
  • 41
  • 56
57
votes
4 answers

Rearranging variable_names

How to write in a standard conforming manner avs_term_rearranged(AVs, T, AVsR) with given AVs and T such that AVsR is a permutation of AVs with the elements arranged in same order as their variables occur in left-to-right order in T. AVs is a list…
false
  • 10,264
  • 13
  • 101
  • 209
47
votes
4 answers

Forward Chaining vs Backward Chaining

What is one good for that the other's not in practice? I understand the theory of what they do, but what are their limitations and capabilities in practical use? I'm considering Drools vs a java prolog for a new AI project, but open to other…
gtrak
  • 5,598
  • 4
  • 32
  • 41
47
votes
14 answers

What's a good Prolog IDE for Linux?

I need to write some Prolog programs for a class. Any recommendations?
Marcos Lara
  • 1,883
  • 5
  • 18
  • 20
46
votes
3 answers

Definition of a path/trail/walk

Many predicates define some kind of an acyclic path built from edges defined via a binary relation, quite similarly to defining transitive closure. A generic definition is thus called for. Note that the notions defined in graph theory do not readily…
false
  • 10,264
  • 13
  • 101
  • 209
45
votes
8 answers

How does Prolog technically work? What's under the hood?

I want to learn more about the internals of Prolog and understand how this works. I know how to use it. But not how it works internally. What are the names of the algorithms and concepts used in Prolog? Probably it builds some kind of tree structure…
45
votes
13 answers

Embedded Prolog Interpreter/Compiler for Java

I'm working on an application in Java, that needs to do some complex logic rule deductions as part of its functionality. I'd like to code my logic deductions in Prolog or some other logic/constraint programming language, instead of Java, as I…
45
votes
5 answers

Knowing when to use cut in prolog

I've took a course in which I learned some prolog. I couldn't figure out how / when to use cuts. Even though I get the general idea of cuts, I can't seem to use them properly. Can anyone explain it briefly or give a good tutorial (that's not…
matanc1
  • 6,525
  • 6
  • 37
  • 57
44
votes
5 answers

What is the logical 'not' in Prolog?

The problem that I face, is a bit trivial. I want to use logical not in Prolog, but it seems that not/1 is not the thing that I want: course(ai). course(pl). course(os). have(X,Y) :- course(X),course(Y),not(X = Y). I query: have(X,Y),…
Masood Delfarah
  • 687
  • 3
  • 7
  • 13
1
2 3
99 100