Automated Reasoning - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Automated Reasoning

Description:

{ beats_in_race(tortoise, Y), philosopher(Y)} have unifier n = {X/tortoise, Y/zeno} and generate the resolvent { philosopher(zeno), younger_than(tortoise, zeno)} 16 ... – PowerPoint PPT presentation

Number of Views:108
Avg rating:3.0/5.0
Slides: 24
Provided by: claude2
Category:

less

Transcript and Presenter's Notes

Title: Automated Reasoning


1
Declarative Progarmming Languages
COMP3006/3906
Lecture 9-10 Tatjana Zrimec
2
Ground vs non-ground term
  • An argument to a functor may be left unspecified
    - it may be a variable.
  • A term refers to both terms that contain
    variables and terms that do not.
  • If a term contains no variables, then it is said
    to be ground
  • otherwise we say the term is non-ground.
  • Given a relation r of arity n requiring n
    arguments,
  • an atom is an expression r(t1,..., tm) where each
    ti is a term.
  • an atom is ground if
  • each of its argument ti is ground
  • otherwise it is non-ground

3
Substitution
  • A substitution is a function that maps variables
    into terms which may or may not be ground.
  • Suppose q is the substitution that maps the
    variable X to 3, Y to house-of(W) and
  • Z to between(3, W)
  • Then one way to write q is
  • q(X) 3
  • q(Y) house-of(W)
  • q(Z) between(3, W)

4
Substitution
  • Given an expression E and a substitution q, q(E)
    denotes the expression obtained by simultaneously
    applying q to each variable occurring in E.
  • The expression q(E) is called an instance of E.
  • If q(E) is ground variable free, then q is said
    to be a grounding substitution for E and q(E) is
    said to be a ground instance of E.

5
Substitution
  • As an example
  • Suppose E is the variable X and q is as defined
    above.
  • Then q(E) is simply the term 3.
  • On the other hand, suppose
  • E is an atom r(X, Y).
  • Then q(r(X, Y)) is the non-ground atom
  • r(3, house-of(W)).
  • The substitution q is an example of a grounding
    substitution for E in the first case, but not in
    the latter case.

6
Unification
  • A binding will be a pair V e.
  • (variable V is bound to the expression, e.
  • e is a term.
  • X f(X) is not a legal binding.)
  • A set of bindings referred to as a substitution.
  • V1 e1 , V2 e2 ,V3 e3 , ... Vn en
  • q(e) is equal to eq.
  • To expressions, e1 and e2, unify (or are
    unifiable) if exists a set of bindings, such
    that
  • e1q e2q q is called a unifier
    of e1 and e2

7
Most General Unifier
  • We are interested in the most general unifier of
    two expressions
  • p(X, f(Y), b) and p(X, f(b), b)
  • the set of bindings X c, Y b is the
    unifier.
  • Y b is also a unifier
  • Y b is a more general unifier than X
    c, Y b

8
Most General Unifier
  • It can be shown that for any two unifiable terms,
    there exists a substitution that makes the fewest
    possible substitutions for variable of two terms.
  • The unifying substitution is called the Most
    General Unifier , or MGU.

Another way to denote a substitution
9
Resolution
  • Resolution, as defined in Languages and Logic, is
    a deduction method which uses only one rule, the
    resolution rule.
  • Resolution is an inference rule that derives one
    clause from two clauses.
  • A poof theory for Clausal Form Logic - CFL is
    based on the resolution.
  • In CFL,
  • a literal is an atom or the negation of an atom
  • A clause is therefor a disjunction of literals
  • A ground clause/literal/atom/term/wff is one
    without variables

10
Resolution
  • Example ( without variables)
  • (1) and (2) are parents
  • p1 and p1 are the selected literals
  • p1 and p1 are a complementary pair
  • (3) is a resolvent

From resolution of 1 and 2
Ø
Ø
11
Resolution
  • Example
  • The derivation of the empty clause o means that
    the original clauses are contradictory.

