Advertisement

Equational Reasoning with Applicative Functors

  • Andreas Lochbihler
  • Joshua Schneider
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9807)

Abstract

In reasoning about effectful computations, it often suffices to focus on the effect-free parts. We present a package for automatically lifting equations to effects modelled by applicative functors. It exploits properties of the concrete functor thanks to a modular classification based on combinators. We formalise the meta theory and demonstrate the usability of our Isabelle/HOL package with two case studies. This is a first step towards practical reasoning with effectful computations.

Keywords

Normal Form Combinatory Logic Proof Method Applicative Functor Idiomatic Expression 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Notes

Acknowledgements

Peter Gammie triggered our interest in reasoning about applicative functors and helped with the Stern-Brocot tree. We thank Dmitriy Traytel, Joachim Breitner, and the anonymous reviewers for suggesting many textual improvements. The first author was supported by SNSF grant 153217 “Formalising Computational Soundness for Protocol Implementations”.

Supplementary material

References

  1. 1.
    Berghofer, S.: Proofs, Programs and Executable Specifications in Higher Order Logic. Ph.D. thesis, Institut für Informatik, Technische Universität München (2003)Google Scholar
  2. 2.
    Berstel, J., Reutenauer, C.: Square-free words and idempotent semigroups. In: Lothaire, M. (ed.) Combinatorics on Words, 2nd edn., pp. 18–38. Cambridge University Press (1997)Google Scholar
  3. 3.
    Boutin, S.: Using reflection to build efficient and certified decision procedures. In: Abadi, M., Ito, T. (eds.) TACS 1997. LNCS, vol. 1281, pp. 515–529. Springer, Heidelberg (1997)Google Scholar
  4. 4.
    Bulwahn, L., Krauss, A., Haftmann, F., Erkök, L., Matthews, J.: Imperative functional programming with Isabelle/HOL. In: Mohamed, O.A., Muñoz, C., Tahar, S. (eds.) TPHOLs 2008. LNCS, vol. 5170, pp. 134–149. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  5. 5.
    Bunder, M.W.: Lambda terms definable as combinators. Theoret. Comput. Sci. 169(1), 3–21 (1996)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Church, A.: The Calculi of Lambda-Conversion. Princeton University Press, Princeton (1941)zbMATHGoogle Scholar
  7. 7.
    Dijkstra, E.W.: An exercise for Dr. R.M. Burstall. In: Selected Writings on Computing: A Personal Perspective. Texts and Monographs in Computer Science, pp. 215–216. Springer, New York (1982)Google Scholar
  8. 8.
    Eberl, M., Hölzl, J., Nipkow, T.: A verified compiler for probability density functions. In: Vitek, J. (ed.) ESOP 2015. LNCS, vol. 9032, pp. 80–104. Springer, Heidelberg (2015)CrossRefGoogle Scholar
  9. 9.
    Gammie, P., Lochbihler, A.: The Stern-Brocot tree. Archive of Formal Proofs, (2015). http://isa-afp.org/entries/Stern_Brocot.shtml, Formal proof development
  10. 10.
    Gibbons, J., Bird, R.: Be kind, rewind: a modest proposal about traversal (2012). http://www.comlab.ox.ac.uk/jeremy.gibbons/publications/backwards.pdf
  11. 11.
    Gibbons, J., Hinze, R.: Just do it: simple monadic equational reasoning. In: ICFP 2011, pp. 2–14. ACM (2011)Google Scholar
  12. 12.
    Graham, R.L., Knuth, D.E., Patashnik, O.: Concrete Mathematics-A Foundation for Computer Science, 2nd edn. Addison-Wesley, Reading (1994)Google Scholar
  13. 13.
    Green, J.A., Rees, D.: On semi-groups in which \(x^r = x\). Math. Proc. Camb. Philos. Soc. 48, 35–40 (1952)MathSciNetCrossRefzbMATHGoogle Scholar
  14. 14.
    Hinze, R.: The Bird tree. J. Func. Programm. 19(5), 491–508 (2009)MathSciNetCrossRefzbMATHGoogle Scholar
  15. 15.
    Hinze, R.: Lifting operators and laws (2010). http://www.cs.ox.ac.uk/ralf.hinze/Lifting.pdf
  16. 16.
    Homeier, P.V.: The HOL-omega logic. In: Berghofer, S., Nipkow, T., Urban, C., Wenzel, M. (eds.) TPHOLs 2009. LNCS, vol. 5674, pp. 244–259. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  17. 17.
    Huffman, B.: Transfer principle proof tactic for nonstandard analysis. In: Kanovich, M., White, G., Gottliebsen, H., Oliva, P. (eds.) NetCA 2005, pp. 18–26. Queen Mary, University of London, Dept. of Computer Science, Research report RR-05-06 (2005)Google Scholar
  18. 18.
    Huffman, B., Kunčar, O.: Lifting and Transfer: a modular design for quotients in Isabelle/HOL. In: Gonthier, G., Norrish, M. (eds.) CPP 2013. LNCS, vol. 8307, pp. 131–146. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  19. 19.
    Hutton, G., Fulger, D.: Reasoning about effects: seeing the wood through the trees. In: Trends in Functional Programming (TFP 2008) (2008)Google Scholar
  20. 20.
    Krebbers, R.: The C standard formalized in Coq. Ph.D. thesis, Radboud University (2015)Google Scholar
  21. 21.
    Lammich, P., Tuerk, T.: Applying data refinement for monadic programs to Hopcroft’s algorithm. In: Beringer, L., Felty, A. (eds.) ITP 2012. LNCS, vol. 7406, pp. 166–182. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  22. 22.
    Lochbihler, A.: Probabilistic functions and cryptographic oracles in higher order logic. In: Thiemann, P. (ed.) ESOP 2016. LNCS, vol. 9632, pp. 503–531. Springer, Heidelberg (2016)CrossRefGoogle Scholar
  23. 23.
    Lochbihler, A., Schneider, J.: Applicative lifting. Archive of Formal Proofs (2015). http://isa-afp.org/entries/Applicative_Lifting.shtml
  24. 24.
    Marlow, S., Peyton Jones, S., Kmett, E., Mokhov, A.: Desugaring Haskell’s do-notation into applicative operations (2016). http://research.microsoft.com/en-us/um/people/simonpj/papers/list-comp/applicativedo.pdf
  25. 25.
    McBride, C., Paterson, R.: Applicative programming with effects. J. Funct. Program. 18(1), 1–13 (2008)CrossRefzbMATHGoogle Scholar
  26. 26.
    Nipkow, T.: More Church-Rosser proofs (in Isabelle/HOL). J. Automat. Reason. 26, 51–66 (2001)MathSciNetCrossRefzbMATHGoogle Scholar
  27. 27.
    Paulson, L.: A higher-order implementation of rewriting. Sci. Comput. Program 3(2), 119–149 (1983)MathSciNetCrossRefzbMATHGoogle Scholar
  28. 28.
    Reynolds, J.C.: Types, abstraction and parametric polymorphism. In: IFIP 1983. Information Processing, vol. 83, pp. 513–523. North-Holland/IFIP (1983)Google Scholar
  29. 29.
    Schropp, A., Popescu, A.: Nonfree datatypes in Isabelle/HOL. In: Gonthier, G., Norrish, M. (eds.) CPP 2013. LNCS, vol. 8307, pp. 114–130. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  30. 30.
    Tuong, F., Wolff, B.: A meta-model for the Isabelle API. Archive of Formal Proofs (2015). http://isa-afp.org/entries/Isabelle_Meta_Model.shtml

Copyright information

© Springer International Publishing Switzerland 2016

Authors and Affiliations

  1. 1.Institute of Information Security, Department of Computer ScienceETH ZurichZürichSwitzerland

Personalised recommendations