# Finite State Machines
A **deterministic finite automata** is sometimes called a **DFA**. The DFA named, A, is defined mathematically with a 5-tuple.
A = (Q, Σ, δ, q0, F)
* Q is a finite set of states
* Σ is a finite set of symbols (an alphabet)
* δ is a transition function δ:QxΣ->Q
* q0 is the start state
* F is a set of final or accepting states F ⊆ Q
**Σ*** denotes the set of all finite strings that can be made using letters from Σ.
The empty string is denoted **ε**.
The δ function has a natural extension to a function δ̂:QxΣ*->Q. We call this function **delta-hat**. It is defined to be the result of iteratively applying each letter in the second argument to produce the next state.
δ̂(q, 123) = δ(δ(δ(q0, 1), 2), 3)
We can define the **language of a state machine** A in the following way:
L(A) = {w∈Σ* | δ̂(q0, w)∈F}
In plain English, The language of A is the set of all words from the alphabet Σ that will cause the delta-hat function to return a final state when beginning at the start state.
# Regular Expressions
The language of finite state machines are the regular expressions. There are five rules the define a regular expression.
* A symbol taken from the alphabet is a regular expression.
* If E is a regular expression, then (E) is also a regular expression with the same language. L(E) = L((E)).
* If A and B are regular expressions, then A+B is a regular expression. L(A+B) == L(A) ∪ L(B)
* If A and B are regular expressions, then AB is a regular expression. (concatenation A followed by B) L(AB) = L(A) X L(B)
* If A is a regular expression, then A* is a regular expression. (closure zero or more occurrences of A)
The precedence of the last three operators are in order from lowest precedence, to highest.