+ All Categories
Home > Documents > Mathematical Preliminaries - Computer...

Mathematical Preliminaries - Computer...

Date post: 30-Apr-2020
Category:
Upload: others
View: 6 times
Download: 0 times
Share this document with a friend
59
Mathematical Preliminaries CSCI 2670 CSCI 2670 Mathematical Preliminaries
Transcript
Page 1: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Mathematical Preliminaries

CSCI 2670

CSCI 2670 Mathematical Preliminaries

Page 2: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Outline for Today

Material from Chapter 0.

I Sets

I Functions

I Relations

I Graphs

CSCI 2670 Mathematical Preliminaries

Page 3: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Sets

I A set is an unordered collection of objects. The objects in the setare called its elements or members.

I In writing, uppercase Roman letters and braces {...} indicate sets.

S = {1, 2, 3, 5, 8, 13, 21}

I a ∈ S (a 6∈ S) indicates a is (is not) a member of S .

I For sets too big to list, we use “. . .” or state a rule.I S = {2, 4, 6, 8 . . .}I T = {x |x is a positive, even integer}

I Order and repetition do not matter with sets.I {1, 3, 5, 7, 9} and {3, 1, 7, 9, 5} denote the same set.I {a, a, b, b, c , c} and {a, b, c} denote the same set.

CSCI 2670 Mathematical Preliminaries

Page 4: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Common Sets of Numbers

I N = {0, 1, 2, . . .}, the natural numbers.

I Z = {0,±1,±2, . . .}, the integers.

I Q = {pq | p ∈ Z and q ∈ Z, q 6= 0}, the rational numbers.

I R, the real numbers (numbers with infinite decimalrepresentations).

I Some authors use N,Z,Q,R.

I Some use superscripts: Z+ = {1, 2, . . .} (the positive integers).

I Some don’t consider 0 a natural number.

CSCI 2670 Mathematical Preliminaries

Page 5: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Subsets and Supersets

I If all members of A are members of B, then A is a subset of B.I A ⊆ B: A is a subset of B.I A * B: A is not a subset of B.

I If A ⊆ B, then B is a superset of A.

I If A ⊆ B and B ⊆ A, then A = B.

I If A ⊂ B and A 6= B, then A is a proper subset of B.

I Observe that for any set S , S ⊆ S and S 6⊂ S .

CSCI 2670 Mathematical Preliminaries

Page 6: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Subsets and Supersets

I The empty set ∅ (or ∅, or {}) is the set with no members.I For any set S , ∅ ⊆ S .

I Note: {∅} 6= ∅.

I List all of the proper subsets of the following:I {a}I {a, b}I {a, b, c}I {{a, {b}, {c}}I ∅

CSCI 2670 Mathematical Preliminaries

Page 7: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Cardinality

I The cardinality |S | of set S is the number of elements in S .

I For finite sets, |S | will be an integer.

S = ∅ |S | = 0S = {a, a, a} |S | = 1S = {a, b, c} |S | = 3S = {{a}, {b, c}} |S | = 2S = {x | x ∈ N} |S | is “countably infinite”

CSCI 2670 Mathematical Preliminaries

Page 8: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Powersets

I The powerset P(S) of set S is the set of all subsets of S .

I In general, if |S | = n, then |P(S)| = 2n.

S |S | P(S) |P(S)|∅ 0 ? ?{a} 1 ? ?{a, b} 2 ? ?{a, b, c} 3 ? ?{a, b, c , d} 4 ? ?

CSCI 2670 Mathematical Preliminaries

Page 9: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Powersets

I The powerset P(S) of set S is the set of all subsets of S .

I In general, if |S | = n, then |P(S)| = 2n.

S |S | P(S) |P(S)|∅ 0 {∅} 1{a} 1 {∅, {a}} 2{a, b} 2 {∅, {a}, {b}, {a, b}} 4{a, b, c} 3 {∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}} 8{a, b, c , d} 4 {∅, {a}, {b}, {c}, {d}{a, b}, {a, c}, {a, d}, {b, c},

{b, d}, {c , d}, {a, b, c}, {a, b, d}, {a, c , d}, 16{b, c , d}, {a, b, c , d}}

