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

Not getting a theory in Aleph for SWI Prolog

我正试图让 Aleph 工作并归纳出一个简单的理论:祖父母 (X, Z):- 父亲 (X, Y), 父亲 (Y, Z)。但是我得到了一个原子(例如祖父母(john,johnJuniorJunior))。希望有人能帮忙。请注意,Aleph for SWI 使用单个文件作为输入。 Cheers/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.

改变

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

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

解决了我的问题。谢谢法布里齐奥!