CS 2740 Knowledge Representation. Lecture 4. Propositional logic. CS 2740 Knowledge Representation. Administration

Similar documents
Knowledge Representation. Propositional logic.

Knowledge Representation. Propositional logic

Propositional logic II.

Introduction Logic Inference. Discrete Mathematics Andrei Bulatov

Discrete Structures of Computer Science Propositional Logic III Rules of Inference

Inference in Propositional Logic

Introduction Propositional Logic

Math.3336: Discrete Mathematics. Propositional Equivalences

The Logic of Compound Statements cont.

Rules Build Arguments Rules Building Arguments

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

Inference in first-order logic

Logic. Introduction to Artificial Intelligence CS/ECE 348 Lecture 11 September 27, 2001

Propositional Logic: Review

Logical Agents. September 14, 2004

CSCI 5582 Artificial Intelligence. Today 9/28. Knowledge Representation. Lecture 9

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

CS100: DISCRETE STRUCTURES. Lecture 5: Logic (Ch1)

Logic: Propositional Logic Truth Tables

Knowledge based Agents

Announcements. CS243: Discrete Structures. Propositional Logic II. Review. Operator Precedence. Operator Precedence, cont. Operator Precedence Example

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

software design & management Gachon University Chulyun Kim

Methods of Proof. 1.6 Rules of Inference. Argument and inference 12/8/2015. CSE2023 Discrete Computational Structures

Logic and Inferences

Natural Deduction for Propositional Logic

Inference in first-order logic

CHAPTER 1 - LOGIC OF COMPOUND STATEMENTS

Advanced Topics in LP and FP

Announcements. CS311H: Discrete Mathematics. Propositional Logic II. Inverse of an Implication. Converse of a Implication

PROPOSITIONAL CALCULUS

Overview. Knowledge-Based Agents. Introduction. COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Natural Deduction. Formal Methods in Verification of Computer Systems Jeremy Johnson

Learning Goals of CS245 Logic and Computation

Artificial Intelligence. Propositional logic

n logical not (negation) n logical or (disjunction) n logical and (conjunction) n logical exclusive or n logical implication (conditional)

Deductive Systems. Lecture - 3

Description Logics. Foundations of Propositional Logic. franconi. Enrico Franconi

Language of Propositional Logic

KB Agents and Propositional Logic

How to determine if a statement is true or false. Fuzzy logic deal with statements that are somewhat vague, such as: this paint is grey.

2. The Logic of Compound Statements Summary. Aaron Tan August 2017

CS 7180: Behavioral Modeling and Decision- making in AI

10/5/2012. Logic? What is logic? Propositional Logic. Propositional Logic (Rosen, Chapter ) Logic is a truth-preserving system of inference

Inference Methods In Propositional Logic

CSCI-2200 FOUNDATIONS OF COMPUTER SCIENCE

03 Propositional Logic II

Logical Agents. Knowledge based agents. Knowledge based agents. Knowledge based agents. The Wumpus World. Knowledge Bases 10/20/14

Review. Propositions, propositional operators, truth tables. Logical Equivalences. Tautologies & contradictions

Chapter 1: The Logic of Compound Statements. January 7, 2008

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

Logic: Propositional Logic (Part I)

Inference in first-order logic

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

Inference Methods In Propositional Logic

Propositional Logic: Part II - Syntax & Proofs 0-0

Artificial Intelligence. Propositional Logic. Copyright 2011 Dieter Fensel and Florian Fischer

COMP9414: Artificial Intelligence Propositional Logic: Automated Reasoning

Logical Agents. Outline

7 LOGICAL AGENTS. OHJ-2556 Artificial Intelligence, Spring OHJ-2556 Artificial Intelligence, Spring

Propositional logic (revision) & semantic entailment. p. 1/34

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic

Artificial Intelligence: Knowledge Representation and Reasoning Week 2 Assessment 1 - Answers

02 Propositional Logic

22c:145 Artificial Intelligence

15414/614 Optional Lecture 1: Propositional Logic

Proof Methods for Propositional Logic

Lecture 11: Measuring the Complexity of Proofs

WUCT121. Discrete Mathematics. Logic. Tutorial Exercises

