(Content for this lecture is also taken from J. Ullman’s slides)
Khawaja 2020 Automata Theory & Languages 1 Introduction • Instructor’s Name: Khawaja Mohiuddin • Instructors Introduction: • Email address: khawaja.mohiuddin@szabist.edu.pk • Consultation Hours: Wed & Thurs, 10:30 – 11:30 • Class CR • Students’ Introduction: – Name – Answer One Question? Khawaja 2020 Automata Theory & Languages 2 Books and References • Text Book: “Introduction to Automata Theory, Languages and Computation” by John E. Hopcroft, Rajeev Motwani, Jeffrey D. Ullman, 3rd edition, 2006. • Reference Book: “Introduction to the Theory of Computation“ by Michael Sipser, 3rd edition, 2012.
• Come to class on time • Participate in class and ask questions if needed • Do assignments on your own • Study for Quizzes / Tests • All above points also help you in getting good marks in Midterm Exam and Final Exam • What does not help in getting a good grade? Asking teacher to give additional marks as a favor
Khawaja 2020 Automata Theory & Languages 5
Automata Theory • Automata Theory is the study of abstract computing devices or “machines”. • Alan Turing in 1930’s, before there were any computers, studied an abstract machine that had the computing capabilities of today’s computers. • Turing's goal was to describe precisely the boundary between what a computing machine could do and what it could not do. • In the 1940s and 1950s, simpler kinds of machines, which we today call finite automata, were studied by a number of researchers. Khawaja 2020 Automata Theory & Languages 6 Formal Grammars • Also in the late 1950s, the linguist N. Chomsky began the study of formal “grammars”. • While not strictly machines, these grammars have close relationships to abstract automata and serve today as the basis of some important software components including parts of compilers.
Khawaja 2020 Automata Theory & Languages 7
Intractable Problems • In 1960's, S. Cook extended Turing's study of what could and what could not be computed. • Cook was able to separate those problems that can be solved efficiently by computer from those problems that can in principle be solved, but in practice take so much time that computers are useless for all but very small instances of the problem. • The latter class of problems is called "intractable" or "NP-hard". • It is highly unlikely that even the exponential improvement in computing speed will have significant impact on our ability to solve large instances of intractable problems.
Khawaja 2020 Automata Theory & Languages 8
Basis of Computing • All of these theoretical developments bear directly on what computer scientists do today. • Some of the concepts like finite automata and certain kinds of formal grammars are used in the design and construction of important kinds of software. • Other concepts like the Turing machine help us understand what we can expect from our software. Khawaja 2020 Automata Theory & Languages 9 Why Study Automata? • Qs: Why study a course with models, terms, mathematical concepts, expressions, …? • Qs: Why not just use a programming language or a tool and build the software we want? • Ans: To answer questions like following: – Where did the core concepts of computing came from? – How were programming languages designed? – How were compilers designed to check syntax? – What made the designers be sure of what they were trying to build will actually work? Khawaja 2020 Automata Theory & Languages 10 Why Study Automata? (ctd) • Regular expressions are used in many systems – E.g., UNIX ab* – E.g., DTD’s describe XML tags with a Regular Expression format like person (name, addr, child*) • Finite automata model communication protocols, electronic circuits. – Theory is used in model-checking.
Khawaja 2020 Automata Theory & Languages 11
Why Study Automata? (ctd) • Context-free grammars are used to describe the syntax of essentially every programming language. – Also play important role in describing natural languages. • And DTD’s taken as a whole, are really CFG’s.
Khawaja 2020 Automata Theory & Languages 12
Why Study Automata? (ctd) • When developing solutions to real problems, we often confront the limitations of what software can do. – Undecidable Problems – no program whatsoever can solve it. – Intractable Problems – there are programs, but no fast programs.
Khawaja 2020 Automata Theory & Languages 13
Course Outline • Theory of Computation and Languages • Finite State Automata • Deterministic and Non-deterministic Finite Automata • Finite Automata with Epsilon Transitions • Regular Expressions • Regular Languages
Khawaja 2020 Automata Theory & Languages 14
Course Outline (ctd) • Context Free Grammars • Ambiguity in Context Free Grammars • Parse Trees • Push Down Automata • Chomsky Normal Form • Turing Machines
Khawaja 2020 Automata Theory & Languages 15
A Model for an On/Off Switch There is a light switch, which has only one button. When we push the button, if switch was off it will turn on and if it was on it will turn off. Write down pseudocode logic to show the above functionality: Hints: Use a variable called state to check and store on/off values, use a function called transition(push) to push the button.
if((state == “off”) && transition(push))
state = “on”; else if((state == “on”) && transition(push)) state = “off”;
Khawaja 2020 Automata Theory & Languages 16
A Model for an On/Off Switch (Finite Automata Example)
More Examples: • Switch up/down button • Transitioning to a higher class