Upload
milton-powers
View
223
Download
0
Tags:
Embed Size (px)
Citation preview
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 I1. Sets 2. LogicPART II3. Proof Techniques4. Relations 5. FunctionsPART III6. Number Theory7. Boolean Algebra
CSE 2353 OUTLINEPART I1. Sets 2. LogicPART II
3.Proof Techniques4. Relations 5. Functions
PART III6. Number Theory7. Boolean Algebra
CSE 2353 sp10 4
Proof Techniques
Direct Proof or Proof by Direct MethodProof 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 trueBy the rule of Universal Generalization (UG), ∀x (P(x) → Q(x)) is true
CSE 2353 sp10 5
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 6
Proof Techniques
Proof by Contradiction Assume that the conclusion is not true and then
arrive at a contradictionExample: Prove that there are infinitely many prime
numbersProof:
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 7
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 trueAssume that p is true and show that q is trueAssume that q is true and show that p is true
CSE 2353 sp10 8
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 9
Other Proof Techniques
Vacuous
Trivial
Contrapositive
Counter Example
Divide into Cases
Constructive
CSE 2353 sp10 10
Proof Basics
You can not prove by example
CSE 2353 sp10 11
Proofs in Computer Science
Proof of program correctness
Proofs are used to verify approaches
CSE 2353 sp10 12
Mathematical Induction
CSE 2353 sp10 13
Mathematical Induction
Proof of a mathematical statement by the principle of mathematical induction consists of three steps:
CSE 2353 sp10 14
Mathematical InductionAssume that when a domino is knocked over, the next domino
is knocked over by itShow that if the first domino is knocked over, then all the
dominoes will be knocked over
CSE 2353 sp10 15
Mathematical Induction
Let P(n) denote the statement that then nth domino is knocked over
Show that P(1) is trueAssume some P(k) is true, i.e. the kth domino is
knocked over for some
Prove that P(k+1) is true, i.e.
1k
)1()( kPkP
CSE 2353 sp10 16
Mathematical Induction
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 17
Mathematical Induction
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
1k
)1()( kPkP
CSE 2353 OUTLINEPART I1. Sets 2. LogicPART II
3. Proof Techniques4.Relations
5. FunctionsPART III
6. Number Theory7. Boolean Algebra
CSE 2353 sp10 19
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
20
Relations
Relations are a natural way to associate objects of various sets
CSE 2353 sp10 21
Relations
R can be described in
Roster form
Set-builder form
CSE 2353 sp10 22
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 23
Relation Arrow Diagram
CSE 2353 sp10 24
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 25
Relation Directed Graph
CSE 2353 sp10 26
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
CSE 2353 sp10 27
Inverse of Relations
CSE 2353 sp10 28
Relations
Constructing New Relations from Existing Relations
CSE 2353 sp10 29
Composition of Relations
CSE 2353 sp10 30
Properties of Relations
CSE 2353 sp10 31
Relations
CSE 2353 sp10 32
Relations
CSE 2353 sp10 33
Equivalence Classes
CSE 2353 sp10 34
Partially Ordered Sets
CSE 2353 sp10 35
Partially Ordered Sets
CSE 2353 sp10 36
Partially Ordered Sets
CSE 2353 sp10 37
Partially Ordered Sets
CSE 2353 sp10 38
Partially Ordered Sets
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.
CSE 2353 sp10 39
Partially Ordered Sets
CSE 2353 sp10 40
Digraph vs. Hasse Diagram
CSE 2353 sp10 41
Minimal and Maximal Elements
CSE 2353 sp10 42
Partially Ordered Sets
CSE 2353 sp10 43
Partially Ordered Sets
CSE 2353 sp10 44
Application: Relational Database
A database is a shared and integrated computer structure that storesEnd-user data; i.e., raw facts that are of interest
to the end user;Metadata, i.e., data about data through which
data are integratedA 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 45
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 46
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 47
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)
A relational database management system provides a standard language, called structured query language (SQL)
CSE 2353 sp10 48
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 OUTLINE
PART I1. Sets 2. LogicPART II
3. Proof Techniques4. Relations
5.FunctionsPART III
6. Number Theory7. Boolean Algebra
CSE 2353 sp10 50
Learning Objectives
Learn about functions
Explore various properties of functions
Learn about binary operations
CSE 2353 sp10 51
Functions
CSE 2353 sp10 52
Functions
CSE 2353 sp10 53
Functions
CSE 2353 sp10 54
Functions
Every function is a relationTherefore, 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 55
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: 1) 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
2) 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 56
Functions
CSE 2353 sp10 57
Functions
CSE 2353 sp10 58
Functions
CSE 2353 sp10 59
Special Functions and Cardinality of a Set
CSE 2353 sp10 60
Special Functions and Cardinality of a Set
CSE 2353 sp10 61
Special Functions and Cardinality of a Set
CSE 2353 sp10 62
Special Functions and Cardinality of a Set
CSE 2353 sp10 63
Special Functions and Cardinality of a Set
CSE 2353 sp10 64
Special Functions and Cardinality of a Set
CSE 2353 sp10 65
Mathematical Systems