High-Integrity Software pp 122-158 | Cite as

# NewSpeak: a reliable programming language

Chapter

## Abstract

Consider the following fragment of Pascal program for evaluating factorials:
One could prove that this program does indeed implement

$$
\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}
$$

*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## Preview

Unable to display preview. Download preview PDF.

## Reference

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

## Copyright information

© Crown Copyright 1989