Basic Terminology

Introduction

In the automata theory, we have to deal with some mathematical preliminaries. As examples in finite automata and finite state machine the knowledge of set theory is necessary, in grammar and language section we need the basic knowledge of alphabet, string, and substring, and in the regular expression chapter we need the concept of prefix, suffix, etc. The knowledge of the basic operations on a set such as union, intersection, difference, Cartesian product, power set, and concatenation product are required throughout the syllabus of formal language and automata theory.

For this reason, in this chapter, we shall discuss some basic terminologies related to mathematics which are required for automata theory.

1.1  Basics of String

A string has some features as follows:

  • Symbol: A symbol is a user-defined entity.

  • Alphabet: An alphabet is a finite set of symbols denoted by Σ in automata. An alphabet is a set of symbols used to construct a language. As an example, {0, 1} is a binary alphabet, and {A……, Z, a…….z} is an alphabet set for the English language.

  • String: A string is defined as a sequence of symbols of finite length. A string is denoted by w in automata. As an example, 000111 is a binary string.

    (The length of a string w is denoted by |w|. For the previous case, |w| = |000111| = 6.)

  • Prefix: A prefix of a string is the string formed by taking any number of symbols of the string.

    Example: Let us take a string w = 0111. For the particular string, λ, 0, 01, 011, and 0111 are prefixes of the string 0111. For a string of length n, there are n + 1 number of prefixes.

  • Proper prefix: For a string, any prefix of the string other than the string itself is called as the proper prefix of the string.

    Example: For the string w = 0111, the proper prefixes are λ, 0, 01, and 011.

  • Suffix: A suffix of a string is formed by taking any number of symbols from the end of the string.

    Example: Let us take a string w = 0110. For the particular string, λ, 0, 10, 110, and 0110 are suffixes of the string 0110. For a string of length n, there are n + 1 number of suffixes.

  • Proper suffix: For a string, any suffix of the string other than the string itself is called as the proper suffix of the string.

    Example: For the string w = 0110, the proper suffixes are λ, 0, 10, and 110.

  • Substring: A substring of a string is defined as a string formed by taking any number of symbols of the string.

    Example: For the string w = 012, the substrings are λ, 0, 1, 2, 01, 12, and 012.

1.2  Basics of Set Theory

A set is a well-defined collection of objects. The objects used for constructing a set are called elements or the members of the set.

A set has some features as follows:

  • A set is a collection of objects. This collection is regarded as a single entity.
  • A set is comprised of distinct elements. If an element, say ‘a’, is in set S, then it is denoted as a ∈ S.
  • A set has a well-defined boundary. If S is a set and ‘a’ is any element, then depending on the properties of ‘a’, it can be said whether a ∈ S or a ∉ S.
  • A set is characterized by its property. In general, if p is the defined property for the elements of S, then S is denoted as S = {a : a has the property p}.

Example:

  • The set of all integers is denoted as S = {a: a is an integer}.

    Here, 7 ∈ S but 1/7 ∉ S.

  • The set of all odd numbers denoted as S = {a: a is not divisible by 2}.

    Here, 7 ∈ S but 8 ∉ S.

  • The set of prime numbers less than 100 is denoted as S = {a: a is prime and less than 100}.

    Here, 23 ∈ S but 98 or 101 ∉ S.

1.2.1  Subset

Let there be two sets S and S 1. S 1 is said to be a subset of S if every element S 1 is an element of S. Symbolically, it is denoted as S 1 ⊂ S.

The reverse of a subset is the superset . In the previous example, S is the superset of S 1 .

Example:

  • Let Z be the set of all integers. E is the set of all even numbers. All even numbers are natural numbers. So, it can be denoted as E ⊂ Z.
  • Let S be the set of the numbers divisible by 6, where T is the set of numbers divisible by 2. Property says that if a number is divisible by 6, it must be divisible by 2 and 3. So, it can be denoted as S ⊂ T.

1.2.2  Finite and Infinite Set

A set is said to be finite if it contains no element or a finite number of elements. Otherwise, it is an infinite set.

Example:

  • Let S be the set of one digit integers greater than 1. S is finite as its number of elements is 8.
  • Let P be the set of all prime numbers. T is infinite, as the number of prime numbers is infinite.

1.2.3  Equal

Two sets S and S 1 are said to be equal if S is a subset of S 1 and S 1 is a subset of S.

