拒绝假设的推理查询

拒绝假设的推理查询

本文介绍了λProlog 拒绝假设的推理查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怀疑 teyjus,λProlog 的主要实现,可能有点被遗弃,但 λProlog 是一个迷人的 Prolog,它应该让你使用高阶逻辑、假设推理和其他东西,这就是为什么我'我正在尝试使用它.

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.

文件example.sig":

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.

文件example.mod":

File "example.mod":

module example.

(grade P) :- (take P german), (take P french).
(grade P) :- (take P german), (take P italian).

take hans french.

然而,当我编译和加载它时,虽然它看起来可以工作,但假设的推理查询被拒绝:

However, when I compile and load it, while it appears to work, hypothetical reasoning queries get rejected:

[example] ?- take X Y.

The answer substitution:
Y = french
X = hans

More solutions (y/n)? y

no (more) solutions

[example] ?- grade X.

no (more) solutions

[example] ?- (take hans german) => (grade hans).
(1,19) : Error : Symbol => is not permitted within terms

我期待是"在那里结束.我做错了什么?

I was expecting a "yes" at the end there. What am I doing wrong?

推荐答案

Extend "example.sig"作者:

Extend "example.sig" by:

type whatif language -> o.

扩展example.mod"作者:

Extend "example.mod" by:

(whatif Q) :- ((take hans Q) => (grade hans)).

然后它就起作用了:

看起来 λProlog 是惰性软件,我提出了一个问题 #122.
或者有一些根本问题,它不起作用,
比如打字问题或编译器优化?

Looks like λProlog is lazyware, I raised an issue #122.
Or there are some fundamental problem that it doesn't work,
like typing problems or compiler optimizations?

P.S.:我活得很危险,从这里下载了 tjsim.exe 等:
http://www.eecs.ucf.edu/~leavens/Windows/usr-local-bin/

P.S.: I was living dangerously, and downloaded tjsim.exe etc.. from here:
http://www.eecs.ucf.edu/~leavens/Windows/usr-local-bin/

这篇关于λProlog 拒绝假设的推理查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 16:44