DISCRETE COMPUTATIONAL STRUCTURES CSE 2353 Fall 2005.

Slides:



Advertisements
Similar presentations
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Advertisements

© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 1: (Part 2): The Foundations: Logic and Proofs.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Discrete Mathematics CSE 2353 Fall 2007
Discrete Mathematics Lecture 1 Logic of Compound Statements Harper Langston New York University.
Discrete Mathematics Lecture 4 Harper Langston New York University.
Sets 1.
Sets 1.
Adapted from Discrete Math
Harper Langston New York University Summer 2015
Set theory Sets: Powerful tool in computer science to solve real world problems. A set is a collection of distinct objects called elements. Traditionally,
1.1 Sets and Logic Set – a collection of objects. Set brackets {} are used to enclose the elements of a set. Example: {1, 2, 5, 9} Elements – objects inside.
Mathematical Structures A collection of objects with operations defined on them and the accompanying properties form a mathematical structure or system.
Discrete Mathematics, Part II CSE 2353 Fall 2007 Margaret H. Dunham Department of Computer Science and Engineering Southern Methodist University Some slides.
MATH 224 – Discrete Mathematics
10/17/2015 Prepared by Dr.Saad Alabbad1 CS100 : Discrete Structures Proof Techniques(1) Dr.Saad Alabbad Department of Computer Science
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
Mathematical Preliminaries (Hein 1.1 and 1.2) Sets are collections in which order of elements and duplication of elements do not matter. – {1,a,1,1} =
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
CS 103 Discrete Structures Lecture 10 Basic Structures: Sets (1)
2.3Logical Implication: Rules of Inference From the notion of a valid argument, we begin a formal study of what we shall mean by an argument and when such.
DISCRETE COMPUTATIONAL STRUCTURES CSE 2353 Fall 2011 Most slides modified from Discrete Mathematical Structures: Theory and Applications.
Barnett/Ziegler/Byleen Finite Mathematics 11e1 Chapter 7 Review Important Terms, Symbols, Concepts 7.1. Logic A proposition is a statement (not a question.
DISCRETE COMPUTATIONAL STRUCTURES
CS201: Data Structures and Discrete Mathematics I
Chapter 2: Basic Structures: Sets, Functions, Sequences, and Sums (1)
Hazırlayan DISCRETE COMPUTATIONAL STRUCTURES Propositional Logic PROF. DR. YUSUF OYSAL.
CompSci 102 Discrete Math for Computer Science
Copyright © Cengage Learning. All rights reserved.
Section 2.1. Section Summary Definition of sets Describing Sets Roster Method Set-Builder Notation Some Important Sets in Mathematics Empty Set and Universal.
1 Introduction to Abstract Mathematics Sets Section 2.1 Basic Notions of Sets Section 2.2 Operations with sets Section 2.3 Indexed Sets Instructor: Hayk.
ELEMENTARY SET THEORY.
Chapter SETS DEFINITION OF SET METHODS FOR SPECIFYING SET SUBSETS VENN DIAGRAM SET IDENTITIES SET OPERATIONS.
Mathematical Preliminaries
Chapter 2 Logic 2.1 Statements 2.2 The Negation of a Statement 2.3 The Disjunction and Conjunction of Statements 2.4 The Implication 2.5 More on Implications.
DISCRETE COMPUTATIONAL STRUCTURES CSE 2353 Fall 2010 Most slides modified from Discrete Mathematical Structures: Theory and Applications by D.S. Malik.
Chapter 2 With Question/Answer Animations. Section 2.1.
(CSC 102) Lecture 13 Discrete Structures. Previous Lectures Summary  Direct Proof  Indirect Proof  Proof by Contradiction  Proof by Contra positive.
Sets Definition: A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We write a.
Copyright © Cengage Learning. All rights reserved. Fundamental Concepts of Algebra 1.1 Real Numbers.
DISCRETE COMPUTATIONAL STRUCTURES CSE 2353 Material for Second Test Spring 2006.
CS104:Discrete Structures Chapter 2: Proof Techniques.
CSE 311: Foundations of Computing Fall 2013 Lecture 8: Proofs and Set theory.
Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
Discrete Mathematics IT223 Sem. 2, SY
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
Chapter 2 1. Chapter Summary Sets (This Slide) The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions.
DISCRETE COMPUTATIONAL STRUCTURES CSE 2353 Fall 2011 Most slides modified from Discrete Mathematical Structures: Theory and Applications.
DISCRETE COMPUTATIONAL STRUCTURES CSE 2353 Spring 2009 Most slides modified from Discrete Mathematical Structures: Theory and Applications.
Introduction to Set Theory (§1.6) A set is a new type of structure, representing an unordered collection (group, plurality) of zero or more distinct (different)
Chapter 1 Logic and proofs
DISCRETE COMPUTATIONAL STRUCTURES CSE 2353 Fall 2010 Most slides modified from Discrete Mathematical Structures: Theory and Applications by D.S. Malik.
CPCS 222 Discrete Structures I
Discrete Mathematics Margaret H. Dunham
Foundations: Sets, Logic, and Algorithms
Chapter 2 Sets and Functions.
Chapter 1: Foundations: Sets, Logic, and Algorithms
CHAPTER 3 SETS, BOOLEAN ALGEBRA & LOGIC CIRCUITS
Chapter 2: Integers and Mathematical Induction
Chapter 1 Logic and Proofs Homework 2 Given the statement “A valid password is necessary for you to log on to the campus server.” Express the statement.
DISCRETE COMPUTATIONAL STRUCTURES
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 2 Sets Slides are adopted from “Discrete.
DISCRETE COMPUTATIONAL STRUCTURES
CS100: Discrete structures
CHAPTER 1: LOGICS AND PROOF
CS201: Data Structures and Discrete Mathematics I
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
CS201: Data Structures and Discrete Mathematics I
Presentation transcript:

DISCRETE COMPUTATIONAL STRUCTURES CSE 2353 Fall 2005

CSE 2353 OUTLINE 1.Sets 2.Logic 3.Proof Techniques 4.Integers and Induction 5.Relations and Posets 6.Functions 7.Counting Principles 8.Boolean Algebra

CSE 2353 OUTLINE 1.Sets 2.Logic 3.Proof Techniques 4.Integers and Induction 5.Relations and Posets 6.Functions 7.Counting Principles 8.Boolean Algebra

Discrete Mathematical Structures: Theory and Applications 4 Sets: Learning Objectives  Learn about sets  Explore various operations on sets  Become familiar with Venn diagrams  CS:  Learn how to represent sets in computer memory  Learn how to implement set operations in programs

Discrete Mathematical Structures: Theory and Applications 5 Sets  Definition: Well-defined collection of distinct objects  Members or Elements: part of the collection  Roster Method: Description of a set by listing the elements, enclosed with braces  Examples:  Vowels = {a,e,i,o,u}  Primary colors = {red, blue, yellow}  Membership examples  “a belongs to the set of Vowels” is written as: a  Vowels  “j does not belong to the set of Vowels: j  Vowels

Discrete Mathematical Structures: Theory and Applications 6 Sets  Set-builder method  A = { x | x  S, P(x) } or A = { x  S | P(x) }  A is the set of all elements x of S, such that x satisfies the property P  Example:  If X = {2,4,6,8,10}, then in set-builder notation, X can be described as X = {n  Z | n is even and 2  n  10}

Discrete Mathematical Structures: Theory and Applications 7 Sets  Standard Symbols which denote sets of numbers  N : The set of all natural numbers (i.e.,all positive integers)  Z : The set of all integers  Z + : The set of all positive integers  Z* : The set of all nonzero integers  E : The set of all even integers  Q : The set of all rational numbers  Q* : The set of all nonzero rational numbers  Q + : The set of all positive rational numbers  R : The set of all real numbers  R* : The set of all nonzero real numbers  R + : The set of all positive real numbers  C : The set of all complex numbers  C* : The set of all nonzero complex numbers

Discrete Mathematical Structures: Theory and Applications 8 Sets  Subsets  “X is a subset of Y” is written as X  Y  “X is not a subset of Y” is written as X Y  Example:  X = {a,e,i,o,u}, Y = {a, i, u} and z = {b,c,d,f,g}  Y  X, since every element of Y is an element of X  Y Z, since a  Y, but a  Z

Discrete Mathematical Structures: Theory and Applications 9 Sets  Superset  X and Y are sets. If X  Y, then “X is contained in Y” or “Y contains X” or Y is a superset of X, written Y  X  Proper Subset  X and Y are sets. X is a proper subset of Y if X  Y and there exists at least one element in Y that is not in X. This is written X  Y.  Example:  X = {a,e,i,o,u}, Y = {a,e,i,o,u,y}  X  Y, since y  Y, but y  X

Discrete Mathematical Structures: Theory and Applications 10 Sets  Set Equality  X and Y are sets. They are said to be equal if every element of X is an element of Y and every element of Y is an element of X, i.e. X  Y and Y  X  Examples:  {1,2,3} = {2,3,1}  X = {red, blue, yellow} and Y = {c | c is a primary color} Therefore, X=Y  Empty (Null) Set  A Set is Empty (Null) if it contains no elements.  The Empty Set is written as   The Empty Set is a subset of every set

Discrete Mathematical Structures: Theory and Applications 11 Sets  Finite and Infinite Sets  X is a set. If there exists a nonnegative integer n such that X has n elements, then X is called a finite set with n elements.  If a set is not finite, then it is an infinite set.  Examples:  Y = {1,2,3} is a finite set  P = {red, blue, yellow} is a finite set  E, the set of all even integers, is an infinite set  , the Empty Set, is a finite set with 0 elements

Discrete Mathematical Structures: Theory and Applications 12 Sets  Cardinality of Sets  Let S be a finite set with n distinct elements, where n ≥ 0. Then |S| = n, where the cardinality (number of elements) of S is n  Example:  If P = {red, blue, yellow}, then |P| = 3  Singleton  A set with only one element is a singleton  Example:  H = { 4 }, |H| = 1, H is a singleton

Discrete Mathematical Structures: Theory and Applications 13 Sets  Power Set  For any set X,the power set of X,written P(X),is the set of all subsets of X  Example:  If X = {red, blue, yellow}, then P(X) = { , {red}, {blue}, {yellow}, {red,blue}, {red, yellow}, {blue, yellow}, {red, blue, yellow} }  Universal Set  An arbitrarily chosen, but fixed set

Discrete Mathematical Structures: Theory and Applications 14 Sets  Venn Diagrams  Abstract visualization of a Universal set, U as a rectangle, with all subsets of U shown as circles.  Shaded portion represents the corresponding set  Example:  In Figure 1, Set X, shaded, is a subset of the Universal set, U

Discrete Mathematical Structures: Theory and Applications 15 Sets  Union of Sets Example: If X = {1,2,3,4,5} and Y = {5,6,7,8,9}, then X ∪ Y = {1,2,3,4,5,6,7,8,9}

Discrete Mathematical Structures: Theory and Applications 16 Sets  Intersection of Sets Example: If X = {1,2,3,4,5} and Y = {5,6,7,8,9}, then X ∩ Y = {5}

Discrete Mathematical Structures: Theory and Applications 17 Sets  Disjoint Sets Example: If X = {1,2,3,4,} and Y = {6,7,8,9}, then X ∩ Y = 

Discrete Mathematical Structures: Theory and Applications 18 Sets

Discrete Mathematical Structures: Theory and Applications 19 Sets

Discrete Mathematical Structures: Theory and Applications 20 Sets  The union and intersection of three,four,or even infinitely many sets can be considered  For a finite collection of n sets, X 1, X 2, … X n where n ≥ 2 :

Discrete Mathematical Structures: Theory and Applications 21 Sets  Index Set

Discrete Mathematical Structures: Theory and Applications 22 Sets  Example:  If A = {a,b,c}, B = {x, y, z} and C = {1,2,3} then A ∩ B =  and B ∩ C =  and A ∩ C = . Therefore, A,B,C are pairwise disjoint

Discrete Mathematical Structures: Theory and Applications 23 Sets  Difference Example: If X = {a,b,c,d} and Y = {c,d,e,f}, then X – Y = {a,b} and Y – X = {e,f}

Discrete Mathematical Structures: Theory and Applications 24 Sets  Complement Example: If U = {a,b,c,d,e,f} and X = {c,d,e,f}, then X’ = {a,b}

Discrete Mathematical Structures: Theory and Applications 25 Sets

Discrete Mathematical Structures: Theory and Applications 26 Sets

Discrete Mathematical Structures: Theory and Applications 27 Sets

Discrete Mathematical Structures: Theory and Applications 28 Sets  Ordered Pair  X and Y are sets. If x  X and y  Y, then an ordered pair is written (x,y)  Order of elements is important. (x,y) is not necessarily equal to (y,x)  Cartesian Product  The Cartesian product of two sets X and Y,written X × Y,is the set  X × Y ={(x,y)|x ∈ X, y ∈ Y}  For any set X, X ×  =  =  × X  Example:  X = {a,b}, Y = {c,d}  X × Y = {(a,c), (a,d), (b,c), (b,d)}  Y × X = {(c,a), (d,a), (c,b), (d,b)}

Discrete Mathematical Structures: Theory and Applications 29 Computer Representation of Sets  A Set may be stored in a computer in an array as an unordered list  Problem: Difficult to perform operations on the set.  Linked List  Solution: use Bit Strings (Bit Map)  A Bit String is a sequence of 0s and 1s  Length of a Bit String is the number of digits in the string  Elements appear in order in the bit string  A 0 indicates an element is absent, a 1 indicates that the element is present  A set may be implemented as a file

Discrete Mathematical Structures: Theory and Applications 30 Computer Implementation of Set Operations  Bit Map  File  Operations  Intersection  Union  Element of  Difference  Complement  Power Set

Discrete Mathematical Structures: Theory and Applications 31 Special “Sets” in CS  Multiset  Ordered Set

CSE 2353 OUTLINE 1.Sets 2.Logic 3.Proof Techniques 4.Relations and Posets 5.Functions 6.Counting Principles 7.Boolean Algebra

Discrete Mathematical Structures: Theory and Applications 33 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical connectives to combine statements  Explore how to draw conclusions using various argument forms  Become familiar with quantifiers and predicates  CS  Boolean data type  If statement  Impact of negations  Implementation of quantifiers

Discrete Mathematical Structures: Theory and Applications 34 Mathematical Logic  Definition: Methods of reasoning, provides rules and techniques to determine whether an argument is valid  Theorem: a statement that can be shown to be true (under certain conditions)  Example: If x is an even integer, then x + 1 is an odd integer  This statement is true under the condition that x is an integer is true

Discrete Mathematical Structures: Theory and Applications 35 Mathematical Logic  A statement, or a proposition, is a declarative sentence that is either true or false, but not both  Lowercase letters denote propositions  Examples:  p: 2 is an even number (true)  q: 3 is an odd number (true)  r: A is a consonant (false)  The following are not propositions:  p: My cat is beautiful  q: Are you in charge?

Discrete Mathematical Structures: Theory and Applications 36 Mathematical Logic  Truth value  One of the values “truth” or “falsity” assigned to a statement  True is abbreviated to T or 1  False is abbreviated to F or 0  Negation  The negation of p, written ∼ p, is the statement obtained by negating statement p  Truth values of p and ∼ p are opposite  Symbol ~ is called “not” ~p is read as as “not p”  Example:  p: A is a consonant  ~p: it is the case that A is not a consonant  q: Are you in charge?

Discrete Mathematical Structures: Theory and Applications 37 Mathematical Logic  Truth Table  Conjunction  Let p and q be statements.The conjunction of p and q, written p ^ q, is the statement formed by joining statements p and q using the word “and”  The statement p ∧ q is true if both p and q are true; otherwise p ∧ q is false

Discrete Mathematical Structures: Theory and Applications 38 Mathematical Logic  Conjunction  Truth Table for Conjunction:

Discrete Mathematical Structures: Theory and Applications 39 Mathematical Logic  Disjunction  Let p and q be statements. The disjunction of p and q, written p v q, is the statement formed by joining statements p and q using the word “or”  The statement p v q is true if at least one of the statements p and q is true; otherwise p v q is false  The symbol v is read “or”

Discrete Mathematical Structures: Theory and Applications 40 Mathematical Logic  Disjunction  Truth Table for Disjunction:

Discrete Mathematical Structures: Theory and Applications 41 Mathematical Logic  Implication  Let p and q be statements.The statement “if p then q” is called an implication or condition.  The implication “if p then q” is written p  q  p  q is read:  “If p, then q”  “p is sufficient for q”  q if p  q whenever p

Discrete Mathematical Structures: Theory and Applications 42 Mathematical Logic  Implication  Truth Table for Implication:  p is called the hypothesis, q is called the conclusion

Discrete Mathematical Structures: Theory and Applications 43 Mathematical Logic  Implication  Let p: Today is Sunday and q: I will wash the car. The conjunction p  q is the statement:  p  q : If today is Sunday, then I will wash the car  The converse of this implication is written q  p  If I wash the car, then today is Sunday  The inverse of this implication is ~p  ~q  If today is not Sunday, then I will not wash the car  The contrapositive of this implication is ~q  ~p  If I do not wash the car, then today is not Sunday

Discrete Mathematical Structures: Theory and Applications 44 Mathematical Logic  Biimplication  Let p and q be statements. The statement “p if and only if q” is called the biimplication or biconditional of p and q  The biconditional “p if and only if q” is written p  q  p  q is read:  “p if and only if q”  “p is necessary and sufficient for q”  “q if and only if p”  “q when and only when p”

Discrete Mathematical Structures: Theory and Applications 45 Mathematical Logic  Biconditional  Truth Table for the Biconditional:

Discrete Mathematical Structures: Theory and Applications 46 Mathematical Logic  Statement Formulas  Definitions  Symbols p,q,r,...,called statement variables  Symbols ~, ^, v, →,and ↔ are called logical connectives 1)A statement variable is a statement formula 2)If A and B are statement formulas, then the expressions (~A ), (A ^ B), (A v B ), (A → B ) and (A ↔ B ) are statement formulas  Expressions are statement formulas that are constructed only by using 1) and 2) above

