1 / 26

CS 490: Automata and Language Theory

CS 490: Automata and Language Theory. Daniel Firpo Spring 2003. Regular Languages. Finite Automata (also known as the Finite State Machine) Regular Expressions. Regular Languages: Finite Automata. Formally, a finite automaton is a 5-tuple (Q, Σ, δ, q 0 , F), where:

quanda
Download Presentation

CS 490: Automata and Language Theory

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 490: Automata and Language Theory Daniel Firpo Spring 2003

  2. Regular Languages • Finite Automata (also known as the Finite State Machine) • Regular Expressions

  3. Regular Languages: Finite Automata • Formally, a finite automaton is a 5-tuple (Q, Σ, δ, q0, F), where: • Q is a finite set of states, • Σ is a finite set called the alphabet (of the automaton), • δ : Q x Σ --> Q is the transition function, • q0 Q is the start state, and • F  Q is the set of accept states.

  4. Finite Automaton are visually represented as state diagrams. For example: Finite Automaton, M: Regular Languages: Finite Automata 0 1 0 1 q1 q2 q3 0,1

  5. Finite Automaton, M: M = (Q, Σ, δ, q0, F): Q = {q1, q2, q3}, Σ = {0,1}, δ is described as: 0 1 q1 q1 q2 q2 q3 q2 q3 q2 q2 q1 is the start state, And F = {q2}. Regular Languages: Finite Automata 0 1 0 1 q1 q2 q3 0,1

  6. Regular Languages: Finite Automata • The type of finite automaton described in the preceding example is a deterministic finite automaton (DFA). • An easier model to work with is the nondeterministic finite automaton (NFA).

  7. Regular Languages: Finite Automata • While in a DFA, every state must have exactly one transition path for each symbol in the automaton’s alphabet, an NFA can have as one, none, or as many transition path as it needs for each symbol in the alphabet. • An NFA can also have a transition path(s) for the empty input, ε. • DFA’a and NFA’s are equivalent.

  8. Regular Languages: Finite Automata • Formally, an NFA is a 5-tuple (Q, Σ, δ, q0, F), where: • Q is a finite set of states, • Σ is a finite set called the alphabet (of the automaton), • δ : Q x Σε --> P(Q) is the transition function, • q0 Q is the start state, and • F  Q is the set of accept states.

  9. The NFA, N: N = (Q, Σ, δ, q0, F): Q = {q1, q2, q3, q4}, Σ = {0,1}, δ is described as: 0 1 ε q1 { q1}{q1,q2}Ø q2 { q3} Ø {q3} q3 Ø q2 Ø q4 {q4} {q4} Ø q1 is the start state, And F = {q4}. Regular Languages: Finite Automata 0,1 1 q1 q2 0, ε 0,1 q3 q4 1

  10. Regular Languages: • Regular Operations: • Union: A  B = {x|x  A or x  B}, • Concatenation: AB = {xy|x  A and x  B}, • Star: A* = {x1x2…xk|k  0 and each xi A}. • The class of regular languages is closed under the regular operations. That is, if A and B are regular languages, than so is A  B, AB, and A*.

  11. Regular Languages: Regular Expressions • Formally, we say that R is a regular expression if R is: • A, for some a in the alphabet Σ, • ε, the empty string, • Ø, the empty language, • A  B, • AB, or • A*, • Where A and B are regular languages.

  12. Regular Languages: Regular Expressions • Regular expressions are useful for designing compilers. The syntax of the tokens, the elemental objects in a programming language, such as the variables and constants, can be described by regular expressions. Once this is done, systems generate the lexical analyzer, which processes the input program. • Regular expressions and finite automata are equivalent.

  13. Context-Free Languages • Pushdown automata (PDA) • Context-free grammars (CFG)

  14. Context-Free Languages: Pushdown Automaton • A PDA is very similar to a NFA. • The main difference is that a PDA has a stack, which serves to provide additional memory to the automata.

  15. Context-Free Languages: Pushdown Automaton • Formally, a pushdown automaton is a 6-tuple (Q, Σ, Γ, δ, q0, F), where: • Q is a finite set of states, • Σ is a finite set called the alphabet (of the automaton), • Γ is the stack alphabet, • δ : Q x Σε x Γε --> P(Q x Γε) is the transition function, • q0 Q is the start state, and • F  Q is the set of accept states.

  16. The PDA, M: M = (Q, Σ, Γ, δ, q0, F): Q = {q1, q2, q3, q4}, Σ = {0,1}, Γ = {0,$}, δ is described on the next slide, q1 is the start state, And F = {q1,q4}. Context-Free Languages: Pushdown Automata 0,ε0 ε,εε q1 q2 1,0ε q4 q3 ε,$ε 1,0ε

  17. The PDA, M: δ is described by: Context-Free Languages: Pushdown Automata 0,ε0 ε,εε q1 q2 1,0ε q4 q3 ε,$ε 1,0ε

  18. Context-Free Languages: Context-Free Grammars • Formally, a context-free grammar is a 4-tuple, (V, Σ, R, S), where: • V is a finite set of variables, • Σ is a finite set of terminals, • R is a finite set of rules, and • S  V is the start variable.

  19. Context-Free Languages: Context-Free Grammars • For example, the following grammar: • G = (V, Σ, R, S), where • V = {S,T}, • Σ = {0,1}, • and R, the rules, are • S  0S1 | T • T  ε • Generates strings such as 01, 0011, and 000111. The language of this grammar, L(G), is: • {0n1n | n  0}. • CFG’s and PDA’s are equivalent.

  20. Turing Machines • Turing Machines (TM) are similar to PDA’s, but with memory that is unlimited and unrestricted. • The Turing Machine uses an infinite tape. • The tape head can read and write symbols on the tape. It can also move to the left or right over the tape. • Turing machines have accept states and reject states, which take immediate effect.

  21. Turing Machines • Turing machines are formally defined as a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where • Q is a finite set of states, • Σ is the input alphabet, • Γ is the tape alphabet, containing the special blank symbol, , where   Γ and Σ  Γ, • δ : Q x Γ  Q x Γ x {L,R} is the transition function, • q0 Q is the start state, • qaccept  Q is the accept state, and • qreject  Q is the reject state, where qreject != qaccept.

  22. Turing Machines • An example, the Turing machine, M: 0L xL xR q5 xR R L 0,R q1 q3 q5 0x,R R R xR 0x,R 0x qaccept xR qreject q2 R

  23. Turing Machines • In this Turing Machine, M = (Q,Σ,Γ,δ,q0,qaccept,qreject), such that • Q = {q1,q2,q3,q4,q5,qaccept,qreject}, • Σ = {0}, • Γ = {0,x,}, • δ is described by the state diagram on the previous slide, • The start state is q0, • The accept state is qaccept, and • The reject state is qreject. • M decides the language A = {02^n | n  0}.

  24. Decidability • A language is called Turing recognizable if some Turing machine recognizes it. • When a Turing machine receives an input, it can either accept, reject, or loop. The machine fails to accept an input that either rejects or loops. • A Turing machine that never loops (either accepts or rejects) is called a decider. • A decider that recognizes a language is also said to decide the language. • A language is decidable if some Turing machine decides it. The TM in the previous example was a decider.

  25. Decidability • The relationship among the four main classes of languages: Turing-recognizable Decidable Context-free Regular

  26. Resource: • Sipser, Michael. Introduction to the Theory of Computation. Boston: PWS Publishing Company, 1997.

More Related