DISCRETE COMPUTATIONAL STRUCTURES CSE 2353 Fall 2010 Most
- Slides: 54
DISCRETE COMPUTATIONAL STRUCTURES CSE 2353 Fall 2010 Most slides modified from Discrete Mathematical Structures: Theory and Applications by D. S. Malik and M. K. Sen
CSE 2353 OUTLINE PART I 1. Sets 2. Logic PART II 3. Proof Techniques 4. Relations 5. Functions PART III 6. Number Theory 7. Boolean Algebra
CSE 2353 OUTLINE PART I 1. Sets 2. Logic PART II 3. Proof Techniques 4. Relations 5. Functions PART III 6. Number Theory 7. Boolean Algebra
Sets: Learning Objectives q Learn about sets q Explore various operations on sets q Become familiar with Venn diagrams q CS: q. Learn how to represent sets in computer memory q. Learn how to implement set operations in programs CSE 2353 Fall 2010 4
Sets q Definition: Well-defined collection of distinct objects q Members or Elements: part of the collection q Roster Method: Description of a set by listing the elements, enclosed with braces q. Examples: q. Vowels = {a, e, i, o, u} q. Primary colors = {red, blue, yellow} q Membership examples q“a belongs to the set of Vowels” is written as: a Vowels q“j does not belong to the set of Vowels: j Vowels CSE 2353 Fall 2010 5
Sets q Set-builder method q. A = { x | x S, P(x) } or A = { x S | P(x) } q A is the set of all elements x of S, such that x satisfies the property P q. Example: q. 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 Fall 2010 6
Sets q Standard Symbols which denote sets of numbers q N : The set of all natural numbers (i. e. , all positive integers) q Z : The set of all integers q Z+ : The set of all positive integers q Z* : The set of all nonzero integers q E : The set of all even integers q Q : The set of all rational numbers q Q* : The set of all nonzero rational numbers q Q+ : The set of all positive rational numbers q R : The set of all real numbers q R* : The set of all nonzero real numbers q R+ : The set of all positive real numbers q C : The set of all complex numbers q C* : The set of all nonzero complex numbers CSE 2353 Fall 2010 7
Sets q Subsets q“X is a subset of Y” is written as X Y q“X is not a subset of Y” is written as X Y q. Example: q X = {a, e, i, o, u}, Y = {a, i, u} and z = {b, c, d, f, g} q. Y X, since every element of Y is an element of X q. Y Z, since a Y, but a Z CSE 2353 Fall 2010 8
Sets q Superset q. 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 q Proper Subset q. 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. q. Example: q X = {a, e, i, o, u}, Y = {a, e, i, o, u, y} q. X Y , since y Y, but y X CSE 2353 Fall 2010 9
Sets q Set Equality q. 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 q. Examples: q{1, 2, 3} = {2, 3, 1} q. X = {red, blue, yellow} and Y = {c | c is a primary color} Therefore, X=Y q Empty (Null) Set q. A Set is Empty (Null) if it contains no elements. q. The Empty Set is written as q. The Empty Set is a subset of every set CSE 2353 Fall 2010 10
Sets q Finite and Infinite Sets q. 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. q. If a set is not finite, then it is an infinite set. q. Examples: q Y = {1, 2, 3} is a finite set q P = {red, blue, yellow} is a finite set q E , the set of all even integers, is an infinite set q , the Empty Set, is a finite set with 0 elements CSE 2353 Fall 2010 11
Sets q Cardinality of Sets q. 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 q. Example: q. If P = {red, blue, yellow}, then |P| = 3 q. Singleton q A set with only one element is a singleton q. Example: q. H = { 4 }, |H| = 1, H is a singleton CSE 2353 Fall 2010 12
Sets q Power Set q. For any set X , the power set of X , written P(X), is the set of all subsets of X q. Example: q. If X = {red, blue, yellow}, then P(X) = { , {red}, {blue}, {yellow}, {red, blue}, {red, yellow}, {blue, yellow}, {red, blue, yellow} } q Universal Set q. An arbitrarily chosen, but fixed set CSE 2353 Fall 2010 13
Venn Diagrams q. Abstract visualization of a Universal set, U as a rectangle, with all subsets of U shown as circles. q. Shaded portion represents the corresponding set CSE 2353 Fall 2010 14
Union of Sets CSE 2353 Fall 2010 15
Intersection of Sets CSE 2353 Fall 2010 16
Difference of Sets CSE 2353 Fall 2010 17
Set Complement CSE 2353 Fall 2010 18
Disjoint Sets CSE 2353 Fall 2010 19
Venn Diagrams for 3 Sets CSE 2353 Fall 2010 20
Properties of Sets CSE 2353 Fall 2010 21
Properties of Sets CSE 2353 Fall 2010 22
De Morgan’s Law CSE 2353 Fall 2010 23
Sets q Ordered Pair q. X and Y are sets. If x X and y Y, then an ordered pair is written (x, y) q. Order of elements is important. (x, y) is not necessarily equal to (y, x) q Cartesian Product q The Cartesian product of two sets X and Y , written X × Y , is the set q X × Y ={(x, y)|x ∈ X , y ∈ Y} q. For any set X, X × = = × X q Example: q X = {a, b}, Y = {c, d} q. X × Y = {(a, c), (a, d), (b, c), (b, d)} q. Y × X = {(c, a), (d, a), (c, b), (d, b)} CSE 2353 Fall 2010 24
Computer Representation of Sets q A Set may be stored in a computer in an array as an unordered list q. Problem: Difficult to perform operations on the set. q Linked List q Solution: use Bit Strings (Bit Map) q. A Bit String is a sequence of 0 s and 1 s q. Length of a Bit String is the number of digits in the string q. Elements appear in order in the bit string q. A 0 indicates an element is absent, a 1 indicates that the element is present q A set may be implemented as a file CSE 2353 Fall 2010 25
Computer Implementation of Set Operations q Bit Map q File q Operations q. Intersection q. Union q. Element of q. Difference q. Complement q. Power Set CSE 2353 Fall 2010 26
Special “Sets” in CS q Multiset q Ordered Set CSE 2353 Fall 2010 27
CSE 2353 OUTLINE PART I 1. Sets 2. Logic PART II 3. Proof Techniques 4. Relations 5. Functions PART III 6. Number Theory 7. Boolean Algebra
Logic: Learning Objectives q Learn about statements (propositions) q Learn how to use logical connectives to combine statements q Explore how to draw conclusions using various argument forms q Become familiar with quantifiers and predicates q CS q Boolean data type q If statement q Impact of negations q Implementation of quantifiers CSE 2353 Fall 2010 29
Mathematical Logic q Definition: Methods of reasoning, provides rules and techniques to determine whether an argument is valid q Theorem: a statement that can be shown to be true (under certain conditions) q. Example: If x is an even integer, then x + 1 is an odd integer q. This statement is true under the condition that x is an integer is true CSE 2353 Fall 2010 30
Mathematical Logic q A statement, or a proposition, is a declarative sentence that is either true or false, but not both q Lowercase letters denote propositions q. Examples: qp: 2 is an even number (true) qq: 3 is an odd number (true) qr: A is a consonant (false) q. The following are not propositions: qp: My cat is beautiful qq: Are you in charge? CSE 2353 Fall 2010 31
Mathematical Logic q Truth value q One of the values “truth” (T) or “falsity” (F) assigned to a statement q Negation q The negation of p, written ~p, is the statement obtained by negating statement p q. Example: qp: A is a consonant q~p: it is the case that A is not a consonant q Truth Table CSE 2353 Fall 2010 32
Conjunction q. The statement p ^ q is true if both p and q are true; otherwise p ^ q is false q. Conjunction of p and q, written p ^ q , is the statement formed by joining statements p and q using the word “and”. CSE 2353 Fall 2010 33
Disjunction q. The disjunction of p and q, written p v q , is the statement formed by joining statements p and q using the word “or”. q. 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. q. Exclusive disjunction, v , one of the other but not both. CSE 2353 Fall 2010 34
Implication q. The statement “if p then q” is called an implication or condition. q. The implication “if p then q” is written p q qp is called the hypothesis (antecedent), q is called the conclusion (consequent) CSE 2353 Fall 2010 35
Mathematical Logic q Implication q. Let p: Today is Sunday and q: I will wash the car. qp q : If today is Sunday, then I will wash the car q. The converse of this implication is written q p If I wash the car, then today is Sunday q. The inverse of this implication is ~p ~q If today is not Sunday, then I will not wash the car q. The contrapositive of this implication is ~q ~p If I do not wash the car, then today is not Sunday CSE 2353 Fall 2010 36
Biimplication q. The statement “p if and only if q” is called the biimplication or biconditional of p and q q. The biconditional “p if and only if q” is written p q CSE 2353 Fall 2010 37
Mathematical Logic q Statement Formulas q Definitions q Symbols p , q , r , . . . , called statement variables q 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 q Expressions are statement formulas that are constructed only by using 1) and 2) above CSE 2353 Fall 2010 38
Mathematical Logic q Precedence of logical connectives is: q~ highest q second highest ^ q v third highest q→ fourth highest q↔ fifth highest CSE 2353 Fall 2010 39
Mathematical Logic q Tautology q. 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 q Contradiction q. 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 Fall 2010 40
Mathematical Logic q Logically Implies q. 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 q Logically Equivalent q. 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 Fall 2010 41
Mathematical Logic See pp 22 -24 in Text CSE 2353 Fall 2010 42
Validity of Arguments q Proof: an argument or a proof of a theorem consists of a finite sequence of statements ending in a conclusion q Argument: a finite sequence of statements. q The final statement, , is the conclusion, and the statements are the premises of the argument. q An argument is logically valid if the statement formula is a tautology. CSE 2353 Fall 2010 43
Validity of Arguments q Valid Argument Forms q. Modus Ponens: q. Modus Tollens : CSE 2353 Fall 2010 44
Validity of Arguments q Valid Argument Forms q. Disjunctive Syllogisms: q. Hypothetical Syllogism: CSE 2353 Fall 2010 45
Validity of Arguments q Valid Argument Forms q. Dilemma: q. Conjunctive Simplification: CSE 2353 Fall 2010 46
Validity of Arguments q Valid Argument Forms q. Disjunctive Addition: q. Conjunctive Addition: CSE 2353 Fall 2010 47
Quantifiers and First Order Logic q Predicate or Propositional Function q. Let x be a variable and D be a set; P(x) is a sentence q. 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 q. Moreover, D is called the domain of the discourse and x is called the free variable CSE 2353 Fall 2010 48
Quantifiers and First Order Logic q Universal Quantifier q. Let P(x) be a predicate and let D be the domain of the discourse. The universal quantification of P(x) is the statement: q. For all x, P(x) or q. For every x, P(x) q. The symbol is read as “for all and every” q q Two-place predicate: CSE 2353 Fall 2010 49
Quantifiers and First Order Logic q Existential Quantifier q. Let P(x) be a predicate and let D be the domain of the discourse. The existential quantification of P(x) is the statement: q. There exists x, P(x) q. The symbol is read as “there exists” q q Bound Variable q. The variable appearing in: or CSE 2353 Fall 2010 50
Quantifiers and First Order Logic q Negation of Predicates (De. Morgan’s Laws) q q. Example: q 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 Fall 2010 51
Quantifiers and First Order Logic q. Negation of Predicates (De. Morgan’s Laws) q CSE 2353 Fall 2010 52
Arguments in Predicate Logic q. Universal Specification If is true, then F(a) is true q. Universal Generalization If F(a) is true then is true q. Existential Specification If is true, then where F(a) is true q. Existential Generalization If F(a) is true then is true CSE 2353 Fall 2010 53
Logic and CS q Logic is basis of ALU q Logic is crucial to IF statements q. AND q. OR q. NOT q Implementation of quantifiers q. Looping q Database Query Languages q. Relational Algebra q. Relational Calculus q. SQL CSE 2353 Fall 2010 54
- Discrete computational structures
- What are ps and qs
- 2110200
- Webhandin unl
- Discrete structures
- Cs 584
- Discrete structures
- After the fall 2010
- Homologous structures
- Characteristics of computational thinking
- Computational thinking algorithms and programming
- Grc computational chemistry
- Using mathematics and computational thinking
- Straight skeleton algorithm
- Neuroscience usc major
- Standard deviation computational formula
- Semi interquartile range
- Computational math
- Computational thinking gcse
- Computational sustainability scope
- Chomsky computational linguistics
- Xkcd computational linguistics
- Comp bio cmu
- Dsp computational building blocks
- Amortized computational complexity
- Computational sustainability subjects
- The computational complexity of linear optics
- Leerlijn computational thinking
- Computational demand
- Computational graph backpropagation
- Computational graph
- Computational thinking jeannette wing
- Hms research computing
- Computational photography uiuc
- Computational neuroethology
- Basic computational models in computer architecture
- Computational methods in plasma physics
- Computational irreducibility
- Computational geometry
- Computational chemistry branches
- Computational intelligence ppt
- Computational chemistry aws
- Computational security
- The computational complexity of linear optics
- Tu bergakademie freiberg computational materials science
- Purdue computational science and engineering
- Nibib.nih.gov computational
- Computational engineering and physical modeling
- Ignoratio elenchi example
- Sp computational formula
- Problem solve
- Computational fluency
- Computational linguist jobs
- Fundamentals of computational neuroscience
- Computational approaches