Predicate Logic (PowerPoint) by yurtgc548

VIEWS: 12 PAGES: 36

									Predicate Logic

        Colin Campbell
     A Formal Language
   Predicate Logic provides a way to
    formalize natural language so that
    ambiguity is removed.
   Mathematical arguments (proofs) are
    usually written in pseudo logic.
   Many programming languages involve
    elements of predicate logic. e.g. if..then
     Predicate vs Propositional
     Logic
   Predicate logic uses the same connectives
    as propositional logic but allows you to
    refer to different elements of the
    universe.
   It also introduces quantifiers…so you can
    say things like..
   It always rains in England.
   Sometimes it is sunny in Bristol.
       Propositional Logic Revised
   Propositional Logic is a formal approach to
    reasoning with or about declarative
    sentences.

     If David likes Mary then Mary likes David
     David likes Mary
     Mary likes David
     Semantics vs Proof Theory
   There are two approaches to reasoning in
    propositional logic.

    Semantics = truth tables and valuations

Proof theory    = formal notion of proof from
                axioms and inference rule
     Truth-Tables
    The truth value of compound sentences can then be
     determined by application of truth tables defined for
     each connective
      A    A     A    B    AB     A    B    AB
      t     f     t    t     t       t   t     t
      f     t     f    t     f       f   t     t     etc
                  t    f     f       t   f     f
                  f    f     f       f   f     t
A sentence B truth-functionally follows from sentence A if
for every row of the truth-table in which A is true B is also
true. Denoted A|=B
   Formal Proof
T=set of assumptions (sentences) then T|-A if we can
generate a sequence of sentences
                                     Axioms for propositional logic
S1,S2,…,Si-1,Si,…,Sn=A               1. A(B A)
                                     2. (A (B C)) ((A B)
Where either                            (A C))
Si=axiom                             3. (B  A) ((B A)
 = a sentence in T (an assumption)      B)

or                                   Inference Rule: Modus
S1,…,Si-1 (inference rule) Si       Ponens
                                     From A,AB infer B
  Relating Semantics and Proof
Soundness

   Proof theory  Semantics

Completeness

   Semantics  Proof theory

Propositional logic is sound and complete

   Semantics = Proof theory
     Decidability
   A formal logic is decidable if there is a mechanical
    (algorithmic) way of determining whether A follows
    from T.
           T|=A ?
                              Propositional logic is
                              decidable: at worst we
                              need only consider
                        yes   every row of the truth-
                              table for which T is
                              true, and there are only
                              finitely many.
           No
       Predicate Logic: Introducing
       Quantifiers
    Predicate logic allows for quantified statements by
     introducing the quantifiers  “for all” and  “there
     exists”.
     Why do we need quantifiers ? Consider
              All birds have wings
              Tweety is a bird
              Therefore, Tweety has wings
    Propositional logic: All birds have wings= (Robins have
    wings)(Crows have wings)(Eagles have wings)
    ..........etc.
    This is impractical.
     Quantifiers 2:
    In predicate logic this translates to

          xBx   W x 
                                     • Unlike propositional logic,
                                     predicate logic has variables- in
                                     this case x.
          BTweety                  • It also has constants – in this
                                     case Tweety
          W Tweety                • Tweety is an instantiation of
                                     the predicates B and W.


B(x)= x is a Bird, W(x)=x has wings,
x (B(x)W(x)) = For all x, if x is a bird then x has wings
B(Tweety)=Tweety is a bird.
W(Tweety)=Tweety has wings
      Functions
   It is also desirable to be able to represent functional
    relationships in predicate logic. Consider

    Blue eyed people have blue eyed fathers
    Some people have blue eyes
    Therefore, some people’s fathers have blue eyes
    Translates to            x is a variable ranging across all people
                    
    x BEx   BE F x     BE(x) -means “person x has blue eyes”
    xBEx 
                             F is a function mapping from one
           
    xBE F x              person x to another person F(x), where
                             F(x) is the father of x
     Syntax: Building Blocks for
     Predicate Logic
   Formula in predicate are built up from the
    following elements
   (1) Predicates: PL is a set of n-ary
    predicates. e.g.
   B(x)=x is a bird –unary
   M(x,y)=x is married to y –binary
   BT(x,y,z)=y is between x and z –tertiary
     Syntax (2)
   (2) Functions: FNL is a set of n-ary
    functions.
   F(x)=Father of x, D(x,y,z)=Day of the
    weeks falling on the date x/y/z.
   (3) Constants: CL is a set of constants
    e.g. Tweety, numbers, Aunty Ethel
   (4) Variables: a set of variables, x,y,z etc
   (5) Connectives, Quantifiers and
    Brackets: ,,,,, (,),[,]
       Terms
    Terms are possible instantiations of predicates.
     The set of terms TL is defined recursively in the
     following way:
    (i) All variables and constants are terms
    (ii) If f is an n - ary function symbols and t1....tn are
    terms then f(t1....tn) is a term.
    FNL={father, mother, first-child}, CL={bill}, VL={x} -
    ranging across parents
