22c:145 Artificial Intelligence

Similar documents
CS:4420 Artificial Intelligence

Logic and Inferences

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

Logic: Propositional Logic (Part I)

Artificial Intelligence. Propositional logic

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

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

CS:4420 Artificial Intelligence

Knowledge based Agents

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

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

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

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

Natural Deduction for Propositional Logic

Propositional Logic Arguments (5A) Young W. Lim 11/30/16

Logical Agents. Outline

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

15414/614 Optional Lecture 1: Propositional Logic

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

Logical Inference. Artificial Intelligence. Topic 12. Reading: Russell and Norvig, Chapter 7, Section 5

INTRODUCTION TO LOGIC. Propositional Logic. Examples of syntactic claims

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

Inference in Propositional Logic

Logical Agent & Propositional Logic

Logic for Computer Science - Week 4 Natural Deduction

Outline. Logical Agents. Logical Reasoning. Knowledge Representation. Logical reasoning Propositional Logic Wumpus World Inference

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

cis32-ai lecture # 18 mon-3-apr-2006

Artificial Intelligence Chapter 7: Logical Agents

Advanced Topics in LP and FP

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

Outline. Logical Agents. Logical Reasoning. Knowledge Representation. Logical reasoning Propositional Logic Wumpus World Inference

Propositional Logic Arguments (5A) Young W. Lim 11/8/16

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

Propositional Logic Arguments (5A) Young W. Lim 10/11/16

Logical Agent & Propositional Logic

AI Principles, Semester 2, Week 2, Lecture 5 Propositional Logic and Predicate Logic

Artificial Intelligence Knowledge Representation I

Proof Methods for Propositional Logic

Language of Propositional Logic

Deliberative Agents Knowledge Representation I. Deliberative Agents

Logical Agents. Chapter 7

Logical Agents (I) Instructor: Tsung-Che Chiang

Propositional Logic: Logical Agents (Part I)

Propositional Logic and Semantics

Propositional Logic. Testing, Quality Assurance, and Maintenance Winter Prof. Arie Gurfinkel

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

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

Price: $25 (incl. T-Shirt, morning tea and lunch) Visit:

Artificial Intelligence

It is not the case that ϕ. p = It is not the case that it is snowing = It is not. r = It is not the case that Mary will go to the party =

Propositional Logic: Review

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask

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.

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

Comp487/587 - Boolean Formulas

CHAPTER 11. Introduction to Intuitionistic Logic

Logical Agents. September 14, 2004

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

Intelligent Agents. Pınar Yolum Utrecht University

Learning Goals of CS245 Logic and Computation

The Wumpus Game. Stench Gold. Start. Cao Hoang Tru CSE Faculty - HCMUT

COMP9414: Artificial Intelligence Propositional Logic: Automated Reasoning

Deductive Systems. Lecture - 3

THE LOGIC OF COMPOUND STATEMENTS

Artificial Intelligence

Propositional Logic. Logic. Propositional Logic Syntax. Propositional Logic

Propositional Logic Arguments (5A) Young W. Lim 2/23/17

Propositional Reasoning

02 Propositional Logic

The Logic of Compound Statements cont.

Tecniche di Verifica. Introduction to Propositional Logic

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

UNIT-I: Propositional Logic

Logic. (Propositional Logic)

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

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

MAI0203 Lecture 7: Inference and Predicate Calculus

Mathematical Logic Prof. Arindama Singh Department of Mathematics Indian Institute of Technology, Madras. Lecture - 15 Propositional Calculus (PC)

First Order Logic: Syntax and Semantics

Propositional logic II.

22c:145 Artificial Intelligence. First-Order Logic. Readings: Chapter 8 of Russell & Norvig.

COMP3702/7702 Artificial Intelligence Week 5: Search in Continuous Space with an Application in Motion Planning " Hanna Kurniawati"

CS 380: ARTIFICIAL INTELLIGENCE

6. Logical Inference

Propositional Logic Part 1

3 The Semantics of the Propositional Calculus

Propositional Logic. CS 3234: Logic and Formal Systems. Martin Henz and Aquinas Hobor. August 26, Generated on Tuesday 31 August, 2010, 16:54

Propositional Logic: Logical Agents (Part I)

Part 1: Propositional Logic

Propositional logic. First order logic. Alexander Clark. Autumn 2014

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

Proseminar on Semantic Theory Fall 2013 Ling 720 Propositional Logic: Syntax and Natural Deduction 1

Logic. proof and truth syntacs and semantics. Peter Antal

Introduction to Metalogic

Propositional Logic Language

Logical agents. Chapter 7. Chapter 7 1

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

