Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
article
Open access

Calculational semantics: Deriving programming theories from equations by functional predicate calculus

Published: 01 July 2006 Publication History

Abstract

The objects of programming semantics, namely, programs and languages, are inherently formal, but the derivation of semantic theories is all too often informal, deprived of the benefits of formal calculation “guided by the shape of the formulas.” Therefore, the main goal of this article is to provide for the study of semantics an approach with the same convenience and power of discovery that calculus has given for many years to applied mathematics, physics, and engineering. The approach uses functional predicate calculus and concrete generic functionals; in fact, a small part suffices. Application to a semantic theory proceeds by describing program behavior in the simplest possible way, namely by program equations, and discovering the axioms of the theory as theorems by calculation. This is shown in outline for a few theories, and in detail for axiomatic semantics, fulfilling a second goal of this article. Indeed, a chafing problem with classical axiomatic semantics is that some axioms are unintuitive at first, and that justifications via denotational semantics are too elaborate to be satisfactory. Derivation provides more transparency. Calculation of formulas for ante- and postconditions is shown in general, and for the major language constructs in particular. A basic problem reported in the literature, whereby relations are inadequate for handling nondeterminacy and termination, is solved here through appropriately defined program equations. Several variants and an example in mathematical analysis are also presented. One conclusion is that formal calculation with quantifiers is one of the most important elements for unifying continuous and discrete mathematics in general, and traditional engineering with computing science, in particular.

References

