COMT Assignment
COMT Assignment
Introduction ................................................................................................................................ 2
Part A: Automata ....................................................................................................................... 3
Part 1 ...................................................................................................................................... 3
Part 2 ...................................................................................................................................... 4
Part 3 ...................................................................................................................................... 7
Part B: Context-Free Grammar .................................................................................................. 9
Part 1 ...................................................................................................................................... 9
Part 2 ...................................................................................................................................... 9
Part C: Complexity & Decidability.......................................................................................... 10
Part 1 .................................................................................................................................... 10
Part 2 .................................................................................................................................... 10
Part 3 .................................................................................................................................... 11
Conclusion ............................................................................................................................... 12
References ................................................................................................................................ 13
1
Introduction
Computing Theory is the study of effective computation, models of computational processes
as well as their limits (Cornell CIS, 2018). Automata are used for confirmations about
computability, and also as theoretical models for computing machines. State machines or finite-
state machines (FSM), better known as finite automata, are used in the design of computer
programs and sequential logic circuits as a mathematical model of computing (Computer Hope,
2017). There are there types of finite automata which are Deterministic Finite Automata (DFA)
and Non-Deterministic Finite Automata (NFA).
Patterns of strings are generated using context-free grammar (CFG), which is a set of recursive
rewriting rules or productions (University of Rochester, 2018). Computational complexity is a
computer science concept that concentrates on the total of computing resources required for
specific types of task (Techopedia, 2018).
Talking about Decidability with example of Turing machine, a problem can be said as a
decidable problem if there exist a corresponding Turing machine which stops on every input
with an answer – yes or no (GeeksforGeeks, 2018).
2
Part A: Automata
Tools such as automata (Finite State Machines) are used for reasoning about computation.
Finite State Machines are a simple technique for specifying a process which have fixed and
very restricted amount of memory, have present state, driven by input and stop when the input
completed, driven by the input or change from present state to new state and produce simple
output. Finite automata can be classified into 2 types which are Deterministic Finite Machine
(DFA) and Non-Deterministic Finite Automaton (NFA).
DFA is called as Deterministic Automaton as for each input symbol, each of them can
determine the state to which the machine will move. Moreover, it is also called Deterministic
Finite Machine or Deterministic Finite Automaton because it has a finite number of states
(Tutorials Point, 2018).
While in NFA, the machine can move to any combination of the states in the machine for a
specific input symbol. The input symbol cannot determine the particular state to which the
machine moves. Thus, it is called Non-Deterministic Automaton. It is also called Non-
Deterministic Finite Machine or Non-Deterministic Finite Automaton because of the finite
number of states it has (Tutorials Point, 2018).
Part 1
Step 1
M = (Q,∑,δ,qo,F)
Q = {q0,q1,q2,q3,q4}
∑ = {t,r,u,e}
qo = {q0}
F = {q4}
3
Step 2
Transition Table
T R U E
qo qo,q1 φ φ φ
q1 φ q1,q2 φ φ
q2 φ φ q2,q3 φ
q3 φ φ φ q4
q4 φ φ φ φ
Step 3
Transition Diagram
Part 2
A{qo}, δ(qo,t) – δ(qo,q1) - B
δ(qo,r) – NULL
δ(qo,u) – NULL
δ(qo,e) – NULL
δ(qo,r) – NULL
δ(qo,u) – NULL
δ(qo,e) – NULL
4
B{q1}, δ(q1,t) – NULL
δ(q1,r) – δ(q1,q2) - C
δ(q1,u) – NULL
δ(q1,e) – NULL
δ(q1,r) – δ(q1,q2) - C
δ(q1,u) – NULL
δ(q1,e) – NULL
δ(q2,r) – NULL
δ(q2,u) – δ(q2,q3) - D
δ(q2,e) – NULL
δ(q2,r) – NULL
δ(q2,u) – δ(q2,q3) - D
δ(q2,e) – NULL
δ(q3,r) – NULL
δ(q3,u) – NULL
δ(q3,e) – δ(q4) – E
δ(q4,r) – NULL
δ(q4,u) – NULL
δ(q4,e) – NULL
5
Transition Table
t r u e
A B φ φ φ
B B C φ φ
C φ C D φ
D φ φ D E
E φ φ φ φ
Transition Diagram
6
Part 3
Regular Expression
Rule 1
Initial state cannot be incoming edges
Rule 2
Final state cannot be outgoing edges
φ φ
Rule 3
Eliminate more number of final state
φ φ
φ φ
φ φ
φ φ
7
Rule 4
Eliminate states
1.
φ φ
2.
3.
φ uu*e
4.
φ
rr*uu*e
5.
φ
tt*rr*uu*e
6.
tt*rr*uu*e
8
Part B: Context-Free Grammar
Context-free grammars (CFGs) are used to define context-free languages. Patterns of strings
are generated by a context free grammar which is a set of recursive rules. All regular languages
can be described by a context-free grammar; however, they cannot describe all possible
languages.
Part 1
S – AB | φ
A – tCu | φ
B–e|φ
C – rD | φ
D– φ
Part 2
Step 1
M = (V,∑,R,S)
V ={S,A,B,C,D,t,r,u,e,φ}
∑ = {t,r,u,e}
S – AB [A – tCu]
S – tCuB[C – rD]
S – trDuB[D – φ]
S – truB[B – e]
S – true
9
Part C: Complexity & Decidability
Most efficient solution of a problem is used to measure the complexity of it. Programmers and
developers who with a better understanding of how to create less resource-hungry processes
can build more efficient systems by applying computational complexity theory on items like
logic tress, nested loops or other type of rhythms (Techopedia, 2018).
Part 1
If ( S = true) {
for (int i = 0, i < n, i++){
if (X == A[i]){
System.out.println( “Found!” & stop );
else{
System.out.println( “Not Found!” );
}
}
}
}
Part 2
Best Case, O(1)
If S is true, and X is the first to match the comparison of Array A, O(1)
Worst Case, O(n)
If S is not true, or S is true but X is the last to match the comparison in Array A, O(n)
10
Part 3
Yes, it is decidable if S is set true in default in the programme as the programme will always
be true and execute the code, thus falls into best case scanario. It is a wiser choice to set the
input in default.
No, it is not decideable if S is inputted by the user into the programme as the programme will
not be executed and falls into worst case scenario if the user input is false. It is not a wise choice
to set the input by the user.
11
Conclusion
The benefit of learning computing theory is you are able to know the elementary ways in which
a computer can be made to think.
Besides that, in the field of Natural Language Processing that involved building Finite State
machines also called Finite State Automata, there is a great deal of work that was made possible.
Moreover, understand the mathematical laws leading efficient computation and use this
understanding to solve problem caused in other parts of computer science and mathematics, as
well as in other fields such as neuroscience and physics (Doaa Abousen, 2018).
12
References
Computer Hope, 2017. Finite Automata. [Online]
Available at: https://www.computerhope.com/jargon/f/finite-automata.htm
[Accessed 10 August 2018].
Cornell CIS, 2018. Theory of Computing. [Online]
Available at: https://www.cs.cornell.edu/research/theory
[Accessed 10 August 2018].
Doaa Abousen, 2018. The Theory of Computation. [Online]
Available at: https://web2.qatar.cmu.edu/~dabousen/theory%20of%20computation.html
[Accessed 10 August 2018].
GeeksforGeeks, 2018. Theory of computation | Decidable and undecidable problems.
[Online]
Available at: https://www.geeksforgeeks.org/theory-computation-decidable-undecidable-
problems/
[Accessed 10 August 2018].
kkdai, 2015. ε-NFA: Epsilon-Nondeterministic finite automaton. [Online]
Available at: https://github.com/kkdai/e-nfa
[Accessed 10 August 2018].
Techopedia, 2018. Computational Complexity. [Online]
Available at: https://www.techopedia.com/definition/18466/computational-complexity
[Accessed 10 August 2018].
Techopedia, 2018. Computational Complexity. [Online]
Available at: https://www.techopedia.com/definition/18466/computational-complexity
[Accessed 10 August 2018].
Tutorials Point, 2018. Deterministic Finite Automaton. [Online]
Available at:
https://www.tutorialspoint.com/automata_theory/deterministic_finite_automaton.htm
[Accessed 10 August 2018].
Tutorials Point, 2018. Non-deterministic Finite Automaton. [Online]
Available at:
https://www.tutorialspoint.com/automata_theory/non_deterministic_finite_automaton.htm
[Accessed 10 August 2018].
University of Rochester, 2018. Context-Free Grammars. [Online]
Available at: https://www.cs.rochester.edu/~nelson/courses/csc_173/grammars/cfg.html
[Accessed 10 August 2018].
13