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

Similar documents
Boolean Logic. CS 231 Dianna Xu

CSC Discrete Math I, Spring Propositional Logic

Definition 2. Conjunction of p and q

Compound Propositions

UNIT-I: Propositional Logic

Discrete Mathematical Structures. Chapter 1 The Foundation: Logic

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

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

EECS 1028 M: Discrete Mathematics for Engineers

Discrete Mathematics and Applications COT3100

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

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

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

2.2: Logical Equivalence: The Laws of Logic

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

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

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

LOGIC & PROPOSITIONAL EQUIVALENCE

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

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

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

Note: The area of logic that deals with propositions is called the propositional calculus or propositional logic.

Sec$on Summary. Propositions Connectives. Truth Tables. Negation Conjunction Disjunction Implication; contrapositive, inverse, converse Biconditional

13.3 Truth Tables for the Conditional and the Biconditional

Chapter 1, Section 1.1 Propositional Logic

Mathematical Logic Part One

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

Propositional Equivalence

Propositional logic ( ): Review from Mat 1348

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

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

Logic and Truth Tables

We last time we began introducing equivalency laws.

AMTH140 Lecture 8. Symbolic Logic

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

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

Propositional Logic 1

PROPOSITIONAL CALCULUS

Propositional Logic. Spring Propositional Logic Spring / 32

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

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

Section 3.1. Statements and Logical Connectives. Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Mathematical Logic Part One

CSE 20 DISCRETE MATH. Fall

Logic and Truth Tables

Math.3336: Discrete Mathematics. Applications of Propositional Logic

1 Propositional Logic

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

Propositional Calculus: Formula Simplification, Essential Laws, Normal Forms

1 The Foundations. 1.1 Logic. A proposition is a declarative sentence that is either true or false, but not both.

Propositional Languages

Introduction to Decision Sciences Lecture 2

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 =

Section 1.1: Logical Form and Logical Equivalence

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

Logic. Definition [1] A logic is a formal language that comes with rules for deducing the truth of one proposition from the truth of another.

Logical Operators. Conjunction Disjunction Negation Exclusive Or Implication Biconditional

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

Discrete Mathematics

TRUTH TABLES LOGIC (CONTINUED) Philosophical Methods

1.1 Language and Logic

1.3 Propositional Equivalences

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

Chapter 4, Logic using Propositional Calculus Handout

Equivalence and Implication

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

Numbers that are divisible by 2 are even. The above statement could also be written in other logically equivalent ways, such as:

CISC-102 Winter 2016 Lecture 17

Truth-Functional Logic

Discrete Mathematics and Its Applications

CHAPTER 1. MATHEMATICAL LOGIC 1.1 Fundamentals of Mathematical Logic

LOGIC CONNECTIVES. Students who have an ACT score of at least 30 OR a GPA of at least 3.5 can receive a college scholarship.

Today s Topic: Propositional Logic

CSE 240 Logic and Discrete Mathematics

Solutions to Homework I (1.1)

Logic and Proofs. (A brief summary)

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

Mathematical Logic Part One

The Foundations: Logic and Proofs. Part I

GEOMETRY. Chapter 2: LOGIC. Name: Teacher: Pd:

Mathematical Logic Part One

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

CSC165 Mathematical Expression and Reasoning for Computer Science

Propositional natural deduction

Packet #1: Logic & Proofs. Applied Discrete Mathematics

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.

Formal Logic. Critical Thinking

Logic and Proof. Aiichiro Nakano

ICS141: Discrete Mathematics for Computer Science I

PHI Propositional Logic Lecture 2. Truth Tables

1.1 Statements and Compound Statements

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

Math.3336: Discrete Mathematics. Propositional Equivalences

Review. Propositional Logic. Propositions atomic and compound. Operators: negation, and, or, xor, implies, biconditional.

