Skip to main content

Reasoning About Programs

  • Chapter
  • 3578 Accesses

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?

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD   84.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 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. 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. 3.

    For simplicity, we limit our operators to addition and multiplication.

Author information

Authors and Affiliations

Authors

Rights and permissions

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

Publish with us

Policies and ethics