CSCI 2670 Mathematical Preliminaries

Page 10: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

ordered n-tuples

I Let a1, a2, . . . an be elements of a set.

I An ordered list of these elements is a sequence.

I (a1, a2, . . . , an) is called an ordered n-tuple.

I (ai , aj) is an ordered pair.

I The order of the elements matters.I (ai , aj) = (aj , ai ) if and only if ai = aj .I If ai 6= aj , then (ai , aj) 6= (aj , ai ).

I In a sequence or n-tuple, repetitions can occur: (1,1,2,3,5,8).

CSCI 2670 Mathematical Preliminaries

Page 11: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Cartesian Products

I A× B is the Cartesian product (cross product) of sets A and B.

A× B = {(a, b)| a ∈ A and b ∈ B}

I N-ary Cartesian product: If A1, . . ., An are sets,

A1 × . . .× An = {(a1, . . . , an)| ai ∈ Ai for each i = 1, . . . , n}

I An is shorthand for A× A× . . .× A.

I Note that × is not commutative or associative.I A× B 6= B × A.I A× (B × C ) 6= (A× B)× C .

CSCI 2670 Mathematical Preliminaries

Page 12: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Cartesian Products

I Let A = {a, b, c} and B = {0, 1}

I What is A× A, A× B, B × A, and B × B.

I Let R be the set {(1, 1)}. Is R a subset of any of the above?

I Let R be the set {(b, 1), (1, 1)}. Is R a subset of any of the above?

CSCI 2670 Mathematical Preliminaries

Page 13: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Venn Diagrams

I Sets can be represented using Venn diagrams.

I A rectangle represents U, the universal set (the set of everything).

I Sets are drawn using closed shapes inside of U.

I Points inside each shape represent elements of the set.

I (We may cross out a region to indicate that it is empty).

I bob ∈ A, A ⊂ U.

CSCI 2670 Mathematical Preliminaries

Page 14: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Venn Diagrams

I Draw a Venn diagram showing that A ⊆ B.

I Draw a Venn diagram showing that A * B.

I Draw a Venn diagram showing that A * B and B * A.

I Draw a Venn diagram showing that A ⊆ B and A ⊆ C but B 6= C .

CSCI 2670 Mathematical Preliminaries

Page 15: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Set Operations

I Union: A ∪ B = {x |x ∈ A OR x ∈ B}

I Intersection: A ∩ B = {x |x ∈ A AND x ∈ B}I If A ∩ B = ∅, then A and B are disjoint.

I Set Difference: A− B = {x |x ∈ A AND x /∈ B}

I Complement: A = U − A

CSCI 2670 Mathematical Preliminaries

Page 16: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Generalized Union and Intersection

Let A1, A2, . . ., An be sets.

I

n⋃i=1

Ai = A1 ∪ A2 ∪ . . . ∪ An

I

n⋂i=1

Ai = A1 ∩ A2 ∩ . . . ∩ An.

Example: Let A1 = {1, 2, 3}, A2 = {3, 4, 5}, A3 = {1, 3, 6}.

I

3⋃i=0

Ai = {1, 2, 3, 4, 5, 6}

I

3⋂i=0

Ai = {3}

CSCI 2670 Mathematical Preliminaries

Page 17: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Questions

Let U = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A = {1, 2, 3, 4, 5}, B = {0, 3, 6}.What is:

I A ∪ B

I A ∩ B

I A− B

I B − A

I A

I U

I A ∩ U

CSCI 2670 Mathematical Preliminaries

Page 18: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Functions

I Let A and B be nonempty sets.

I A function f from A to B (f : A→ B) is an assignment of exactlyone element in B to each element in A.

I A is the domain of f .I B is the codomain of f .I {f (a)|a ∈ A} is the range of f .

I f is sometimes called a map, mapping, or transformation.

