Abstract
Reynolds' relational parametricity provides a powerful way to reason about programs in terms of invariance under changes of data representation. A dazzling array of applications of Reynolds' theory exists, exploiting invariance to yield "free theorems", non-inhabitation results, and encodings of algebraic datatypes. Outside computer science, invariance is a common theme running through many areas of mathematics and physics. For example, the area of a triangle is unaltered by rotation or flipping. If we scale a triangle, then we scale its area, maintaining an invariant relationship between the two. The transformations under which properties are invariant are often organised into groups, with the algebraic structure reflecting the composability and invertibility of transformations.
In this paper, we investigate programming languages whose types are indexed by algebraic structures such as groups of geometric transformations. Other examples include types indexed by principals--for information flow security--and types indexed by distances--for analysis of analytic uniform continuity properties. Following Reynolds, we prove a general Abstraction Theorem that covers all these instances. Consequences of our Abstraction Theorem include free theorems expressing invariance properties of programs, type isomorphisms based on invariance properties, and non-definability results indicating when certain algebraically indexed types are uninhabited or only inhabited by trivial programs. We have fully formalised our framework and most examples in Coq.
Supplemental Material
- M. Abadi, A. Banerjee, N. Heintze, and J. G. Riecke. A Core Calculusof Dependency. Proceedings, POPL, pp.147--160, 1999. Google Scholar
Digital Library
- R. Atkey. Syntax for Free: Representing Syntax with Binding UsingParametricity. Proceedings, TLCA,pp. 35--49, 2009. Google Scholar
Digital Library
- N. Benton, C.-K. Hur, A. J. Kennedy, C. McBride.Strongly Typed Term Representations in Coq. Journal of Automated Reasoning 49(2), pp. 141--159, 2012. Google Scholar
Digital Library
- N. Benton, A. Kennedy, M. Hofmann, L. Beringer.Reading, Writing and Relations.Proceedings, APLAS,pp. 114--130, 2006. Google Scholar
Digital Library
- J.-P. Bernardy, P. Jansson, R. Paterson.Proofs for Free: Parametricity for Dependent Types. Journal of Functional Programming 22(2), pp. 107--152, 2012. Google Scholar
Digital Library
- L. Cardelli, P. Gardner.Processes in Space. Programs, Proofs, Processes: Proceedings, CiE, pp. 78--87, %LNCS vol. 6158, 2010. Google Scholar
Digital Library
- Computational Geometry Algorithms Library (CGAL): User and ReferenceManual. Available at http://www.cgal.org.Google Scholar
- S. Chaudhuri, S. Gulwani, and R. Lublinerman. Continuity Analysis ofPrograms. Proceedings, POPL, pp. 57--70, 2010. Google Scholar
Digital Library
- J. Gallier. Geometric Methods and Applications For ComputerScience and Engineering. Springer, 2011. Google Scholar
Digital Library
- J. Harrison.Without Loss of Generality.Proceedings, TPHOLs,pp. 43--59, 2009. Google Scholar
Digital Library
- M. Hofmann. Correctness of Effect-based ProgramTransformations. Formal Logical Methods for System Security andCorrectness, pp. 149--173, 2008.Google Scholar
- M. P. Jones. Functional Programming with Overloading and Higher-OrderPolymorphism. Proceedings, AFP,pp. 97--136, 1995. Google Scholar
Digital Library
- A. J. Kennedy. Relational Parametricity and Units of Measure.Proceedings, POPL, pp. 442--455, 1997. Google Scholar
Digital Library
- A. J. Kennedy. Types for Units-of-Measure: Theory and Practice.Central European Functional Programming school (CEFP), pp. 268--305, LNCS vol. 6299, 2010. Google Scholar
Digital Library
- S. Mann, N. Litke, T. DeRose. A Coordinate Free Geometry ADT.Technical Report CS-97--15, University of Waterloo, 1997.Google Scholar
- A. M. Pitts. Parametric Polymorphism and Operational Equivalence. Mathematical Structures in Computer Science 10(3), pp. 321--359,2000. Google Scholar
Digital Library
- J. Reed and B. C. Pierce. Distance Makes the Types Grow Stronger.Proceedings, ICFP, pp. 157--169, 2010. Google Scholar
Digital Library
- J. C. Reynolds. Types, Abstraction and Parametric Polymorphism. Information Processing 83, pp. 513--523, 1983.Google Scholar
- A. Sabelfeld and D. Sands. A PER Model of Secure Information Flow inSequential Programs. Higher-Order and Symbolic Computation 14(1), pp. 59--91, 2001. Google Scholar
Digital Library
- N. Shikuma and A.Igarahsi. Proving Noninterference by a FullyComplete Translation to the Simply Typed lambda-calculus. Logical Methods in Computer Science 4(3), 2008.Google Scholar
- S. Tse and S. Zdancewic. Translating Dependency into Parametricity.Proceedings, ICFP, pp.115--125, 2004. Google Scholar
Digital Library
- P. Wadler. Theorems for Free!. Proceedings, FPCA,pp. 347--359, 1989. Google Scholar
Digital Library
Index Terms
Abstraction and invariance for algebraically indexed types
Recommendations
Abstraction and invariance for algebraically indexed types
POPL '13: Proceedings of the 40th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesReynolds' relational parametricity provides a powerful way to reason about programs in terms of invariance under changes of data representation. A dazzling array of applications of Reynolds' theory exists, exploiting invariance to yield "free theorems", ...
Explicit invariance of Cartesian Zernike moments
Zernike moments are one of the most commonly implemented feature extractors among the family of moment invariants. Their popularity stems from the fact that they are robust in the presence of noise. Their rotational invariance property is inherited from ...
Parametric quantifiers for dependent type theory
Polymorphic type systems such as System F enjoy the parametricity property: polymorphic functions cannot inspect their type argument and will therefore apply the same algorithm to any type they are instantiated on. This idea is formalized mathematically ...







Comments