B1.1 Motivation. Theory of Computer Science. Theory of Computer Science. B1.1 Motivation. B1.2 Syntax. B1.3 Semantics

Similar documents
Theory of Computer Science

Theory of Computer Science

Theory of Computer Science

Chapter 4: Classical Propositional Semantics

Logic: Propositional Logic (Part I)

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

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

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

Theory of Computer Science

Propositional Logic and Semantics

Syntax of propositional logic. Syntax tree of a formula. Semantics of propositional logic (I) Subformulas

Artificial Intelligence. Propositional logic

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

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

15414/614 Optional Lecture 1: Propositional Logic

Review of Predicate Logic

03 Propositional Logic II

Learning Goals of CS245 Logic and Computation

UNIT-I: Propositional Logic

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

COMP9414: Artificial Intelligence Propositional Logic: Automated Reasoning

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

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

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Theory of Computer Science

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

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

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

Advanced Topics in LP and FP

DISCRETE STRUCTURES WEEK5 LECTURE1

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence

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

Foundations of Artificial Intelligence

The Calculus of Computation: Decision Procedures with Applications to Verification. Part I: FOUNDATIONS. by Aaron Bradley Zohar Manna

A statement is a sentence that is definitely either true or false but not both.

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

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

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

02 Propositional Logic

Propositional Languages

3 Propositional Logic

Logic as a Tool Chapter 1: Understanding Propositional Logic 1.1 Propositions and logical connectives. Truth tables and tautologies

Proofs. Joe Patten August 10, 2018

1.1 Language and Logic

Inference Methods In Propositional Logic

Logic Overview, I. and T T T T F F F T F F F F

Logic. Def. A Proposition is a statement that is either true or false.

CSC Discrete Math I, Spring Propositional Logic

Tautologies, Contradictions, and Contingencies

Foundations of Artificial Intelligence

ECE473 Lecture 15: Propositional Logic

Comp487/587 - Boolean Formulas

Agents that reason logically

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

CSE 311: Foundations of Computing. Lecture 2: More Logic, Equivalence & Digital Circuits

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

1.1 Language and Logic

Propositional Logic. Logic. Propositional Logic Syntax. Propositional Logic

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

CHAPTER 4 CLASSICAL PROPOSITIONAL SEMANTICS

Propositional Logic: Models and Proofs

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel

CSE 311: Foundations of Computing. Lecture 3: Digital Circuits & Equivalence

Inference Methods In Propositional Logic

Propositional Logic Language

Introduction to Artificial Intelligence Propositional Logic & SAT Solving. UIUC CS 440 / ECE 448 Professor: Eyal Amir Spring Semester 2010

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

Logical Agent & Propositional Logic

COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning

2/13/2012. Logic: Truth Tables. CS160 Rosen Chapter 1. Logic?

Propositional Language - Semantics

Propositional Resolution Introduction

DERIVATIONS AND TRUTH TABLES

22c:145 Artificial Intelligence

PHIL 422 Advanced Logic Inductive Proof

Propositional Logic: Review

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

Propositional Reasoning

THE LOGIC OF COMPOUND STATEMENTS

Logical Agents. September 14, 2004

INTRODUCTION TO LOGIC. Propositional Logic. Examples of syntactic claims

Propositional Logic: Logical Agents (Part I)

Logic and Inferences

Logic and Proofs. (A brief summary)

Logic: Propositional Logic Truth Tables

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

INF3170 Logikk Spring Homework #8 For Friday, March 18

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

Logical Agent & Propositional Logic

Compound Propositions

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

Propositional Logic. Methods & Tools for Software Engineering (MTSE) Fall Prof. Arie Gurfinkel

Introduction. Applications of discrete mathematics:

Propositional Resolution Part 1. Short Review Professor Anita Wasilewska CSE 352 Artificial Intelligence

Artificial Intelligence Chapter 7: Logical Agents

Propositional Logic. Yimei Xiang 11 February format strictly follow the laws and never skip any step.

Proofs Propositions and Calculuses

PROPOSITIONAL LOGIC. VL Logik: WS 2018/19

Intelligent Agents. Pınar Yolum Utrecht University

Transcription:

Theory of Computer Science February 29, 2016 B1. Propositional Logic I Theory of Computer Science B1. Propositional Logic I Malte Helmert University of Basel February 29, 2016 B1.1 Motivation B1.2 Syntax B1.3 Semantics B1.4 Properties of Propositional Formulas B1.5 Summary M. Helmert (Univ. Basel) Theorie February 29, 2016 1 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 2 / 35 Why Logic? B1.1 Motivation formalizing mathematics What is a true statement? What is a valid proof? basis of many tools in computer science design of digital circuits meaning of programming languages semantics of databases; query optimization verification of safety-critical hardware/software knowledge representation in artificial intelligence... M. Helmert (Univ. Basel) Theorie February 29, 2016 3 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 4 / 35

Example: Group Theory Example: Group Theory Example of a group (in mathematics): Z, + the set of integers with the addition operation A group in general: G, G is a set and : G G G is called the group operation; we write x y instead of (x, y) (infix notation) For G, to be a group, it must satisfy the group axioms: (G1) For all x, y, z G, (x y) z = x (y z). There exists e G (called the neutral element) such that: (G2) for all x G, x e = x, and (G3) for all x G, there is a y G with x y = e. German: Gruppe, Verknüpfung, Infix, Gruppenaxiome, neutrales Element Theorem (Existence of a left inverse) Let G, be a group with neutral element e. For all x G there is a y G with y x = e. Proof. Consider an arbitrary x G. Because of G3, there is a y with x y = e (*). Also because of G3, for this y there is a z with y z = e (**). It follows that: y x (G2) = (y x) e (**) = (y x) (y z) (G1) = y (x (y z)) (G1) = y ((x y) z) (*) = y (e z) (G1) = (y e) z (G2) = y z (**) = e M. Helmert (Univ. Basel) Theorie February 29, 2016 5 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 6 / 35 What Logic is About Propositional Logic General Question: Given a set of axioms (e. g., group axioms) what can we derive from them? (e. g., theorem about the existence of a left inverse) And on what basis may we argue? (e. g., why does y x = (y x) e follow from axiom G2?) logic Goal: mechanical proofs formal game with letters detached from a concrete meaning Propositional logic is a simple logic without numbers or objects. Building blocks of propositional logic: propositions are statements that can be either true or false atomic propositions cannot be split into sub-propositions logical connectives connect propositions to form new ones German: Aussagenlogik, Aussage, atomare Aussage, Junktoren M. Helmert (Univ. Basel) Theorie February 29, 2016 7 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 8 / 35

Examples for Building Blocks Examples for Building Blocks If I don t drink beer to a meal, then I always eat fish. Whenever I have fish and beer with the same meal, I abstain from ice cream. When I eat ice cream or don t drink beer, then I never touch fish. If I don t drink beer to a meal, then I always eat fish. Whenever I have fish and beer with the same meal, I abstain from ice cream. When I eat ice cream or don t drink beer, then I never touch fish. Every sentence is a proposition that consists of sub-propositions (e. g., eat ice cream or don t drink beer ). atomic propositions drink beer, eat fish, eat ice cream logical connectives and, or, negation, if, then Every sentence is a proposition that consists of sub-propositions (e. g., eat ice cream or don t drink beer ). atomic propositions drink beer, eat fish, eat ice cream logical connectives and, or, negation, if, then M. Helmert (Univ. Basel) Theorie February 29, 2016 9 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 10 / 35 Problems with Natural Language Problems with Natural Language If I don t drink beer to a meal, then I always eat fish. Whenever I have fish and beer with the same meal, I abstain from ice cream. When I eat ice cream or don t drink beer, then I never touch fish. If I don t drink beer, then I eat fish. Whenever I have fish and beer, I abstain from ice cream. When I eat ice cream or don t drink beer, then I never touch fish. irrelevant information different formulations for the same connective/proposition irrelevant information different formulations for the same connective/proposition M. Helmert (Univ. Basel) Theorie February 29, 2016 11 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 12 / 35

