在Aleph for SWI Prolog中没有获得理论

时间:2016-11-27 20:20:24

标签: prolog swi-prolog

我正在尝试让Aleph工作并引出一个简单的理论:祖父母(X,Z): - 父亲(X,Y),父亲(Y,Z)。然而我得到了一个原子(例如祖父母(john,johnJuniorJunior))。希望有人可以提供帮助。请注意,Aleph for SWI使用单个文件作为输入。 干杯/ JC

我的节目:

:- use_module(library(aleph)).
:- aleph.

:- modeh(*,grandparent(+person,-person)).
:- modeb(*,father(+person,-person)).

:-begin_bg.
person(john).
person(johnJunior).
person(johnJuniorJunior).
person(jack).
person(jackJunior).
person(jackJuniorJunior).
father(johnJunior, john).
father(johnJuniorJunior, johnJunior).
father(jackJunior, jack).
father(jackJuniorJunior, jackJunior).

:-determination(grandparent/2,father/2).

:-end_bg.

:-begin_in_pos.
grandparent(john, johnJuniorJunior).
grandparent(jack, jackJuniorJunior).
:-end_in_pos.

:-begin_in_neg.
grandparent(jack, john).
:-end_in_neg.

:-aleph_read_all.

我的输出:

[theory]

[Rule 1] [Pos cover = 1 Neg cover = 0]
grandparent(john,johnJuniorJunior).

[Rule 2] [Pos cover = 1 Neg cover = 0]
grandparent(jack,jackJuniorJunior).

[time taken] [0.0]
[total clauses constructed] [2]
true.

1 个答案:

答案 0 :(得分:0)

更改

:- modeh(*,grandparent(+person,-person)).
:- modeb(*,father(+person,-person)).

:- modeh(*,grandparent(+person,+person)).
:- modeb(*,father(-person,-person)).

解决了我的问题。谢谢Fabrizio!