Presentation is loading. Please wait.

Presentation is loading. Please wait.

DISCRETE COMPUTATIONAL STRUCTURES

Similar presentations


Presentation on theme: "DISCRETE COMPUTATIONAL STRUCTURES"— Presentation transcript:

1 DISCRETE COMPUTATIONAL STRUCTURES
CSE 2353 Spring 2010 Most slides modified from Discrete Mathematical Structures: Theory and Applications

2 CSE 2353 OUTLINE Sets Logic Proof Techniques Integers and Induction
Relations and Posets Functions Counting Principles Boolean Algebra

3 CSE 2353 OUTLINE Sets Logic Proof Techniques Integers and Induction
Relations and Posets Functions Counting Principles Boolean Algebra

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 CSE 2353 sp10

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 CSE 2353 sp10

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} CSE 2353 sp10

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 CSE 2353 sp10

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 CSE 2353 sp10

9 Sets Superset Proper Subset
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 CSE 2353 sp10

10 Sets Set Equality Empty (Null) Set
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 CSE 2353 sp10

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 CSE 2353 sp10

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 H = { 4 }, |H| = 1, H is a singleton CSE 2353 sp10

13 Sets Power Set Universal 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 CSE 2353 sp10

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 CSE 2353 sp10

15 Set Operations and Venn Diagrams
Union of Sets Example: If X = {1,2,3,4,5} and Y = {5,6,7,8,9}, then XUY = {1,2,3,4,5,6,7,8,9} CSE 2353 sp10

16 Sets Intersection of Sets Example:
If X = {1,2,3,4,5} and Y = {5,6,7,8,9}, then X ∩ Y = {5} CSE 2353 sp10

17 Sets Disjoint Sets Example:
If X = {1,2,3,4,} and Y = {6,7,8,9}, then X ∩ Y =  CSE 2353 sp10

18 Sets CSE 2353 sp10

19 Sets CSE 2353 sp10

20 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} CSE 2353 sp10

21 Sets Complement Example:
If U = {a,b,c,d,e,f} and X = {c,d,e,f}, then X’ = {a,b} CSE 2353 sp10

22 Sets CSE 2353 sp10

23 Sets CSE 2353 sp10

24 Sets CSE 2353 sp10

25 Sets Ordered Pair Cartesian Product
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)} CSE 2353 sp10

26 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 CSE 2353 sp10

27 Computer Implementation of Set Operations
Bit Map File Operations Intersection Union Element of Difference Complement Power Set CSE 2353 sp10

28 Special “Sets” in CS Multiset Ordered Set CSE 2353 sp10

29 CSE 2353 OUTLINE Logic Sets Proof Techniques Relations and Posets
Functions Counting Principles Boolean Algebra

30 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 CSE 2353 sp10

31 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 CSE 2353 sp10

32 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? CSE 2353 sp10

33 Mathematical Logic Truth value Negation Truth Table
One of the values “truth” (T) or “falsity” (F) assigned to a statement Negation The negation of p, written ~p, is the statement obtained by negating statement p Example: p: A is a consonant ~p: it is the case that A is not a consonant Truth Table CSE 2353 sp10

34 Mathematical Logic 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 Truth Table for Conjunction: CSE 2353 sp10

35 Mathematical Logic Disjunction Truth Table for 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” Truth Table for Disjunction: CSE 2353 sp10

36 Mathematical Logic “If p, then q””
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 “If p, then q”” p is called the hypothesis, q is called the conclusion Truth Table for Implication: CSE 2353 sp10

37 Mathematical Logic Implication p  q :
Let p: Today is Sunday and q: I will wash the car. 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 CSE 2353 sp10

38 Mathematical Logic Biimplication “p if and only if q”
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 if and only if q” Truth Table for the Biconditional: CSE 2353 sp10

39 Mathematical Logic Statement Formulas Definitions
Symbols p ,q ,r ,...,called statement variables Symbols ~, ^, v, →,and ↔ are called logical connectives A statement variable is a statement formula 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 CSE 2353 sp10

40 Mathematical Logic Precedence of logical connectives is:
~ highest ^ second highest v third highest → fourth highest ↔ fifth highest CSE 2353 sp10

41 Mathematical Logic Tautology Contradiction
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 CSE 2353 sp10

42 Mathematical Logic Logically Implies Logically Equivalent
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 CSE 2353 sp10

43 Mathematical Logic CSE 2353 sp10

44 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. CSE 2353 sp10

45 Validity of Arguments Valid Argument Forms Modus Ponens:
Modus Tollens : CSE 2353 sp10

