dva337 – lecture 2

DVA337 – LECTURE 2
Set theory and induction
LAST TIME
NAIVE SET THEORY
SET
A set is an unordered collection of elements, for which membership is decidable
 { 1, 2, 3 }
 { blue, green, red }
Let capital letters S, T denote sets
Membership, x ∈ S
 2 ∈ { 1, 2, 3 }
 4 ∉ { 1, 2, 3 }
We will exclusively work with sets of numbers, but sets can contain (almost) anything
SOME IMPORTANT SETS
∅, the empty set, also written { }
ℕ, the set of natural numbers
ℤ, the set of integers
ℚ, the set of rational numbers
ℝ, the set of real numbers
ℂ, the set of complex numbers
In general we use capital letters or names for sets.
FORMING SETS
Sets can be formed by listing the elements
 { 1, 2, 3 }
 { 1, ..., 10 }
 { 1, 2, 3, ... }
Sets can be formed from other sets
 by union, intersection, difference, and complement
 by selecting elements
 by applying a function to the elements
FORMING SETS
Selecting elements from existing sets, { x : conditions on x }
 { n : n ∈ ℕ, even(n) }
 { n : n ∈ ℕ, ∀m ∈ ℕ . m | n → m = 1 ∨ m = n }
Applying a function to the element of existing sets { f(x) : conditions on x }
 { n2 : n ∈ ℕ }
Can be used in combination
 { n2 : n ∈ ℕ, even(n) }
SET OPERATIONS
Subset, S ⊆ T
 { 1, 2 } ⊆ { 1, 2, 3 }
 { 1, 2, 3 } ⊆ { 1, 2, 3 }
Equality, S = T
 A set is an unordered collection of elements
 { 1, 2 } = { 2, 1 }
 { 1, 1, 2 } = { 1, 2 }
Proper subset, S ⊂ T
 { 1, 2 } ⊂ { 1, 2, 3 }
 { 1, 2, 3 } ⊄ { 1, 2, 3 }
Can we define those as predicates in terms of each other and membership?
VENN DIAGRAMS
Venn diagrams shows relationships between sets
 Sets represented by circles
 Relative sizes of circles represent relative sizes of sets
 Overlap between circles represent common elements
Venn diagram for (proper) subset, S ⊂ T
SET OPERATIONS
Union, S ∪ T
 The set of elements that are in S or T
 { 1 } ∪ { 2, 3 } = { 1, 2, 3 }
 { } ∪ { 1, 2 } = { 1 , 2 }
Intersection, S ∩ T
 The set of elements that occur in both S and T
 { 1 } ∩ { 2, 3 } = ∅
 { 1, 2, 3 } ∩ { 1, 2, 3 } = { 1, 2 }
Venn diagrams and definitions?
SET OPERATIONS
Difference, S ∖ T
 The set of elements in S that are not in T
 { 1, 2, 3 } ∖ { 2 } = { 1, 3 }
Complement, S∁
 The set of elements not in S
 Relative a universe U, the set of all elements
 { 1, 2, 3 }∁ = { 4, 5, ... }
Venn diagram and definitions?
LAWS
Commutative
 A ∪ B =B ∪ A
A∩B=B∩A
Associative
 (A ∪ B) ∪ C = A ∪ (B ∪ C)
 (A ∩ B) ∩ C = A ∩ (B ∩ C)
Distributive
 A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
 A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
...
CARDINALITY
The cardinality of a set, |S|, is the number of elements in the set
 |∅| = 0
 |{ 2 }| = 1
 |{ 1, 2, 3 }| = 3
Simple for finite sets
More interesting for infinite sets
 Probably later in the course
POWER SET
The power set of a set P(S) is the set of all subsets of the set
 P({ 1 }) = { ∅, { 1 } }
 P({ 1, 2 }) = { ∅, { 1 }, { 2 }, { 1, 2 } }
