# Programming

The process of designing programs (cf. Program), a plan of action.

The discipline studying methods and means for designing programs. As a discipline programming can be divided, with a large part of arbitrariness, into theoretical programming, studying mathematical abstractions of programs and ways of constructing them, system programming, occupying itself with the development of software for computers, i.e. of program complexes for large-scale or protracted use, and applied programming, attending to concrete applications of computers in all their variants.

Designing programs is a creative activity, since the attempt to arrive at a goal, even a clearly outlined one, by certain means requires, in general, the development or involvement of new knowledge. In certain particular situations it is possible to find more systematic or formal programming procedures. E.g. if the programming task has already been formulated as an algorithm, programming reduces to a translation from the language in which the algorithm is written, or algorithmic language, into a language that can immediately be accepted by the computer. For certain mathematical models the translation problem has been solved exhaustively. E.g. if a problem is formulated as an existence theorem,

where is a formula in the restricted predicate calculus, then from the proof of the theorem in constructive logic one can effectively extract a recursive description of the functions for which (the Kleene–Nelson theorem). The attempt to translate the description of the algorithm into a program and to derive the program from the conditions of the problem and additional information in a systematic way forms the subject matter of automatic programming and its particular case, the translation of programs.

The methodics of programming devotes special attention to the ways of describing the initial specification of a problem that needs to be programmed, since a skillful use of the information contained in the specification makes it possible to give a more reliable character to programming. An important aspect of programming is the care for a clear program structure, facilitating the verification of correctness of the program, and most important is the extraction and isolation of those fragments of a program whose further elaboration into details requires that new knowledge be invoked.

A conception of the way of transition from the specification of a problem to a program is given by the following example of programming, viz. the problem of raising to a natural power .

The initial knowledge: , , . Discovering that these relations allow one to reduce the solution of the problem of to simpler ones (i.e. with lesser ), one attempts to specify the initial knowledge in the simple form (a creative step):

Analysis of the content shows that the third relation is more effective than the second, but is not always applicable. The second relation is re-written, keeping in mind the case complementary to the third relation (a creative step):

By using the invertibility of the functions and as well as the logical incompatibility of the relations, one obtains a recursive relation by the method of sorting out cases (a formal step):

It remains to re-write this rule in some algorithmic language, e.g. Algol-60 (a formal step):

;

.

The determination of a procedure to check the parity is a separate, more particular, programming problem.

An important component of programming is to check the correctness of a program. One way to ensure correctness is to specify the procedure of programming in a form that resembles the proof of a theorem, i.e. when each formation step of the program can be associated with a reasoning by means of which the consistency of this step can be confirmed with the initial knowledge on the program and the additional information used in the step. The formal deductive system that arises in this way is also studied in theoretical programming. An additional means for checking correctness of an already compiled program is systematic execution, i.e. systematic testing on a computer and comparing the effects generated by the program with the expected effects. Although in practice systematic execution is the most important means of checking a program, theoretically it cannot be exhaustive, since the establishment of correctness of a program by a finite system of tests can be realized for very narrow classes of problems only (cf. Automata, theory of).

#### References

[1] | E.Z. Lyubimskii, V.V. Martinyuk, N.P. Trifonov, "Programming" , Moscow (1980) (In Russian) |

[2] | E.W. Dykstra, "A discipline of programming" , Prentice-Hall (1976) |

[3] | B. Meyer, C. Baudoin, "Méthodes de programmation" , 1–2 , Eyrolles (1978) |

#### Comments

#### References

[a1] | D. Gries, "The science of programming" , Springer (1981) |

**How to Cite This Entry:**

Programming. A.P. Ershov (originator),

*Encyclopedia of Mathematics.*URL: http://www.encyclopediaofmath.org/index.php?title=Programming&oldid=12500