Abstract
We propose an algorithm to compute the \(C^\infty \)-ring structure of arbitrary Weil algebra. It allows us to do some analysis with higher infinitesimals numerically and symbolically. To that end, we first give a brief description of the (Forward-mode) automatic differentiation (AD) in terms of \(C^\infty \)-rings. The notion of a \(C^\infty \)-ring was introduced by Lawvere [10] and used as the fundamental building block of smooth infinitesimal analysis and synthetic differential geometry [11]. We argue that interpreting AD in terms of \(C^\infty \)-rings gives us a unifying theoretical framework and modular ways to express multivariate partial derivatives. In particular, we can “package” higher-order Forward-mode AD as a Weil algebra, and take tensor products to compose them to achieve multivariate higher-order AD. The algorithms in the present paper can also be used for a pedagogical purpose in learning and studying smooth infinitesimal analysis as well.
This work was supported by the Research Institute for Mathematical Sciences, an International Joint Usage/Research Center located in Kyoto University.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
Such implementation is inherently a partial approximation: there are \(2^{\aleph _0}\)-many smooth functions, but there are only countably many computable (floating) functions.
References
Cox, D., Little, J., O’Shea, D.: Using Algebraic Geometry, 2nd edn. Springer, New York (2005). http://www.cs.amherst.edu/~dac/uag.html
Elliott, C.: Beautiful differentiation. In: International Conference on Functional Programming (ICFP) (2009). http://conal.net/papers/beautiful-differentiation
Elliott, C.: The simple essence of automatic differentiation. In: Proceedings of the ACM on Programming Languages, vol. 2. Association for Computing Machinery, New York, July 2018. https://doi.org/10.1145/3236765
Ishii, H.: Computational algebra system in Haskell (2013). https://konn.github.io/computational-algebra
Ishii, H.: A purely functional computer algebra system embedded in Haskell. In: Gerdt, V.P., Koepf, W., Seiler, W.M., Vorozhtsov, E.V. (eds.) CASC 2018. LNCS, vol. 11077, pp. 288–303. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-99639-4_20
Ishii, H.: smooth: Computational smooth infinitesimal analysis (2020). https://github.com/konn/smooth
Ishii, H.: A succinct multivariate lazy multivariate tower AD for Weil algebra computation. In: Fujimura, M. (ed.) Computer Algebra. RIMS Kôkyûroku, vol. 2185, pp. 104–112. Research Institute for Mathematical Sciences, Kyoto University, Kyoto, Japan (2021)
Joyce, D.: Algebraic geometry over \(C^\infty \)-rings (2016)
Kmett, E.A.: ad: Automatic differentiation (2010). https://hackage.haskell.org/package/ad
Lawvere, F.W.: Categorical dynamics. Topos Theor. Methods Geom. 30, 1–28 (1979)
Moerdijk, I., Reyes, G.E.: Models for Smooth Infinitesimal Analysis. Springer, New York (1991). https://doi.org/10.1007/978-1-4757-4143-8
Nishimura, H., Osoekawa, T.: General Jacobi identity revisited again. Int. J. Theor. Phys. 46(11), 2843–2862 (2007). https://doi.org/10.1007/s10773-007-9397-z
Pearlmutter, B., Siskind, J.: Lazy multivariate higher-order forward-mode AD, vol. 42, pp. 155–160 (2007). https://doi.org/10.1145/1190216.1190242
Wikipedia: Automatic differentiation (2021). https://en.wikipedia.org/w/index.php?title=Automatic_differentiation&oldid=995938170#Automatic_differentiation_using_dual_numbers
Acknowledgments
The author is grateful to Prof. Akira Terui, for encouraging to write this paper and many helpful feedbacks, and to anonymous reviewers for giving constructive comments.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
A Succinct Multivariate Lazy Tower AD
A Succinct Multivariate Lazy Tower AD
For completeness, we include the referential implementation of the Tower-mode AD in Haskell, which can be used in Algorithm 2. The method presented here is a mixture of Lazy Multivariate Tower [13] and nested Sparse Tower [9]. For details, we refer readers to the related paper by the author in RIMS Kôkyûroku [7].
The idea is simple: we represent each partial derivative as a path in a tree of finite width and infinite heights. A path goes down if the function is differentiated by the 0th variable. It goes right if there will be no further differentiation w.r.t. 0th variable, but differentiations w.r.t. remaining variable can take place. This intuition is depicted by the following illustration of the ternary case:

This can be seen as a special kind of infinite trie (or prefix-tree) of alphabets \(\partial _{x_i}\), with available letter eventually decreasing.
This can be implemented by a (co-)inductive type as follows:

A tree can have an infinite height. Since Haskell is a lazy language, this won’t eat up the memory and only necessary information will be gradually allocated. Since making everything lazy can introduce a huge space leak, we force each coefficient
when their corresponding data constructors are reduced to weak head normal form, as expressed by field strictness annotation
.
Then a lifting operation for univariate function is given by:

Here, we use type-level constraint
to represent to a subclass of smooth functions, e.g.
for elementary functions. Constraint of form \(\forall x k.\ \texttt {c}\ x => \texttt {c}\ (\texttt {STower}\ k\ x)\) is an example of so-called Quantified Constraints. This requires
to be implemented for any succinct Tower AD, provided that their coefficient type, say
, is also an instance of
. This constraint is used recursively when one implements an actual implementation of instance
. For example,
instance (for elementary floating point operations) can be written as follows:

In this way, we can implement Tower AD for a class of smooth function closed under differentiation, just by specifying an original and their first derivatives.
More general n-ary case of lifting operator is obtained in just the same way:

Rights and permissions
Copyright information
© 2021 Springer Nature Switzerland AG
About this paper
Cite this paper
Ishii, H. (2021). Automatic Differentiation with Higher Infinitesimals, or Computational Smooth Infinitesimal Analysis in Weil Algebra. In: Boulier, F., England, M., Sadykov, T.M., Vorozhtsov, E.V. (eds) Computer Algebra in Scientific Computing. CASC 2021. Lecture Notes in Computer Science(), vol 12865. Springer, Cham. https://doi.org/10.1007/978-3-030-85165-1_11
Download citation
DOI: https://doi.org/10.1007/978-3-030-85165-1_11
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-85164-4
Online ISBN: 978-3-030-85165-1
eBook Packages: Computer ScienceComputer Science (R0)