Discrete Structures & Algorithms. Propositional Logic EECE 320 // UBC

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

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

Compound Propositions

CSC Discrete Math I, Spring Propositional Logic

Propositional Logic. Spring Propositional Logic Spring / 32

PROPOSITIONAL CALCULUS

Chapter Summary. Propositional Logic. Predicate Logic. Proofs. The Language of Propositions (1.1) Applications (1.2) Logical Equivalences (1.

CHAPTER 1 - LOGIC OF COMPOUND STATEMENTS

Propositional Logic. Fall () Propositional Logic Fall / 30

HW1 graded review form? HW2 released CSE 20 DISCRETE MATH. Fall

THE LOGIC OF COMPOUND STATEMENTS

The Logic of Compound Statements cont.

software design & management Gachon University Chulyun Kim

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

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

Chapter 1, Part I: Propositional Logic. With Question/Answer Animations

2/2/2018. CS 103 Discrete Structures. Chapter 1. Propositional Logic. Chapter 1.1. Propositional Logic

Discrete Structures of Computer Science Propositional Logic III Rules of Inference

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

Discrete Mathematical Structures. Chapter 1 The Foundation: Logic

2.2: Logical Equivalence: The Laws of Logic

A. Propositional Logic

Section 1.2: Propositional Logic

Example. Logic. Logical Statements. Outline of logic topics. Logical Connectives. Logical Connectives

What is Logic? Introduction to Logic. Simple Statements. Which one is statement?

EECS 1028 M: Discrete Mathematics for Engineers

Chapter 1, Section 1.1 Propositional Logic

Definition 2. Conjunction of p and q

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

Packet #1: Logic & Proofs. Applied Discrete Mathematics

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

Sample Problems for all sections of CMSC250, Midterm 1 Fall 2014

Logic and Proofs. (A brief summary)

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

Propositional Equivalence

1 The Foundation: Logic and Proofs

Chapter 4, Logic using Propositional Calculus Handout

MACM 101 Discrete Mathematics I. Exercises on Propositional Logic. Due: Tuesday, September 29th (at the beginning of the class)

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

15414/614 Optional Lecture 1: Propositional Logic

CSE 20 DISCRETE MATH. Fall

Logic. Logic is a discipline that studies the principles and methods used in correct reasoning. It includes:

Today s Lecture 2/25/10. Truth Tables Continued Introduction to Proofs (the implicational rules of inference)

Natural Deduction is a method for deriving the conclusion of valid arguments expressed in the symbolism of propositional logic.

Chapter 4: Classical Propositional Semantics

Boolean Algebra and Proof. Notes. Proving Propositions. Propositional Equivalences. Notes. Notes. Notes. Notes. March 5, 2012

Discrete Mathematics and Applications COT3100

Topic 1: Propositional logic

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

1.1 Statements and Compound Statements

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

Discrete Structures of Computer Science Propositional Logic I

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

Propositional Logic: Equivalence

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

Introduction. Applications of discrete mathematics:

1 The Foundation: Logic and Proofs

PHI Propositional Logic Lecture 2. Truth Tables

Introduction Logic Inference. Discrete Mathematics Andrei Bulatov

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

CSE 20 DISCRETE MATH WINTER

EECS 1028 M: Discrete Mathematics for Engineers

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

Section 1.1 Propositional Logic. proposition : true = T (or 1) or false = F (or 0) (binary logic) the moon is made of green cheese

Proofs. Joe Patten August 10, 2018

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

COMP 182 Algorithmic Thinking. Proofs. Luay Nakhleh Computer Science Rice University

ANALYSIS EXERCISE 1 SOLUTIONS

1.3 Propositional Equivalences

Proposition/Statement. Boolean Logic. Boolean variables. Logical operators: And. Logical operators: Not 9/3/13. Introduction to Logical Operators

An Introduction to Logic 1.1 ~ 1.4 6/21/04 ~ 6/23/04

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

Introduction Propositional Logic. Discrete Mathematics Andrei Bulatov

02 Propositional Logic

Chapter 1 Elementary Logic

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

The statement calculus and logic

KP/Worksheets: Propositional Logic, Boolean Algebra and Computer Hardware Page 1 of 8

DISCRETE MATHEMATICS BA202

Chapter 1, Part I: Propositional Logic. With Question/Answer Animations

Logic and Proofs. (A brief summary)

Propositional Logic. Argument Forms. Ioan Despi. University of New England. July 19, 2013

Natural Deduction for Propositional Logic

Solutions to Homework I (1.1)

Boolean Logic. CS 231 Dianna Xu

Propositional Logic 1

Conjunction: p q is true if both p, q are true, and false if at least one of p, q is false. The truth table for conjunction is as follows.

Discrete Mathematics and Its Applications

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

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

Logic, Sets, and Proofs

Section 1.1: Logical Form and Logical Equivalence

Steinhardt School of Culture, Education, and Human Development Department of Teaching and Learning. Mathematical Proof and Proving (MPP)

Unit 1. Propositional Logic Reading do all quick-checks Propositional Logic: Ch. 2.intro, 2.2, 2.3, 2.4. Review 2.9

Intro to Logic and Proofs

Tools for reasoning: Logic. Ch. 1: Introduction to Propositional Logic Truth values, truth tables Boolean logic: Implications:

Topics in Logic and Proofs

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

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

Logic: Propositional Logic (Part I)

Transcription:

Discrete Structures & Algorithms Propositional Logic EECE 320 // UBC 1

Review of last lecture Pancake sorting A problem with many applications Bracketing (bounding a function) Proving bounds for pancake sorting You can make money solving such problems (Bill Gates!) Illustrated many concepts that we will learn in this course Proofs Sets Counting Induction Performance of algorithms 2

Propositional logic Logic of compound statements built from simpler statements using Boolean connectives. Building block for mathematics and computing. Direct applications Design of digital circuits Expressing conditions in programs Database queries 3

I find the question, Why are we here? typically human. I d suggest Are we here? would be the more logical choice. (Leonard Nimoy) Against logic there is no armor like ignorance. (Laurence J. Peter) Logic is like the sword those who live by it shall perish by it. (Samuel Butler) 4

A sandwich is better than God Nothing is better than God. A sandwich is better than nothing. Thus, a sandwich is better than God. 5

What is propositional logic? The simplest form of mathematical logic. Develops a symbolic language to treat compound and complex propositions and their logical relationship in an abstract manner. And, before we get ahead of ourselves... what is a proposition? A declarative statement that is either true or false (but not both). 6

Examples of propositions September 6 2007 is a Thursday. September 6 2007 is a Friday. 3+2 equals 7. There is no gravity. The following are not propositions. Do your homework. What is the time? 3+4. 7

Propositions and their negations Suppose p is a proposition, then the negation of p is written as p. The negation of proposition p implies that It is not the case that p. Examples p: It is raining. p: It is not raining. p: 3+2=5. p: 3+2 5. Notice that p is a proposition too. 8

Conjunctions and disjunctions Elaborate ways of saying and and or Consider two propositions, p and q Conjunction ( and ): p q It is a bright and windy day. The day has to be both bright and windy. Disjunction ( or ): p q To ride the bus you must have a ticket or hold a pass. One of the two conditions ( have a ticket or hold a pass ) suffices. (Though both could be true.) 9

Exclusive or In day-to-day speech, sometimes we use or as an exclusive or. I will take a taxi or a bus from the airport. Only one of taxi or bus is implied. To be precise, one would need to say I will take either a taxi or a bus from the airport. Exclusive or /XOR is denoted by the symbol. 10

Truth tables Truth tables can be used to evaluate statements. A simple proposition can either be true or false. Negation p p T F F T Conjunction ( and ) p q p q F F F F T F T F F T T T Disjunction ( or ) p q p q F F F F T T T F T T T T Notice that the conjunction and disjunction of two propositions are also propositions (and, along with negation, are called compound propositions). 11

Logical equivalence Two statements are logically equivalent if and only if they have identical truth tables. The simplest example is ( p) p. 12

Implication Another important logical construct is implication, which is a conditional statement. This is akin to saying If... then... When proposition p holds then q holds. This is expressed as p q. Example: If I am on campus, I study a lot. p: I am on campus. q: I study a lot. 13

Truth table for implication p q: If p, then q. If p is true, q must be true for the implication to hold. p is the assumption/premise/antecedent. q is the conclusion/consequent. p Implication p q q F F T F T T T F F T T T 14

An equivalent for implication Is there an expression that is equivalent to p q but uses only the operators,,? Consider the proposition p q p Implication p q q F F T F T T T F F T T T p q p p q F F T T F T T T T F F F T T F T 15

Proving other equivalences Easy to use truth tables and show logical equivalences. Example: distributivity p (q r) (p q) (p r) Do this as an exercise. You would have seen these forms in earlier courses on digital logic design. 16

Logical equivalences The basic laws Identity Domination Idempotence Negation and double negation Commutation Association Distribution Absorption De Morgan s laws Propositions that are logically equivalent. You will need to know them, although we will not elaborate on them in lecture. In the text (Rosen): Chapter 1, Section 2. 17

Variations on a proposition Given a proposition p q, there are other propositions that can be stated. Example: If a function is not Of the continuous, three (contrapositive, it is not differentiable. converse, inverse), which is not like the other two? Contrapositive: q p Example: If a function is differentiable, then it is continuous. Converse: q p Hint: One is a logical equivalent of the original proposition. Example: If a function is not differentiable, then it is not continuous. Inverse: p q The contrapositive is equivalent to the original proposition. Example: If a function is continuous, then it is differentiable. 18

Tautology & Contradiction A proposition that is always true is called a tautology. Example: p p A proposition that is always false is called a contradiction. Example: p p 19

Bi-conditionals ( if and only if ) If p and q are two propositions, then p q is a bi-conditional proposition. p if and only if q. (p iff q) p is necessary and sufficient for q. If p then q, and conversely. Example: The Thunderbirds win if and only if it is raining. p q is the same as (p q) (q p). Are there other other equivalent statements? 20

Necessary and sufficient If p q, then p is a sufficient condition for q. q can be true even when p is not, therefore p is not necessary for q to be true. If p q, then p is a necessary and sufficient condition for q. q is true only when p is, and q is always true when p is. 21

For arguments sake What is an argument? It is a sequence of statements the ends with a conclusion. Not the common language usage of a debate or dispute. Structure of an argument Statement 1 (p1) Statement 2 (p2)... Statement n (pn) premises or antecedents Statement n+1 (conclusion) 22

For arguments sake Premises If you have a current password, you can log onto the computer network. You have a current password. Conclusion Therefore, you can log onto the computer network. 23

Representing an argument An argument is sometimes written as follows: premises conclusion 24

Valid arguments An argument is valid if and only if it is impossible for all the premises to be true and the conclusion to be false. How do we show that an argument is valid? We can use a truth table, or We can show that (p1 p2... pn pn+1) is a tautology using some rules of inference. 25

Why use rules of inference? Constructing a truth table is time consuming! If we have n propositions, what is the size of the truth table? 2 n, which means that the table doubles in size with every proposition. p Implication p q q F F T F T T T F F T T T Two propositions are involved in an implication, therefore the truth table has 2 2 = 4 rows. 26

Rules of inference modus ponens method of affirming 27

Rules of inference modus tollens method of denying 28

Rules of inference More rules of inference listed in the text. Try proving them as an exercise. Chapter 1, Section 5 (Rosen). generalization specialization 29

Proofs If he is Mark Spitz then he is a great swimmer. How do we prove that he is a great swimmer? If we identify him to be Mark Spitz, then this statement is true: He is Mark Spitz. Then this is true: He is a great swimmer. by modus ponens 30

Proofs and theorems A theorem is a statement that can be shown to be true. A proof is the means of doing so. 31

Pancake numbers How did we prove the bounds on Pn? n P n 2n 3 What are the propositions involved? 32

Wrap up Propositional logic Or propositional calculus Truth tables Logical equivalence Basic laws Rules of inference Arguments Premises and conclusions Proofs 33