CS250 at CCUT Week 1: Introductions

Course Title: CS250 -- Discrete Structures I

Instructor: David Lu

Some facts about me:

Map of US

Here are some pictures of SU:

Syracuse University Panoramic

The building housing the philosophy department:

Hall of Languages in the Fall

Here are some pictures of PSU and Portland

PSU Library:
PSU Library

PSU location in downtown Portland:
PSU Overhead

Portland from the east side, looking west to downtown:
Portland

Portland steel bridge:
Portland in the Fall

Mount Hood in the distance view from PSU:
Mount Hood

Columbia River that separates Oregon state from Washington state:
Columbia River

Willamette River that separates east from west Portland:
Willamette River

Willamette River:
Willamette River

CS250 Purpose and Goals

CS 250 is the first term of the two term sequence CS 250-251. The main goal of the sequence is that students obtain those skills in discrete mathematics and logic that are used in the study and practice of computer science.

The goals of the course are listed below:

  1. Describe basic properties of sets, bags, tuples, relations, graphs, trees, and functions.
  2. Perform traversals of graphs and trees; construct simple functions by composition of known functions; determine whether simple functions are injective, surjective, or bijective; and classify simple functions by rate of growth.
  3. Describe the concepts of countable and uncountable sets, and apply the diagonalization method to construct elements that are not in certain countable sets.
  4. Construct inductive definitions for sets, construct grammars for languages (sets of strings), and construct recursive definitions for functions and procedures.
  5. Construct a topological sort of a partially ordered set and determine whether a partially ordered set is well-founded.
  6. Use elementary counting techniques to count simple finite structures that are either ordered or unordered, to count the worst case number of comparisons and, with discrete probability, to count the average number of comparisons for simple decision trees.
  7. Find closed form solutions for simple recurrences using the techniques of substitution, cancellation, and generating functions.
  8. Demonstrate standard proof techniques and the technique of inductive proof by writing short informal proofs about simple properties of numbers, sets, and ordered structures.

Intersection

Review of Basic Set Theory

You should have had an introduction to set theory by now. Let's do a little review before we take a look at our next topic.

Basic definitions for set theory.

Definition 1: A set is a well defined collection of objects, considered as an object itself. The objects making up the set are called elements or members of the set. There is no order to the elements and no multiplicity.

If a is an element of set X, then we write aXa \in X. And if not, we write aXa \notin X.

Sets are conventionally denoted with capital letters.

There is a set with no members, and it's called the empty set, denoted by \emptyset.

There are two ways of describing a set.

We often have the choice of specifying a set either intensionally or extensionally. For example: R={xR = \{x : xx is one of the first four positive integers}\}. So T=RT = R. We use a pipe, '\mid', or sometimes a colon to read "such that." Here are some more examples:

Review:

Definition 2: If XX and YY are sets and have the same elements, then they are identical. (Extensionality) The identity of sets are given by their extensions (the elements they contain). This definition gives us a common proof strategy for proving set identities.

Definition 3: If every element of XX is an element of YY, then XX is a subset of YY. We write XYX \subseteq Y.

It follows from this definition that every set is a subset of itself.

Also, it's possible for a set to be an element of another set.

If XYX \subseteq Y and Y̸XY \not\subseteq X then XYX \subset Y. In other words, if every element of XX is an element of YY, but not every element of YY is an element of XX, then we say that XX is a proper subset of YY.

Definition 4: The set consisting of all subsets of XX is called the power set of XX, written P(X)\mathscr{P} (X)

What are all the possible subsets of {a,b,c}\{a, b, c\}?

Definition 5: The union of XX and YY, written XYX \cup Y, is the set of all things which are elements of XX or YY or both.

XY={xX \cup Y = \{x : xXxY}x \in X \lor x \in Y\}

Venn diagrams can be useful to illustrate union and intersection.

Definition 6: The intersection of XX and YY, written XYX \cap Y, is the set of all things which are elements of both XX and YY.

Definition 7: If ZZ is a set of sets, then Z\bigcup Z is the set of elements of elements of ZZ.
Z={x\bigcup Z = \{x : xx belongs to an element of Z}Z\} or
Z={x\bigcup Z = \{x : there is a YZY \in Z such that xY}x \in Y\}

Definition 8: If ZZ is a set of sets, then Z\bigcap Z is the set of objects which all elements of ZZ have in common.
Z={x\bigcap Z = \{x : xx belongs to every element of Z}Z\} or
Z={x\bigcap Z = \{x : for all YZY \in Z, xY}x \in Y\}

Definition 9 The difference XYX \setminus Y is the set of all elements of XX which are not elements of YY.
XY={xX \setminus Y = \{x : xXx\in X and xY}x \notin Y\}

Important sets

B\mathbb{B} = Boolean values = {true,false}\{true, false\}
N\mathbb{N} = natural numbers = {0,1,2,3,...}\{0, 1, 2, 3, . . . \}
Z\mathbb{Z} = integers = {...,3,2,1,0,1,2,3,...}\{. . . , -3, -2, -1, 0, 1, 2, 3, . . . \}
Z+\mathbb{Z}+ = Z1\mathbb{Z}\geq 1 = positive integers = {1,2,3,...}\{1, 2, 3, . . . \}
R\mathbb{R} = set of real numbers
R+\mathbb{R}+ = R>0\mathbb{R} > 0 = set of positive real numbers
C\mathbb{C} = set of complex numbers
Q\mathbb{Q} = set of rational numbers

