23 research outputs found
Two tricks to trivialize higher-indexed families
The conventional general syntax of indexed families in dependent type
theories follow the style of "constructors returning a special case", as in
Agda, Lean, Idris, Coq, and probably many other systems. Fording is a method to
encode indexed families of this style with index-free inductive types and an
identity type. There is another trick that merges interleaved higher
inductive-inductive types into a single big family of types. It makes use of a
small universe as the index to distinguish the original types. In this paper,
we show that these two methods can trivialize some very fancy-looking indexed
families with higher inductive indices (which we refer to as higher indexed
families).Comment: 8 page
New Equations for Neutral Terms: A Sound and Complete Decision Procedure, Formalized
The definitional equality of an intensional type theory is its test of type
compatibility. Today's systems rely on ordinary evaluation semantics to compare
expressions in types, frustrating users with type errors arising when
evaluation fails to identify two `obviously' equal terms. If only the machine
could decide a richer theory! We propose a way to decide theories which
supplement evaluation with `-rules', rearranging the neutral parts of
normal forms, and report a successful initial experiment.
We study a simple -calculus with primitive fold, map and append operations on
lists and develop in Agda a sound and complete decision procedure for an
equational theory enriched with monoid, functor and fusion laws
Elaborating Inductive Definitions
We present an elaboration of inductive definitions down to a universe of
datatypes. The universe of datatypes is an internal presentation of strictly
positive families within type theory. By elaborating an inductive definition --
a syntactic artifact -- to its code -- its semantics -- we obtain an
internalized account of inductives inside the type theory itself: we claim that
reasoning about inductive definitions could be carried in the type theory, not
in the meta-theory as it is usually the case. Besides, we give a formal
specification of that elaboration process. It is therefore amenable to formal
reasoning too. We prove the soundness of our translation and hint at its
correctness with respect to Coq's Inductive definitions.
The practical benefits of this approach are numerous. For the type theorist,
this is a small step toward bootstrapping, ie. implementing the inductive
fragment in the type theory itself. For the programmer, this means better
support for generic programming: we shall present a lightweight deriving
mechanism, entirely definable by the programmer and therefore not requiring any
extension to the type theory.Comment: 32 pages, technical repor
Code Generation for Higher Inductive Types
Higher inductive types are inductive types that include nontrivial
higher-dimensional structure, represented as identifications that are not
reflexivity. While work proceeds on type theories with a computational
interpretation of univalence and higher inductive types, it is convenient to
encode these structures in more traditional type theories with mature
implementations. However, these encodings involve a great deal of error-prone
additional syntax. We present a library that uses Agda's metaprogramming
facilities to automate this process, allowing higher inductive types to be
specified with minimal additional syntax.Comment: 16 pages, Accepted for presentation in WFLP 201
Verification of high-level transformations with inductive refinement types
International audienceHigh-level transformation languages like Rascal include expressive features for manipulating large abstract syntax trees: first-class traversals, expressive pattern matching, backtrack-ing and generalized iterators. We present the design and implementation of an abstract interpretation tool, Rabit, for verifying inductive type and shape properties for transformations written in such languages. We describe how to perform abstract interpretation based on operational semantics, specifically focusing on the challenges arising when analyzing the expressive traversals and pattern matching. Finally, we evaluate Rabit on a series of transformations (normaliza-tion, desugaring, refactoring, code generators, type inference, etc.) showing that we can effectively verify stated properties. CCS Concepts • Software and its engineering → General programming languages; • Social and professional topics → History of programming languages
Verification of Program Transformations with Inductive Refinement Types
International audienceHigh-level transformation languages like Rascal include expressive features for manipulating large abstract syntax trees: first-class traversals, expressive pattern matching, backtracking, and generalized iterators. We present the design and implementation of an abstract interpretation tool, Rabit, for verifying inductive type and shape properties for transformations written in such languages. We describe how to perform abstract interpretation based on operational semantics, specifically focusing on the challenges arising when analyzing the expressive traversals and pattern matching. Finally, we evaluate Rabit on a series of transformations (normalization, desugaring, refactoring, code generators, type inference, etc.) showing that we can effectively verify stated properties
Transporting Functions across Ornaments
Programming with dependent types is a blessing and a curse. It is a blessing
to be able to bake invariants into the definition of data-types: we can finally
write correct-by-construction software. However, this extreme accuracy is also
a curse: a data-type is the combination of a structuring medium together with a
special purpose logic. These domain-specific logics hamper any effort of code
reuse among similarly structured data.
In this paper, we exorcise our data-types by adapting the notion of ornament
to our universe of inductive families. We then show how code reuse can be
achieved by ornamenting functions. Using these functional ornament, we capture
the relationship between functions such as the addition of natural numbers and
the concatenation of lists. With this knowledge, we demonstrate how the
implementation of the former informs the implementation of the latter: the user
can ask the definition of addition to be lifted to lists and she will only be
asked the details necessary to carry on adding lists rather than numbers.
Our presentation is formalised in a type theory with a universe of data-types
and all our constructions have been implemented as generic programs, requiring
no extension to the type theory
Refining Inductive Types
Dependently typed programming languages allow sophisticated properties of data to be expressed within the type system. Of particular use in dependently typed programming are indexed types that refine data by computationally useful information. For example, the N-indexed type of vectors refines lists by their lengths. Other data types may be refined in similar ways, but programmers must produce purpose-specific refinements on an ad hoc basis, developers must anticipate which refinements to include in libraries, and implementations must often store redundant information about data and their refinements. In this paper we show how to generically derive inductive characterizations of refinements of inductive types, and argue that these characterizations can alleviate some of the aforementioned difficulties associated with ad hoc refinements. Our characterizations also ensure that standard techniques for programming with and reasoning about inductive types are applicable to refinements, and that refinements can themselves be further refined