Learning Range Restricted Horn Expressions

Roni Khardon^{∗} Department of Computer Science University of Edinburgh The King’s Buildings Edinburgh EH9 3JZ Scotland roni@dcs.ed.ac.uk

September 22, 1998

Abstract

We study the learnability of first order Horn expressions from equivalence and membership queries. We show that the class of expressions where every term in the consequent of a clause appears also in the antecedent of the clause is learnable. The result holds both for the model where interpretations are examples (learning from interpretations) and the model where clauses are examples (learning from entailment).

The result for learning from interpretations is derived by exhibiting a reduction to the function free case (which was previously shown to be learnable). The reduction uses flattening of clauses - replacing a function symbol with a predicate symbol of arity larger by one - and an axiomatisation of the functionality of the new predicates. Learning from entailment is then shown possible by reducing it to learning from interpretations under the given restrictions. This relies on a procedure for model finding for this class.

We also motivate the choice of restriction by showing that for such expressions implication is decidable. Hence, the learned expressions can be used as a knowledge base in a system in a useful way.

∗This work was partly supported by EPSRC Grant GR/M21409.

1 Introduction

We study the problem of exactly identifying universally quantified first order Horn expressions using Angluin’s [Ang88] model of exact learning. Much of the work in learning theory has dealt with learning of Boolean expressions in propositional logic. Early treatments of relational expressions were given by [Val85, Hau89], but only recently more attention was given to the subject in framework of Inductive Logic Programming [MDR94, Coh95a, Coh95b]. It is clear that the relational learning problem is harder than the propositional one and indeed except for very restricted cases it is computationally hard [Coh95b]. To tackle this issue in the propositional domain various queries and oracles that allow for efficient learning have been studied [Val84, Ang88]. In particular, propositional Horn expressions are known to be learnable in polynomial time from equivalence and membership queries [AFP92, FP93]. In the relational domain, queries have been used in several systems [Sha83, SB86, DRB92, MB92] and results on learnability in the limit were derived [Sha83, DRB92]. More recently Reddy and Tadepalli [RT97, RT98] considered the use of equivalence and membership queries and have shown that Horn definitions (where all clauses have the same unique positive literal), and acyclic Horn expressions are learnable.

In previous work [Kha98] we have shown that universally quantified function free Horn expressions are exactly learnable in several models of learning from equivalence and membership queries. This paper extends these results to a class of expressions allowing the use of function symbols. In particular, we present algorithms for learning range restricted Horn expressions where every term in the consequent of a clause appears also in the antecedent of the clause.

One distinction between the learning models is concerned with the notion of examples. The natural generalisation of the setup studied in propositional logic suggests that examples are interpretations of the underlying language. That is, a positive example is a model of the expression being learned. Another view suggests that a positive example is a sentence that is logically implied by the expression, and in particular Horn clauses have been used as examples. These two views have been called learning from interpretations and learning from entailment respectively [DR97] and were both studied before. We present algorithms for learning range restricted Horn expressions in both settings. We also motivate the choice of restriction by showing that for such expressions implication is decidable. Hence, the learned expressions can be used as a knowledge base in a system in a useful way.

The result for learning from interpretations is derived by exhibiting a reduction to the function free case. The reduction uses flattening of clauses [Rou92] - replacing a function symbol with a predicate symbol of arity larger by one - and an axiomatisation of the functionality of the new predicates. The hypothesis language allows for use of equalities in the Horn clauses, under a certain syntactic restriction generalising the the range restricted form. Learning from entailment is then shown possible by reducing it to learning from interpretations under the given restrictions. This relies on a procedure for model finding for this class, which also proves the decidability of inference for it. Interestingly, the reduction uses learning from interpretations in a particular way that allows us to use range restricted expressions as the hypothesis language.

2 Preliminaries

2.1 First Order Horn Expressions

We follow standard definitions of first order expressions; for these see [CK90, Llo87]. The learning problems under consideration assume a pre-fixed known and finite signature S of the language. That is, S = (P, F) where P is a finite set of predicates, and F is a finite set of function symbols, each with its associated fixed arity. Constants are simply 0-ary function symbols and are treated as such. In addition a set of variables x_{1}, x_{2}, x_{3}, … is used to construct expressions.

We next define terms and their depth. A variable is a term of depth 0. A constant is a term of depth 0. If t_{1}, …, t_{n} are terms, each of depth at most i (and one with depth precisely i) and f ∈ F is a function symbol of arity n, then f(t_{1}, …, t_{n}) is a term of depth i + 1.

An atom is an expression p(t_{1}, …, t_{n}) where p ∈ P is a predicate symbol of arity n and t_{1}, …, t_{n} are terms. An atom is called a positive literal; a negative literal is an expression ¬l where l is a positive literal. A clause is a disjunction of literals where all variables are taken to be universally quantified. A Horn clause has at most one positive literal and an arbitrary number of negative literals. A Horn clause ¬p_{1} ∨ … ∨ ¬p_{n} ∨ p_{n+1} is equivalent to its “implicational form” p_{1} ∧ … ∧ p_{n} → p_{n+1}. When presenting a clause in this way we call p_{1} ∧ … ∧ p_{n} the antecedent of the clause and p_{n+1} the consequent of the clause. A Horn expression is a conjunction of Horn clauses. We will make use of further restrictions:

Definition 2.1 (definite clauses) A clause is definite if it includes precisely one positive literal.

Definition 2.2 (range restricted clauses) A definite Horn clause is called range restricted^{1} if every term that appears in its consequent also appears in its antecedent (possibly as a subterm of another term).

