Abstract
We have seen how to design an algorithm to solve a problem by decomposing the overall problem into precisely specified subproblems and then verifying that if each subproblem is solved correctly, and the solutions are fitted together in a specified way, then the original problem will be solved correctly. In other words, in order to understand an abstract algorithm and prove it correct, we have to know and specify precisely what the abstract statements do, but not how they do it. However, on the lower levels of abstraction, abstract statements are refined into sequences of actual statements of the chosen programming language, at which point we specify how each abstract statement accomplishes its task. Since an abstract statement is denoted by a sequence of symbols which names the action it performs, we can say that, in the process of program development, we associate a sequence of statements with each such name. These named sequences of statements are called procedures in Pascal, and the association between a name and a sequence of statements is specified in a procedure declaration. For example, given a procedure exchange which, applied to two variables, exchanges their values, we would call it (after it has been declared, of course) simply by listingexchange(a,b) as a line of our program, where a and b are the names of the variables whose values we want exchanged.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 1978 Springer-Verlag, New York Inc.
About this chapter
Cite this chapter
Alagić, S., Arbib, M.A. (1978). Procedures and Functions. In: The Design of Well-Structured and Correct Programs. Texts and Monographs in Computer Science. Springer, New York, NY. https://doi.org/10.1007/978-1-4612-6272-5_5
Download citation
DOI: https://doi.org/10.1007/978-1-4612-6272-5_5
Publisher Name: Springer, New York, NY
Print ISBN: 978-1-4612-6274-9
Online ISBN: 978-1-4612-6272-5
eBook Packages: Springer Book Archive