Source: https://www.cs.utexas.edu/~ear/cs341/automatabook/AutomataTheoryBook.pdf