Higher-Order and Symbolic Computation

, Volume 21, Issue 4, pp 377–409 | Cite as

Adapting functional programs to higher order logic

Article

Abstract

Higher-order logic proof systems combine functional programming with logic, providing functional programmers with a comfortable setting for the formalization of programs, specifications, and proofs. However, a possibly unfamiliar aspect of working in such an environment is that formally establishing program termination is necessary. In many cases, termination can be automatically proved, but there are useful programs that diverge and others that always terminate but have difficult termination proofs. We discuss techniques that support the expression of such programs as logical functions.

Keywords

Higher order logic Recursive definition Termination Well-foundedness Regular expression pattern matching 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Supplementary material

References

  1. 1.
    Abel, A., Altenkirch, T.: A predicative analysis of structural recursion. J. Funct. Program. 12(1), 1–41 (2002) MATHCrossRefMathSciNetGoogle Scholar
  2. 2.
    Augustsson, L.: Cayenne—a language with dependent types. In: International Conference on Functional Programming, pp. 239–250 (1998) Google Scholar
  3. 3.
    Berghofer, S., Nipkow, T.: Executing higher order logic. In: Callaghan, P., Luo, Z., McKinna, J., Pollack, R. (eds.) Types for Proofs and Programs (TYPES 2000). Lecture Notes in Computer Science, vol. 2277, pp. 24–40. Springer, New York (2002) CrossRefGoogle Scholar
  4. 4.
    Berghofer, S., Nipkow, T.: Random testing in Isabelle/HOL. In: Second IEEE International Conference on Software Engineering and Formal Methods (SEFM 2004). IEEE Computer Society Press, Silver Spring (2004) Google Scholar
  5. 5.
    Berry, G., Sethi, R.: From regular expressions to deterministic automata. Theor. Comput. Sci. 48(1), 117–126 (1986) MATHCrossRefMathSciNetGoogle Scholar
  6. 6.
    Bertot, Y., Castéran, P.: Interactive Theorem Proving and Program Development: Coq’Art: The Calculus of Inductive Constructions. Texts in Theoretical Computer Science, An EATCS Series. Springer, New York (2004) MATHGoogle Scholar
  7. 7.
    Boyer, R.S., Moore, J.S.: A Computational Logic. Academic, New York (1979) MATHGoogle Scholar
  8. 8.
    Brzozowski, J.: Derivatives of Regular Expressions. J. ACM 11(4), 481–494 (1964) MATHCrossRefMathSciNetGoogle Scholar
  9. 9.
    Church, A.: A formulation of the simple theory of types. J. Symb. Log. 5(2), 56–68 (1940) MATHCrossRefMathSciNetGoogle Scholar
  10. 10.
    Cockett, R., Fukushima, T.: About charity. Technical Report TR 92/480/18, Department of Computer Science, University of Calgary (1992) Google Scholar
  11. 11.
    Danvy, O., Filinski, A.: Abstracting control. In: Proceedings of the 1990 ACM Conference on LISP and Functional Programming, Nice, New York, NY, pp. 151–160. ACM, New York (1990) CrossRefGoogle Scholar
  12. 12.
    Danvy, O., Nielsen, L.R.: Defunctionalization at work. Technical Report RS-01-23, BRICS (2001). Extended version of an article appearing in 3rd International Conference on Principles and Practice of Declarative Programming, PPDP’01 Proceedings, pp. 162–174 (2001) Google Scholar
  13. 13.
    Dybjer, P., Haiyan, Q., Takeyama, M.: Combining testing and proving in dependent type theory. In: Basin, D., Wolff, B. (eds.) Proceedings of TPHOLs 2003. Lecture Notes in Computer Science, vol. 2758, pp. 188–203. Springer, New York (2003) Google Scholar
  14. 14.
    Farmer, W., Guttman, J., Thayer, J.: IMPS: an interactive mathematical proof system. In: Stickel, M. (ed.) Tenth International Conference on Automated Deduction (CADE). Kaiserslautern, pp. 653–654 (1990) Google Scholar
  15. 15.
    Filliâtre, J.-C.: Verification of non-functional programs using interpretations in type theory. J. Funct. Program. 13(4), 709–745 (2003) MATHCrossRefGoogle Scholar
  16. 16.
    Frisch, A., Cardelli, L.: Greedy regular expression matching. In: ICALP 2004. Lecture Notes in Computer Science, vol. 3142, pp. 618–629. Springer, New York (2004) Google Scholar
  17. 17.
    Gibbons, J., Jones, G.: The under-appreciated unfold. In: Proceedings of the third ACM SIGPLAN International Conference on Functional Programming, pp. 273–279. ACM Press, Baltimore (1998) CrossRefGoogle Scholar
  18. 18.
    Giesl, J.: Termination analysis for functional programs using term orderings. In: Proceedings of the Second International Symposium on Static Analysis, pp. 154–171. Springer, New York (1995) Google Scholar
  19. 19.
    Giesl, J.: Termination of nested and mutually recursive algorithms. J. Autom. Reason. 19(1), 1–29 (1997) MATHCrossRefMathSciNetGoogle Scholar
  20. 20.
    Giménez, E.: Structural recursive definitions in type theory. In: Proceedings of ICALP’98. Lecture Notes in Computer Science, vol. 1443. Springer, New York (1998) Google Scholar
  21. 21.
    Gordon, M., Melham, T.: Introduction to HOL, a Theorem Proving Environment for Higher Order Logic. Cambridge University Press, Cambridge (1993) MATHGoogle Scholar
  22. 22.
    Gordon, M., Milner, R., Wadsworth, C.: Edinburgh LCF: A Mechanised Logic of Computation. Lecture Notes in Computer Science, vol. 78. Springer, New York (1979) Google Scholar
  23. 23.
    Gordon, M., Iyoda, J., Owens, S., Slind, K.: Automatic formal synthesis of hardware from higher order logic. In: Proceedings of Fifth International Workshop on Automated Verification of Critical Systems (AVoCS). ENTCS, vol. 145 (2005) Google Scholar
  24. 24.
    Greve, D., Wilding, M., Hardin, D.: High-speed, analyzable simulators. In: Kaufmann, M., Manolios, P., Moore, J. (eds.) Computer-Aided Reasoning Case Studies, pp. 113–135. Kluwer Academic, Dordrecht (2000) Google Scholar
  25. 25.
    Greve, D.A., Kaufmann, M., Manolios, P., Moore, J.S., Ray, S., Ruiz-Reina, J.L., Sumners, R., Vroon, D., Wilding, M.: Efficient execution in an automated reasoning environment. J. Funct. Program. 18(1), 15–46 (2008) MATHCrossRefGoogle Scholar
  26. 26.
    Hagino, T.: A categorical programming language. Ph.D. thesis, University of Edinburgh (1987). Also published as ECS-LFCS-87-38 Google Scholar
  27. 27.
    Harper, R.: Proof-directed debugging. J. Funct. Program. 9(4), 463–470 (1999) MATHCrossRefMathSciNetGoogle Scholar
  28. 28.
    Harrison, J.: Inductive definitions: automation and application. In: Schubert, E.T., Windley, P.J., Alves-Fos, J. (eds.) Proceedings of the 1995 International Workshop on Higher Order Logic Theorem Proving and its Applications, Aspen Grove, Utah, pp. 200–213. Springer, New York (1995) Google Scholar
  29. 29.
    Hosoya, H., Pierce, B.: Regular expression pattern matching for XML. J. Funct. Program. 13(6), 961–1004 (2003) MATHCrossRefMathSciNetGoogle Scholar
  30. 30.
    Huet, G., Lang, B.: Proving and applying program transformations expressed with second-order patterns. Acta Inf. 11, 31–55 (1978) MATHMathSciNetGoogle Scholar
  31. 31.
    Kaufmann, M., Manolios, P., Moore, J.S.: Computer-Aided Reasoning: An Approach. Kluwer Academic, Dordrecht (2000) Google Scholar
  32. 32.
    Kaufmann, M., Manolios, P., Moore, J.S.: Computer-Aided Reasoning: Case Studies. Kluwer Academic, Dordrecht (2000) Google Scholar
  33. 33.
    Kreitz, C.: Building reliable, high-performance networks with the nuprl proof development system. J. Funct. Program. 14(1), 21–68 (2004) MATHCrossRefMathSciNetGoogle Scholar
  34. 34.
    Krstić, S., Matthews, J.: Verifying BDD algorithms through monadic interpretation. In: Cortesi, A. (ed.) Verification, Model Checking and Abstract Interpretation: Third International Workshop (VMCAI 2002). Lecture Notes in Computer Science, vol. 2294. Springer, New York (2002) Google Scholar
  35. 35.
    Lee, C.S., Jones, N.D., Ben-Amram, A.M.: The size-change principle for program termination. In: Proceedings of the 28th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. pp. 81–92 (2001) Google Scholar
  36. 36.
    Lewis, J.R., Shields, M.B., Meijer, E., Launchbury, J.: Implicit parameters: dynamic scoping with static types. In: Reps, T. (ed.) ACM Symposium on Principles of Programming Languages, Boston, Massachusetss, USA. ACM Press, New York (2000) Google Scholar
  37. 37.
    Li, G., Owens, S., Slind, K.: Structure of a proof-producing compiler for a subset of higher order logic. In: ESOP 2007. Lecture Notes in Computer Science, vol. 4421. Springer, New York (2007) Google Scholar
  38. 38.
    Liu, X., Kreitz, C., Renesse, R., Hickey, J., Hayden, M., Birman, K., Constable, R.: Building reliable, high-performance communication systems from components. In: Proceedings of the 17th ACM Symposium on Operating System Principles. ACM Press, New York (1999) Google Scholar
  39. 39.
    Manolios, P., Vroon, D.: Termination analysis with calling context graphs. In: Ball, T., Jones, R. (eds.) Computer Aided Verification (CAV). Lecture Notes in Computer Science, vol. 4144, pp. 401–414. Springer, New York (2006) CrossRefGoogle Scholar
  40. 40.
    Marché, C.: A simple library for regular expressions. Regexp library for OCaml, available at http://www.lri.fr/~marche/regexp/ (2002)
  41. 41.
    Matthews, J.: Recursive definition over coinductive types. In: Bertot, Y., Dowek, G., Hirschowitz, A., Paulin, C., Thery, L. (eds.) Proceedings of the 12th International Conference on Theorem Proving in Higher Order Logics, TPHOLs’99, Nice. Springer, New York (1999) Google Scholar
  42. 42.
    McIlroy, D.: Enumerating the strings of regular languages (Functional Pearl). J. Funct. Program. 14(5), 503–518 (2004) MATHCrossRefGoogle Scholar
  43. 43.
    Moore, J., Manolios, P.: Partial functions in ACL2. J. Autom. Reason. 31(2), 107–127 (2003) MATHCrossRefMathSciNetGoogle Scholar
  44. 44.
    Müller, O., Nipkow, T., Oheimb, D.v, Slotosch, O.: HOLCF=HOL+LCF. J. Funct. Program. 9, 191–223 (1999) MATHCrossRefGoogle Scholar
  45. 45.
    Nipkow, T.: Verified lexical analysis. In: Grundy, J., Newey, M. (eds.) Theorem Proving in Higher Order Logics. Lecture Notes in Computer Science, vol. 1479, pp. 1–15. Springer, New York (1998). Invited talk CrossRefGoogle Scholar
  46. 46.
    Nipkow, T., Paulson, L.C., Wenzel, M.: Isabelle/HOL—A Proof Assistant for Higher-Order Logic. Lecture Notes in Computer Science, vol. 2283. Springer, New York (2002) MATHGoogle Scholar
  47. 47.
    Nishihara, T., Minamide, Y.: Depth first search. Entry in the Isabelle Archive of Formal Proofs (2004) Google Scholar
  48. 48.
    Norrish, M., Slind, K.: HOL-4 manuals. Available at http://hol.sourceforge.net/ (1998–2005)
  49. 49.
    Owens, S., Flatt, M., Shivers, O., McMullan, B.: Parsing tools in scheme. In: Proceedings of the 2004 Scheme Workshop (2004) Google Scholar
  50. 50.
    Owre, S., Shankar, N., Rushby, J.M., Stringer-Calvert, D.W.J.: PVS System Guide. SRI Computer Science Laboratory. Available at http://pvs.csl.sri.com/documentation.shtml (2001)
  51. 51.
    Rudnicki, P., Trybulec, A.: On equivalents of well-foundedness. J. Autom. Reason. 23(3), 197–234 (1999) MATHCrossRefMathSciNetGoogle Scholar
  52. 52.
    Shankar, N.: Steps towards mechanizing program transformations using PVS. In: Moeller, B. (ed.) Mathematics of Program Construction, Third International Conference (MPC’95), Kloster Irsee, Germany, pp. 50–66 (1995) Google Scholar
  53. 53.
    Shankar, N.: Static analysis for safe destructive updates in a functional language. In: Pettorossi, A. (ed.) Logic Based Program Synthesis and Transformation, 11th International Workshop, LOPSTR 2001. Lecture Notes in Computer Science, vol. 2372, pp. 1–24. Springer, New York (2001) CrossRefGoogle Scholar
  54. 54.
    Slind, K.: Derivation and use of induction schemes in higher order logic. In: Theorem Proving in Higher Order Logics, Murrary Hill, New Jersey, USA, pp. 275–291. Springer, New York (1997) CrossRefGoogle Scholar
  55. 55.
    Slind, K.: Reasoning about terminating functional programs. Ph.D. thesis, Institut für Informatik, Technische Universität München. Available at http://tumb1.biblio.tu-muenchen.de/publ/diss/in/1999/slind.html (1999)
  56. 56.
    Slind, K.: Wellfounded schematic definitions. In: McAllester, D. (ed.) Proceedings of the Seventeenth International Conference on Automated Deduction CADE-17, vol. 1831. Pittsburgh, Pennsylvania, pp. 45–63. Springer, New York Google Scholar
  57. 57.
    Slind, K., Hurd, J.: Applications of polytypism in theorem proving. In: Basin, D., Wolff, B. (eds.) Theorem Proving in Higher Order Logics, 16th International Conference, TPHOLs 2003, Rome, Italy, Proceedings. Lecture Notes in Computer Science, vol. 2758, pp. 103–119. Springer, New York (2003) Google Scholar
  58. 58.
    Thompson, K.: Programming techniques: regular expression search algorithm. Commun. ACM 11(6), 419–422 (1968) MATHCrossRefGoogle Scholar
  59. 59.
    Thompson, S.: Regular expressions and automata using Haskell. Technical Report 5-00, Computing Laboratory, University of Kent. Available at http://www.cs.ukc.ac.uk/pubs/2000/958 (2000)
  60. 60.
    Turner, D.A.: Elementary strong functional programming. In: Functional Programming Languages in Education. Lecture Notes in Computer Science, vol. 1022, pp. 1–13. Springer, New York (1995) Google Scholar
  61. 61.
    van der Vlist, E.: Relax NG. O’Reilly (2003) Google Scholar
  62. 62.
    Xi, H.: Dependent types for program termination verification. J. Higher-Order Symb. Comput. 15, 91–131 (2002) MATHCrossRefGoogle Scholar

Copyright information

© Springer Science+Business Media, LLC 2008

Authors and Affiliations

  1. 1.School of ComputingUniversity of UtahSalt Lake CityUSA

Personalised recommendations