Logic: Propositional Logic (Part I)

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

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Propositional Logic Language

Intelligent Agents. Pınar Yolum Utrecht University

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

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

Advanced Topics in LP and FP

Logic: First Order Logic

Introduction to Artificial Intelligence. Logical Agents

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

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

Foundations of Artificial Intelligence

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Logical Agents. Chapter 7

Language of Propositional Logic

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel

Logic: Propositional Logic Truth Tables

Logical Agents. Outline

Logical Agent & Propositional Logic

Kecerdasan Buatan M. Ali Fauzi

Inference in Propositional Logic

Tecniche di Verifica. Introduction to Propositional Logic

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

Logical Agent & Propositional Logic

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

Propositional Calculus: Formula Simplification, Essential Laws, Normal Forms

CSC Discrete Math I, Spring Propositional Logic

Inf2D 06: Logical Agents: Knowledge Bases and the Wumpus World

COMP9414: Artificial Intelligence Propositional Logic: Automated Reasoning

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

Artificial Intelligence Chapter 7: Logical Agents

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

Logical Agents. Chapter 7

Logical agents. Chapter 7. Chapter 7 1

Logical agents. Chapter 7. Chapter 7 1

TDT4136 Logic and Reasoning Systems

Knowledge based Agents

Class Assignment Strategies

Knowledge representation DATA INFORMATION KNOWLEDGE WISDOM. Figure Relation ship between data, information knowledge and wisdom.

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

Propositional Logic: Logical Agents (Part I)

Logic and Inferences

22c:145 Artificial Intelligence

Logical Agents (I) Instructor: Tsung-Che Chiang

Artificial Intelligence

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

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

Theory of Computer Science

