B.Y. Choueiry ✫ ✬ Title: First-Order Logic AIMA: Chapter 8 (Sections 8.1 and 8.2) Section 8.3, discussed briefly, is also required reading 1 Introduction to Artificial Intelligence CSCE 476-876, Fall 2018 URL: www.cse.unl.edu/˜choueiry/F18-476-876 Instructor’s notes #13 Berthe Y. Choueiry (Shu-we-ri) October 26, 2018 (402)472-5444 ✪ ✩
B.Y. Choueiry ✫ ✬ Outline • First-order logic: – basic elements 2 – syntax – semantics • Examples Instructor’s notes #13 October 26, 2018 ✪ ✩
B.Y. Choueiry ✫ ✬ Pros and cons of propositional logic • Propositional logic is declarative: pieces of syntax correspond to facts • Propositional logic allows partial/disjunctive/negated information (unlike most data structures and databases) • Propositional logic is compositional: 3 meaning of B 1 , 1 ∧ P 1 , 2 is derived from meaning of B 1 , 1 and of P 1 , 2 • Meaning in propositional logic is context-independent (unlike natural language, where meaning depends on context) Instructor’s notes #13 • but... October 26, 2018 Propositional logic has very limited expressive power E.g., cannot say “pits cause breezes in adjacent squares” except by writing one sentence for each square ✪ ✩
B.Y. Choueiry ✫ ✬ Propositional Logic • is simple • illustrates important points: model, inference, validity, satisfiability, .. • is restrictive: world is a set of facts 4 • lacks expressiveness: → In PL, world contains facts First-Order Logic Instructor’s notes #13 • more symbols (objects, properties, relations) October 26, 2018 • more connectives (quantifier) ✪ ✩
B.Y. Choueiry ✫ ✬ First Order Logic → FOL provides more "primitives" to express knowledge: — objects (identity & properties) — relations among objects (including functions) Objects: people, houses, numbers, Einstein, Huskers, event, .. 5 Properties : smart, nice, large, intelligent, loved, occurred, .. Relations : brother-of, bigger-than, part-of, occurred-after, .. Functions : father-of, best-friend, double-of, .. Examples : (objects? function? relation? property?) Instructor’s notes #13 — one plus two equals four [sic] October 26, 2018 — squares neighboring the wumpus are smelly ✪ ✩
B.Y. Choueiry ✫ ✬ Logic Attracts : mathematicians, philosophers and AI people Advantages: — allows to represent the world and reason about it — expresses anything that can be programmed Non-committal to : — symbols could be objects or relations 6 ( e.g. , King(Gustave), King(Sweden, Gustave), Merciless(King)) — classes, categories, time, events, uncertainty .. but amenable to extensions: OO FOL, temporal logics, situation/event calculus, modal logic, etc. Instructor’s notes #13 October 26, 2018 − → Some people think FOL *is* the language of AI true/false? donno :—( but it will remain around for some time.. ✪ ✩
B.Y. Choueiry ✫ ✬ Types of logic Logics are characterized by what they commit to as “primitives” Ontological commitment : what exists—facts? objects? time? beliefs? Epistemological commitment : what states of knowledge? 7 Language Ontological Commitment Epistemological Commitment (What exists in the world) (What an agent believes about facts) Propositional logic facts true/false/unknown First-order logic facts, objects, relations true/false/unknown Temporal logic facts, objects, relations, times true/false/unknown Instructor’s notes #13 Probability theory facts degree of belief 0…1 Fuzzy logic degree of truth degree of belief 0…1 October 26, 2018 Higher-Order Logic: views relations and functions of FOL as objects ✪ ✩
B.Y. Choueiry ✫ ✬ Syntax of FOL : words and grammar The words: symbols • Constant symbols stand for objects: QueenMary, 2, UNL, etc. • Variable symbols stand for objects: x , y , etc. • Predicate symbols stand for relations: Odd, Even, Brother, Sibling, etc. 8 • Function symbols stand for functions (viz. relation) Father-of, Square-root, LeftLeg, etc. • Quantifiyers ∀ , ∃ Instructor’s notes #13 • Connectives: ∧ , ∨ , ¬ , ⇒ , ⇔ , October 26, 2018 • (Sometimes) equality = Predicates and functions can have any arity (number of arguments) ✪ ✩
B.Y. Choueiry ✫ ✬ Basic elements in FOL (i.e., the grammar) In propositional logic , every expression is a sentence In FOL , • Terms 9 • Sentences: – atomic sentences – complex sentences • Quantifiers: Instructor’s notes #13 – Universal quantifier October 26, 2018 – Existential quantifier ✪ ✩
B.Y. Choueiry ✫ ✬ Term logical expression that refers to an object 10 — built with: constant symbols, variables, function symbols Term = function ( term 1 , . . . , term n ) or constant or variable Instructor’s notes #13 — ground term : term with no variable October 26, 2018 ✪ ✩
B.Y. Choueiry ✫ ✬ Atomic sentences state facts built with terms and predicate symbols 11 Atomic sentence = predicate ( term 1 , . . . , term n ) or term 1 = term 2 Examples : Instructor’s notes #13 Brother (Richard, John) October 26, 2018 Married (FatherOf(Richard), MotherOf(John)) ✪ ✩
B.Y. Choueiry ✫ ✬ Complex Sentences built with atomic sentences and logical connectives ¬ S S 1 ∧ S 2 S 1 ∨ S 2 12 S 1 ⇒ S 2 S 1 ⇔ S 2 Examples : Instructor’s notes #13 Sibling(KingJohn,Richard) ⇒ Sibling(Richard,KingJohn) October 26, 2018 > (1 , 2) ∨ ≤ (1 , 2) > (1 , 2) ∧ ¬ > (1 , 2) ✪ ✩
B.Y. Choueiry ✫ ✬ Truth in first-order logic : Semantic Sentences are true with respect to a model and an interpretation Model contains objects and relations among them Interpretation specifies referents for 13 constant symbols → objects predicate symbols → relations function symbols → functional relations An atomic sentence predicate ( term 1 , . . . , term n ) is true Instructor’s notes #13 iff the objects referred to by term 1 , . . . , term n are in the relation referred to by predicate October 26, 2018 ✪ ✩
B.Y. Choueiry ✫ ✬ Model in FOL : example crown on head brother person person king brother R J $ left leg left leg 14 The domain of a model is the set of objects it contains: five objects Instructor’s notes #13 Intended interpretation: Richard refers Richard the Lion Heart, October 26, 2018 John refers to Evil King John, Brother refers to brotherhood relation, etc. ✪ ✩
B.Y. Choueiry ✫ ✬ Models for FOL: Lots! We can enumerate the models for a given KB vocabulary: For each number of domain elements n from 1 to ∞ For each k -ary predicate P k in the vocabulary For each possible k -ary relation on n objects For each constant symbol C in the vocabulary 15 For each choice of referent for C from n objects . . . Computing entailment by enumerating models is not going to be easy! Instructor’s notes #13 There are many possible interpretations, also some model domain are not bounded October 26, 2018 − → Checking entailment by enumerating is not an option ✪ ✩
B.Y. Choueiry ✫ ✬ Quantifiers allow to make statements about entire collections of objects 16 • universal quantifier: make statements about everything • existential quantifier: make statements about some things Instructor’s notes #13 October 26, 2018 ✪ ✩
B.Y. Choueiry ✫ ✬ Universal quantification ∀ � variables � � sentence � Example : all dogs like bones ∀ xDog ( x ) ⇒ LikeBones ( x ) x = Indy is a dog x = Indiana Jones is a person ∀ x P is equivalent to the conjunction of instantiations of P 17 Dog ( Indy ) ⇒ LikeBones ( Indy ) Dog ( Rebel ) ⇒ LikeBones ( Rebel ) ∧ Dog ( KingJohn ) ⇒ LikeBones ( KingJohn ) ∧ ∧ . . . Instructor’s notes #13 Typically : ⇒ is the main connective with ∀ October 26, 2018 Common mistake : using ∧ as the main connective with ∀ Example: ∀ x Dog ( x ) ∧ LikeBones ( x ) all objects in the world are dogs, and all like bones ✪ ✩
B.Y. Choueiry ✫ ✬ Existential quantification ∃ � variables � � sentence � Example : some student will talk at the TechFair ∃ xStudent ( x ) ∧ TalksAtTechFair ( x ) Pat, Leslie, Chris are students ∃ x P is equivalent to the disjunction of instantiations of P 18 Student ( Pat ) ∧ TalksAtTechFair ( Pat ) Student ( Leslie ) ∧ TalksAtTechFair ( Leslie ) ∨ Student ( Chris ) ∧ TalksAtTechFair ( Chris ) ∨ ∨ . . . Instructor’s notes #13 Typically : ∧ is the main connective with ∃ October 26, 2018 Common mistake : using ⇒ as the main connective with ∃ ∃ x Student ( x ) ⇒ TalksAtTechFair ( x ) is true if there is anyone who is not Student ✪ ✩
B.Y. Choueiry ✫ ✬ Properties of quantifiers (I) ∀ 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” 19 ∀ y ∃ xLoves ( x, y ) “Everyone in the world is loved by at least one person” Quantifier duality : each can be expressed using the other Instructor’s notes #13 ∀ x Likes ( x, IceCream ) ¬ ∃ x ¬ Likes ( x, IceCream ) October 26, 2018 ∃ x Likes ( x, Broccoli ) ¬ ∀ x ¬ Likes ( x, Broccoli ) Parsimony principal : ∀ , ¬ , and ⇒ are sufficient ✪ ✩
Recommend
More recommend