Can you define the power set as a set comprehension
What is the power set of ∅?
SYSTEMATIC CONSTRUCTION OF POWER SET
What is the power set of { ∅, 1, 2 }?
How can we describe this way of building?
ORDERED PAIRS
Let s ∈ S and t ∈ T and let (s,t) denote an ordered pair
 where s is the first element and t the second
How can we define what an ordered pair is?
 can we encode ordered pairs in term of sets?
What is the important property?
An n-tuple is an ordered ‘pair’ with n elements (s1, s2, ... , sn)
 A pair is a 2-tuple
 can we encode n-tuples in terms of sets? in terms of pairs?
CARTESIAN PRODUCT
The Cartesian product of two sets S × T
is the set of all pairs
 { 1 } × { a } = { (1, a) }
 { 1, 2 } × { a } = { (1, a), (2, a) }
What is { 1, 2 } × { a, b }
Can you define the Cartesian product as
a set comprehension?
EXERCISE, CARTESIAN PRODUCT
What is the Cartesian product of the sets, S × T × U
Can you generalize to a product of n sets?
RELATIONS
A binary relation is a relation between two things
 R(x,y) : x > y
How can binary relations be represented as sets?
RELATIONS
For two set S and T how many binary relations exist between them?
FUNCTIONS
A function f : A → B is a mapping between two sets
 the domain A and the range B
A function can be seen a special case of a relation, how?
EXERCISE, FUNCTIONS
Define f(x,y) = x + y + 1 set theoretically
PROOFS
selected techniques
PROOFS
There are many different methods for proving.
Have already seen a few proofs, e.g.,
Proof that p ∧ (p → q) ⇒ q, by case analysis
Proof that p ∧ (p → q) ∧ (q → r) ∧ (r → s) ⇒ s, by deduction
SELECTED PROOF METHODS
Proof by case analysis
Proof by deduction
Proof by construction
Proof by induction
Proof by contradiction
PROOF BY CONSTRUCTION
A proof by construction is a proof that demonstrates the existence of a mathematical
objects by
 constructing the objects, or
 describing a way to construct the objects
For instance, we can prove statements of the form ∃x P(x) by
 constructing the object, o, and
 showing that P(o) holds
DEFINITION: K-REGULAR GRAPHS
In a graph, the degree of the node is the
number of edges of the node
A k-regular graph is a graph where are
nodes in the graph have degree k
EXERCISE, K-REGULAR GRAPH
Theorem: There exists a 3-regular graph with 4 nodes
Proof: By construction.
EXERCISE, QUADRATIC EQUATIONS
Theorem: Every quadratic equation, ax2 + bx + c = 0, has at least one solution.
Proof: By construction.
EXAMPLE, K-REGULAR GRAPHS
Theorem: For each even number n > 2, there exists a 3-regular graph with n nodes
Proof: By construction. Show how to construct such graph for any n.
PROOF BY CONSTRUCTION
We have seen two different types of proofs by construction
To prove the existence of an object with a certain property, we
 construct the object, and
 prove that the constructed object has the desired property.
To prove the existence of many (potentially infinitely many) objects, we
 construct method for constructing them, and
 prove that method constructs objects with the desired property.
PROOF BY CONTRADICTION
Proofs so far have been direct proofs
A proof by contradiction is an indirect proof; it relies on the fact that it suffices to
prove that ¬p must be false to reach the conclusion p. (Why?)
To prove φ by contradiction, assume that ¬φ is true and derive a contradiction, thus
proving that the assumption that ¬φ is true must be false.
PROOF BY CONTRADICTION
Theorem: There are infinitely many prime numbers.
Proof: By contradiction.
EXERCISE, PROOF BY CONTRADICTION
Prove modus tollens: ¬q ∧ (p → q) ⇒ ¬p
INFINITE SETS
construction and proof principles
INFINITE SETS
So far we have only seen how to construct finite sets
We have postulated the existence of infinite ones
 which ones?