Interval Notation

We can use interval notation to describe subsets of sets upon which an order is defined, e.g., numbers.

Set Cardinality

Definition:
If there are exactly nn distinct elements in a set SS, where nn is a nonnegative integer, we say that SS is finite. Otherwise it is infinite.

Definition
The cardinality of a finite set SS, denoted by S|S|, is the number of
(distinct) elements of SS.

Examples:

Power Sets

Definition
The set of all subsets of a set SS is called the power set of SS.

Tuples

Ordered pairs, Tuples, and Cartesian Products

Sets have no order, but sometimes it is necessary to think of a collection in ordered terms. We use angle brackets to specify ordered pairs, such as x,y\langle x, y \rangle. Order matters so x,yy,x\langle x, y \rangle \neq \langle y, x \rangle.

Definition 10: Given sets XX and YY, their Cartesian product X×Y={x,yX \times Y = \{\langle x, y \rangle : xXx \in X and yY}y \in Y\}.

If X={0,1}X = \{0, 1\} and Y={1,a,b}Y = \{1, a, b\} what is X×YX \times Y?

Theorem 1 If XX has nn elements and YY has mm elements, then X×YX \times Y has nmn \cdot m elements.

Why is this the case?

Proof

For every element xx in X, there are mm elements of the form x,yX×Y⟨x,y⟩∈X×Y.
Let Yx=x,y:yYY_x = {⟨x,y⟩:y∈Y}.
Since whenever x1􏰁x2,x1,y􏰁x2,yx_1 \neq 􏰁x_2, ⟨x_1,y⟩ \neq 􏰁 ⟨x_2,y⟩, Yx1Yx2=Y_{x_1} \cap Y_{x_2} = ∅.
But if X=x1,...,xnX = {x_1,...,x_n}, then X×Y=Yx1YxnX×Y=Y_{x_1} ∪···∪Y_{x_n}, and so has nmn·m elements.

To visualize this, arrange the elements of X×YX×Y in a grid:
Yx1={x1,y1x1,y2...x1,ym}Y_{x_1} = \{⟨x_1,y_1⟩ ⟨x_1,y_2⟩ ... ⟨x_1,y_m⟩\}
Yx2={x2,y1x2,y2...x2,ym}Y_{x_2} = \{⟨x_2,y_1⟩ ⟨x_2,y_2⟩ ... ⟨x_2,y_m⟩\}
...
Yxn={xn,y1xn,y2...xn,ym}Y_{x_n} = \{⟨x_n,y_1⟩ ⟨x_n,y_2⟩ ... ⟨x_n,y_m⟩\}

Since the xix_i are all different, and the yjy_j are all different, no two of the pairs in this grid are the same, and there are nmn · m of them.

Russell's Paradox
In a village, the barber shaves everyone who does not shave themselves, and no one else.

The question that prompts the paradox is this: Does the barber shave himself?

Another Informal proof:
If XX has nn elements then P(X)\mathscr{P}(X) has 2n2^n elements.

proof Given an element $x$ of $S$, each subset of $S$ either includes $x$ or does not include $x$ (by definition of set), which gives us two possibilities. The same reasoning holds for any element of $S$. We can see that this means there are 2 * 2 * … * 2 = $2^{|S|}$ total possible combinations of elements of $S$.

Set Theory Exercises

  1. Which of these sets are equal?
    {x,y,zx, y, z}, {z,y,z,xz, y, z, x}, {y,x,y,zy, x, y, z}, {y,z,x,yy, z, x, y}

  1. List the elements of each set where N\mathbb{N} = {1,2,3,...1, 2, 3, ...}.
    (a) A=A = { xNx \in \mathbb{N} | 3<x<93 < x < 9}
    (b) B=B = { xNx \in \mathbb{N} | xx is even, x<11x < 11}

  1. Prove that BA=BAB \setminus A = B \cap \overline{A}
    (The complement of a set XX, X\overline{X} = {xx | xUx \in \mathbb{U} and xXx \notin X})

  1. Give some example sets that make the following statements true:
    (a) AB=ACA \cap B = A \cap C and BCB \neq C
    (b) DE=DFD \cup E = D \cup F and E=FE = F

  1. Prove that A(BC)=(AB)(AC)A \cap (B \cup C) = (A \cap B) \cup (A \cap C) (Set distributivity law)

  1. Determine the validity of the following argument, using a Venn diagram:

  1. Which of the following sets are identical?

A={xx24x+3=0}A = \{x | x^2 - 4x + 3 = 0\}

B={xx23x+2=0}B = \{x | x^2 - 3x + 2 = 0\}

C={xxN,x<3}C = \{x | x \in \mathbb{N}, x < 3\}

D={xxN,xD = \{x | x \in \mathbb{N}, x is odd, x<5}x < 5\}

E={1,2}E = \{1, 2\}

F={1,2,1}F = \{1, 2, 1\}

G={3,1}G = \{3, 1\}

H={1,1,3}H = \{1, 1, 3\}


  1. Find the power set P(A)\mathscr{P}(A) of A={{a,b},{c},{d,e,f}}A = \{\{a, b\}, \{c\}, \{d, e, f\}\}