I If a ∈ A, f (a) denotes the element in B assigned to a.

I If f : A→ B is defined for each a ∈ A, then f is a total function.

I If there is an a ∈ A with f (a) undefined, f is a partial function.

I Functions can be written in prefix notation—g(x , y)—or infixnotation—x + y .

CSCI 2670 Mathematical Preliminaries

Page 19: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Functions

I Given function f : A→ B:I A = {a, b, c , d}.I B = {0, 1, 2, 3}.

a f (x)

a 1b 0c 0d 1

I What’s the domain of f ?

I What’s the codomain of f ?

I What’s the range of f ?

I How would you represent f as a set?

CSCI 2670 Mathematical Preliminaries

Page 20: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Injective, Surjective, and Bijective Functions

Let f : A→ B be a function. f isI injective (one-to-one) if and only if each element of A gets

mapped to a unique element of B.

I surjective (onto) if and only if the codomain of f equals therange of f .

I bijective (a one-to-one correspondence) if it is injective andsurjective.

Important! if f : A→ B is bijective, then |A| = |B|.Is this function bijective? Assume A = {a, b, c , d} and B = {0, 1, 2, 3}.

a f (x)

a 1b 0c 0d 1

CSCI 2670 Mathematical Preliminaries

Page 21: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Which are Bijective?

I Assume f : R→ R.I f (x) = 3x

I f (x) = sin(x) + 20

I f (x) = x2 + 1

I f (x) = x3

I What if f : R+ → R+?

I Suppose g : N→ R. Can g be bijective?

CSCI 2670 Mathematical Preliminaries

Page 22: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Unary, Binary, k-ary Functions

I f : A→ B is a unary function (it has one input).

I f : A1 × A2 → B is a binary function (it has two inputs).I It maps ordered pairs from A1 × A2 to elements of B.

I f : A1 × A2 × . . .× Ak → B is a k-ary (or arity k) function (ithas k inputs).

I It maps ordered k-tuples from A1 × A2 × . . .× Ak to elements of B.

I Finite binary functions can be represented using a table.

I Let A = {1, 2, 3} and B = {2, 5}. Define f : A× B → N as:

f 2 5

1 2 52 4 103 6 15

CSCI 2670 Mathematical Preliminaries

Page 23: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Relations

I A subset of A1 × A2 × . . .× Ak is a k-ary relation.

I Alternatively, a relation can be viewed as a function:

A1 × A2 × . . .× Ak → {TRUE ,FALSE}.

I A function whose codomain is {TRUE ,FALSE} is sometimescalled a predicate (sometimes a property).

I E.g., ≤ is a binary relation on R × R .

I As a set, (4, 4) ∈≤.

I As a function, ≤ (4, 4) = TRUE , but ≤ (5, 4) = FALSE .

CSCI 2670 Mathematical Preliminaries

Page 24: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Equivalence Relations

I Let A be a set.

I An equivalence relation R on A is a relation R ⊆ A× A that is

I reflexive: For each x ∈ A, (x , x) ∈ R.

I symmetric: For each x , y ∈ A, if (x , y) ∈ R, then (y , x) ∈ R.

I transitive: For each x , y , z ∈ A, if (x , y) ∈ R and (y , z) ∈ R, then(x , z) ∈ R.

I “=” is obviously an equivalence relation.

I So is “has the same mother as”.

CSCI 2670 Mathematical Preliminaries

Page 25: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Equivalence Relations

I An equivalence relation R on A is a relation R ⊆ A× A that is

I reflexive: For each x ∈ A, (x , x) ∈ R.

I symmetric: For each x , y ∈ A, if (x , y) ∈ R, then (y , x) ∈ R.

I transitive: For each x , y , z ∈ A, if (x , y) ∈ R and (y , z) ∈ R, then(x , z) ∈ R.

I Consider the following relation: x ≡7 y if and only if x − y is amultiple of 7.

I Is this an equivalence relation?

CSCI 2670 Mathematical Preliminaries

