Mode Declaration

alphaILP adopts mode declaration as a language bias.

Mode Declaration [Muggleton95, Ray07] is one of the common language biases. We used mode declaration, which is defined as follows. A mode declaration is either a head declaration \({\tt modeh(r, p(mdt_1, \ldots, mdt_n))}\) or a body declaration \({\tt modeb(r, p(mdt_1, \ldots, mdt_n))}\), where \({\tt r}\in \mathbb{N}\) is an integer, \({\tt p}\) is a predicate, and \({\tt mdt_i}\) is a mode datatype. A mode datatype is a tuple \({\tt (pm, dt)}\), where \({\tt pm}\) is a place-marker and \({\tt dt}\) is a datatype. A place-marker is either \(\#\), which represents constants, or \(+\) (resp. \(−\)), which represents input (resp. output) variables. \({\tt r}\) represents the number of the usages of the predicate to compose a solution.

  • Muggleton, S.: Inverse Entailment and Progol. New Generation Computing, Special issue on Inductive Logic Programming 13(3-4), 245–286 (1995)

  • Ray, O., Inoue, K.: Mode-directed inverse entailment for full clausal theories. In: Proceedings of the 17th International Conference on Inductive Logic Programming (ILP). Lecture Notes in Computer Science, vol. 4894, pp. 225–238 (2007)

Mode declaration can be implemented using ModeDeclaration class in mode_declaration.py.

For example, to solve Kandinsky patterns, the following mode declarations are defined:

\({\tt modeb(1, color(+object, \#color))}\)

where \({\tt modeb}\) means that the declaration is for the body atoms in clauses. This declaration can be read: Atoms that have the predicate of color can appear once in the body of clauses to be generated. The first argument is a variable which has been already seen on the clause (not to introduce a new variable), and the second is a constant whose datatype is color.

Using ModeTerm and DataType class, \({\tt +object}\) and \({\tt \#color}\) can be instantiated:

p_object = ModeTerm('+', DataType('object'))
s_color = ModeTerm('#', DataType('color'))

Then mode declaration \({\tt modeb(1, color(+object, \#color))}\) can be instantiated: ModeDeclaration('body', 1, lang.get_pred_by_name('color'), [p_object, s_color])

alphaILP defines a serch space by having a list of mode declarations to limit the clauses to be accepted as a candidate.