Discrete Mathematical Structures: Theory and Applications 47 Mathematical Logic  Precedence of logical connectives is:  ~ highest  ^ second highest  v third highest  → fourth highest  ↔ fifth highest

Discrete Mathematical Structures: Theory and Applications 48 Mathematical Logic  Example:  Let A be the statement formula (~(p v q )) → (q ^ p )  Truth Table for A is:

Discrete Mathematical Structures: Theory and Applications 49 Mathematical Logic  Tautology  A statement formula A is said to be a tautology if the truth value of A is T for any assignment of the truth values T and F to the statement variables occurring in A  Contradiction  A statement formula A is said to be a contradiction if the truth value of A is F for any assignment of the truth values T and F to the statement variables occurring in A

Discrete Mathematical Structures: Theory and Applications 50 Mathematical Logic  Logically Implies  A statement formula A is said to logically imply a statement formula B if the statement formula A → B is a tautology. If A logically implies B, then symbolically we write A → B  Logically Equivalent  A statement formula A is said to be logically equivalent to a statement formula B if the statement formula A ↔ B is a tautology. If A is logically equivalent to B, then symbolically we write A ≡ B

Discrete Mathematical Structures: Theory and Applications 51 Mathematical Logic

Discrete Mathematical Structures: Theory and Applications 52 Mathematical Logic  Proof of (~p ^ q ) → (~(q →p ))

