Title: AR for Horn clause logic
1AR for Horn clause logic
2How to deal with variables?
Principle use instantiations of the 2 Horn
clauses, such that these DO match.
3More examples
- We drop the universal quantification, since all
variables are universally quantified anyway.
- Some examples using standard modus ponens
Unification !!
4Substitutions
? x / g(z) , y / B
? x / h(g(A)) , y / g(A) , z / w
- A substitution is a finite set of pairs of the
form variable / term, such that all variables at
the left-hand sides of the pairs are distinct.
- In our substitutions we will NOT allow that some
variable that occurs left also occurs in some
term at the right.
5Applying substitutions
? x / g(z) , y / B
p(x , f(y, z)) ? p(g(z) , f(B, z))
? x / h(g(A)) , y / g(A) , z / w
p(x, f(y, z)) ? p(h(g(A)) , f(g(A) , w))
- Substitutions can be applied to simple
expressions (atoms or terms), by replacing all
occurrences of the left-side variables in the
expression by the corresponding terms.
6Remember the motivation
- We want substitutions that make atoms equal.
7Unifiers
S related(John,x), related(y, father(y))
? y / John, x / father(John) is a unifier for
S
8One more refinement
? x / John, y / Mary, z / Mary
etc.
9Relation between these?
S ? (S ?) ?
10Most general unifier
- Key-idea create minimal instantiation changes!
- Notation ? mgu(S) , or ? mgu(A, B) for S
A,B
11Generalized modus ponens for Horn clauses
- Generalized modus ponens must be further extended
as
- Note Bi and Bi must have the same predicate.
- Correctness due to correctness for all ground
instances of this derivation.
12Example a few steps
false ? big(house(y))
- Observe we will always provide the variables
with new names in order to avoid accidental
clashes of names.
13Backward procedure for Horn clauses
- Again concrete versions of this generic scheme
should allow for backtracking over previous
selections, - or they should treat the problem as a general
search problem through the space of derivable
goals.
14The example again
false ? lot_maint(house(x))
false ? big(house(x))
false ? rich(x)
false ? showm(x) ? european(x)
false ? showm(x) ? belg(x)
false ? showm(Bos)
false ?
15Why rename variables?
- Consider the derivation step
- Problem p(y) ? q(x,y) is equivalent with p(y) ?
q(z,y) so that alternatively we could perform the
step
- Which gives us a strictly stronger conclusion !
- Always first rename variables apart !!
16Another example
false ? anc(u,v)
Several different proofs are possible !
17Completeness
- Backward generalized modus ponens, using a
complete search method to search the space of
derived goals and with renaming of variables is
complete.
- Remark that it can only be semi-deciding, because
the search space of goals may be infinitely
large.
- thus, in general, this cannot help us to decide
whether false ? is derivable.
18An infinite derivation
nat(s(x)) ? nat(x) false ? nat(u)
false ? nat(u)
19Using a complete searchwe do get an answer for
nat(0) nat(s(x)) ? nat(x) false ? nat(u)
false ? nat(u)
20Unification
- A basic algorithm in Automated Reasoning
21A unification algorithm
Stop false
22Unification algorithm (2)
23Example 1
- Unify p(B,y) and p(x,f(x))
- Case 5 mgu B x, y f(x)
- Case 1 mgu x B, y f(x)
- Case 4 mgu x B, y f(B)
- No more cases applicable !
- p(B,y) and p(x,f(x)) are unifiable
- mgu x/B, y/f(B)
- result p(B, f(B))
24Example 2 3
- Case 5 mgu A f(x)
- Case 5 Stop true
25Termination of the algorithm
- no unifier
- expressions are not unifiable
- mgu contains a set of equalities of the form
- x1 t1, , xn tn with
- all x1,,xn mutually distinct variables !
- The substitution x1/t1,,xn/tn is a most
general unifier for the initial s and t . - Martelli-Montanari algorithm.
- Extendable for more than 2 expressions.
26Deducing with unification
vertical(segment(point(x,y),point(x,z))) horizonta
l(segment(point(x,y),point(z,y)))
?u vertical(segment(point(1,2),u))
?u,v horizontal(segment(point(1,u),point(2,v)))
27Representation-powerof Horn clauses
- Most predicate logic formulae can easily be
rewritten in Horn clauses.
?x cat(x) ? dog(x) ? pet(x)
?x poodle(x) ? dog(x) ? small(x)
?x human(x) ? male(x) ? female(x)
?x dog(x) ? abnormal(x) ? has_4_legs(x)