46 Validity of Arguments Valid Argument Forms Disjunctive Syllogisms:
Hypothetical Syllogism: CSE 2353 sp10

47 Validity of Arguments Valid Argument Forms Dilemma:
Conjunctive Simplification: CSE 2353 sp10

48 Validity of Arguments Valid Argument Forms Conjunctive Addition:
Disjunctive Addition: Conjunctive Addition: CSE 2353 sp10

49 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 CSE 2353 sp10

50 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: CSE 2353 sp10

51 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 CSE 2353 sp10

52 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, CSE 2353 sp10

53 Quantifiers and First Order Logic
Negation of Predicates (DeMorgan’s Laws) CSE 2353 sp10

54 Logic and CS Logic is basis of ALU Logic is crucial to IF statements
OR NOT Implementation of quantifiers Looping Database Query Languages Relational Algebra Relational Calculus SQL CSE 2353 sp10

55 Integers and Inductions
CSE OUTLINE Sets Logic Proof Techniques Integers and Inductions Relations and Posets Functions Counting Principles Boolean Algebra

56 Proof Technique: Learning Objectives
Learn various proof techniques Direct Indirect Contradiction Induction Practice writing proofs CS: Why study proof techniques? CSE 2353 sp10

57 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 CSE 2353 sp10

58 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 CSE 2353 sp10

59 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 CSE 2353 sp10

60 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. p1,p2,…,pn Consider the number q = p1p2…pn+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. CSE 2353 sp10

61 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 CSE 2353 sp10

62 Proof of Equivalent Statements
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 What other methods are possible? CSE 2353 sp10

63 Other Proof Techniques
Vacuous Trivial Contrapositive Counter Example Divide into Cases Constructive CSE 2353 sp10

64 You can not prove by example
Proof Basics You can not prove by example CSE 2353 sp10

65 Proofs in Computer Science
Proof of program correctness Proofs are used to verify approaches CSE 2353 sp10

66 Integers and Induction
CSE OUTLINE Sets Logic Proof Techniques Integers and Induction Relations and Posets Functions Counting Principles Boolean Algebra

67 Learning Objectives Learn how the principle of mathematical induction is used to solve problems and proofs Learn about the basic properties of integers Explore how addition and subtraction operations are performed on binary numbers CS Become aware how integers are represented in computer memory Looping CSE 2353 sp10

68 Mathematical Deduction
CSE 2353 sp10

69 Mathematical Deduction
Proof of a mathematical statement by the principle of mathematical induction consists of three steps: CSE 2353 sp10

70 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 CSE 2353 sp10

71 Mathematical Deduction
Let P(n) denote the statement that then nth domino is knocked over Show that P(1) is true Assume some P(k) is true, i.e. the kth domino is knocked over for some Prove that P(k+1) is true, i.e. CSE 2353 sp10

72 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 nth staircase is climbed It is given that the first staircase is climbed, so P(1) is true CSE 2353 sp10

73 Mathematical Deduction
Suppose some P(k) is true, i.e. the kth staircase is climbed for some By the assumption, because the kth staircase was climbed, the k+1st staircase was climbed Therefore, P(k) is true, so CSE 2353 sp10

74 Mathematical Deduction
CSE 2353 sp10

75 Mathematical Deduction
We can associate a predicate, P(n). The predicate P(n) is such that: CSE 2353 sp10

76 Integers Properties of Integers CSE 2353 sp10

77 Integers CSE 2353 sp10

78 The div and mod operators
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 CSE 2353 sp10

79 Integers CSE 2353 sp10

80 Integers CSE 2353 sp10

81 Integers Relatively Prime Number CSE 2353 sp10

82 Integers Least Common Multiples CSE 2353 sp10

83 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 CSE 2353 sp10

84 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 CSE 2353 sp10

85 Representation of Integers in Computers
CSE 2353 sp10

86 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 CSE 2353 sp10

87 Representation of Integers in Computers
CSE 2353 sp10

88 Representation of Integers in Computers
One’s Complements and Operations on Binary Numbers CSE 2353 sp10

89 Representation of Integers in Computers
CSE 2353 sp10

90 Prime Numbers Example:
Consider the integer 131. Observe that 2 does not divide 131. We now find all odd primes p such that p2  131. These primes are 3, 5, 7, and 11. Now none of 3, 5, 7, and 11 divides 131. Hence, 131 is a prime. CSE 2353 sp10

91 Prime Numbers CSE 2353 sp10

92 Factoring a Positive Integer
Prime Numbers Factoring a Positive Integer The standard factorization of n CSE 2353 sp10

