首页 > 解决方案 > 如何使用 SWI-Prolog 在 Aleph 中获得更复杂的理论?

问题描述

我厌倦了用 Aleph 来获得一个理论,但我只有一个头和一个身体,实际上我想要更多的身体。

我的输入文件是:

:- use_module(library(aleph)).
:- if(current_predicate(use_rendering/1)).
:- use_rendering(prolog).
:- endif.
:- aleph.
:- modeh(*,attr2col(+attribute)).
:- modeb(*,type(+attribute,-class)).
:- modeb(*,attrs(+class,+attribute)).

:-determination(attr2col/1, type/2).
:-determination(attr2col/1, attrs/2).


:-begin_bg.
class(clerk).
class(manager).
attribute(boss).
attribute(notype).
attribute(noattrs).
attrs(manager,boss).
attrs(manager,notype).
type(notype,manager).
type(boss,manager).
:-end_bg.

:-begin_in_pos.
attr2col(boss).
attr2col(notype).
:-end_in_pos.

:-begin_in_neg.
attr2col(clerk).
attr2col(manager).
:-end_in_neg.

:-aleph_read_all.

我的输出是:

attr2col(A) :-
   type(A,B).

我想要的是:

attr2col(A) :- attribute(A), attrs(B,A), type(A,C).

现在只有一具尸体,但我想要三具。并且有'attribute(A)'作为一个主体,如何只用一个变量添加这样的东西?

标签: prologlogicswi-prologinductionaleph-ilp

解决方案


您可以尝试以下几件事:

  1. 为您的谓词添加模式声明和确定attribute

  2. 在模式声明中尝试不同的 + 和 - 组合

  3. 检查所需子句正文中的所有文字是否确实需要正确预测结果。

干杯/JCR


推荐阅读