1.2.4  Algebraic Operations on Sets

  • Union: If there are two sets A and B, then their union is denoted by A ∪ B. Let A = {2, 3, 4} and B = {3, 5, 6}. Then, A ∪ B = {2, 3, 4, 5, 6}. In general, A ∪ B = {x | x ∈ A or x ∈ B}.

    Diagrammatically, the union operation on two sets can be represented as shown in Fig. 1.1 . This diagrammatic representation of sets is called the Venn diagram.

    Fig 1.1

    Fig. 1.1 A ∪ B

  • Intersection: If there are two sets A and B, then their intersection is denoted by A ∩ B. Let A = {2, 3, 4} and B = {3, 4, 5, 6}. Then, A ∩ B = {3, 4}. In general, A ∩ B = {x | x ∈ A and x ∈ B}.

    The Venn representation of the intersection operation on two sets can be represented as shown in Fig. 1.2.

    Fig 1.2

    Fig. 1.2 A ∩ B

  • Difference: If there are two sets A and B, then their difference is denoted by A − B. Let A = {2, 3, 4, 5} and B = {3, 4}. Then, A − B = {2, 5}. In general, A − B = {x | x ∈ A and x ∉ B}.

    The Venn representation of the difference operation on two sets can be represented as shown in Fig. 1.3.

    Fig 1.3

    Fig. 1.3 A − B

  • Complementation: The complement of a set A, which is a subset of a large set U is denoted by A C or A′, defined by A′ = {x ∈ U: x ∉ A}.

    The Venn representation of the complement operation is given in Fig. 1.4.

    Fig 1.4

    Fig. 1.4 A C

  • Cartesian product: If there are two sets A and B, then their Cartesian product is denoted by A × B. Let A = {2, 3, 4, 5} and B = {3, 4}. Then, A × B = {(2, 3), (2, 4), (3, 3), (3, 4),(4, 3), (4, 4), (5, 3), (5, 4)}. In general, A × B = {(a, b)|a ∈ A and b ∈ B}.

  • Power set: The power set of a set A is the set of all possible subsets of A. Let A = {a, b}. Then, the power set of A is {(Ø), (a), (b), (a, b)}. For a set of elements n, the number of elements of the power set of A is 2 n .

  • Concatenation: If there are two sets A and B, then their concatenation is denoted by A.B. Let A = {a, b} and B = {c, d}. Then, A.B = {ac, ad, bc, bd}. In general, A.B = {ab|a is in A and b is in B}.

1.2.5  Properties Related to Basic Operation

Some properties related to basic operations on set are as follows:

  • A ∪ Ø = A, A ∩ Ø = A (Ø is called null set)
  • A ∪ U = U, A ∩ U = A (where A ⊂ U)
  • A ∪ A = A, A ∩ A = A (idempotent law)
  • A ∪ B = B ∪ A, A ∩ B = B ∩ A (commutative property)
  • A ∪ (B ∪ C) = (A ∪ B) ∪ C, A ∩ (B ∩ C) = (A ∩ B) ∩ C (associative property)
  • A ∪ (B ∩ C) = (A ∪ B) ∩ (B ∪ C), A ∩ (B ∪ C) = (A ∩ B) ∪ (B ∩ C) (distributive property)
  • A ∪ A C = U (U is the universal set)
  • A ∩ A C = Ø
  • (A C ) C = A
  • (A ∪ B) C = A C ∩ B C , (A ∩ B) C = A C ∪ B C (D’Morgan’s Law)
  • A − (B ∪ C) = (A − B) ∩ (A − C)
  • A − (B ∩ C) = (A − B) ∪ (A − C)

1.3  Relation on Set

  • Relation: Let there be two non-empty sets S and T. A relation R, defined between S and T, is a subset of S × T. If the ordered pair (s, t) ∈ R, then the element s ∈ S is said to be related to t ∈ T by the relation R.

    Let S = {2, 4, 6, 8} and T = {12, 16, 18, 19}. A relation R between S and T is defined as an element s in S is related to an element t of T if t is divided by s. Here, R = {(2, 12), (2, 16), (2, 18), (4, 12), (6, 12), (6, 18)}. But (4, 18) ∉ R as 18 is not divisible by 4.

  • Reflexive: A relation R is said to be reflexive on a non-empty set R if every element of A is related to itself by that relation R.

    Let A = {B, C, D}, where B, C, and D are brothers. Then, the relation brotherhood is a reflexive relation on the set A as {B, C}, {B, D}, and {C, D} are all sets of brother.

  • Symmetric: A relation R is said to be symmetric, if for two elements ‘a’ and ‘b’ in X, if ‘a’ is related to ‘b’ then b is related to a.

    Let A be a set of all students in a class. Let R be a relation called classmate. Then we can call R as a symmetric relation. If a and b are two students belonging to the set, then a is a classmate of b and b is a classmate of a.

  • Transitive: Let R be a relation defined on a set A; then the relation R is said to be transitive if for a, b, c ∈ A and if aRb, bRc holds good then aRc also holds good.

    Let A = {8, 6, 4}, where R is a relation called greater than. If 8 > 6 and 6 > 4 hold good, then 8 > 4 also holds good. So, ‘greater than’ is a transitive relation.

  • Equivalence relation: A relation R is called as an equivalence relation on ‘A’ if R is reflexive, symmetric, and transitive.

  • Right invariant : An equivalence relation R on a strings of symbols from some alphabet Σ is said to be a right invariant if for all x, y ∈ Σ* with x R y and all w ∈ Σ* we have that xw R yw. This definition states that an equivalence relation has the right invariant property if two equivalent strings (x and y) that are in the language still are equivalent if a third string (w) is appended to the right of both of them.

  • Closure: A set is closed (under an operation) if and only if the operation on two elements of the set produces another element of the set. If an element outside the set is produced, then the operation is not closed.

    Closure is a property which describes when we combine any two elements of the set; the result is also included in the set.

    If we multiply two integer numbers , we will get another integer number. Since this process is always true, it is said that the integer numbers are ‘closed under the operation of multiplication’. There is simply no way to escape the set of integer numbers when multiplying.

    Let S = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10….} be a set of integer numbers.

    1 × 2 = 2
    2 × 3 = 6
    5 × 2 = 10

    All are included in the set of integer numbers.

    So, we can say that integer numbers are closed under the operation of multiplication.

