Technical report Frank / Johann-Wolfgang-Goethe-Universität, Fachbereich Informatik und Mathematik, Institut für Informatik
22 search hits
- 49
-
Simulation in the call-by-need lambda-calculus with letrec, case, constructors, and seq
(2012)
-
Manfred Schmidt-Schauß
David Sabel
Elena Machkasova
- This paper shows equivalence of applicative similarity and contextual approximation, and hence also of bisimilarity and contextual equivalence, in LR, the deterministic call-by-need lambda calculus with letrec extended by data constructors, case-expressions and Haskell's seqoperator. LR models an untyped version of the core language of Haskell. Bisimilarity simplifies equivalence proofs in the calculus and opens a way for more convenient correctness proofs for program transformations.
The proof is by a fully abstract and surjective transfer of the contextual
approximation into a call-by-name calculus, which is an extension
of Abramsky's lazy lambda calculus. In the latter calculus equivalence
of similarity and contextual approximation can be shown by Howe's
method. Using an equivalent but inductive definition of behavioral preorder
we then transfer similarity back to the calculus LR.
The translation from the call-by-need letrec calculus into the extended call-by-name lambda calculus is the composition of two translations. The first translation replaces the call-by-need strategy by a call-by-name strategy and its correctness is shown by exploiting infinite tress, which emerge by unfolding the letrec expressions. The second translation encodes letrec-expressions by using multi-fixpoint combinators and its correctness is shown syntactically by comparing reductions of both calculi. A further result of this paper is an isomorphism between the mentioned calculi, and also with a call-by-need letrec calculus with a less complex definition of reduction than LR.
- 50
-
Correctness of an STM Haskell implementation
(2012)
-
Manfred Schmidt-Schauß
David Sabel
- A concurrent implementation of software transactional memory in Concurrent Haskell using a call-by-need functional language with processes and futures is given. The description of the small-step operational semantics is precise and explicit, and employs an early abort of con
icting transactions. A proof of correctness of the implementation is given for a contextual semantics with may- and should-convergence.
This implies that our implementation is a correct evaluator for an abstract specification equipped with a big-step semantics.
- 48
-
An abstract machine for concurrent Haskell with futures
(2012)
-
David Sabel
- We show how Sestoft’s abstract machine for lazy evaluation
of purely functional programs can be extended to evaluate expressions of
the calculus CHF – a process calculus that models Concurrent Haskell
extended by imperative and implicit futures. The abstract machine is
modularly constructed by first adding monadic IO-actions to the machine
and then in a second step we add concurrency. Our main result is that
the abstract machine coincides with the original operational semantics
of CHF, w.r.t. may- and should-convergence.
- 44
-
A contextual semantics for concurrent Haskell with futures
(2011)
-
David Sabel
Manfred Schmidt-Schauß
- In this paper we analyze the semantics of a higher-order functional language with concurrent threads, monadic IO and synchronizing variables as in Concurrent Haskell. To assure declarativeness of concurrent programming we extend the language by implicit, monadic, and concurrent futures. As semantic model we introduce and analyze the process calculus CHF, which represents a typed core language of Concurrent Haskell extended by concurrent futures. Evaluation in CHF is defined by a small-step reduction relation. Using contextual equivalence based on may- and should-convergence as program equivalence, we show that various transformations preserve program equivalence. We establish a context lemma easing those correctness proofs. An important result is that call-by-need and call-by-name evaluation are equivalent in CHF, since they induce the same program equivalence. Finally we show that the monad laws hold in CHF under mild restrictions on Haskell’s seq-operator, which for instance justifies the use of the do-notation.
- 47
-
On conservativity of concurrent Haskell
(2011)
-
David Sabel
Manfred Schmidt-Schauß
- The calculus CHF models Concurrent Haskell extended by
concurrent, implicit futures. It is a process calculus with concurrent threads, monadic concurrent evaluation, and includes a pure functional
lambda-calculus which comprises data constructors, case-expressions,
letrec-expressions, and Haskell’s seq. Futures can be implemented in Concurrent
Haskell using the primitive unsafeInterleaveIO, which is available in most implementations of Haskell. Our main result is conservativity
of CHF, that is, all equivalences of pure functional expressions are
also valid in CHF. This implies that compiler optimizations and transformations
from pure Haskell remain valid in Concurrent Haskell even if
it is extended by futures. We also show that this is no longer valid if Concurrent
Haskell is extended by the arbitrary use of unsafeInterleaveIO.
- 39
-
Reconstruction a logic for inductive proofs of properties of functional programs
(2010)
-
David Sabel
Manfred Schmidt-Schauß
- A logical framework consisting of a polymorphic call-by-value functional language and a first-order logic on the values is presented, which is a reconstruction of the logic of the verification system VeriFun. The reconstruction uses contextual semantics to define the logical value of equations. It equates undefinedness and non-termination, which is a standard semantical approach. The main results of this paper are: Meta-theorems about the globality of several classes of theorems in the logic, and proofs of global correctness of transformations and deduction rules. The deduction rules of VeriFun are globally correct if rules depending on termination are appropriately formulated. The reconstruction also gives hints on generalizations of the VeriFun framework: reasoning on nonterminating expressions and functions, mutual recursive functions and abstractions in the data values, and formulas with arbitrary quantifier prefix could be allowed.
- 40
-
Simulation in the call-by-need lambda-calculus with letrec
(2010)
-
Manfred Schmidt-Schauß
David Sabel
Elena Machkasova
- This paper shows the equivalence of applicative similarity and contextual approximation, and hence also of bisimilarity and contextual equivalence, in the deterministic call-by-need lambda calculus with letrec. Bisimilarity simplifies equivalence proofs in the calculus and opens a way for more convenient correctness proofs for program transformations. Although this property may be a natural one to expect, to the best of our knowledge, this paper is the first one providing a proof. The proof technique is to transfer the contextual approximation into Abramsky's lazy lambda calculus by a fully abstract and surjective translation. This also shows that the natural embedding of Abramsky's lazy lambda calculus into the call-by-need lambda calculus with letrec is an isomorphism between the respective term-models.We show that the equivalence property proven in this paper transfers to a call-by-need letrec calculus developed by Ariola and Felleisen.
- 42
-
A termination proof of reduction in a simply typed calculus with constructors
(2010)
-
Manfred Schmidt-Schauß
David Sabel
- The well-known proof of termination of reduction in simply typed calculi is adapted to a monomorphically typed lambda-calculus with case and constructors and recursive data types. The proof differs at several places from the standard proof. Perhaps it is useful and can be extended also to more complex calculi.
- 37
-
On correctness of buffer implementations in a concurrent lambda calculus with futures
(2009)
-
Jan Schwinghammer
David Sabel
Joachim Niehren
Manfred Schmidt-Schauß
- Motivated by the question of correctness of a specific implementation of concurrent buffers in the lambda calculus with futures underlying Alice ML, we prove that concurrent buffers and handled futures can correctly encode each other. Correctness means that our encodings preserve and reflect the observations of may- and must-convergence. This also shows correctness wrt. program semantics, since the encodings are adequate translations wrt. contextual semantics. While these translations encode blocking into queuing and waiting, we also provide an adequate encoding of buffers in a calculus without handles, which is more low-level and uses busy-waiting instead of blocking. Furthermore we demonstrate that our correctness concept applies to the whole compilation process from high-level to low-level concurrent languages, by translating the calculus with buffers, handled futures and data constructors into a small core language without those constructs.
- 36
-
Contextual equivalence in lambda-calculi extended with letrec and with a parametric polymorphic type system
(2009)
-
Manfred Schmidt-Schauß
David Sabel
Frederik Harwath
- This paper describes a method to treat contextual equivalence in polymorphically typed lambda-calculi, and also how to transfer equivalences from the untyped versions of lambda-calculi to their typed variant, where our specific calculus has letrec, recursive types and is nondeterministic. An addition of a type label to every subexpression is all that is needed, together with some natural constraints for the consistency of the type labels and well-scopedness of expressions. One result is that an elementary but typed notion of program transformation is obtained and that untyped contextual equivalences also hold in the typed calculus as long as the expressions are well-typed. In order to have a nice interaction between reduction and typing, some reduction rules have to be accompanied with a type modification by generalizing or instantiating types.