First-Order Logic (FOL) - PowerPoint PPT Presentation

About This Presentation
Title:

First-Order Logic (FOL)

Description:

First-Order Logic (Predicate Calculus) Some statements encode axioms from which other statements can be proven E.g., natural(0) and x natural(x) natural(successor(x)) – PowerPoint PPT presentation

Number of Views:76
Avg rating:3.0/5.0
Slides: 8
Provided by: cseWustl
Category:
Tags: fol | first | horn | logic | order

less

Transcript and Presenter's Notes

Title: First-Order Logic (FOL)


1
First-Order Logic (FOL)
  • Some logic statements may encode axioms from
    which other statements can be proven
  • E.g., natural(0) and? x natural(x) ?
    natural(successor(x))
  • Different constructs make up first-order-logic
  • Constants like 0 or 1 (usually numbers or names)
  • Variables like x whose possible values are sets
    of constants
  • Predicates like natural that return true or false
  • Functions like successor that return a constant
    or variable
  • Connectives like and, or, not, ?, and ?
  • Quantifiers like ? and ? that also introduce
    bound variables
  • Punctuation symbols like parentheses, commas,
    periods
  • Inference rules can produce new (proven)
    statements
  • E.g., (a ? b) and (b ? c) allows us to assert (a
    ? c)

2
Horn Clauses
  • A restricted form of first-order-logic
  • Statements are of the form (a ? b ? c) ? d
  • Equivalent to a? b ? c ? d
  • d is the head of the clause
  • (a ? b ? c) is the body of the clause
  • a and b and c and d are predicates of arbitrary
    arity (they each may take 0 or more arguments and
    return a Boolean result), e.g., true,
    isEnrolled(alice), parent(X, Y), etc.
  • Axioms or facts
  • Written in the form ? d (or just d )
  • Procedural interpretation of Horn Clauses
  • If you have the body of a clause, produce its
    head
  • Motivates use of the resolution inference rule

3
Unification
  • Given two clauses that potentially could be
    matched but in which variable naming/binding
    isnt the same
  • Predicates, e.g., in425(alice) and in425(X), can
    be unified (matched) under substitution, e.g.,
    alice/X (alice for X) where alice is a constant
    and X is a variable
  • Each such substitution then must be remembered
    for all occurrences of that variable within the
    horn clauses being considered (e.g., inputs and
    outputs to a resolution step)
  • Rules for transforming/matching statements
  • Can rename variables (variable substitution) as
    in X/Y
  • Can bind values (constant substitution) as in
    alice/X
  • Cannot modify constants like alice

4
Resolution
  • Straightforward inference rule for Horn clauses
  • Match existing facts to the terms in the body of
    a clause
  • If all are matched (unified), assert the head of
    that clause
  • E.g., in425(alice) and in425(X) ? isEnrolled(X)
  • allow assertion of isEnrolled(alice)
  • Can also use resolution to evaluate queries
  • Written as the body of a clause
  • If all of the terms in it can be matched, it is
    proven true (a good example of the idea of a
    deductive database since it then can be added to
    the set of available statements)

5
Execution Order
  • Resolution in Prolog uses a depth-first search
    strategy
  • Replaces goals left-to-right
  • Works through database top-to-bottom
  • Sub-goals are considered as soon as possible
  • Whenever failure occurs, Prolog backtracks to
    continue
  • Can exploit this behavior to cause iteration
  • E.g., to do repetitive searches, show all
    answers, etc.
  • Built-in predicate fail forces backtracking
  • Watch out for unbounded recursion
  • E.g., need to be sure search will progress to
    termination

6
Some Problems with Logic Programming
  • Occur-check problem
  • A unification algorithm does not check whether a
    term that is being unified with a variable
    contains that variable itself
  • Can lead to non-progressing iteration (which does
    not halt)
  • Negation as failure (and vice versa)
  • Absence of proof is not proof of absence (but
    negation can make it appear that way),
    backtracking may release bindings
  • Expressive power of Horn clauses is limited
  • E.g., cannot express existential quantification
    as in ? x p(x)
  • Problems involving control information
  • Order of clauses (and statements) affects
    evaluation order
  • In terms of pure logic this does not matter
  • For logic programming this impacts progress,
    termination

7
Todays Studio Exercises
  • Well continue looking at logic programming
  • Building up to simple Horn clause evaluation
  • Lab 3 will use unification and resolution to
    produce new Horn clauses from existing ones
  • Todays exercises are again in C
  • Continuing to build on the examples from last
    time
  • When done, please email your answers to the
    studio exercises to the cse425_at_seas.wustl.edu
    course account, with subject Logic Programming
    Studio II
Write a Comment
User Comments (0)
About PowerShow.com