236 questions
2
votes
1
answer
171
views
How is one meant to parse the phrase "pure monotonic Prolog"?
The phrase "pure monotonic Prolog" (sometimes written with a comma) is often used in discussion of the language, especially in discussion of how one ought to write code. How is the phrase ...
0
votes
0
answers
43
views
Logic Programming languages supporting multiple scenarios and what-if
Is there any LPL that supports tracking multiple fact scenarios, identifying those that have become inconsistent, and performing what-if tests?
All the versions of Prolog I have seen have only a ...
1
vote
0
answers
99
views
Infinite loop with `counto` relation in core.logic
I am interested in expressing the number of occurrences of an element in a list as a relational goal in Clojure's core.logic library.
(Note that this question is not a duplicate of clojure core.logic ...
1
vote
1
answer
76
views
Minizinc: inconsistent constraint reformulation
I'm developing a Minizinc model and I ran into this issue: given this model
enum req_type = {roads, rivers};
enum cities = {city1, city2, city3}
array[cities, cities] of var bool: are_connected; % ...
3
votes
0
answers
111
views
Logic programming with multiple fact databases
I have to find a logically consistent subset of multiple fact sets (databases). Is there a logic programming language with built-in facilities to do this? If not, are there logic programming languages ...
4
votes
2
answers
492
views
How does prolog resolution use proof by contradiction?
I'm learning prolog, and I'm confused by the claim that prolog uses proof by contradiction:
The resolution proof process makes use of a technique that is known as reduction to the absurd: suppose ...
0
votes
0
answers
44
views
Value Semantics in Parallel Programming
What is the advantage of following value semantics while designing parallel programming?
1
vote
0
answers
32
views
How to eliminate circular solutions in unification?
I use the next unification lib.
from unification import *
x1 = var('x1')
unify((x1, 1), x1) # {~x1: (~x1, 1)}
Can you please suggest how to eliminate such circular solutions (~x1 references to ...
0
votes
1
answer
954
views
Clingo: Intersecting All Possible Optimal Solutions (ASP)
I want to find atoms, within a pre-defined set of atoms, that are in all possible optimal solutions of an ASP problem.
I'll explain what i want to do. I have an optimization problem where multiple ...
1
vote
0
answers
143
views
Is it possible to insert a Clojure statement in the middle of a series of core.logic calls, "à la Prolog"?
Prolog mixes logic (fallible) goals, and (infallible) processes like write/2 or assert/1. Is it possible to do so with Clojure's core.logic?
For example:
(pldb/with-db myFacts
(l/run* [x y]
...
7
votes
1
answer
328
views
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 ...
0
votes
1
answer
150
views
Trying to solve Lady or the Tiger in Alloy
I've been trying to solve the logic puzzle Lady or the Tiger in Alloy but got stuck. Right now I'm trying to solve the 4th puzzle which is on the 2nd day.
It goes as following: There are a few rooms ...
2
votes
1
answer
236
views
Route Inspection of Directed Graph in ASP
For the multidirected graph below I am trying to write an program that visits all edges at least once. For instance, in the below graph I am looking for an outcome similar to "edge(1,2), edge(2,3)...
1
vote
1
answer
465
views
Negative optimization result in Answer Set Programming
I have written an ASP program with an optimization condition in the end. When I compile it, even though I get the correct result, in the summary I get a negative value for the optimization (i.e. -3).
...
1
vote
1
answer
105
views
Non-termination when query variable is on a specific position
Consider this blog post where the author implements palindrome relation using reverso:
(defn reverso [l r]
(conde
[(== l ()) (== r ())]
[(fresh [la ld ldr]
(conso la ld l)
(...
3
votes
2
answers
329
views
What is committed-choice logic programming language?
In the logic programming community, I have heard many people talk about "committed choice logic programming language", but I am not very clear about its definition. I searched the internet, ...
3
votes
1
answer
133
views
How do I translate Prolog's cuts to Curry?
Here's an algorithm in Curry which takes n and matches on two strings within edit distance n of each other.
lev :: Eq a => Int -> [a] -> [a] -> ()
lev n (a : b) (a : c) =
lev n b c
lev n ...
1
vote
1
answer
362
views
Converting `appendo` relation from smt2 to python
Recently I am learning SMT solver. Although SMT solver is a new concept to me, it reminds me of logic programming, e.g. Prolog and minikanren. So I tried a classic example of logic programming in SMT ...
1
vote
1
answer
546
views
How to replace constants terms from python API in clingo / gringo?
Suppose I have a the following file foo.lp:
foo(x).
Now when I run gringo -t -c x=1 foo.lp I obviously get:
foo(1).
Now I want to know how to achieve the same behavior as the -c command line option ...
1
vote
1
answer
657
views
Clingo: operation undefined
Adding the following rule to my code results in an error message (info: operation undefined (Max-Min)):
rank_difference(Room, Deck, Diff) :-
played(Room, Deck),
Min = #min {Rank: seat(Player, ...
0
votes
1
answer
317
views
Shorthand for multiple choice predicates in clingo
Right now I have a single choice predicate that defines my search space.
#const nRounds = 3.
#const nPlayers = 17.
#const nSeats = nRounds * nPlayers.
#const nRooms = 3.
#const nDecks = 6.
nSeats { ...
2
votes
2
answers
776
views
How to define multiple penalties to minimise overall in clingo?
I am trying to use clingo to generate tournament player-room allocations:
player(1..20).
room(1..4).
played(1..20, 0).
rank(1..20, 1).
played(1..20, 1..20, 0).
0 { used_room(R) } 1 :- room(R).
3 {...
0
votes
1
answer
486
views
Clingo program expected to be satisfiable
I am testing some programs involving arithmetics in Clingo 5.0.0 and I don't understand why the below program is unsatisfiable:
#const v = 1.
a(object1).
a(object2).
b(object3).
value(object1,object2,...
1
vote
2
answers
120
views
Look for algorithm/research area that determines facts that would make a Prolog query true given a Prolog program
I'm looking for research, algorithms or even terminology for this area of research that take a Prolog program and a query I want to be true and attempt to find the facts that would need to be asserted ...
2
votes
1
answer
311
views
"Generating Numbers" Puzzle
I have come across the following puzzle and couldn't formulate a solution in Picat:
You will generate 5-digit numbers, where each digit is in 1..5 and different from the others, with the constraint ...