Example 1.1

A relation R is defined on set (I) of all integers, by aRb, if and only if ab > 0, for all a, b ∈ I. Examine if R is (a) reflexive, (b) symmetric, and (c) transitive.

Solution:

  1. Let a ∈ I. Then a.a > 0 holds good if a ≠ 0. If a = 0, then a.a = 0. Therefore, aRa does not hold for all a in I. So, R is not reflexive.

  2. Let a, b ∈ I. If ab > 0, then ba >0 also. That is, aRb ⇒ bRa. So, R is symmetric.

  3. Let a, b, c ∈ I. Let a Rb and bRc both hold good. It can be said that ab > 0 and bc > 0. If we multiply these two, then (ab)(bc) > 0. ab 2 c > 0. We know b 2 is always > 0. It can be said clearly that ac > 0.

    Thus, aRb and bRc ⇒ aRc. So, R is transitive.

Example 1.2

A relation R is defined on a set of integers (I) by aRb if a − b is divisible by 3, for a, b ∈ I. Examine if R is (a) reflexive (b) symmetric, and (c) transitive.

Solution:

  1. Let a ∈ I. Then, a − a is divisible 3. Therefore, aRa holds good for all a ∈ I. So the relation R is reflexive.

  2. Let a, b ∈ I and aRb hold good. It means a− b is divisible by 3. If it is true, then b − a is also divisible by 3.

    (Let a = 6, b = 3, a− b = 3, divisible by 3, b − a = − 3, which is also divisible by 3). So, bRa holds good. Therefore, R is symmetric.

  3. Let a, b, c ∈ I and aRb, bRc hold good. It means a − b and b − c both are divisible by 3. Therefore, (a − c) = (a − b) + (b − c) is divisible by 3.

    (Let a = 18, b = 12, c = 6, a − b = 6, b − c = 6. Both are divisible by 3. a − c = 12 is also divisible by 3.)

    So, aRc holds good. Therefore, R is transitive.

Example 1.3

Consider the relation R = {(a,b), where len(a) = len(b)}. Show that it is an equivalence relation.

Solution: Here, len(a) means the length of string a

  1. It is reflexive: as len(a) = len(a).

  2. It is symmetric: if len(a) = len(b), then len(b) = len(a) holds good.

  3. It is transitive: if len(a) = len(b) and len(b) = len(c), then len(a) = len(c).

    Thus, R is an equivalence relation.

Example 1.4

Check whether the set of numbers divisible by 5 is closed under the addition operation.

Solution: Let the set S = {0, 5, 10, 15…}.

0 + 5 = 5, divisible by 5.
5 + 10 = 15, divisible by 5.
10 + 15 = 25, divisible by 5.

All the results are included in the same set S.

So, the set of numbers divisible by 5 is closed under the addition operation.

Example 1.5

Prove that a set of numbers divisible by n is closed under the addition and multiplication operations.

Solution: The set of numbers divisible by n can be represented as S = {0, n, 2n, 3n, 4n,……}.

Addition:

0 + n = n
n + 2n = 3n
0 + 2n = 2n
……………

In general, (m − p)n + (m − q).n = n(2m − p − q). This is divisible by n.

So, a set of numbers divisible by n is closed under addition.

Multiplication:

0 × n = 0
n × 2n = 2n 2
2n × 3n = 6n 2
……………..