Discrete Mathematical Structures: Theory and Applications 53 Mathematical Logic  Proof of (~p ^ q ) → (~(q →p )) [continued]

Discrete Mathematical Structures: Theory and Applications 54 Validity of Arguments  Proof: an argument or a proof of a theorem consists of a finite sequence of statements ending in a conclusion  Argument: a finite sequence of statements.  The final statement,, is the conclusion, and the statements are the premises of the argument.  An argument is logically valid if the statement formula is a tautology.

Discrete Mathematical Structures: Theory and Applications 55 Validity of Arguments  Valid Argument Forms  Modus Ponens (Method of Affirming)  Modus Tollens (Method of Denying)

Discrete Mathematical Structures: Theory and Applications 56 Validity of Arguments  Valid Argument Forms  Disjunctive Syllogisms

Discrete Mathematical Structures: Theory and Applications 57 Validity of Arguments  Valid Argument Forms  Hypothetical Syllogism  Dilemma

Discrete Mathematical Structures: Theory and Applications 58 Validity of Arguments  Valid Argument Forms  Conjunctive Simplification

Discrete Mathematical Structures: Theory and Applications 59 Validity of Arguments  Valid Argument Forms  Disjunctive Addition

Discrete Mathematical Structures: Theory and Applications 60 Validity of Arguments  Valid Argument Forms  Conjunctive Addition