Problems with Natural Language What is Next? irrelevant information If not DrinkBeer, then EatFish. If EatFish and DrinkBeer, then not EatIceCream. If EatIceCream or not DrinkBeer, then not EatFish. different formulations for the same connective/proposition What are meaningful (well-defined) sequences of atomic propositions and connectives? if then EatIceCream not or DrinkBeer and not meaningful syntax What does it mean if we say that a statement is true? Is DrinkBeer and EatFish true? semantics When does a statement logically follow from another? Does EatFish follow from if DrinkBeer, then EatFish? logical entailment German: Syntax, Semantik, logische Folgerung M. Helmert (Univ. Basel) Theorie February 29, 2016 13 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 14 / 35 B1. Propositional Logic I Syntax B1. Propositional Logic I Syntax Syntax of Propositional Logic B1.2 Syntax Definition (Syntax of Propositional Logic) Let A be a set of atomic propositions. The set of propositional formulas (over A) is inductively defined as follows: Every atom a A is a propositional formula over A. If ϕ is a propositional formula over A, then so is its negation ϕ. If ϕ and ψ are propositional formulas over A, then so is the conjunction (ϕ ψ). If ϕ and ψ are propositional formulas over A, then so is the disjunction (ϕ ψ). The implication (ϕ ψ) is an abbreviation for ( ϕ ψ). The biconditional (ϕ ψ) is an abbrev. for ((ϕ ψ) (ψ ϕ)). German: atomare Aussage, aussagenlogische Formel, Atom, Negation, Konjunktion, Disjunktion, Implikation, Bikonditional M. Helmert (Univ. Basel) Theorie February 29, 2016 15 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 16 / 35

B1. Propositional Logic I Syntax Syntax: Examples Which of the following sequences of symbols are propositional formulas over the set of all possible letter sequences? (A (B C)) ((EatFish DrinkBeer) EatIceCream) ( Rain StreetWet) (Rain StreetWet) (A = B) (A (B )C) (A (B C)) ((A B) C) ((A 1 A 2 ) (A 3 A 2 )) B1.3 Semantics Which kinds of formula are they (atom, conjunction,... )? M. Helmert (Univ. Basel) Theorie February 29, 2016 17 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 18 / 35 Meaning of Propositional Formulas? Semantics of Propositional Logic So far propositional formulas are only symbol sequences without any meaning. For example, what does this mean: ((EatFish DrinkBeer) EatIceCream)? We need semantics! Definition (Semantics of Propositional Logic) A truth assignment (or interpretation) for a set of atomic propositions A is a function I : A {0, 1}. A propositional formula ϕ (over A) holds under I (written as I = ϕ) according to the following definition: I = a (for a A) iff I(a) = 1 I = ϕ iff not I = ϕ I = (ϕ ψ) iff I = ϕ and I = ψ I = (ϕ ψ) iff I = ϕ or I = ψ Question: should we define semantics of (ϕ ψ) and (ϕ ψ)? German: Wahrheitsbelegung/Interpretation, ϕ gilt unter I M. Helmert (Univ. Basel) Theorie February 29, 2016 19 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 20 / 35

Semantics of Propositional Logic: Terminology Semantics: Example (1) For I = ϕ we also say I is a model of ϕ and that ϕ is true under I. If ϕ does not hold under I, we write this as I = ϕ and say that I is no model of ϕ and that ϕ is false under I. Note: = is not part of the formula but part of the meta language (speaking about a formula). German: I ist ein/kein Modell von ϕ; ϕ ist wahr/falsch unter I; Metasprache A = {DrinkBeer, EatFish, EatIceCream} I = {DrinkBeer 1, EatFish 0, EatIceCream 1} ϕ = ( DrinkBeer EatFish) Do we have I = ϕ? M. Helmert (Univ. Basel) Theorie February 29, 2016 21 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 22 / 35 Semantics: Example (2) Semantics: Example (3) Goal: prove I = ϕ. Let us use the definitions we have seen: I = ϕ iff I = ( DrinkBeer EatFish) iff I = ( DrinkBeer EatFish) iff I = DrinkBeer or I = EatFish This means that if we want to prove I = ϕ, it is sufficient to prove I = DrinkBeer or to prove I = EatFish. We attempt to prove the first of these statements. New goal: prove I = DrinkBeer. We again use the definitions: I = DrinkBeer iff not I = DrinkBeer iff not not I = DrinkBeer iff I = DrinkBeer iff I(DrinkBeer) = 1 The last statement is true for our interpretation I. To write this up as a proof of I = ϕ, we can go through this line of reasoning back-to-front, starting from our assumptions and ending with the conclusion we want to show. M. Helmert (Univ. Basel) Theorie February 29, 2016 23 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 24 / 35