Propositional Logic: Models and Proofs

Transcription:

22c:145 Artificial Intelligence Fall 2005 Propositional Logic Cesare Tinelli The University of Iowa Copyright 2001-05 Cesare Tinelli and Hantao Zhang. a a These notes are copyrighted material and may not be used in other course settings outside of the University of Iowa in their current or modified form without the express written permission of the copyright holders. 22c:145 Artificial Intelligence, Fall 05 p.1/31

Readings Chap. 7 of [Russell and Norvig, 2003] 22c:145 Artificial Intelligence, Fall 05 p.2/31

Logics A logic is a triple L, S, R where L, the logic s language, is a class of sentences described by a formal grammar. S, the logic s semantics is a formal specification of how to assign meaning in the real world to the elements of L. R, the logic s inference system, is a set of formal derivation rules over L. There are several logics: propositional, first-order, higher-order, modal, temporal, intuitionistic, linear, equational, non-monotonic, fuzzy,... We will concentrate on propositional logic and first-order logic. 22c:145 Artificial Intelligence, Fall 05 p.3/31

Propositional Logic Each sentence is made of propositional variables (A, B,..., P, Q,...) logical constants (True, False). logical connectives (,,,...). Every propositional variable stands for a basic fact. Examples: I m hungry, Apples are red, Joe and Jill are married. 22c:145 Artificial Intelligence, Fall 05 p.4/31

Propositional Logic Ontological Commitments Propositional Logic is about facts in the world that are either true or false, nothing else. Semantics of Propositional Logic Since each propositional variable stands for a fact about the world, its meaning ranges over the Boolean values {True, False}. Note: Do note confuse True, False, which are values (i.e., semantical entities) here with True, False which are logical constants (i.e., symbols of the language). 22c:145 Artificial Intelligence, Fall 05 p.5/31

Propositional Logic The Language Each propositional variable (A, B,..., P, Q,...) is a sentence. Each logical constant (True, False) is a sentence. If ϕ and ψ are sentences, all of the following are also sentences. (ϕ) ϕ ϕ ψ ϕ ψ ϕ ψ ϕ ψ Nothing else is a sentence. 22c:145 Artificial Intelligence, Fall 05 p.6/31

The Language of Propositional Logic More formally, it is the language generated by the following grammar. Symbols: Propositional variables: A, B,..., P, Q,... Logical constants: True (true) (and) (implies) (not) False (false) (or) (equivalent) Grammar Rules: Sentence ::= AtomicS ComplexS AtomicS ::= True False A B... P Q... ComplexS ::= (Sentence) Sentence Connective Sentence Sentence Connective ::= 22c:145 Artificial Intelligence, Fall 05 p.7/31

Semantics of Propositional Logic The meaning (value) of True is always True. The meaning of False is always False. The meaning of the other sentences depends on the meaning of the propositional variables. Base cases: Truth Tables P Q :P P ^ Q P _ Q P ) Q P, Q False False True False False True True False True True False True True False True False False False True False False True True False True True True True Non-base Cases: Given by reduction to the base cases Ex: the meaning of (P Q) R is the same as the meaning of A R where A has the same meaning as P Q. 22c:145 Artificial Intelligence, Fall 05 p.8/31

The Meaning of Logical Connectives: A Warning Disjunction A B is true when A or B or or both are true (inclusive or). A B is sometimes used to mean either A or B but not both (exclusive or). Implication A B does not require a causal connection between A and B. Ex: Sky-is-blue Snow-is-white When A is false, A B is always true regardless of the value of B. Ex: Two-equals-four Apples-are-red Beware of negations in implications. Ex: Is-a-female-bird Lays-eggs Is-a-female-bird lays-eggs 22c:145 Artificial Intelligence, Fall 05 p.9/31

Semantics of Propositional Logic An assignment of Boolean values to the propositional variables of a sentence is an interpretation of the sentence. P H P _ H (P _ H) ^ :H ((P _ H) ^ :H) ) P False False False False True False True True False True True False True True True True True True False True Interpretations: {P False, H False}, {P False, H True},... The semantics of Propositional logic is compositional: the meaning of a sentence is defined recursively in terms of the meaning of the sentence s components. 22c:145 Artificial Intelligence, Fall 05 p.10/31

Semantics of Propositional Logic The meaning of a sentence in general depends on its interpretation. Some sentences, however, have always the same meaning. P H P _ H (P _ H) ^ :H ((P _ H) ^ :H) ) P False False False False True False True True False True True False True True True True True True False True A sentence is satisfiable if it is true in some interpretation, valid if it is true in every possible interpretation. 22c:145 Artificial Intelligence, Fall 05 p.11/31

