Article

Finiteness and rational sequences, constructively

Authors:
To read the full-text of this research, you can request a copy directly from the authors.

Abstract

Rational sequences are possibly infinite sequences with a finite number of distinct suffixes. In this paper, we present different implementations of rational sequences in Martin–Löf type theory. First, we literally translate the above definition of rational sequence into the language of type theory, i.e., we construct predicates on possibly infinite sequences expressing the finiteness of the set of suffixes. In type theory, there exist several inequivalent notions of finiteness. We consider two of them, listability and Noetherianness, and show that in the implementation of rational sequences the two notions are interchangeable. Then we introduce the type of lists with backpointers, which is an inductive implementation of rational sequences. Lists with backpointers can be unwound into rational sequences, and rational sequences can be truncated into lists with backpointers. As an example, we see how to convert the fractional representation of a rational number into its decimal representation and vice versa.

No full-text available

Request Full-text Paper PDF

To read the full-text of this research,
you can request a copy directly from the authors.

... This result is not surprising, it is well-known that one can treat regular structures as cyclic structures (see e.g. [Spa16,UV17]), but we provide an abstract construction in the general setting of rule-based definitions, proving it is correct. Furthermore, relying on the inductive characterization, we define a proof technique to show soundness of a set of inference rules against a set of valid judgements, that is, that all derivable judgements are valid. ...
... A further development in this direction would be to provide support to regular reasoning in proof assistants, which usually provide primitives only for plain induction and coinduction. To this end, we could start from existing approaches [Spa16,UV17] to implement regular terms in proof assistants. ...
Preprint
Full-text available
Inference systems are a widespread framework used to define possibly recursive predicates by means of inference rules. They allow both inductive and coinductive interpretations that are fairly well-studied. In this paper, we consider a middle way interpretation, called regular, which combines advantages of both approaches: it allows non-well-founded reasoning while being finite. We show that the natural proof-theoretic definition of the regular interpretation, based on regular trees, coincides with a rational fixed point. Then, we provide an equivalent inductive characterization, which leads to an algorithm to check whether a judgement is derivable in the regular interpretation. Relying on these results, we define proof techniques for regular reasoning: the regular coinduction principle, to prove completeness, and and an inductive technique to prove soundness, based on the inductive characterization of the regular interpretation. Finally, we show the regular approach can be smoothly extended to inference systems with corules, a recently introduced, generalised framework, which allows to refine the coinductive interpretation.
... If so desired, we could have avoided working with sets by replacing them with a type-theoretic setup that is equipped with a suitable notion of finite subtypes [31,32] and the analogue of the finite powerset monad. Such structures can be constructed in several ways, for instance using quotient types [33]. ...
Preprint
Full-text available
We develop and investigate a general theory of representations of second-order functionals, based on a notion of a right comodule for a monad on the category of containers. We show how the notion of comodule representability naturally subsumes classic representations of continuous functionals with well-founded trees. We find other kinds of representations by varying the monad, the comodule, and in some cases the underlying category of containers. Examples include uniformly continuous or finitely supported functionals, functionals querying their arguments precisely once, or at most once, functionals interacting with an ambient environment through computational effects, as well as functionals trivially representing themselves. Many of these rely on our construction of a monad on containers from a monad on shapes and a weak Mendler-style monad algebra on the universe for positions. We show that comodule representability on the category of propositional containers, which have positions valued in a universe of propositions, is closely related to instance reducibility in constructive mathematics, and through it to Weihrauch reducibility in computability theory.
... The first one is to support other interpretations of inference systems, such as the regular one [Dagnino, 2020], which is basically coinductive but allows only proof trees with finitely many distinct subtrees. To this end, useful starting points are works on regular terms and streams [Spadotti, 2016, Uustalu andVeltri, 2017] and on finite sets [Firsov and Uustalu, 2015] in dependent type the-ories. The challenging part is the finiteness constraint, which is not trivial in a type-theoretic setting. ...
Preprint
Full-text available
Sessions are a fundamental notion in message-passing systems. A session is an abstract notion of communication between parties where each one owns an endpoint. Session types are types that are assigned to the endpoints and that are used to statically and dynamically enforce some desired properties of the communications, such as the absence of deadlocks. Properties of concurrent systems are usually divided in safety and liveness ones and depending on the class it belongs to, a property is defined using different (dual) techniques. However, there exist some properties that require to mix both techniques and the challenges in defining them are exacerbated in proof assistants (e.g. Agda, Coq, . . . ), that is, tools that allow users to formally characterize and prove theorems. In particular, we mechanize the meta-theory of inference systems in Agda. Among the interesting properties that can be studied in the session-based context, we study fair termination which is the property of those sessions that can always eventually reach successful termination under a fairness assumption. Fair termination implies many desirable and well known properties, such as lock freedom. Moreover, a lock free session does not imply that other sessions are lock free as well. On the other hand, if we consider a session and we assume that all the other ones are fairly terminating, we can conclude that the one under analysis is fairly terminating as well.
... Other definitions include Bishop-finiteness [13], enumerated sets [44], streamless sets, and Noether- ian sets [12,20,[37][38][39]44]. The latter three notions have also been translated to type theory [10,19,48], but only in a proof-relevant fashion i.e., without truncation. Note also that streamlessness and Noetherianness both are weaker than enumeratedness, which we studied in Section 4. ...
Conference Paper
We study different formalizations of finite sets in homotopy type theory to obtain a general definition that exhibits both the computational facilities and the proof principles expected from finite sets. We use higher inductive types to define the type K(A) of "finite sets over type A" à la Kuratowski without assuming that K(A) has decidable equality. We show how to define basic functions and prove basic properties after which we give two applications of our definition. On the foundational side, we use K to define the notions of "Kuratowski-finite type" and "Kuratowski-finite subobject", which we contrast with established notions, e.g. Bishop-finite types and enumerated types. We argue that Kuratowski-finiteness is the most general and flexible one of those and we define the usual operations on finite types and subobjects. From the computational perspective, we show how to use K(A) for an abstract interface for well-known finite set implementations such as tree- and list-like data structures. This implies that a function defined on a concrete finite sets implementation can be obtained from a function defined on the abstract finite sets K(A) and that correctness properties are inherited. Hence, HoTT is the ideal setting for data refinement. Beside this, we define bounded quantification, which lifts a decidable property on A to one on K(A).
... Other definitions include Bishop-finiteness [13], enumerated sets [44], streamless sets, and Noetherian sets [12, 20, 37ś39, 44]. The latter three notions have also been translated to type theory [10,19,48], but only in a proof-relevant fashion i.e., without truncation. Note also that streamlessness and Noetherianness both are weaker than enumeratedness, which we studied in Section 4. ...
Conference Paper
We study different formalizations of finite sets in homotopy type theory to obtain a general definition that exhibits both the computational facilities and the proof principles expected from finite sets. We use higher inductive types to define the type K(A) of "finite sets over type A" à la Kuratowski without assuming that K(A) has decidable equality. We show how to define basic functions and prove basic properties after which we give two applications of our definition. On the foundational side, we use K to define the notions of "Kuratowski-finite type" and "Kuratowski-finite subobject", which we contrast with established notions, e.g. Bishop-finite types and enumerated types. We argue that Kuratowski-finiteness is the most general and flexible one of those and we define the usual operations on finite types and subobjects. From the computational perspective, we show how to use K(A) for an abstract interface for well-known finite set implementations such as tree- and list-like data structures. This implies that a function defined on a concrete finite sets implementation can be obtained from a function defined on the abstract finite sets K(A) and that correctness properties are inherited. Hence, HoTT is the ideal setting for data refinement. Beside this, we define bounded quantification, which lifts a decidable property on A to one on K(A).
Article
Full-text available
The effect of different dilutions with heparin solutions or saline on blood Pco2, pH and standard bicarbonate was investigated. Blood was first equilibrated to give about 40 or 60 mmHg Pco2. The solutions were in equilibrium with room air. The effect on blood Pco2 etc. could be fully explained by the dilution with a medium having a much lower Pco2. Thus, correction of the heparin solution to pH 7.40 and Pco2 40 mmHg eliminated the effect on Pco2, pH and standard bicarbonate. With ordinary procedure for blood heparinization (about 2% dilution) the effect is practically negligible.
Article
Full-text available
Mixing induction and coinduction, we study alternative definitions of streams being finitely red. We organize our definitions into a hierarchy including also some well-known alternatives in intuitionistic analysis. The hierarchy collapses classically, but is intuitionistically of strictly decreasing strength. We characterize the differences in strength in a precise way by weak instances of the Law of Excluded Middle.
Article
Full-text available
Almost every programmer has faced the problem of representing a tree together with a subtree that is the focus of attention, where that focus may move left, right, up or down the tree. The Zipper is Huet's nifty name for a nifty data structure which fulfills this need. I wish I had known of it when I faced this task, because the solution I came up with was not quite so efficient or elegant as the Zipper.
Conference Paper
Definitions of many mathematical structures used in computer science are parametrized by finite sets. To work with such structures in proof assistants, we need to be able to explain what a finite set is. In constructive mathematics, a widely used definition is listability: a set is considered to be finite, if its elements can be listed completely. In this paper, we formalize different variations of this definition in the Agda programming language. We develop a toolbox for boilerplate-free programming with finite sets that arise as subsets of some base set with decidable equality. Among other things we implement combinators for defining functions from finite sets and a prover for quantified formulas over decidable properties on finite sets.
Article
Co-recursion is the ability of defining a function that produces some infinite data in terms of the function and the data itself, and is typically supported by languages with lazy evaluation. However, in languages as Haskell strict operations fail to terminate even on infinite regular data. Regular co-recursion is naturally supported by co-inductive Prolog, an extension where predicates can be interpreted either inductively or co-inductively, that has proved to be useful for formal verification, static analysis and symbolic evaluation of programs. In this paper we propose two main alternative vanilla meta-interpreters to support regular co-recursion in Prolog as an interesting programming style in its own right, able to elegantly solve problems that would require more complex code if conventional recursion were used. In particular, the second meta-interpreters avoids non termination in several cases, by restricting the set of possible answers. The semantics defined by these vanilla meta-interpreters are an interesting starting point to study new semantics able to support regular co-recursion for non logical languages.
Article
The notion algebraic theory was introduced by Lawvere in 1963 (cf. S. Eilenberg and J. B. Wright, Automata in general algebras, Information and Control 11 (1967) 4) to study equationally definable classes of algebras from a more intrinsic point of view. We make use of it to study Turing machines and machines with a similar kind of control at a level of abstraction which disregards the nature of ‘storage’ or ‘external memory’.
Article
Every finitary endofunctor of \Set is proved to generate a free iterative theory in the sense of Elgot. This work is based on coalgebras, specifically on parametric corecursion, and the proof is presented for categories more general than just \Set.
Article
Infinite trees naturally arise in the formalization and the study of the semantics of programming languages. This paper investigates some of their combinatorial and algebraic properties that are especially relevant to semantics. This paper is concerned in particular with regular and algebraic infinite trees, not with regular or algebraic sets of infinite trees. For this reason most of the properties stated in this work become trivial when restricted either to finite trees or to infinite words. It presents a synthesis of various aspects of infinite trees, investigated by different authors in different contexts and hopes to be a first step towards a theory of infinite trees that could take place near the theory of formal languages and the combinatorics of the free monoid.
Article
This paper establishes the relationship between regular trees, equationally defined trees, and Elgot's iterative algebraic theories; in particular, it provides a regular tree characterization of the free iterative theory and an equational tree characterization of the free iterative theory. These tree characterizations have implications for decision problems involving flowchart schemes interpreted in iterative theories and they also help to explicate the connections between order theoretic and non-order theoretic fixed point models for iteration.
Article
In ''Monadic Computation and Iterative Algebraic Theories'' by Calvin C. Elgot,the notion ''iterative theory'' (more fully, ''ideal theory closed under conditional iteration'') is introduced and applied to the study of computational processes. The main point of the present paper is to show the existence (in a constructive sense) of free iterative theories. The main complication is the fact that in an iterative theory I the ''iteration'' operation is not defined for all elements of I. Were it not for this complication, the existence of free iterative theories would follow from general algebraic considerations (extended to many-sorted algebras). Actually we sketch two proofs of the existence of free iterative theories. One argument follows as much as possible general algebraic lines and is given a linguistic flavor in order to emphasize the concreteness of the ideas involved. The second argument depends upon ''normal descriptions'': a morphism in the free iterative theory being an equivalence class of normal descriptions.
Une théorie mécanisée des arbres réguliers en théorie des types dépendants
  • R Spadotti