In general, (m − p)n × (m − q).n = (m − p) (m − q)n 2 . This is divisible by n.

So, a set of numbers divisible by n is closed under multiplication.

1.4  Graph and Tree

1.4.1  Graph

A graph is an abstract representation of a set of objects where some pairs of the objects are connected by directed or undirected links. The interconnected objects are called vertices , and the links that connect some pairs of vertices are called edges . A graph G = (V, E) consists of a set of vertices V = {v 1 , v 2 , v 3 , …..} and a set of edges E = {e 1 , e 2 , e 3 , ……}. The vertices associated with an edge e are called the end vertices of that edge.

As an example, the graph in Fig.1.5 has 5 vertices (A, B, C, D, and E) and 6 edges (AB, BC, CD, DA, DE, and EA).

Fig 1.5

Fig. 1.5 Example of Graph

1.4.2  Incident and Degree of a Vertex

The edges meet at a common vertex are called incident on that common vertex

The number of edges incident on a vertex is called the degree of the vertex. If the edge is a self-loop, it will be counted twice.

As an example, for the graph in Fig. 1.5 , the edges AE, AB, and AD are incident on the vertex A. The degree of the vertex is d(A) = 3.

It can be proved that the number of odd degree vertices in a graph is always even.

1.4.3  Isolated Vertex, Pendant Vertex

A vertex of a graph having no incident edge is called an isolated vertex.

A vertex of degree one is called a pendant vertex. Sometimes, the pendant vertex is called an end vertex.

In the graph shown in Fig.1.6 , G is called the isolated vertex and F is called the pendant vertex, as it has degree 1.

Fig 1.6

Fig. 1.6 Example of Isolated and Pendant Vertex

1.4.4  Walk

Starting from a vertex, traversing some edges and at last ends on some vertex forms a walk. It may be defined as a finite alternating sequence of vertices and edges, beginning and ending with vertices. One important condition of a walk is that no edges are traversed more than once in a single walk, whereas a vertex may be traversed more than once.

For the graph in Fig.1.6 , B(BC)C(CD)D(DF)F is a walk. The label in () represents edge.

If the beginning and end vertices of a walk are the same, then it is called closed walk or else open walk.

1.4.5  Path and Circuit

An open walk in which no vertex appears more than once is called a path.

A closed walk where no vertex appears more than once is called a circuit.

1.4.6  Connected and Disconnected Graph

A graph is called a connected graph if between every pair of vertices there exists at least one path. Else, the graph is called a disconnected graph.

1.4.7  Tree

A tree is defined as an undirected connected graph with no circuit.

A tree has a specially designed vertex called a root. The rest of the nodes could be partitioned into t disjoint sets (t ≥ 0), where each set represents a tree T i . i = 0 to t. These are called sub-trees .

The number of sub-trees of a node is called the degree of the node.

The vertex of a tree having degree 0 is called the leaf node or the terminal node. The nodes other than the leaf nodes are called the non-terminal nodes.

In a rooted tree, the parent of a vertex is the vertex connected to it on the path to the root; every vertex except the root has a unique parent. A child of a vertex v is a vertex of which v is the parent.

The children of a same parent node are called siblings .

The depth of a node is the length of the path from the root of the tree to the node. The set of all nodes at a given depth is called the level of the tree. The root node has depth 0.

The height of a tree is the length of the path from the root to the deepest node in the tree.

A tree is given in Fig. 1.7. The root node is ‘A’. The node C has two sub-trees. So, the node C has a degree.

Fig 1.7

Fig. 1.7 Example of Tree

In the tree, the leaf nodes are G, H, E, and I. For the node E, the parent node is C. E and F are siblings as they are from the same parent C. The height of the three is three. The highest level of the tree is 3.

A binary tree is a tree in which each node has at most two children.

A full binary tree is a tree in which every node other than the leaves has two children.

The number of nodes in a full binary tree is n = 2 h + 1 – 1, where h is the height of the tree.

A full binary tree is given in Fig. 1.8. The height of the tree is 2. The number of nodes is 2 3 − 1 = 7. If you count the number of nodes, it is 7.

Fig 1.8

Fig. 1.8 Full Binary Tree

A complete binary tree is a binary tree in which every level, except leaves, is completely filled.

The number of nodes of a complete binary tree is minimum: n = 2 h and maximum: n = 2 h + 1 − 1, where h is the height of the tree.

1.5  Basics of Digital Electronics

This is the age of electronics. From toy to radio, television, and music player, all are electronics components. The computer hardware is also a complex electronics circuit. Electronics is a branch of technology concerned with the design of circuits using different gates, transistors, microprocessor chips, etc., and with the behaviour and movement of electrons in a semiconductor, conductor, vacuum, or gas. By definition, circuits are closed paths used to describe many situations. An electronics circuit is a closed path consisting of a series of electronic components through which electricity flows to perform some operations.

