Download presentation

Presentation is loading. Please wait.

Published byZachary Eve Modified over 2 years ago

1
**SLD-resolution Introduction Most general unifiers SLD-resolution**

Soundness Completeness

2
**Proof of A = refutation of A**

: true (any valid formula) : false (any unsatisfiable formula) Fact 1 P |= A iff P { A} |= Fact 2 if P { A} |- then P { A} |= supposing the inference rules are sound ’if and only if’ if they are sound and complete idea of ‘proof by refutation’ start from P and A apply inference rules until is produced if so, we know that P |= A

3
**Refutation proofs with clauses**

Definite clauses F can be read as F G1, ..., Gm G1, ..., Gm ‘empty clause’ Refutation proofs start from P and G1,...,Gm try to derive the ‘empty clause’ example pp : a sort of generalized Modus Ponens

4
**How to automate refutations?**

G = G1, ...,Gm select some Gi = p(t1, ..., tn) look for clauses ‘defining’ p/n H B1, ..., Bk (we may have several such) make Gi and H syntactically identical reason: Modus Ponens requires it find substitution (unifier) such that H = Gi if such exists, apply it to (B1,...,Bk) and the rest of G new goal: ( G1, ..., B1, ..., Bk, ... Gm) continue until G is empty (if possible)

5
**What did we just compute?**

G: ( (G1 ... Gm)) ( G1 ... Gm) if G lead to contradiction then we have the conclusion that G1 ... Gm holds Derivation: any chain of inference steps Refutation of G: finite derivation of falsity starting from G consists of k inferences with k unifications i (1 i k) (( G1 ... Gm) 1... k) was shown to be unsatisfiable fact: p(X) is unsatisfiable iff some instance of p(X) is Thus: P |= (G1 ... Gm) 1 ... k 1 ... k is the counter-example or the answer to our question if some variables are left unbound we may assume the universal closure

6
**Troubles in the computation**

Selections: deterministic or not? goal literals program clauses unifiers Computations:success/fail/infinite? dead ends (no matching clauses) infinite number of solutions (several unifiers) loops (p p)

7
**Most general unifiers Algorithmic solution to the ‘matching’ problem**

