1 / 23

Artificial Intelligence

Artificial Intelligence. First-Order Logic (FOL). Outline of this Chapter. The need for FOL? What is a FOL? Syntax and semantics of FOL Using FOL. Pros and cons of propositional logic.  Propositional logic is declarative: pieces of syntax correspond to facts.

happy
Télécharger la présentation

Artificial Intelligence

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Artificial Intelligence First-Order Logic (FOL)

  2. Outline of this Chapter • The need for FOL? • What is a FOL? • Syntax and semantics of FOL • Using FOL

  3. Pros and cons of propositional logic Propositional logic is declarative:pieces of syntax correspond to facts.  Propositional logic has expressive power to deal with partial information, using disjunction & negation. • (unlike most data structures and databases) • Propositional logic is compositional: - the meaning of a sentence is a function of the meaning of its parts • meaning of B1,1 P1,2 is derived from meaning of B1,1 and of P1,2 • Meaning in propositional logic is context-independent • (unlike natural language, where meaning depends on context)  Propositional logic has very limited expressive power to describe an Env with many objects concisely • (unlike natural language- syntax & semantic of English make it possible to describe the Env concisely. • E.g., cannot say "pits cause breezes in adjacent squares“ • except by writing a separate rule about B & P for each square.

  4. First-order u logic (FOL) • FOL more expressive language than the PL. • FOL is a general-purpose representation language that is based on an ontological commitment to the existence of objects & relations in the world. • It builds on simple propositional logic by adding objects, predicates, variables and quantifiers. • Whereas propositional logic assumes the world contains facts (can be T/F), • FOL (like natural language) assumes the world contains • Objects: people, houses, numbers, colors, baseball games, wars, … • Relations: brother of, bigger than, part of, comes between, … • Properties: unary relation such as red, round • Functions: relations in which there is only 1 value for a giver input. i.e. father of, best friend, plus, …

  5. Example • “One Plus Two Equals Three “ Objects: One, Two, Three Relations: Equals Functions: Plus • “Square neighboring the wumpus are smelly“ Objects: wumpus, square Relations: neighboring Property: smelly

  6. Syntax and semantics • In Propositional logic – every expression is a sentence • In FOL = Sentences + Terms (which represents objects) • Sentences - are built using quantifiers and predicate symbols • Term: Logical expression that refers to an object = function (term1,...,termn) or constant or variable. = Brother (Samir, Ali) Ali, x,y

  7. Syntax of FOL: Basic elements The basic syntactic elements of FOL are the symbols that stand for objects, relations & functions. • Constants (stand for objects) Sarah, A, B,... • Predicates (stand for relation) Brother, Round,... • Functions (stand for function) FatherOf,... • Variables x, y, a, b,... • Connectives , , , ,  • Equality = • Quantifiers , 

  8. Atomic sentences • It is formed from a predicate symbol followed by a parenthesized list of terms. • Atomic sentence = predicate (term1,...,termn) or term1 = term2 E.g. Sister (Mona, Manal) • They can have arguments that are complex terms E.g. Married(FatherOf(Ali),Sister (Mona))

  9. Complex sentences • Complex sentences are made from atomic sentences using logical connectives e.g. •  Sister(Mona,Alia) is true when Mona is not the sister of Alia. • Older (Reem, 20)  Younger(Reem, 20) if Reem is older than 20, then she is not younger than 20.

  10. Truth in first-order logic • Sentences are true with respect to a model and an interpretation • Model contains objects (domainelements) and relations among them • Interpretation specifies referents for constant symbols → objects predicate symbols → relations function symbols → functional relations • An atomic sentence predicate(term1,...,termn) is true iff the objects referred to by term1,...,termnare in the relation referred to by predicate

  11. Truth Example • Consider the interpretation in which • Sara  Sara Ibrahim • Mona  Mona Ibrahim • Sister  the sisterhood relation • Under this interpretation, Sister(Sara; Mona) is true just in case Sara Ibrahim and Mona Ibrahim are in the sisterhood relation in the model

  12. Models for FOL: Example • A model containing 5 objects. These objects may be related in various ways: • Binary relation – brother & on head • Unary relations (properties) – person, crown & king • Unary function – left leg

  13. Quantification • Quantification is a formula constructor that produces new formulas from old ones. • Quantifier is a symbol- let us express properties of entire collections of objects, instead of listing the objects by name. • In natural language- for all, for some; many, few, a lot, etc • FOL contains 2 standard quantifiers: • Universal • existential

  14. Universal quantification • <variables> <sentence> e.g. All cats are mammals:  x Cats(x) => Mammals(x), for all x, if x is a cat, then x is a mammal • Universal quantification makes statements about every object. • Universal quantifiers often used with "implies" to form "rules.“ • Everyone at PSU is smart :  x At(x, PSU) => Smart(x) •  x P (any logical expression) is equivalent to the conjunction of instantiations of P At( Sara, PSU) => Smart(Sara)  At(Mary, PSU) => Smart(Mary)  ... • Typically, is the main connective with  • Common mistake: using  as the main connective with :

  15. Existential quantification •  <variables> <sentence> • Existential quantification makes statements about some object. • Someone at PSU is smart: x At(x, PSU)  Smart(x) •  x P is equivalent to thedisjunctions of instantiations of P At( Sara, PSU) => Smart(Sara)  At(Mary, PSU) => Smart(Mary)  ... • Typically, is the main connective with  • Common mistake: using  as the main connective with :

  16. Properties of quantifiers To express more complex sentences, use multiple 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) “For every person, there is someone that person loves” •  y x Loves(x,y) “There is someone who is loved by every body” • Quantifier duality: each can be expressed using the other (& are connected with each other through negation) • x Likes(x,IceCream) x Likes(x,IceCream) •  x Likes (x, Cabbage) x Likes(x, Cabbage) The deMorgan rules for quantified and unquantified sentences are as follows  x P = x P P  Q = (P V Q )  x P = x P (P  Q) = P V Q x P = x P P  Q = (P V Q ) x P =  x P P V Q = (P  Q )

  17. Equality • term1 = term2is true under a given interpretation if and only if term1andterm2refer to the same object e.g. Mother(Mona) = Jenny • The equality symbol can be used with negation to insist that two terms are not the same object. e.g. Mona has at least 2 sisters. x,y Sister(Mona,x)  Sister(Mona,y)  (x=y)

  18. Examples • All food are edible • Brothers are siblings • “Sibling" is symmetric relation ship (quantifiers of the same type) • One's mother is one's female parent Solutions: •  x food( x) => edible( x) •  x, y Brother(x, y)  Sibling(x, y). •  x, y Sibling(x, y) Sibling(y, x). •  m, c Motherof(c) = m  (Female(m)  Parent(m, c))

  19. Interacting with FOL KBs • To add sentences to a knowledge base KB, we would call TELL. Such sentences are called assertions. e.g. TELL (KB, Mother(Nora)) // assert that Nora is a Mother TELL(KB,  x Mother(x)  Person (x)) // Mothers are persons • To ask questions of the KB, we use ASK • Questions asked using ASK are called queries e.g.ASK (KB,Mother(Nora))

  20. In-class Activity • Abeer, Mona and linda belong to the champions Club. • Every member of the club is either skier or a mountain climber . • No mountain climber likes rain, and all skiers like snow • linda dislikes whatever Abeer likes and likes whatever Abeer dislikes • Abeer likes rain and snow • Is there any member of the club who is climber but not skier? • Translate this problem into FOL Sentences?

  21. Solution • S(x) means x is a skier • M(x) means x is a mountain climber • L(x,y) means x likes y • The English sentences in the prev slide can be translated into the following FOL:  x Clubmember(x) => S(x) V M (x) ~  x M(x)  L(x,rain)  x S(x) => L(x,snow)  y L(linda, y) <=> ~L(Abeer,y) L(Abeer, rain) ^L(Abeer,snow)

  22. Summary • FOL can be used as the representation language for a KB agent. • FOL is more powerful than propositional logic • A possible world for FOL is defined by a set of : • objects and relations are semantic primitives • syntax: constants, functions, predicates, equality, quantifiers • Complex sentences use connectives just like propositional logic, & quantified sentences allow the expression of general rules.

  23. End of lecture

More Related