Introduc)on. CSC 1300 Discrete Structures Villanova University. Villanova CSC Dr Papalaskari 1

Similar documents
Discrete Structures. Introduc:on. Examples of problems solved using discrete structures. What is discrete about Discrete Structures?

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

W3203 Discrete Mathema1cs. Logic and Proofs. Spring 2015 Instructor: Ilia Vovsha. hcp://

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

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

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

Chapter 4 : The Logic of Boolean Connec6ves. Not all English connec4ves are truth- func4onal

Outline. Logic. Knowledge bases. Wumpus world characteriza/on. Wumpus World PEAS descrip/on. A simple knowledge- based agent

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

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

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

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

10/13/15. Proofs: what and why. Proposi<onal Logic Proofs. 1 st Proof Method: Truth Table. A sequence of logical arguments such that:

Introduction to Sets and Logic (MATH 1190)

Discrete Mathematics

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

Math.3336: Discrete Mathematics. Propositional Equivalences

Proofs Sec*ons 1.6, 1.7 and 1.8 of Rosen

Compound Propositions

CSC Discrete Math I, Spring Propositional Logic

Discrete Mathematical Structures. Chapter 1 The Foundation: Logic

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

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

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

Definition 2. Conjunction of p and q

Course Staff. Textbook

CHAPTER 1. MATHEMATICAL LOGIC 1.1 Fundamentals of Mathematical Logic

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

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

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

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

Logic and Proof. Aiichiro Nakano

EECS 1028 M: Discrete Mathematics for Engineers

Section 1.1: Logical Form and Logical Equivalence

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

Today s Topic: Propositional Logic

Part I: Propositional Calculus

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

Sec$on Summary. Mathematical Proofs Forms of Theorems Trivial & Vacuous Proofs Direct Proofs Indirect Proofs

Discrete Structures of Computer Science Propositional Logic I

Discrete Mathematics and Applications COT3100

The Logic of Compound Statements cont.

Logical Operators. Conjunction Disjunction Negation Exclusive Or Implication Biconditional

Announcement. Homework 1

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

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

software design & management Gachon University Chulyun Kim

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

Logic. Propositional Logic: Syntax

Write the negation of each of the following propositions without using any form of the word not :

Proposi'onal Logic Not Enough

ICS141: Discrete Mathematics for Computer Science I

Introduc)on to Ar)ficial Intelligence

Announcements CompSci 102 Discrete Math for Computer Science

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

ADVICE. Since we will need to negate sentences, it is important to review seccons 7 and 11 before proceeding.

ECOM Discrete Mathematics

Propositional Logic. Spring Propositional Logic Spring / 32

Discrete Structures for Computer Science

Sec$on Summary. Tautologies, Contradictions, and Contingencies. Logical Equivalence. Normal Forms (optional, covered in exercises in text)

COMP 2600: Formal Methods for Software Engineeing

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

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

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

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

Proving logical equivalencies (1.3)

ICS141: Discrete Mathematics for Computer Science I

Topic 1: Propositional logic

PHIL12A Section answers, 28 Feb 2011

~ p is always false. Based on the basic truth table for disjunction, if q is true then p ~

15414/614 Optional Lecture 1: Propositional Logic

CS 161: Design and Analysis of Algorithms

Artificial Intelligence Knowledge Representation I

Chapter 1, Part II: Predicate Logic

Basic Logic and Proof Techniques

Introduction Propositional Logic

MAT2345 Discrete Math

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.

STRATEGIES OF PROBLEM SOLVING

CS Module 1. Ben Harsha Apr 12, 2017

Predicate Logic & Quantification

CSCI 1010 Models of Computa3on. Lecture 02 Func3ons and Circuits

DISCRETE MATH: FINAL REVIEW

Propositional Logic Not Enough

! Predicates! Variables! Quantifiers. ! Universal Quantifier! Existential Quantifier. ! Negating Quantifiers. ! De Morgan s Laws for Quantifiers

Math Fundamentals of Higher Math

DERIVATIONS AND TRUTH TABLES

Computer Science 280 Spring 2002 Homework 2 Solutions by Omar Nayeem

CSE 240 Logic and Discrete Mathematics

Logic and Truth Tables

Intro to Logic and Proofs

Section 1.2: Propositional Logic

