Predicative programming is the original name of a formal method for program specification and refinement, more recently called a Practical Theory of Programming, invented by Eric Hehner. The central idea is that each specification is a binary (boolean) expression that is true of acceptable computer behaviors and false of unacceptable behaviors. It follows that refinement is just implication. This is the simplest formal method, and the most general, applying to sequential, parallel, stand-alone, communicating, terminating, nonterminating, natural-time, real-time, deterministic, and probabilistic programs, and includes time and space bounds.
Commands in a programming language are considered to be a special case of specification—those specifications that are compilable. For example, if the program variables are
x
y
z
x
y
x'
y
y'
y
z'
z
x
y
z
x'
y'
z'
x'
y
x
y
x'
y
x
y
x'
y
Loop proofs are greatly simplified. For example, if
x
while
x
x
x
refines, or implements the specification
x
x'
if
x
x
x
x
x'
ok
x
x'
where
ok
x'
x
Execution time (upper bounds, lower bounds, exact time) can be proven the same way, just by introducing a time variable. To prove termination, prove the execution time is finite. To prove nontermination, prove the execution time is infinite. For example, if the time variable is
t
x
x
x
if
x
x
x
t
t
x
t'
t
x
x
t'
ok
x
t'
t
x
x
t'
where
ok
x'
x
t'
t