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
12
votes
1 answer

How to find the optimal processing order?

I have an interesting question, but I'm not sure exactly how to phrase it... Consider the lambda calculus. For a given lambda expression, there are several possible reduction orders. But some of these don't terminate, while others do. In the lambda…
MathematicalOrchid
  • 61,854
  • 19
  • 123
  • 220
11
votes
7 answers

Non-Prolog logic programming

Are there any good non-Prolog or Prolog-based logic programming languages ? Who has or any good experience with it?
uhbif19
  • 3,139
  • 3
  • 26
  • 48
11
votes
1 answer

What syntax core.logic matche, defne pattern matching constructs use?

Some of core.logic constructs (matcha, matche, matchu, defne, fne) use pattern matching expressions as body and can be used such as: (run* [q] (fresh [a o] (== a [1 2 3 4 5]) (matche [a] ([ [1 2 . [3 4 5] ]] (== q…
kolen
  • 2,752
  • 2
  • 27
  • 35
10
votes
2 answers

Is the `append` predicate tail-recursive?

A typical code example of list processing in Prolog is append: append([], Ys, Ys). append([X | Xs], Ys, [X | Zs]) :- append(Xs, Ys, Zs). My question is whether this program is tail recursive or not. I guess not from my experience in functional…
day
  • 2,292
  • 1
  • 20
  • 23
9
votes
3 answers

Logic programming in Lua?

Is there a way to do logic programming (think of Prolog) in Lua? In particular: is there any Lua module for logic programming (miniKanren implemenatation will be the best, but it isn't strictly required)? Because I couldn't find any [1]. And if…
mnicky
  • 1,308
  • 11
  • 24
9
votes
3 answers

Breadth-First in Prolog

What is the general idea of using breadth-first over the default depth-first search scheme in Prolog? Not taking infinite branches? Is there any general way to use breadth-first in Prolog? I've been googling around and I didn't find too much useful…
Ricardo
  • 1,778
  • 1
  • 19
  • 32
9
votes
1 answer

Function Returns "No Solution" Instead Of "Nothing"

I have a standard datatype representing formulae of predicate logic. A function representing a natural deduction elimination rule for disjunction might look like: d_el p q = if p =: (Dis r s) && q =: (Neg r) then Just s else if q =: (Dis r s) &&…
emi
  • 5,380
  • 1
  • 27
  • 45
9
votes
1 answer

Difference between logic programming and automated theorem proving

What is the difference between logic programming and automated theorem proving (ATP) (e.g. with E-Prover, Spass or Princess)? I searched a lot and the only information I found is that ATP is the precursor of logic programming. But I do not see the…
2Application
  • 165
  • 10
9
votes
4 answers

How is this context free grammar using difference lists in Prolog functioning?

I'm reading this tutorial on context free grammars in Prolog, and they mention at the bottom of the page implementing a context free grammar in Prolog using difference lists, with the following code block included: s(X,Z):- np(X,Y), vp(Y,Z).…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
9
votes
2 answers

A question about logic and the Curry-Howard correspondence

Could you please explain me what is the basic connection between the fundamentals of logical programming and the phenomenon of syntactic similarity between type systems and conventional logic?
Bubba88
  • 1,910
  • 20
  • 44
9
votes
2 answers

Purity of Prolog predicates that use impure primitives

I know that var/1, nonvar/1 and !/0 are impure primitives, but does their use make every program that uses them impure? I wrote the following predicate plus/3 that behaves as if it were pure or at least that is what I claim. The predicate is…
Tudor Berariu
  • 4,910
  • 2
  • 18
  • 29
9
votes
3 answers

Logic variables support for .NET

I am looking for a library/assembly that allows me to work with logical variables in F#. I want to avoid reinventing the wheel in implementing the required union-find datastructure, unification code and so on. I have found Prolog.NET, but the manual…
Frank
  • 10,461
  • 2
  • 31
  • 46
8
votes
0 answers

Will whole Haskell be a part of Curry?

I found Curry on Wikipedia. It says Curry is nearly a superset but not because of lacking of something. I'd like to see it support whole Haskell. Did they plan to implement Haskell as a part of Curry?
user1065942
7
votes
1 answer

Does the term "Functor" in Prolog have any relation to the term taken from Category Theory?

I started to learn Prolog and I just read that the atom at the beginning of an structure is usually called functor. I'm also familiar with the term functor from Category Theory and Functional Programming. So my question is, does the choice of the…
7
votes
3 answers

Does Prolog need GC when the occurs check is globally enabled?

As far as I can tell, with sound unification, SLD resolution should not create cyclic data structures (Is this correct?) If so, one could, in theory, implement Prolog in such a way that it wouldn't need garbage collection (GC). But then again, one…
1
2
3
15 16