x, bill, father(x), mother(x), first-child(x), father(bill), mother(bill),
first-child(bill), father(father(x)), father(mother(x)), first-child(father(x))
father(father(bill)), father(mother(bill)),.......etc
      Formula in Predicate Logic
   Atomic Formula: The atomic formula ATL, have the
    form P(t1,...., tn) where P is an n-ary relation in PL
    and ti are terms for i=1,...,n
   E.g. PNL={Rich,Happy},
    FNL={father,mother},CL={jim, fred, mary},
    VL={x,y}
   Atomic formula include…Rich(x), Happy(y), Rich(bill),
    Happy(father(y)), Rich(mother(mary)),
    Happy(father(mother(x))) etc
     Formula 2
   Well-Formed Formula: The set of well-formed
    formula WFL is defined recursively as follows:

    (i) all atomic formula are well-formed formula
    (ii) If F and G are well-formed formula so are (F),
    (FG), (FG), (FG), (FG)
    (iii) If F is a well-formed formula and xVL then
    (xF) and (xF) are well-formed formula.

E.g. Rich(x)Happy(x), Rich(x)Happy(y),
Rich(bill)Happy(father(fred)),
(x Happy(x)) yRich(y)), x(Rich(x) Happy(x))
       Translating from Logic to
       English
   Example: PL ={married, younger-than, equal} all binary
                VL={x,y,z} ranging over all parents
                CL={bill, john, george, mary}
                FNL={father, mother, first-child} -all unary
                Connectives ,,,,
                Quantifiers ,, Brackets