[1]
Back, R.-J. 1983. A continuous semantics for unbounded nondeterminism. Theor. Comput. Sci. 23, 2, 187--210.
[2]
Back, R.-J. and von Wright, J. 1992. Combining angels, demons and miracles in program specifications. Theor. Comput. Sci. 100, 2, 365--383.
[3]
Back, R.-J. and von Wright, J. 1998. Refinement Calculus: A Systematic Introduction. Springer, New York.
[4]
Backhouse, R. 2002. Galois Connections. Number 7 in Programming Algebra. Univ. of Nottingham. http://www.cs.nott.ac.uk/~rcb/G53PAL/G53PAL.html.
[5]
Bass, H. 2003. The Carnegie initiative on the doctorate: The case of mathematics. Notices of the AMS 50, 7 (Aug.), 767--776.
[6]
Boiten, E. and Möller, B. 2002. 6th international conference on mathematics of program construction. Conference announcement: http://www.cs.kent.ac.uk/events/conf/2002/mpc2002.
[7]
Boute, R. 1988. Systems semantics: Principles, applications and implementation. ACM Trans. Program. Languages Syst. 10, 1 (Jan.), 118--155.
[8]
Boute, R. 1993. Funmath illustrated: A declarative formalism and application examples. Declarative Systems Series 1, Computing Science Institute, University of Nijmegen.
[9]
Boute, R. 2002. Functional mathematics: A unifying declarative and calculational approach to systems, circuits and programs---Part I. Ghent University. Course notes.
[10]
Boute, R. 2003. Concrete generic functionals: Principles, design and applications. In Generic Programming, J. Gibbons and J. Jeuring, eds. Kluwer Academic, Hingham, Mass, 89--119.
[11]
Boute, R. 2005. Functional declarative language design and predicate calculus: A practical approach. ACM Trans. Program. Languages Syst. 27, 5 (Sept.) 988--1047.
[12]
Cohen, E. 1990. Programming in the 1990's: An Introduction to the Calculation of Programs. Springer, New York.
[13]
De Bakker, J. W. 1980. Mathematical Theory of Program Correctness. Prentice-Hall, Upper Saddle River, N. J.
[14]
Dean, C. N. and Hinchey, M. G. 1996. Teaching and Learning Formal Methods. Academic Press, London.
[15]
Dijkstra, E. W. 1976. A Discipline of Programming. Prentice-Hall, Upper Saddle River, N. J.
[16]
Dijkstra, E. W. 2000. Under the spell of Lcibniz's dream. Technical Note EWD1298. http://www.cs.utexas.edu/users/EWD/ewd12xx/EWD1298.pdf.
[17]
Dijkstra, E. W. and Scholten, C. S. 1990. Predicate Calculus and Program Semantics. Springer, New York.
[18]
Dijkstra, R. M. 1994. Relational calculus and relational program semantics. Computing Science Reports CS-R9408, Dept. of Computer Science, University of Groningen.
[19]
Dijkstra, R. M. 1998. Computation calculus: Bridging a formalization gap. In Proceedings of the Conference Mathematics of Program Construction. LNCS, vol. 1422. Springer, New York, 151--174.
[20]
Gordon, M. 2003. Specification and Verification I. University of Cambridge. http://www.cl.cam.ac.uk/Teaching/mjcg/Lectures/SpecVer1/Notes03/Notes.pdf.
[21]
Gries, D. 1996. The need for education in useful formal logic. IEEE Computer 29, 4 (Apr.), 29--30.
[22]
Gries, D. and Schneider, F. B. 1993. A Logical Approach to Discrete Math. Springer, New York.
[23]
Hancock, P. 2004. Refinement calculus: Some references and pointers. Technical note. http://homepages.inf.ed.ac.uk/v1phanc1/RC-bib.pdf.
[24]
Hehner, E. 1999. Specifications, programs and total correctness. Sci. Comput. Program. 34, 3 (July), 191--205. Original version (1998) also on the web: http://www.cs.toronto.edu/~hehner/SPTC.pdf.
[25]
Hehner, E. 2004. A Practical Theory of Programming, 2nd ed. Springer, New York. http://www.cs.toronto.edu/~hehner/aPToP/.
[26]
Hesselink, W. H. 1992. Programs, Recursion, and Unbounded Choice. Cambridge, New York.
[27]
Hoare, C. A. R. 1969. An axiomatic basis for computer programming. Comm. ACM 12, 10 (Oct.), 576--580, 583.
[28]
Hoare, C. A. R. and Jifeng, H. 1998. Unifying Theories of Programming. Prentice-Hall, Upper Saddle River, N. J.
[29]
Lamport, L. 2002. Specifying Systems. Addison-Wesley, Reading, Mass.
[30]
Lamport, L. 2004. All I really need to know I learned in high school. Proceedings of the 2004 CoLogNET/FME Symposium on Teaching Formal Methods. http://www.intec.UGent.be/groupsites/formal/Sympos2004/Sympos2004.htm.
[31]
Lang, S. 1983. Undergraduate Analysis. Springer, Berlin.
[32]
Leavens, G. 1995. Weakest preconditions. Course notes Semantics Program. Languages (Com S 641). http://www.cs.iastate.edu/~leavens/ComS641-Hesselink.html.
[33]
Lee, E. A. and Messerschmitt, D. G. 1998. Engineering---An education for the future. IEEE Computer 31, 1 (Jan.), 77--85. http://www.gigascale.org/pubs/5/computermag.pdf.
[34]
Lee, E. A. and Varaiya, P. 2003. Structure and Interpretation of Signals and Systems. Addison-Wesley, Reading, Mass.
[35]
Leino, K. R. M. and Manohar, R. 1999. Joining specification statements. Theor. Comput. Sci. 216, 1--2 (Mar.), 375--394.
[36]
Loeckx, J. and Sieber, K. 1984. The Foundations of Program Verification. Wiley-Teubner.
[37]
McCluskey, E. J. 1965. Introduction to the Theory of Switching Circuits. McGraw Hill, New York.
[38]
Meyer, B. 1991. Introduction to the Theory of Programming Languages. Prentice Hall, Upper Saddle River, N. J.
[39]
Morgan, C. 1994. Programming from Specifications, 2nd ed. Prentice Hall, Upper Saddle River, N. J.
[40]
Morris, J. M. 1987. A theoretical basis for stepwise refinement and the programming calculus. Sci. Comput. Program. 9, 3 (Dec.), 287--306.
[41]
Nelson, G. 1989. A generalization of Dijkstra's calculus. ACM Trans. Prog. Lang. Syst. 11, 4 (Oct.), 517--561.
[42]
Plotkin, G. D. 1980. Dijkstra's predicate transformers and Smyth's powerdomains. In Abstract Software Specifications, D. Björner, ed. LNCS, vol. 86. Springer, New York, 527--583.
[43]
Ravaglia, R., Alper, T., Rozenfeld, M., and Suppes, P. 1999. Successful pedagogical applications of symbolic computation. In Computer-Human Interaction in Symbolic Computation, N. Kajler, ed. Springer, New York. http://www-epgy.stanford.edu/research/chapter4.pdf.
[44]
Recorde, R. 1557. The Whetstone of Witte. http://www-gap.dcs.st-and.ac.uk/~history/Mathematicians/Recorde.html.
[45]
Taylor, P. 2000. Practical Foundations of Mathematics, 2nd printing. Cambridge Studies in Advanced Mathematics, no. 59. Cambridge University Press, New York. Comment about chapter 1 of this book on http://www.dcs.qmul.ac.uk/~pt/Practical_Foundations/html/s10.html.
[46]
Wigner, E. 1960. The unreasonable effectiveness of mathematics in the natural sciences. Comm. Pure Appl. Math. 13, I (Feb.), 1--14. http://nedwww.ipac.caltech.edu/level5/March02/Wigner/Wigner.html.
[47]
Winskel, G. 1993. The Formal Semantics of Programming Languages: An Introduction. MIT Press, Cambridge, Mass.

