2012wq171 13 FOL Semantics

Embed Size (px)

Citation preview

  • 8/2/2019 2012wq171 13 FOL Semantics

    1/19

    Fi rs t -Ord er Log icSemant i cs

    Reading: Chapter 8, 9.1-9.2, 9.5.1-9.5.5

    FOL Syntax and Semantics read: 8.1-8.2

    FOL Knowledge Engineering read: 8.3-8.5

    FOL Inference read: Chapter 9.1-9.2, 9.5.1-9.5.5

    (Please read lecture topic material before and after eachlecture on that topic)

  • 8/2/2019 2012wq171 13 FOL Semantics

    2/19

    Out l i ne

    Propositional Logic is Usefu l --- but has L im i ted Exp r ess ive Pow er

    First Order Predicate Calculus (FOPC), or First Order Logic (FOL).

    FOPC has greatly expanded expressive power, though still limited.

    New Ontology

    The world consists of OBJECTS (for propositional logic, the world was facts).

    OBJECTS have PROPERTIES and engage in RELATIONS and FUNCTIONS.

    New Syntax

    Constants, Predicates, Functions, Properties, Quantifiers.

    New Semantics

    Meaning of new syntax.

    Knowledge engineering in FOL

    Inference in FOL

  • 8/2/2019 2012wq171 13 FOL Semantics

    3/19

    You w i l l be expec ted t o kn ow

    FOPC syntax and semantics

    Syntax: Sentences, predicate symbols, function symbols, constantsymbols, variables, quantifiers

    Semantics: Models, interpretations

    De Morgans rules for quantifiers

    connections between and

    Nested quantifiers Difference between x y P(x, y) and x y P(x, y)

    x y Likes(x, y)

    x y Likes(x, y)

    Translate simple English sentences to FOPC and back

    x y Likes(x, y) Everyone has someone that they like.

    x y Likes(x, y) There is someone who likes every person.

  • 8/2/2019 2012wq171 13 FOL Semantics

    4/19

    Out l i ne

    Review: KB |= S is equivalent to |= (KB S)

    So what does {} |= S mean?

    Review: Follows, Entails, Derives

    Follows: Is it the case?

    Entails: Is it true?

    Derives: Is it provable?

    Semantics of FOL (FOPC)

    Model, Interpretation

  • 8/2/2019 2012wq171 13 FOL Semantics

    5/19

    FOL (or FOPC) Ontology:What kind of things exist in the world?What do we need to describe and reason about?Objects --- with their relations, functions, predicates, properties, and general rules.

    Reasoning

    Representation-------------------A FormalSymbol System

    Inference---------------------Formal PatternMatching

    Syntax---------What issaid

    Semantics-------------What itmeans

    Schema-------------Rules ofInference

    Execution-------------SearchStrategy

  • 8/2/2019 2012wq171 13 FOL Semantics

    6/19

    Rev iew : KB | = S m ea ns | = ( KB S)

    KB |= S is read KB entails S.

    Means S is true in every world (model) in which KB is true. Means In the world, S follows from KB.

    KB |= S is equivalent to |= (KB S)

    Means (KB S) is true in every world (i.e., is valid).

    And so: {} |= S is equivalent to |= ({} S)

    So what does ({} S) mean?

    Means True implies S.

    Means S is valid. In Horn form, means S is a fact. p. 256 (3rd ed.; p. 281, 2nd ed.)

    Why does {} mean True here, but False in resolution proofs?

  • 8/2/2019 2012wq171 13 FOL Semantics

    7/19

    Rev iew : ( Tru e S) m eans S i s a fac t .

    By convention,

    The null conjunct is syntactic sugar for True. The null disjunct is syntactic sugar for False.

    Each is assigned the truth value of its identity element.

    For conjuncts, True is the identity: (A True) A

    For disjuncts, False is the identity: (A False) A

    A KB is the conjunction of all of its sentences.

    So in the expression: {} |= S

    We see that {} is the null conjunct and means True.

    The expression means S is true in every world where True is true.

    I.e., S is valid.

    Better way to think of it: {} does not exclude any worlds (models).

    In Conjunctive Normal Form each clause is a disjunct.

    So in, say, KB = { (P Q) (Q R) () (X Y Z) }

    We see that () is the null disjunct and means False.

  • 8/2/2019 2012wq171 13 FOL Semantics

    8/19

    Side Tr ip : Fun c t ion s AND, OR, and n u l l va lu es( No te : These a re syn t act i c suga r i n l og i c.)

    f unc t i on AND(arglist) r e t u r n s a truth-valuer e t u r n ANDOR(arglist, True)

    f unc t i on OR(arglist) r e t u r n s a truth-value

    r e t u r n ANDOR(arglist, False)

    f unc t i on ANDOR(arglist, nullvalue) r e t u r n s a truth-value

    /* nullvalueis the identity element for the caller. */

    i f (arglist= {})t h e n r e t u r n nullvalue

    i f ( FIRST(arglist) = NOT(nullvalue) )

    t h e n r e t u r n NOT(nullvalue)

    r e t u r n ANDOR( REST(arglist) )

  • 8/2/2019 2012wq171 13 FOL Semantics

    9/19

    Side Tr ip : W e on ly need one log ica l connect i ve .( No te : AND, OR, NOT a re syn t act i c sugar i n l og ic.)

    Both NAND and NOR are log ica l l y com ple te .

    NAND is a l so ca l led t he She f fe r s t rok e

    NOR is a lso ca l led Pie rce s a r row

    (NOT A) = (NAND A TRUE) = (NOR A FALSE)

    (AND A B) = (NAND TRUE (NAND A B))

    = (NOR (NOR A FALSE) (NOR B FALSE))

    (OR A B) = (NAND (NAND A TRUE) (NAND B TRUE))=(NOR FALSE (NOR A B))

  • 8/2/2019 2012wq171 13 FOL Semantics

    10/19

    Rev iew : Schem at i c fo r Fo l l ow s , En t a i l s, and Der i v es

    If KB is true in the real world,

    then any sentence entailedby KB

    and any sentence derivedfrom KB

    by a sound inference procedureis also true in the real world.

    Sentences SentenceDerivesInference

  • 8/2/2019 2012wq171 13 FOL Semantics

    11/19

    Schem at ic Ex am ple : Fo l low s, Ent a i l s , and Der iv es

    Inference

    Mary is Sues sister and

    Amy is Sues daughter. Mary is

    Amys aunt.Representation

    Derives

    Entails

    FollowsWorld

    Mary Sue

    Amy

    Mary is Sues sister and

    Amy is Sues daughter.

    An aunt is a sister

    of a parent.

    An aunt is a sisterof a parent.

    Sister

    Daughter

    Mary

    Amy

    Aunt

    Mary is

    Amys aunt.

    Is it provable?

    Is it true?

    Is it the case?

  • 8/2/2019 2012wq171 13 FOL Semantics

    12/19

    Rev iew : Model s ( and i n FOL, I n t e rp re t a t i ons )

    Models are formal worlds in which truth can be evaluated

    We say mis a model ofa sentence if is true in m

    M() is the set of all models of

    Then KB iffM(KB) M() E.g. KB, = Mary is Sues sister

    and Amy is Sues daughter. = Mary is Amys aunt.

    Think of KB and as constraints,and of models m as possible states.

    M(KB) are the solutions to KBand M() the solutions to .

    Then, KB , i.e., (KB a) ,when all solutions to KB are also solutions to .

  • 8/2/2019 2012wq171 13 FOL Semantics

    13/19

    Sem ant i cs : W or ld s

    Th e world cons is ts o f objects t h a t h a v e properties.

    There a r e relations an d functions b e t w e en t h e se o b j e ct s

    Ob j ects i n t h e w o r ld , i nd i v idua ls : people, houses, numbers,colors, baseball games, wars, centuries

    Clock A, John, 7, the-house in the corner, Tel-Aviv, Ball43

    Func t ions on individuals: father-of, best friend, third inning of, one more than

    Rela t ions:

    brother-of, bigger than, inside, part-of, has color, occurredafter

    Prope r t i es ( a re la t i on o f a r i t y 1 ) :

    red, round, bogus, prime, multistoried, beautiful

  • 8/2/2019 2012wq171 13 FOL Semantics

    14/19

    Se m a n t i cs: I n t e r p r e t a t i o n

    An i n t e r p r e t a t i o n of a sentence (wff) is an assignment thatmaps

    Object constant symbols to objects in the world,

    n-ary function symbols to n-ary functions in the world,

    n-ary relation symbols to n-ary relations in the world

    Given an interpretation, an atomic sentence has the valuetrue if it denotes a relation that holds for those individualsdenoted in the terms. Otherwise it has the value false.

    Example: Kinship world:

    Symbols = Ann, Bill, Sue, Married, Parent, Child, Sibling,

    World consists of individuals in relations:

    Married(Ann,Bill) is false, Parent(Bill,Sue) is true,

  • 8/2/2019 2012wq171 13 FOL Semantics

    15/19

    Tru th i n f i r st - o rde r l og i c

    Sentences are true with respect to a model and an interpretation

    Model contains objects (domainelements) and relations among them

    Interpretation specifies referents for

    constantsymbols objects

    predicatesymbols relations

    functionsymbols functional relations

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

  • 8/2/2019 2012wq171 13 FOL Semantics

    16/19

    Sem ant ics: Mode ls

    A n i n t e r p r e t a t i on satisfies a w f f ( se n t e n ce ) i f t h e w f f h a st h e v a lu e t r u e u n d e r t h e i n t e r p r et a t i on .

    Model : A dom a in and an i n te rp re ta t i on t ha t sa t i s f ies aw f f i s a model o f t h at w f f

    Va li d it y : A n y w f f t h a t h a s t h e v a lu e t r u e u n d e r a l l

    i n t e rp re ta t i ons i s valid Any w f f t h a t does no t have a m ode l is i nconsi sten t o r

    unsa t i s f iab le

    I f a w f f w h a s a v al u e t r u e u n d e r a l l t h e m o d e ls o f a se to f sen t ences KB then KB log ica l l y en t a i l s w

  • 8/2/2019 2012wq171 13 FOL Semantics

    17/19

    Models fo r FOL: Ex am ple

  • 8/2/2019 2012wq171 13 FOL Semantics

    18/19

    FOL (or FOPC) Ontology:What kind of things exist in the world?What do we need to describe and reason about?Objects --- with their relations, functions, predicates, properties, and general rules.

    Reasoning

    Representation-------------------

    A FormalSymbol System

    Inference---------------------

    Formal PatternMatching

    Syntax---------What issaid

    Semantics-------------What itmeans

    Schema-------------Rules ofInference

    Execution-------------SearchStrategy

  • 8/2/2019 2012wq171 13 FOL Semantics

    19/19

    S u m m a r y

    First-order logic:

    Much more expressive than propositional logic Allows objects and relations as semantic primitives

    Universal and existential quantifiers

    Syntax: constants, functions, predicates, equality, quantifiers

    Nested quantifiers

    Translate simple English sentences to FOPC and back