Every programmer has wondered: what inputs will make this code do the right thing? Answering that question by testing is slow and incomplete. There is a better way.
In 1975, Edsger W. Dijkstra introduced the predicate transformer — a mechanical rule that works backward through a program. You start with the result you want (the postcondition), feed it through the program in reverse, and out comes the weakest precondition: the most permissive description of all inputs for which the program is guaranteed to deliver that result.
"Weakest" here means least restrictive — any stronger condition would unnecessarily exclude valid inputs. The predicate transformer computes exactly the right one, neither too tight nor too loose, by a small set of rules applied to each statement one at a time.
This is not just theory. The same idea powers every modern program verification tool, automated test generators, and the proofs that keep critical software safe.
Comments
Loading comments...