1 10/13/2015 MATH 224 – Discrete Mathematics Why Study Discrete Math  Determination of the efficiency of algorithms, e.g., insertion sort versus selection.

Slides:



Advertisements
Similar presentations
Introduction to Proofs
Advertisements

CSE 311: Foundations of Computing Fall 2013 Lecture 3: Logic and Boolean algebra.
CS344: Introduction to Artificial Intelligence (associated lab: CS386) Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture–5 and 6: Propositional Calculus.
Copyright © Cengage Learning. All rights reserved.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
ISBN Chapter 3 Describing Syntax and Semantics.
Discrete Mathematics Math 6A Instructor: M. Welling.
Describing Syntax and Semantics
Proof by Deduction. Deductions and Formal Proofs A deduction is a sequence of logic statements, each of which is known or assumed to be true A formal.
EE1J2 – Discrete Maths Lecture 5 Analysis of arguments (continued) More example proofs Formalisation of arguments in natural language Proof by contradiction.
Propositional Calculus Math Foundations of Computer Science.
Mathematical Induction Assume that we are given an infinite supply of stamps of two different denominations, 3 cents and and 5 cents. Prove using mathematical.
Adapted from Discrete Math
What it is? Why is it a legitimate proof method? How to use it?
Methods of Proof & Proof Strategies
Intro to Discrete Structures
MATH 224 – Discrete Mathematics
MATH 224 – Discrete Mathematics
Discrete Mathematics and Its Applications
Systems Architecture I1 Propositional Calculus Objective: To provide students with the concepts and techniques from propositional calculus so that they.
CISC 2315 Discrete Structures Professor William G. Tanner, Jr. Fall 2010 Slides created by James L. Hein, author of Discrete Structures, Logic, and Computability,
Copyright © Curt Hill Using Propositional Logic Several applications.
Introduction to Proofs
MATH 224 – Discrete Mathematics
Copyright © Cengage Learning. All rights reserved. CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF ELEMENTARY NUMBER THEORY AND METHODS OF PROOF.
Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW.
Dr. Naveed Riaz Design and Analysis of Algorithms 1 1 Formal Methods in Software Engineering Lecture # 24.
Review I Rosen , 3.1 Know your definitions!
1 Inference Rules and Proofs (Z); Program Specification and Verification Inference Rules and Proofs (Z); Program Specification and Verification.
March 3, 2015Applied Discrete Mathematics Week 5: Mathematical Reasoning 1Arguments Just like a rule of inference, an argument consists of one or more.
10/17/2015 Prepared by Dr.Saad Alabbad1 CS100 : Discrete Structures Proof Techniques(1) Dr.Saad Alabbad Department of Computer Science
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
CISC 2315 Discrete Structures Professor William G. Tanner, Jr. Spring 2011 Slides created by James L. Hein, author of Discrete Structures, Logic, and Computability,
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
MATH 224 – Discrete Mathematics
Lecture Propositional Equivalences. Compound Propositions Compound propositions are made by combining existing propositions using logical operators.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
September1999 CMSC 203 / 0201 Fall 2002 Week #1 – 28/30 August 2002 Prof. Marie desJardins.
CompSci 102 Discrete Math for Computer Science
Propositional Logic ITCS 2175 (Rosen Section 1.1, 1.2)
Mathematical Preliminaries
Chapter 1: The Foundations: Logic and Proofs
Logic UNIT 1.
Dr. Naveed Riaz Design and Analysis of Algorithms 1 1 Formal Methods in Software Engineering Lecture # 25.
CS104:Discrete Structures Chapter 2: Proof Techniques.
1 2/21/2016 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence.
Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and Quantifiers.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
Chapter 15 Running Time Analysis. Topics Orders of Magnitude and Big-Oh Notation Running Time Analysis of Algorithms –Counting Statements –Evaluating.
Notions & Notations - 1ICOM 4075 (Fall 2010) UPRM Department of Electrical and Computer Engineering University of Puerto Rico at Mayagüez Fall 2010 ICOM.
Section 1.7. Section Summary Mathematical Proofs Forms of Theorems Direct Proofs Indirect Proofs Proof of the Contrapositive Proof by Contradiction.
Mathematical Induction What it is? Why is it a legitimate proof method? How to use it?
Module Code MA0003NI: Computing mathematics Lecture for Week Autumn.
Chapter 1 Logic and proofs
Chapter 1 Logic and Proof.
MATH 224 – Discrete Mathematics
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
DISCRETE MATHEMATICS CHAPTER I.
Niu Kun Discrete Mathematics Chapter 1 The Foundations: Logic and Proof, Sets, and Functions Niu Kun 离散数学.
Propositional Calculus: Boolean Algebra and Simplification
Information Technology Department
CHAPTER 1: LOGICS AND PROOF
CS 220: Discrete Structures and their Applications
Foundations of Discrete Mathematics
1.3 Propositional Equivalences
Discrete Structures Prepositional Logic 2
Presentation transcript:

1 10/13/2015 MATH 224 – Discrete Mathematics Why Study Discrete Math  Determination of the efficiency of algorithms, e.g., insertion sort versus selection sort. Can you provide an example?  Boolean expressions for controlling loops and conditional statements are based on the propositional calculus and Boolean algebra. What is an example in C++?  The building blocks of computers – logic gates implement Boolean expressions.  Design of programs and algorithms is similar to developing mathematical proofs.  Conversion of high level languages to machine code makes use of formal language theory. Name some high level languages. What is machine code?  Induction and recursion are the basis for algorithms and programs that use repeated instructions, e.g., for statements, while statements and recursive functions.

2 10/13/2015 MATH 224 – Discrete Mathematics Why Study Discrete Math Continued  Security including encryption and authentication make use of math concepts. Can you give an example of where encryption is used? What is authentication?  Many data structures make use of trees, e.g., heaps, binary search trees, databases.  The theory behind caching and paging uses mathematics. Do you know what these are?  Graph theory is used in communication networks, artificial intelligence, computer games, computer animation among others.  And much much more.  Perquisite for CS 340 − Required for ABET accreditation

3 10/13/2015 MATH 224 – Discrete Mathematics Propositions  X <= Y  Z > 10 && Z <= 20  !(Z 20)  Flag-- where Flag is a Boolean variable  !Flag || X % 2 == 0 -- When is X % 2 == 0 ? Propositions correspond to Boolean expressions in C++. They are statements, sometimes represented by variables, that may be either true or false. Examples of proposition like expressions (actually conditional statements) in C++ include:

4 10/13/2015 MATH 224 – Discrete Mathematics Common Logical (connectives) Operators Note that the conditional is not quite the same as the if statement in C++. In programming languages the condition is not a proposition but a statement about what code should be executed based on whether or not a Boolean expression is either true or false. Can you give an example of a conditional statement in C++? How can the other operators (→, ↔ and + ) be expressed in C++?

5 10/13/2015 MATH 224 – Discrete Mathematics The Meaning of Logical Operators Using Truth Tables These are called compound propositions or propositional clauses. Can you create a similar table with one or both of P replaced by ¬P and Q replaced by ¬Q? Bitwise operators are among the others use & (and) | (or) and ^ (xor) in C++. These are not the same as the logical operators. Read the text on this topic (pages 15 and 16) and be prepared to answer questions.

6 10/13/2015 MATH 224 – Discrete Mathematics Using Truth Tables. More complex clauses may be created using multiple truth connectives. In the truth table below the third and fourth columns show the truth values for two clauses with a single operator and then the result when these two clauses are combined with a third operator. What would the truth values be if the left and right side of the conditional were to be reversed?

7 10/13/2015 MATH 224 – Discrete Mathematics Contrapositive. On page 8 of our textbook there is a discussion of the terms converse, contrapositive and inverse. The contrapositive is the one most commonly used in proofs since it has the same truth value as the original proposition. The contrapositive of p → q is ¬q → ¬p. For example consider : If x = 2 then the √x is irrational (equivalent to p → q). The contrapositive would be : if the √x is rational then x ≠ 2 (¬q → ¬p) Assume that √x = a/b a rational number in reduced form. Then since a 2 /b 2 = x, x ≠ 2. Note that a and b have no common factors unless b = 1. Thus the original proposition is true. Why is b ≠ 1? Can you prove for all integers x that the √x is either an integer or irrational?

