lambda-prolog

De Bruijn index based substitution in Prolog

梦想与她 提交于 2021-02-15 07:18:55
问题 The Dutch mathematician Nicolaas Govert de Bruijn invented these indexes for representing terms of lambda calculus without naming the bound variables. Lets take this lambda expression: K = λx.λy.x With de Bruijn indexes it reads, when we use the convention, as here, that the zero de Bruijn index refers to the first enclosing lambda binder: K = λλ1 The de Bruijn index 1 refers to the second lambda binder enclosing the de Bruijn index. How would one write Prolog code for a substitution, so that

Uses cases of closure expansion, how about library(reif)?

时光毁灭记忆、已成空白 提交于 2021-01-29 12:42:06
问题 It seems that SWI-Prolog offers closure expansion. Most likely Jekejeke Prolog 1.4.7 will provide closure expansion as well. We can for example define: goal_expansion(println(X), (write(X), nl)). test :- call(println,'Hello World!'). And it will expand println/0 in the first argument of call/2, which has meta specifier closure index 1. Could we use this to make extensible expansion for library(reif)? This code here rather looks that it cannot work with arbitrary conditions, the predicate

λProlog rejecting hypothetical reasoning queries?

Deadly 提交于 2021-01-27 12:46:59
问题 I suspect that teyjus, the main implementation of λProlog, might be a bit of abandonware, but λProlog is a fascinating Prolog that is supposed to let you use higher-order logic, hypothetical reasoning and other things, which is why I'm trying to use it. File "example.sig": sig example. kind person, language type. type hans person. type german, french, italian language. type grade person -> o. type take person -> language -> o. File "example.mod": module example. (grade P) :- (take P german),

Is there a higher order Prolog that wouldn't need a type system?

大兔子大兔子 提交于 2021-01-27 10:08:39
问题 I suspect that λProlog needs a type system to make their higher order unification sound. Otherwise through self application some Russell type anomalies can appear. Are there alternative higher order Prologs that don't need .sig files? Maybe by a much simpler type system, that doesn't need that many declarations but still has some form of higher order unification? Can this dilemma be solved? 回答1: Is there a higher order Prolog that wouldn't need a type system? These are type-free: HiLog HiOrd

Is there a higher order Prolog that wouldn't need a type system?

為{幸葍}努か 提交于 2021-01-27 10:07:27
问题 I suspect that λProlog needs a type system to make their higher order unification sound. Otherwise through self application some Russell type anomalies can appear. Are there alternative higher order Prologs that don't need .sig files? Maybe by a much simpler type system, that doesn't need that many declarations but still has some form of higher order unification? Can this dilemma be solved? 回答1: Is there a higher order Prolog that wouldn't need a type system? These are type-free: HiLog HiOrd

Can higher order Prolog help closure expansion?

自作多情 提交于 2021-01-05 07:28:29
问题 If I enter this code in SWI-Prolog: goal_expansion(println(X), (write(X), nl)). test :- call(println, 'Hello World!'). Listing shows me this result: test :- call('__aux_wrapper_8a89205eca9a6ffb31dd01cc968a2aa022fa1f49', 'Hello World!'). '__aux_wrapper_8a89205eca9a6ffb31dd01cc968a2aa022fa1f49'(A) :- write(A), nl. Would a higher order Prolog do the same? Are there higher order Prologs that have goal expansion and/or closure expansion? 来源: https://stackoverflow.com/questions/65289298/can-higher

Can higher order Prolog help closure expansion?

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-05 07:28:18
问题 If I enter this code in SWI-Prolog: goal_expansion(println(X), (write(X), nl)). test :- call(println, 'Hello World!'). Listing shows me this result: test :- call('__aux_wrapper_8a89205eca9a6ffb31dd01cc968a2aa022fa1f49', 'Hello World!'). '__aux_wrapper_8a89205eca9a6ffb31dd01cc968a2aa022fa1f49'(A) :- write(A), nl. Would a higher order Prolog do the same? Are there higher order Prologs that have goal expansion and/or closure expansion? 来源: https://stackoverflow.com/questions/65289298/can-higher

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 ~~>

higher-order “solutions” predicate

余生颓废 提交于 2019-12-23 12:26:06
问题 I am using a higher order Prolog variant that lacks findall . There is another question on implementing our own findall here: Getting list of solutions in Prolog. The inefficient implementation is: parent(pam, bob). %pam is a parent of bob parent(george, bob). %george is a parent of bob list_parents(A, Es, [X|Xs]) :- parent(X, A), \+ member(X, Es), list_parents(A, [X|Es], Xs). list_parents(A, Es, []). The efficient one need a "solutions" higher-order predicate: list_parents(X, Ys) :-