logic-programming

Real world Prolog usage

Many study Prolog in college, but I have personally not come in contact with it professionally. The traditional examples given are AI and expert system applications, but what have you used it for and what made Prolog a suitable language for the task? ...

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 non-AI fields easier. My question is this: why hasn't logic programming caught on in the...

Prolog operator precedence and rules matching

I have the next two facts loaded in my prolog interpreter: foo(U+V,1). foo(U*V,2). Now I try the next queries with that results: foo(x*x+x,R). --> R = 1 foo(x+x*x,R). --> R = 1 foo(x*x*x,R). --> R = 2 Now I try with the next query: foo(x*x-x,R). --> no As I understand, this is explained by how the operator precedence bui...

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 info for a novice. ...

Documentation for the Prolog dialect Prova

I would like to switch from SWI-Prolog to Prova - but it seems to be harder than expected: Predicates like succ() are not available and operations like Var1+Var2>Var3 do not work (obviously it has to be Var3<Var1+Var2 to be valid). Is there documentation available describing the differences between Prolog dialects? ...

Logic programming online resources

I might look like a n00b, but I would like to know whether anyone here in SO knows any good online resources on logic programming. I'm working on a huge scheduling application and I have "reduced" the algorithmic problem to another huge constraint satisfaction problem. Now I want to know how to use these constraints to derive logically e...

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 believe the resulting code will be significantly simpler and more maintainable. I Googled for e...

Multithreading in... functional languages? (Prolog)

When my friend started learning Prolog in school, I made fun of him for learning a useless language. However, he's showed me some stuff I never even knew possible; I want to know where this technique comes from. The technique is this: permutation(List) :- isAMember(X, List), deleteFirstElement(X, List, Substring), % and so...

Vector addition in prolog

I'm writing a predicate to add two vectors. This is what I came up with: add( [], [], 0 ). add( [A], 0, A ). add( [A], [B], C ) :- C is A + B. add( A, B, C ) :- add( B, A, C ). add( [H1|T1], [H2|T2], WYNIK ) :- X is H1 + H2, add( T1, T2, Y ), append( [X], Y, WYNIK ). First four lines work just fine, but I can't get the last one to wor...

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 is a bit sparse. I do not want a full-fledged Prolog implementation, but only its treatm...

How should I go about implementing a points-to analysis in Maude?

I'm going to implement a points-to analysis algorithm. I'd like to implement this analysis mainly based on the algorithm by Whaley and Lam. Whaley and Lam use a BDD based implementation of Datalog to represent and compute the points-to analysis relations. The following lists some of the relations that are used in a typical points-to ana...

A question about logic and the Curry-Howard correspondence.

Hi. 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? ...

Relational Clausal Logic question: what is a Herbrand interpretation

I'm having a hard time coming to grips with relational clausal logic, and I'm not sure if this is the place to ask but it would be help me so much with revision if anyone could provide guidance with the following questions. Let P be the program: academic(X); student(X); other_staff(X):- works_in(X, university). :-student(john). :...

What is more interesting or powerful: Curry/Mercury/Lambda-Prolog/your suggestion.

Hi! 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 rather open (open in the sense of free/open-source) projects of logical/declarative programming systems. I've decided to make up something similar in my free time, or at least ...

What, if any, is wrong with this approach to declarative I/O

I'm not sure exactly how much this falls under 'programming' opposed to 'program language design'. But the issue is this: Say, for sake of simplicity we have two 'special' lists/arrays/vectors/whatever we just call 'ports' for simplicity, one called stdIn and another stdOut. These conceptually represent respectively All the user input...

Help with prolog's clauses

emissionOf(alpha). emissionOf(beta). detected(proton), detected(electron) :- emissionOf(alpha), emissionOf(beta). I'm facing the problem that for some (probably obvious) reason Prolog doesn't accept the last line of the above code. The reason has something to do with: detected(proton), detected(electron) If I try just detected(pr...

yap prolog read predicate

I am experimenting with prolog, reading "Programming in prolog using the ISO standard, fith edition". I have installed yap (yet another prolog) on my ubuntu 10.10 Maverick RC system, installed using synaptic. I am running prolog from within emacs23 using prolog-mode. The following code (from chapter five of book) does not give results a...

Executing prolog code on an iPhone

Hello, 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 never reach the App Store. Purpose In this case prolog is used to describe an objec...

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, but I am not sure why this is advantages. CLIPS is supposedly altogether different, but i...