Page 26: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Outline for Today

Material from Chapter 0.

I Graphs

I Recursive Definitions

I Strings and languages

I Logic

I Proofs

For Next Week: Read Ch 1 (Sec 1.1-1.2)

CSCI 2670 Mathematical Preliminaries

Page 27: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Graphs

I A graph G = (V ,E ) consists ofI a nonempty set V of vertices (or nodes) and

I a set E of edges (represented as pairs of vertices from V).

I In an undirected graph, the pairs are unordered—e.g., {u, v}. In adirected graph, the pairs are ordered—e.g., (v , u).

I A loop is an edge that connects one vertex to itself.

I A graph is simple if it there are no duplicate edges between nodes.

I Let G = ({v1, v2, v3, v4}, {{v1, v2}, {v1, v3}, {v1, v4}, {v3, v4}})

CSCI 2670 Mathematical Preliminaries

Page 28: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Subgraphs

I If G1 = (V1,E1) and G2 = (V2,E2) are graphs such that V2 ⊆ V1

and E2 ⊆ E1, then G2 is a subgraph of G1.

I H = ({v1, v3, v4}, {{v1, v3}, {v1, v4}, {v3, v4}}) is a subgraph of G.

CSCI 2670 Mathematical Preliminaries

Page 29: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Degree of Vertices

I In an undirected graph, the degree deg(v) of a vertex v is thenumber of edges incident with it (loops count twice).

I Above, the deg(v2) = 3, and deg(v3) = 2.

CSCI 2670 Mathematical Preliminaries

Page 30: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Degree of Vertices

I In a directed graph, edges are ordered and indicated using arrows.

I The indegree deg−(v) of v is the number of incoming edges.

I The outdegree deg+(v) of v is the number of outgoing edges.

I Above, the deg−(a) = 0 but deg+(a) = 2.

CSCI 2670 Mathematical Preliminaries

Page 31: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Paths in Undirected Graphs

I A path from u to v in an undirected, simple graph is a sequence ofvertices v1, v2, . . . , vn such that u = v1 and v = vn, and for each vi < vn,{vi , vi+1} is an edge. A circuit (cycle) is a path in which u = v .

I A path is simple if no vertex is repeated.

I A circuit is simple if n > 2, v1 = vn, but no other vertex is repeated.

I A graph is connected if there is a path connecting every two vertices.

I The above graph is connected.

CSCI 2670 Mathematical Preliminaries

Page 32: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Trees

I A connected graph without simple cycles is called a tree.

I Each pair of distinct nodes is connected by exactly one simple path.

I A specific node might be designated the root.

I The nodes of degree 1 (other than the root) are leaves.

CSCI 2670 Mathematical Preliminaries

Page 33: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Paths in Directed Graphs

I A path from u to v in a directed graph G = (V ,E ) is a sequence ofvertices v1, v2, . . . , vn such that u = v1 and v = vn, and for each vi < vn,(vi , vi+1) ∈ E .

I G is strongly connected if a directed path connects any two distinctvertices.

I If the underlying undirected graph is connected, G is weakly connected.

I The above graph is not strongly connected.

CSCI 2670 Mathematical Preliminaries

Page 34: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Directed Graphs

Draw the following directed graph G = (V ,E ), where

1. V = {1, 2, 3, 4, 5, 6}, and

2. E = {(1, 2), (1, 5), (2, 1), (2, 4), (5, 4), (5, 6), (6, 1), (6, 3)}

Is it strongly connected?

CSCI 2670 Mathematical Preliminaries

Page 35: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Recursive Definitions

I An infinite set S can be defined recursively.I Basis: A finite number of items is first specified to be in S .

I Recursive Step: A set of operations generates additional membersof S from previously defined members of S .

I A closure condition ensures only objects defined in the basis or viafinite number of applications of the operations are members of S .

CSCI 2670 Mathematical Preliminaries

Page 36: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Recursive Definitions

I A recursive definition of N:I Basis: 0 ∈ N.