Discrete Mathematical Structures: Theory and Applications 61 Quantifiers and First Order Logic  Predicate or Propositional Function  Let x be a variable and D be a set; P(x) is a sentence  Then P(x) is called a predicate or propositional function with respect to the set D if for each value of x in D, P(x) is a statement; i.e., P(x) is true or false  Moreover, D is called the domain of the discourse and x is called the free variable

Discrete Mathematical Structures: Theory and Applications 62 Quantifiers and First Order Logic  Predicate or Propositional Function  Example:  Q(x,y) : x > y, where the Domain is the set of integers  Q is a 2-place predicate  Q is T for Q(4,3) and Q is F for Q (3,4)

Discrete Mathematical Structures: Theory and Applications 63 Quantifiers and First Order Logic  Universal Quantifier  Let P(x) be a predicate and let D be the domain of the discourse. The universal quantification of P(x) is the statement:  For all x, P(x) or  For every x, P(x)  The symbol is read as “for all and every”   Two-place predicate:

Discrete Mathematical Structures: Theory and Applications 64 Quantifiers and First Order Logic  Existential Quantifier  Let P(x) be a predicate and let D be the domain of the discourse. The existential quantification of P(x) is the statement:  There exists x, P(x)  The symbol is read as “there exists”   Bound Variable  The variable appearing in: or

