Namespaces
Variants
Actions

Difference between revisions of "Programming"

From Encyclopedia of Mathematics
Jump to: navigation, search
m (Undo revision 48308 by Ulf Rehmann (talk))
Tag: Undo
m (tex encoded by computer)
 
Line 1: Line 1:
 +
<!--
 +
p0750901.png
 +
$#A+1 = 20 n = 0
 +
$#C+1 = 20 : ~/encyclopedia/old_files/data/P075/P.0705090 Programming
 +
Automatically converted into TeX, above some diagnostics.
 +
Please remove this comment and the {{TEX|auto}} line below,
 +
if TeX found to be correct.
 +
-->
 +
 +
{{TEX|auto}}
 +
{{TEX|done}}
 +
 
The process of designing programs (cf. [[Program|Program]]), a plan of action.
 
The process of designing programs (cf. [[Program|Program]]), a plan of action.
  
Line 5: Line 17:
 
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|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,
 
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|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,
  
<table class="eq" style="width:100%;"> <tr><td valign="top" style="width:94%;text-align:center;"><img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p0750901.png" /></td> </tr></table>
+
$$
 +
\forall x  \exists !y  P ( x, y),
 +
$$
  
where <img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p0750902.png" /> 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 <img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p0750903.png" /> for which <img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p0750904.png" /> (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|automatic programming]] and its particular case, the [[Translation of programs|translation of programs]].
+
where $  P ( x, y) $
 +
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 $  \phi ( x) $
 +
for which $  \forall x  P ( x, \phi ( x)) $(
 +
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|automatic programming]] and its particular case, the [[Translation of programs|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.
 
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 <img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p0750905.png" /> to a natural power <img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p0750906.png" />.
+
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 $  x $
 +
to a natural power $  n $.
  
The initial knowledge: <img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p0750907.png" />, <img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p0750908.png" />, <img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p0750909.png" />. Discovering that these relations allow one to reduce the solution of the problem of <img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p07509010.png" /> to simpler ones (i.e. with lesser <img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p07509011.png" />), one attempts to specify the initial knowledge in the simple form (a creative step):
+
The initial knowledge: $  x  ^ {1} = x $,  
 +
$  x ^ {n + m } = x  ^ {n} \cdot x  ^ {m} $,  
 +
$  x  ^ {nm} = ( x  ^ {n} )  ^ {m} $.  
 +
Discovering that these relations allow one to reduce the solution of the problem of $  x  ^ {n} $
 +
to simpler ones (i.e. with lesser $  n $),  
 +
one attempts to specify the initial knowledge in the simple form (a creative step):
  
<table class="eq" style="width:100%;"> <tr><td valign="top" style="width:94%;text-align:center;"><img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p07509012.png" /></td> </tr></table>
+
$$
 +
x  ^ {0}  = 1,\ \
 +
x ^ {n + 1 }  = x  ^ {n} \cdot x,\ \
 +
x  ^ {2n}  = ( x  ^ {n} )  ^ {2} .
 +
$$
  
 
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):
 
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):
  
<table class="eq" style="width:100%;"> <tr><td valign="top" style="width:94%;text-align:center;"><img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p07509013.png" /></td> </tr></table>
+
$$
 +
x  ^ {0}  = 1,\ \
 +
x ^ {2n + 1 }  = x  ^ {2n} \cdot x,\ \
 +
x  ^ {2n}  = ( x  ^ {n} )  ^ {2} .
 +
$$
 +
 
 +
By using the invertibility of the functions  $  n \mapsto 2n $
 +
and  $  n \mapsto n + 1 $
 +
as well as the logical incompatibility of the relations, one obtains a recursive relation by the method of sorting out cases (a formal step):
  
By using the invertibility of the functions <img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p07509014.png" /> and <img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p07509015.png" /> as well as the logical incompatibility of the relations, one obtains a recursive relation by the method of sorting out cases (a formal step):
+
$$
 +
x  ^ {n}  = \
 +
\textrm{ if } \
 +
\left \{
  
<table class="eq" style="width:100%;"> <tr><td valign="top" style="width:94%;text-align:center;"><img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p07509016.png" /></td> </tr></table>
+
\begin{array}{ll}
 +
n = 0,  & \textrm{ then }  1; \\
 +
n  \textrm{ even } ,  & \textrm{ then }  ( x  ^ {n/2} )  ^ {2} ; \\
 +
n  \textrm{ odd } ,  & \textrm{ then }  x \cdot x ^ {n - 1 } . \\
 +
\end{array}
 +
 
 +
\right .$$
  
 
It remains to re-write this rule in some algorithmic language, e.g. Algol-60 (a formal step):
 
It remains to re-write this rule in some algorithmic language, e.g. Algol-60 (a formal step):
  
<img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p07509017.png" />;
+
$  {\mathbf{real}  procedure }  power ( x, n);  {\mathbf{real} }  x,  {\mathbf{integer} }  n $;
  
<img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p07509018.png" />
+
$  power : = \mathbf{i f }  n = 0 {\mathbf{then} }  1  {\mathbf{else} } $
  
<img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p07509019.png" />.
+
$  \mathbf{i f }  even ( n)  {\mathbf{then} }  power ( x, n/2) \uparrow 2  {\mathbf{else} }  x \times power ( x, n - 1) $.
  
The determination of a procedure to check the parity <img align="absmiddle" border="0" src="https://www.encyclopediaofmath.org/legacyimages/p/p075/p075090/p07509020.png" /> is a separate, more particular, programming problem.
+
The determination of a procedure to check the parity $  even ( n) $
 +
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|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|Automata, theory of]]).
 
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|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|Automata, theory of]]).
Line 39: Line 84:
 
