predicate calculus. first-order logic whereas propositional logic assumes the world contains facts,...

35
Predicate Calculus

Post on 21-Dec-2015

225 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Predicate Calculus

Page 2: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

First-order logic

• Whereas propositional logic assumes the world contains facts,

• first-order logic (like natural language) assumes the world contains

• Objects: people, houses, numbers, colors, baseball games, wars, …

• Relations: red, round, prime, brother of, bigger than, part of, comes between, …

Page 3: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

And

• Functions: father of, best friend, one more than, plus, …

Page 4: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Syntax of FOL: Basic elements

• Constants TaoiseachJohn, 2, DIT,...

• Predicates Brother, >,...

• Functions Sqrt, LeftLegOf,...

• Variables x, y, a, b,...

• Connectives , , , , • Equality =

• Quantifiers ,

Page 5: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Atomic sentences

Atomic sentence = predicate (term1,...,termn) or term1 = term2

Term = function (term1,...,termn) or constant or variable

• E.g., Brother(TaoiseachJohn,RichardTheLionheart) > (Length(LeftLegOf(Richard)), Length(LeftLegOf(TaoiseachJohn)))

Page 6: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Complex sentences

• Complex sentences are made from atomic sentences using connectives

S, S1 S2, S1 S2, S1 S2, S1 S2,

E.g. Sibling(TaoiseachJohn,Richard) Sibling(Richard,TaoiseachJohn)

>(1,2) ≤ (1,2)

>(1,2) >(1,2)

Page 7: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Truth in first-order logic• Sentences are true with respect to a model and an interpretation

• Model contains objects (domain elements) and relations among them

• Interpretation specifies referents forconstant symbols → objectspredicate symbols → relationsfunction symbols → functional relations

• An atomic sentence predicate(term1,...,termn) is trueiff the objects referred to by term1,...,termn

are in the relation referred to by predicate

–•

Page 8: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Universal quantification <variables> <sentence>

Everyone at DIT is smart:x At(x,DIT) Smart(x)

x P is true in a model m iff P is true with x being each possible object in the model

Page 9: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

• Roughly speaTaoiseach, equivalent to the conjunction of instantiations of P

At(TaoiseachJohn,DIT) Smart(TaoiseachJohn) At(Richard,DIT) Smart(Richard) At(DIT,DIT) Smart(DIT) ...

Page 10: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

A common mistake to avoid

• Typically, is the main connective with • Common mistake: using as the main

connective with :x At(x,DIT) Smart(x)

means “Everyone is at DIT and everyone is smart”

Page 11: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Existential quantification <variables> <sentence>

• Someone at DIT is smart: x At(x,DIT) Smart(x)$

x P is true in a model m iff P is true with x being some possible object in the model

Page 12: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

• Roughly speaTaoiseach, equivalent to the disjunction of instantiations of P

At(TaoiseachJohn,DIT) Smart(TaoiseachJohn) At(Richard,DIT) Smart(Richard) At(DIT,DIT) Smart(DIT) ...

Page 13: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Another common mistake to avoid

• Typically, is the main connective with

• Common mistake: using as the main connective with :

x At(x,DIT) Smart(x)

is true if there is anyone who is not at DIT!

••

Page 14: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Properties of quantifiers x y is the same as y x x y is the same as y x

x y is not the same as y x x y Loves(x,y)

– “There is a person who loves everyone in the world” y x Loves(x,y)

– “Everyone in the world is loved by at least one person”

• Quantifier duality: each can be expressed using the other x Likes(x,IceCream) x Likes(x,IceCream) x Likes(x,Broccoli) x Likes(x,Broccoli)

••

––

Page 15: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Equality

• term1 = term2 is true under a given interpretation if and only if term1 and term2 refer to the same object

• E.g., definition of Sibling in terms of Parent:x,y Sibling(x,y) [(x = y) m,f (m = f)

Parent(m,x) Parent(f,x) Parent(m,y) Parent(f,y)]•

Page 16: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Using FOL

The kinship domain:• Brothers are siblings

x,y Brother(x,y) Sibling(x,y)

Page 17: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

• One's mother is one's female parentm,c Mother(c) = m (Female(m) Parent(m,c))