For example, the clause (p_{1}(f_{1}(f_{2}(x)), f_{3}()) → p_{2}(f_{2}(x), x)) is range restricted, but the clause (p_{1}(f_{1}(f_{2}(x)), f_{3}()) → p_{2}(f_{1}(x), x)) is not.

Definition 2.3 (H(S)) Let S be a signature. Then H(S) is the set of all Horn expressions over S in which all clauses are definite and range restricted.

Our hypothesis language will allow a restricted use of equalities. To motivate the next definition consider the following clause and its equivalent form

(p_{1}(x_{1}, f_{1}(x_{2})) ∧ p_{2}(f_{2}()) → p_{1}(x_{1}, f_{2}()))
((z_{1} = f_{1}(x_{2})) ∧ (z_{2} = f_{2}()) ∧ p_{1}(x_{1}, z_{1}) ∧ p_{2}(z_{2}) → p_{1}(x_{1}, z_{2}))

1A similar restriction has been used before by several authors. Unfortunately, in a previous version of [Kha98] it was called “non-generative” while in other work it was called “generative” [MF92]. The term “range-restricted” was used in database literature for the function free case [Min88]. Here we use a natural generalisation for the case with function symbols.

where we have replaced each term t_{i} with a new variable z_{i} but have added an equality (z_{i} = t_{i}) between them. In this way each z_{i} has one defining equation, and we may think of the variables involved in the equation as its ancestors (e.g. x_{2} is an ancestor of z_{1}). Constructed in this way all variables that appear in equational literals are ancestors of some variable in the original literals. We will consider the case where z_{i} may have more than one such equation as in

((z_{1} = f_{3}(x_{1})) ∧ (z_{1} = f_{1}(x_{2})) ∧ (z_{2} = f_{2}()) ∧ p_{1}(x_{1}, z_{1}) ∧ p_{2}(z_{2}) → p_{1}(x_{1}, z_{2}))

but where the variables in equations are still ancestors in this sense. These ideas are formalised in the following definitions.

Definition 2.4 (root variables, legal ancestor) Let C be a definite Horn clause with equalities in its antecedent and where every non-equational literal includes only variables as terms, and every equational literal is of the form (z_{i} = f_{j}(x_{1}, …, x_{n})).

• The variables appearing in non-equational literals in the antecedent are called root variables.

• Root variables are legal ancestors.

• If an equational literal (z = f(x_{1}, …, x_{n})) appears in the antecedent and z is a legal ancestor then x_{1}, …, x_{n} are also legal ancestors.

Definition 2.5 (weakly range restricted clauses) A definite Horn clause with equalities in its antecedent (in the above form) is called weakly range restricted if every variable that appears in its consequent or in equational literals is a legal ancestor.

As exemplified above, range restricted clauses have a semantically equivalent form (according to the standard semantics discussed below) which is weakly range restricted.

Definition 2.6 (H(S, =)) Let S be a signature. Then H(S, =) is the set of all Horn expressions over S in which all clauses are definite and weakly range restricted.

2.2 Examples

We define here the scheme of learning from interpretations [DRD94]. Learning from entailment [FP93], where examples are clauses in the language is defined in Section 5.

An example is an interpretation I of the predicates and function symbols in S [Llo87]. An interpretation I includes a domain D which is a (finite) set of elements. For each function symbol f ∈ F of arity n, I associates a mapping from D^{n} to D; if f(a_{1}, …, a_{n}) is associated with a we say that f(a_{1}, …, a_{n}) corresponds to a in I. For each predicate symbol p ∈ P of arity n, I specifies the truth values of p on n-tuples over D. The extension of a predicate in I is the set of positive instantiations of it that are true in I. Let str(S) be the set of interpretations for the signature S

Examples of this form have been used in [Hau89, RT97, Kha98] and are motivated by the scenario of acting in structural domains (e.g. [Kha96, RTR96]). They are also used in the non-monotonic form of ILP [DRD94]. In structural domains, domain elements are objects in the world and an instantiation describes properties and relations of objects. We therefore refer to domain elements as objects.

2.3 Semantics

We use the standard semantics [CK90, Llo87]. Some basic notions are defined here to introduce the notation. Let I be an interpretation, T a set of terms (closed under subterms), X the set of variables appearing in T, and θ a mapping of the variables in X to objects in I. The term assignment of terms with respect to I and θ is defined inductively according to the depth of the term. For terms of depth 0: a variable x ∈ X is mapped to θ(x), and a constant f() ∈ F is mapped to the object it corresponds to in I. For a term f(t_{1}, …, t_{n}) of depth i + 1, let a_{1}, …, a_{n} be the term assignments of t_{1}, …, t_{n}; then f(t_{1}, …, t_{n}) is mapped to the object f(a_{1}, …, a_{n}) corresponds to in I.

Let l(t_{1}, …, t_{n}) be a literal, I an interpretation and θ a mapping of the variables in X to objects in I. The ground literal lθ = l(t_{1}θ, …, t_{n}θ) is obtained from l by substituting variables in it according to θ. A ground positive literal l(t_{1}, …, t_{n}) is true in I with respect to θ if and only if l(a_{1}, …, a_{n}) is true in I where a_{1}, …, a_{n} are the term assignments of t_{1}, …, t_{n}. A ground negative literal is true in I if and only if its negation is not.

A clause C ∈ H(S) is true in an interpretation I if for every substitution θ at least one of the literals in Cθ is true in I. A Horn clause is therefore not true (falsified) in I if there is a substitution that simultaneously satisfies the antecedent and falsifies the consequent. An expression T ∈ H(S) is true in I if all clauses C in T are true in I.

