Finite Automata (Finite State Machine)
  Def 1.5, p 35:
    states, alphabet, transition function, start state, accepting states
  state diagram
  Def 1.16: A language is a regular language if some finite automata accepts it
  Computer scientist/engineer Finite State Machine: Finite state transducer, p. 87

Nondeterminate Finite Automata
  Section 1.2
  Transition function:
    "Goes" between sets of next moves
       or "splits" into a copy (or fork)
    Includes an epsilon transition, ε, for a spontaneous state change
  DFA → NFA (trivial)
  NFA → DFA (if DFA has k states, the NFA can have 2k states)
  Cor 1.40: A language is regular iff some nondeterminate finite automate accepts it

Regular operations
  Operates on sets
Regular expressions
  Section 1.3
  Formal language
  Formal definition: Definition 1.52
    symbols from an alphabet Σ
    ε (empty string)
    ∅ (empty set)
    Union: A ∪ B
    Concatenation: A ○ B
    Star: A*

  Kleene star
  Stephen Cole Kleene

  egrep
    R1 + R2        
    R*
    R+		match 1 or more
    R?		match 0 or 1
    R{m,n}	match m to n occurrences
    .		any character
    ^		match beginning
    $		match end

  Programming languages
     Java
     JavaScript
     Python

Equivalences
Regular expression ⇒ NFA
	Construct the NFA! Not so hard.
	Lemma 1.55, Example 1.58 (pp 68-69)

DFA ⇒ Regular expression
	Tedious (pp 70-76)
	   GNFA: Generalized nondeterminate finite automata
	The process 
	   n state DFA ⇒ (n+2) state GNFA
	  (i+1) state GNFA ⇒ i state GNFA
	     repeat until number of states is 2: starting and accepting

Pumping lemma
   If A is regular
      there exists p
         such for any string s in A of length p or greater
            there are strings x, y, z
      such that
         0)  s = x y z
         1)  |x y| ≤ p             |...| is sizeof
         2)  |y| > 0
         3)  for every i ≥ 0, x yi z is in A

   necessary but not sufficient condition

Example 1.73   {0n 1n | n >= 0} is not regular
     Assume p of pumping lemma
     Let s = 0p 1p
        There are x, y, z where 0p 1p = x y z, |x y| ≤ p and |y| > 0
        This means y is 0i for some i > 0
     Pumping y will give you too many 0’s
     Therefore the language is not regular

Example 1.74   {w | w has an equal number of 0's and 1's} is not regular
     Assume p of pumping lemma
     Let s = 0p 1p
        There are x, y, z where 0p 1p = x y z, |x y| ≤ p and |y| > 0
        This means y is 0i for some i > 0
     Again pumping y will give you too many 0’s
     Also, intersecting this language 0* 1* yields example 1.73

Example 1.75   {w w | w is composed of 0's and 1's} is not regular
     Assume p of pumping lemma
     Let s = 0p 1 0p 1
        There are x, y, z where 0p 1 0p 1 = x y z, |x y| ≤ p and |y| > 0
        This means y is 0i for some i > 0
     However, 0p+i 1 0p 1 is not in language
     Note: the hard part is getting the right s

Example 1.76   {1n*n | n >= 0} is not regular
    Assume p of pumping lemma

Let s = 1p*p

        There are x, y, z where 1p*p = x y z, |x y| ≤ p and |y| > 0
        This means y is 1q for some q such that q > 0 and q < p
     |x y y z| == |1p*p+q| = where q ≤ p, but p*p+q is less than (p+1)*(p+1) which is p*p+2*p + 1

Example 1.77   {0i 1j | i > j} is not regular
     Assume p of pumping lemma

Let s = 0p+1 1p

        There are x, y, z where 0p+1 1p = x y z, |x y| ≤ p and |y| > 0
        This means y is 0q for some q such that q > 0 and q < p
     Removing y makes the number of 0’s less than or equal to the number of 1’s