# NewSpeak: a reliable programming language

• I. F. Currie
Part of the Software Science and Engineering book series (SSEN)

## Abstract

Consider the following fragment of Pascal program for evaluating factorials:
$$\begin{array}{*{20}c} {i: = 0;x: = 1;} \\ {while\;i < n} \\ \begin{gathered} begin\;i: = i + 1 \hfill \\ x:i*x \hfill \\ \end{gathered} \\ {end} \\ \end{array}$$
One could prove that this program does indeed implement n! by the following reasoning. A useful invariant of the while-statement is x=i!. This is trivially proved by observing that x= 1 =0! initially and applying induction on i. Provided n is a positive integer, the loop will terminate with i = n and hence the final value of x is n!. This proof could be formalized and even produced automatically by any one of a variety of program-proving systems.

## Keywords

Actual Parameter Floating Point Float Point Number Concrete Syntax Proof Rule

## Reference

1. [Cullyer 1987]
Cullyer J., “Implementing safety-critical systems: the Viper microprocessor”, Proc. Hardware Verification Workshop, University of Calgary (Jan. 1987).Google Scholar