Questions tagged [logic-programming]

Logic Programming is a programming paradigm based on first order logic.

Logic programming is a programming paradigm which is largely based on formal logic. Any program written in a logic programming language is a set of sentences in logical form, expressing facts and rules about some problem domain. Major logic programming language families include Prolog, answer set programming (ASP) and Datalog.

231 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
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…
42
votes
1 answer

Using the "Prolog in Scala" to find available type class instances

Considering https://speakerdeck.com/folone/theres-a-prolog-in-your-scala, I would like to "abuse" the Scala type system to find all instances of e.g. CanBuildFrom that match a given criteria. Prolog style, I would evaluate something in the lines of…
40
votes
10 answers

Relational/Logic Programming in Python?

I'm a longtime python developer and recently have been introduced to Prolog. I love the concept of using relationship rules for certain kinds of tasks, and would like to add this to my repertoire. Are there any good libraries for logic programming…
AJ.
  • 27,586
  • 18
  • 84
  • 94
34
votes
2 answers

Datalog vs CLIPS vs Prolog

As many programmers I studied Prolog in university, but only very little. I understand that Prolog and Datalog are closely related, but Datalog is simpler? Also, I believe that I read that Datalog does not depend on ordering of the logic clauses,…
Eli Schneider
  • 4,903
  • 3
  • 28
  • 50
34
votes
8 answers

What are the best uses of Logic Programming?

By Logic Programming I mean the a sub-paradigm of declarative programming languages. Don't confuse this question with "What problems can you solve with if-then-else?" A language like Prolog is very fascinating, and it's worth learning for the sake…
mbac32768
  • 11,453
  • 9
  • 34
  • 40
29
votes
4 answers

Haskell's type system and logic programming - how to port Prolog programs to type level

I'm trying to understand the relation between a logic programming language(Prolog in my case) and Haskell's type system. I know both use unification and variables to find values(or types, in Haskell's type system) depending on relations. As an…
sinan
  • 6,809
  • 6
  • 38
  • 67
25
votes
13 answers

Why hasn't logic programming caught on?

As time goes by, it appears more and more like functional programming is having more of an effect on other programming languages. We're starting on Prolog in my AI class, and it seems like there are some things there that would make programming in…
Jason Baker
  • 192,085
  • 135
  • 376
  • 510
23
votes
1 answer

What type systems can prevent goal suspension in logical languages?

From section 3.13.3 of the curry tutorial: Operations that residuate are called rigid , whereas operations that narrow are called flexible. All defined operations are flexible whereas most primitive operations, like arithmetic operations, are rigid…
user82928
  • 877
  • 7
  • 16
21
votes
4 answers

What is more interesting or powerful: Curry, Mercury or Lambda-Prolog?

I would like to ask you about what formal system could be more interesting to implement from scratch/reverse engineer. I've looked through some existing and open-source projects of logical/declarative programming systems. I've decided to make up…
Bubba88
  • 1,910
  • 20
  • 44
21
votes
2 answers

Concise Explanation of Core.logic

I want to use Clojure's Core.logic. However, I want to also understand how it works. Is there a concise explanation of it somewhere? (Like implementing a metacircular evaluator?) Thanks!
user1311390
19
votes
6 answers

Newer programming language than Prolog for logic programming

Is there any newer language than Prolog specialized for logical programming?
Istvan
  • 191
  • 1
  • 3
17
votes
5 answers

Executing prolog code on an iPhone

I currently have the need to execute prolog code in an application I am making. I am aware that Apple probably never would allow something like this in the App Store, but that is not the intention either. This is more a private project that will…
Bendik
  • 928
  • 11
  • 23
17
votes
11 answers

Can you do Logic Programming in Scala?

I read somewhere that Pattern Matching like that supported by the match/case feature in Scala was actually borrowed from Logic languages like Prolog. Can you use Scala to elegantly solve problems like the Connected Graph problem? e.g.…
Alex R
  • 11,364
  • 15
  • 100
  • 180
16
votes
3 answers

What is the use of non short-circuiting boolean operators in Erlang?

I am learning Erlang from the LearnYouSomeErlang web-book. One thing that struck me while learning was the non short-circuiting boolean conjunction and disjunction operators viz; and and or. What are the use cases for these operators? Why would you…
1
2 3
15 16