240 likes | 414 Views
Automata Theory CS 3313. Chapter 2 Revision of Mathematical Notations and Techniques. String Alphabets & Language * A SYMBOL is an abstract entity. * Letters (a-z) and digits (0-9) are examples of frequently used symbols.
E N D
Automata TheoryCS 3313 Chapter 2 Revision of Mathematical Notations and Techniques
String Alphabets & Language * A SYMBOL is an abstract entity. * Letters (a-z) and digits (0-9) are examples of frequently used symbols. * A STRING (or word) is a finite sequence of symbols juxtaposed (adjacent). * For example ‘a’, ‘b’ and ‘c’ are the symbols and “abcb” is a string. * The LENGTH of string “w”, denoted |w|, is the number of symbols composing the string. * For example “abcb” has length 4.
* The empty string, denoted by “” (in some other books it denoted by “”), is the string consisting of zero symbols. * Thus || = 0. (length of empty is equal to zero) * A PREFIX of a string is any number of leading symbols of that string and a SUFFIX is any number of trailing symbols. * For example, string “abc” has prefixes , a, ab and abc; its suffixes are , c, bc and abc. * Note: A prefix or suffix of a string, other than the string itself is called “PROPER” PREFIX or SUFFIX.
* The CONCATENATION of the two strings is the string formed by writing the first, followed by the second, with no space between them. * For example, the concatenation of “dog” and “house” is “doghouse”. * Juxtaposition is used as the concatenation operator. * That is, if ‘s1’ and ‘s2’ are strings, then s1s2 is the concatenation of these two strings. * The empty string is the identity for the concatenation operator. * That is, w = w = w.
* An ALPHABET is the finite set of symbols. * A certain specified set of string of characters from the alphabet will be called the LANGUAGE. * In other words, A LANGUAGE is a set of string of symbols from some one alphabet. * The empty set, , and the set consisting of the empty string {} are languages. * Note: they are distinct; the latter has a member while the former does not. * The set of Palindromes (string that read the same forward and backward) over the alphabet {0, 1} is an infinite language. * Some members of this language are , 0, 1, 00, 11, 010, 101, …, 1101011 etc.
* Note that the set of all palindromes over an infinite collection of symbols is technically not a language because its string are not collectively built from an alphabet. * Another language is the set of all string over a fixed alphabet . * We denotes this language by *. * For example, = {a}, then * = {, a, aa, aaa, … }. * If = {0, 1}, then * = {, 0, 1, 00, 01, 10, 11, 100, 000, … }. * Some examples: - {X {a, b}* | |X| 8} = {, a, b, aa, ab, ba, bb, …, bbbbbbbb} - {X {a, b}* | |X| is odd} = {, a, b, aaa, aab, …, bbbbbbb}
* An alphabet is a finite, non-empty set of elements, called as symbols or letters. * Let X be an alphabet. * A word over the alphabet X is a finite sequence of symbols from X. * The empty word is ‘L’, is the empty sequence. * Note: The empty word L is a word over any alphabet. * The universal language of all words over an alphabet X is denoted by X*. * X* is an infinite set. * A language L over an alphabet X is a subset of X*. * L Î X* - This means that language is a set of words.
* Note: F, which is empty set, is a language over any alphabet. * Similarly {L }, the set containing only one word, that is empty word, is a language over any alphabet. * But F¹ { L }
Graphs & Trees: · * A GRAPH denoted G = (V, E), consists of a finite set vertices (or nodes) V and a set of pairs of vertices E called edges. * An example graph is shown in following Figure:
* Here V = {1, 2, 3, 4, 5} and E = {(n, m) | n+m = 4} * A PATH in a graph is sequence of vertices V1, V2, V3, …, Vk, K 1, such that there is an edge (Vi , Vi+1) for each i, 1 i k. * E = { (1, 3), (1, 4), (3, 4), (2, 5) } * The length of the path is k-1. * For example, 1, 3, 4 is a path in the graph of Figure above; so is 5 by itself. If V1 = Vk the path is a CYCLE.
Directed Graph * A directed graph (or digraph), also denoted G = {V, E}, consists of a finite set of vertices V and a set of ordered pairs of vertices E called arcs. * We denote an arc from V to W by V W. * A PATH in a digraph is sequence of vertices V1, V2, V3, …, Vk, K 1, such that Vi Vi+1 is an arc for each i, 1 i k. * If V W is an arc we say V is a predecessor of W and W is a successor of V.
Trees * A TREE (strictly speaking, an ordered, directed tree) is a digraph with the following properties. * There is one vertex, called the root, that has no predecessors and from which there is a path to every vertex. * Each vertex other than the root has exactly one predecessor. * The successors of each vertex are ordered “from left to right”. * We shall draw trees with the root at the top and all arcs pointing downward. * The arrow on the arcs are therefore not needed to indicate direction, and they will not be shown.
* The successors of each vertex will be drawn in left-to-right order. * There is a special terminology for trees that differs from the general terminology for arbitrary graphs. * A successor of a vertex is called a SON, and the predecessor is called the FATHER. * If there is a path from vertex V1 to vertex V2, then V1 is said to be ANCESTOR of V2 and V2 is said to be a DESCENDANT of V1. * Note that the case V1 = V2 is not ruled out; any vertex is an ancestor and a descendant of itself. * A vertex with no sons is called a LEAF, and the other vertices are called INTERIOR vertices.
Inductive Proof * Many theorems will be proved by mathematical induction. * Suppose we have a statement P(n) about a nonnegative integer n. * A commonly chosen example is to take P(n) to be:
* The principle of mathematical induction is that P(n) follows from: a) P(0), and b) P (n-1) implies P(n) for n 1. * Condition (a) in an inductive proof is called the BASIS, and condition (b) is called the inductive step. * The left-hand side of (b), that is P(n-1), is called the inductive hypothesis. * Example: let us prove eq. by mathematical induction. * We establish (a) by substituting 0 for n in (eq.) and observing that both are 0. * To prove (b), we substitute n-1 for n in (eq.) and try to prove (eq.) from the result. * That is, we must show for n 1 that …Proof.
Set Notation * A collection of the objects (members of the set) without repetition. * Finite sets may be specified by listing their members between brackets. * For example, we used {0, 1} to denote the alphabet of symbols 0 and 1. * If every member of A is a member of B, then we write A B and say A is contained in B. * A B is synonymous with B A. * If A B but A B, that is, every member of A is in B and there is some member of B that is not in A, then we write A B. * Sets A and B are equal if they have the same members. * That is A = B if and only if A B and B A.
Operations on sets: * The usual operations defined on sets are: 1) A U B, the UNION defined on sets are: {X / X is in A or X is in B} 2) A B, the INTERSECTION of A and B, is: {X / X is in A and X is in B} 3) A – B, the difference of A and B, is: {X / X is in A and is not in B} 4) A x B, the Cartesian product of A and B, is the set of ordered pair (a, b) such that a is in A and b is in B. 5) 2A, the power set of A, is the set of all subsets of A
·Example, A = {1, 2} and B = {2, 3} ·AUB = {1, 2, 3} ·A B = {2} ·A-B = {1} ·B-A = {3} ·AxB = {(1,2), (1,3), (2,2), (2,3)} ·BxA = {(2,1), (2,2), (3,1), (3,2)} ·2A = {, {1}, {2}, {1,2}} ·If A and B have n and m members, respectively, then AxB has nxm members and 2A has 2n members. ·Cardinality = number of members
Relations · A (binary) relation is a set of pairs. · The first component of each pair is chosen form a set called the “domain” and the second component of each pair is chosen form a (possibly different) set called the range. · We shall use primarily relations in which the domain and range are the same set S. · In that case we say the relation is on S. · If R is a relation and (a, b) is a pair in R, then we often write aRb.
Properties of relations · We say a relation R on set S is: 1) Reflexive: if aRa for all a in S; 2) Irreflexive: if aRa is false for all a in S; 3) Transitive: if aRb and bRc imply aRc; 4) Symmetric: if aRb implies bRa; 5) Asymmetric: if aRb implies that bRa is false. * Note that any asymmetric relation must be irreflexive. * Example: the relation < on the set of integers is transitive because a < b and b < c implies a < c. * It is asymmetric and hence irreflexive because a < b implies b < a false. * A relation R that is reflexive, symmetric, and transitive is said to be an equivalence relation.
Closures of Relations · Suppose P is a set of properties of relations. · The P-closure of a relation R is the smallest relation R’ that includes all the pairs of R and possesses the properties in P. · For example, the transitive closure of R, denoted R+ is defined by: 1) If (a, b) is in R, then (a, b) is in R+. 2) If (a, b) is in R+ and (b, c) is in R, then (a, c) is in R+. 3) Noting is in R+ unless it so follows from (1) and (2).
·It should be evident that any pair placed in R+ by rule (1) and (2) belongs there, else R+ would either not include R or not be transitive. · Also an easy inductive proof shows that R+ is in fact transitive. · Thus R+ includes R, is transitive, and contains as few pairs as any relation that includes R and is transitive. · The reflexive and transitive closure of R, denoted R*. · For example: · let R = {(1, 2), (2, 2), (2, 3)} be a relation on the set of {1, 2, 3}, then · R+ = {(1, 2), (2, 2), (2, 3), (1, 3)}, and · R* = {(1, 1), (1, 2), (1, 3), (2, 2), (2, 3), (3, 3)}
·let R = {(aRb), (bRb), (bRc)} be a relation on the set of {a, b, c}, then · R+ = {(aRb), (bRb), (bRc), (aRc)}, and - - aRc also · R* = {(aRa), (aRb), (aRc), (bRb), (bRc), (cRc)} - - all cases