• “Sibling” is symmetricx,y Sibling(x,y) Sibling(y,x)

–•

Page 18: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Knowledge engineering in FOL

1. Identify the task2. Assemble the relevant knowledge3. Decide on a vocabulary of predicates,

functions, and constants4. Encode general knowledge about the domain5. Encode a description of the specific problem

instance6. Pose queries to the inference procedure and

get answers7. Debug the knowledge base

Page 19: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Summary

• First-order logic:– objects and relations are semantic primitives– syntax: constants, functions, predicates,

equality, quantifiers

Page 20: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Semantics for Predicate Calculus

• An interpretation over D is an assignment of the entities of D to each of the constant, variable, predicate and function symbols of a predicate calculus expression such that:

Page 21: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

• 1: Each constant is assigned an element of D• 2: Each variable is assigned a non-empty subset

of D;(these are the allowable substitutions for that variable)

• 3: Each predicate of arity n is defined on n arguments from D and defines a mapping from Dn into {T,F}

• 4: Each function of arity n is defined on n arguments from D and defines a mapping from Dn into D

Page 22: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

The meaning of an expression

• Given an interpretation, the meaning of an expression is a truth value assignment over the interpretation.

Page 23: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Truth Value of Predicate Calculus expressions

• Assume an expression E and an interpretation I for E over a non empty domain D. The truth value for E is determined by:

• The value of a constant is the element of D assigned to by I

• The value of a variable is the set of elements assigned to it by I

Page 24: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

More truth values

• The value of a function expression is that element of D obtained by evaluating the function for the argument values assigned by the interpretation

• The value of the truth symbol “true” is T

• The value of the symbol “false” is F

• The value of an atomic sentence is either T or F as determined by the interpretation I

Page 25: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Similarity with Propositional logic truth values

• The value of the negation of a sentence is F if the value of the sentence is T and F otherwise

• The values for conjunction, disjunction ,implication and equivalence are analogous to their propositional logic counterparts

Page 26: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Universal Quantifier

• The value for

• Is T if S is T for all assignments to X under I, and F otherwise

Page 27: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Existential Quantifier

• The value for

• Is T if S is T for any assignment to X under I, and F otherwise

Page 28: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Some Definitions

• A predicate calculus expressions S1 is satisfied.

• Definition If there exists an Interpretation I and a variable assignment under I which returns a value T for S1 then S1 is said to be satisfied under I.

• S is Satisfiable if there exists an interpretation and variable assignment that satisfies it: Otherwise it is unsatisfiable

Page 29: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Some Definitions

• A set of predicate calculus expressions S is satisfied.

• Definition For any interpretation I and variable assignment where a value T is returned for every element in S the the set S is said to be satisfied,

Page 30: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

• A set of expressions is satisfiable if and only if there exist an intrepretation and variable assignment that satisfy every element

• If a set of expressions is not satisfiable, it is said to be inconsistent

• If S has a value T for all possible interpretations , it is said to be valid

Page 31: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Some Definitions• A predicate calculus expressions S1 is satisfied.• Definition If there exists an Interpretation I and a variable

assignment under I which returns a value T for S1 then S1 is said to be satisfied under I.

• A set of predicate calculus expressions S is satisfied.• • Definition For any interpretation I and variable assignment

where a value T is returned for every element in S the the set S is said to be satisfied,

• An inference rule is complete.• Definition If all predicate calculus expressions X that logically

follow from a set of expressions, S can be produced using the inference rule , then the inference rule is said to be complete.

Page 32: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

• A predicate calculus expression X logically follows from a set S of predicate calculus expressions .

• For any interpretation I and variable assignment where S is satisfied, if X is also satisfied under the same interpretation and variable assignment then X logically follows from S.

• Logically follows is sometimes called entailment

Page 33: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Soundness

• An inference rule is sound.

• If all predicate calculus expressions X produced using the inference rule from a set of expressions, S logically follow from S then the inference rule is said to be sound.

Page 34: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Completeness

• An inference Rule is complete if given a set S of predicate calculus expressions, it can infer every expression that logically follows from S

Page 35: Predicate Calculus. First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes

Equivalence

• Recall that :• See attached word

document