93 Fermat’s Factoring Method
Prime Numbers Fermat’s Factoring Method CSE 2353 sp10

94 Fermat’s Factoring Method
Prime Numbers Fermat’s Factoring Method CSE 2353 sp10

95 Integers and Induction
CSE OUTLINE Sets Logic Proof Techniques Integers and Induction Relations and Posets Functions Counting Principles Boolean Algebra

96 Learn about relations and their basic properties
Learning Objectives Learn about relations and their basic properties Explore equivalence relations Become aware of closures Learn about posets Explore how relations are used in the design of relational databases CSE 2353 sp10

97 Relations are a natural way to associate objects of various sets
CSE 2353 sp10

98 Relations R can be described in Roster form Set-builder form
CSE 2353 sp10

99 Relations Arrow Diagram Write the elements of A in one column
Write the elements B in another column Draw an arrow from an element, a, of A to an element, b, of B, if (a ,b)  R Here, A = {2,3,5} and B = {7,10,12,30} and R from A into B is defined as follows: For all a  A and b  B, a R b if and only if a divides b The symbol → (called an arrow) represents the relation R CSE 2353 sp10

100 Relations CSE 2353 sp10

101 Relations Directed Graph Let R be a relation on a finite set A
Describe R pictorially as follows: For each element of A , draw a small or big dot and label the dot by the corresponding element of A Draw an arrow from a dot labeled a , to another dot labeled, b , if a R b . Resulting pictorial representation of R is called the directed graph representation of the relation R CSE 2353 sp10

102 Relations CSE 2353 sp10

103 Domain and Range of the Relation
Relations Domain and Range of the Relation Let R be a relation from a set A into a set B. Then R ⊆ A x B. The elements of the relation R tell which element of A is R-related to which element of B CSE 2353 sp10

104 Relations CSE 2353 sp10

105 Relations CSE 2353 sp10

106 Relations Let A = {1, 2, 3, 4} and B = {p, q, r}. Let R = {(1, q), (2, r ), (3, q), (4, p)}. Then R−1 = {(q, 1), (r , 2), (q, 3), (p, 4)} To find R−1, just reverse the directions of the arrows D(R) = {1, 2, 3, 4} = Im(R−1), Im(R) = {p, q, r} = D(R−1) CSE 2353 sp10

107 Relations CSE 2353 sp10

108 Relations Constructing New Relations from Existing Relations
CSE 2353 sp10

109 Relations Example: Consider the relations R and S as given in Figure 3.7. The composition S ◦ R is given by Figure 3.8. CSE 2353 sp10

110 Relations CSE 2353 sp10

111 Relations CSE 2353 sp10

112 Relations CSE 2353 sp10

113 Relations CSE 2353 sp10

114 Relations CSE 2353 sp10

115 Relations CSE 2353 sp10

116 Relations CSE 2353 sp10

117 Relations CSE 2353 sp10

118 Partially Ordered Sets
CSE 2353 sp10

119 Partially Ordered Sets
CSE 2353 sp10

120 Partially Ordered Sets
CSE 2353 sp10

121 Partially Ordered Sets
CSE 2353 sp10

122 Partially Ordered Sets
Hasse Diagram Let S = {1, 2, 3}. Then P(S) = {, {1}, {2}, {3}, {1, 2}, {2, 3}, {1, 3}, S} Now (P(S),≤) is a poset, where ≤ denotes the set inclusion relation. The poset diagram of (P(S),≤) is shown in Figure 3.22 CSE 2353 sp10

123 Partially Ordered Sets
CSE 2353 sp10

124 Partially Ordered Sets
Hasse Diagram Let S = {1, 2, 3}. Then P(S) = {, {1}, {2}, {3}, {1, 2}, {2, 3}, {1, 3}, S} (P(S),≤) is a poset, where ≤ denotes the set inclusion relation Draw the digraph of this inclusion relation (see Figure 3.23). Place the vertex A above vertex B if B ⊂ A. Now follow steps (2), (3), and (4) CSE 2353 sp10

125 Partially Ordered Sets
CSE 2353 sp10

126 Partially Ordered Sets
Hasse Diagram Consider the poset (S,≤), where S = {2, 4, 5, 10, 15, 20} and the partial order ≤ is the divisibility relation. 2 and 5 are the only minimal elements of this poset. This poset has no least element. 20 and 15 are the only maximal elements of this poset. This poset has no greatest element. CSE 2353 sp10

127 Partially Ordered Sets
CSE 2353 sp10

128 Partially Ordered Sets
CSE 2353 sp10

129 Partially Ordered Sets
CSE 2353 sp10

130 Partially Ordered Sets
CSE 2353 sp10

