1 answer

How to generate negative examples in inductive logic programming?

I am trying to learn rules of puzzles and board games by observing a human using inductive logic programming. I use PROGOL which is a program for ILP written in Prolog. While for some games it is able …

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!

3 answers

how to stop prolog from examining impossible solutions infinitely?

suppose the following program: nat(0). nat(s(N)) :- nat(N). /* 0+b=b */ plus(0,B,B) :- nat(B). /* (a+1)+b = c iff a+(b+1)=c */ plus(s(A),B,C) :- plus(A,s(B),C). it works great for adding two ...

0 answers

Concurrent and Parallel Logic Programming

In the introduction to The Art of Prolog, Sterling and Shapiro defer a discussion of parallelism, concurrency, and logic programming to another book. My question is whether there is such a resource: …

1 answer

How to solve this logical description with Prolog?

That's my first question so please be tolerant. I've logical problem to write in prolog/CLP: "It is known only one character is telling the truth. Mr April says Mr May tells lies. Mr May says …

1 answer

Inference from generic situation S

I hope that someone can help me. Is it possible inference from a situation S different to s0 in Prolog? I have a s0 (initial situation) like this: isoven(oven). isoff(oven,s0). ison(X,do(a,S)):- ...

Feb 2 at 22:10
1 answer

Prolog - descending order list

I am trying to write a function - decListRange(X,List) which give a list in range [X-1:1] by descending order. For example - decListRange(9,List). Will give - List = [8,7,6,5,4,3,2,1]. I tried …

Feb 2 at 21:42
2 answers

Herbrand universe and Least herbrand Model

I read the question asked in Herbrand universe, Herbrand Base and Herbrand Model of binary tree (prolog) and the answers given, but I have a slightly different question more like a confirmation and …

Feb 2 at 18:07
2 answers

How can I find the input from a list which yields the maximum result from some query in SWI-Prolog?

I'm just picking up Prolog now, so I'm unfamiliar with the normal way of doing most things. Essentially I have a rule which gives a value from an input: ScoreFromInput(Input, Score) :- ... And I …

1 answer

Prolog: show a list contained within a list

I currently have the following facts defined in a Prolog program: hobbies([jarrod, [gaming, running, boxing]]). hobbies([james, [programming, gaming, drawing]]). What query could display a list of …

Jan 25 at 16:21
4 answers

Logical equivalence in Prolog

I got two expressions to list all lists of bits using Prolog: bit(0). bit(1). bitlist1([]). bitlist1([B|Bs]) :- bit(B), bitlist1(Bs). bitlist2([]). bitlist2([B|Bs]) :- bitlist2(Bs), …

Jan 25 at 16:02
1 answer

Why DLV finds an answer set rather than another, in this ASP example program?

I tried two simple programs in ASP(Answer Set Programming) and then i used the answer set solver DLV to find the answer sets (also referred as stable models); the programs are P1: b :- c. c. …

1 answer

Answer set programming getting length of series as input

I am new at Answer Set Programming and trying to encode a problem into ASP. I think it is a simple question. Here is the code; events(1..3). sequence(A,B,C) :- events(A;B;C), A!=B, A!=C, B!=C. As …

1 answer

Alloy constraint specification

I wrote the following code block in Alloy: one h: Human | h in s.start => { s'.currentCall = h.from } I want to pick one 'human' from a set of humans (s.start) and set a variable ...

Dec 10 '13 at 0:08
1 answer

Why cant i get the answer to the zebra puzzle in prolog?

this is my code currently, I am trying to solve the zebra puzzle. exists(A,(A,_,_,_,_)). exists(A,(_,A,_,_,_)). exists(A,(_,_,A,_,_)). exists(A,(_,_,_,A,_)). exists(A,(_,_,_,_,A)). ...

1 answer

Intersection in SWI-Prolog

I am new to Prolog and I am having a little bit of trouble understanding recursion. I am trying to write a relation that finds the intersection of two sorted lists without using SWI's built-in ...

Nov 24 '13 at 11:00
2 answers

Prolog: Failure driven loops

I used the following failure driven loop to list everything without using semicolons. happiness(fred,5). happiness(john,3). happiness(grace,2). someGoal(X) :- happiness(X,Y), write(Y), ...

Nov 23 '13 at 20:21
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 …

5 answers

Language for Logic Programming?

Is there any newer language than Prolog specialized for logical programming ?

2 answers

Transforming recursion into tail recursion?

I am trying to write a predicate that recursively finds the nth power of some number [A^n = A * A^(n-1)] and uses the shortcut A^(2n) = A^n * A^n. Here is the solution so far. p(_,0,1):-!. ...

Nov 14 '13 at 12:34
1 answer

PyDatalog: list of values in answer

In PyDatalog I have defined the following assertions: #stations assert_fact('station', 'A' ,'yellow') assert_fact('station', 'B' ,'yellow') assert_fact('station', 'C' ,'yellow') ...

Nov 4 '13 at 19:20
1 answer

How do you specify facts in prolog files?

I have a few facts stored in a file test.pl. memory(0, 0, 0). memory(0, 1, 0). memory(0, 2, 0). Now in the same directory, I start gprolog and load the file. | ?- ['test.pl']. compiling ...

Oct 8 '13 at 16:01
1 answer

Logic programming: how to distribute resources among consumers?

I have a task in which I must distribute unique resources among consumers. Rules are: each consumer has a set of resource types they can use, each resource is unique, each consumer must receive n>0 …

Oct 5 '13 at 15:50
0 answers

Modelling Constraint Logic Programs (for analysis)

Object-Oriented programs can be modelled by different models such as Automata, Process Algebras, Petri Nets or UML. Some of these models can be used to perform various kind of analysis to spot problem …

1 answer

Logic on/off user in dashboard

I'm having a problem, I'm doing a system in php and should show how many users are online and how many are offline. so I did a column "online type int" 0 = offline, 1 = online. when the user logs …

Sep 21 '13 at 20:26
1 answer

Constraint logic programming with sets in Prolog

The clpfd is a constraint programming library for integers in SWI Prolog. Is there a similar library for sets? If not, do you know of any articles useful to implement such library? Is it doable at …

1 answer

pyDatalog: is it possible to define multiple independent datalog sessions?

I'm working on some code that assesses data in a database to see if instances in a stream of incoming events comply with a set of protocols. The idea is to use pyDatalog to do this. Ideally, we would …

Aug 28 '13 at 8:28
2 answers

pyDatalog: 'object is incompatible with the class queried' when asking a query

I'm working on a program that uses pyDatalog to query an sqlite database. The key table in the database is Event, which is defined as follows: class Event(Base): __tablename__ = 'Event' id = ...

Aug 28 '13 at 8:09
1 answer

most useful & instructive functional-logic language to learn?

I was pretty amazed by the power of prolog. It took some time to get the head around, but to me it seemed to be the coolest declarative language out there. That's why recently, after two years of some …

1 answer

Clojure.logic difference with The Reasoned Schemer

I've been working through The Reasoned Schemer (TRS) using Clojure.logic and paying attention to the differences documented here. I reached frame 24 of Chapter 3, where TRS reports that (run 5 [x] …

15 30 50 per page
1 2 3