1 answer

Why is this contradictory clojure.core.logic/featurec result being returned?

...and how can I avoid it? (run* [q] (featurec q {:a 1}) (featurec q {:a 2}))) returns ((_0 :- (clojure.core.logic/featurec _0 {:a 2}) (clojure.core.logic/featurec _0 {:a 1}))) which ...

4 answers

Prolog : Enumerate All Elements of Countably Infinite Results

Are there any prolog implementations that are able to enumerate all elements of countably infinite results? Let's consider to enumerate all pairs of natural numbers. If we enumerate pairs in order ...

4 answers | Aug 22 at 17:22 by egi on Stack Overflow stackoverflow.com
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 ...

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

2 answers | Aug 12 at 22:50 by day on Stack Overflow stackoverflow.com
0 answers

how Sets and Relations are useful and related to logic programming?

i am getting started with logic programming, but i am forced to do contents of discrete mathematics first. but i don't see the relation here. Sets however is used in predicate logic but Relations, how ...

1 answer

Modelling recipes and available ingredients with constraint logic

Imagine I have a number of recipes for different dishes and a larder containing various ingredients in my kitchen. I want to construct a model using core.logic which will enable me to answer the ...

0 answers

Restriction of resolution - logic programming-horn clause

I am confused about restriction of resolution especially input resolution. In one of the input resolution exercise, we began to resolve the clauses with negative horn clause. Question 1: Do we have ...

2 answers

Can pyDatalog be used to check if all data dependencies are satisfied?

I am trying to use pyDatalog to determine if the dependencies for various features are satisfied. Some library (lA,lB,...) provides outputs (1,2,...) which are needed by features (fX,fY,...). For ...

2 answers | Jul 6 at 11:39 by kerblogglobel on Stack Overflow stackoverflow.com
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 ...

2 answers

How is this context free grammar using difference lists in Prolog functioning? It's completely over my head

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

3 answers

Prolog XOR on elements of list

I am new in Prolog and I would like to apply XOR operation on elements of given list of length n. The predicate should return True if list contains some false elements in the first n-1 element or if ...

3 answers | Jun 29 at 17:44 by user3074510 on Stack Overflow stackoverflow.com
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 ...

3 answers | Jun 24 at 22:16 by mnicky on Stack Overflow stackoverflow.com
1 answer

SWI Prolog pass a goal with non-zero arity through the command line arguments

SWI Prolog allows the execution of a goal before top level with non zero arity as follows swipl -s consultingfile.pl -g start however when a predicate with non zero arity is specified as follows ...

3 answers

Swapping consecutive items of a list in Prolog

I'm trying to write Prolog code that can swap two elements of a list, but only if they are consecutive to each other. That is, conseq_swap(d, e, [a, g, d, e, f], X). should give: X = [a, g, e, d, ...

1 answer

Finding similar sets with clojure's core.logic / minikanren

this is my first question on Stack Overflow. I’m new to logic programming and are trying to evaluate if it can be used to solve some matching problems I’m working on. Problem: Lets say we have a ...

1 answer

Prolog combinatorics

Is there any way to generate all possibilities like 9 letters to be divided in 3 teams, like this: - 1st team: 2 letters - 2nd team: 3 letters - 3rd team: 4 letters ? Example: find([a, b, c, d, e, ...

1 answers | May 22 at 20:12 by charqus on Stack Overflow stackoverflow.com
1 answer

Dijkstra path (not only distance)

I have the code that calculates the minimum distance of Dijkstra path. Can you help me edit my code in order to not only print the minimum distance, but the full path too? % ...

1 answers | May 22 at 19:23 by charqus on Stack Overflow stackoverflow.com
1 answer

Fixed Point and Proof theory

For any given logic program, proof theory of it uses SLD (Selective Linear Definite) resolution to find the satisfiablity of the query. For the same logic program, we can apply fixed point theorem to ...

1 answer

Community resources for the Maude Language

Where do I go for interactive help when learning the Maude Language? I've found books, tutorials, and webpages with excellent instruction. I can't find any sort of interaction such as an IRC ...

1 answers | May 3 at 2:07 by MRocklin on Stack Overflow stackoverflow.com
2 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

Is the Prova implemented with a Prolog compiler or Prolog interpreter?

I am looking at the Java-written Prolog system, Prova. https://prova.ws/ But it is not clear about its implementation, a Prolog compiler or Prolog interpreter? I read the manual, but did not found an ...

1 answers | Apr 22 at 23:12 by Osiris Xu on Stack Overflow stackoverflow.com
3 answers

Prolog: How can I implement the sum of squares of two largest numbers out of three?

Exercise 1.3 of the book Structure and Interpretation of Computer Programs asks the following: Define a procedure that takes three numbers as arguments and returns the sum of the squares of the ...

1 answer

Logic programming - Is subset with only one function symbol Turing - complete?

If I have a subset of logic programming which contains only one function symbol, am I able to do everything? I think that I cannot but I am not sure at all. A programming language can do anything ...

0 answers

Product of two permutations (cycles) in Prolog

I would like to find the product of two permutations in Prolog (in cycle form) and I'm having problems with it (mostly because I can't even imagine, what it will look like). I thought about changing ...

1 answer

Enumerating binary trees in Prolog

I am trying to create Prolog rules to enumerate 'binary trees' in list form in Prolog. I am new to Prolog. A tree with 0 nodes is an empty list: [] A tree with 1 node is: [[],[]] A tree with 2 ...

1 answers | Mar 29 at 17:02 by 1026501 on Stack Overflow stackoverflow.com
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 ...

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

0 answers

Proof of Correctness - Dependency Graph in Logic Program

I was trying to prove this. This is a logic program P = { a $\leftarrow$ b,c; g $\leftarrow$ a; f $\leftarrow$ k ; } Query= {g} Dependency Graph (G): ...

1 answer

Why does creating a relationship in pyDatalog seem to give me the wrong answer?

I'm new to the concepts of Datalog, and I am exploring it through pyDatalog. I am experimenting with a unit measurement converter. So, given facts about how many inches there are in a meter, for ...

1 answers | Nov 25 '14 at 22:28 by blippy on Stack Overflow stackoverflow.com
1 answer

Loading a datalog program in a file into pyDatalog

I am trying to use the pyDatalog.load() method to load a small pyDatalog program. For example, I am loading the factorial sample from https://sites.google.com/site/pydatalog/ from pyDatalog import ...

1 answers | Nov 25 '14 at 22:27 by Andres on Stack Overflow stackoverflow.com
15 30 50 per page
1 2 3