131 Partially Ordered Sets
CSE 2353 sp10

132 Partially Ordered Sets
CSE 2353 sp10

133 Partially Ordered Sets
CSE 2353 sp10

134 Application: Relational Database
A database is a shared and integrated computer structure that stores End-user data; i.e., raw facts that are of interest to the end user; Metadata, i.e., data about data through which data are integrated A database can be thought of as a well-organized electronic file cabinet whose contents are managed by software known as a database management system; that is, a collection of programs to manage the data and control the accessibility of the data CSE 2353 sp10

135 Application: Relational Database
In a relational database system, tables are considered as relations A table is an n-ary relation, where n is the number of columns in the tables The headings of the columns of a table are called attributes, or fields, and each row is called a record The domain of a field is the set of all (possible) elements in that column CSE 2353 sp10

136 Application: Relational Database
Each entry in the ID column uniquely identifies the row containing that ID Such a field is called a primary key Sometimes, a primary key may consist of more than one field CSE 2353 sp10

137 Application: Relational Database
Structured Query Language (SQL) Information from a database is retrieved via a query, which is a request to the database for some information A relational database management system provides a standard language, called structured query language (SQL) CSE 2353 sp10

138 Application: Relational Database
Structured Query Language (SQL) An SQL contains commands to create tables, insert data into tables, update tables, delete tables, etc. Once the tables are created, commands can be used to manipulate data into those tables. The most commonly used command for this purpose is the select command. The select command allows the user to do the following: Specify what information is to be retrieved and from which tables. Specify conditions to retrieve the data in a specific form. Specify how the retrieved data are to be displayed. CSE 2353 sp10

139 Integers and Induction
CSE OUTLINE Sets Logic Proof Techniques Integers and Induction Relations and Posets Functions Counting Principles Boolean Algebra

140 Explore various properties of functions Learn about binary operations
Learning Objectives Learn about functions Explore various properties of functions Learn about binary operations CSE 2353 sp10

141 Functions CSE 2353 sp10

142 CSE 2353 sp10

143 CSE 2353 sp10

144 Functions Every function is a relation
Therefore, functions on finite sets can be described by arrow diagrams. In the case of functions, the arrow diagram may be drawn slightly differently. If f : A → B is a function from a finite set A into a finite set B, then in the arrow diagram, the elements of A are enclosed in ellipses rather than individual boxes. CSE 2353 sp10

145 Functions To determine from its arrow diagram whether a relation f from a set A into a set B is a function, two things are checked: Check to see if there is an arrow from each element of A to an element of B This would ensure that the domain of f is the set A, i.e., D(f) = A Check to see that there is only one arrow from each element of A to an element of B This would ensure that f is well defined CSE 2353 sp10

146 Functions Let A = {1,2,3,4} and B = {a, b, c , d} be sets
The arrow diagram in Figure 5.6 represents the relation f from A into B Every element of A has some image in B An element of A is related to only one element of B; i.e., for each a ∈ A there exists a unique element b ∈ B such that f (a) = b CSE 2353 sp10

147 Functions Therefore, f is a function from A into B
The image of f is the set Im(f) = {a, b, d} There is an arrow originating from each element of A to an element of B D(f) = A There is only one arrow from each element of A to an element of B f is well defined CSE 2353 sp10

148 Functions The arrow diagram in Figure 5.7 represents the relation g from A into B Every element of A has some image in B D(g ) = A For each a ∈ A, there exists a unique element b ∈ B such that g(a) = b g is a function from A into B CSE 2353 sp10

149 The image of g is Im(g) = {a, b, c , d} = B
Functions The image of g is Im(g) = {a, b, c , d} = B There is only one arrow from each element of A to an element of B g is well defined CSE 2353 sp10

150 Functions CSE 2353 sp10

151 Functions CSE 2353 sp10

152 Functions Example Let A = {1,2,3,4} and B = {a, b, c , d}. Let f : A → B be a function such that the arrow diagram of f is as shown in Figure 5.10 The arrows from a distinct element of A go to a distinct element of B. That is, every element of B has at most one arrow coming to it. If a1, a2 ∈ A and a1 = a2, then f(a1) = f(a2). Hence, f is one-one. Each element of B has an arrow coming to it. That is, each element of B has a preimage. Im(f) = B. Hence, f is onto B. It also follows that f is a one-to-one correspondence. CSE 2353 sp10

