Type systems can already prove significant aspects of programs correct, and the stronger the type system and the more thoroughly you make use of it, the more properties can be proven.
The issue with proving programs correct in general is essentially that programs can be quite large and complex, making full proofs of correctness a major undertaking that generally isn’t considered worth the effort, compared to testing and using the program to discover bugs.
It has nothing to do with the idea that “programming isn’t math.”
1. "State space of the towers of Hanoi program is a Sierpinski triangle!".
I don't quite understand why that is, or how to prove it, or even how to draw the state-space. But isn't that simply amazing?
2. Laws of software resemble laws of gravity, at least in one aspect:
It is easy to understand and use Newton's laws of gravity in the case of TWO objects. What is difficult to analyze and predict is the gravitaional interactions of > 2 objects. In software the difficulty (or impossibility) is to understand what happens when thousands of software components interact with each other.
Now draw a dot to represent this state, then consider the two consequent states that can come out of it (move the smallest disk to one of the two empty towers). Draw a line representing the transition between the initial and those two consequent states (and the reverse, you don't need arrows here as all movements are reversible). Now examine the two new states, you'll see you can draw a line between them and also introduce two more states (move second biggest disk to the still empty tower).
Repeat this process, and select the right arrangement of the nodes, and you'll get something approximating the sierpinski triangle. You may need to play with the layout a bit to get it right.
Start with just one disk, then two, then three to see how it gets more and more like the sierpinski triangle as the disks increase.
EDIT: https://www.cut-the-knot.org/triangle/Hanoi.shtml - found this which illustrates it and already has the right layout so you don't have to retry it. You'll notice that it's not quite the same as the Sierpinski triangle, the middle sections are hexagons instead of triangles.