How can we create infinite sets?
NATURAL NUMBERS
0 is a natural number
if n is a natural number then S(n) is a natural number
By repeating the process infinitely many times you get a set X, s.t.,
0∈X
 ∀x . x ∈ X → S(x) ∈ X
This is the set of natural numbers, ℕ
ℕ is the smallest set that is closed under the successor operation.
INDUCTIVE SETS
Imagine an operation on sets F(X) = { 0 } ∪ { S(x) : x ∈ X }
What is the result of iterating the operation as follows
 X0 = { }
 Xn = F(Xn-1)
What is F(ℕ)?
INDUCTIVE SETS
For any monotone operation F on sets gives rise to an inductive set
 the smallest fixed point of F
The set of natural numbers was generated by
 F(X) = { 0 } ∪ { x + 1 : x ∈ X }
Which set is generated by
 F(X) = { p, q, r, ... } ∪ { ¬ x : x ∈ X } ∪ { x ∧ y : x, y ∈ X }
THE SET OF PROPOSITIONAL FORMULAS
F(X) = { p, q, r, ... } ∪ { ¬ x : x ∈ X } ∪ { x ∧ y : x, y ∈ X } ∪ ...
PROPERTIES OF INFINITE SETS
Imagine we want to prove that 1 + 2 + ... + n = n (n + 1) / 2 for all n ∈ ℕ
1 = 1 (1 + 1) / 2 = 2 / 2
1 + 2 = 2 (2 + 1) / 2 = 6 / 2 = 3
...
How can this be done?
INDUCTIVE PROOFS
We want to prove ∀n ∈ ℕ . P(n) for P(n) : 0 + 1 + 2 + ... + n = n (n + 1) / 2
Use the inductive structure of ℕ given by F(X) = { 0 } ∪ { x + 1 : x ∈ X }
1) Prove that the proper holds for all base cases
 P(0)
2) Prove that the successor function maintains the property
 If we assume that P(n) show that P(n+1) must hold
3) We conclude that ∀n ∈ ℕ . P(n)
INDUCTIVE PROOFS
We want to prove ∀n ∈ ℕ . P(n) for P(n) : 0 + 1 + 2 + ... + n = n (n + 1) / 2
Use the inductive structure of ℕ given by F(X) = { 0 } ∪ { x + 1 : x ∈ X }
We have P(0), and ∀n . P(n) → P(n+1)
EXAMPLE PROOF
Prove ∀n ∈ ℕ . P(n) for P(n) : 0 + 1 + 2 + ... + n = n (n + 1) / 2
INDUCTION PRINCIPLE
For natural numbers
To prove ∀n ∈ ℕ . P(n) it suffices to prove
1. The base case, P(0)
2. The inductive step, ∀n . P(n) → P(n+1)
EXERCISE, PROVE BY INDUCTION
The cardinality of the power set, |P(S)| = 2|S|
STRONG INDUCTION
Sometimes the induction step ∀n . P(n) → P(n+1) cannot be proved – the assumption
P(n) may be too weak.
However, we saw that P(n) holds for all n up to and including n, which gives us a more
powerful version of induction, called strong induction.
To prove ∀n ∈ ℕ . P(n) by strong induction it suffices to prove
1. The base case, P(0)
2. The inductive step, ∀n . (∀m . m ≤ n . P(n)) → P(n+1)
GENERALIZING THE PRINCIPLE
Every inductively defined set has an induction principle
What is the principle associated with
 F(X) = { p, q, r, ... } ∪ { -x : x ∈ X } ∪ { x + y : x, y ∈ X }
PROVING
We have seen a selection of possible proof methods
 many more exists
More complex proofs consist of a combination of different methods
 we may use deductive reasoning in an inductive proof
 ...
We will use different techniques when doing proofs in the course
 You need to have a basic understanding and proficiency with the different techniques
 Familiarize yourselves – we don’t want to have to spend energy on understanding our tools later on in
the course