Conservativity of Equational Theories in Typed Lambda Calculi1

1993 ◽  
Vol 19 (1-2) ◽  
pp. 1-49
Author(s):  
Val Breazu-Tannen ◽  
Albert R. Meyer

In programming languages that feature unrestricted recursion, the equational theory corresponding to evaluation of data type expressions must be distinguished from the classical theory of the data as given by, say, algebraic specifications. Aiming to preserve classical reasoning about the underlying data types, that is, for the equational theory of the programming language to be a conservative extension of the theory given by the data type specification, we investigate, alternative computational settings given by typed lambda calculi, specifically here by the Girard-Reynolds polymorphic lambda calculus ( λ ∀ ). We prove that the addition of just the λ ∀ -constructions to arbitrary specifications, as given by algebraic theories, and even simply typed lambda theories, is conservative. This suggests that polymorphic constructs and reasoning can be superimposed on familiar data-type definition features of programming languages without changing the behavior of these features. Using purely syntactic methods, we give transformational proofs of these results for certain systems of equational reasoning. A new technique for analyzing polymorphic equational proofs is developed to this purpose. Finally, we prove, with a semantics argument, that it is possible to combine arbitrary algebraic data type specifications and the λ ∀ -constructions into functional programming languages that both conserve algebraic reasoning about data. and ensure, over arbitrary algebraically specified observables, a computing power equivalent to that of the pure λ ∀ . The corresponding problem for simply typed specifications remains open.

1986 ◽  
Vol 9 (3) ◽  
pp. 343-370
Author(s):  
Eric G. Wagner

The aim of this paper is to model recursive types, equational types, and elementary programming control constructs (such as conditionals and while-do) in one, comparatively simple, algebraic framework, that can be used for theoretical studies and as a basis for data type and program specification. To this end we introduce a new kind of algebraic theory, the RV-theory. We give simple examples of the use of such theories for data type specification. We provide a mathematical semantics for these specifications that extends the initial algebra semantics for equational specification to include recursive types.


1995 ◽  
Vol 5 (1) ◽  
pp. 81-110 ◽  
Author(s):  
Peter Achten ◽  
Rinus Plasmeijer

AbstractFunctional programming languages have banned assignment because of its undesirable properties. The reward of this rigorous decision is that functional programming languages are side-effect free. There is another side to the coin: because assignment plays a crucial role in Input/Output (I/O), functional languages have a hard time dealing with I/O. Functional programming languages have therefore often been stigmatised as inferior to imperative programming languages because they cannot deal with I/O very well. In this paper, we show that I/O can be incorporated in a functional programming language without loss of any of the generally accepted advantages of functional programming languages. This discussion is supported by an extensive account of the I/O system offered by the lazy, purely functional programming language Clean. Two aspects that are paramount in its I/O system make the approach novel with respect to other approaches. These aspects are the technique of explicit multiple environment passing, and the Event I/O framework to program Graphical User I/O in a highly structured and high-level way. Clean file I/O is as powerful and flexible as it is in common imperative languages (one can read, write, and seek directly in a file). Clean Event I/O provides programmers with a high-level framework to specify complex Graphical User I/O. It has been used to write applications such as a window-based text editor, an object based drawing program, a relational database, and a spreadsheet program. These graphical interactive programs are completely machine independent, but still obey the look-and-feel of the concrete window environment being used. The specifications are completely functional and make extensive use of uniqueness typing, higher-order functions, and algebraic data types. Efficient implementations are present on the Macintosh, Sun (X Windows under Open Look) and PC (OS/2).


1993 ◽  
Vol 3 (2) ◽  
pp. 171-190 ◽  
Author(s):  
F. Warren Burton ◽  
Robert D Cameron

AbstractPattern matching in modern functional programming languages is tied to the representation of data. Unfortunately, this is incompatible with the philosophy of abstract data types.Two proposals have been made to generalize pattern matching to a broader class of types. The laws mechanism of Miranda allows pattern matching with non-free algebraic data types. More recently, Wadler proposed the concept of views as a more general solution, making it possible to define arbitrary mappings between a physical implementation and a view supporting pattern matching. Originally, it was intended to include views in the new standard lazy functional programming language Haskell.Laws and views each offer important advantages, particularly with respect to data abstraction. However, if not used with great care, they also introduce serious problems in equational reasoning. As a result, laws have been removed from Miranda and views were not included in the final version of Haskell.We propose a third approach which unifies the laws and views mechanisms while avoiding their problems. Philosophically, we view pattern matching as a bundling of case recognition and component selection functions instead of a method for inverting data construction. This can be achieved by removing the implied equivalence between data constructors and pattern constructors. In practice, we allow automatic mapping into a view but not out of the view. We show that equational reasoning can still be used with the resulting system. In fact, equational reasoning is easier, since there are fewer hidden traps.