married(mary,john) translates to ”Mary is married to John”
equal(father(bill),george) translates to ”George is the father of Bill”
equal(mother(mother(bill)),mary) translates to ”Mary is the maternal
grandmother of Bill”
(equal(mother(x),y)equal(father(x),y)) translates to ”y is a parent of x”
xy(married(x,y) married(y,x)) translates to ”for any parents x and y
if x is married to y then y is married to x”
xy(equal(mother(x),y) translates to ”everyone has a mother”
     Translating from English to
     Logic
   “Anyone who is persistent can learn logic” translates
    to x(persistent(x)learn(x, logic))
   “All blocks which are on top of or attached to blocks
    which have been moved, have also been moved”
    translates to xy((block(x)block(y)(ontop(x,y)
    attached(x,y))moved(y))moved(x))
   “You can fool some of the people all of the time, and
    you can fool all the people some of the time, but you
    can’t fool all the people all the time” translates to
    xy(person(x)time(y)fool-at(y,x)) 
    yx(person(x)time(y)fool-at(y,x)) 
    (x y (person(x)time(y)fool-at(y,x)))
       Removing Ambiguity
   Bertrand Russell gave the following example of how
    translating to logic can remove ambiguity.
   Consider the sentence “The current king of France is
    bald”. Is this sentence true?
   Translating to logic gives:
   x(KF(x)B(x))
   KF(x)= x is the current king of France.
   B(x)= x is bald.
   This is clearly false! Why?
    Whoops-Missed a bit
                 Its only me!
                                So the correct translation is
                                xKF(x)
                                x(KF(x)y(KF(y)equals(x,y)))
                                x(KF(x)B(x))

                                Still false though!



What about “the current king of France is not bald” – is it
true or false?
     Declarative Formula
   Some formula have a truth-value while others don’t.
   xy(equal(mother(x),y) has a truth-value
   So does x(Rich(x)Happy(x))
   But neither Rich(x) nor married(x,y) married(y,x)
    have truth values.
   In predicate logic declarative formula are closed.
    Non-declarative form are open.
       Open and Closed Formula
   Scope of a Quantifier: The scope of x (resp. x) in x
    F (resp x F) is F
   E.g. In x(Rich(x)Happy(x)) the scope of x is
    (Rich(x)Happy(x))
   In xy(equal(mother(x),y) the scope of x is
    y(equal(mother(x),y) and the scope of y is
    (equal(mother(x),y)
   Free and Bound Occurrence of a Variable: A bound
    occurrence of a variable in a formula is an occurrence
    immediately following a quantifier or an occurrence within
    the scope of a quantifier, which has the same variable
    immediately after the quantifier.
   Any other variable is free.
      Open and Closed:2
   Example: In the formula (xP(x,y))Q(x) the
    occurrence of x in P(x,y) is bound but the occurrence
    of x in Q(x) is free.
    All occurrences of x in x(P(x,y)Q(x)) are bound.
   Open and Closed Formula: A closed formula is a
    well-formed formula with no free occurrences of any
    variable. An open formula is a formula that is not
    closed
   Example: xy(equal(mother(x),y) is closed since
    all occurrences of x fall within the cope of x and all
    occurrences of y fall within the sope of y.
      Interpretations
   Really a language of predicate logic is only a set of
    symbols which can be interpreted in different ways.
   Consider the formula: yxP(x,y)
   Quantification over natural numbers, P(x,y) means
    xy then interpretation is `for all natural numbers x
    there is some natural y for which xy’
   Quantification over people, P(x,y) means `y is the
    father of x’ then interpretation is `there is some who
    is the father of everyone’
   Interpretations:2
    U1                                           U2
                        Formal Logic
                    I                   J   PL J={PJ,QJ,RJ,..}
PLI={PI,QI,RI,..}       PL={P,Q,R,..}
                                            FL J={fJ,gJ,hJ,..}
FLI={fI,gI,hI,..}       FL={f,g,h,..}
                                            CL J={aJ,bJ,cJ,..}
CLI={aI,bI,cI,..}       CL={a,b,c,..}
    Theories and Models
   Theory: A theory of a language of
    predicate logic L is any finite set of
    closed well-formed formula of L.
   Model: A model of a theory T is an
    interpretation of L under which all the
    formula in T are true.
    Satisfiability
   A theory of L, is satisfiable if it has at
    least one model.
   Any theory that is not satisfiable is said
    to be inconsistent.
   Any theory for which every possible
    interpretation is a model is said to be
    valid.
     Satisfiability: 2
   The theory consisting of the single
    formula x(P(x) P(x)) is inconsistent.
   The theory {x (P(x) P(x))} is valid.
    Example
   Consider the following theories:
            T1  xyPx, y   Pc, f c 
            T2  xPx, f x   yPc, y 

   Also consider the following two interpretations
    Interpretation I: Let U1 be the set of all integers, cI=0,
    fI is the successor function, PI is >

    Interpretation J: Let U2 be the set of all integers,
    cJ=0, fJ is the predecessor function, PI is 
     Example: 2
Under I
T1 means
If for every integer x there is some integer y such that x>y
then 0>0+1
Clearly this is false since the antecedent is true and the
consequence is false - I is not a model of T1

T2 means
If for every integer x x>x+1 then there exists an integer y
such that 0>y
This is true since the antecedent is false - I is a model of T2
    Example: 3
Under J
T1 means
If for every integer x there is some integer y such that xy
then 0  0-1
Clearly this is true since both the antecedent and
consequence are true - J is a model of T1

T2 means
If for every integer x, x x-1 then there exists an integer y
such that 0y
This is true since, again, both antecedent and consequence
are true - J is a model of T2
     Example: 4
   We see that T1 is not a valid theory since I
    is not a model of T1.
   Both I and J are models of T2. Is T2 valid?
   Let K be any interpretation of L then T2
    means
   If for every element xU PK (x, fK(x)) then
    there exists some element yU such that
    PK(cK, y ).
    Example: 5
   Two possibilities
   Antecedent false -in this case the
    conditional is automatically true.
   Antecedent true -in this case since cKU
    we have PK (cK, fK(cK)) and hence the
    consequence of the conditional must
    also be true since we can select y to be
    fK(cK).
      Semantic Entailment
   A theory T is said to entail a closed formula F if F is true
    in every model of T.
             T F                            T F

     models of F      models of F       models of F      models of F

     models of T                                          models of T




                   models of F    models of F         T F
                           models of T                 T F
    Decidability
      T F                 T F


      Proof                Proof
   Procedure             Procedure        Predicate logic is only
  Query: does F        Query: does F      semi-decidable
  follow from T        follow from T



Algorithm terminate   Algorithm may or
and answers “yes”     may not terminate
                      and answers “no”

								
To top