A brief introduction to Logic. (slides from

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

Truth-Functional Logic

CS 771 Artificial Intelligence. Propositional Logic

Agenda. Artificial Intelligence. Reasoning in the Wumpus World. The Wumpus World

Natural Deduction for Propositional Logic

Propositional Logic and Semantics

Compound Propositions

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

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

Propositional Logic: Models and Proofs

Deductive Systems. Lecture - 3

Tautologies, Contradictions, and Contingencies

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw

CS 380: ARTIFICIAL INTELLIGENCE

Introduction to Intelligent Systems

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask

Logic. proof and truth syntacs and semantics. Peter Antal

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

Learning Goals of CS245 Logic and Computation

Chapter 4: Classical Propositional Semantics

Propositional Logic. Logic. Propositional Logic Syntax. Propositional Logic

CS:4420 Artificial Intelligence

7. Logical Agents. COMP9414/ 9814/ 3411: Artificial Intelligence. Outline. Knowledge base. Models and Planning. Russell & Norvig, Chapter 7.

Part 1: Propositional Logic

COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning

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

Outline. Formale Methoden der Informatik First-Order Logic for Forgetters. Why PL1? Why PL1? Cont d. Motivation

Artificial Intelligence. Propositional logic

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

Chapter 11: Automated Proof Systems

CS 188: Artificial Intelligence Spring 2007

Section 1.2 Propositional Equivalences. A tautology is a proposition which is always true. A contradiction is a proposition which is always false.

Introduction to Intelligent Systems

Propositional Logic Basics Propositional Equivalences Normal forms Boolean functions and digital circuits. Propositional Logic.

Revised by Hankui Zhuo, March 21, Logical agents. Chapter 7. Chapter 7 1

Logical Agents: Propositional Logic. Chapter 7

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

Proof Methods for Propositional Logic

Propositional Logic Part 1

Inference Methods In Propositional Logic

Propositional natural deduction

Propositional Logic: Methods of Proof. Chapter 7, Part II

2.2: Logical Equivalence: The Laws of Logic

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

Propositional Reasoning

INF5390 Kunstig intelligens. Logical Agents. Roar Fjellheim

Agents that reason logically

Propositional Logic: Methods of Proof (Part II)

15414/614 Optional Lecture 1: Propositional Logic

Transcription:

Logic: Propositional Logic (Part I) Alessandro Artale Free University of Bozen-Bolzano Faculty of Computer Science http://www.inf.unibz.it/ artale Descrete Mathematics and Logic BSc course Thanks to Prof. Enrico Franconi for provoding the slides

Knowledge bases Inference engine Knowledge base domain-independent algorithms domain-specific content Knowledge base = set of sentences in a formal language = logical theory Declarative approach to build an intelligent agent: Tell him what he needs to know Then he can Ask himself what to do answers should follow from the KB Agents can be viewed at: the knowledge level what they know, regardless of how it is implemented; or at the implementation level data structures in KB and algorithms that manipulate them

Logic in general Logic is a formal language for representing information such that conclusions can be drawn. Syntax defines the sentences in the language Semantics define the meaning of sentences; i.e., define truth of a sentence in a world E.g., the language of arithmetic x + 2 y is a sentence; x2 + y > is not a sentence x + 2 y is true iff the number x + 2 is no less than the number y x + 2 y is true in a world where x = 7, y = 1 x + 2 y is false in a world where x = 0, y = 6 x + 2 x + 1 is true in every world.

The one and only Logic? Logics of higher order Modal logics epistemic temporal and spatial... Description logic Non-monotonic logic Intuitionistic logic... But: There are standard approaches propositional and predicate logic

Reasoning: Entailment Logical Implication KB = α Knowledge base KB entails (or, logically implies) sentence α if and only if α is true in all worlds where KB is true E.g., the KB containing Manchester United won and Manchester City won entails Either Manchester United won or Manchester City won

Models Semantics in Logic is in terms of Models: structured worlds with respect to which truth of sentences can be evaluated. We say M is a model of a sentence α if α is true in M. M(α) is the set of all models of α Semantics of Entailment: KB = α if and only if M(KB) M(α) E.g. KB = {United won, City won} α = City won or α = Manchester won or α = either City or Manchester won

Reasoning: Inference Deduction Derivation KB i α KB i α = sentence α can be inferred (or, derived or deduced) from KB by procedure i It refers to an algorithmic procedure that manipulate sentences in the input KB to produce α as an output Soundness: i is sound if whenever KB i α, it is also true that KB = α Completeness: i is complete if whenever KB = α, it is also true that KB i α Ideally a logic must be expressive enough to say almost anything of interest, and equipped with a sound and complete inference procedure.

Reasoning: Entailment Vs. Inference We are interested in the questions: when a statement is entailed by a set of statements, in symbols: Θ = ϕ, can we define inference, in symbols: Θ i ϕ, in such a way that inference and entailment coincide? Formally, we are looking for an inference procedures, i, such that: Θ i ϕ iff Θ = ϕ If this is the case, then the inference procedure is said to be Sound and Complete.

Propositional Logics: Basic Ideas The elementary building blocks of propositional logic are atomic statements that cannot be decomposed any further: propositions. E.g., The block is red One plus one equals two It is raining Using logical connectives and, or, not, we can build propositional formulas.

Syntax of Propositional Logic Countable alphabet Σ of atomic propositions: a, b, c,.... ϕ, ψ a atomic formula false true Propositional formulas: ϕ negation ϕ ψ conjunction ϕ ψ disjunction ϕ ψ implication ϕ ψ equivalence Atom: atomic formula Literal: (negated) atomic formula Clause: disjunction of literals

Syntax of Propositional Logic Operator Precedence: from high to low is:,,,, Examples of Formulas p q r p q a (p q) (a b) c d...

Semantics: Intuition Atomic statements can be true T or false F. The truth value of formulas is determined by the truth values of the atoms (truth value assignment or interpretation). Example: (a b) c If a and b are false and c is true, then the formula is not true. Then logical entailment could be defined as follows: ϕ is logically implied by Θ, Θ = ϕ, if ϕ is true in all states of the world in which Θ is true.

Semantics: Formally A truth value assignment (or interpretation) of the atoms in Σ is a function I: I : Σ {T, F}. Note: Instead of I(a) we also write a I. Definition: A formula ϕ is satisfied by an interpretation I (I = ϕ), or is true under I, if and only if: I =, I = I = a iff a I = T I = ϕ iff I = ϕ I = ϕ ψ iff I = ϕ and I = ψ I = ϕ ψ iff I = ϕ or I = ψ I = ϕ ψ iff if I = ϕ, then I = ψ I = ϕ ψ iff I = ϕ, if and only if I = ψ

Exercises Let: I : a T b F c F d T Check the truth value under I of the following formulas: b c d c d b b c d ((a b) (c d)) ( (a b) (c d))

Exercises Find an interpretation and a formula such that the formula is true in that interpretation (or: the interpretation satisfies the formula). Find an interpretation and a formula such that the formula is not true in that interpretation (or: the interpretation does not satisfy the formula). Find a formula which can t be true in any interpretation (or: no interpretation can satisfy the formula).

Satisfiability and Validity An interpretation I is said to be a model of ϕ when: I = ϕ Definition. A formula ϕ is satisfiable, if there is some I that is a model of ϕ, unsatisfiable, if ϕ is not satisfiable, valid (i.e., a tautology), if every I is a model of ϕ. falsifiable, if there is some I that does not satisfy ϕ, Two formulas are logically equivalent (ϕ ψ), if for all I: I = ϕ iff I = ψ

Truth Tables A truth table is a convenient format for displaying the semantics of a formula by showing its truth value for every possible interpretation of the formula. Definition. Let ϕ be a formula with n atoms. A truth table is a table with n + 1 columns and 2 n rows. There is a column for each atom in ϕ, plus a column for the formula ϕ. The first n columns specify the interpretation I that maps atoms in ϕ to {T, F}. The last column shows the truth value of ϕ under I. Example: Truth Table for the formula A B: A B A B False False False False True False True False False True True True

Exercise Satisfiable, tautology? (((a b) a) b) (( ϕ ψ) (ψ ϕ)) (a b c) ( a b d) ( a b d) Equivalent? (ϕ (ψ χ)) ((ϕ ψ) (ψ χ)) (ϕ ψ) ϕ ψ Try to use truth tables to support your conclusions.

Important Facts Theorem. ϕ is valid iff ϕ is unsatisfiable. ϕ is unsatisfiable iff ϕ is valid. ϕ is satisfiable iff ϕ is falsifiable. Relationship between and Theorem. ϕ ψ iff ϕ ψ is a tautology. Logical equivalence justifies substitution of one formula for another. Substitution Theorem: If ϕ and ψ are equivalent, and χ results from replacing ϕ in χ by ψ, then χ and χ are equivalent.

Entailment Extension of the interpretation relationship to sets of formulas Θ I = Θ iff I = ϕ for all ϕ Θ Extension of the entailment relationship to sets of formulas Θ. Θ = ϕ iff I = ϕ for all models I of Θ Note: we want the formula ϕ to be implied by a set Θ, if ϕ is true in all models of Θ (symbolically, Θ = ϕ)

Propositional inference: Truth Table method Let α = A B and KB = {(A C), (B C)} Is it the case that KB = α? Check all possible models α must be true wherever KB is true A B C A C B C KB α False False False False False True False True False False True True True False False True False True True True False True True True

Propositional inference: Truth Table method Let α = A B and KB = {(A C), (B C)} Is it the case that KB = α? Check all possible models α must be true wherever KB is true A B C A C B C KB α False False False False False False True True False True False False False True True True True False False True True False True True True True False True True True True True

Propositional inference: Truth Table method Let α = A B and KB = {(A C), (B C)} Is it the case that KB = α? Check all possible models α must be true wherever KB is true A B C A C B C KB α False False False False True False False True True False False True False False True False True True True True True False False True True True False True True False True True False True True True True True True True

Propositional inference: Truth Table method Let α = A B and KB = {(A C), (B C)} Is it the case that KB = α? Check all possible models α must be true wherever KB is true A B C A C B C KB α False False False False True False False False True True False False False True False False True False False True True True True True True False False True True True True False True True False False True True False True True True True True True True True True

Propositional inference: Truth Table method Let α = A B and KB = {(A C), (B C)} Is it the case that KB = α? Check all possible models α must be true wherever KB is true A B C A C B C KB α False False False False True False False False False True True False False False False True False False True False True False True True True True True True True False False True True True True True False True True False False True True True False True True True True True True True True True True True Thus KB = α Note. The method of truth tables is a very inefficient since we need to evaluate a formula for each of 2 n possible interpretations, where n is the number of distinct atoms in the formula.

Equivalences (I) Commutativity ϕ ψ ψ ϕ ϕ ψ ψ ϕ ϕ ψ ψ ϕ Associativity (ϕ ψ) χ ϕ (ψ χ) (ϕ ψ) χ ϕ (ψ χ) (ϕ ψ) χ ϕ (ψ χ) Idempotence ϕ ϕ ϕ ϕ ϕ ϕ Absorption ϕ (ϕ ψ) ϕ ϕ (ϕ ψ) ϕ Distributivity ϕ (ψ χ) (ϕ ψ) (ϕ χ) ϕ (ψ χ) (ϕ ψ) (ϕ χ)

Equivalences (II) Implication ϕ ψ ϕ ψ Tautology ϕ ϕ ϕ ϕ ϕ Unsatisfiability ϕ Constants ϕ ϕ ϕ ϕ Neutrality ϕ ϕ ϕ ϕ ϕ ϕ Negation ϕ ϕ Double Negation ϕ ϕ De Morgan (ϕ ψ) ϕ ψ De Morgan (ϕ ψ) ϕ ψ

Minimal set of Logical Operators From the above presented equivalences the following follows. Theorem. The logical operators,,,, can be defined from negation,, and one of,,.

Properties of Entailment Θ {ϕ} = ψ iff Θ = ϕ ψ (Deduction Theorem) Θ {ϕ} = ψ iff Θ {ψ} = ϕ (Contraposition Theorem) Θ {ϕ} is unsatisfiable iff Θ = ϕ (Contradiction Theorem)

Normal Forms Inference procedures use syntactic operations on sentences, often expressed in standardized forms. Conjunctive Normal Form (CNF) conjunction of disjunctions of literals }{{} : n i=1 ( m clauses E.g., (A B) (B C D) j=1 l i,j) Disjunctive Normal Form (DNF) disjunction of conjunctions of literals }{{} : n i=1 ( m j=1 l i,j) terms E.g., (A B) (A C) (A D) ( B C) ( B D)

Normal Forms, cont. Horn Form (restricted) conjunction of Horn clauses (clauses with 1 positive literal) E.g., (A B) (B C D) Often written as set of implications: B = A and (C D) = B Theorem For every formula, there exists an equivalent formula in CNF and one in DNF.

Why Normal Forms? But: We can transform propositional formulas, in particular, we can construct their CNF and DNF. DNF tells us something as to whether a formula is satisfiable. If all disjuncts contain or complementary literals, then no model exists. Otherwise, the formula is satisfiable. CNF tells us something as to whether a formula is a tautology. If all clauses (= conjuncts) contain or complementary literals, then the formula is a tautology. Otherwise, the formula is falsifiable. the transformation into DNF or CNF is expensive (in time/space)

Summary: important notions Syntax: formula, atomic formula, literal, clause Semantics: truth value, assignment, interpretation Formula satisfied by an interpretation Logical implication, entailment Satisfiability, validity, tautology, logical equivalence Deduction theorem, Contraposition Theorem Conjunctive normal form, Disjunctive Normal form, Horn form