Signals are of two types, analog and digital. An analog signal is a fluctuating voltage which can have any numerical value, from tiny fractions of a volt to a hundreds of volts. It may be a constant voltage or rapidly changing. It is a continuous signal and provides a true reflection of the real world signals.

In contrast to the analog signal, a digital signal can only have one of the two possible values. The exact value of these voltages varies from circuit to circuit. In common, + 5 V is referred to as the digital high and 0 V as the digital low. Though this voltage level is not fixed, it has a certain tolerance.

The electronic gate receives input in the form of voltage and produces output also in the form of voltage. As discussed earlier, the value of the voltage varies from circuit to circuit and from device to device. As gates are digital components, all these voltage ranges are restricted to two values ‘high’ and ‘low’. In digital electronics, ‘high’ is represented as ‘1’ and low is represented as ‘0’. The electronic gate acts as a switching device which either permits flow of current or blocks it. The basic gates are AND, OR, NOT, and XOR.

The AND gate has two or more inputs and a single output ( Fig. 1.9 ). If all of the inputs are ‘1’ the output is ‘1’; otherwise, the output is ‘0’. For a two-input AND gate, with input labels ‘A’ and ‘B’, the output function is written as T = AB. A two-input AND gate is represented by the following symbol and the truth table is as follows.

Fig 1.9

Fig. 1.9 The AND Gate with Truth Table

The OR gate also has two or more inputs and a single output ( Fig. 1.10 ). If any of the inputs is ‘1’, the output is ‘1’; otherwise, it is ‘0’. For a two-input OR gate, with input labels ‘A’ and ‘B’, the output function is written as T = A + B. A two-input OR gate is represented by the following symbol and the truth table is as follows.

Fig 1.10

Fig. 1.10 The OR Gate with Truth Table

The NOT gate has a single input and a single output ( Fig. 1.11 ). The function of the NOT gate is to reverse the input. The output function of the NOT gate is represented as T = A, where ‘A’ is the input. The symbol and truth table of the NOT gate is given as follows.

Fig 1.11

Fig. 1.11 The NOT Gate with Truth Table

The exclusive-OR, in short XOR, gate is a complex gate ( Fig. 1.12 ). A two-input XOR gate gives the output ‘1’ when its two inputs are different and the output ‘0’ when the inputs are the same. For two inputs ‘A’ and ‘B’, the output functions are represented by T = A ⊕ B = AB + AB.

Fig 1.12

Fig. 1.12 The XOR Gate with Truth Table

1.6  Digital Circuit

A digital circuit is a circuit using logic gates where the signal must be one of two discrete levels. Each level is interpreted as one of two different states depending on the voltage level (on/off, 0/1 or true/false). The digital circuit is operated by the logic of the Boolean algebra. This logic is the foundation of digital electronics and computer processing.

Depending on the output function, digital circuits are divided into two groups:

  1. Combinational circuits: The circuits where the output depends only on the present input, i.e., output is the function of only the present input, are called combinational circuits.

    O/P = Func.(Present I/P)

  2. Sequential circuit: The circuits where the output depends on the external input and the stored information at that time, i.e., output is the function of external input and the present stored information, are called sequential circuits. 

    Equation

The difference between the sequential and combinational circuit is that sequential circuit has memory in the form of flip flop, whereas combinational circuit does not have the memory element. A general block diagram of sequential circuit is shown in Fig. 1.13.

Fig 1.13

Fig. 1.13 Block Diagram of Sequential Circuit

Sequential circuits fall into two classes: synchronous and asynchronous. Synchronization is usually achieved by some timing device, such as clock. A clock produces equally spaced pulses. These pulses are fed into a circuit in such a way that various operations of the circuit take place with the arrival of appropriate clock pulses. Generally, the circuits, whose operations are controlled by clock pulses, are called synchronous circuit.

The operation of an asynchronous circuit does not depend on clock pulses. The operations in an asynchronous circuit are controlled by a number of completion and initialization signals. Here, the completion of one operation is the initialization of the execution of the next consecutive operation. The following ( Fig. 1.14 ) block diagram is that of a synchronous sequential circuit.

Fig 1.14

Fig. 1.14 Synchronous Sequential Circuit

A synchronous sequential machine has finite number of inputs. If a machine has n number of input variables, the input set consists of 2 n distinct inputs called input alphabet I.

In the figure, the input alphabet is I = {I 1 , I 2 , ……, I p }.

The number of outputs of a synchronous sequential machine is also finite.

