845 research outputs found
General Recursion via Coinductive Types
A fertile field of research in theoretical computer science investigates the
representation of general recursive functions in intensional type theories.
Among the most successful approaches are: the use of wellfounded relations,
implementation of operational semantics, formalization of domain theory, and
inductive definition of domain predicates. Here, a different solution is
proposed: exploiting coinductive types to model infinite computations. To every
type A we associate a type of partial elements Partial(A), coinductively
generated by two constructors: the first, return(a) just returns an element
a:A; the second, step(x), adds a computation step to a recursive element
x:Partial(A). We show how this simple device is sufficient to formalize all
recursive functions between two given types. It allows the definition of fixed
points of finitary, that is, continuous, operators. We will compare this
approach to different ones from the literature. Finally, we mention that the
formalization, with appropriate structural maps, defines a strong monad.Comment: 28 page
Beating the Productivity Checker Using Embedded Languages
Some total languages, like Agda and Coq, allow the use of guarded corecursion
to construct infinite values and proofs. Guarded corecursion is a form of
recursion in which arbitrary recursive calls are allowed, as long as they are
guarded by a coinductive constructor. Guardedness ensures that programs are
productive, i.e. that every finite prefix of an infinite value can be computed
in finite time. However, many productive programs are not guarded, and it can
be nontrivial to put them in guarded form.
This paper gives a method for turning a productive program into a guarded
program. The method amounts to defining a problem-specific language as a data
type, writing the program in the problem-specific language, and writing a
guarded interpreter for this language.Comment: In Proceedings PAR 2010, arXiv:1012.455
The Guarded Lambda-Calculus: Programming and Reasoning with Guarded Recursion for Coinductive Types
We present the guarded lambda-calculus, an extension of the simply typed
lambda-calculus with guarded recursive and coinductive types. The use of
guarded recursive types ensures the productivity of well-typed programs.
Guarded recursive types may be transformed into coinductive types by a
type-former inspired by modal logic and Atkey-McBride clock quantification,
allowing the typing of acausal functions. We give a call-by-name operational
semantics for the calculus, and define adequate denotational semantics in the
topos of trees. The adequacy proof entails that the evaluation of a program
always terminates. We introduce a program logic with L\"ob induction for
reasoning about the contextual equivalence of programs. We demonstrate the
expressiveness of the calculus by showing the definability of solutions to
Rutten's behavioural differential equations.Comment: Accepted to Logical Methods in Computer Science special issue on the
18th International Conference on Foundations of Software Science and
Computation Structures (FoSSaCS 2015
Inductive and Coinductive Components of Corecursive Functions in Coq
In Constructive Type Theory, recursive and corecursive definitions are
subject to syntactic restrictions which guarantee termination for recursive
functions and productivity for corecursive functions. However, many terminating
and productive functions do not pass the syntactic tests. Bove proposed in her
thesis an elegant reformulation of the method of accessibility predicates that
widens the range of terminative recursive functions formalisable in
Constructive Type Theory. In this paper, we pursue the same goal for productive
corecursive functions. Notably, our method of formalisation of coinductive
definitions of productive functions in Coq requires not only the use of ad-hoc
predicates, but also a systematic algorithm that separates the inductive and
coinductive parts of functions.Comment: Dans Coalgebraic Methods in Computer Science (2008
Coinductive Formal Reasoning in Exact Real Arithmetic
In this article we present a method for formally proving the correctness of
the lazy algorithms for computing homographic and quadratic transformations --
of which field operations are special cases-- on a representation of real
numbers by coinductive streams. The algorithms work on coinductive stream of
M\"{o}bius maps and form the basis of the Edalat--Potts exact real arithmetic.
We use the machinery of the Coq proof assistant for the coinductive types to
present the formalisation. The formalised algorithms are only partially
productive, i.e., they do not output provably infinite streams for all possible
inputs. We show how to deal with this partiality in the presence of syntactic
restrictions posed by the constructive type theory of Coq. Furthermore we show
that the type theoretic techniques that we develop are compatible with the
semantics of the algorithms as continuous maps on real numbers. The resulting
Coq formalisation is available for public download.Comment: 40 page
Normalization by Evaluation in the Delay Monad: A Case Study for Coinduction via Copatterns and Sized Types
In this paper, we present an Agda formalization of a normalizer for
simply-typed lambda terms. The normalizer consists of two coinductively defined
functions in the delay monad: One is a standard evaluator of lambda terms to
closures, the other a type-directed reifier from values to eta-long beta-normal
forms. Their composition, normalization-by-evaluation, is shown to be a total
function a posteriori, using a standard logical-relations argument.
The successful formalization serves as a proof-of-concept for coinductive
programming and reasoning using sized types and copatterns, a new and presently
experimental feature of Agda.Comment: In Proceedings MSFP 2014, arXiv:1406.153
Unguarded Recursion on Coinductive Resumptions
We study a model of side-effecting processes obtained by starting from a
monad modelling base effects and adjoining free operations using a cofree
coalgebra construction; one thus arrives at what one may think of as types of
non-wellfounded side-effecting trees, generalizing the infinite resumption
monad. Correspondingly, the arising monad transformer has been termed the
coinductive generalized resumption transformer. Monads of this kind have
received some attention in the recent literature; in particular, it has been
shown that they admit guarded iteration. Here, we show that they also admit
unguarded iteration, i.e. form complete Elgot monads, provided that the
underlying base effect supports unguarded iteration. Moreover, we provide a
universal characterization of the coinductive resumption monad transformer in
terms of coproducts of complete Elgot monads.Comment: 47 pages, extended version of
http://www.sciencedirect.com/science/article/pii/S157106611500079
Type-Based Termination, Inflationary Fixed-Points, and Mixed Inductive-Coinductive Types
Type systems certify program properties in a compositional way. From a bigger
program one can abstract out a part and certify the properties of the resulting
abstract program by just using the type of the part that was abstracted away.
Termination and productivity are non-trivial yet desired program properties,
and several type systems have been put forward that guarantee termination,
compositionally. These type systems are intimately connected to the definition
of least and greatest fixed-points by ordinal iteration. While most type
systems use conventional iteration, we consider inflationary iteration in this
article. We demonstrate how this leads to a more principled type system, with
recursion based on well-founded induction. The type system has a prototypical
implementation, MiniAgda, and we show in particular how it certifies
productivity of corecursive and mixed recursive-corecursive functions.Comment: In Proceedings FICS 2012, arXiv:1202.317
Representations of first order function types as terminal coalgebras
Cosmic rays provide an important source for free electrons in Earth's atmosphere and also in dense interstellar regions where they produce a prevailing background ionization. We utilize a Monte Carlo cosmic ray transport model for particle energies of 10(6) eV <E <10(9) eV, and an analytic cosmic ray transport model for particle energies of 10(9) eV <E <10(12) eV in order to investigate the cosmic ray enhancement of free electrons in substellar atmospheres of free-floating objects. The cosmic ray calculations are applied to Drift-Phoenix model atmospheres of an example brown dwarf with effective temperature T-eff = 1500 K, and two example giant gas planets (T-eff = 1000 K, 1500 K). For the model brown dwarf atmosphere, the electron fraction is enhanced significantly by cosmic rays when the pressure p(gas) <10(-2) bar. Our example giant gas planet atmosphere suggests that the cosmic ray enhancement extends to 10(-4)-10(-2) bar, depending on the effective temperature. For the model atmosphere of the example giant gas planet considered here (T-eff = 1000 K), cosmic rays bring the degree of ionization to f(e) greater than or similar to 10(-8) when p(gas) <10(-8) bar, suggesting that this part of the atmosphere may behave as a weakly ionized plasma. Although cosmic rays enhance the degree of ionization by over three orders of magnitude in the upper atmosphere, the effect is not likely to be significant enough for sustained coupling of the magnetic field to the gas.Publisher PDFPeer reviewe
- …