Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
Próximos SlideShares
Carregando em…5
×

# Introduction to the theory of computation

5.737 visualizações

• Full Name
Comment goes here.

Are you sure you want to Yes No
• If u need a hand in making your writing assignments - visit ⇒ www.WritePaper.info ⇐ for more detailed information.

Tem certeza que deseja  Sim  Não
Insira sua mensagem aqui
• Yes you are right. There are many research paper writing services available now. But almost services are fake and illegal. Only a genuine service will treat their customer with quality research papers. HelpWriting.net

Tem certeza que deseja  Sim  Não
Insira sua mensagem aqui

### Introduction to the theory of computation

1. 1. Introduction to the Theory of Computation, Michael Sipser Chapter 0: Introduction Automata, Computability and Complexity: • They are linked by the question: o “What are the fundamental capabilities and limitations of computers?” • The theories of computability and complexity are closely related. In complexity theory, the objective is to classify problems as easy ones and hard ones, whereas in computability theory he classification of problems is by those that are solvable and those that are not. Computability theory introduces several of the concepts used in complexity theory. • Automata theory deals with the definitions and properties of mathematical models of computation. • One model, called the finite automaton, is used in text processing, compilers, and hardware design. Another model, called the context – free grammar, is used in programming languages and artificial intelligence. Strings and Languages: • The string of the length zero is called the empty string and is written as ε. • A language is a set of strings. Definitions, Theorems and Proofs: • Definitions describe the objects and notions that we use. • A proof is a convincing logical argument that a statement is true. • A theorem is a mathematical statement proved true. • Occasionally we prove statements that are interesting only because they assist in the proof of another, more significant statement. Such statements are called lemmas. • Occasionally a theorem or its proof may allow us to conclude easily that other, related statements are true. These statements are called corollaries of the theorem. Chapter 1: Regular Languages Introduction: • An idealized computer is called a “computational model” which allows us to set up a manageable mathematical theory of it directly. • As with any model in science, a computational model may be accurate in some ways but perhaps not in others. • The simplest model is called “finite state machine” or “finite automaton”. Finite Automata: • Finite Automata are good models for computers with an extremely limited amount of memory, like for example an automatic door, elevator or digital watches. • Finite automata and their probabilistic counterpart “Markov chains” are useful tools when we are attempting to recognize patterns in data. These devices are used in speech processing and in optical character recognition. Markov chains have even been used to model and predict price changes in financial markets. • State diagrams are described on p.34. • The output of an finite automaton is “accepted” if the automaton is now in an accept state (double circle) and reject if it is not. 1PDF created with FinePrint pdfFactory trial version http://www.pdffactory.com
2. 2. • A finite automaton is a list of five objects: o Set of states o Input alphabet o Rules for moving o Start state o Accepts states • δ ( x,1) = y , means that a transition from x to y exists when the machine reads a 1. • Definition: A finite automaton is a 5 – tuple (Q, Σ, δ , q 0 , F ) , where 1. Q is a finite set called the states. 2. Σ is a finite set called the alphabet. 3. δ : Q × Σ → Q is the transition function 4. q 0 ∈ Q is the start state 5. F ⊆ Q is the set of accept states. • If A is the set of all strings that machine M accepts, we say that A is the language of machine M and write L(M) = A. We say M recognizes A. • A language is called a “regular language” if some finite automaton recognizes it. • A finite automaton has only a finite number of states, which means a finite memory. • Fortunately, for many languages (although they are infinite) you don’t need to remember the entire input (which is not possible for a finite automaton). You only need to remember certain crucial information. The Regular Operations: • We define 3 operations on languages, called the regular operations, and use them to study properties of the regular languages. • Definition: Let A and B be languages. We define the regular operations union, concatenation and star as follows: o Union: A ∪ B = {x | x ∈ A or x ∈ B} o Concatenation: A o B = {xy | x ∈ A and y ∈ B} o Star: A* = {x1 x 2 ...x k | k ≥ 0 and each xi ∈ A} • Example: Let the alphabet Σ be the standard 26 letters {a, b, …, z}. If language A = {good, bad} and language B = {boy, girl}, then: o A ∪ B = {good, bad, boy, girl} o A o B = {goodboy, goodgirl, badboy, badgirl} o A* = {ε, good, bad, goodgood, goodbad, badgood, badbad, goodgoodgood, goodgoodbas, …} • The class of regular languages is closed under the union operation. In other word, if A and B are regular languages, so is A ∪ B . • The class of regular languages is closed under the concatenation operation. • The class of regular languages is closed under the intersection operation. • The class of regular languages is closed under the star operation. Nondeterminism: • Nondeterminism is a generalization of determinism, so every deterministic finite automaton is automatically a nondeterministic finite automaton. • In a DFA (deterministic finite automaton), every state always has exactly one exiting transition arrow for each symbol in the alphabet. In an NFA (nondeterministic finite automaton) a state may have zero, one or many exiting arrows for each alphabet symbol. 2PDF created with FinePrint pdfFactory trial version http://www.pdffactory.com
3. 3. • How does an NFA compute? Suppose that we are running an NFA on an input string and come to a state with multiple ways to proceed. Fro example, say that we are in state q1 in NFA N1 and that the next input symbol is a 1. After reading that symbol, the machine splits into multiple copies of itself and follows all the possibilities in parallel. Each copy of the machine takes one of the possible ways to proceed and continues as before. If there are subsequent choices, the machine splits again. If the next input symbol doesn’t appear on any of the arrows exiting the state occupied by a copy of the machine, that copy of the machine dies, along with the branch of the computation associated with it. Finally, if any one of these copies of the machine is in an accepts state ate the end of the input, the NFA accepts the input string. If a state with an ε symbol on an exiting arrow is encountered, something similar happens. Without reading any input, the machine splits into multiple copies, one following each of the exiting ε - labelled arrows and one staying at the current state. Then the machine proceeds nondeterministically as before. • Nondeterministic finite automata are useful in several respects. As we will show, every NFA can be converted into an equivalent DFA, and constructing NFAs is sometimes easier than directly constructing DFAs. An NFA may be much smaller than its deterministic counterpart, or its functioning may be easier to understand. Nondeterministic Finite Automaton: • Definition: A nondeterministic finite automaton is a 5 – tuple (Q, Σ, δ , q 0 , F ) , where 1. Q is a finite set of states. 2. Σ is a finite alphabet. 3. δ : Q × Σ ε → P (Q ) is the transition function, Σ ε = Σ ∪ {ε } 4. q 0 ∈ Q is the start state. 5. F ⊆ Q is the set of accept states. • In a DFA the transition function takes a state and an input symbol and produces the next state. In a NFA the transition function takes a state and an input symbol or the empty string and produces the set of possible next states. • For any set Q we write P(Q) to be the collection of all subsets of Q (Power ser of Q). • Deterministic and nondeterministic finite automaton recognize the same class of languages. • Two machines are equivalent if they recognize the same language. • Every NFA has an equivalent DFA. • If k is the number of states of the NFA, it has 2 k subsets of states. Each subset corresponds to one of the possibilities that the DFA must remember, so the DFA simulating the NFA will have 2 k states. • NFA transforming to DFA: o The DFA M accepts (means it is in an accept state) if one of the possible states that the NFA N could be in at this point, is an accept state. o A language is regular if and only if some NFA recognizes it. Regular Expressions: • Definition: Say that R is a regular expression if R is: 1. a for some a in the alphabet Σ . 2. ε. 3. ∅, 1*∅ = ∅, ∅* = {ε}, R o ∅ = ∅ 4. ( R1 ∪ R 2) , where R1 and R2 are regular expressions. 5. ( R1 o R 2) , where R1 and R2 are regular expressions. 6. (R1*) , where R1 is a regular expression. • The value of a regular expression is a language. • Regular expressions have an important role in computer science applications. In applications involving text, user may want to search for strings that satisfy certain patterns . Regular expressions provide a powerful method for describing such patterns. 3PDF created with FinePrint pdfFactory trial version http://www.pdffactory.com