A synchronous sequential circuit can be designed by the following process:

  • From the problem description, design a state table and a state diagram (whichever is first applicable).
  • Make the state table redundant by machine minimization. This removes some states and makes the table redundant.
  • Perform state assignment by assigning the states to binary numbers. n binary numbers can assign 2 n states.
  • After performing the state assignment, derive a transition table and an output table.
  • Derive the transitional function and the output function from the transitional table and the output table.
  • Draw the circuit diagram.

The following examples design some synchronous sequential circuit.

Example 1.6

Design a sequential circuit which performs the following:

Equation

The carry is added with the I/P’s in the next clock pulse.

Solution: Let us take two input strings X 1 = 0111 and X 2 = 0101.

Here, the output at time t i is a function of the inputs X 1 and X 2 at the time t i and of the carry generated for the input at t i−1.

O/P = func.(I/P at t i and the carry generated for the input at t i−1 )

Therefore, this is a sequential circuit ( Fig. 1.15 ).

Fig 1.15

Fig. 1.15

If we look into the previous table, we will see two types of cases arisen there. These are

  1. The producing carry ‘0’
  2. The producing carry ‘1’.

We have to consider this as the O/P depends of the carry also.

Let us take the cases as states. So, we can consider two states, A for (1) and B for (2). If we construct a table for the inputs X 1 and X 2 by considering the states, it will become

Equation

This type of table is called the state table.

We can make this tabular form more clear by a graphical notation ( Fig. 1.16 ).

Fig 1.16

Fig. 1.16 State Diagram for the Sequential Circuit

This type of graph is called state graph or state diagram.

For designing a circuit, we need only ‘0’ and ‘1’, i.e., Boolean values. So, the states A and B must be assigned to some Boolean number. As there are only two states A and B, only one-digit Boolean value is sufficient. Let us represent A as ‘0’ and B as ‘1’.

By assigning these Boolean values to A and B, the modified table becomes

Equation

From this function, the digital circuit is designed as denoted in Fig.1.17 .

Fig 1.17

Fig. 1.17 Circuit Diagram for the Sequential Circuit

This is the circuit for full binary adder.

Example 1.7

Design a full binary substractor.

Solution: The truth table for a substractor is given in the following table:

Equation

Let us take two input strings X 1 = 1010 and X 2 = 0111.

Here, the output at time t i is a function of the inputs X 1 and X 2 at the time t i and of the borrow generated for the input at t i−1.

O/P = func.(I/P at t i and the carry generated for the input at t i−1 )

Therefore, this is a sequential circuit ( Fig. 1.18 ).

Fig 1.18

Fig. 1.18

If we look into the previous table, we will see two types of cases arisen there. These are

  1. The producing borrow ‘0’
  2. The producing borrow ‘1’.

We have to consider this, as the O/P depends on the borrow also.

Let us take the cases as states. So, we can consider two states, S 1 for (1) and S 2 for (2). If we construct a table for the inputs X 1 and X 2 by considering the states, it will become.

Equation

This is the state table for binary substractor.

The state graph for the binary substractor is shown in Fig. 1.19.

Fig 1.19

Fig. 1.19 State Diagram for the Binary Substractor

State Assignment: For designing a digital circuit, we need to convert S 1 and S 2 into some digital number. There are only two states, and so a 1-bit digital number which can produce two types of digital values 0 or 1 is sufficient to represent S 1 and S 2 .

Let us represent S 1 as 0 and S 2 as 1.

The modified state table is

Equation

Fig 1.20

Fig. 1.20 Circuit Diagram

1.7  Basics of Automata Theory and Theory of Computation

The term ‘automata’ has some typical pronounceable symmetry with the term ‘automatic’. In a computer, all the processes appear to be done automatically. A given input is being processed in the CPU, and an output is generated. We are not concerned about the internal operation in the CPU. We are only concerned about the given input and the received output. However, in reality, the input is converted to ‘0’ and ‘1’ and assigned to the process for which the input was given. It then performs some internal operation in its electronic circuit and generates the output in ‘0’ and ‘1’ format. The output generated in the ‘0’ and ‘1’ format is converted to a user-understandable format and we get the output. From the discussion, it is clear that the CPU performs machine operations internally. In automata, we shall learn about how to design such machines. To get a clear idea about automata theory, we need to travel back to the history of computer science. The engineering branch ‘electrical engineering’ stands on the base of physics. Electronics engineering came from electrical engineering. The hardware of a computer is a complex electronics circuit. The circuit understands only binary command, which is impossible for a human user to memorize. Then, mathematics extends its hand for developing the logic. Mathematics and electronics have jointly given birth to a new branch of engineering called ‘computer science and engineering’.

