Abstract
We present transformations for incrementally defining both inductive sum/variant types and coinductive product/record types in a formal refinement setting. Inductive types are built by incrementally accumulating constructors. Coinductive types are built by incrementally accumulating observers. In each case, when the developer decides that the constructor (resp. observer) set is complete, a transformation is applied that generates a canonical definition for the type. It also generates definitions for functions that have been characterized in terms of patterns over the constructors (resp. copatterns over the observers). Functions that input a possibly-recursive sum/variant type are defined inductively via patterns on the input data. Dually, functions that output a possibly-recursive record type are defined coinductively via copatterns on the function’s output. The transformations have been implemented in the Specware system [4] and have been used extensively in the automated synthesis of concurrent garbage collection algorithms [9, 12] and families of protocol-processing codes for distributed vehicle control [5].
This work has been sponsored in part by DARPA under agreements FA8750-10-C-0241 and FA8750-12-C-0257.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsReferences
Abel, A., Pientka, B., Thibodeau, D., and Setzer, A. Copatterns: programming infinite structures by observations. In: Proceedings of the 40th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2013, pp. 27–38 (2013)
Cook, W.R.: Object-oriented programming versus abstract data types. In: de Bakker, J.W., de Roever, W.P., Rozenberg, G. (eds.) REX 1990. LNCS, vol. 489, pp. 151–178. Springer, Heidelberg (1991). https://doi.org/10.1007/BFb0019443
Jacobs, B., Rutten, J.: A tutorial on (co)algebras and (co)induction. Bull. EATCS 62, 222–259 (1996)
Kestrel Institute: Specware System and documentation (2003). http://www.specware.org/
Kreitz, C., Smith, D.R.: Synthesis of network protocols: final report. Technical report, Kestrel Institute (2016). http://www.kestrel.edu/home/people/smith/pub/HACMS-Final-Report.pdf
Leroy, X., Blazy, S.: Formal verification of a C-like memory model and its uses for verifying program transformations. J. Autom. Reason. 41(1), 1–31 (2008)
Liu, Y.: Systematic Program Design: From Clarity to Efficiency. Cambridge University Press, Cambridge (2013)
Paige, R., Koenig, S.: Finite differencing of computable expressions. ACM Trans. Program. Lang. Syst. 4(3), 402–454 (1982)
Pavlovic, D., Pepper, P., Smith, D.R.: Formal derivation of concurrent garbage collectors. In: Bolduc, C., Desharnais, J., Ktari, B. (eds.) MPC 2010. LNCS, vol. 6120, pp. 353–376. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-13321-3_20. Extended version in http://arxiv.org/abs/1006.4342
Smith, D.R.: Another proof of the modularization theorem. Technical report, Kestrel Institute, February 1993. http://www.kestrel.edu/home/people/smith/pub/modularization.pdf
Smith, D.R.: Generating programs plus proofs by refinement. In: Meyer, B., Woodcock, J. (eds.) VSTTE 2005. LNCS, vol. 4171, pp. 182–188. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-69149-5_20
Smith, D.R., Westbrook, E., Westfold, S.J.: Deriving concurrent garbage collectors: final report. Technical report, Kestrel Institute (2015). http://www.kestrel.edu/home/people/smith/pub/CRASH-Final-Report.pdf
Srinivas, Y.V., Jüllig, R.: Specware: formal support for composing software. In: Möller, B. (ed.) MPC 1995. LNCS, vol. 947, pp. 399–422. Springer, Heidelberg (1995). https://doi.org/10.1007/3-540-60117-1_22
Tuch, H.: Formal verification of C systems code: structured types, separation logic and theorem proving. J. Autom. Reason. 42(2), 125–187 (2009)
Veloso, P.A., Maibaum, T.: On the modularization theorem for logical specification. Inf. Process. Lett. 53(5), 287–293 (1995)
Wadler, P.: The expression problem. Technical report, Bell Labs, Murray Hill, NJ (1998). http://homepages.inf.ed.ac.uk/wadler/papers/expression/expression.txt
Acknowledgements
Thanks to Christoph Kreitz, Peter Pepper, Florian Rabe, and the reviewers for helpful discussions and comments on the text.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2020 Springer Nature Switzerland AG
About this paper
Cite this paper
Smith, D.R., Westfold, S.J. (2020). Transformations for Generating Type Refinements. In: Sekerinski, E., et al. Formal Methods. FM 2019 International Workshops. FM 2019. Lecture Notes in Computer Science(), vol 12233. Springer, Cham. https://doi.org/10.1007/978-3-030-54997-8_24
Download citation
DOI: https://doi.org/10.1007/978-3-030-54997-8_24
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-54996-1
Online ISBN: 978-3-030-54997-8
eBook Packages: Computer ScienceComputer Science (R0)