Discrete Mathematical Structures: Theory and Applications 65 Quantifiers and First Order Logic  Negation of Predicates (DeMorgan’s Laws)   Example:  If P(x) is the statement “x has won a race” where the domain of discourse is all runners, then the universal quantification of P(x) is, i.e., every runner has won a race. The negation of this statement is “it is not the case that every runner has won a race. Therefore there exists at least one runner who has not won a race. Therefore: and so,

Discrete Mathematical Structures: Theory and Applications 66 Quantifiers and First Order Logic  Negation of Predicates (DeMorgan’s Laws) 

Discrete Mathematical Structures: Theory and Applications 67 Logic and CS  Logic is basis of ALU  Logic is crucial to IF statements  AND  OR  NOT  Implementation of quantifiers  Looping  Database Query Languages  Relational Algebra  Relational Calculus  SQL

CSE 2353 OUTLINE 1.Sets 2.Logic 3.Proof Techniques 4.Integers and Inductions 5.Relations and Posets 6.Functions 7.Counting Principles 8.Boolean Algebra

Discrete Mathematical Structures: Theory and Applications 69 Proof Technique: Learning Objectives  Learn various proof techniques  Direct  Indirect  Contradiction  Induction  Practice writing proofs  CS: Why study proof techniques?

Discrete Mathematical Structures: Theory and Applications 70 Proof Techniques  Theorem  Statement that can be shown to be true (under certain conditions)  Typically Stated in one of three ways  As Facts  As Implications  As Biimplications

