Source: https://cs.uwaterloo.ca/~cbruni/CS245Resources/lectures/2018_Fall/23_Decidability_Halting_Problem_post.pdf