Aleph是Inductive logic programming的一个工具。
Aleph输入文件包括三个,分别为:事实文件(input.b),正例文件(input.f),反例文件(input.n)。三个文件的文件名字部分相同,但具有不同的扩展名。
调用时,使用命令:read_all(input)。
事实文件
事实文件是一个形如*.b的文件,包含以Prolog子句形式进行编码的相关领域信息,也可以包含Prolog编译器可以理解的命令。该文件还包含提供给Aleph的语言和搜索限制信息。最基本的包括modes,types和determinations。
模式声明(Mode declarations)
声明了谓词的调用方式,这些谓词将会出现在Aleph推断出的假设子句中。其形式为:
mode(RecallNumber,PredicateMode).
RecallNumber用来限制一种谓词调用形式的不确定性,PredicateMode指定调用谓词的合法形式。
RecallNumber can be either (a) a number specifying the number of successful calls to the predicate; or (b) * specifying that the predicate has bounded non-determinacy. It is usually easiest to specify RecallNumber as *.
PredicateMode是如下形式的一个模板:
p(ModeType, ModeType,...)
ModeType可以是a.simple 或 b.structured
类型规范(Type speciations)
构造假设子句的谓词中的参数的类型都要具体指定,实际上这一步已经在模式声明过程中完成了。Aleph中没有类型检查,类型就是名字。
决定式(Determinations)
Determinations声明了可以用来构造假设的谓词。其形式为:
determination(TargetName/Arity,BackgroundName/Arity).
第一个参数是目标谓词的名字,也就是说,这个谓词将会出现在假设子句的头部(head)。第二个参数是可以出现在假设子句body部分的谓词的名字。一般来说,对一个目标谓词会有很多这种声明。Determinations are only allowed for 1 target predicate on any given run of Aleph: if multiple target determinations occur, the first one is chosen.
正例文件
正例文件名字形式为*.f,包含正例,正例都是ground facts。如:
eastbound(east1).
eastbound(east2).
eastbound(east3).
反例文件
反例文件名字形式为*.n,包含反例,反例也都是ground facts。如:
eastbound(east1).
eastbound(east2).
eastbound(east3).