Discrete Mathematical Structures: Theory and Applications 71 Proof Techniques  Direct Proof or Proof by Direct Method  Proof of those theorems that can be expressed in the form ∀ x (P(x) → Q(x)), D is the domain of discourse  Select a particular, but arbitrarily chosen, member a of the domain D  Show that the statement P(a) → Q(a) is true. (Assume that P(a) is true  Show that Q(a) is true  By the rule of Universal Generalization (UG), ∀ x (P(x) → Q(x)) is true

Discrete Mathematical Structures: Theory and Applications 72 Proof Techniques  Indirect Proof  The implication p → q is equivalent to the implication ( ∼ q → ∼ p)  Therefore, in order to show that p → q is true, one can also show that the implication ( ∼ q → ∼ p) is true  To show that ( ∼ q → ∼ p) is true, assume that the negation of q is true and prove that the negation of p is true

Discrete Mathematical Structures: Theory and Applications 73 Proof Techniques  Proof by Contradiction  Assume that the conclusion is not true and then arrive at a contradiction  Example: Prove that there are infinitely many prime numbers  Proof:  Assume there are not infinitely many prime numbers, therefore they are listable, i.e. p 1,p 2,…,p n  Consider the number q = p 1 p 2 …p n +1. q is not divisible by any of the listed primes  Therefore, q is a prime. However, it was not listed.  Contradiction! Therefore, there are infinitely many primes

Discrete Mathematical Structures: Theory and Applications 74 Proof Techniques

Discrete Mathematical Structures: Theory and Applications 75 Proof Techniques  Proof of Biimplications  To prove a theorem of the form ∀ x (P(x) ↔ Q(x )), where D is the domain of the discourse, consider an arbitrary but fixed element a from D. For this a, prove that the biimplication P(a) ↔ Q(a) is true  The biimplication p ↔ q is equivalent to (p → q) ∧ (q → p)  Prove that the implications p → q and q → p are true  Assume that p is true and show that q is true  Assume that q is true and show that p is true

Discrete Mathematical Structures: Theory and Applications 76 Proof Techniques  Proof of Equivalent Statements  Consider the theorem that says that statements p,q and r are equivalent  Show that p → q, q → r and r → p  Assume p and prove q. Then assume q and prove r Finally, assume r and prove p  Or, prove that p if and only if q, and then q if and only if r  Other methods are possible

Discrete Mathematical Structures: Theory and Applications 77 Other Proof Techniques  Vacuous  Trivial  Contrapositive  Counter Example  Divide into Cases

Discrete Mathematical Structures: Theory and Applications 78 Proof Basics You can not prove by example

Discrete Mathematical Structures: Theory and Applications 79 Proofs in Computer Science  Proof of program correctness  Proofs are used to verify approaches

CSE 2353 OUTLINE 1.Sets 2.Logic 3.Proof Techniques 4.Integers and Induction 5.Relations and Posets 6.Functions 7.Counting Principles 8.Boolean Algebra

Discrete Mathematical Structures: Theory and Applications 81 Learning Objectives  Learn about the basic properties of integers  Explore how addition and subtraction operations are performed on binary numbers  Learn how the principle of mathematical induction is used to solve problems  CS  Become aware how integers are represented in computer memory  Looping

Discrete Mathematical Structures: Theory and Applications 82 Integers  Properties of Integers

Discrete Mathematical Structures: Theory and Applications 83 Integers

Discrete Mathematical Structures: Theory and Applications 84 Integers

Discrete Mathematical Structures: Theory and Applications 85 Integers

Discrete Mathematical Structures: Theory and Applications 86 Integers

Discrete Mathematical Structures: Theory and Applications 87 Integers

Discrete Mathematical Structures: Theory and Applications 88 Integers  The div and mod operators  div  a div b = the quotient of a and b obtained by dividing a on b.  Examples:  8 div 5 = 1  13 div 3 = 4  mod  a mod b = the remainder of a and b obtained by dividing a on b  8 mod 5 = 3  13 mod 3 = 1

Discrete Mathematical Structures: Theory and Applications 89 Integers

Discrete Mathematical Structures: Theory and Applications 90 Integers

Discrete Mathematical Structures: Theory and Applications 91 Integers

Discrete Mathematical Structures: Theory and Applications 92 Integers

Discrete Mathematical Structures: Theory and Applications 93 Integers  Relatively Prime Number

Discrete Mathematical Structures: Theory and Applications 94 Integers  Least Common Multiples

Discrete Mathematical Structures: Theory and Applications 95 Representation of Integers in Computer  Electrical signals are used inside the computer to process information  Two types of signals  Analog  Continuous wave forms used to represent such things as sound  Examples: audio tapes, older television signals, etc.  Digital  Represent information with a sequence of 0s and 1s  Examples: compact discs, newer digital HDTV signals

Discrete Mathematical Structures: Theory and Applications 96 Representation of Integers in Computers  Digital Signals  0s and 1s – 0s represent low voltage, 1s high voltage  Digital signals are more reliable carriers of information than analog signals  Can be copied from one device to another with exact precision  Machine language is a sequence of 0s and 1s  The digit 0 or 1 is called a binary digit, or bit  A sequence of 0s and 1s is sometimes referred to as binary code

Discrete Mathematical Structures: Theory and Applications 97 Representation of Integers in Computers  Decimal System or Base-10  The digits that are used to represent numbers in base 10 are 0,1,2,3,4,5,6,7,8, and 9  Binary System or Base-2  Computer memory stores numbers in machine language, i.e., as a sequence of 0s and 1s  Octal System or Base-8  Digits that are used to represent numbers in base 8 are 0,1,2,3,4,5,6, and 7  Hexadecimal System or Base-16  Digits and letters that are used to represent numbers in base 16 are 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, and F

Discrete Mathematical Structures: Theory and Applications 98 Representation of Integers in Computers

Discrete Mathematical Structures: Theory and Applications 99 Representation of Integers in Computers

Discrete Mathematical Structures: Theory and Applications 100 Representation of Integers in Computers  Two’s Complements and Operations on Binary Numbers  In computer memory, integers are represented as binary numbers in fixed-length bit strings, such as 8, 16, 32 and 64  Assume that integers are represented as 8-bit fixed-length strings  Sign bit is the MSB (Most Significant Bit)  Leftmost bit (MSB) = 0, number is positive  Leftmost bit (MSB) = 1, number is negative

Discrete Mathematical Structures: Theory and Applications 101 Representation of Integers in Computers

Discrete Mathematical Structures: Theory and Applications 102 Representation of Integers in Computers  One’s Complements and Operations on Binary Numbers

Discrete Mathematical Structures: Theory and Applications 103 Representation of Integers in Computers

Discrete Mathematical Structures: Theory and Applications 104 Representation of Integers in Computers

Discrete Mathematical Structures: Theory and Applications 105 Representation of Integers in Computers

Discrete Mathematical Structures: Theory and Applications 106 Representation of Integers in Computers

Discrete Mathematical Structures: Theory and Applications 107 Representation of Integers in Computers

Discrete Mathematical Structures: Theory and Applications 108 Mathematical Deduction

Discrete Mathematical Structures: Theory and Applications 109 Mathematical Deduction  Proof of a mathematical statement by the principle of mathematical induction consists of three steps:

Discrete Mathematical Structures: Theory and Applications 110 Mathematical Deduction  Assume that when a domino is knocked over, the next domino is knocked over by it  Show that if the first domino is knocked over, then all the dominoes will be knocked over

Discrete Mathematical Structures: Theory and Applications 111 Mathematical Deduction  Let P(n) denote the statement that then n th domino is knocked over  Show that P(1) is true  Assume some P(k) is true, i.e. the k th domino is knocked over for some  Prove that P(k+1) is true, i.e.

Discrete Mathematical Structures: Theory and Applications 112 Mathematical Deduction  Assume that when a staircase is climbed, the next staircase is also climbed  Show that if the first staircase is climbed then all staircases can be climbed  Let P(n) denote the statement that then n th staircase is climbed  It is given that the first staircase is climbed, so P(1) is true

Discrete Mathematical Structures: Theory and Applications 113 Mathematical Deduction  Suppose some P(k) is true, i.e. the k th staircase is climbed for some  By the assumption, because the k th staircase was climbed, the k+1 st staircase was climbed  Therefore, P(k) is true, so

Discrete Mathematical Structures: Theory and Applications 114 Mathematical Deduction

Discrete Mathematical Structures: Theory and Applications 115 Mathematical Deduction  We can associate a predicate, P(n). The predicate P(n) is such that:

Discrete Mathematical Structures: Theory and Applications 116 Prime Numbers  For any positive integer n > 1, the integers 1 and n are called the trivial positive divisors of n  An integer n > 1 is a prime integer if and only if n has only trivial positive divisors  An integer n > 1 is a composite integer if and only if n has a nontrivial positive divisor

Discrete Mathematical Structures: Theory and Applications 117 Prime Numbers

Discrete Mathematical Structures: Theory and Applications 118 Prime Numbers

Discrete Mathematical Structures: Theory and Applications 119 Prime Numbers Example: Consider the integer 131. Observe that 2 does not divide 131. We now find all odd primes p such that p 2  131. These primes are 3, 5, 7, and 11. Now none of 3, 5, 7, and 11 divides 131. Hence, 131 is a prime.

Discrete Mathematical Structures: Theory and Applications 120 Prime Numbers

Discrete Mathematical Structures: Theory and Applications 121 Prime Numbers  Factoring a Positive Integer  The standard factorization of n

Discrete Mathematical Structures: Theory and Applications 122 Prime Numbers  Fermat’s Factoring Method

Discrete Mathematical Structures: Theory and Applications 123 Prime Numbers  Fermat’s Factoring Method