I Recursive Step: If n ∈ N, then s(n) ∈ N.

I Only 0 and objects generated by a finite number of applications of sare in N.

I A recursively defined set S can be associated with a sequence ofsets S0, S1, S2 . . ..

I S0: the basis of S .

I Si+1: Si together with items generated by a single application ofoperations in the recursive step.

CSCI 2670 Mathematical Preliminaries

Page 37: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Strings and Languages

I An alphabet is a nonempty, finite set of objects (symbols).I Σ and Γ are usually used to indicate alphabets.

I For instance, Σ1 = {a, b, c , d , e, f }, Σ2 = {0, 1}

I A string over Σ is any finite sequence of symbols from Σ.I 0, 101, and 0101111 are strings over Σ = {0, 1}.I The length |w | of a string w is the number of symbols in w .

I |0| = 1, |101| = 3, and |0101111| = 7.

I We refer to the symbols of w by their index: w = w1w2w3 . . ..

I The empty string ε (or λ) consists of no symbols; |ε| = 0.

I wR = wn . . .w2w1 is the reverse of w = w1w2 . . .wn.

I A consecutive sequence of symbols of w is a substring of w .

CSCI 2670 Mathematical Preliminaries

Page 38: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Strings and Languages

I Let x = x1 . . . xn and y1 . . . ym be strings over some alphabet.

I xy = x1 . . . xny1 . . . ym is the concatenation of x and y .I Σ = {0, 1},I x = 01, y = 001.

I xy = 01001, yx = 00101.

I If w is a string and k ∈ N, then wk is the concatenation of k w ’s.

I If w = 001, then w3 = 001001001.

I Note: w0 = ε for any string w .

CSCI 2670 Mathematical Preliminaries

Page 39: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Σ∗ and Languages

I Let Σ be some alphabet.

I Σ∗ is the set of strings defined as follows:I Basis: ε ∈ Σ∗.

I If w ∈ Σ∗ and a ∈ Σ, then wa ∈ Σ∗.

I Nothing not in the basis or else formed by a finite number ofapplications of the above rule is a member of Σ∗.

I A language L over an alphabet Σ is any subset of Σ∗.

I (In other words, a language is a set of strings).

CSCI 2670 Mathematical Preliminaries

Page 40: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Σ∗ and Languages

I Provide a recursive definition for the language consisting of allstrings representing even binary numbers.

I Provide a recursive definition for the language consisting of allstrings representing odd binary numbers.

I Provide a recursive definition for the language of all bit strings thatread the same forwards and backwards.

CSCI 2670 Mathematical Preliminaries

Page 41: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Boolean (Propositional) Logic

The language of Boolean logic uses the following alphabet.

I Propositional Variables: p, q, r , etc., with/without subscripts.

I The Logical Connectives (operators):Negation ¬ NOTConjunction ∧ ANDDisjunction ∨ ORExclusive Disjunction ⊕ XORImplication → IF...THENBiimplication ↔ IF AND ONLY IF

I Grouping Symbols ‘(’ and ‘)’.

CSCI 2670 Mathematical Preliminaries

Page 42: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Boolean (Propositional) Logic

I Well-formed formulas (wffs) of the logic are defined as follows:I If p is a propositional variable, then p is a wff.

I If p is a wff, then ¬p is a wff.

I If p and q are wffs, then the following are all wffs:

I (p ∧ q), (p ∨ q), (p ⊕ q), (p → q), (p ↔ q)

I No other strings are wffs.

I Note that this is language in the sense described earlier.

I Note also that the wffs are defined recursively.

CSCI 2670 Mathematical Preliminaries

Page 43: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Boolean (Propositional) Logic

I The propositional variables range over {0, 1}.

I The below tables allow values to be assigned to every wff.

p q (p ∧ q) (p ∨ q) (p ⊕ q) (p → q) (p ↔ q)

1 1 1 1 0 1 11 0 0 1 1 0 00 1 0 1 1 1 00 0 0 0 0 1 1