Cited By

View all

Recommendations

Reviews

Wolfgang Schreiner

Scholars in many disciplines envy physics and its mathematical formalism, where natural processes can be described by precise equations and equational reasoning can derive consequences and yield insights that would be hard to obtain by intuition alone. This is also true for computer scientists who aim to elaborate formal calculi for describing the behavior of programs in order to get a better understanding of their properties. In pursuit of this goal, the paper presents a set of calculational semantics that allow equational reasoning on programs. The core problem is that programs process discrete objects (computer stores) in a way that can only be adequately described by a logic with quantifiers. To support equational reasoning on such formulas, the author introduces a functional predicate calculus, where logical formulas are represented by Boolean functions and logical equivalence becomes function equality. It is shown how program behavior can be described by equations and how the laws of various other approaches to program semantics can be derived by formal calculations. This approach has various elder relatives. For instance, the late Dijkstra, a pioneer in the field of programming theory, together with Scholten, propagated an equational style of program reasoning, and Hoare and Jifeng introduced an algebra of programming based on a view of programs as relations between states. While the calculational semantics presented in this paper does not enter new territory, it nevertheless provides a succinct working language and a framework for linking other theories. Online Computing Reviews Service

Access critical reviews of Computing literature here

Become a reviewer for Computing Reviews.

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Programming Languages and Systems
ACM Transactions on Programming Languages and Systems  Volume 28, Issue 4
July 2006
217 pages
ISSN:0164-0925
EISSN:1558-4593
DOI:10.1145/1146809
Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 01 July 2006
Published in TOPLAS Volume 28, Issue 4

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Assignment
  2. axiomatic semantics
  3. calculational reasoning
  4. formal semantics
  5. functional predicate calculus
  6. generic functionals
  7. intuitive semantics
  8. loops
  9. nondeterminacy
  10. programming theories
  11. strongest postcondition
  12. termination
  13. weakest antecondition

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)36
  • Downloads (Last 6 weeks)10
Reflects downloads up to 26 Sep 2024

Other Metrics

Citations

Cited By

View all
  • (2021)Hoare and He’s Unifying Theories of ProgrammingTheories of Programming10.1145/3477355.3477369(285-316)Online publication date: 4-Oct-2021
  • (2018)Pointfree expression and calculationFormal Methods in System Design10.1007/s10703-010-0100-237:2-3(95-140)Online publication date: 28-Dec-2018
  • (2013)Extending Floyd-Hoare Logic for Partial Pre- and PostconditionsInformation and Communication Technologies in Education, Research, and Industrial Applications10.1007/978-3-319-03998-5_18(355-378)Online publication date: 2013
  • (2012)Computer-Assisted Program Reasoning Based on a Relational Semantics of ProgramsElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.79.879(124-142)Online publication date: 21-Feb-2012
  • (2012)Soundness of a Logic-Based Verification Method for Imperative LoopsProceedings of the 2012 14th International Symposium on Symbolic and Numeric Algorithms for Scientific Computing10.1109/SYNASC.2012.63(127-134)Online publication date: 26-Sep-2012
  • (2010)A Purely Logical Approach to the Termination of Imperative LoopsProceedings of the 2010 12th International Symposium on Symbolic and Numeric Algorithms for Scientific Computing10.1109/SYNASC.2010.64(142-149)Online publication date: 23-Sep-2010
  • (2009)A Calculus for Imperative ProgramsProceedings of the 2009 11th International Symposium on Symbolic and Numeric Algorithms for Scientific Computing10.1109/SYNASC.2009.42(77-84)Online publication date: 26-Sep-2009
  • (2009)Making Temporal Logic CalculationalProceedings of the 2nd World Congress on Formal Methods10.1007/978-3-642-05089-3_25(387-402)Online publication date: 4-Nov-2009
  • (2008)Simple Gedanken Experiments in Leveraging Applications of Formal MethodsLeveraging Applications of Formal Methods, Verification and Validation10.1007/978-3-540-88479-8_60(847-861)Online publication date: 2008
  • (2006)Using domain-independent problems for introducing formal methodsProceedings of the 14th international conference on Formal Methods10.1007/11813040_22(316-331)Online publication date: 21-Aug-2006

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media