The terms (1) T is true in I, (2) I is a positive example for T, (3) I satisfies T, (4) I is a model of T, and (5) I ⊧ T, have the same meaning. Let T_{1}, T_{2} ∈ H(S) then T_{1} implies T_{2}, denoted T_{1} ⊧ T_{2}, if every model of T_{1} is also a model of T_{2}.

2.4 The Learning Model

We use Angluin’s model of learning from Equivalence Queries (EQ) and Membership Queries (MQ) [Ang88]. Let H be a class under consideration, H′ a (possibly different) class used to represent hypotheses, and let T ∈ H be the target function. For membership queries, the learner presents an interpretation I and the oracle MQ returns “yes” iff I ⊧ T. For equivalence queries, the learner presents a hypothesis H ∈ H′ and the oracle EQ returns “yes” if for all I, I ⊧ T iff I ⊧ H; otherwise it returns a counter example I such that I ⊧ T and I |̸= H (a positive counter example) or I |̸= T and I ⊧ H (a negative counter example).^{2}

In the learning model, T ∈ H is fixed by an adversary and hidden from the learner. The learner has access to EQ and MQ and must find an expression H equivalent to T (under the definition above). For complexity we measure the running time of the algorithm and the number of times it makes queries to EQ and MQ. It is well known [Lit88, Ang88] that learnability in this model implies pac-learnability [Val84].

2Clearly, if H′ is different from H, the above definition still makes sense if we have a clear notion of what I ⊧ H means for H ∈ H′.

3 Learning from Interpretations

We first define a modified signature of the language above. Similar transformations have been previously used under the name of flattening [Rou92] (see also [NCDW97]). For each function symbol f of arity n, define a new predicate symbol f_{p} of arity n + 1. Let F_{p} be the new set of predicates so defined, S′ = (P ∪ F_{p}, ∅) be the modified signature, H(S′) the set of function free Horn expressions over the predicates in P ∪ F_{p}, and str(S′) be the set of interpretations for S′.

Reductions appropriate for learning with membership queries were defined in [AK95] where they are called pwm-reductions. Three transformations are required. The representation transformation maps T ∈ H(S) to T′ ∈ H(S′), the example transformation maps I ∈ str(S) to I′ ∈ str(S′), and the membership queries transformation maps I′ ∈ str(S′) to {Y es, No} ∪ str(S). Intuitively, the learner for T ∈ H(S) will be constructed out of a learner for T′ ∈ H(S′) (the image of the representation transformation) by using the transformations. The obvious properties required of these transformations guarantee correctness. The example and representation transformations guarantee that the learner receives correct examples for T′ and the membership query transformation guarantees that queries can be either answered immediately or transfered to the membership oracle for T.

The Representation Transformation: Let T ∈ H(S) be a Horn expression, then the expression flat(T) ∈ H(S′) is formed by unfolding terms in C bottom-up and replacing them with variables. Formally, flat(T) is defined by transforming each clause C in T as follows. Find a term f(x_{1}, …, x_{n}) in C all of whose sub-terms are variables (this includes constants) and rewrite the clause by replacing all occurrences of this term with a new variable z, and adding a new literal f_{p}(x_{1}, …, x_{n}, z) to the antecedent of C. For example the clause

(p_{1}(x_{1}, f_{1}(x_{2})) ∧ p_{2}(f_{2}()) → p_{1}(x_{1}, f_{2}()))

is first transformed (using f_{1}(x_{2})) into

(f_{1}_{p}(x_{2}, z_{1}) ∧ p_{1}(x_{1}, z_{1}) ∧ p_{2}(f_{2}()) → p_{1}(x_{1}, f_{2}())).

and then (using the constant f_{2}()) into

(f_{1}_{p}(x_{2}, z_{1}) ∧ f_{2}_{p}(z_{2}) ∧ p_{1}(x_{1}, z_{1}) ∧ p_{2}(z_{2}) → p_{1}(x_{1}, z_{2})).

In similarity with the definitions of H(S, =) we say that a variable in flat(C) is a root variable if it appears in a literal p(…) in the antecedent for p ∈ P. For every literal f_{p}(x_{1}, …, x_{n}, z) in the antecedent we say that x_{1}, …, x_{n} are ancestors of z, and take the transitive extension of the ancestor relation (in the above example x_{2} is an ancestor of z_{2}).

Lemma 3.1 For C ∈ H(S), every variable in flat(C) is either a root variable or an ancestor of a root variable.

Proof: By construction this holds for variables in f_{p}() literals. It holds for variables in the consequent since C is range restricted.

We also axiomatise the fact that the new predicates are functional. Our treatment diverges from previous uses of flattening [Rou92] in that the function symbols are taken out of the language. For every f ∈ F of arity n let

exist_{f} = (∀x_{1}, ∀x_{2} …, ∀x_{n}, ∃z, f_{p}(x_{1}, …, x_{n}, z))
unique_{f} = (∀x_{1}, ∀x_{2} …, ∀x_{n}, ∀z_{1}, ∀z_{2}, f_{p}(x_{1}, …, x_{n}, z_{1}) ∧ f_{p}(x_{1}, …, x_{n}, z_{2}) → (z_{1} = z_{2}))

Let ϕ_{f} = exist_{f} ∧ unique_{f}, ϕ_{F} = ∧_{f∈F} ϕ_{f}, and A_{unique} = ∧_{f∈F} unique_{f}. We call exist_{f} the existence clause of f and unique_{f} the uniqueness clause. Finally, ax-flat(T) = ϕ_{F} ∧ flat(T)

