Since that time I've been interested in the idea of proving programs correct. On weekends I'm currently making my way through David Gries's The Science of Programming. Similar books include
- A Discipline of Programming by Dijkstra
- The Evolution of Programs by N. Dershowitz
Both the Gries book and Stepanov's book have really impressive reviews on Amazon, am looking forward to diving into them.
http://www.amazon.com/Science-Programming-Monographs-Compute...
http://www.amazon.com/Elements-Programming-Alexander-Stepano...
http://en.wikipedia.org/wiki/Formal_semantics_of_programming...
I seem to remember that Dijkstra was keen on identifying weakest preconditions of different statements that can be used to prove a program correct.
However, I warn you that if you try this you will soon find out what this kind of formal reasoning about programs never caught on that widely - at least for imperative programs.