logic-programming

Executing prolog code on an iPhone

巧了我就是萌 提交于 2019-12-03 08:52:38
问题 I currently have the need to execute prolog code in an application I am making. I am aware that Apple probably never would allow something like this in the App Store, but that is not the intention either. This is more a private project that will never reach the App Store. Purpose In this case prolog is used to describe an object (like for example a telephone) and its properties. The object will be drawn with OpenGL using coordinates specified in the prolog script. The reason for using prolog

Most useful and instructive functional-logic language to learn

自闭症网瘾萝莉.ら 提交于 2019-12-03 07:08:02
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 functional programming with Scala, I decided to take a look at logical programming again, to "train my brain" or better for actual usage. Combining functional and logical programming seems attractive for me to learn/solidify concepts of both declarative paradigms. I find also find strong type systems very useful and fascinating. Scala really shined with interop. Let's not reinvent wheels. It

Executing prolog code on an iPhone

天涯浪子 提交于 2019-12-02 22:54:39
I currently have the need to execute prolog code in an application I am making. I am aware that Apple probably never would allow something like this in the App Store, but that is not the intention either. This is more a private project that will never reach the App Store. Purpose In this case prolog is used to describe an object (like for example a telephone) and its properties. The object will be drawn with OpenGL using coordinates specified in the prolog script. The reason for using prolog is that I need the ability to query the program about some of the features this object has, and prolog

How is this context free grammar using difference lists in Prolog functioning?

时光毁灭记忆、已成空白 提交于 2019-11-30 20:41:10
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 block included: s(X,Z):- np(X,Y), vp(Y,Z). np(X,Z):- det(X,Y), n(Y,Z). vp(X,Z):- v(X,Y), np(Y,Z). vp(X,Z):- v(X,Z). det([the|W],W). det([a|W],W). n([woman|W],W). n([man|W],W). v([shoots|W],W). It mentions: Consider these rules carefully. For example, the s rule says: I know that the pair of lists X and Z represents a sentence if (1) I can consume X and leave behind a Y , and the pair X and Y

How is this context free grammar using difference lists in Prolog functioning?

廉价感情. 提交于 2019-11-30 04:09:10
问题 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 block included: s(X,Z):- np(X,Y), vp(Y,Z). np(X,Z):- det(X,Y), n(Y,Z). vp(X,Z):- v(X,Y), np(Y,Z). vp(X,Z):- v(X,Z). det([the|W],W). det([a|W],W). n([woman|W],W). n([man|W],W). v([shoots|W],W). It mentions: Consider these rules carefully. For example, the s rule says: I know that the pair of lists

Relational/Logic Programming in Python?

不问归期 提交于 2019-11-29 20:09:45
I'm a longtime python developer and recently have been introduced to Prolog. I love the concept of using relationship rules for certain kinds of tasks, and would like to add this to my repertoire. Are there any good libraries for logic programming in Python? I've done some searching on Google but only found the following: jtauber's blog series on relational_python Would love to compare to some others...thanks! -aj Richie Perhaps you should google "Logic Programming in Python". Pyke looks promising: Pyke introduces a form of Logic Programming (inspired by Prolog) to the Python community by

Purity of Prolog predicates that use impure primitives

谁都会走 提交于 2019-11-29 02:14:01
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 least that is what I claim. The predicate is demonstrative, not designed to be efficient. % nat(X) is true if X is a natural number nat(0). nat(X):- nonvar(X), !, X > 0. nat(X):- nat(X1), X is X1 + 1. % plus(A, B, C) is true if A,B and C are natural numbers and A+B=C plus(A, B, C):- nat(A), (nonvar(C), C < A, !, false ; true), plus_(B, A, C). plus_(A, B, C):- nat(A), (nonvar(C), C < A, !, false ;

What are the main technical differences between Prolog and miniKanren, with respect to logic programming? [closed]

牧云@^-^@ 提交于 2019-11-28 14:56:26
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 core.logic . Prolog , the first "big" logic programming language. What I'm interested in now: What are the principal technical differences between the two? Are they very similar in approach and implementation, or do they take completely different approaches to logic programming? Which branches of mathematics do they come from, and what are the theoretical foundations? William E. Byrd First, allow me

Embedded Prolog Interpreter/Compiler for Java

会有一股神秘感。 提交于 2019-11-27 17:58:33
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 programming language, instead of Java, as I believe the resulting code will be significantly simpler and more maintainable. I googled for embedded Java implementations on Prolog, and found number of them, each with very little documentation. My (modest) selection criteria are: should be embeddable in Java (e.g. can be bundled up with my java package instead of requiring any native installations on

What are the main technical differences between Prolog and miniKanren, with respect to logic programming? [closed]

大城市里の小女人 提交于 2019-11-27 08:57:32
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . 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 core.logic. Prolog , the first "big" logic programming language. What I'm interested