The Example Transformation: Let I be an interpretation for S, then flat(I) is an interpretation for S′ defined as follows. The domain of flat(I) is equal to the domain of I and the extension of predicates in P is the same as in I. The extension of a predicate f_{p} ∈ F_{p} of arity n + 1 is defined in a natural way to include all tuples (a_{1}, …, a_{n}, a_{n+1}) where a_{i} are domain elements and f(a_{1}, …, a_{n}) corresponds to a_{n+1} in I.

Let C ∈ H(S) be a clause, I ∈ str(S), and θ a mapping of variables of C to objects of I. The term-assignment extension of θ is a mapping θ′ of variables in flat(C) to objects of flat(I) that is defined inductively as follows. Initialise θ′ to be θ. In the process of flattening a clause defined above, each time a term f(x_{1}, …, x_{n}) is replaced with a variable z and the atom f_{p}(x_{1}, …, x_{n}, z) added, θ′ maps z to the object that f(x_{1}θ′, …, x_{n}θ′) corresponds to in I. Hence it simply maps a variable to the object corresponding to the term assignment of the term that generated it. Since the term assignment is unique θ′ is well defined.

Lemma 3.2 Let C ∈ H(S) be a clause, I ∈ str(S), θ a mapping of variables of C to objects of I, and θ′ the term-assignment extension of θ. Then

(1) For all f_{p} ∈ F_{p}, every literal f_{p}(x_{i_{1}}, …, x_{i_{n+1}}) in the antecedent of flat(C) is true in flat(I) with respect to θ′.

(2) For all p ∈ P and every atom l = p(t_{1}, …, t_{n}) in C and the corresponding atom l′ = p(x_{i_{1}}, …, x_{i_{n}}) in flat(C): l is true in I with respect to θ if and only if l′ is true in flat(I) with respect to θ′.

Proof: Each literal f_{p}(…) is generated by some term f(…) in C. For a constant f(), the literal is f_{p}(x), and θ′ maps x to the object a to which f() corresponds in I. By the construction of flat(I), f_{p}(a) is true in flat(I). For a term f(t_{1}, …, t_{n}) of depth i the corresponding atom is f_{p}(x_{i_{1}}, …, x_{i_{n}}, z), where each x_{i_{j}} is mapped by θ′ to a_{j}, the term assignment of t_{j} in I with respect to θ. Furthermore, z is mapped by θ′ to the object f(a_{1}, …, a_{n}) corresponds to in I; let this object be a. Again , by the construction of flat(I), f_{p}(a_{1}, …, a_{n}, a) is true in flat(I).

For (2) we observe as above that θ′ maps each x_{i_{j}} to the term assignment a_{j} of t_{j} in I with respect to θ. Since predicates in P have the same extension in I and flat(I) we obtain the equivalence.

Lemma 3.3 For all T ∈ H(S) and for all I ∈ str(S)

(1) flat(I) ⊧ ϕ_{F}

(2) I ⊧ T if and only if flat(I) ⊧ flat(T)

(3) I ⊧ T if and only if flat(I) ⊧ ax-flat(T)

Proof: Since each constant and each ground term of depth 1 are mapped to precisely one domain element in I, (1) is true by the construction of flat(I). Clearly, given (1), part (3) follows from (2).

For (2) , assume first that I |̸= T. Hence there is a substitution θ such that Cθ is not true in I for some clause C in T. We claim that flat(I) |̸= flat(C) with respect to θ′, the term-assignment extension of θ. Therefore, flat(I) |̸= flat(T).

For the claim observe that by Lemma 3.2 all literals in the antecedent of flat(C) involving predicates in F_{p} are true in I, θ′, and that all atoms involving predicates in P have the same truth value as in C with respect to I, θ. Therefore both antecedent and consequent of flat(C) have the same truth value as of C in I, θ and the clause is falsified.

Assume on the other hand that flat(I) |̸= flat(C). Hence there is a substitution θ′ such that the antecedent of flat(C) is true in flat(I) with respect to θ′. Now, by construction, the extension of each f_{p} predicate in flat(I) is functional. Hence, since all f_{p} predicates are true with respect to θ′, it follows that θ′ is a term-assignment extension of some substitution θ to the variables of C. As above it follows that I ⊧ Cθ if and only if flat(I) ⊧ flat(C)θ′ thus proving the result.

The Membership Queries Transformation: A mapping converting structures from str(S′) to str(S) is a bit more involved. Let J ∈ str(S′); if J ⊧ ϕ_{F} then the previous mapping can simply be reversed, and we denote it by unflat(J). Otherwise there are two cases. If J falsifies the uniqueness clause, it is in some sense inconsistent with the intension for usage of the predicates. Such interpretations are not output by the algorithm of [Kha98] when learning H(S′) and hence we do not need to deal with them. If J satisfies the uniqueness clause (of all function symbols) but falsifies the existence axiom then some information on the interpretation of the function symbols is missing. In this case we complete it by introducing a new domain element ∗ and defining complete(J) ∈ str(S′) to be the interpretation in which all ground instances of the existence clauses false in J are made true by adding a positive atom whose last term is ∗. More formally, let noncomplete(J) have the additional object ∗ but the same extension as J. For any set a_{1}, …, a_{n} of domain elements of non-complete(J) such that ∃zf_{p}(a_{1}, …, a_{n}, z) is not true in noncomplete(J), put f_{p}(a_{1}, …, a_{n}, ∗) in a set of “additional atoms”. Then complete(J) has the additional element ∗ and the extension of predicates is defined by the union of positive atoms true in J and the additional atoms defined above.

