I laughed at formal methods of program proof until I came across a simplified version of cleanroom development methodology (which breaks program components into 'program primes' like A then B, If A then B, While A do B and for A in B do C) that allowed you to formally prove outcomes on paper. I have long since lost the document but to this day, I construct most of my work around these primes for certain projects.