153 Functions Let A = {1,2,3,4} and B = {a, b, c , d, e}
Example Let A = {1,2,3,4} and B = {a, b, c , d, e} f : 1 → a, 2 → a, 3 → a, → a For this function the images of distinct elements of the domain are not distinct. For example 1  2, but f(1) = a = f(2) . Im(f) = {a}  B. Hence, f is neither one-one nor onto B. CSE 2353 sp10

154 Functions Let A = {1,2,3,4} and B = {a, b, c , d, e}
f : 1 → a, 2 → b, 3 → d, → e f is one-one. In this function, for the element c of B, the codomain, there is no element x in the domain such that f(x) = c ; i.e., c has no preimage. Hence, f is not onto B. CSE 2353 sp10

155 Functions CSE 2353 sp10

156 Functions Let A = {1,2,3,4}, B = {a, b, c , d, e},and C = {7,8,9}. Consider the functions f : A → B, g : B → C as defined by the arrow diagrams in Figure 5.14. The arrow diagram in Figure 5.15 describes the function h = g ◦ f : A → C. CSE 2353 sp10

157 Special Functions and Cardinality of a Set
CSE 2353 sp10

158 Special Functions and Cardinality of a Set
CSE 2353 sp10

159 Special Functions and Cardinality of a Set
CSE 2353 sp10

160 Special Functions and Cardinality of a Set
CSE 2353 sp10

161 Special Functions and Cardinality of a Set
CSE 2353 sp10

162 Special Functions and Cardinality of a Set
CSE 2353 sp10

163 Special Functions and Cardinality of a Set
CSE 2353 sp10

164 Special Functions and Cardinality of a Set
CSE 2353 sp10

165 Special Functions and Cardinality of a Set
CSE 2353 sp10

166 Special Functions and Cardinality of a Set
CSE 2353 sp10

167 CSE 2353 sp10

168 Special Functions and Cardinality of a Set
CSE 2353 sp10

169 Binary Operations CSE 2353 sp10

170 CSE 2353 sp10

171 CSE 2353 sp10

172 Integers and Induction
CSE OUTLINE Sets Logic Proof Techniques Integers and Induction Relations and Posets Functions Counting Principles Boolean Algebra

173 Learn the basic counting principles— multiplication and addition
Learning Objectives Learn the basic counting principles— multiplication and addition Explore the pigeonhole principle Learn about permutations Learn about combinations CSE 2353 sp10

174 Basic Counting Principles
CSE 2353 sp10

175 Basic Counting Principles
CSE 2353 sp10

176 Pigeonhole Principle The pigeonhole principle is also known as the Dirichlet drawer principle, or the shoebox principle. CSE 2353 sp10

177 Pigeonhole Principle CSE 2353 sp10

178 Permutations CSE 2353 sp10

179 Permutations CSE 2353 sp10

180 Combinations CSE 2353 sp10

181 Combinations CSE 2353 sp10

182 Generalized Permutations and Combinations
CSE 2353 sp10

183 Integers and Induction
CSE OUTLINE Sets Logic Proof Techniques Integers and Induction Relations and Posets Functions Counting Principles Boolean Algebra

184 Two-Element Boolean Algebra
Let B = {0, 1}. CSE 2353 sp10

185 CSE 2353 sp10

186 CSE 2353 sp10

187 CSE 2353 sp10

188 Two-Element Boolean Algebra
CSE 2353 sp10

189 Two-Element Boolean Algebra
CSE 2353 sp10

190 CSE 2353 sp10

191 CSE 2353 sp10

192 CSE 2353 sp10

193 CSE 2353 sp10

194 CSE 2353 sp10

195 Boolean Algebra CSE 2353 sp10

196 Boolean Algebra CSE 2353 sp10

197 Logical Gates and Combinatorial Circuits
CSE 2353 sp10

198 Logical Gates and Combinatorial Circuits
CSE 2353 sp10

199 Logical Gates and Combinatorial Circuits
CSE 2353 sp10

200 Logical Gates and Combinatorial Circuits
CSE 2353 sp10

201 CSE 2353 sp10

202 CSE 2353 sp10

203 CSE 2353 sp10

204 CSE 2353 sp10

205 CSE 2353 sp10

206 CSE 2353 sp10

207 CSE 2353 sp10

208 CSE 2353 sp10

209 CSE 2353 sp10

210 CSE 2353 sp10

211 CSE 2353 sp10

212 Logical Gates and Combinatorial Circuits
The Karnaugh map, or K-map for short, can be used to minimize a sum-of-product Boolean expression. CSE 2353 sp10

213 CSE 2353 sp10

214 CSE 2353 sp10

215 CSE 2353 sp10


Download ppt "DISCRETE COMPUTATIONAL STRUCTURES"

Similar presentations


Ads by Google