Entailment in Propositional Logic Given we write a set Γ of sentences and a sentence ϕ, Γ = ϕ iff every interpretation that makes all sentences in Γ true makes ϕ also true. Γ = ϕ is read as Γ entails ϕ or ϕ logically follows from Γ. 22c:145 Artificial Intelligence, Fall 05 p.12/31

Entailment in Propositional Logic: Examples {A, A B} = B {A} = A B {A, B} = A B {} = A A {A} = A B {A A} = A A B A B A B A B A A 1. False False True False False True 2. False True True True False True 3. True False False True False True 4. True True True True True True 22c:145 Artificial Intelligence, Fall 05 p.13/31

Properties of Entailment Γ = ϕ, for all ϕ Γ (inclusion property of PL) if Γ = ϕ, then Γ = ϕ for all Γ Γ (monotonicity of PL) ϕ is valid iff True = ϕ (also written as = ϕ) ϕ is unsatisfiable iff ϕ = False Γ = ϕ iff the set Γ { ϕ} is unsatisfiable 22c:145 Artificial Intelligence, Fall 05 p.14/31

Logical Equivalence Two sentences ϕ 1 and ϕ 2 are logically equivalent, written if ϕ 1 = ϕ 2 and ϕ 2 = ϕ 1. Note: ϕ 1 ϕ 2 ϕ 1 ϕ 2 if and only if every interpretation assigns the same Boolean value to ϕ 1 and ϕ 2. Implication and equivalence (, ), which are syntactical entities, are intimately related to entailment and logical equivalence ( =, ), which are semantical notions: ϕ 1 = ϕ 2 iff = ϕ 1 ϕ 2 ϕ 1 ϕ 2 iff = ϕ 1 ϕ 2 22c:145 Artificial Intelligence, Fall 05 p.15/31

Properties of Logical Connectives and are commutative ϕ 1 ϕ 2 ϕ 2 ϕ 1 ϕ 1 ϕ 2 ϕ 2 ϕ 1 and are associative ϕ 1 (ϕ 2 ϕ 3 ) (ϕ 1 ϕ 2 ) ϕ 3 ϕ 1 (ϕ 2 ϕ 3 ) (ϕ 1 ϕ 2 ) ϕ 3 and are mutually distributive ϕ 1 (ϕ 2 ϕ 3 ) (ϕ 1 ϕ 2 ) (ϕ 1 ϕ 3 ) ϕ 1 (ϕ 2 ϕ 3 ) (ϕ 1 ϕ 2 ) (ϕ 1 ϕ 3 ) and are related by (DeMorgan s Laws) (ϕ 1 ϕ 2 ) ϕ 1 ϕ 2 (ϕ 1 ϕ 2 ) ϕ 1 ϕ 2 22c:145 Artificial Intelligence, Fall 05 p.16/31

Properties of Logical Connectives,, and are actually redundant: ϕ 1 ϕ 2 ( ϕ 1 ϕ 2 ) ϕ 1 ϕ 2 ϕ 1 ϕ 2 ϕ 1 ϕ 2 (ϕ 1 ϕ 2 ) (ϕ 2 ϕ 1 ) We keep them all mainly for convenience. Exercise. Use the truth tables to verify all the logical equivalences seen so far. 22c:145 Artificial Intelligence, Fall 05 p.17/31

Inference Systems for Propositional Logic An inference system I for PL is a procedure that given a set Γ = {α 1,...,α m } of sentences and a sentence ϕ, may reply yes, no, or runs forever. If I replies positively to input (Γ, ϕ), we say that Γ derives ϕ in I, a and write Γ I ϕ Intuitively, I should be such that it replies yes on input (Γ, ϕ) only if ϕ is in fact entailed by Γ. a Or, I derives ϕ from Γ, or, ϕ derives from Γ in I. 22c:145 Artificial Intelligence, Fall 05 p.18/31

All These Fancy Symbols! Note: A B C is a sentence, a bunch of symbols manipulated by an inference system I. A B = C is a mathematical abbreviation standing for the statement: every interpretation that makes A B true, makes C also true. A B I C is a mathematical abbreviation standing for the statement: I derives C from A B. In other words, is a formal symbol of the logic, which is used by the inference system. = is a shorthand we use to talk about the meaning of formal sentences. I is a shorthand we use to talk about the output 22c:145 of Artificial the Intelligence, Fall 05 p.19/31

