skip to main content
research-article

Gradual certified programming in coq

Published:21 October 2015Publication History
Skip Abstract Section

Abstract

Expressive static typing disciplines are a powerful way to achieve high-quality software. However, the adoption cost of such techniques should not be under-estimated. Just like gradual typing allows for a smooth transition from dynamically-typed to statically-typed programs, it seems desirable to support a gradual path to certified programming. We explore gradual certified programming in Coq, providing the possibility to postpone the proofs of selected properties, and to check "at runtime" whether the properties actually hold. Casts can be integrated with the implicit coercion mechanism of Coq to support implicit cast insertion à la gradual typing. Additionally, when extracting Coq functions to mainstream languages, our encoding of casts supports lifting assumed properties into runtime checks. Much to our surprise, it is not necessary to extend Coq in any way to support gradual certified programming. A simple mix of type classes and axioms makes it possible to bring gradual certified programming to Coq in a straightforward manner.

References

  1. M. Abadi, L. Cardelli, B. Pierce, and G. Plotkin. Dynamic typing in a statically typed language. ACM Transactions on Programming Languages and Systems, 13(2):237–268, Apr. 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. E. Allende, J. Fabry, R. Garcia, and É. Tanter. Confined gradual typing. In Proceedings of the 29th ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 2014), pages 251–270, Portland, OR, USA, Oct. 2014. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. F. Ba˜nados, R. Garcia, and É. Tanter. A theory of gradual effect systems. In Proceedings of the 19th ACM SIGPLAN Conference on Functional Programming (ICFP 2014), pages 283–295, Gothenburg, Sweden, Sept. 2014. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. J. Bengtson, K. Bhargavan, C. Fournet, A. D. Gordon, and S. Maffeis. Refinement types for secure implementations. ACM Transactions on Programming Languages and Systems, 33(2):8:1–8:45, Jan. 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. A. Chlipala. Certified Programming with Dependent Types. MIT Press, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. R. Chugh, P. M. Rondon, A. Bakst, and R. Jhala. Nested refinements: a logic for duck typing. In Proceedings of the 39th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages (POPL 2012), pages 231– 244, Philadelphia, USA, Jan. 2012. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. M. Dénès, C. Hritcu, L. Lampropoulos, Z. Paraskevopoulou, and B. C. Pierce. QuickChick: Property-based testing for Coq. In Coq Workshop, 2014.Google ScholarGoogle Scholar
  8. T. Disney and C. Flanagan. Gradual information flow typing. In International Workshop on Scripts to Programs, 2011.Google ScholarGoogle Scholar
  9. L. Fennell and P. Thiemann. Gradual security typing with references. In Proceedings of the 26th Computer Security Foundations Symposium (CSF), pages 224–239, June 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. R. B. Findler and M. Felleisen. Contracts for higher-order functions. In Proceedings of the 7th ACM SIGPLAN International Conference on Functional Programming, pages 48–59, Pittsburgh, PA, USA, 2002. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. T. Freeman and F. Pfenning. Refinement types for ML. In Proceedings of the ACM Conference on Programming Language Design and Implementation (PLDI ’91), pages 268– 277. ACM Press, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. R. Garcia, É. Tanter, R. Wolff, and J. Aldrich. Foundations of typestate-oriented programming. ACM Transactions on Programming Languages and Systems, 36(4):12:1–12:44, Oct. 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. G. Gonthier and A. Mahbouhi. An introduction to small scale reflection in Coq. Journal of Formalized Reasoning, 3(2):95– 152, 2010.Google ScholarGoogle Scholar
  14. G. Gonthier, B. Ziliani, A. Nanevski, and D. Dreyer. How to make ad hoc proof automation less ad hoc. Journal of Functional Programming, 23(4):357–401, 2013.Google ScholarGoogle ScholarCross RefCross Ref
  15. J. Gronski, K. Knowles, A. Tomb, S. N. Freund, and C. Flanagan. Sage: Hybrid checking for flexible specifications. In Proceedings of the Scheme and Functional Programming Workshop, pages 93–104, 2006.Google ScholarGoogle Scholar
  16. A. Igarashi, B. C. Pierce, and P. Wadler. Featherweight Java: a minimal core calculus for Java and GJ. ACM Transactions on Programming Languages and Systems, 23(3):396–450, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. K. Knowles and C. Flanagan. Hybrid type checking. ACM Transactions on Programming Languages and Systems, 32(2): Article n.6, Jan. 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. X. Ou, G. Tan, Y. Mandelbaum, and D. Walker. Dynamic typing with dependent types. In Proceedings of the IFIP International Conference on Theoretical Computer Science, pages 437–450, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  19. B. C. Pierce. Types and programming languages. MIT Press, Cambridge, MA, USA, 2002. ISBN 0-262-16209-1. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. P. M. Rondon, M. Kawaguchi, and R. Jhala. Liquid types. In R. Gupta and S. P. Amarasinghe, editors, Proceedings of the ACM Conference on Programming Language Design and Implementation (PLDI 2008), pages 159–169. ACM Press, June 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. A. Sa¨ıbi. Typing algorithm in type theory with inheritance. In Proceedings of the 24th ACM Symposium on Principles of Programming Languages (POPL 97), pages 292–301, Paris, France, Jan. 1997. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. T. Schrijvers and B. C. Oliveira. Monads, zippers and views: virtualizing the monad stack. In Proceedings of the 16th ACM SIGPLAN Conference on Functional Programming (ICFP 2011), pages 32–44, Tokyo, Japan, Sept. 2011. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. E. Seidel, N. Vazou, and R. Jhala. Type targeted testing. In J. Vitek, editor, Proceedings of the 24th European Symposium on Programming Languages and Systems (ESOP 2015), volume 9032 of Lecture Notes in Computer Science, London, UK, Mar. 2015. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. I. Sergey and D. Clarke. Gradual ownership types. In H. Seidl, editor, Proceedings of the 21st European Symposium on Programming Languages and Systems (ESOP 2012), volume 7211 of Lecture Notes in Computer Science, pages 579– 599, Tallinn, Estonia, 2012. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. T. Sheard, A. Stump, and S. Weirich. Language-based verification will change the world. In Proceedings of the FSE/SDP Workshop on the Future of Sofware Engineering Research (FoSER 2010), pages 343–348, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. J. Siek and W. Taha. Gradual typing for functional languages. In Proceedings of the Scheme and Functional Programming Workshop, pages 81–92, Sept. 2006.Google ScholarGoogle Scholar
  27. M. Sozeau. Subset coercions in Coq. In Types for Proofs and Programs, volume 4502 of Lecture Notes in Computer Science, pages 237–252. Springer-Verlag, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. P. Thiemann and L. Fennell. Gradual typing for annotated type systems. In Z. Shao, editor, Proceedings of the 23rd European Symposium on Programming Languages and Systems (ESOP 2014), volume 8410 of Lecture Notes in Computer Science, pages 47–66, Grenoble, France, 2014. Springer-Verlag.Google ScholarGoogle Scholar
  29. N. Vazou, P. M. Rondon, and R. Jhala. Abstract refinement types. In M. Felleisen and P. Gardner, editors, Proceedings of the 22nd European Symposium on Programming Languages and Systems (ESOP 2013), volume 7792 of Lecture Notes in Computer Science, pages 209–228, Rome, Italy, Mar. 2013. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. R. Wolff, R. Garcia, É. Tanter, and J. Aldrich. Gradual typestate. In M. Mezini, editor, Proceedings of the 25th European Conference on Object-oriented Programming (ECOOP 2011), volume 6813 of Lecture Notes in Computer Science, pages 459–483, Lancaster, UK, July 2011. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. H. Xi and F. Pfenning. Eliminating array bound checking through dependent types. In Proceedings of the ACM Conference on Programming Language Design and Implementation (PLDI ’98), pages 249–257. ACM Press, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Gradual certified programming in coq

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!