The name of the subject is formal language and automata theory. We have a basic idea about the automata theory. Now what is formal language? Let us discuss what language is. Language is a communication medium through which two persons communicate. For every nation, there is some language to communicate such as Hindi, English, Bengali, etc. It is the same for communicating with a computer, wherein the user needs some language called the programming language. C, C++, and Java are some examples of programming languages. The characteristics of these types of languages are that they are similar to the English language and are easily understandable by the user. However, the computer does not understand English-like statements. It understands only binary numbers. Therefore, the computers have a compiler that checks the syntax and acts as a converter between English-like statements to binary numbers and vice versa. But, to design the compiler, some logic is needed. That logic can be designed by using mathematics. For each language, there is a grammar. Grammar is the constructor for any language. Similarly, the languages that are used for computer programming purpose have some grammar to construct them. These rules and grammar and the process to convert these grammar and languages to machine format are the main objectives of automata theory.

Any problem which can be modeled to be solved by a computer is called a computational problem. On the contrary, non-computational problems cannot be solved by any computer. As an example, ‘what will be the result of the forthcoming cricket match?’ In computer science, we consider only computational problems.

1.8  History of Automata Theory

Theoretical computer science or automata theory is the study of abstract machines and the computational problems related to these abstract machines. These abstract machines are called automata. The origin of the word ‘automata’ is from a Greek word (Αυτόματα) which means that something is doing something by itself.

Around 1936, when there were no computers, Alen Turing proposed a model of abstract machine called the Turing machine which could perform any computational process carried out by the present day’s computer. A formal version of the finite automata model was proposed in 1943 in the McCulloch-Pitts neural network models. Finite automata and finite state machines got a complete form by the efforts of George H. Mealy at the Bell Labs and Edward F. Moore in IBM around 1960. The machines are named as the Mealy and Moore machines, respectively. In mid-1950, Noam Chomsky at the Harvard University started working on formal languages and grammars. Grammar is a set of rules that are performed to produce sentences in the language. Chomsky structured a hierarchy of formal languages based on the properties of the grammars required to generate the languages. The Chomsky hierarchy drives the automata theory one step forward. In 1971, Stephen Arthur Cook in his research paper ‘The Complexity of Theorem Proving Procedures’ formalized the notions of polynomial-time reduction and NP-completeness. He separated those problems that can be solved efficiently by the computer from the set of problems that can be solved but taking much time. These second classes of problems are called NP-hard.

This subject is sometimes called the ‘Theory of Computation’ because it includes all of these rules for constructing a computer language and converts them into machine format. That is the theory of computer science. Basically, formal language and automata theory and theory of computation are different names for a single subject that covers all the aspects of the theoretical part of computer science.

1.9  Use of Automata

It is unfruitful to study a subject without knowing its usefulness. The subject ‘automata theory’ is called one of the core subjects of computer science. Some of the uses of this subject in different fields of computer science and engineering them are.

  • The main usefulness of the automata theory is in the compiler design. The first phase of compiler called lexical analyser is designed by the finite automata. In syntax analysis part, a common error called syntax error is checked by the rules of context-free grammar.
  • The working principle of the software used for checking the behaviour of digital circuits is based on the automata theory.
  • The software for natural language processing (NLP) takes the help of the automata theory.
  • Automata is useful for designing the software for counting the occurrence of a particular word, pattern, etc., in a large text.

What We Have Learned So Far

  1. A string is defined as a sequence of symbols of finite length.
  2. A set is a well-defined collection of objects.
  3. The operations union, intersection, difference, complement, Cartesian product etc. can be performed on set.
  4. A relation R is called as an equivalence relation on ‘A’ if R is reflexive, symmetric, and transitive.
  5. A set is closed (under an operation) if and only if the operation on two elements of the set produces another element of the set.
  6. A graph is an abstract representation of a set of objects where some pairs of the objects are connected by directed or undirected links.
  7. A tree is an undirected connected graph with no circuit.
  8. A binary tree is a tree in which each node has at most two children.
  9. A full binary tree is a tree in which every node other than the leaves has two children.
  10. The operations of synchronous circuit are controlled by clock pulses. The operations in an asynchronous circuit are controlled by a number of completion and initialization signals. Here, the completion of one operation is the initialization of the execution of the next consecutive operation.
  11. The circuit whose output depends on the present state only is called a combinational circuit., i.e., O/P = Func.(Present I/P).
  12. If the output is the function of the external input and the present stored information, then the circuit is called a sequential circuit., i.e., O/P = Func.(External I/P and Present stored information).