Logical Structures in Natural Language: Propositional Logic II (Truth Tables and Reasoning

Description Logics. Deduction in Propositional Logic. franconi. Enrico Franconi

Intelligent Systems. Propositional Logic. Dieter Fensel and Dumitru Roman. Copyright 2008 STI INNSBRUCK

Review: Potential stumbling blocks

Artificial Intelligence Chapter 7: Logical Agents

Rules of Inference. Arguments and Validity

CS 380: ARTIFICIAL INTELLIGENCE PREDICATE LOGICS. Santiago Ontañón

ECOM Discrete Mathematics

Propositional Logic. Spring Propositional Logic Spring / 32

Propositional Logic Part 1

CS 380: ARTIFICIAL INTELLIGENCE

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5)

CS 2710 Foundations of AI Lecture 12. Propositional logic. Logical inference problem

Logic for Computer Science - Week 4 Natural Deduction

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

3/29/2017. Logic. Propositions and logical operations. Main concepts: propositions truth values propositional variables logical operations

PHIL 50 - Introduction to Logic

Logical Agent & Propositional Logic

Propositional Logic. Logic. Propositional Logic Syntax. Propositional Logic

PHIL12A Section answers, 28 Feb 2011

FORMAL PROOFS DONU ARAPURA

Review. p q ~p v q Contrapositive: ~q ~p Inverse: ~p ~q Converse: q p

Discrete Mathematics Logics and Proofs. Liangfeng Zhang School of Information Science and Technology ShanghaiTech University

n Empty Set:, or { }, subset of all sets n Cardinality: V = {a, e, i, o, u}, so V = 5 n Subset: A B, all elements in A are in B

AI Programming CS S-09 Knowledge Representation

THE LOGIC OF COMPOUND STATEMENTS

Chapter 1, Logic and Proofs (3) 1.6. Rules of Inference

Introduction to Metalogic

Propositional Logic. Jason Filippou UMCP. ason Filippou UMCP) Propositional Logic / 38

KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) RULES OF INFERENCE. Discrete Math Team

Intelligent Agents. Pınar Yolum Utrecht University

Transcription:

Lecture 4 Propositional logic Milos Hauskrecht milos@cs.pitt.edu 5329 Sennott Square dministration Homework assignment 1 is out Due next week on Wednesday, September 17 Problems: LISP programming a PL translation exercise Submission guidelines: Reports should be submitted at the beginning of the class on the due date Programs should be submitted electronically before the class. Submission instructions are in: http://www.cs.pitt.edu/~milos/courses/cs2740/program-submissions.html

Knowledge representation The objective of knowledge representation is to express knowledge about the world in a computer-tractable form Key aspects of knowledge representation languages: Syntax: describes how sentences are formed in the language Semantics: describes the meaning of sentences, what is it the sentence refers to in the real world Computational aspect: describes how sentences and objects are manipulated in concordance with semantical conventions Many KB systems rely on some variant of logic Logic Logic: defines a formal language for logical reasoning It gives us a tool that helps us to understand how to construct a valid argument Logic Defines: the meaning of statements the rules of logical inference

Logic Logic is defined by: set of sentences sentence is constructed from a set of primitives according to syntax rules. set of interpretations n interpretation gives a semantic to primitives. It associates primitives with values. The valuation (meaning) function V ssigns a value (typically the truth value) to a given sentence under some interpretation V : sentence interpretation {, } The simplest logic Propositional logic Definition: proposition is a statement that is either true or false. Examples: Pitt is located in the Oakland section of Pittsburgh. (T) 5 + 2 = 8. (F) It is raining today. (either T or F)

Propositional logic Examples (cont.): How are you? a question is not a proposition x + 5 = 3 since x is not specified, neither true nor false 2 is a prime number. (T) She is very talented. since she is not specified, neither true nor false There are other life forms on other planets in the universe. either T or F Propositional logic. Syntax Formally propositional logic P: is defined by Syntax+interpretation+semantics of P Syntax: Symbols (alphabet) in P: Constants:, Propositional symbols Examples: P Pitt is located in the Oakland section of Pittsburgh., It rains outside, etc. set of connectives:,,,,

Propositional logic. Syntax Sentences in the propositional logic: tomic sentences: Constructed from constants and propositional symbols, are (atomic) sentences P, Q or Light in the room is on, It rains outside are (atomic) sentences Composite sentences: Constructed from valid sentences via connectives If, B are sentences then ( B ) ( B ) ( B ) ( B ) or ( B ) ( B ) are sentences Propositional logic. Semantics. The semantic gives the meaning to sentences. the semantics in the propositional logic is defined by: 1. Interpretation of propositional symbols and constants Semantics of atomic sentences 2. Through the meaning of connectives Meaning (semantics) of composite sentences

