Abstract
In the present work a Coq based approach is taken to characterize the foldl using a functorial structure from which an inductive type is determined. With μ F being an initial F–algebra and (B,θ) another F–algebra, two F–algebras with support B×μ F are constructed and then coequalized. This coequalization morphism allows the definition of foldl structurally.
After examining some significant examples we propose the following methodology to define a foldl operator. Let F be a polynomial endofunctor and (μ F ,in F ) its initial algebra. We define two F–algebras with support B×μ F , and h1,h2:F(B×μ F ) →B ×μ F constructed such that in one of them the argument of the initial type is syntactically (structurally) lower than that in the other. Then, \({\mathit{foldl}}:B\times\mu_F \rightarrow B\) can be defined as a specific morphism that coequalizes them \((h_1;{\mathit{foldl}}=h_2;{\mathit{foldl}}).\)
For an initial F–algebra with distinguished element (as in the case of lists), foldl is a coequalizer of h1 and h2.
The proofs are performed using the Coq proof system. In this context, constructive approach stress that existence is constructive, therefore with a computational content.
Detailed structure for proofs in Coq is included but interactive code is omited. See the section 4 for a repository with the complete source code.
Partially supported by Xunta de Galicia PGIDIT07TIC005105PR and MEC TIN2005-08986.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Arbib, M.A., Manes, E.G.: Algebraic Approaches to Program Semantics. The AKM Series in Theoretical Computer Science. Springer, Heidelberg (1986)
Belleannée, C., Brisset, P., Ridoux, O.: A Pragmatic Reconstruction of λ–Prolog. The Journal of Logic Programming (1994)
Bertot, Y., Castéran, P.: Interactive Theorem Proving and Program Development. EATCS Series. Springer, Heidelberg (2004)
Freire, J.L., Blanco, A.: On the abstraction process. In: Brain Processes, Theories and Models. MIT Press, Cambridge (1996)
Freire Nistal, J.L., Blanco Ferro, A., Freire Brañas, J.E., Sánchez Penas, J.J.: EUROCAST 2001. LNCS, vol. 2178, pp. 583–596. Springer, Heidelberg (2001)
Freire, J.L., Freire, E., Blanco, A.: On Recursive Functions and Well–Founded Relations in the Calculus of Constructions. In: Moreno Díaz, R., Pichler, F., Quesada Arencibia, A. (eds.) EUROCAST 2005. LNCS, vol. 3643, pp. 69–80. Springer, Heidelberg (2005)
Gibbons, J., Hutton, G.: Proof methods for corecursive programs. Fundamenta Informaticae Special Issue on Program Transformation 66(4), 353–366 (2005)
Gibbons, J., Hutton, G., Altenkirch, T.: When is a function a fold or an unfold? Electronic Notes in Theoretical Computer Science 44(1) (2001)
Greiner, J.: Programming with Inductive and Co-Inductive Types, Technical report, School of Computer Science, Carnegie Mellon University, Pittsburgh (1992)
Jay, C.B.: Tail Recursion through Universal Invariants, Technical report, University of Edinburgh (1993)
Jacobs, B., Rutten, J.: A Tutorial on (Co)Algebras and (Co)Induction. EATCS Bulletin 62 (1997)
Naish, L., Sterling, L.: A Higher Order Reconstruction of Stepwise Enhancement. In: Fuchs, N.E. (ed.) LOPSTR 1997. LNCS, vol. 1463, pp. 245–262. Springer, Heidelberg (1998)
Weber, T., Caldwell, J.: Constructively Characterizing Fold and Unfold. In: Bruynooghe, M. (ed.) LOPSTR 2003. LNCS, vol. 3018, pp. 110–127. Springer, Heidelberg (2003)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2009 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Blanco, A., Freire, E., Freire, J.L., Paris, J. (2009). The Foldl Operator as a Coequalizer Using Coq. In: Moreno-Díaz, R., Pichler, F., Quesada-Arencibia, A. (eds) Computer Aided Systems Theory - EUROCAST 2009. EUROCAST 2009. Lecture Notes in Computer Science, vol 5717. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-04772-5_23
Download citation
DOI: https://doi.org/10.1007/978-3-642-04772-5_23
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-04771-8
Online ISBN: 978-3-642-04772-5
eBook Packages: Computer ScienceComputer Science (R0)