====References====
 
====References====
 
<table><TR><TD valign="top">[1]</TD> <TD valign="top">  E.Z. Lyubimskii,  V.V. Martinyuk,  N.P. Trifonov,  "Programming" , Moscow  (1980)  (In Russian)</TD></TR><TR><TD valign="top">[2]</TD> <TD valign="top">  E.W. Dykstra,  "A discipline of programming" , Prentice-Hall  (1976)</TD></TR><TR><TD valign="top">[3]</TD> <TD valign="top">  B. Meyer,  C. Baudoin,  "Méthodes de programmation" , '''1–2''' , Eyrolles  (1978)</TD></TR></table>
 
<table><TR><TD valign="top">[1]</TD> <TD valign="top">  E.Z. Lyubimskii,  V.V. Martinyuk,  N.P. Trifonov,  "Programming" , Moscow  (1980)  (In Russian)</TD></TR><TR><TD valign="top">[2]</TD> <TD valign="top">  E.W. Dykstra,  "A discipline of programming" , Prentice-Hall  (1976)</TD></TR><TR><TD valign="top">[3]</TD> <TD valign="top">  B. Meyer,  C. Baudoin,  "Méthodes de programmation" , '''1–2''' , Eyrolles  (1978)</TD></TR></table>
 
 
  
 
====Comments====
 
====Comments====
 
  
 
====References====
 
====References====
 
<table><TR><TD valign="top">[a1]</TD> <TD valign="top">  D. Gries,  "The science of programming" , Springer  (1981)</TD></TR></table>
 
<table><TR><TD valign="top">[a1]</TD> <TD valign="top">  D. Gries,  "The science of programming" , Springer  (1981)</TD></TR></table>

Latest revision as of 14:54, 7 June 2020


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,

$$ \forall x \exists !y P ( x, y), $$

where $ P ( x, y) $ 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 $ \phi ( x) $ for which $ \forall x P ( x, \phi ( x)) $( 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 $ x $ to a natural power $ n $.

The initial knowledge: $ x ^ {1} = x $, $ x ^ {n + m } = x ^ {n} \cdot x ^ {m} $, $ x ^ {nm} = ( x ^ {n} ) ^ {m} $. Discovering that these relations allow one to reduce the solution of the problem of $ x ^ {n} $ to simpler ones (i.e. with lesser $ n $), one attempts to specify the initial knowledge in the simple form (a creative step):

$$ x ^ {0} = 1,\ \ x ^ {n + 1 } = x ^ {n} \cdot x,\ \ x ^ {2n} = ( x ^ {n} ) ^ {2} . $$

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):

$$ x ^ {0} = 1,\ \ x ^ {2n + 1 } = x ^ {2n} \cdot x,\ \ x ^ {2n} = ( x ^ {n} ) ^ {2} . $$

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

$$ x ^ {n} = \ \textrm{ if } \ \left \{ \begin{array}{ll} n = 0, & \textrm{ then } 1; \\ n \textrm{ even } , & \textrm{ then } ( x ^ {n/2} ) ^ {2} ; \\ n \textrm{ odd } , & \textrm{ then } x \cdot x ^ {n - 1 } . \\ \end{array} \right .$$

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

$ {\mathbf{real} procedure } power ( x, n); {\mathbf{real} } x, {\mathbf{integer} } n $;

$ power : = \mathbf{i f } n = 0 {\mathbf{then} } 1 {\mathbf{else} } $

$ \mathbf{i f } even ( n) {\mathbf{then} } power ( x, n/2) \uparrow 2 {\mathbf{else} } x \times power ( x, n - 1) $.

The determination of a procedure to check the parity $ even ( n) $ 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. Encyclopedia of Mathematics. URL: http://encyclopediaofmath.org/index.php?title=Programming&oldid=49536
This article was adapted from an original article by A.P. Ershov (originator), which appeared in Encyclopedia of Mathematics - ISBN 1402006098. See original article