Questions tagged [minikanren]

KANREN is a declarative logic programming system with first-class relations, embedded in a pure functional subset of Scheme. miniKANREN is a simplified subset of KANREN without many bells, whistles, and optimizations.

KANREN is a declarative logic programming system with first-class relations, embedded in a pure functional subset of Scheme. The system has a set-theoretical semantics, true unions, fair scheduling, first-class relations, lexically-scoped logical variables, depth-first and iterative deepening strategies. The system achieves high performance and expressivity without cuts.

Applications of the system range from expert systems to polymorphic type inference and overloading resolution, to model checking and theorem proving. The system can be used as a meta-logic system.

KANREN works on any computer platform for which a Scheme implementation exists (from PalmPilot and iPAQ to Unix/Linux/Winxx/Mac workstations and servers to MindLego bricks). The system can be compiled or interpreted. Being essentially a Scheme library, KANREN can interact with the user through any graphical or command-line interface provided by the host Scheme implementation.

miniKANREN is a simplified KANREN without many bells, whistles, and optimizations of the full system. The goal of the simplifications was to make miniKANREN easier to explain.

69 questions
6
votes
1 answer

Listing unique DAG parents with core.logic

Here's a (hopefully) simple logical program I've been stuck with for a while. I have a DAG represented by an edge relation in core.logic, when generating the list of parent nodes, I get duplicates when I have "diamond shapes" in the graph (I'm not…
5
votes
2 answers

Clarify search algorithms in different minikanren implementation

I am currently learning miniKanren by The Reasoned Schemer and Racket. I have three versions of minikanren implementation: The Reasoned Schemer, First Edition (MIT Press, 2005). I called it TRS1 https://github.com/miniKanren/TheReasonedSchemer PS.…
chansey
  • 1,266
  • 9
  • 20
5
votes
3 answers

miniKanren: How to define #s and #u?

In miniKanren, succeed can be defined as (define succeed (== #t #t)), and fail can be defined as (define fail (=== #t #f)). But what about #s and #u as short forms of succeed and fail, as they appear in The Reasoned Schemer? (define #s succeed)…
Flux
  • 9,805
  • 5
  • 46
  • 92
5
votes
1 answer

Feature structure unification in minikanren

How would one define a feature structure unification and subsumption in minikanren if we represent feature structures with lists? The general behaviour would be something like this (I think): (run* (q) (unifyo '(a b) '(a b) q))) => (a b) (run* (q)…
5
votes
2 answers

Does MiniKanren have the "not" operator?

Does MiniKanren have the "not" operator? For example, how would one represent Prolog's a :- b, not(c) a is true if b is true and c is not (Prolog uses negation as failure, i.e. not(c) is considered proven if c can not be proven) Prolog's not also…
MWB
  • 11,740
  • 6
  • 46
  • 91
5
votes
2 answers

How to implement fully-declarative Horn logic?

I would like to formalize some knowledge and execute queries in what may referred to as fully-declarative Horn logic (or, fully-declarative Prolog). Could anyone provide some guidelines on how to implement it? I briefly recap the fine description…
5
votes
1 answer

Why does 'The Reasoned Schemer' add an 'o' to the end of its functions?

In the reasoned schemer, they name standard lisp functions with an 'o' on the end, eg conso and appendo. My question is: Why does 'The Reasoned Schemer' add an 'o' to the end of its functions?
hawkeye
  • 34,745
  • 30
  • 150
  • 304
5
votes
1 answer

why does the output of core.logic give the same value repeated?

I tried this in core.logic (require [clojure.core.logic :as l]) (l/run* [q] (l/fresh [a b c] (l/membero a [1]) (l/membero b [4 5]) (l/membero c [1 2]) (l/== q [a b]))) expecting the result to be [1 4] [1 5] but it was [1 4] [1…
zcaudate
  • 13,998
  • 7
  • 64
  • 124
4
votes
1 answer

Is a "facts database" not a core feature of miniKanren?

I have been playing around with miniKanren, trying to understand it by converting very basic Prolog tutorials into it. I use Python habitually so I started with the LogPy library, which has since been forked and improved upon as a lib actually…
4
votes
0 answers

what categories do relational languages describe?

I read that lambda calculus is the language of cartesian closed categories. As I understand it, relational languages such as minikanren or (in part) prolog would then operate on those, but also other categories (since functions are a special case of…
4
votes
2 answers

mini-kanren what is the difference between cond-a cond-u and cond-e?

I have tried to use an implementation of mini-kanren in clojure. But been struggling to understand the difference between cond-a cond-u and cond-e. I seem to be quite clear about cond-e but understanding of cond-a and cond-u is quiet bad. cond-e…
4
votes
1 answer

What does non-relational mean in practice for core.logic?

When trying to understand core.logic throgh the API docs I come across Non-Relational goals and relational goals. I have no idea what this means in practice and why it is important to annotate goals if they are relational or not. Can you explain…
user3139545
  • 6,882
  • 13
  • 44
  • 87
4
votes
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 in performance or design. I am studying about…
3
votes
0 answers

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 allowing to operate on multiple fact databases…
Paul Jurczak
  • 7,008
  • 3
  • 47
  • 72
3
votes
1 answer

Performance characteristics of core.logic with many finite domain constraints

I'm learning relational programming in miniKanren and I decided to implement a time scheduling system. Basically, it boils down to three relations over finite domain. First, there is a time strip that has a start, duration, end and occurs in a…
tsuki
  • 907
  • 4
  • 17