2021 ◽  
Author(s):  
Siti Nurhaliza nurhalizah

An algorithm is a logical step or sequence in making a decision to solve a problem. Algorithms can be written in many ways, such as using everyday language, flow charts and even using programming languages such as C or C++. And in the algorithm there is also a Flowchart which means an image or graph of the steps that must be followed to make it easier to solve the problem. Programming languages cannot be separated from data types, if/else, arrays because these have an important role for beginners or those who want to know about programming languages. Writing scientific articles can make it easier for readers to know about algorithms and programming languages. Keywords: algorithm, algorithm and programming, programming language, data type, writing algorithm


2019 ◽  
Author(s):  
◽  
Thomas N. Reynolds

The [lambda]-calculus provides a simple, well-established framework for research in functional programming languages that readily lends itself to the use offormal methods--that is, the use of mathematically sound techniques and supporting tools--to describe and verify properties of programming languages, as well. This is no coincidence. After all, the [lambda]-calculus formalizes the concept of effective computability, for all computable functions are definable in the untyped [lambda]-calculus, making it expressively equivalent torecursive functions. In software, the expressiveness of functional languages is considereda strength. Functional approaches to language design, however, needn't be limited to soft-ware. In hardware, the expressiveness of functional languages becomes a major obstacle to successful hardware synthesis, for the reason that such languages are usually capable of expressing general recursion. The presence of general recursion makes it possible to generate expressions that run forever, never producing a well-defined value. In this dissertation, we study two novel variants of the simply typed [lambda]-calculus, representing fragments of functional hardware description languages. The first variant extends the type system, using natural numbers representing time. This addition, though simple, is non-trivial. We prove that this calculus possesses bounded variants of type-safety and strong normalization. That is to say, we show that all well-typed expressions evaluate to values within a bound determined by the natural number index of their corresponding types. The second variant is a computational [lambda]-calculus that formalizes the core fragment of the hardware description language known as ReWire. We prove that the language has type-safety and is strongly normalizing -- the proof of strong normalizationis the first mechanized proof of its kind. We define an equational theory with respect to this language. This allows us to prove that the language has desirable security properties by construction. This work supports a full-edged, formal methodology for producing high assurance hardware.


2022 ◽  
Vol 6 (POPL) ◽  
pp. 1-32
Author(s):  
Vikraman Choudhury ◽  
Jacek Karwowski ◽  
Amr Sabry

The Pi family of reversible programming languages for boolean circuits is presented as a syntax of combinators witnessing type isomorphisms of algebraic data types. In this paper, we give a denotational semantics for this language, using weak groupoids à la Homotopy Type Theory, and show how to derive an equational theory for it, presented by 2-combinators witnessing equivalences of type isomorphisms. We establish a correspondence between the syntactic groupoid of the language and a formally presented univalent subuniverse of finite types. The correspondence relates 1-combinators to 1-paths, and 2-combinators to 2-paths in the universe, which is shown to be sound and complete for both levels, forming an equivalence of groupoids. We use this to establish a Curry-Howard-Lambek correspondence between Reversible Logic, Reversible Programming Languages, and Symmetric Rig Groupoids, by showing that the syntax of Pi is presented by the free symmetric rig groupoid, given by finite sets and bijections. Using the formalisation of our results, we perform normalisation-by-evaluation, verification and synthesis of reversible logic gates, motivated by examples from quantum computing. We also show how to reason about and transfer theorems between different representations of reversible circuits.


Author(s):  
Norihiro Yamada ◽  
Samson Abramsky

Abstract The present work achieves a mathematical, in particular syntax-independent, formulation of dynamics and intensionality of computation in terms of games and strategies. Specifically, we give game semantics of a higher-order programming language that distinguishes programmes with the same value yet different algorithms (or intensionality) and the hiding operation on strategies that precisely corresponds to the (small-step) operational semantics (or dynamics) of the language. Categorically, our games and strategies give rise to a cartesian closed bicategory, and our game semantics forms an instance of a bicategorical generalisation of the standard interpretation of functional programming languages in cartesian closed categories. This work is intended to be a step towards a mathematical foundation of intensional and dynamic aspects of logic and computation; it should be applicable to a wide range of logics and computations.


Sign in / Sign up

Export Citation Format

Share Document