Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [prolog]

Prolog is the most commonly used logic programming language. It supports non-deterministic programming through backtracking and pattern matching through unification.

1
vote
1answer
35 views

What is the connection between the logic and the logic programming?

As I understand, then logic (i.e. particular theory of logic with some theory's axioms and some possible assignments of the variables) describes some specific world (in the non-modal case) or some set ...
0
votes
0answers
14 views

Channeling Constraints in Constraint Handling Rules (CHR)

Suppose we have a constraint satisfaction problem that can be defined as its constraints in two different viewpoints $V_1$ and $V_2$. Moreover, there are two variables $A$ and $B$ from $V_1$ and $V_2$ ...
3
votes
0answers
23 views

How does negation as failure work with variables?

Let's say we have the following rule: p -: X ≠ Y, X = Y Stating that $\forall x.y. x \neq y \land x = y \implies p$. Now let us suppose that we are searching for ...
0
votes
0answers
14 views

what are the limitations of definite clause grammars?

Definite clause grammars have been around for a long time but there are not the answer to every parsing problem or we would not need to invent new formalisms. Are there any languages they cannot ...
1
vote
1answer
190 views

Convert FOL clauses to PROLOG

I am very new to PROLOG so it might be a very trivial question, but I absolutely have no idea how to solve it. There are 4 sentences I need to formulate into PROLOG code: All hounds howl at ...
1
vote
0answers
18 views

Is there any difference in the expressiveness of boolean grammars versus definite clause grammars?

Definite clause grammars have been around a long time and are included in logic languages such as Prolog. They can be translated into (are just syntactic sugar for) Prolog programs and are therefore ...
1
vote
1answer
124 views

How do we translate first order logic's universal quantifier (the $\forall$) and the existential quantifier (the $\exists$) to Prolog?

I'm trying to convert some English statements to first order logic statements and I'm trying to use Prolog to verify the translations. My question is: how do I convert a first order logic statement (...
0
votes
2answers
60 views

What are constraints on some new logic programming language and system?

As I understand, everyone can create logic programming language and system by declaring that the valid program of some logic programming language is the set of statements in the form: ...
7
votes
3answers
139 views

How often is Prolog/ASP used in non-research areas?

I've just recently found out about KRR (Knowledge representation and Reasoning) and ASP, not hearing a thing about them before (except a bit about prolog). I've read a bit about them and one of their ...
1
vote
1answer
91 views

What is the computation model of Prolog?

Several computation models have representative programming language counterparts, as, according to this answer, Snobol for rewriting systems, APL for combinators, Lisp/Scheme for lambda calculus, and ...
1
vote
1answer
326 views

Hamiltonian path and minimum spanning tree

Suppose i have a graph and i want to find minimum-spanning-tree. As in imperative languages we have to take specific steps from everynode(example ,we use kruskal's algorithm or prim's algorithm) to ...
3
votes
1answer
79 views

Programmatically checking equivalence of statements

So as part of a theorem-prover/checker, I'm using Prolog to try to determine the equivalence of statements that have been parsed into tree form, e.g. $x=2$ is represented as ...
2
votes
1answer
259 views

Generalization of Horn clauses in logic programming?

As far as I understand, Prolog and related languages are restricted to inference rules of the form $$ p_1 \land \dots \land p_n \rightarrow q$$ which is equivalent to the Horn clause $$ \neg p_1 \lor \...
2
votes
1answer
288 views

How to determine if prolog query will give an answer or not?

Explain what will happen if we try to evaluate the query “path(a,e).”. When the query was actually run, it kept looping.I used the following method. Is it correct? When evaluating $path(Z,e)$, if $...
2
votes
1answer
113 views

Is there an implementation of higher kinded types in typed lambda calculus?

I can see that we can do higher kinded types ( * -> *) -> * in Scala and Haskell and other languages. I'm looking for a simpler vanilla implementation of just ...
3
votes
0answers
197 views

Open Standard Prolog Knowledge Bases [closed]

Are there any standard Prolog knowledge bases available anywhere that have the same purpose as Cyc, namely to encode generally accepted common sense and human knowledge? Typically containing ...
1
vote
1answer
3k views

Horn clause to Prolog [closed]

At the needs of my HW at uni I need to transform some Horn clauses to Prolog but I cannot figure out how to do it. I found out some guides but they describe how to do it with only one fact. So can you ...
15
votes
2answers
3k views

What makes PROLOG Turing-complete?

I know that it can be proven PROLOG is Turing-complete by constructing a program that simulates a Turing machine like this: ...
5
votes
2answers
674 views

Proper terminology in Prolog/logical programming theory?

I have a good understanding of how to program using logic languages, but I'm currently writing up a paper describing some of my work, and I wanted to ensure that I wasn't abusing the proper ...
24
votes
2answers
8k views

How to implement a prolog interpreter in a purely functional language?

Is there a clear reference, with pseudo-code, on how to go about implementing a Prolog interpreter in a purely functional language? That which I have found so far seems to deal only with imperative ...
17
votes
3answers
3k views

Can constraint satisfaction problems be solved with Prolog?

Is "party attendance" type of problems solvable in Prolog? For example: Burdock Muldoon and Carlotta Pinkstone both said they would come if Albus Dumbledore came. Albus Dumbledore and Daisy ...