https://cs.nyu.edu/courses/spring03/G22.2560-001/nondet.html