Source: https://cglab.ca/~michiel/TheoryOfComputation/TheoryOfComputation.pdf