deterministic & efficient Vocabulary predicate symbols & functors: constructors atoms, terms: structures principal symbol, direct substructures size of a structure (# of symbols)

8
**Unifier (definition) Let s1, s2 be structures and a substitution**

if s1 = s2 then is a unifier of s1 and s2 Notes if s contains X then X and s have no unifier proof: size(s) > size(X) size(s) > size(X) whatever is unifier may leave (some) variables free composition of with any substitution yields another unifier each of them is ‘more specific’ than

9
**Generality of unifiers**

let and be unifiers of s and t = : is more general than any s is an instance of s Note: generality is not antisymmetric … … but the following holds if is more general than and vice versa then s and s are identical up to the renaming of variables

10
**Most general unifier(s), mgu**

substitution is a mgu of s & t if is a unifier of s & t is more general than any other unifier of s & t Thm: mgus are unique up to renaming! mgus are the substitutions we are looking for in the matching problem: how to find them effectively

11
**(yet) Some (more) terminology**

Set of equations {X1=t1,…,Xn=tn} is in solved form iff X1,…,Xn are distinct variables, and none of X1,…,Xn appear in t1,…,tn Proposition If E = {X1=t1,…,Xn=tn} is in solved form then = {X1/t1,…,Xn/tn} is a mgu of E Definition: E1 and E2 are equivalent both have the same set of unifiers consequently same solutions in Herbr. interpretations

12
**Unification algorithm**

Several implementations exist simple O(min(size(s), size(t))) presented with ‘occurs check’: quadratic time Basic ideas if s is a variable, bind it to t (and vice versa) if both are structures (or constants) principal symbols must be the same direct substructures must unify (use recursion) note: bindings may ‘spread’ elsewhere in terms same variable may have several occurrences

13
**Our algorithm (p. 40) To unify s & t Theorem: Algorithm returns**

try to transform {s = t} into an equivalent one in solved form if this succeeds, the result gives also a mgu of s & t if this fails, no unifier exists note: constants are treated as 0-ary functors Theorem: Algorithm returns the equivalent solved form of s = t or ‘failure’ if no such exists

14
**Resolution rule Inference rule for definite clauses & goals From**

( (G1,...,Gi,...,Gm)) and ( H B1,...,Bk) such that Gi and H have a mgu derive ( (G1,...,B1,...,Bk,...,Gm))

15
**Procedural view FROM SUCH THAT DERIVE query G and clause C**

subgoal Gi of G and the head H of C unify DERIVE a new query G’ with Gi replaced with body of C and mgu of H and Gi applied to the result

16
**Resolution: technicalities (i)**

Both premises universally closed scopes of the quantifiers are disjoint Conclusion is universally closed variables in the premises must be disjoint What to do? rename variables in clauses before inference e.g. attach the # of the inference step to all variables allows multiple uses of the same clause essential with recursive clauses

17
**Resolution: technicalities (ii)**

Selection of subgoals abstraction: assume some selection function a.k.a. computation rule SLD-resolution Linear resolution for Definite clauses with Selection function linear resolution P1 is always the query created in the previous step P2 is always a program clause

18
**Using SLD-resolution G0 = A1,...,Am (G0) = Ai apply resolution to**

Ai and a (renamed copy of a) program clause C construct new goal G1, then G2, ... computations end (at some goal Gi) when (Gi) does not unify with any clause head or Gi = false (empty goal) infinite computations possible, too

19
**Formalizing resolution proofs**

SLD-derivation From Gi & (a copy of) Ci, determine G(i+1) Note: Gi, & Ci determine (i+1) reason: mgus are unique (up to var. names) no need to state separately in derivations including s improves the readability, though G(i+1) is said to be derived from Gi & Ci Gi & Ci resolve into G(i+1) special notation (jagged arrow, p. 44) Each derivation G0,...,Gn yields a computed substitution 1…n Example 3.13 p. 45

20
**Successful derivations**

Finite and end to the empty goal SLD-refutation of G answer substitution = computed substitution of a refutation Theorem (independence of the computation rule) If G has a SLD-refutation with some rule 1 then G has one with the same answer with any other rule 2, and the refutation ‘2’ is obtained by permuting the clauses used in the refutation ‘1’ proof intuitive reason all subgoals are selected sooner or later same clauses are used to refute each of them

21
**Classifying derivations**

Successful lead to false Failed lead to some goal Gi such that (Gi) does no unify with any clause head note: it doesn’t matter if there are some other subgoals than the selected one which unify with some clause head, we are stuck with the selected one anyway Infinite Complete derivation: any of the above ’taken to the extreme’, continued as long as possible

22
**SLD-trees... Consider alternative clauses for a selected subgoal**

(Gi) may unify with several clauses Gi may have several (and different) complete derivations with rule SLD-trees formalize the set of all such derivations nodes: goals (G0 at the root) edges are labeled with the clause used in inference descendant: the resulting new goal Each path represents some derivation some may fail, some succeed, some may be infinite Definition 3.18.

23
...SLD-trees SLD-trees are (usually) distinct for different selection functions Finite tree with 1 & infinite with 2 possible! Independence of computation rule tells that refutations in tree T1 (using 1) are also found in T2 (using 2) and are permutations of the paths in T1 Note there may exist other failing or infinite paths for which the above does not hold but they don’t interest us that much anyway it is enough that the successful derivations are found

24
**Soundness of SLD-resolution**

Final conclusion for a give goal G try to find a refutation of G if found, apply the answer substitution to G this step is actually an additional inference rule SLD-resolution gives answers p(X), …, empty goal, = {X/tom,…} reasoning is sound, if P |= p(tom) Answer = computed substitution restricted on query variables negative answer is possible, too Soundness (or correctness) Shown w.r.t. computed answer substitutions Reason: user is not (usually) interested in individual resolution steps, but the final answer

25
**Soundness theorem (Clark -79)**

Let P be a definite program a selection function a -computed answer for goal A1,…,Am Then P |= ( (A1 … Am) ) Note Requires ‘occurs-check’ in unification see example 3.21

26
Completeness theorem... Does SLD-resolution compute all logical consequences? strictly speaking NOT, but practically YES, since every correct answer is an instance of some computed answer Let P, A1,…,Am, and be as before If P |= (A1 … Am) Then there exists a refutation of A1,…,Am with answer such that (A1 … Am) is an instance of (A1 … Am) See Example 3.23

27
...Completeness theorem Most general unifiers are used in inference steps refutations give the most general answers necessity for completeness theorem to hold Thm. confirms only the existence of a refutation does not tell how to find one in practice, we have to systematically search in the SLD-tree for the successful derivations

28
**Search in SLD-trees Prolog systems Breadth-first?**

Textual ordering of clauses ordering of edges Depth-first –search in this order Backtrack from leaf nodes Solutions are reported at empty leaves Property: the above is complete for finite SLD-trees Infinite trees infinite paths infinite search Breadth-first? theoretically better makes implementation (memory management) much more complicated too slow for practical applications

29
**Proof trees Structural representations for SLD-derivations**

like derivation trees in CF grammars each clause represents an elementary tree derivation tree = combination of elementary trees joint nodes labeled with equations for clause head & corresponding body atom above proof tree a complete derivation tree, i.e. all leaf nodes are constants true

30
**Proof trees… Alternative view**

proof tree = collection of equations (joint nodes) consistent tree: equation set has a solved form not all derivation trees are consistent Note: works also in other interpretations i.e. no matter what the ‘equality’ stands for Extension: use (atomic) goals as the root solved form = an answer for the goal Simplification of proof trees apply the substitution induced by the solved form to the tree collapse identical equations into one node simplified tree shows (clearly) the consistence

31
**Searching for a consistent proof tree**

Two (possibly) interleaved processes combination of elementary trees given this subgoal, try out this clause simplification of nodes not necessary to simplify the whole tree at once In which order to simplify? construct the whole tree & check then check while building check the whole set of equations when new ones are added simplify the tree as new equations are introduced Prolog approach build tree in depth-first manner simplify immediately

32
**Derivations and proof trees**

Many derivations may map to the same proof tree Clear due to the independence of computation rule computation rule tells the order in which equations are solved the final result stays the same

Similar presentations

OK

AI - Week 16 Logic and Reasoning in AI: Resolution Refutation Lee McCluskey, room 2/07

AI - Week 16 Logic and Reasoning in AI: Resolution Refutation Lee McCluskey, room 2/07

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on historical places in jaipur Ppt on biotechnology in india Ppt on what is critical whiteness theory Ppt online to pdf Ppt on peak load pricing economics Ppt on ecops News oppt one peoples Ppt on networking related topics in ict Ppt on l&t construction Ppt on ac to dc rectifier circuit