Semantic: propositional symbols propositional symbol a statement about the world that is either true or false Examples: Pitt is located in the Oakland section of Pittsburgh It rains outside Light in the room is on n interpretation maps symbols to one of the two values: (T), or (F), depending on whether the symbol is satisfied in the world I: Light in the room is on ->, It rains outside -> I : Light in the room is on ->, It rains outside -> Semantic: propositional symbols The meaning (value) of the propositional symbol for a specific interpretation is given by its interpretation I: Light in the room is on ->, It rains outside -> V(Light in the room is on, I) = V( It rains outside, I) = I : Light in the room is on ->, It rains outside -> V(Light in the room is on, I ) =

Semantics: constants The meaning (truth) of constants: and constants are always (under any interpretation) assigned the corresponding, value V(, I) = V(, I) = For any interpretation I Semantics: composite sentences The meaning (truth value) of complex propositional sentences. Determined using the standard rules of logic: P Q P P Q P Q P Q P Q Rows define all possible interpretations (worlds)

Translation ssume the following sentences: It is not sunny this afternoon and it is colder than yesterday. We will go swimming only if it is sunny. If we do not go swimming then we will take a canoe trip. If we take a canoe trip, then we will be home by sunset. Denote: p = It is sunny this afternoon q = it is colder than yesterday r = We will go swimming s= we will take a canoe trip t= We will be home by sunset Translation ssume the following sentences: It is not sunny this afternoon and it is colder than yesterday. We will go swimming only if it is sunny. If we do not go swimming then we will take a canoe trip. If we take a canoe trip, then we will be home by sunset. Denote: p = It is sunny this afternoon q = it is colder than yesterday r = We will go swimming s= we will take a canoe trip t= We will be home by sunset p q r p r s s t

Contradiction and Tautology Some composite sentences may always (under any interpretation) evaluate to a single truth value: Contradiction (always ) P P Tautology (always ) P P ( P Q ) ( P Q ) ( P Q ) ( P Q ) DeMorgan s Laws Model, validity and satisfiability model (in logic): n interpretation is a model for a set of sentences if it assigns true to each sentence in the set. sentence is satisfiable if it has a model; There is at least one interpretation under which the sentence can evaluate to. sentence is valid if it is in all interpretations i.e., if its negation is not satisfiable (leads to contradiction) P Q P Q ( P Q) Q (( P Q) Q) P

Model, validity and satisfiability model (in logic): n interpretation is a model for a set of sentences if it assigns true to each sentence in the set. sentence is satisfiable if it has a model; There is at least one interpretation under which the sentence can evaluate to. sentence is valid if it is in all interpretations i.e., if its negation is not satisfiable (leads to contradiction) P Q P Q ( P Q) Q (( P Q) Q) P Model, validity and satisfiability model (in logic): n interpretation is a model for a set of sentences if it assigns true to each sentence in the set. sentence is satisfiable if it has a model; There is at least one interpretation under which the sentence can evaluate to. sentence is valid if it is in all interpretations i.e., if its negation is not satisfiable (leads to contradiction) Satisfiable sentence P Q P Q ( P Q) Q (( P Q) Q) P

Model, validity and satisfiability model (in logic): n interpretation is a model for a set of sentences if it assigns true to each sentence in the set. sentence is satisfiable if it has a model; There is at least one interpretation under which the sentence can evaluate to. sentence is valid if it is in all interpretations i.e., if its negation is not satisfiable (leads to contradiction) Satisfiable sentence Valid sentence P Q P Q ( P Q) Q (( P Q) Q) P Entailment Entailment reflects the relation of one fact in the world following from the others according to logic Entailment KB = α Knowledge base KB entails sentence α if and only if α is true in all worlds where KB is true

Sound and complete inference Inference is a process by which conclusions are reached. We want to implement the inference process on a computer!! ssume an inference procedure i that derives a sentence α from the KB : KB i α Properties of the inference procedure in terms of entailment Soundness: n inference procedure is sound If KB i α then it is true that KB = α Completeness: n inference procedure is complete If KB = α then it is true that KB α i Logical inference problem Logical inference problem: Given: a knowledge base KB (a set of sentences) and a sentence α (called a theorem), Does a KB semantically entail α? KB = α? In other words: In all interpretations in which sentences in the KB are true, is also true? α Question: Is there a procedure (program) that can decide this problem in a finite number of steps? nswer: Yes. Logical inference problem for the propositional logic is decidable.