Proposition logic and argument. CISC2100, Spring 2017 X.Zhang

Where are my glasses?

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

Unit 6 Logic Math 116

Functions. Lecture 4: Truth functions, evaluating compound statements. Arithmetic Functions. x y x+y

Review 3. Andreas Klappenecker

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

Solutions to Homework I (1.1)

Transcription:

Introduc)on CSC 1300 Discrete Structures Villanova University 1

Discrete Structures Goal: Understand how to use mathema)cs to reason about problems in Computer Sciences: sets and coun)ng func)ons and rela)ons sequences, summa)ons logic proofs, including mathema)cal induc)on recurrences combinatorics trees graphs 2

What is discrete about Discrete Structures? Also called Discrete (or inite) Mathema2cs Mathema)cs for Computer Science finite in nature: Algorithms Data structures Databases Opera)ng Systems Computer Security Digital imaging Unlike calculus which is concerned with infinite processes and the no)on of con)nuity 3

Examples of problems solved using discrete structures How many ways are there to choose a valid password? How can we prove that a list of n numbers cannot be sorted using fewer than nlog 2 n comparisons? Is there a link between two computer systems in a network? How many habitats do you need to create in a zoo so that animals don t eat each other? What is a reasonable way to determine the significance of a webpage (page rank) Prove that in a gathering with 6 people, where each pair is either friends or strangers, there is a group of 3 people who are either all mutual friends or all mutual strangers. 4

Course organiza)on Lectures will cover approximately one chapter per week Exercises of various sorts: Readiness or Warmup exercises Drill exercises Homework problems 3 exams inal 5

An old quote A priest asked: What is ate, Master? And he answered: It is that which gives a beast of burden its reason for existence. It is that which men in former )mes had to bear upon their backs. It is that which has caused na)ons to build byways from City to City upon which carts and coaches pass, and alongside which inns have come to be built to stave off Hunger, hirst and Weariness. And that is ate? said the priest. ate...i thought you said reight, responded the Master. hat's all right, said the priest. I wanted to know what reight was too. - Kehlog Albran Source unknown: his quote appeared as one of the fortunes displayed by the fortune cookie program on old unix systems ( fortune was a program that ran automa?cally every?me you logged out of the system and displayed a random, pithy saying. 6

Introduc)on to Logic Major themes Sentences or proposi)ons Logical connec)ves ruth tables Logical equivalence Open sentences autology and contradic)on Proving logical equivalence

Why Logic? Logic a science of reasoning Basis of sound reasoning - gives precise meaning to mathema)cal (or other) statements - is used to dis)nguish between valid and invalid arguments Applica)ons of logic in CS: - programming - design of hardware - verifica)on of program correctness - modeling in ar)ficial intelligence - inferences, integrity of databases

Statement (or Proposi;on) A declara2ve sentence that is either true or false Are the following statements? 1+2 = 3 today is my birthday New York is the capital of the USA 5-3 + 2 x+y > 5 Is Villanova in Pennsylvania? Don t talk Your feet are ugly his sentence is false

Compound statements and Connec;ves Compound statements are formed from simpler statements using connec?ves, also called logical operators. he connec)ves we will study are: nega?on or not operator denoted or ~ conjunc?on or and operator disjunc?on or or operator exclusive or or xor operator implica?on bicondi?onal

Nega;on (NO) If p is a statement, then It is not the case that p is also a statement, called the nega?on of p, denoted by p (or ~ p) and read not p which is true when p is false, and is false when p is true. Example: What is the nega)on of oday is Wednesday? he truth table for nega)on: p p

Conjunc;on (AND) he statement p and q, denoted by p q, is called the conjunc?on of p and q. It is true when both p and q are true, otherwise it is false. Examples: oday is Wednesday and it is raining. oday is Wednesday but it is not raining. he truth table for conjunc)on: p q p q

Disjunc;on (OR) he statement p or q, denoted by p q, is called the disjunc?on of p and q. It is false when both p and q are false, otherwise it is true. Example: oday is Sunday or a holiday. he truth table for disjunc)on: p q p q

Exclusive OR (XOR) he statement p q is called the exclusive or of p and q. It is true when exactly one of p and q is true, otherwise it is false. Example: his dish comes with soup or salad. he truth table for exclusive or: p q p q

