Gradual refinement: blending pattern matching with data abstraction

  • Authors:
  • Meng Wang;Jeremy Gibbons;Kazutaka Matsuda;Zhenjiang Hu

  • Affiliations:
  • Oxford University Computing Laboratory, Oxford, UK;Oxford University Computing Laboratory, Oxford, UK;Graduate School of Information Sciences, Tohoku University, Sendai-city, Miyagi-pref., Japan;GRACE Center, National Institute of Informatics, Tokyo, Japan

  • Venue:
  • MPC'10 Proceedings of the 10th international conference on Mathematics of program construction
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

Pattern matching is advantageous for understanding and reasoning about function definitions, but it tends to tightly couple the interface and implementation of a datatype. Significant effort has been invested in tackling this loss of modularity; however, decoupling patterns from concrete representations while maintaining soundness of reasoning has been a challenge. Inspired by the development of invertible programming, we propose an approach to abstract datatypes based on a right-invertible language RINV--every function has a right (or pre-) inverse. We show how this new design is able to permit a smooth incremental transition from programs with algebraic datatypes and pattern matching, to ones with proper encapsulation (implemented as abstract datatypes), while maintaining simple and sound reasoning.