All These Fancy Symbols! The connective and the shorthand = are related as follows. The sentence ϕ 1 ϕ 2 is valid (always true) if and only if ϕ 1 = ϕ 2. Example: A (A B) is valid and A = (A B) A B A B A (A B) 1. False False False True 2. False True True True 3. True False True True 4. True True True True 22c:145 Artificial Intelligence, Fall 05 p.20/31

All These Fancy Symbols! The shorthands = and I are related as follows. A sound inference system can derive only sentences that logically follow from a given set of sentences: if Γ I ϕ then Γ = ϕ. A complete inference system can derive all sentences that logically follow from a given set of sentences: if Γ = ϕ then Γ I ϕ. 22c:145 Artificial Intelligence, Fall 05 p.21/31

Inference in Propositional Logic There are two (equivalent) classes of inference systems of Propositional Logic: one based on truth tables (T T ) one based on derivation rules (R) Truth Tables The inference system T T is specified as follows: {α 1,...,α m } T T ϕ iff all the values in the truth table of (α 1 α m ) ϕ are True. 22c:145 Artificial Intelligence, Fall 05 p.22/31

Inference by Truth Tables The truth-tables-based inference system is sound: α 1,..., α m TT ϕ implies truth table of (α 1 α m ) ϕ all true implies implies implies implies (α 1 α m ) ϕ is valid = (α 1 α m ) ϕ (α 1 α m ) = ϕ α 1,..., α m = ϕ It is also complete (exercise: prove it). Its time complexity is O(2 n ) where n is the number of propositional variables in α 1,...,α m, ϕ. We cannot hope to do better in general because a related, simpler problem (determining the satisfiability of a sentence) is NP-complete. However, really hard cases of propositional inference are somewhat rare in practice. 22c:145 Artificial Intelligence, Fall 05 p.23/31

Rule-Based Inference in Propositional Logic An inference system in Propositional Logic can also be specified as a set R of inference (or derivation) rules. Each rule is just a pattern premises/conclusion. A rule applies to Γ and derives ϕ if some of the sentences in Γ match with the premises of the rule and ϕ matches with the conclusion. A rule is sound it the set of its premises entails its conclusion. 22c:145 Artificial Intelligence, Fall 05 p.24/31

Some Inference Rules And-Introduction α β α β And-Elimination α β α Or-Introduction α α β α β β α β α 22c:145 Artificial Intelligence, Fall 05 p.25/31

Some Inference Rules (cont d) Implication-Elimination (aka Modus Ponens) α β β α Unit Resolution α β β α Resolution α β α γ β γ or, equivalently, α β, β γ α γ 22c:145 Artificial Intelligence, Fall 05 p.26/31

Some Inference Rules (cont d) Double-Negation-Elimination α α False-Introduction α α False False-Elimination False β 22c:145 Artificial Intelligence, Fall 05 p.27/31

Inference by Proof We say there is a proof of ϕ from Γ in an inference system R if we can derive ϕ by applying the rules of R repeatedly to Γ and its derived sentences. Example: a proof of P from {(P H) H} 1. (P H) H by assumption 2. P H by -elimination applied to (1) 3. H by -elimination applied to (1) 4. P by unit resolution applied to (2),(3) We can represent a proof more visually as a proof tree: Example: (P H) H (P H) H P H H P 22c:145 Artificial Intelligence, Fall 05 p.28/31

Rule-Based Inference in Propositional Logic More precisely, there is a proof of ϕ from Γ in R if 1. ϕ Γ or, 2. there is a rule in R that applies to Γ and produces ϕ or, 3. there is a proof of each ϕ 1,...,ϕ m from Γ in R and a rule that applies to {ϕ 1,...,ϕ m } and produces ϕ. Then, the inference system R is specified as follows: Γ R ϕ iff there is a proof of ϕ from Γ in R 22c:145 Artificial Intelligence, Fall 05 p.29/31

An Inference System R α β α α α β α β β α α β α β α β α β α α β β α β β γ β α α γ α α α False α False β 22c:145 Artificial Intelligence, Fall 05 p.30/31

Soundness of R The given system R is sound because all of its rules are. α β, β γ Example: the Resolution rule α γ α β γ β α β β γ α γ 1. False False False True False True False 2. False False True True False True True 3. False True False False True False False 4. False True True False True True True 5. True False False True True True True 6. True False True True True True True 7. True True False False True False True 8. True True True False True True True All the interpretations that satisfy both α β and β γ (4,5,6,8) satisfy α γ as well. 22c:145 Artificial Intelligence, Fall 05 p.31/31

Soundness of R The given system R is sound because all of its rules are. Exercise: prove that the other inference rules are sound as well. Is R also complete? 22c:145 Artificial Intelligence, Fall 05 p.31/31