Abstract
This chapter illustrates how the notions of mathematics presented in the previous chapters can be applied to computer science to reason about programs. Three main applications are given: (i) Correctness of algorithms: While an algorithm says how an answer can be calculated, a specification states what the answer should look like. But how can one prove that an algorithm really satisfies a specification? (ii) Giving meaning to programs: Without giving a formal meaning to programs, we cannot answer questions such as ‘Is a program equivalent to another?’ or ‘Does a program exhibit certain behaviours and not others?’. But how can the meaning of a program be mathematically specified? (iii) The limits of computing: Surprisingly, there are specifications for which no correct implementation exists. Can we identify any such specifications, and how do we prove that no algorithm satisfies them?
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
If, whenever we use this algorithm, we always also require a sorted version of the list, then we might as well sort the list in the first place. If, however, we just require the largest element, sorting the sequence would be unnecessarily wasteful.
- 2.
Actually, the argument is slightly more involved since one of the operands of GCD can be zero. However, the intersection of a finite set with another set is always finite, and thus, given that at least one of the two operands is non-zero guarantees that GCD is well defined.
- 3.
For simplicity, we limit our operators to addition and multiplication.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2012 Springer-Verlag Berlin Heidelberg
About this chapter
Cite this chapter
Pace, G.J. (2012). Reasoning About Programs. In: Mathematics of Discrete Structures for Computer Science. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-29840-0_10
Download citation
DOI: https://doi.org/10.1007/978-3-642-29840-0_10
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-29839-4
Online ISBN: 978-3-642-29840-0
eBook Packages: Computer ScienceComputer Science (R0)