CS 4700: Foundations of Artificial Intelligence

Slides:



Advertisements
Similar presentations
Artificial Intelligence Chapter 13 The Propositional Calculus Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
Advertisements

Agents That Reason Logically Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2004.
Logic.
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
1 Discrete Structures CS 2800 Prof. Bart Selman Module Logic (part 1)
1 Problem Solving CS 331 Dr M M Awais Representational Methods Formal Methods Propositional Logic Predicate Logic.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
Knowledge Representation & Reasoning (Part 1) Propositional Logic chapter 6 Dr Souham Meshoul CAP492.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
Carla P. Gomes CS4700 CS 4700: Foundations of Artificial Intelligence Carla P. Gomes Module: Intro to Logic (Reading R&N: Chapter.
From Chapter 4 Formal Specification using Z David Lightfoot
Knoweldge Representation & Reasoning
Knowledge Representation & Reasoning (Part 1) Propositional Logic chapter 5 Dr Souham Meshoul CAP492.
Let remember from the previous lesson what is Knowledge representation
Logical Agents Chapter 7 Feb 26, Knowledge and Reasoning Knowledge of action outcome enables problem solving –a reflex agent can only find way from.
Rutgers CS440, Fall 2003 Propositional Logic Reading: Ch. 7, AIMA 2 nd Ed. (skip )
Adapted from Discrete Math
Intro to Discrete Structures
Logical Agents Chapter 7 (based on slides from Stuart Russell and Hwee Tou Ng)
Logical Agents. Knowledge bases Knowledge base = set of sentences in a formal language Declarative approach to building an agent (or other system): 
CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Jan 19, 2012.
Propositional Logic: Logical Agents (Part I) This lecture topic: Propositional Logic (two lectures) Chapter (this lecture, Part I) Chapter 7.5.
Knowledge Representation Use of logic. Artificial agents need Knowledge and reasoning power Can combine GK with current percepts Build up KB incrementally.
Pattern-directed inference systems
1 Logical Agents CS 171/271 (Chapter 7) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
S P Vimal, Department of CSIS, BITS, Pilani
1 Info 2950 Prof. Carla Gomes Module Logic (part 1) Rosen, Chapter 1.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 3 Logic Representations.
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.:
1 Logical Agents CS 171/271 (Chapter 7) Some text and images in these slides were drawn from Russel & Norvig’s published material.
1 Logical Agents Chapter 7. 2 A simple knowledge-based agent The agent must be able to: –Represent states, actions, etc. –Incorporate new percepts –Update.
October 17, 2012Introduction to Artificial Intelligence Lecture 11: Knowledge Representation and Reasoning I 1Semantics In propositional logic, we associate.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
CS6133 Software Specification and Verification
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part B Propositional Logic.
Propositional Logic Rather than jumping right into FOL, we begin with propositional logic A logic involves: §Language (with a syntax) §Semantics §Proof.
ARTIFICIAL INTELLIGENCE Lecture 2 Propositional Calculus.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7 Part I. 2 Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 01: Boolean Logic Sections 1.1 and 1.2 Jarek Rossignac.
March 3, 2016Introduction to Artificial Intelligence Lecture 12: Knowledge Representation & Reasoning I 1 Back to “Serious” Topics… Knowledge Representation.
Artificial Intelligence Logical Agents Chapter 7.
1 Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 3-1 Logic Based Reasoning.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents. Inference : Example 1 How many variables? 3 variables A,B,C How many models? 2 3 = 8 models.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Propositional Logic: Logical Agents (Part I)
Chapter 7. Propositional and Predicate Logic
Knowledge Representation and Reasoning
Niu Kun Discrete Mathematics Chapter 1 The Foundations: Logic and Proof, Sets, and Functions Niu Kun 离散数学.
The Propositional Calculus
ARTIFICIAL INTELLIGENCE
EA C461 – Artificial Intelligence Logical Agent
Information Technology Department
Discrete Structures CSC 281
Logical Agents Chapter 7.
Artificial Intelligence
Back to “Serious” Topics…
Logical Agents Chapter 7.
CS 416 Artificial Intelligence
Knowledge Representation I (Propositional Logic)
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Presentation transcript:

CS 4700: Foundations of Artificial Intelligence Carla P. Gomes gomes@cs.cornell.edu Module: Propositional Logic: Syntax and Semantics (Reading R&N: Chapter 7)

Propositional Logic

Syntax: Elements of the language Primitive propositions --- statements like: Bob loves Alice Alice loves Bob P Q Propositional Symbols (atomic propositions) Compound propositions Bob loves Alice and Alice loves Bob P  Q ( - stands for and)

Connectives ¬ - not  - and  - or  - implies  - equivalent (if and only if)

Syntax Syntax of Well Formed Formulas (wffs) or sentences Atomic sentences are wffs: Propositional symbol (atom); Example: P, Q, R, BlockIsRed; SeasonIsWinter; Complex or compound wffs. Given w1 and w2 wffs:  w1 (negation) (w1  w2) (conjunction) (w1  w2) (disjunction) (w1  w2) (implication; w1 is the antecedent; w2 is the consequent) (w1  w2) (biconditional)

Propositional logic: Examples Examples of wffs P  Q (P  Q)  R P  Q  P (P  Q)  (Q  P)  P P   this is not a wff. Note1: atoms or negated atoms are called literals; examples p and p are literals. P  Q is a “compound statement or proposition”. Note2: parentheses are important to ensure that the syntax is unambiguous. Quite often parentheses are omitted; The order of precedence in propositional logic is (from highest to lowest):  ,, , , 

Propositional Logic: Syntax vs. Semantics Semantics has to do with “meaning”:  it associates the elements of a logical language with the elements of a domain of discourse. Propositional Logic – we associate atoms with propositions / assertions about the world (therefore propositional logic).

Propositional Logic: Semantics Interpretation or Truth Assignment Assignment of truth values (True or False) to every proposition. So if for n atomic propositions, there are 2n truth assignments or interpretations. This makes the representation powerful: the propositions implicitly capture 2n possible states of the world.

Propositional Logic: Semantics Example: We might associate the atom (just a symbol!) BlockIsRed with the proposition: “The block is Red”, but we could also associate it with the proposition “The block is Black” even though this would be quite confusing… BlockIsRed has value True just in the case the block is red; otherwise BlockIsRed is False. (Aside: computers manipulate symbols. The string “BlockIsRed” does not “mean” anything to the computer. Meaning has to come from how to come from relations to other symbols and the “external world”. Hmm. How can a computer / robot obtain the meaning ``The block is Red’’? The fact that computers only “push around symbols” led to quite a bit of confusion in the early days or Artificial Intelligence, Robotics, and natural language understanding. Which ones are propositions? Cornell University is in Ithaca NY 1 + 1 = 2 what time is it? 2 + 3 = 10 watch your step!

Propositional Logic: Semantics Truth table for connectives Given the values of atoms under some interpretation, we can use a truth table to compute the value for any wff under that same interpretation; the truth table establishes the semantics (meaning) of the propositional connectives.   We can use the truth table to compute the value of any wff given the values of the constituent atom in the wff. Note: In table, P and Q can be compound propositions themselves. Note: implication not necessarily aligned with English usage.

Contra-positive: q   p; Inverse  p   q; Implication (p  q) This is only False (violated) when q is False and p is True. Related implications: Converse: q  p; Contra-positive: q   p; Inverse  p   q; Important: only the contra-positive of p  q is equivalent to p  q (i.e., has the same truth values in all models); the converse and the inverse are equivalent;

Implication (p  q) Implication plays an important role in reasoning a variety of terminology is used to refer to implication: conditional statement if p then q if p, q p is sufficient for q q if p q when p a necessary condition for p is q (*) p implies q p only if q (*) a sufficient condition for q is p q whenever p q is necessary for p (*) q follows from p Note: the mathematical concept of implication is independent of a cause and effect relationship between the hypothesis (p) and the conclusion (q), that is normally present when we use implication in English. Note: Focus on the case, when is the statement False. I.e., p is True and q is False, should be the only case that makes the statement false. (*) assuming the statement true, for p to be true, q has to be true

Propositional Logic: Semantics Notes: Bi-conditionals (p  q) Variety of terminology : p is necessary and sufficient for q if p then q, and conversely p if and only if q p iff q p  q is equivalent to (pq)  (q p) Note: the if and only if construction used in biconditionals is rarely used in common language; Example: “if you finish your meal, then you can play;” what is really meant is: “If you finish your meal, then you can play” and ”You can play, only if you finish your meal”.

Exclusive Or P  Q is equivalent to (P ¬Q)  (¬PQ) Truth Table P Q P  Q _____________ T T F T F T F T T F F F P  Q is equivalent to (P ¬Q)  (¬PQ) and also equivalent to ¬ (P  Q) Use a truth table to check these equivalences.

Propositional Logic: Satisfiability and Models An interpretation or truth assignment satisfies a wff, if the wff is assigned the value True, under that interpretation. An interpretation that satisfies a wff is called a model of that wff. Given an interpretation (i.e., the truth values for the n atoms) the one can use the truth table to find the value of any wff.

The truth table method (Propositional) logic has a “truth compositional semantics”: Meaning is built up from the meaning of its primitive parts (just like English text).

Propositional Logic: Inconsistency (Unsatisfiability) and Validity Inconsistent or Unsatisfiable set of Wffs It is possible that no interpretation satisifies a set of wffs  In that case we say that the set of wffs is inconsistent or unsatisfiable or a contradiction Examples: 1 – {P  P} 2 – { P  Q, P Q, P  Q, P Q} (use the truth table to confirm that this set of wffs is inconsistent) Validity (Tautology) of a set of Wffs If a wff is True under all the interpretations of its constituents atoms, we say that the wff is valid or it is a tautology. Examples: 1- P  P; 2 - (P  P); 3 - [P  (Q  P)]; 4- [(P  Q) P) P]

Logical equivalence       Two sentences p an q are logically equivalent ( or ) iff p  q is a tautology (and therefore p and q have the same truth value for all truth assignments)       Note: logical equivalence (or iff) allows us to make statements about PL, pretty much like we use = in in ordinary mathematics.

Truth Tables Truth table for connectives False We can use the truth table to compute the value of any wff given the values of the constituent atom in the wff. Example: Suppose P and Q are False and R has value True. Given this interpretation, what is the truth value of [( P  Q)  R ]  P? False If a system is described using n features (corresponding to propositions), and these features are represented by a corresponding set of n atoms, then there are 2n different ways the system can be. Why? Each of the ways the system can be corresponds to an interpretation. Therefore there are , i.e., 2n interpretations.

Example: Binary valued featured descriptions Consider the following description: The router can send packets to the edge system only if it supports the new address space. For the router to support the new address space it is necessary that the latest software release be installed. The router can send packets to the edge system if the latest software release is installed. The router does not support the new address space. Features: Router P - router can send packets to the edge of system Q - router supports the new address space Latest software release R – latest software release is installed

Feature 2 (Q) (router supports the new address space ) Formal: The router can send packets to the edge system only if it supports the new address space. (constraint between feature 1 and feature 2) If Feature 1 (P) (router can send packets to the edge of system) then P  Q Feature 2 (Q) (router supports the new address space ) For the router to support the new address space it is necessary that the latest software release be installed. (constraint between feature 2 and feature 3); If Feature 2 (Q) (router supports the new address space ) then Feature 3 (R) (latest software release is installed) Q  R The router can send packets to the edge system if the latest software release is installed. (constraint between feature 1 and feature 3); If Feature 3 (R) (latest software release is installed) then Feature 1 (P) (router can send packets to the edge of system) R  P The router does not support the new address space. ¬ Q

Inference

Entailment in the wumpus world Knowledge Base in the Wumpus World  Rules of the wumpus world + new percepts Situation after detecting nothing in [1,1], moving right, breeze in [2,1] Consider possible models for KB with respect to the cells (1,2), (2,2) and (3,1), with respect to the existence or non existence of pits 3 Boolean choices  8 possible models (enumerate all the models)

Wumpus world sentences Let Pi,j be true if there is a pit in [i, j]. Let Bi,j be true if there is a breeze in [i, j]. Sentence 1 (R1):  P1,1 Sentence 2 (R2): B1,1 Sentence 3 (R3): B2,1 "Pits cause breezes in adjacent squares" Sentence 4 (R4): B1,1  (P1,2  P2,1) Sentence 5 (R5): B2,1  (P1,1  P2,2  P3,1)

Inference by enumeration The goal of logical inference is to decide whether KB╞ α, for some sentence . For example, given the rules of the Wumpus World is P22 entailed? Relevant propositional symbols: R1:  P1,1 R2: B1,1 R3: B2,1 "Pits cause breezes in adjacent squares" R4: B1,1  (P1,2  P2,1) R5: B2,1  (P1,1  P2,2  P3,1) Inference by enumeration  we have 7 symbols therefore 27 interpretations – check if P22 is true in all the KB models;

Propositional logic: Wumpus World Each model specifies true/false for each proposition symbol E.g. P1,2 P2,2 P3,1 false true false With these symbols, 8 interpretations, can be enumerated automatically. P12  P22  P31 P12  P22  P31 P12  P22  P31 etc

Is P12 Entailed from KB. Is P22 Entailed from KB Is P12 Entailed from KB? Is P22 Entailed from KB? Given R1, R2, R3, R4, R5 P11 P12 P21 P22 P31 B11 B21 R1:P11 R2:B11 R3:B21 R4:B11(P12  P21) R5:B21P11  P22P31 KB False True Consider all possible truth assignments to P12, P22, P31, and check which assignments lead to models for the KB; then check if P12 and P22 is true in all the models

Is P12 Entailed from KB. Is P22 Entailed from KB Is P12 Entailed from KB? Is P22 Entailed from KB? Given R1, R2, R3, R4, R5 P11 P12 P21 P22 P31 B11 B21 R1:P11 R2:B11 R3:B21 R4:B11(P12  P21) R5:B21P11  P22P31 KB False True There are only 3 models for the KB: i.e., for which R1, R2, R3, R4, R5 are True; In all of them P12 is false, so there is not pit in [1,2] – the KB entails P12; on the other hand P22 is true in two of the three models and false in the other one – so at this point we cannot tell whether P22 is true or not.

Is P12 Entailed from KB. Is P22 Entailed from KB Is P12 Entailed from KB? Is P22 Entailed from KB? Given R1, R2, R3, R4, R5 What does the KB entail wrt P12? What does the KB entail wrt P22? P11 P12 P21 P22 P31 B11 B21 R1:P11 R2:B11 R3:B21 R4:B11(P12  P21) R5:B21P11  P22P31 KB False True There are only 3 models for the KB: i.e., for which R1, R2, R3, R4, R5 are True; In all of them P12 is false, so there is not pit in [1,2] – the KB entails P12; on the other hand P22 is true in two of the three models and false in the other one – so at this point we cannot tell whether P22 is true or not.

Inference by enumeration TT-Entails – Truth Table enumeration algorithm for deciding propositional entailment; This is a recursive enumeration of a finite space of assignments to variables; depth-first algorithm: it enumerates all models and checks if the sentence is true in all the models;  sound  complete; For n symbols, time complexity is O(2n), space complexity is O(n). Worst-case complexity is exponential for any algorithm. But in practice we can do better. More later…

Inference by enumeration TT-Entails – Truth Table enumeration algorithm for deciding propositional entailment; Processed all symbols We only care about models For which KB is True Depth-first enumeration of all models is sound and complete TT – Truth Table; PL-True returns true if a sentence holds within a model; Model – represents a partial model – an assignment to some of the variables; EXTEND(P,true,model) – returns a partial model in which P has the value True;

Models KB ╞ α iff M(KB)  M(α) Note: The empty set or null set ( Ø ) is a subset of every set. An inconsistent KB entails every possible sentence.

Validity and Satisfiability A sentence is valid (or is a tautology) if it is true in all interpretations, e.g., True, A A, A  A, (A  (A  B))  B Validity is connected to inference via the Deduction Theorem: KB ╞ α iff (KB  α) is valid A sentence is satisfiable if it is true in some model e.g., A B, C A sentence is unsatisfiable if it is true in no models e.g., AA Satisfiability is connected to inference via the following: KB ╞ α iff (KB α) is unsatisfiable (Reductio ad absurdum; Proof by refutation or Proof by contradiction)