From resolution of 1 and 2
o
12
Resolution with variables
  • Clause can be resolved if there is some pair in
    the parents that is complementary when some MGU
    is applied to them.
  • The MGU is also applied to the resolvent.
  • Example

From resolution of 1 and 2 with MGU X a (X
/ a)
13
Resolution
  • Exercise 1
  • Example

Resolution from 1 and 2 with MGU X U, Y V
o
14
Resolution
  • Unification in resolution is a sophisticated
    form of pattern matching operation (used in
    Prolog).
  • When matching literals, we look for variable
    substitutions that will make the two expressions
    identical. Eg.
  • runs_faster_than(X, zeno)
  • runs_faster_than(tortoise, Y)
  • are identical under the substitution X/tortoise,
    Y/zeno

15
Resolving Clauses
  • To resolve two non-ground clauses, you must find
    a unifier for complimentary literals. Eg.
  • beats_in_race(X, zeno), younger_than(X,
    zeno)
  • and
  • beats_in_race(tortoise, Y),
    philosopher(Y)
  • have unifier n X/tortoise, Y/zeno and
    generate the resolvent
  • philosopher(zeno), younger_than(tortoise
    , zeno)

16
Proofs
  • We can prove a formula, p, if we can derive it
    from a theory,T, by a sequence of resolution
    steps.
  • Written as T O p.
  • If the theory is very large, there may be many
    ways of deriving a proof.
  • How can we find a short derivation?
  • We try a proof by refutation, ie. add negation of
    goal to theory and show that the new theory is
    inconsistent, ie. implies false.
  • The empty clause, , is interpreted as false.
    So if theory derives false, we have an
    inconsistent theory.

o
17
Resolution
  • Resolution is very good at demonstrating
    inconsistency (unsatisfiability).
  • If a set of clauses is unsatisfiable, then it is
    always possible by resolution alone to derive a
    contradiction from the clauses in the set.
  • In clausal from a contradiction takes the from of
    the empty clause, .

o
18
Resolution refutation
  • To prove p follows from some theory, T, assume
    p and then try to derive a contradiction from
    its conjunction with T.
  • This way of doing proof by contradiction is
    known as refutation theorem proving.
  • Resolution refutation theorem proving is
    refutation theorem proving where the inference
    rule is resolution.

19
Resolution refutation tree
  • Resolution that lead to the derivation of
    can be shown as a refutation tree.
  • Show that the following clauses are inconsistent

o
o
20
Horn Clauses
  • A Horn clause is one which only has a single
    positive literal, eg.

p

q
,
K
,
q

1
1
n
  • The programming language, Prolog, consists of
    Horn clause definitions, eg.
  • on(a, b).
  • on(b, c).
  • above(X, Y) - on(X, Y).
  • above(X, Y) - on(Z, Y), above(X, Z).

Let ask Prolog
?- above(a, c).
- above(a, c).
21
A Prolog Proof Tree
- above(a, c).
above(X, Y) - on(Z, Y), above(X, Z).
- on(Z, c), above(a, Z).
on(b, c).
- above(a, b).
above(X, Y) - on(X, Y).
- on(a, b).
on(a, b).
o
22
Resolution Search
  • Resolution uses backward chaining to focus search
    for clauses to resolve.
  • There are many refinements to this search.
  • We will stick to the Prolog method which resolves
    clauses and their literals in input order, ie,
    top-to-bottom, left-to-right.

23
Soundness and Completeness
  • A proof procedure is sound if every formula it
    derives is true. Ie. it cannot prove something it
    shouldn't.
  • A proof procedure is complete if it can derive
    every thing that is possible to derive from a
    theory. Ie. There is no true statement that it
    cannot prove.
  • Decidability means that we can always show if a
    proposition follows from a theory.
  • Prolog's proof procedure is sound and complete
    for Horn clauses.
  • Unrestricted first-order logic is undecidable.
Write a Comment
User Comments (0)
About PowerShow.com