lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

index.md (2908B)


      1 +++
      2 title = "Lecture 1"
      3 template = "page-math.html"
      4 +++
      5 
      6 # Automata and complexity
      7 
      8 [Slides](http://joerg.endrullis.de/automata/)
      9 
     10 ## Intro
     11 
     12 Some problems are undecidable: program termination, post correspondence
     13 problem
     14 
     15 Some are NP-complete - travelling salesman, satisfiability in
     16 prop. logic
     17 
     18 **Word**: finite sequence of symbols from finite alphabet Σ
     19 
     20 conventions:
     21 
     22 -   symbols: a, b, c
     23 -   words: u, v, w, x, y, z
     24 -   empty word: λ
     25 
     26 computer program is a word, takes input word, produces output word
     27 
     28 can concatenate words, \|v\| means length of word
     29 
     30 power v<sup>k</sup> is k concatenations of v's
     31 
     32 reverse (a<sub>1</sub> ... a<sub>n</sub>)<sup>R</sup> = a<sub>n</sub> ... a<sub>1</sub>
     33 
     34 ## Formal languages
     35 
     36 Formal language: set of words.
     37 
     38 Σ<sup>\*</sup> is set of all words over Σ, formal language L is subset of Σ<sup>\*</sup>
     39 
     40 Since it's a set, the usual set operations have meaning (complement,
     41 union, intersection, etc.)
     42 
     43 nth power of language is L<sup>n+1</sup> = L<sup>n</sup> L
     44 
     45 Kleene star: $L<sup>* = \bigcup_{i=0}</sup>{\infty} L<sup>i$, $L</sup>+ = \bigcup_{i=1}<sup>{\infty} L</sup>i$
     46 
     47 $\overline{L}<sup>R$ == $\overline{L</sup>R}$
     48 
     49 But sets are not the best for language description, so let's use something else.
     50 
     51 ## Deterministic Finite Automata (DFA)
     52 
     53 Consists of:
     54 
     55 -   Q: finite set of states
     56 -   Σ: finite input alphabet
     57 -   δ : Q × Σ → Q: transition function
     58 -   q<sub>0</sub> ∈ Q: starting state
     59 -   set F ⊂ Q of final states
     60 
     61 If automaton in state q reads symbol a, resulting state is δ(q, a).
     62 
     63 $(q, aw) \vdash (q', w) \quad if \quad \delta(q, a) = q'$
     64 
     65 You can write transition function δ in form of table:
     66 
     67 |       | State              ||
     68 | ---   | ------   | ------   |
     69 | **δ** | **q<sub>0</sub>** | **q<sub>1</sub>** |
     70 | a     | q<sub>0</sub>     | q<sub>1</sub>     |
     71 | b     | q<sub>1</sub>     | q<sub>0</sub>     |
     72 
     73 
     74 
     75 ### DFA transition graphs
     76 
     77 DFA can be visualised as transition graph:
     78 
     79 -   states are nodes of graph
     80 -   arows with labels from Σ
     81 -   starting state: extra incoming arrow
     82 -   final states: double circle
     83 -   arrow q → q\' with label a iff δ(q, a) = q\'
     84 
     85 ![](880d7e035dcb41b290b260eb932562c7.png)
     86 
     87 if $(q, w) \vdash^* (q', λ)$, can write $q \xrightarrow{w} q'$
     88 
     89 A DFA defines a regular language based on what it accepts (or rejects).
     90 
     91 To get a complement, you can just invert final states.
     92 
     93 ### Determinism
     94 
     95 Deterministic: for every state and symbol, any state q has only one
     96 outgoing arrow with label a
     97 
     98 For every input word, there\'s exactly one path from starting state
     99 through transition graph
    100 
    101 ### Theorems for regular languages
    102 
    103 A language is regular if there is a DFA M = (Q, Σ, δ, q<sub>0</sub>, F) with L(M) = L
    104 
    105 If L regular, $\overline{L}$ also regular.
    106 
    107 If L<sub>1</sub> and L<sub>2</sub> regular, then L<sub>1</sub> ∪ L<sub>2</sub> regular.
    108 
    109 If L regular, L<sup>R</sup> regular.
    110 
    111 Every finite language is regular.