2/18/14. What is logic? Proposi0onal Logic. Logic? Propositional Logic, Truth Tables, and Predicate Logic (Rosen, Sections 1.1, 1.2, 1.

1.1 Language and Logic

Logical Agents. Chapter 7

Propositional Logic. Propositional Equivalences. Agenda. Yutaka HATA, IEEE Fellow. Ch1.1 Propositional Logic. Ch1.2 Propositional Equivalences

DISCRETE STRUCTURES WEEK5 LECTURE1

Introduction to Sets and Logic (MATH 1190)

Transcription:

Proposition/Statement Boolean Logic CS 231 Dianna Xu A proposition is either true or false but not both he sky is blue Lisa is a Math major x == y Not propositions: Are you Bob? x := 7 1 2 Boolean variables We use Boolean variables to refer to propositions Usually denoted with lower case letters starting with p (i.e. p, q, r, s, etc.) A Boolean variable can have one of two values true () or false () A proposition can be A single variable: p A compound statement: p (q ~r) Introduction to Logical Operators About a dozen logical operators Similar to algebraic operators + * - / In the following examples, p = It is uesday q = It is 9/3 3 4 Logical operators: Not Logical operators: And Negation Not switches (negates) the truth value Symbol: ~ or the operand is! ~p = It is not uesday p ~p 5 Conjunction And is true if both operands are true Symbol: the operand is && p q = It is uesday and it is 9/3 p q p q 6 1

Logical operators: Or Logical operators: Exclusive Or Disjunction Or is true if either operands is true Symbol: the operand is p q = It is uesday or it is 9/3 (or both) p q p q 7 Exclusive Or is true if one of the operands are true, but false if both are true Symbol: Often called XOR p q (p q) ~(p q) In Java, the operand is ^ (but not in C/C++) p q p q p q = It is uesday or it is 9/3, but not both 8 Inclusive Or versus Exclusive Or Do these sentences mean inclusive or exclusive or? Experience with C++ or Java is required Lunch includes soup or salad o enter the country, you need a passport or a driver s license Publish or perish Logical Equivalence wo statements are logically equivalent if and only if they have identical truth values for all possible substitutions of statement variables p q 9 10 A conditional means if p then q or p implies q Symbol: p q = If it is uesday, then it is 9/3 p q ~p v q the antecedent the consequent Conditional p q p q ~p v q Conditional 2 Let p = I am elected and q = I will lower taxes p q = If I am elected, then I will lower taxes he statement doesn t say anything about ~p If ~p, then the conditional is true regardless of whether q is true or false p q p q 11 12 2

Conditional 3 Logical operators: Conditional 4 Conditional Inverse Converse Contrapositive p q ~p ~q p q ~p ~q q p ~q ~p he conditional and its contra-positive are equivalent So are the inverse and converse 13 Alternate ways of stating a conditional: p implies q If p, q p is sufficient for q q if p q whenever p q is necessary for p (if ~q then ~p) p only if q 14 Bi-conditional Bi-conditional A bi-conditional means p if and only if q Symbol: Alternatively, it means (if p then q) and (if q then p) p q p q q p Note that a bi-conditional has the opposite truth values of the exclusive or p q p q 15 Let p = You get a grade and q = You take this class hen p q means You get a grade if and only if you take this class p q p q Alternatively, it means If you get a grade, then you took (take) this class and if you take (took) this class then you get a grade 16 Boolean operators summary not not and or xor conditional biconditional p q ~p ~q p q p q p q p q p q Precedence of operators Precedence order (from highest to lowest): ~ he first three are the most important Not is always performed before any other operation Learn what they mean, don t just memorize the table! 17 18 3

ranslating English Sentences Problem: p = It is below freezing q = It is snowing It is below freezing and it is snowing It is below freezing but not snowing It is not below freezing and it is not snowing It is either snowing or below freezing (or both) If it is below freezing, it is also snowing It is either below freezing or it is snowing, but it is not snowing if it is below freezing hat it is below freezing is necessary and sufficient for it to be snowing p q p ~q ~p ~q p q p q (p q) (p ~q) p q 19 autology and Contradiction A tautology t is a statement that is always true p ~p will always be true (Negation Law) A contradiction c is a statement that is always false p ~p will always be false (Negation Law) p p ~p p ~p 20 DeMorgan s Law Probably the most important logical equivalence o negate p q (or p q), you flip the sign, and negate BOH p and q hus, ~(p q) ~p ~q hus, ~(p q) ~p ~q p q ~p ~q p q ~(p q) ~p ~q p q ~(p q) ~p ~q 21 Logical Equivalences Communicative p q q p p q q p Associative (p q) r p (q r) (p q) r p (q r) Distributive p (q r) (p q) (p r) p (q r) (p q) (p r) Identity p t p p c p Negation p ~p t p ~p c Double Negative ~(~p) p Idempotent p p p p p p Universal bound p c c p t t De Morgan s ~(p q) ~p ~q ~(p q) ~p ~q Absorption p (p q) p p (p q) p Negation of t and c ~t c ~c t 22 How to prove two propositions are equivalent? wo methods: Using truth tables Not good for long formulae Should not be your first method to prove logical equivalence! Using the logical equivalences and laws he preferred method Example: show that: r 23 Using ruth ables r p q r p r q r (p r) (q r) p q (p q) r 24 4

Using Logical Equivalences Using Logical Equivalences r Original statement (~ p r) (~ q r) ~ (p q) r p q ~ p q Definition of implication (~ p r) (~ DeMorgan s q r) Law (~ ~ p (p q) ~ q) r ~ p ~ q ~ Associativity p r ~ q r of Or ~ (~ p p r) (~ ~ q r q r) ~ p r ~ q r ~ p ~ Re-arranging q r r ~ p ~ q r r Original statement (~ p r) (~ q r) ~ (p q) r Definition of implication (~ p r) (~ q r) (~ p ~ q) r DeMorgan s Law ~ p r ~ q r ~ p ~ q r Associativity of Or ~ p ~ q r r ~ p ~ q r Re-arranging Idempotent ~ p ~ q r Law ~ r p r ~ q r r ~ p ~ q r ~ p ~ q r Idempotent Law 25 26 5