Solving logical inference problem In the following: How to design the procedure that answers: = α KB? Three approaches: Truth-table approach Inference rules Conversion to the inverse ST problem Resolution-refutation Truth-table approach Problem: KB = α? We need to check all possible interpretations for which the KB is true (models of KB) whether α is true for each of them Truth table: enumerates truth values of sentences for all possible interpretations (assignments of / values to propositional symbols) Example: KB P Q P Q P Q α ( P Q) Q

Truth-table approach Problem: KB = α? We need to check all possible interpretations for which the KB is true (models of KB) whether α is true for each of them Truth table: enumerates truth values of sentences for all possible interpretations (assignments of / to propositional symbols) Example: P Q P Q KB P Q α ( P Q) Q Truth-table approach Problem: KB = α? We need to check all possible interpretations for which the KB is true (models of KB) whether α is true for each of them Truth table: enumerates truth values of sentences for all possible interpretations (assignments of / to propositional symbols) Example: KB P Q P Q P Q α ( P Q) Q

Truth-table approach two steps procedure: 1. Generate table for all possible interpretations 2. Check whether the sentence α evaluates to true whenever KB evaluates to true Example: KB = ( C ) ( B C ) α = ( B ) B C C ( B C ) KB α Truth-table approach two steps procedure: 1. Generate table for all possible interpretations 2. Check whether the sentence α evaluates to true whenever KB evaluates to true Example: KB = ( C ) ( B C ) α = ( B ) B C C ( B C ) KB α

Truth-table approach two steps procedure: 1. Generate table for all possible interpretations 2. Check whether the sentence α evaluates to true whenever KB evaluates to true Example: KB = ( C ) ( B C ) α = ( B ) B C C ( B C ) KB α Truth-table approach KB = ( C ) ( B C ) α = ( B ) B C C ( B C ) KB α KB entails α The truth-table approach is sound and complete for the propositional logic!!

Limitations of the truth table approach. KB = α? What is the computational complexity of the truth table approach? Exponential in the number of the proposition symbols n 2 Rows in the table must be filled Observation: typically only a small subset of rows is true Question: Is it possible to make the process more efficient? Solution: Inference rules checks only entries for which KB is. Represent sound inference patterns repeated in inferences Can be used to generate new (sound) sentences from the existing ones Inference rules for logic Modus ponens B, B premise conclusion If both sentences in the premise are true then conclusion is true. The modus ponens inference rule is sound. We can prove this through the truth table. B B

Inference rules for logic nd-elimination 1 2 i n nd-introduction Or-introduction 1, 1 2, 1 2 2 n i n i K n Inference rules for logic Elimination of double negation Unit resolution Resolution B, B B, B C C special case of ll of the above inference rules are sound. We can prove this through the truth table, similarly to the modus ponens case.

Example. Inference rules approach. KB: P Q P R S Theorem: S 1. 2. 3. P Q P R S Example. Inference rules approach. KB: P Q P R S Theorem: S 1. P Q 2. P R 3. 4. S P From 1 and nd-elim 1 2 i n

Example. Inference rules approach. KB: P Q P R S Theorem: S 1. P Q 2. P R 3. 4. 5. S P R From 2,4 and Modus ponens B, B Example. Inference rules approach. KB: P Q P R S Theorem: S 1. 2. 3. 4. 5. P Q P R S P R 6. Q From 1 and nd-elim 1 2 i n

Example. Inference rules approach. KB: P Q P R S Theorem: S 1. P Q 2. P R 3. 4. 5. 6. 7. S P R Q From 5,6 and nd-introduction 1, 2, n 1 2 n Example. Inference rules approach. KB: P Q P R S Theorem: S 1. 2. 3. 4. 5. 6. 7. P Q P R S P R Q B, B 8. S From 7,3 and Modus ponens Proved: S

Example. Inference rules approach. KB: P Q P R S Theorem: S 1. P Q 2. P R 3. 4. S P From 1 and nd-elim 5. R From 2,4 and Modus ponens 6. Q From 1 and nd-elim 7. From 5,6 and nd-introduction 8. S From 7,3 and Modus ponens Proved: S