Advertisement

Polynomial Functors Constrained by Regular Expressions

  • Dan Piponi
  • Brent A. YorgeyEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9129)

Abstract

We show that every regular language, via some DFA which accepts it, gives rise to a homomorphism from the semiring of polynomial functors to the semiring of \(n \times n\) matrices over polynomial functors. Given some polynomial functor and a regular language, this homomorphism can be used to automatically derive a functor whose values have the same shape as those of the original functor, but whose sequences of leaf types correspond to strings in the language.

The primary interest of this result lies in the fact that certain regular languages correspond to previously studied derivative-like operations on polynomial functors, which have proven useful in program construction. For example, the regular language \(a^*ha^*\) yields the derivative of a polynomial functor, and \(b^*ha^*\) its dissection. Using our framework, we are able to unify and lend new perspective on this previous work. For example, it turns out that dissection of polynomial functors corresponds to taking divided differences of real or complex functions, and, guided by this parallel, we show how to generalize binary dissection to \(n\)-ary dissection.

Keywords

Polynomial Functors Regular expressions Differentiation Dissection 

Notes

Acknowledgements

This work was partially supported by the National Science Foundation, under NSF 1218002, CCF-SHF Small: Beyond Algebraic Data Types: Combinatorial Species and Mathematically-Structured Programming.

Our sincere thanks to the anonymous reviewers, who had many helpful suggestions. Thanks also to Lukas Mai for pointing out some errors in a draft.

References

  1. 1.
    Abbott, M., Altenkirch, T., McBride, C., Ghani, N.: \(\partial \) for data: differentiating data structures. Fundam. Inform. 65(1–2), 1–28 (2005)zbMATHMathSciNetGoogle Scholar
  2. 2.
    Stephen, D.: Fun with semirings: a functional pearl on the abuse of linear algebra. In: ACM SIGPLAN Notices, vol. 48, pp. 101–110. ACM (2013)Google Scholar
  3. 3.
    Droste, M., Kuich, W., Vogler, H. (eds.): Handbook of Weighted Automata. Springer Science & Business Media, Heidelberg (2009)zbMATHGoogle Scholar
  4. 4.
    Duchon, P., Flajolet, P., Louchard, G., Schaeffer, G.: Boltzmann samplers for the random generation of combinatorial structures. Comb. Probab. Comput. 13(4–5), 577–625 (2004)zbMATHMathSciNetCrossRefGoogle Scholar
  5. 5.
    Huet, G.: Functional pearl: the zipper. J. Funct. Program. 7, 549–554 (1997)zbMATHMathSciNetCrossRefGoogle Scholar
  6. 6.
    Kleene, S.C.: Representation of events in nerve nets and finite automata. Technical report, DTIC Document (1951)Google Scholar
  7. 7.
    Lehmann, D.J.: Algebraic structures for transitive closure. Theor. Comput. Sci. 4(1), 59–76 (1977)zbMATHCrossRefGoogle Scholar
  8. 8.
    Marlow, S.: Haskell 2010 language report (2010). https://www.haskell.org/onlinereport/haskell2010/
  9. 9.
    McBride, C.: Clowns to the left of me, jokers to the right (pearl): dissecting data structures. In: POPL, pp. 287–295 (2008)Google Scholar
  10. 10.
    McBride, C., Paterson, R.: Applicative programming with effects. J. Funct. Program. 18(01), 1–13 (2008)zbMATHCrossRefGoogle Scholar
  11. 11.
    O’Connor, R.: A very general method for computing shortest paths (2011). http://r6.ca/blog/20110808T035622Z.html
  12. 12.
    Piponi, D.: Finite differences of types (2009). http://blog.sigfpe.com/2009/09/finite-differences-of-types.html
  13. 13.
    Piponi, D.: Constraining types with regular expressions (2010). http://blog.sigfpe.com/2010/08/constraining-types-with-regular.html
  14. 14.
    Piponi, D.: Divided differences and the tomography of types (2010). http://blog.sigfpe.com/2010/08/divided-differences-and-tomography-of.html
  15. 15.
    Sipser, M.: Introduction to the Theory of Computation. Cengage Learning, Boston (2012)Google Scholar
  16. 16.
    Siskind, J.M., Pearlmutter, B.A.: Nesting forward-mode ad in a functional framework. High.-Order Symb. Comput. 21(4), 361–376 (2008)zbMATHCrossRefGoogle Scholar
  17. 17.
  18. 18.
    Tarski, A.: A lattice-theoretical fixpoint theorem and its applications. Pac. J. Math. 5(2), 285–309 (1955)zbMATHMathSciNetCrossRefGoogle Scholar
  19. 19.
    Yorgey, B.A.: On a problem of SIGFPE (2010). https://byorgey.wordpress.com/2010/08/12/on-a-problem-of-sigfpe/

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  1. 1.A Neighborhood of InfinityOaklandUSA
  2. 2.Williams CollegeWilliamstownUSA

Personalised recommendations