For any J ∈ str(S′) such that J ⊧ A_{unique}, the interpretation J is thus transformed into unflat(complete(J)).

Lemma 3.4 For all T ∈ H(S) and for all J ∈ str(S′) such that J ⊧ A_{unique}: J ⊧ flat(T) if and only if complete(J) ⊧ ax-flat(T).

Proof: Assume first that J |̸= flat(T). Thus there is a substitution θ such that J |̸= Cθ for some C in flat(T). The same substitution can be used to show that complete(J) |̸= flat(T) and hence also complete(J) |̸= ax-flat(T).

Assume on the other hand that complete(J) |̸= ax-flat(T). Then, since complete(J) ⊧ ϕ_{F} it follows that complete(J) |̸= flat(T). Let C be a clause in T and θ a substitution such that complete(J) |̸= flat(C)θ, and the antecedent of C is satisfied by θ in complete(J).

Since C is range restricted, it follows that no variable in flat(C) is mapped to the new object ∗ by θ. To see that observe that by Lemma 3.1 every variable in flat(C) is an ancestor of some root variable in flat(C). Now, by construction if x is an ancestor of y and x is mapped to ∗ by θ then, since the antecedent is satisfied by θ, y is also mapped to ∗ by θ (since the uniqueness axiom is satisfied in complete(J)). It follows that some root variable x is mapped to ∗ by θ. Therefore, by the construction, some literal p(…, x, …) (where p ∈ P) in the antecedent of flat(C) is made false by θ. Hence no variable is mapped to ∗.

Therefore θ can be used as a substitution in J and J |̸= flat(C)θ, implying J |̸= flat(T).

Lemma 3.5 For all T ∈ H(S) and for all J ∈ str(S′) such that J ⊧ A_{unique}: J ⊧ flat(T) if and only if unflat(complete(J)) ⊧ T.

Proof: Note that unflat(complete(J)) ∈ str(S) and flat(unflat(complete(J))) = complete(J). Hence, by Lemma 3.3(3), unflat(complete(J)) ⊧ T if and only if complete(J) ⊧ ax-flat(T). The lemma thus follows from Lemma 3.4.

For a clause C ∈ H(S), by the number of distinct terms in C we mean the number of distinct elements in the set of all terms in C and all their sub-terms. For example, (p(x, f_{1}(x), f_{2}(f_{1}(x)), f_{3}()) → q(f_{1}(x))) has 4 distinct terms x, f_{3}(), f_{1}(x), f_{2}(f_{1}(x)).

Theorem 3.6 Let S = (P, F) be a signature, and let r be the maximal arity of predicates and function symbols in S.

• H(S) is learnable from equivalence and membership queries with hypothesis in H(S′).

• For T ∈ H(S) with m clauses and at most k distinct terms in a clause, the algorithm is polynomial in |P | + |F | and m and exponential in r, k.

Proof: The theorem follows from properties of pwm-reductions [AK95] and the result in [Kha98] showing that H(S′) is learnable.

Essentially the idea is that when learning T ∈ H(S) we will run the algorithm A2 from [Kha98] to learn the expression flat(T) ∈ H(S′). When A2 presents H ∈ H(S′) to an equivalence query we interpret this by saying that I ∈ str(S) is a models of H if and only if flat(I) ⊧ H. Hence given a counter example I we simply compute flat(I) and present it as a counter example to A2. Lemma 3.3(2) and the above interpretation guarantee that the examples it receives are correct. When A2 presents J for a membership query, we compute unflat(complete(J)), present it to MQ and return its answer to A2. Lemma 3.5 guarantees that the answer is correct. By Corollary 11 of [Kha98] we get that A2 will find an expression equivalent to flat(T).

It remains to observe that each distinct term in a clause C ∈ H(S) is mapped to a variable in flat(C). The complexity bound follows from [Kha98].

4 Modifying the Hypothesis Language

The previous theorem produces a hypothesis in H(S′) while the target function is in H(S). Modifying the algorithm so as to work with expressions in H(S) will clearly be of interest. Failing to do this we show how one can use a hypothesis in H(S, =) where the same signature as in H(S) is used.

We first need to describe the hypothesis of the learning algorithm A2 from [Kha98]. The algorithm maintains a set of interpretations S ⊆ str(S′) such that for each J ∈ S, J |̸= flat(T). The hypothesis is H = ∧_{J∈S}rel-cands(J) where rel-cands(J) is a set of clauses produced as follows. First take the conjunction of positive atoms true in J as an antecedent and an atom false in J as a consequent. Each such choice of consequent generates a ground clause. Considering each ground clause separately, substitute a unique variable to each object in the clause to get a clause in rel-cands(J).

We generate clauses over S by replacing every literal of the form f_{p}(x_{1}, …, x_{n}, x_{n+1}) by the corresponding literal (x_{n+1} = f(x_{1}, …, x_{n})). For C ∈ rel-cands(J) let unflat(C) be the resulting clause. Notice that unflat(C) may not be in H(S, =) since some of the variables in its equality literals may not be legal ancestors (cf. Definition 2.4).

Lemma 4.1 For all I ∈ str(S), for all J ∈ str(S′), and for all C ∈ rel-cands(J): I ⊧ unflat(C) if and only if flat(I) ⊧ C.

Proof: Note that C and unflat(C) have the same variables and flat(I) and I have the same domain. It follows by the construction of flat(I) that for any θ mapping these variables to domain elements, (x_{n+1} = f(x_{1}, …, x_{n}))θ is true in I if and only if f_{p}(x_{1}, …, x_{n}, x_{n+1})θ is true in flat(I). The result follows since the truth values of predicates in P is not changed by this transformation.