8 10/13/2015 MATH 224 – Discrete Mathematics Reasoning that is Incorrect Both the general theory of relativity and string theory can be used to explain gravity. Physicist A shows that general relativity is incorrect. Based on this result, physicist B concludes that string theory must be correct. What is wrong with B’s conclusion. One controversial topic involves intelligent design versus evolution. Is a proof that evolution is false sufficient to prove that intelligent design is true? Is a proof that evolution is true sufficient to prove that intelligent design is false? Another controversy involves climate change. What is wrong with the following? The sun is the most important factor in determining the global climate. Therefore, the burning of fossil fuels does not cause global climate change. A mother tells her son that if he makes his bed he can have some ice cream after dinner. After dinner Billy’s mother gives him some ice cream. Can you conclude that Billy made his bed?

9 10/13/2015 MATH 224 – Discrete Mathematics Logic Puzzles Example 18 (pages 13-14): Knights are always truthful and knaves always lie. A says B is a Knight and B says we are different. If A is a knight then B must also be a knight. But that leads to a contraction since they must be different. If A is a knave then B must be a knave since knaves lie. B says they are different which would be a lie if B is a knave. Thus the two statements are consistent. Both A and B are knaves. Problem 43 (page 19): Given statements 1 through 100, “Exactly n statements are false.” Which statement must be true? If instead we have, “at least n statements are false.” Which statements are true? What would be the case if there are 99 statements instead of 100? Note that it is possible to have a statement that either contradicts itself or a group of statements that are contradictory. This is called a paradox.

10 10/13/2015 MATH 224 – Discrete Mathematics More Logic Puzzles Problem 46 (pages 20): Each member of a group of cannibals either lies or does not lie. An explorer must determine if a given cannibal tells the truth or not. Why does asking him if he is a liar not help? What yes or no question should the explorer ask? How would you go about analyzing this type of problem? One of the tricks that often works is the use of a double negative, i.e., the negation of a negation.

11 10/13/2015 MATH 224 – Discrete Mathematics More Logic Puzzles Dr. Who was a British television program from the 1960s and 70s. He was an explorer who used an old telephone booth as his spaceship. In one episode he had to choose between two doors. One door led to freedom and the other to his certain death. There were two robots in the room. One always lied and one always told the truth. What single yes or no question should Dr. Who ask of one of the robots in order to determine which door to take?

12 10/13/2015 MATH 224 – Discrete Mathematics More Logic Puzzles Evaluating a While Statement A jar contains both white and black beans. You take two beans from the jar. If both of them are black you return one black bean to the jar. If one is black and one is white you return the white bean. If both are white you take both of them and add a black bean to the jar. You repeat this step until you are tired or until the jar has only one bean in it. Will this process ever stop? How many beans will be left at the end? Can you say anything about the original number of black and white beans based on the beans that are left? These properties are called preconditions. Are there any invariant properties?

13 10/13/2015 MATH 224 – Discrete Mathematics Semi-formal Proofs By using propositional clauses that have already been shown to be true it is possible to derive equivalent propositions or to prove that a proposition is a tautology (always true). Below is an example of a rather trivial derivation.

14 10/13/2015 MATH 224 – Discrete Mathematics Semi-formal Proofs Here is a more complex derivation. Using p ↔ q ≡ (p → q) ^ (q → p) show that p ↔ q ≡ (p ^ q) v (¬p ^ ¬q) p ↔ q≡ (p → q) ^ (q → p)Given ≡(¬p V q) ^ (¬q V p)Table 7, Page 25 ≡(¬p ^ ¬q)v(¬p ^ p)v(¬q ^ q)v(q ^ p) distributive laws Table 6, Page 24 ≡ (¬p ^ ¬q) v F v F v (q ^ p)negation law, Table 6 ≡ (p ^ q) v (¬q ^ ¬p)identity law, Table 6 ≡ (p ^ q) v (¬p ^ ¬q)commutative law, Table 6 Is (p ↔ q) ↔ [(p ^ q) v (¬p ^ ¬q)] a tautology? Explain your answer.