Source: https://people.cs.clemson.edu/~goddard/texts/theoryOfComputation/3a.pdf