In fact the lemma does not depend on C being generated by the rel-cands() operation. However, when applied in this way we observe that a hypothesis modified by unflat() attracts precisely the same counter examples and we get learnability with expressions over the signature S. A further improvement is needed to generate a hypothesis in H(S, =). We first define legal objects of interpretations in similarity with legal ancestors in clauses. Let J ∈ str(S′), and let D be the domain of J. Here again legal objects are defined inductively. If p(a_{1}, …, a_{n}) is true in J, for p ∈ P then a_{1}, …, a_{n} are legal objects. If f_{p}(a_{1}, …, a_{n}, a_{n+1}) is true in J where f_{p} ∈ F_{p}, and a_{n+1} is a legal object then a_{1}, …, a_{n} are legal objects.

The idea is that non-legal objects are somehow “not connected” to the important objects of the interpretation (corresponding to root variables in clauses) and hence the atoms referring to them can be dropped. For D′ ⊂ D let J_{|D′} be the projection of J over D′. Namely, the interpretation where the domain is D′ and an atom q(a_{1}, …, a_{n}), where a_{1}, …, a_{n} ∈ D′, is true in J_{|D′} if and only if it is true in J.

Lemma 4.2 Let T ∈ H(S) and J ∈ str(S′), such that J ⊧ A_{unique}. Let D be the domain of J and let a ∈ D be a non-legal object in J. Then unflat(complete(J)) ⊧ T if and only if unflat(complete(J_{|{D\a}}) ⊧ T.

Proof: Assume first that unflat(complete(J)) |̸= T. By Lemma 3.4 and Lemma 3.5 we have that complete(J) |̸= flat(T). Therefore, there is a θ such that complete(J) |̸= flat(C)θ for some C in T.

By the definition of non-legal objects and the construction of complete(J), if a is nonlegal (or the object ∗) and b = f(…, a, …) in complete(J), then b is either a non-legal object or the object ∗ in complete(J).

Recall that by Lemma 3.1 every variable in flat(C) is an ancestor of some root variable in flat(C). Therefore, since the antecedent of flat(C) is satisfied by θ in complete(J) and the uniqueness axiom holds in complete(J), we get that if some variable in flat(C) is mapped to a non-legal object in complete(J) then some root variable in flat(C) is mapped either to a non-legal object or to ∗. It follows that, in such a case, some literal p(…) (where p ∈ P) in the antecedent of flat(C) is made false by θ, and complete(J) ⊧ flat(C)θ. Hence no variable is mapped to a non-legal object (or to ∗) in J by θ. Therefore θ can be used in complete(J_{|{D\a}}) without altering the truth value of flat(C) implying that complete(J_{|{D\a}}) |̸= flat(C).

For the other direction, the same argument shows that if complete(J_{|{D\a}}) |̸= flat(C) then the falsifying substitution does not use the object ∗. Hence, it can be used in J without altering the truth value of flat(C) and the result follows.

Since a membership query of the algorithm (i.e. whether J ⊧ flat(T)) is translated to a membership query for T (i.e. whether unflat(complete(J)) ⊧ T) the lemma indicates that all non-legal objects can be dropped from J before making the membership query. This fact is utilised in the next section.

For our current purpose it suffices to observe that in A2 dropping of objects happens by default. In particular, whenever the algorithm A2 (with its optional step taken) puts an interpretation J into the set S (that generates its hypothesis as discussed above), it makes sure that J |̸= flat(T) and for every object a in the domain D of J, it holds that J_{|{D\a}} ⊧ flat(T). If this does not hold then it uses J_{|{D\a}} instead of J. Therefore, by Lemma 4.2 we get that all objects in all interpretations in S are legal objects. This in turn implies that the hypothesis is in H(S, =).

Corollary 4.3 The class H(S) is learnable from equivalence and membership queries with hypothesis in H(S, =).

5 Learning from Entailment

In this model examples are clauses in the underlying language H(S) [FP93]. An example C ∈ H(S) is positive for T ∈ H(S) if T ⊧ C. The equivalence and membership oracles are defined accordingly. For membership queries, the learner presents a clause C and the oracle EntMQ returns “yes” iff T ⊧ C. For equivalence queries, the learner presents a hypothesis H ∈ H′ and the oracle EntEQ returns “yes” if for all I, I ⊧ T iff I ⊧ H; otherwise it returns a counter example C such that T ⊧ C and H |̸= C (a positive counter example) or T |̸= C and H ⊧ C (a negative counter example). The following lemma indicates that we can replace MQ by EntMQ for clauses in H(S, =).

Lemma 5.1 Let J ∈ str(S′) be such that J ⊧ A_{unique} and all objects in J are legal objects. Then unflat(complete(J)) |̸= T if and only if T ⊧ unflat(C) for some C ∈ rel-cands(J).

Proof: Let I = unflat(complete(J)). First note that by construction I |̸= unflat(C) for all C ∈ rel-cands(J). Hence if T ⊧ unflat(C) for some such C then I |̸= T.

For the other direction, recall that we can rewrite range restricted clauses in equational form as illustrated in Section 2. The equational form of C ∈ H(S) can be obtained by computing unflat(flat(C)). Let R be a clause in T in its equational form and θ a substitution such that I |̸= Rθ.

Let γ be the (reverse) substitution that is used when generating rel-cands(J). Since the antecedent of R is satisfied by θ in J we get that ant(R)θγ ⊆ ant(unflat(C)) for all C ∈ rel-cands(J), where ant() refers to the antecedent part of the clause considered as a set of literals. (The resulting substitution θγ is a variable renaming that may unify several variables into one.) Since in rel-cands(R) all consequents are considered, we get that for some C′ ∈ rel-cands(J), Rθγ ⊆ unflat(C′).^{3} We therefore get that T ⊧ R ⊧ Rθγ ⊧ unflat(C′).

We next prove a lemma that is instrumental in the decidability result as well.

Lemma 5.2 Given H ∈ H(S, =) and a clause C ∈ H(S, =) such that H |̸= C, one can find an interpretation I ∈ str(S) such that I ⊧ H and I |̸= C.

Proof: The idea is to generate an interpretation from C and then make sure (by forward chaining) that it is a model of H but not of C.

Generate a structure I_{0} ∈ str(S) as follows. First, introduce a unique domain element for each term in C and then collapse elements if their terms are equated in the antecedent of C; let this domain be D. The extension of predicates in I_{0} includes precisely the atoms corresponding to the antecedent of C and the mapping of domain elements produced. Let p be the (ground atom which is the) consequent of C under this mapping. To make I_{0} into an interpretation, (as in the complete() construction) add another domain element ∗ and map each term f(a_{1}, …, a_{n}) that has not yet been assigned to ∗.

3In other words R, θ-subsumes unflat(C′) [Plo70].

Next, let I = I_{0} and run forward chaining on H adding positive atoms to I. That is, repeat the following procedure: find a clause C in H and a substitution θ such that I |̸= Cθ and add the atom corresponding to the consequent of Cθ to I. This results in an interpretation I whose domain size is at most the number of distinct terms in C plus 1, and which is a model of H. This is true since H is definite and the domain of I_{0} is finite and hence by adding atoms to I_{0} we eventually get to a state where all clauses are satisfied (there is a finite number of atoms that can be added). We claim that p is not in I and hence I |̸= C.

By the restriction on H(S, =), all variables that appear in clauses in H are ancestors of at least one root variable. It follows that for any substitution in I_{0} for which any of the variables in a clause is mapped to ∗ the antecedent is falsified. Hence forward chaining does not produce any positive atoms containing the object ∗. Inductively, this shows that no such atom is true in I.

Let J be some interpretation such that J ⊧ H and J |̸= C (which exists by the condition of the lemma). Let θ be such that J |̸= Cθ and let q be the consequent of Cθ. Clearly, q is not true in J. Moreover, there is a mapping from objects in I_{0} (apart from ∗) to the objects in J that are used in Cθ, so that all positive atoms true in I_{0} are true in J under this mapping, and all equalities true in I_{0} (apart from ones referring to ∗) are true in J under this mapping. Namely, a homomorphic embedding [CK90] of I_{0}_{|D} into J.

Finally, assume that p is in I. Since its forward chaining does not touch the object ∗, we can use the same chaining under the homomorphism to generate q in J, and therefore since J ⊧ H, q is in J, a contradiction.

The above process is similar to the use of the chase procedure to decide on uniform containment of database queries [Sag88]. Since we have access to EntMQ we can make sure that all clauses in the hypothesis of the algorithm are implied by the target function. (This essentially replaces the positive counter examples in the interpretations setting with EntMQ in the entailment setting.) Thus, the following lemma indicates that in the presence of EntMQ we can replace EQ by EntEQ.

Lemma 5.3 Let T ∈ H(S), H ∈ H(S, =) and T ⊧ H. Given a positive (clause) counter example C ∈ H(S) such that T ⊧ C and H |̸= C one can find a negative (interpretation) counter example I such that I |̸= T and I ⊧ H.

Proof: This easily follows from the previous lemma since I |̸= C and T ⊧ C implies I |̸= T.

In fact the above construction shows that interpretation counter examples found in this way have a special structure. In particular, since C ∈ H(S) (in Lemma 5.3) every object in I (of Lemma 5.2) has a unique term associated with it (as generated from C). It follows that in the clauses generated in rel-cands(I) each variable has at most one defining equation. Therefore, the clauses can be “folded back” from the equational form into a range restricted form. This implies:

Corollary 5.4 The class H(S) is learnable from entailment equivalence queries and entailment membership queries with hypothesis in H(S).

6 Decidability

It makes sense to concentrate on a subset of the language for which implication is decidable. In such a case the learned expressions can be used as the knowledge base of the learner. Using the techniques developed for learning from clauses we can show that this holds for H(S, =). The complexity of this algorithm depends directly on the complexity of the forward chaining process; while we do not discuss this here there is a clear relationship to query evaluation in database theory (see discussion in [Sag88]) and more refined complexity results in the line of [PY97] can probably be derived.

Theorem 6.1 Implication is decidable for expressions in H(S, =).

Proof: To decide whether H ⊧ C where H, C ∈ H(S, =) construct the interpretation I as in Lemma 5.2. Then check if C is falsified by I (in which case H |̸= C) or not (H ⊧ C).

7 Discussion

While we have mostly presented various transformations between learning problems and examples, the resulting algorithm can be specified using the signature S alone. Moreover, for learning from entailment, pairing and other operations used in [Kha98] can be performed directly on clauses (or their antecedents) without resorting to the use of interpretations.

The resulting algorithm is similar to the algorithm for learning from entailment in the propositional case [FP93] as well as several previous ILP algorithms. In fact, the construction in Lemma 5.2 corresponds to elaboration in [SB86] and saturation in [Rou92], and flattening has been used before in [Rou92]. Our pairing procedure and the various minimisations of objects correspond to the LGG computation or the heuristic search used, but provide a more refined way to control the complexity of the process. In addition the dropping of non-legal literals is similar to what is done in [Rou92]. As we have shown a combination of these steps is formally justified in that it leads to convergence for range restricted Horn expressions.

References

[AFP92] D. Angluin, M. Frazier, and L. Pitt. Learning conjunctions of Horn clauses. Machine Learning, 9:147–164, 1992.

[AK95] D. Angluin and M. Kharitonov. When won’t membership queries help? Journal of Computer and System Sciences, 50:336–355, 1995.

[Ang88] D. Angluin. Queries and concept learning. Machine Learning, 2(4):319–342, 1988.

[CK90] C. Chang and J. Keisler. Model Theory. Amsterdam Oxford : North-Holland, 1990.

[Coh95a] W. Cohen. PAC-learning recursive logic programs: Efficient algorithms. Journal of Artificial Intelligence Research, 2:501–539, 1995.

[Coh95b] W. Cohen. PAC-learning recursive logic programs: Negative result. Journal of Artificial Intelligence Research, 2:541–573, 1995.

[DR97] L. De Raedt. Logical settings for concept learning. Artificial Intelligence, 95(1):187–201, 1997. See also relevant Errata.

[DRB92] L. De Raedt and Bruynooghe. An overview of the interactive concept learner and theory revisor CLINT. In S. Muggleton, editor, Inductive Logic Programming. Academic Press, 1992.

[DRD94] L. De Raedt and S. Dzeroski. First order jk-clausal theories are PAC-learnable. Artificial Intelligence, 70:375–392, 1994.

[FP93] M. Frazier and L. Pitt. Learning from entailment: An application to propositional Horn sentences. In Proceedings of the International Conference on Machine Learning, pages 120–127, Amherst, MA, 1993. Morgan Kaufmann.

[Hau89] D. Haussler. Learning conjunctive concepts in structural domains. Machine Learning, 4(1):7–40, 1989.

[Kha96] R. Khardon. Learning to take actions. In Proceedings of the National Conference on Artificial Intelligence, pages 787–792, Portland, Oregon, 1996. AAAI Press.

[Kha98] R. Khardon. Learning function free Horn expressions. Technical Report ECS-LFCS-98-394, Laboratory for Foundations of Computer Science, Edinburgh University, 1998. A preliminary version of this paper appeared in COLT 1998.

[Lit88] N. Littlestone. Learning quickly when irrelevant attributes abound: A new linear-threshold algorithm. Machine Learning, 2:285–318, 1988.

[Llo87] J.W. Lloyd. Foundations of Logic Programming. Springer Verlag, 1987. Second Edition.

[MB92] S. Muggleton and W. Buntine. Machine invention of first order predicates by inverting resolution. In S. Muggleton, editor, Inductive Logic Programming. Academic Press, 1992.

[MDR94] S. Muggleton and L. De Raedt. Inductive logic programming: Theory and methods. Journal of Logic Programming, 20:629–679, 1994.

[MF92] S. Muggleton and C. Feng. Efficient induction of logic programs. In S. Muggleton, editor, Inductive Logic Programming. Academic Press, 1992.

[Min88] J. Minker, editor. Foundations of Deductive Databases and Logic Programming. Morgan Kaufmann, 1988.

[NCDW97] S. Nienhuys-Cheng and R. De Wolf. Foundations of Inductive Logic Programming. Springer-verlag, 1997. Lecture notes in Artificial Intelligence, vol. 1228.

[Plo70] G. D. Plotkin. A note on inductive generalization. In B. Meltzer and D. Michie, editors, Machine Intelligence 5, pages 153–163. American Elsevier, 1970.

[PY97] C. H. Papadimitriou and M. Yannakakis. On the complexity of database queries. In Proceedings of the symposium on Principles of Database Systems, pages 12–19, Tucson, Arizona, 1997. ACM Press.

[Rou92] C. Rouveirol. Extensions of inversion of resolution applied to theory completion. In S. Muggleton, editor, Inductive Logic Programming. Academic Press, 1992.

[RT97] C. Reddy and P. Tadepalli. Learning Horn definitions with equivalence and membership queries. In International Workshop on Inductive Logic Programming, pages 243–255, Prague, Czech Republic, 1997. Springer. LNAI 1297.

[RT98] C. Reddy and P. Tadepalli. Learning first order acyclic Horn programs from entailment. In International Conference on Inductive Logic Programming, pages 23–37, Madison, WI, 1998. Springer. LNAI 1446.

[RTR96] C. Reddy, P. Tadepalli, and S. Roncagliolo. Theory guided empirical speedup learning of goal decomposition rules. In International Conference on Machine Learning, pages 409–416, Bari, Italy, 1996. Morgan Kaufmann.

[Sag88] Y. Sagiv. Optimizing datalog programs. In J. Minker, editor, Foundations of Deductive Databases and Logic Programming. Morgan Kaufmann, 1988.

[SB86] C. Sammut and R. Banerji. Learning concepts by asking questions. In R. Michalski, J. Carbonell, and T. Mitchell, editors, Machine Learning : An AI Approach, Volume II. Morgan Kaufman, 1986.

[Sha83] E. Y. Shapiro. Algorithmic Program Debugging. MIT Press, Cambridge, MA, 1983.

[Val84] L. G. Valiant. A theory of the learnable. Communications of the ACM, 27(11):1134–1142, 1984.

[Val85] L. G. Valiant. Learning disjunctions of conjunctions. In Proceedings of the International Joint Conference of Artificial Intelligence, pages 560–566, Los Angeles, CA, 1985. Morgan Kaufmann.