p ¬p1 00 1

A formula p is satisfiable if it is possible to assign 0 and 1 to itspropositional variables such that p evaluates to 1.

CSCI 2670 Mathematical Preliminaries

Page 44: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Proofs: Terminology

I An axiom is a proposition that is taken as true without question.

I A theorem is a proposition that has been proven to be true (it hasbeen shown to deductively follow from definitions and axioms).

I A corollary is a proposition that trivially follows from a theorem.

I A lemma is a minor theorem, usually needed in the proof of moreimportant theorems.

I A conjecture is a proposition that has been claimed to be true butnot proven.

CSCI 2670 Mathematical Preliminaries

Page 45: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Conditional Proofs

I Many mathematical claims are of the form “If P, then Q”.

I One way of proving such a claim is to first assume that P is true,and then show that Q must also be true.

I In the proof, you may only use definitions, axioms, the assumptionof p, as well as any other statements that have already beenproven.

I This is called a conditional proof or direct proof.

CSCI 2670 Mathematical Preliminaries

Page 46: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Proof Strategies: Conditional Proof

Claim: Let A and B be sets. If x ∈ A ∪ B, then x ∈ A ∩ B.

CSCI 2670 Mathematical Preliminaries

Page 47: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Proof Strategies: Conditional Proof

Let A and B be sets. If x ∈ A ∪ B, then x ∈ A ∩ B.

Proof.Suppose x ∈ A ∪ B. By definition of set complements, x /∈ A ∪ B. Bydefinition of A ∪ B, x /∈ A and x /∈ B. Because of this (again using thedefinition of set complements), x ∈ A and x ∈ B. According to thedefinition of set intersection, x ∈ A ∩ B

CSCI 2670 Mathematical Preliminaries

Page 48: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Proofs of Biconditionals/Equality

I To prove “P if and only if Q”, perform two proofs:

I the forward direction (Left-to-Right): “If P, then Q”.

I the reverse direction (Right-to-Left): “If Q, then P”.

I E.g. “x ∈ A ∪ B if and only if x ∈ A ∩ B.”I Show x ∈ A ∪ B implies x ∈ A ∩ B, and

I Show x ∈ A ∩ B implies x ∈ A ∪ B.

I Many proofs for equality are implicitly biconditional proofs.

I E.g., to prove A ∪ B = A ∩ B, you prove the bi-conditional above.

CSCI 2670 Mathematical Preliminaries

Page 49: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Existence proofs: Constructive

I Some mathematical propositions claim the existence of something.

I In a constructive proof, the claim is proven by actually exhibitingor constructing the object.

I Claim: There exists an even prime number.

I Proof: It’s 2.

CSCI 2670 Mathematical Preliminaries

Page 50: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Existence proofs: Nonconstructive

In a nonconstructive proof, the claim is proven, but no object isconstructed or presented.

Claim: There exist irrational numbers x and y such that xy is rational.(Consider a = b =

√2).

CSCI 2670 Mathematical Preliminaries

Page 51: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Existence proofs: Nonconstructive

In a nonconstructive proof, the claim is proven, but no object isconstructed or presented.

Claim: There exist irrational numbers x and y such that xy is rational.(Consider a = b =

√2).

Proof.Let a = b =

√2 (note that

√2 is irrational). ab is either rational or it’s not.

We consider each case.

1. If ab is rational, then the claim is proven.

2. If ab is irrational, then let c = ab =√

2√2. ca = (

√2√2)√2 =

√2√2∗√2

=√

22

= 2. And so ca is rational.

Either way, there exist irrational x and y such that xy is rational.

This is a proof by cases. We haven’t ascertained which case obtains,and so we haven’t actually provided a specific x , y proving the claim.

CSCI 2670 Mathematical Preliminaries

Page 52: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Proof by Contradiction

In a proof by contradiction, to prove P, one shows that ¬P implies acontradiction.

Claim:√

2 is irrational.

CSCI 2670 Mathematical Preliminaries

