logical-purity

Is “almost pure” Prolog expressive?

…衆ロ難τιáo~ 提交于 2021-01-13 09:37:11
问题 @false commented earlier: Yes, you can implement a Turing machine without dif/2 . But you cannot even implement intersection or similar predicates. Suppose we do extend pure Prolog (Horn FOL + CWA + UNA) with call/N , dif/2 , and (=)/3 , to be used in if_/3 , would there still be gaps in its expressiveness, i.e. things that are trivial to define in, say, Scheme, but are much harder to state in such extended (almost pure) Prolog? In particular, does such a Prolog allow manipulating Prolog

Pure Prolog δλ-Calculus Equality

旧街凉风 提交于 2021-01-07 01:35:18
问题 It is not so difficult to conceive an appartness relation for Peano numbers. Its even possible to make a reified eq/3 predicate like here. Question is now, whether we can push the boundary and also implement Scheme equal? predicate in a pure and reified manner? Problem would be for example to realize this reductions, also known as δ-rule (see Chapter 6 Extensions here): δxx ~~> T δxy ~~> F if x and y are not identical In case terms are represented with deBruijn indexes. This would incorporate

Pure Prolog δλ-Calculus Equality

元气小坏坏 提交于 2021-01-07 01:29:35
问题 It is not so difficult to conceive an appartness relation for Peano numbers. Its even possible to make a reified eq/3 predicate like here. Question is now, whether we can push the boundary and also implement Scheme equal? predicate in a pure and reified manner? Problem would be for example to realize this reductions, also known as δ-rule (see Chapter 6 Extensions here): δxx ~~> T δxy ~~> F if x and y are not identical In case terms are represented with deBruijn indexes. This would incorporate

Pure Prolog Scheme Quine

依然范特西╮ 提交于 2021-01-03 06:42:45
问题 There is this paper: William E. Byrd, Eric Holk, Daniel P. Friedman, 2012 miniKanren, Live and Untagged Quine Generation via Relational Interpreters http://webyrd.net/quines/quines.pdf Which uses logic programming to find a Scheme Quine. The Scheme subset that is consider here does not only contain lambda abstraction and application, but also a little list processing by the following reduction, already translated to Prolog: [quote,X] ~~> X [] ~~> [] [cons,X,Y] ~~> [A|B], for X ~~> A and Y ~~>

Pure Prolog Scheme Quine

柔情痞子 提交于 2021-01-03 06:40:14
问题 There is this paper: William E. Byrd, Eric Holk, Daniel P. Friedman, 2012 miniKanren, Live and Untagged Quine Generation via Relational Interpreters http://webyrd.net/quines/quines.pdf Which uses logic programming to find a Scheme Quine. The Scheme subset that is consider here does not only contain lambda abstraction and application, but also a little list processing by the following reduction, already translated to Prolog: [quote,X] ~~> X [] ~~> [] [cons,X,Y] ~~> [A|B], for X ~~> A and Y ~~>

NU-Prolog's and Gödel's logical and sound `if-then-else` extension

女生的网名这么多〃 提交于 2021-01-03 06:28:16
问题 A paper about mercury says the following: The if-then-else and negation constructs in most variants of Prolog are non-logical and unsound: they can cause the system to compute answers which are inconsistent with the program viewed as a logical theory. Some existing logic programming systems such as NU-Prolog and Gödel provide logical and sound replacements for these Prolog constructs . Unfortunately, these systems enforce safety via runtime groundness checks. This effect can increase the

NU-Prolog's and Gödel's logical and sound `if-then-else` extension

╄→尐↘猪︶ㄣ 提交于 2021-01-03 06:28:06
问题 A paper about mercury says the following: The if-then-else and negation constructs in most variants of Prolog are non-logical and unsound: they can cause the system to compute answers which are inconsistent with the program viewed as a logical theory. Some existing logic programming systems such as NU-Prolog and Gödel provide logical and sound replacements for these Prolog constructs . Unfortunately, these systems enforce safety via runtime groundness checks. This effect can increase the

What is meant by “logical purity” in Prolog?

醉酒当歌 提交于 2019-12-29 08:33:10
问题 What is meant by "logical purity" (in the context of Prolog programming)? The logical-purity tag info says "programs using only Horn clauses" , but then, how would predicates like if_/3 qualify, using as much as it does the cut, and the various meta-logical (what's the proper terminology? var/1 and such) predicates, i.e. the low-level stuff. I get it that it achieves some "pure" effect, but what does this mean, precisely? For a more concrete illustration, please explain how does if_/3 qualify

What is meant by “logical purity” in Prolog?

≡放荡痞女 提交于 2019-12-29 08:33:03
问题 What is meant by "logical purity" (in the context of Prolog programming)? The logical-purity tag info says "programs using only Horn clauses" , but then, how would predicates like if_/3 qualify, using as much as it does the cut, and the various meta-logical (what's the proper terminology? var/1 and such) predicates, i.e. the low-level stuff. I get it that it achieves some "pure" effect, but what does this mean, precisely? For a more concrete illustration, please explain how does if_/3 qualify

Purity of Prolog predicates that use impure primitives

家住魔仙堡 提交于 2019-12-18 03:38:29
问题 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