Artificial Intelligence

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

1 Knowledge Representation Introduction KR and Logic.
1 Knowledge and reasoning – second part Knowledge representation Logic and representation Propositional (Boolean) logic Normal forms Inference in propositional.
Artificial Intelligence First-Order Logic
Inference in First-Order Logic
Russell and Norvig Chapter 7
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
1 Logic Logic in general is a subfield of philosophy and its development is credited to ancient Greeks. Symbolic or mathematical logic is used in AI. In.
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
We have seen that we can use Generalized Modus Ponens (GMP) combined with search to see if a fact is entailed from a Knowledge Base. Unfortunately, there.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Logic Use mathematical deduction to derive new knowledge.
Agents That Reason Logically Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2004.
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Resolution Theorem Proving
Propositional Logic Russell and Norvig: Chapter 6 Chapter 7, Sections 7.1—7.4 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2003/home.htm.
Deduction In addition to being able to represent facts, or real- world statements, as formulas, we want to be able to manipulate facts, e.g., derive new.
Logic CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Logic.
Logic Concepts Lecture Module 11.
Knowledge Representation I Suppose I tell you the following... The Duck-Bill Platypus and the Echidna are the only two mammals that lay eggs. Only birds.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
CSE (c) S. Tanimoto, 2008 Propositional Logic
CPSC 322, Lecture 20Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Computer Science cpsc322, Lecture 20 (Textbook.
ITCS 3153 Artificial Intelligence Lecture 11 Logical Agents Chapter 7 Lecture 11 Logical Agents Chapter 7.
Knowledge Representation & Reasoning (Part 1) Propositional Logic chapter 6 Dr Souham Meshoul CAP492.
Methods of Proof Chapter 7, second half.
Knoweldge Representation & Reasoning
Artificial Intelligence
Knowledge Representation & Reasoning (Part 1) Propositional Logic chapter 5 Dr Souham Meshoul CAP492.
Proof by Deduction. Deductions and Formal Proofs A deduction is a sequence of logic statements, each of which is known or assumed to be true A formal.
Logical and Rule-Based Reasoning Part I. Logical Models and Reasoning Big Question: Do people think logically?
CSM6120 Introduction to Intelligent Systems Propositional and Predicate Logic.
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
CPS 170: Artificial Intelligence Propositional Logic Instructor: Vincent Conitzer.
Knowledge Representation Use of logic. Artificial agents need Knowledge and reasoning power Can combine GK with current percepts Build up KB incrementally.
Logical Agents Logic Propositional Logic Summary
1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of.
Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Jim Little UBC CS 322 – CSP October 20, 2014.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
CS6133 Software Specification and Verification
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
11 Artificial Intelligence CS 165A Thursday, October 25, 2007  Knowledge and reasoning (Ch 7) Propositional logic 1.
Automated Reasoning in Propositional Logic Problem Given: KB: a set of sentence  : a sentence Answer: KB  ?
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part B Propositional Logic.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
Automated Reasoning in Propositional Logic Russell and Norvig: Chapters 6 and 9 Chapter 7, Sections 7.5—7.6 CS121 – Winter 2003.
March 3, 2016Introduction to Artificial Intelligence Lecture 12: Knowledge Representation & Reasoning I 1 Back to “Serious” Topics… Knowledge Representation.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
EA C461 Artificial Intelligence
Instructor: Vincent Conitzer
Knowledge Representation and Reasoning
CS201: Data Structures and Discrete Mathematics I
Logic Use mathematical deduction to derive new knowledge.
CS 270 Math Foundations of CS
CS 416 Artificial Intelligence
Back to “Serious” Topics…
CPS 570: Artificial Intelligence Logic
CSNB234 ARTIFICIAL INTELLIGENCE
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
Artificial Intelligence Propositional Logic
CPS 570: Artificial Intelligence Logic
CS201: Data Structures and Discrete Mathematics I
Presentation transcript:

Artificial Intelligence Seyed Hashem Davarpanah Davarpanah@usc.ac.ir University of Science and Culture

Logic and AI Would like our AI to have knowledge about the world, and logically draw conclusions from it Search algorithms generate successors and evaluate them, but do not “understand” much about the setting Example question: is it possible for a chess player to have all her pawns and 2 queens? Search algorithm could search through tons of states to see if this ever happens, but…

A story You know the following things: You roommate comes home; he/she is completely wet You know the following things: Your roommate is wet If your roommate is wet, it is because of rain, sprinklers, or both If your roommate is wet because of sprinklers, the sprinklers must be on If your roommate is wet because of rain, your roommate must not be carrying the umbrella The umbrella is not in the umbrella holder If the umbrella is not in the umbrella holder, either you must be carrying the umbrella, or your roommate must be carrying the umbrella You are not carrying the umbrella Can you conclude that the sprinklers are on? Can AI conclude that the sprinklers are on?

Knowledge base for the story RoommateWet RoommateWet => (RoommateWetBecauseOfRain OR RoommateWetBecauseOfSprinklers) RoommateWetBecauseOfSprinklers => SprinklersOn RoommateWetBecauseOfRain => NOT(RoommateCarryingUmbrella) UmbrellaGone UmbrellaGone => (YouCarryingUmbrella OR RoommateCarryingUmbrella) NOT(YouCarryingUmbrella)

Syntax What do well-formed sentences in the knowledge base look like? A Backus Normal Form grammar: Symbol → P, Q, R, …, RoommateWet, … Sentence → True | False | Symbol | NOT(Sentence) | (Sentence AND Sentence) | (Sentence OR Sentence) | (Sentence => Sentence) We will drop parentheses sometimes, but formally they really should always be there

Semantics A model specifies which of the proposition symbols are true and which are false Given a model, I should be able to tell you whether a sentence is true or false Truth table defines semantics of operators: a b NOT(a) a AND b a OR b a => b false true Given a model, can compute truth of sentence recursively with these

(P OR Q) OR (NOT(P) AND NOT(Q)) Tautologies A sentence is a tautology if it is true for any setting of its propositional symbols P Q P OR Q NOT(P) AND NOT(Q) (P OR Q) OR (NOT(P) AND NOT(Q)) false true (P OR Q) OR (NOT(P) AND NOT(Q)) is a tautology

Is this a tautology? (P => Q) OR (Q => P)

NOT(NOT(P) AND NOT(Q)) Logical equivalences Two sentences are logically equivalent if they have the same truth value for every setting of their propositional variables P Q P OR Q NOT(NOT(P) AND NOT(Q)) false true P OR Q and NOT(NOT(P) AND NOT(Q)) are logically equivalent Tautology = logically equivalent to True

Famous logical equivalences (a OR b) ≡ (b OR a) commutatitvity (a AND b) ≡ (b AND a) commutatitvity ((a AND b) AND c) ≡ (a AND (b AND c)) associativity ((a OR b) OR c) ≡ (a OR (b OR c)) associativity NOT(NOT(a)) ≡ a double-negation elimination (a => b) ≡ (NOT(b) => NOT(a)) contraposition (a => b) ≡ (NOT(a) OR b) implication elimination NOT(a AND b) ≡ (NOT(a) OR NOT(b)) De Morgan NOT(a OR b) ≡ (NOT(a) AND NOT(b)) De Morgan (a AND (b OR c)) ≡ ((a AND b) OR (a AND c)) distributitivity (a OR (b AND c)) ≡ ((a OR b) AND (a OR c)) distributitivity

Inference SprinklersOn is entailed! We have a knowledge base of things that we know are true RoommateWetBecauseOfSprinklers RoommateWetBecauseOfSprinklers => SprinklersOn Can we conclude that SprinklersOn? We say SprinklersOn is entailed by the knowledge base if, for every setting of the propositional variables for which the knowledge base is true, SprinklersOn is also true RWBOS SprinklersOn Knowledge base false true SprinklersOn is entailed!

Simple algorithm for inference Want to find out if sentence a is entailed by knowledge base… For every possible setting of the propositional variables, If knowledge base is true and a is false, return false Return true Not very efficient

Inconsistent knowledge bases Suppose we were careless in how we specified our knowledge base: PetOfRoommateIsABird => PetOfRoommateCanFly PetOfRoommateIsAPenguin => PetOfRoommateIsABird PetOfRoommateIsAPenguin => NOT(PetOfRoommateCanFly) PetOfRoommateIsAPenguin No setting of the propositional variables makes all of these true Therefore, technically, this knowledge base implies anything TheMoonIsMadeOfCheese telegraph.co.uk/news/main.jhtml?xml=/news/2008/04/01/npenguin101.xml Note the date in the URL

Reasoning patterns Obtain new sentences directly from some other sentences in knowledge base according to reasoning patterns If we have sentences a and a => b , we can correctly conclude the new sentence b This is called modus ponens If we have a AND b , we can correctly conclude a If we have a, we can correctly conclude a OR b Having a AND b, we can correctly conclude a => b

Formal proof that the sprinklers are on RoommateWet RoommateWet => (RoommateWetBecauseOfRain OR RoommateWetBecauseOfSprinklers) RoommateWetBecauseOfSprinklers => SprinklersOn RoommateWetBecauseOfRain => NOT(RoommateCarryingUmbrella) UmbrellaGone UmbrellaGone => (YouCarryingUmbrella OR RoommateCarryingUmbrella) NOT(YouCarryingUmbrella) YouCarryingUmbrella OR RoommateCarryingUmbrella (modus ponens on 5 and 6) NOT(YouCarryingUmbrella) => RoommateCarryingUmbrella (equivalent to 8) RoommateCarryingUmbrella (modus ponens on 7 and 9) NOT(NOT(RoommateCarryingUmbrella) (equivalent to 10) NOT(NOT(RoommateCarryingUmbrella)) => NOT(RoommateWetBecauseOfRain) (equivalent to 4 by contraposition) NOT(RoommateWetBecauseOfRain) (modus ponens on 11 and 12) RoommateWetBecauseOfRain OR RoommateWetBecauseOfSprinklers (modus ponens on 1 and 2) NOT(RoommateWetBecauseOfRain) => RoommateWetBecauseOfSprinklers (equivalent to 14) RoommateWetBecauseOfSprinklers (modus ponens on 13 and 15) SprinklersOn (modus ponens on 16 and 3)

Reasoning about penguins PetOfRoommateIsABird => PetOfRoommateCanFly PetOfRoommateIsAPenguin => PetOfRoommateIsABird PetOfRoommateIsAPenguin => NOT(PetOfRoommateCanFly) PetOfRoommateIsAPenguin PetOfRoommateIsABird (modus ponens on 4 and 2) PetOfRoommateCanFly (modus ponens on 5 and 1) NOT(PetOfRoommateCanFly) (modus ponens on 4 and 3) NOT(PetOfRoommateCanFly) => FALSE (equivalent to 6) FALSE (modus ponens on 7 and 8) FALSE => TheMoonIsMadeOfCheese (tautology) TheMoonIsMadeOfCheese (modus ponens on 9 and 10)

Systematic inference? General strategy: if we want to see if sentence a is entailed, add NOT(a) to the knowledge base and see if it becomes inconsistent (we can derive a contradiction) Any knowledge base can be written as a single formula in conjunctive normal form RoommateWet => (RoommateWetBecauseOfRain OR RoommateWetBecauseOfSprinklers) becomes (NOT(RoommateWet) OR RoommateWetBecauseOfRain OR RoommateWetBecauseOfSprinklers) Formula for modified knowledge base is satisfiable if and only if sentence a is not entailed

Resolution Unit resolution: if we have l1 OR l2 OR … OR lk and NOT(li) we can conclude l1 OR l2 OR … li-1 OR li+1 OR … OR lk Basically modus ponens

Resolution… General resolution: if we have l1 OR l2 OR … OR lk and m1 OR m2 OR … OR mn where for some i,j, li = NOT(mj) we can conclude l1 OR l2 OR … li-1 OR li+1 OR … OR lk OR m1 OR m2 OR … OR mj-1 OR mj+1 OR … OR mn Same literal may appear multiple times; remove those

Resolution algorithm Given formula in conjunctive normal form, repeat: Find two clauses with complementary literals, Apply resolution, Add resulting clause (if not already there) If the empty clause results, formula is not satisfiable Must have been obtained from P and NOT(P) Otherwise, if we get stuck (and we will eventually), the formula is guaranteed to be satisfiable (proof in a couple of slides)

Example Our knowledge base: Can we infer SprinklersOn? We add: 1) RoommateWetBecauseOfSprinklers 2) NOT(RoommateWetBecauseOfSprinklers) OR SprinklersOn Can we infer SprinklersOn? We add: 3) NOT(SprinklersOn) From 2) and 3), get 4) NOT(RoommateWetBecauseOfSprinklers) From 4) and 1), get empty clause