Page 53: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Proof by Contradiction

In a proof by contradiction, to prove P, one shows that ¬P implies acontradiction.

Claim:√

2 is irrational.

Proof.Suppose for a proof by contradiction that

√2 is rational. Then there

exist integers a and b with b 6= 0 such that√

2 = ab . We can assume

without loss of generality that either a or b is odd, since if they areboth even ( a

b = 2c2d ), we can reduce the fraction further.

Squaring both sides of√

2 = ab yields 2 = a2

b2. And so a2 = 2b2. So a2

is even, which implies that a is even (a = 2k for some integer k). Assuch, a2 = (2k)2 = 4k2 = 2b2, and so 2k2 = b2, which means that b2

and hence b is even. A contradiction! We conclude that√

2 isirrational.

CSCI 2670 Mathematical Preliminaries

Page 54: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Proof by Induction

I Induction may be used to prove each n ∈ N, n > b, has aproperty P.

I Inductive proofs have two parts:I Basis: P(b) is shown to hold.

I Induction: P(k) is assumed to hold (this is the inductivehypothesis), and it is then shown that P(k + 1) must also hold..

I strong induction: In this variant of induction, the inductivehypothesis instead assumes P(j) holds for all j ≤ k .

CSCI 2670 Mathematical Preliminaries

Page 55: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Proof by Induction

Claim: For every integer n > 3, 2n < n!.

CSCI 2670 Mathematical Preliminaries

Page 56: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Proof by Induction

Claim: For every integer n > 3, 2n < n!.

Proof.

I Basis: 24 = 16, and 4! = 4× 3× 2 = 24, and so the claim holdsfor n = 4.

I Induction: Suppose the claim holds for n = k , where k > 2. Then2k < k!. As such, 2(2k) < 2(k!), that is 2k+1 < 2k!. Since 2 < k ,it follows that 2 < k + 1 and so 2k! < (k + 1)k!. From this,2k+1 < (k + 1)!, which is what we wanted to show.

CSCI 2670 Mathematical Preliminaries

Page 57: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Proof by Induction

Claim: Every integer n > 1 is either prime or else equal to a product ofprimes. (Note that if n is not prime, then by definition there existintegers 1 < a, b < n such that n = ab.)

CSCI 2670 Mathematical Preliminaries

Page 58: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Proof by Induction

Claim: Every integer n > 1 is either prime or else equal to a product ofprimes. (Note that if n is not prime, then by definition there existintegers 1 < a, b < n such that n = ab.)

Proof.

I Basis: 2 is prime.

I Induction: Suppose the claim holds for all 2 ≤ n ≤ k and consider k + 1.k + 1 is either prime or not. If k + 1 is prime, then the claim clearlyholds. So suppose that k + 1 is not prime. Then there exist integers1 < a, b < k + 1 such that k + 1 = ab. Since a < k + 1 and b < k + 1,it follows by the inductive hypothesis that each is either prime or elseequal to a product of primes. And so k + 1 is itself equal to a product ofprimes.

Note that this is an example of strong induction. The inductivehypothesis assumes the claim holds for all integers ≤ k and then theproof shows that the claim must also hold for k + 1.

CSCI 2670 Mathematical Preliminaries

Page 59: Mathematical Preliminaries - Computer Sciencecobweb.cs.uga.edu/~potter/theory/1_preliminaries.pdf · Functions I Let A and B be nonempty sets. I A function f from A to B (f : A !B)

Structural Induction (general idea)

I Suppose that P is some property, and we want to show that everywff of propositional logic has property P.

I Basis: We show that every atomic proposition has property P.I Induction: We then show that if p and q have property P (where p

and q are arbitrary), then ¬p, (p ∧ q), (p ∨ q), (p ∨ q), (p → q),and (p ↔ q) have property P.

I This is also a form of induction, one that leverages a recursivedefinition of a set.

I Here, we show that every possible application of a rule for wffsensures that the resulting expression has property P.

CSCI 2670 Mathematical Preliminaries


Recommended