About: Total functional programming is a research topic. Over the lifetime, 8 publications have been published within this topic receiving 255 citations. The topic is also known as: strong functional programming.
TL;DR: It is shown that general recursive definitions can be represented in the free monad which supports the ‘effect’ of making a recursive call, without saying how these calls should be executed.
Abstract: In this paper, I show that general recursive definitions can be represented in the free monad which supports the ‘effect’ of making a recursive call, without saying how these calls should be executed. Diverse semantics can be given within a total framework by suitable monad morphisms. The Bove-Capretta construction of the domain of a general recursive function can be presented datatype-generically as an instance of this technique. The paper is literate Agda, but its key ideas are more broadly transferable.
TL;DR: It is shown that from foetus output the authors can actually conclude that the function terminates, and a general soundness theorem allows us to conclude that each term accepted by the foetus system actually terminates.
Abstract: We are developing a system (MuTTI Munich Type Theory Implementation) with dependent types which can be used for the development of provably correct programs in Type Theory Inspired by Coquand’s pattern matching for dependent types [Coq92] as implemented in the ALF system [Alf94] and its successors, we define a total language as a subset of a partial one Hence, we are faced with the problem of verifying termination We restrict ourselves to structural recursion, where by structural recursion we mean that the only termination orderings we consider are lexical products of the natural structural ordering on a strictly positive datatype We also allow mutual recursion A further restriction is that smaller terms are only generated by primitive operators like case-analysis, projection and application In the type-theoretic context this is sufficient, since general terminating recursion can be represented by adding additional (computationally irrelevant) parameters We are not sure whether structural recursive without the afore mentioned restriction is actually decidable Abel implemented a termination checker for a simply typed sublanguage of MuTTI (called foetus), this system allows mutual recursive definitions on general strict positive datatypes and returns a lexical ordering on the arguments of the function if one exists In the work we want to present here, we show that from foetus output we can actually conclude that the function terminates We define a semantic interpretation of each type and formally define the structural ordering on semantic values of possibly different types A central result is that the structural ordering is wellfounded at each type A general soundness theorem allows us to conclude that each term accepted by the foetus system actually terminates Our approach is related to the work by Telford & Turner, who are interested in a total functional programming language (ESFP) In a recent (unpublished) article [TTu98b] they present also a termination analysis based
TL;DR: It is explained why and how the restriction to total functions improves the semantic correspondence substantially, and the basic design and capabilities of the total functional programming tools for tabular expressions are described.
Abstract: Tabular expressions are a multidimensional structured notation for complex mathematical definitions of relations or functions. They have been found useful for documenting imperative programs by stating the function or relation that describes the black-box behaviour of those programs. Tools are needed to increase the practicality of this approach to documentation. In order to create tools to check and evaluate tabular expressions, we have investigated functional programming as an implementation paradigm that reflects the semantics of these mathematical expressions faithfully. We explain why and how the restriction to total functions improves the semantic correspondence substantially, and describe the basic design and capabilities of our total functional programming tools for tabular expressions. We demonstrate the practical advantages of totality by giving examples for the especially easy and effective application of well-known code transformation techniques to total functional programs.
TL;DR: These findings are the result of implementing a TFP compiler as a modification of the Glasgow Haskell Compiler (GHC), as well as a total standard library and a variety of total example programs.
Abstract: Functional programming offers an advantage over imperative programming: functional programs are easier to reason about and understand, which makes certain classes of errors less common. Yet, the two disciplines have some pitfalls in common: any computation, functional or not, may be non-terminating, or may terminate in a run-time error. Turner describes a discipline called “Total Functional Programming” (TFP) in which these pitfalls are impossible, due to some easily-checked rules which require all recursion to be done structurally. [30] In this report, I detail my findings about the practical benefits and limitations of total functional programming, as well as the interactions which arise between TFP and the design and implementation of a rich functional programming language. These findings are the result of implementing a TFP compiler as a modification of the Glasgow Haskell Compiler (GHC), as well as a total standard library and a variety of total example programs.
TL;DR: In this paper, the forward and reverse mode Combinatory Homomorphic Automatic Differentiation (CHAD) is applied to total functional programming languages with expressive type systems featuring the combination of tuple types; sum types; inductive types; coinductive types; and function types.
Abstract: We show how to apply forward and reverse mode Combinatory Homomorphic Automatic Differentiation (CHAD) to total functional programming languages with expressive type systems featuring the combination of - tuple types; - sum types; - inductive types; - coinductive types; - function types. We achieve this by analysing the categorical semantics of such types in $\Sigma$-types (Grothendieck constructions) of suitable categories. Using a novel categorical logical relations technique for such expressive type systems, we give a correctness proof of CHAD in this setting by showing that it computes the usual mathematical derivative of the function that the original program implements. The result is a principled, purely functional and provably correct method for performing forward and reverse mode automatic differentiation (AD) on total functional programming languages with expressive type systems.