Advertisement

A Purely Functional Computer Algebra System Embedded in Haskell

  • Hiromi Ishii
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11077)

Abstract

We demonstrate how methods in Functional Programming can be used to implement a computer algebra system. As a proof-of-concept, we present the computational-algebra package. It is a computer algebra system implemented as an embedded domain-specific language in Haskell, a purely functional programming language. Utilising methods in functional programming and prominent features of Haskell, this library achieves safety, composability, and correctness at the same time. To demonstrate the advantages of our approach, we have implemented advanced Gröbner basis algorithms, such as Faugère’s \(F_4\) and \(F_5\), in a composable way.

Keywords

Gröbner basis Signature-based algorithms Computational algebra Functional programming Haskell Type system Formal methods Property-based testing Implementation report 

Notes

Acknowledgments

The author would like to thank my supervisor, Prof. Akira Terui, for discussions, and to anonymous reviewers for helpful comments. This research is supported by Grant-in-Aid for JSPS Research Fellow Number 17J00479, and partially by Grants-in-Aid for Scientific Research 16K05035.

References

  1. 1.
    Claessen, K., Hughes, J.: QuickCheck: a lightweight tool for random testing of Haskell programs. In: Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, ICFP 2000, pp. 268–279. ACM, New York (2000).  https://doi.org/10.1145/351240.351266
  2. 2.
    Coquand, T., Persson, H.: Gröbner bases in type theory. In: Altenkirch, T., Reus, B., Naraschewski, W. (eds.) TYPES 1998. LNCS, vol. 1657, pp. 33–46. Springer, Heidelberg (1999).  https://doi.org/10.1007/3-540-48167-2_3CrossRefGoogle Scholar
  3. 3.
    Coutts, D., Leshchinskiy, R., Stewart, D.: Stream fusion. from lists to streams to nothing at all. In: Proceedings of the 12th ACM SIGPLAN International Conference on Functional Programming, ICFP 2007 (2007)Google Scholar
  4. 4.
    Eisenberg, R.A., Weirich, S.: Dependently typed programming with singletons. ACM SIGPLAN Not. 47(12), 117–130 (2012). Haskell 2012Google Scholar
  5. 5.
    Faugére, J.-C.: A new efficient algorithm for computing Gröbner bases (\({F}_4\)). J. Pure Appl. Algebra 139(1), 61–88 (1999)MathSciNetCrossRefGoogle Scholar
  6. 6.
    Faugére, J.-C.: A new efficient algorithm for computing Gröbner bases without reduction to zero (\({F}_5\)). In: Proceedings of the 2002 International Symposium on Symbolic and Algebraic Computation, pp. 75–83. ACM, Lille (2002)Google Scholar
  7. 7.
    GHC Team: The Glasgow Haskell Compiler (2018). https://www.haskell.org/ghc/. Accessed 2018
  8. 8.
    Giovini, A., Mora, T., Niesi, G., Robbiano, L., Traverso, C.: “One sugar cube, please” or selection strategies in the Buchberger algorithm. In: Proceedings of the 1991 International Symposium on Symbolic and Algebraic Computation, ISSAC 1991, pp. 5–4. ACM (1991)Google Scholar
  9. 9.
    Greuel, G.-M., Pfister, G.: A Singular Introduction to Commutative Algebra, 2nd edn. Springer, Heidelberg (2007).  https://doi.org/10.1007/978-3-662-04963-1CrossRefzbMATHGoogle Scholar
  10. 10.
    Haskell Committee: The Haskell Programming Language. http://haskell.org/
  11. 11.
    Hypothesis: Most testing is ine ective - Hypothesis (2018). https://hypothesis.works. Accessed 06 May 2018
  12. 12.
    Ishii, H.: The computational-algebra package (2018). https://konn.github.io/computational-algebra
  13. 13.
    Ishii, H.: The ghc-typelits-presburger package (2017). http://hackage.haskell.org/package/ghc-typelits-presburger
  14. 14.
    Ishii, H.: The type-natural package (2013). http://hackage.haskell.org/package/type-natural
  15. 15.
    Jolly, R.: Categories as type classes in the scala algebra system. In: Gerdt, V.P., Koepf, W., Mayr, E.W., Vorozhtsov, E.V. (eds.) CASC 2013. LNCS, vol. 8136, pp. 209–218. Springer, Cham (2013).  https://doi.org/10.1007/978-3-319-02297-0_18CrossRefzbMATHGoogle Scholar
  16. 16.
    Keller, G., Chakravarty, M.M., Leshchinskiy, R., Peyton Jones, S., Lippmeier, B.: Regular, shape-polymorphic, parallel arrays in Haskell. In: Proceedings of the 15th ACM SIGPLAN International Conference on Functional Programming, ICFP 2010, pp. 261–272. ACM, Baltimore (2010)Google Scholar
  17. 17.
    Kmett, E.A.: The algebra package (2011). http://hackage.haskell.org/package/algebra. Accessed 2018
  18. 18.
    Kredel, H., Jolly, R.: Generic, type-safe and object oriented computer algebra software. In: Gerdt, V.P., Koepf, W., Mayr, E.W., Vorozhtsov, E.V. (eds.) CASC 2010. LNCS, vol. 6244, pp. 162–177. Springer, Heidelberg (2010).  https://doi.org/10.1007/978-3-642-15274-0_14CrossRefzbMATHGoogle Scholar
  19. 19.
    Launchbury, J., Peyton Jones, S.L.: Lazy functional state threads. In: Proceedings of the ACM SIGPLAN 1994 Conference on Programming Language Design and Implementation, PLDI 1994, pp. 24–35. ACM, Orlando (1994)Google Scholar
  20. 20.
    Lobachev, O., Loogen, R.: Implementing data parallel rational multiple-residue arithmetic in Eden. In: Gerdt, V.P., Koepf, W., Mayr, E.W., Vorozhtsov, E.V. (eds.) CASC 2010. LNCS, vol. 6244, pp. 178–193. Springer, Heidelberg (2010).  https://doi.org/10.1007/978-3-642-15274-0_15CrossRefzbMATHGoogle Scholar
  21. 21.
    Marlow, S.: Parallel and Concurrent Programming in Haskell: Techniques for Multicore and Multithreaded Programming. O’Reilly Media, Sebastopol (2013)Google Scholar
  22. 22.
    Marlow, S., Maier, P., Loidl, H.-W., Aswad, M.K., Trinder, P.: Seq no more: better strategies for parallel Haskell. In: Proceedings of the Third ACM Haskell Symposium on Haskell, Haskell 2010, pp. 91–102. ACM, Baltimore (2010).  https://doi.org/10.1145/1863523.1863535
  23. 23.
    Mechveliani, S.D.: Computer algebra with Haskell: applying functional-categorial-“lazy” programming. In: Proceedings of International Workshop CAAP, pp. 203–211 (2001)Google Scholar
  24. 24.
    Mechveliani, S.D.: DoCon-A a Provable Algebraic Domain Constructor (2018). http://www.botik.ru/pub/local/Mechveliani/docon-A/2.02/manual.pdf. Accessed 06 May 2018
  25. 25.
    Pan, S., Hu, Y., Wang, B.: The termination of the F5 algorithm revisited. In: Proceedings of the 38th International Symposium on Symbolic and Algebraic Computation, ISSAC 2013, pp. 291–298. ACM, Boston (2013)Google Scholar
  26. 26.
    Runciman, C., Naylor, M., Lindblad, F.: SmallCheck and Lazy SmallCheck: automatic exhaustive testing for small values. In: Proceedings of the First ACM SIGPLAN Symposium on Haskell, Haskell 2008, pp. 37–48. ACM, Victoria (2008).  https://doi.org/10.1145/1411286.1411292
  27. 27.
    Yorgey, B.A., Weirich, S., Cretin, J., Peyton Jones, S., Vytiniotis, D., Magalhães, J.P.: Giving Haskell a promotion. In: Proceedings of the 8th ACM SIGPLAN Workshop on Types in Language Design and Implementation, TLDI 2012, pp. 53–66. ACM, Philadelphia (2012)Google Scholar

Copyright information

© Springer Nature Switzerland AG 2018

Authors and Affiliations

  1. 1.University of TsukubaTsukubaJapan

Personalised recommendations