ruth tables for more complex statements p q r r (q p)

Implica;on he implica?on or condi?onal statement p q is the statement that is false only when p is true and q is false. p is called the hypothesis and q is called the conclusion. he truth table for implica)on: p q p q Readings for p q: if p then q p only if q q is necessary for p p is sufficient for q p implies q q if p q whenever p

Examples of Implica;on Wording If John is in L.A., then he is in California. o be in California, it is sufficient for John to be in L.A. o be in LA, it is necessary for John to be in California. You will get an A if you study hard. vs. You will get an A only if you study hard.

More Examples of Implica;on wording: If you place your order by 11:59pm December 21 st, then we guarantee delivery by Christmas. Placing your order by 11:59pm December 21 st guarantees delivery by Christmas. We guarantee delivery by Christmas if you place your order by 11:59pm December 21st.

More Examples of Implica;on wording: If you place your order by 11:59pm December 21 st, then we guarantee delivery by Christmas. Placing your order by 11:59pm December 21 st guarantees delivery by Christmas. We guarantee delivery by Christmas if you place your order by 11:59pm December 21st. is this the same too? We guarantee delivery by Christmas only if you place your order by 11:59pm December 21st.

Bicondi;onal he bicondi?onal p q is the statement that is true when p and q have the same truth values, and is false otherwise. he truth table for bicondi)onal: Readings for p q: p q p q p if and only if q p is necessary and sufficient for q if p, then q, and conversely

autologies and contradic;ons tautology: A statement that is always true (no maoer what the truth values of the statements that occur in it) he truth table for a tautology has in every row. contradic?on: A statement that is always false he truth table for a contradic)on has in every row. 21

Simplest example of a tautology and contradic;on p p p p p p he fish is fresh he fish is fresh or the fish is not fresh he fish is fresh and the fish is not fresh 22

autology? p q r ( p ( p q)) q

More examples of tautologies and contradic;ons? p q p q (p q) p p q (p q) ( p q) 24

Logical equivalence We say that the statements p and q are logically equivalent (and write p q) if p and q have the same truth value for all combina)ons of truth values of their component statements. ie, p q just in case p and q have the same truth table Examples: s u s u, because: p q s u s u s u p ( p), because: p ( p) 25

De Morgan s Laws for Logic irst De Morgan s law for logic: (p q) ( p) ( q) Example: Negate: oday is Sunday or a holiday Second De Morgan s law for logic: (p q) Example: Negate: oday is Sunday and a holiday

Why logical equivalences are important he replacement of a (sub)statement with a logically equivalent statement is a powerful tool in mathema)cal reasoning. he result of such a replacement will always have the same truth value as (will be logically equivalent to) the original statement. E.g., ( p) q p q, because ( p) p. Also, using a chain of this kind of replacements can some)mes be the only way to establish that two statements are logically equivalent. or the truth table for a compound statement with 100 variables would have 2100 rows! 27

Using logical equivalences Equivalence Name Equivalence Name p p p p p p p p p p p p p p Iden)ty laws Domina)on laws Idempotent laws Double nega)on law p q q p p q q p (p q) r p (q r) (p q) r p (q r) p (q r) (p q) (p r) p (q r) (p q) (p r) (p q) p q (p q) p q Commuta)ve laws Associa)ve laws Distribu)ve laws De Morgan s laws denotes a tautology and denotes a contradic)on p p (tautology) p p (contradic)on) p q p q ( elimina)on) p q (p q) (q p) ( elimina)on) 28

Example: Applying logical equivalences to derive a new equivalence Without using truth tables, show that [p ( p q)] p q 29

Some more examples: Without using truth tables, show that : p q and q p (p q ) ( q p) p p are equivalent is a tautology is a contradic)on (p (p q ) (q r) (r s) (s w)) w is a tautology 30

Open Sentences Declara)ve sentences containing variable(s) represen)ng objects from some set D called the domain of discourse (or just the domain) ruth of Open sentence depends on value(s) of variables Nota)on: P(x) or Q(x,y,z) Also called Proposi;onal func;ons Example Let P(x) denote the statement x is even. Domain of x: Posi)ve Integers P(2) P(3)

Open Sentences More Examples: x is enrolled in CSC 1051 and CSC 1300 this semester x loves y x loves y and y loves z x is even or x is odd