Solved Problems

  1. Prove that A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C).

    Solution: Let P = A ∪ (B ∩ C) and Q = (A ∪ B) ∩ (A ∪ C).

    Consider an element a ∈ P and b ∈ Q.

    As P = A ∪ (B ∩ C) and a ∈ P, it implies that

    Equation

    It is proved that P is a subset of Q.

    As Q = (A ∪ B) ∩ (A ∪ C) and b ∈ Q, it implies that

    Equation

    It is proved that Q is a subset of P.

    As P is a subset of Q and Q is a subset of P, it implies that P ≡ Q.

    Thus A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) is proved.

  2. Prove the following identity:

    r (s + t) = rs + rt

    Solution: Let x ∈ r(s + t),

    Equation

    That is r(s + t) ⊆ (is a subset of) (rs + rt).

    Let x ∈ (rs + rt)

    Equation

    That is (rs + rt) ⊆ r(s + t).

    So, r(s + t) = rs + rt (proved).

  3. Prove that

    Equation

    Solution: From the distributive property, we know A ∪ (B ∩ C) = (A ∪ B) ∩ (B ∪ C).

    → (B ∪ A) ∩ (B ∪ C) → B ∪ (A ∩ C) → B ∪ (C ∩ A)

    LHS (A ∪ B) ∩ (B ∪ C) ∩ (C ∪ A)

    Equation

  4. Let R be an equivalence relation in {0}* with the following equivalence classes:

    [ ]R = {0} 0

    [0]R = {0} 1

    [00]R = {0} 2 ∪ {0} 3 ∪ {0} 4 ……….

    Show that R is right invariant.

    Solution: From the definition of right invariant, we know that if R is right invariant then for all x, y, and z,

    xRy ⇒ xzRyz.

    From the given equivalence classes,

    [ ] R means a null string.

    [0] R has only string 0.

    [00] R has strings 00, 000, 0000, ……, etc.

    Three cases may occur:

    1. If x and y are null string, i.e., if x, y ∈ [ ] R . xz = z and yz = z and zRz holds good.

    2. If x, y ∈ [0] R, and z ∈ [ ] R , then xz = x and yz = y. So, xRy = xzRyz.

      If z ∈ [0] R, then xz = 00 and yz = 00, Hence, xz = yz, which implies that xzRyz holds good.

      If z ∈ [00] R , then z has at least 2 zeros. This means that xz and yz have at least 3 zeros which belongs to [00] R. This means that xzRyz holds good.

    3. If x, y ∈ [00] R , then x and y each have at least 2 zeros. z may belong to any one of the three, but xy and yz produce strings of 2 or more zeros. That is, both of them belong to [00] R . This means that xzRyz holds good.

    It is clear from the previous discussion that for all the cases xRy ⇒ xzRyz. Thus, R is a right invariant.

  5. Check whether a set of numbers divisible by n is closed under subtraction and division (except division by 0) operation.

    Solution: A set of numbers divisible by n can be represented as S = {0, n, 2n, 3n, 4n,……}.

    Subtraction:

    n − 0 = n
    n − 2n = −n
    3n − n = 2n
    …………..

    In general, (m − p)n − (m − q).n = n (q − p). This is divisible by n. So, a set of numbers divisible by n is closed under subtraction.

    Division:

    2n/n = 2
    3n/2n = 3/2
    …………......

    In general, (m − p)n/(m−q).n = (m−p)/(m−q). This may or may not be divisible by n. So, a set of numbers divisible by n is not closed under division.

Fill in the Blanks

  1. For a string, any prefix of the string other than the string itself is called as the __________ of the string.
  2. For a string, any suffix of the string other than the string itself is called as the __________ of the string.
  3. If there are two sets A and B, then their intersection is denoted by __________.
  4. For a set of elements n, the number of elements of the power set of A is __________.
  5. A relation R is said to be __________, if for two elements ‘a’ and ‘b’ in X, if a is related to b then b is related to a.
  6. A relation R is said to be __________, if for a, b, c ∈ A and if aRb, bRc hold good then aRc also holds good.
  7. A relation R is called as an __________ on ‘A’, if R is reflexive, symmetric, and transitive.

Answers:

  1. proper prefix
  2. proper suffix
  3. A ∩ B
  4. 2 n
  5. symmetric
  6. transitive
  7. equivalence relation

Exercise

  1. Using Venn diagram prove that A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C).
  2. Prove that (a) A ∪ (A C ∩ B) = A ∪ B and (b) A ∩ (A C ∪ B) = A ∩ B.
  3. A relation R is defined as a R b if a 2 − b 2 is divisible by 5, where a and b are integers. Prove that R is an equivalence relation.
  4. A relation R is defined on set N (natural numbers) such that R = {(a, b) ∈ N × N if ‘a’ is a divisor of ‘b’}. Examine if R is reflexive, symmetric, and transitive.
  5. Check whether the relation power defined as a b , where a and b are natural numbers, is closed or not.