Semantics: Example (4) Let I = {DrinkBeer 1, EatFish 0, EatIceCream 1}. Proof that I = ( DrinkBeer EatFish): (1) We have I = DrinkBeer (uses defn. of = for atomic props. and fact I(DrinkBeer) = 1). (2) From (1), we get I = DrinkBeer (uses defn. of = for negations). (3) From (2), we get I = DrinkBeer (uses defn. of = for negations). (4) From (3), we get I = ( DrinkBeer ψ) for all formulas ψ, in particular I = ( DrinkBeer EatFish) (uses defn. of = for disjunctions). (5) From (4), we get I = ( DrinkBeer EatFish) (uses defn. of ). B1.4 Properties of Propositional Formulas M. Helmert (Univ. Basel) Theorie February 29, 2016 25 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 26 / 35 Properties of Propositional Formulas Examples A propositional formula ϕ is satisfiable if ϕ has at least one model unsatisfiable if ϕ is not satisfiable valid (or a tautology) if ϕ is true under every interpretation falsifiable if ϕ is no tautology German: erfüllbar, unerfüllbar, gültig/eine Tautologie, falsifizierbar How can we show that a formula has one of these properties? Show that (A B) is satisfiable. I = {A 1, B 1} (+ simple proof that I = (A B)) Show that (A B) is falsifiable. I = {A 0, B 1} (+ simple proof that I = (A B)) Show that (A B) is not valid. Follows directly from falsifiability. Show that (A B) is not unsatisfiable. Follows directly from satisfiability. So far all proofs by specifying one interpretation. How to prove that a given formula is valid/unsatisfiable/ not satisfiable/not falsifiable? must consider all possible interpretations M. Helmert (Univ. Basel) Theorie February 29, 2016 27 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 28 / 35

Truth Tables Truth Tables in General Evaluate for all possible interpretations if they are models of the considered formula. I(A) I(B) I = (A B) 0 0 No 0 1 No 1 0 No 1 1 Yes I(A) I = A 0 Yes 1 No I(A) I(B) I = (A B) 0 0 No 0 1 Yes 1 0 Yes 1 1 Yes Similarly in the case where we consider a formula whose building blocks are themselves arbitrary unspecified formulas: I = ϕ I = ψ I = (ϕ ψ) No No No No Yes No Yes No No Yes Yes Yes Exercises: truth table for (ϕ ψ) M. Helmert (Univ. Basel) Theorie February 29, 2016 29 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 30 / 35 Truth Tables for Properties of Formulas Connection Between Formula Properties and Truth Tables Is ϕ = ((A B) ( B A)) valid, unsatisfiable,...? I(A) I(B) I = B I = (A B) I = ( B A) I = ϕ 0 0 Yes Yes No Yes 0 1 No Yes Yes Yes 1 0 Yes No Yes Yes 1 1 No Yes Yes Yes A propositional formula ϕ is satisfiable if ϕ has at least one model result in at least one row is Yes unsatisfiable if ϕ is not satisfiable result in all rows is No valid (or a tautology) if ϕ is true under every interpretation result in all rows is Yes falsifiable if ϕ is no tautology result in at least one row is No M. Helmert (Univ. Basel) Theorie February 29, 2016 31 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 32 / 35

Main Disadvantage of Truth Tables B1. Propositional Logic I Summary How big is a truth table with n atomic propositions? 1 2 interpretations (rows) 2 4 interpretations (rows) 3 8 interpretations (rows) n??? interpretations B1.5 Summary Some examples: 2 10 = 1024, 2 20 = 1048576, 2 30 = 1073741824 not viable for larger formulas; we need a different solution Foundations of Artificial Intelligence course M. Helmert (Univ. Basel) Theorie February 29, 2016 33 / 35 M. Helmert (Univ. Basel) Theorie February 29, 2016 34 / 35 B1. Propositional Logic I Summary Summary propositional logic based on atomic propositions syntax defines what well-formed formulas are semantics defines when a formula is true interpretations are the basis of semantics satisfiability and validity are important properties of formulas truth tables systematically consider all possible interpretations truth tables are only useful for small formulas M. Helmert (Univ. Basel) Theorie February 29, 2016 35 / 35