First Order Logic (3)

download First Order Logic (3)

of 33

Transcript of First Order Logic (3)

  • 8/13/2019 First Order Logic (3)

    1/33

    ITCS 3153

    Artificial Intelligence

    Lecture 13

    First-Order Log ic

    Chapter 8

  • 8/13/2019 First Order Logic (3)

    2/33

    First-order logic

    We saw how propo si t ional logic can create

    intel l igent behavior

    Bu t propos i t ional log ic is a poor representat ionfor complex envi ronm ents

    Why?

    First -order log ic is a more exp ressive andpowerfu l representation

  • 8/13/2019 First Order Logic (3)

    3/33

    What do we like about propositional

    logic?

    It is :

    Declarative

    Relationships between variables are described

    A method for propagating relationships Expressive

    Can represent partial information using disjunction

    Compositional

    IfA means foo and B means bar,A ^ Bmeans foo and ba

  • 8/13/2019 First Order Logic (3)

    4/33

    What dont we like about

    propositional logic?

    Lacks expressive power to descr ibe the

    envi ronm ent conc isely

    Separate rules for every square/square relationship in

    Wumpus world

  • 8/13/2019 First Order Logic (3)

    5/33

    Natural Language

    Engl ish appears to be express ive

    Squares adjacent to pits are breezy

    Bu t natural language is a medium o f communicat ion, not

    a know ledge representat ion

    Much of the information and logic conveyed by language is dependent

    on context

    Information exchange is not well defined

    Not compositional (combining sentences may mean something different

    It is ambiguous

  • 8/13/2019 First Order Logic (3)

    6/33

    But we borrow representational

    ideas from natural language

    Natural language syn tax

    Nouns and noun phrases refer to objects

    People, houses, cars

    Verbs and verb phrases refer to relationshipsbtw objects

    Red, round, nearby, eaten

    Some relationships are clearly defined functions where there is only one

    output for a given input

    Best friend, first thing, plus

    We bui ld f i rst order logic around objects and relat ions

  • 8/13/2019 First Order Logic (3)

    7/33

    Ontology

    a specification of a conceptualization

    A description of the objects and relationships that can exist

    Propositional logic had only true/false relationships

    First-order logic has many more relationships

    The ontological commitmentof languages is different

    How much can you infer from what you know?

    Temporal logicdefines additional ontologicalcommitments because of timing constraints

  • 8/13/2019 First Order Logic (3)

    8/33

    Higher-order logic

    First-order logic is first because you relate objects (thef i rst-order enti t ies that actual ly exist in the world )

    There are 10 chickens chickens.number=10

    There are 10 ducks ducks.number=10

    You canno t bu i ld relationships between relat ions or

    funct ions

    There are as many chickens as ducks chickens.number =

    ducks.number

    the number of objects belonging to a group must be a property of the

    group, and not the objects themselves

    Cannot represent Leibnizs law: Ifxand yshare all properties,xisy

  • 8/13/2019 First Order Logic (3)

    9/33

    Another characterization of a logic

    Epistemolog ica l comm itments

    The possible states of knowledge permitted with respect to

    each fact

    In first-order logic, each sentence is a statement that is True, false, or unknown

  • 8/13/2019 First Order Logic (3)

    10/33

    Formal structure of first-order logic

    Models of f i rst-order logic contain: A set of objects (its domain)

    Alice, Alices left arm, Bob, Bobs hat

    Relationshipsbetween objects

    Represented as tuples

    Sibling (Alice, Bob), Sibling (Bob, Alice)

    On head (Bob, hat)

    Person (Bob), Person (Alice)

    Some relationships are functionsif a given object is related to exactl

    one object in a certain way

    Alice -> Alices left arm

  • 8/13/2019 First Order Logic (3)

    11/33

    First-order logic syntax

    Constant Symbols

    A, B, Bob, Alice, Hat

    Predicate Symbols

    Is, onHead, hasColor, person

    Funct ion Symbols

    Mother, leftLeg

    Each predicate and func t ion s ymbol has an ar i ty

    A constant the fixes the number of arguments

  • 8/13/2019 First Order Logic (3)

    12/33

    First-order logic syntax

    Names of thin gs are abitrary

    Knowledge base adds meaning

    Number o f poss ib le domain elements is

    unbounded

    Number of models is unbounded

    Checking enumeration by entailment is impossible

  • 8/13/2019 First Order Logic (3)

    13/33

    Syntax

    Term

    A logical expression that refers to an object

    Constants

    We could assign names to all objects, like providing aname for every shoe in your closet

    Function symbols

    Used in place of a constant symbol OnLeftFoot(John))

  • 8/13/2019 First Order Logic (3)

    14/33

    Atomic Sentences

    Formed by a predicatesym bo l fo l lowed by parenthesizedl ist of terms

    Sibling (Alice, Bob)

    Married (Father(Alice), Mother(Bob))

    An atom ic sentence is true in a given m odel , under a

    given interpretat ion , i f the relat ion referred to by the

    predicate sym bol ho lds among the objects referred to by

    the arguments

  • 8/13/2019 First Order Logic (3)

    15/33

    Complex sentences

    We can use logical connect ives

    ~Sibling(LeftLeg(Alice), Bob)

    Sibling(Alice, Bob) ^ Sibling (Bob, Alice)

  • 8/13/2019 First Order Logic (3)

    16/33

    Quantifiers

    A way to express propert ies o f ent i re co l lect ions

    of objects

    Universal quantification (forall, )

    The power of first-order logic

    ForallxKing(x) => Person(x)

    xis a variable

    )()(: xPersonxKingx

  • 8/13/2019 First Order Logic (3)

    17/33

    Universal Quantification

    Forall x, P

    P is true for every object x

    Forall x, King(x) => Person(x)

    Richard the Lionheart King John

    Richards left leg

    Johns left leg

    The crown

  • 8/13/2019 First Order Logic (3)

    18/33

    Universal Quantification

    Note that al l of th ese are true Implication is true if premise is false

    Using AND instead of implication is overly strong

    By assert ing a un iversal ly quant i f ied sentence,you assert a who le l is t of indiv idual impl ications

  • 8/13/2019 First Order Logic (3)

    19/33

    Existential Quantification

    There exists ,

    There exists an x such that Crown(x) ^ OnHead(x, John)

    It is true for at leastone object

    AND, ^, is the appropriate connective

  • 8/13/2019 First Order Logic (3)

    20/33

    Existential Quantification

    What if we used impl icat ion as the connect ive?

    Implication is true if both premise and conclusion are true or

    if premise is false

    Richard the Lionheart is not a crown, first assertion is true

    and existential is satisfied

  • 8/13/2019 First Order Logic (3)

    21/33

    Nested Quantifiers

    Bui ld ing m ore complex sentences

    Everybody loves somebody

    There is someone who is loved by everyone

    Use un ique variable names and parenth eses whenappropriate

  • 8/13/2019 First Order Logic (3)

    22/33

    Combining

    Everyone who dislikes parsnips ==there does not exist someone who likes parsnips

    Everyone likes ice cream ==

    there is no one who does not like ice cream

  • 8/13/2019 First Order Logic (3)

    23/33

    Combining

    De Morgans rules apply

  • 8/13/2019 First Order Logic (3)

    24/33

    Equality

    Two terms refer to the same object

    Father (John) = Henry

    Richard has at least two brothers

    Notice this sentence is not the same

  • 8/13/2019 First Order Logic (3)

    25/33

    An Example

    A Tel l/Ask interface for a first-order know ledge base

    Sentences are added with Tell

    These are called assertions

    Tell (KB, King(John))

    Tell (KB, Forall x: King(x) => Person(x))

    Queries are made with Ask

    Ask (KB, King(John))

    Ask (KB, Person(John))

  • 8/13/2019 First Order Logic (3)

    26/33

    An Example

    Quantified queries

    Ask (KB, exist x: Person(x))

    KB should return a list of variable/term pairs that satisfy the

    query

  • 8/13/2019 First Order Logic (3)

    27/33

    The Wumpus World

    More precise axiom s than with pro pos i t ional logic Percept has five values

    Time is important

    A typical sentence

    Percept ([Stench, Breeze, Glitter, None, None], 5)

    The actions are terms

    Turn(right), Turn(left), Forward, Shoot, Grab, Release

    Computing best action with a query

    Exist a: BestAction(a, 5)

  • 8/13/2019 First Order Logic (3)

    28/33

    The Wumpus World

    After executing query, KB responds with variable/term list:{a/Grab}

    Then tell the KB the action taken

    Raw percept data is easily encoded

    Reflexes are easily encoded

  • 8/13/2019 First Order Logic (3)

    29/33

    Wumpus World

    Defining the environment with[x,y] reference instead ofalternative atomic name

    Adjacency between two squares

    Location of Wumpus is constant: Home (Wumpus)

    Location of agent changes: At (Agent, [ ], t)

  • 8/13/2019 First Order Logic (3)

    30/33

    Diagnostic Rules

    Rules leading from observed ef fects to hiddencauses

    Breezy implies pits

    Not breezy implies no pits

    Combining

  • 8/13/2019 First Order Logic (3)

    31/33

    Causal Rules

    Some hidd en property causes percepts to begenerated

    A pit causes adjacent squares to be breezy

    If all squares adjacent to a square a pitless, it will not be

    breezy

  • 8/13/2019 First Order Logic (3)

    32/33

    Causal Rules

    The causal ru les fo rmulate a model

    Knowledge of how the environment operates

    Model can be very useful and important and replace

    straightforward diagnostic approaches

  • 8/13/2019 First Order Logic (3)

    33/33

    Conclusion

    If the axiom s correct ly and completely descr ibe the waythe wor ld works and the way percepts are produced,

    then any com plete logical inference procedure w i l l infer

    the strongest possib le descr ipt ion of the wo r ld state

    given the avai lable percepts

    The agent designer can focus on gett ing the knowledge

    r ight wi thout worry ing about the processes of deduct ion