Foundations of Computer Science Spring 2017 Equivalence Relation, Recursive Definition, and Mathematical Induction Mathematical Preliminaries Mohammad Ashiqur Rahman Department of Computer Science College of Engineering Tennessee Tech University
Equivalence Class R instead of R is an equivalence relation over A The equivalence class of an element x A is defined by R is the set [x] R = {y A x R y}. A Problem: P is the parity relation over N. x P y, iff x, y N have the same parity (even or odd). Prove that P is an equivalence. [0] P =? [1] P =? Are [0] P and [2] P are equal?
Lemma Over Equivalence Relation If R be an equivalence relation over A and x, y A, then either: [x] R = [y] R [x] R [y] R = Disjoint classes or sets Prove: Assume, [x] R [y] R. Then, prove [x] R = [y] R. By symmetry and transitivity, we will try to prove: [y] R [x] R First prove x R y: There is some element z such that z [x] R and z [y] R z [x] R and z [y] R, x R z and y R z y R z, by symmetry, z R y x R z and z R y, by transitivity, x R y
Lemma Over Equivalence Relation 2 If R be an equivalence relation over A and x, y A, then either [x] R = [y] R OR [x] R [y] R = Prove: Assume: [x] R [y] R Now prove [y] R [x] R : If u [y] R, then, y R u x R y and y R u, by transitivity, x R u Thus, u [x] R All elements in [y] R are also in [x] R : [y] R [x] R Similarly, [x] R [y] R Therefore, [x] R = [y] R If [x] R [y] R, then [x] R [y] R =
Theorem on Equivalence Class Let R be an equivalence relation over A. The equivalent classes of R partition A. Proof: The equivalence classes form a disjoint family of subsets of A. Let x A By reflexivity, x [x] R Each element of A is in one of the equivalence classes. Therefore, the union of equivalence classes is the entire set A.
Infinite Sets and Sets with infinite elements Formal language and automata theory Need technique(s) to define element of an infinite set N = {0, 1, 2, 3,...} How can a machine tell the next number or if a number is a natural number? Recursive definition Specifies a method for constructing the elements of the set Two components: A basis and a set of operations
The basis Recursive Definition of a Set A A finite set of elements that are explicitly designated as members of A Known element(s) A (finite) set of operation(s) To construct new elements of A from the previously defined elements The recursive step Define N, the set of natural numbers. Basis: 0 N Recursive step: If n N, then s(n) N s is the successor function: s(n) = n + 1 Closure: n N only if it can be obtained from 0 by a finite number of application of the operation s s(0), s(s(0)), s(s(s(0))),
Recursive Definition (More Example) Define the sum operation of two numbers m and n. Basis: Recursive step: Closure: Define the relation LT (less than). Basis: Recursive step: Closure:
Recursive Definition (More Example) 2 Define the sum operation of two numbers m and n. Basis: If n = 0, m + n = m Recursive step: m + s(n) = s (m + n) Closure: m + n = k, only if this can be obtained from m + 0 = m using finite number of application of the recursive step 3 + 2 = s(s(s(0))) + s(s(0)) = s(s(s(s(0))) + s(0)) = s(s(s(s(s(0))) + 0) Define the relation LT (less than). Basis: [0, 1] LT Recursive step: If [m, n] LT, then [m, s(n)] LT and [s(m), s(n)] LT Closure: [m, n] LT only if it can be obtained from [0, 1] by a finite.
Recursive Generation of X Recursive generation of X: X 0 = {x x is a basis element} X i + 1 = X i {x x can be generated by i + 1 operations} X = {x x X j for some j 0} X i X i + 1 X 1 X 2 X 0
Mathematical Induction Proof for the verification of hypothesized properties Establishing relationships between the elements of sets and operations on the sets Impossible to prove a property for each member of an infinite set Mathematical induction provides sufficient conditions to prove a property that holds for each element in a set. A recursively defined set Extend a property from the basis to the entire set. A recursive definition is applied to generate the relation LT. [i, j] LT and i < j Does every pair generated by this definition ensure i < j?
Let Principle of Mathematical Induction X be a set defined by recursion from the basis X 0 X 0, X 1, X 2,, X n, be the sequence of sets generated by the recursive process P be a property defined on the elements of X Does P hold for every element in X? If it can be shown that i. P holds for each element in X 0 ii. Whenever P holds for every element in X 0, X 1, X 2,, and X n, P also holds for every element in X n+1 Then, by the principle of mathematical induction, P holds for every element in X
Justification! Conditions (i) and (ii) are satisfied but P is not true for all elements in X! Let X j be the first set of its kinds for which P fails. j > 0 Condition (i): P is true for each element in X 0 P holds for all sets starting from X 0 to X j - 1 Recursive generation: X 0, X 1,, X j - 1 Condition (ii): P must hold for X j There is no first set for which P fails.
Steps of an Inductive Proof Three distinct steps: Property P holds for each element of the basis set. The statement of the inductive hypothesis P holds for each X 0, X 1, X 2,, and X n Inductive step: P can be extended for X n+1 Recursive definition of LT (Less Than) Basis: [0, 1] LT Recursive step: If [m, n] LT, then [m, s(n)] LT and [s(m), s(n)] LT Lt i + 1 = LT i {[m, s(n)], [s(m), s(n)]} Closure: [m, n] LT only if it can be obtained from [0, 1] by a finite. Does every ordered pair [i, j] generated by this definition satisfy the inequality, i < j?
Definition of LT: Correctness Proof The basis step: The inequality holds for all elements in the basis. X 0 = {[0, 1]} The inductive hypothesis: x < y, for all ordered pairs [x, y] LT n The inductive step: i < j for all ordered pairs [i, j] LT n + 1 Recursive step in the definition relates LT n + 1 with LT n Either [i, j] = [x, s(y)] or [i, j] = [s(x), s(y)] for some [x, y] LT n If [i, j] = [x, s(y)], then i = x < y < s(y) = j If [i, j] = [s(x), s(y)], then i = s(x) < s(y) = j
Arithmetic Series Basis: n = 0 Inductive hypothesis: Assume for k = 1, 2,, n Inductive step: Prove for k = n + 1,
Directed Graph G = (N, A): A mathematical structure (graph) consisting of a set N and a binary relation A on N N: Nodes or vertices A N N: Arcs or edges A: Adjacency relation [x, y] A In-degree vs. out-degree Path A sequence of nodes and/or arcs Null-path: zero length, path to itself a b d c
Directed Graph: (Ordered) Tree An acyclic directed graph Root: In-degree zero All other nodes with in-degree one T = (N, A, r), r is the root, r N Parent, child Leaf: out-degree zero Depth Ancestor, descendent Minimal common ancestor Subtree A binary tree A strictly binary tree x 1 x 2 x 3 x 4 x 5 x 6 x 9 x 10 x 11 x 7 x 8 x 12
A Strictly Binary Tree Recursive definition Basis: A directed graph T = ({r}, φ, r) is a binary tree Recursive step: If T 1 = (N 1, A 1, r 1 ) and T 2 = (N 2, A 2, r 2 ) are binary trees T 1 T 2 = φ r N 1 N 2 Then T = (N 1 N 2 r, A 1 A 2 {[r, r 1 ], [r, r 2 ]}, r) Closure: T is a strictly binary tree only if it can be obtained from the basis elements by a finite number of constructions given in the recursive step. Prove the following relation? # of arcs = 2 # of leaves 2
THANKS Source: - Chapter 1, Languages and Machines, Thomas Sudkamp