Godel's incompleteness theorem indicates illegal states as unrepresentable is impossible at a fundamental level.
It is true that it is impossible in general, but that says nothing about whether or not it is possible in almost every useful case
If we carve out "programs that run themselves on themselves and then do the opposite", what remains?