scispace - formally typeset
Search or ask a question
Journal ArticleDOI

Idris, a general-purpose dependently typed programming language: Design and implementation

01 Sep 2013-Journal of Functional Programming (Cambridge University Press)-Vol. 23, Iss: 05, pp 552-593
TL;DR: This paper describes the implementation of Idris, a new dependently typed functional programming language, and presents a tactic-based method for elaborating concrete high-level syntax with implicit arguments and type classes into a fully explicit type theory.
Abstract: Many components of a dependently-typed programming language are by now well understood, for example the underlying type theory, type checking, unification and evaluation. How to combine these components into a realistic and usable high-level language is, however, folklore, discovered anew by successive language implementators. In this paper, I describe the implementation of IDRIS, a new dependently-typed functional programming language. IDRIS is intended to be a general purpose programming language and as such provides high-level concepts such as implicit syntax, type classes and do notation. I describe the high-level language and the underlying type theory, and present a tactic-based method for elaborating concrete high-level syntax with implicit arguments and type classes into a fully explicit type theory. Furthermore, I show how this method facilitates the implementation of new high-level language constructs.
Citations
More filters
Journal ArticleDOI
TL;DR: There has been an increasing trend towards the publication of blockchain-based smart contract articles at conferences and journals, mainly reflecting experiments and presenting methods, tools and models since 2016, according to the results.

297 citations

Proceedings ArticleDOI
02 Jun 2016
TL;DR: The tool was able to synthesize more complex programs than those reported in prior work, as well as most of the benchmarks tackled by existing synthesizers, often starting from a more concise and intuitive user input.
Abstract: We present a method for synthesizing recursive functions that provably satisfy a given specification in the form of a polymorphic refinement type. We observe that such specifications are particularly suitable for program synthesis for two reasons. First, they offer a unique combination of expressive power and decidability, which enables automatic verification—and hence synthesis—of nontrivial programs. Second, a type-based specification for a program can often be effectively decomposed into independent specifications for its components, causing the synthesizer to consider fewer component combinations and leading to a combinatorial reduction in the size of the search space. At the core of our synthesis procedure is a newalgorithm for refinement type checking, which supports specification decomposition. We have evaluated our prototype implementation on a large set of synthesis problems and found that it exceeds the state of the art in terms of both scalability and usability. The tool was able to synthesize more complex programs than those reported in prior work (several sorting algorithms and operations on balanced search trees), as well as most of the benchmarks tackled by existing synthesizers, often starting from a more concise and intuitive user input.

224 citations


Cites background from "Idris, a general-purpose dependentl..."

  • ...Another important body of related work related is hole driven development, as embodied in systems like Agda [26] and Idris [6], which leverage a rich type system to aid development, but are meant to be used interactively rather than to perform complete synthesis....

    [...]

Journal ArticleDOI
TL;DR: An architecture of a full hammer for dependent type theory together with its implementation for the Coq proof assistant is presented and 40.8% of the theorems can be proved in a push-button mode in about 40 s of real time on a 8-CPU system.
Abstract: Hammers provide most powerful general purpose automation for proof assistants based on HOL and set theory today. Despite the gaining popularity of the more advanced versions of type theory, such as those based on the Calculus of Inductive Constructions, the construction of hammers for such foundations has been hindered so far by the lack of translation and reconstruction components. In this paper, we present an architecture of a full hammer for dependent type theory together with its implementation for the Coq proof assistant. A key component of the hammer is a proposed translation from the Calculus of Inductive Constructions, with certain extensions introduced by Coq, to untyped first-order logic. The translation is “sufficiently” sound and complete to be of practical use for automated theorem provers. We also introduce a proof reconstruction mechanism based on an eauto-type algorithm combined with limited rewriting, congruence closure and some forward reasoning. The algorithm is able to re-prove in the Coq logic most of the theorems established by the ATPs. Together with machine-learning based selection of relevant premises this constitutes a full hammer system. The performance of the whole procedure is evaluated in a bootstrapping scenario emulating the development of the Coq standard library. For each theorem in the library only the previous theorems and proofs can be used. We show that 40.8% of the theorems can be proved in a push-button mode in about 40 s of real time on a 8-CPU system.

100 citations


Cites methods from "Idris, a general-purpose dependentl..."

  • ...Lastly, we would like to extend the work to other systems based on variants of CIC and other interesting foundations, including Matita, Agda, and Idris....

    [...]

  • ...Agda [13] and Idris [19], one would need a method to heuristically infer which types are to be regarded as propositions, in addition to possibly some adjustments to the formalism of CIC0....

    [...]

  • ...For proof assistants based on dependent type theories which do not make this distinction, e.g. Agda [13] and Idris [19], one would need a method to heuristically infer which types are to be regarded as propositions, in addition to possibly some adjustments to the formalism of CIC0....

    [...]

Proceedings ArticleDOI
11 Jan 2016
TL;DR: The formalisation of type theory avoids referring to preterms or a typability relation but defines directly well typed objects by an inductive definition and uses the elimination principle to define the set-theoretic and logical predicate interpretation.
Abstract: We present an internal formalisation of a type heory with dependent types in Type Theory using a special case of higher inductive types from Homotopy Type Theory which we call quotient inductive types (QITs). Our formalisation of type theory avoids referring to preterms or a typability relation but defines directly well typed objects by an inductive definition. We use the elimination principle to define the set-theoretic and logical predicate interpretation. The work has been formalized using the Agda system extended with QITs using postulates.

100 citations


Cites background from "Idris, a general-purpose dependentl..."

  • ...In the paper, to improve readability we omit implicitly quantified variables whose types can be inferred from the context (in this respect we follow rather Idris [9])....

    [...]

References
More filters
Book
12 Mar 2014
TL;DR: A practical introduction to the development of proofs and certified programs using Coq can be found in this paper, which is an invaluable tool for researchers, students, and engineers interested in formal methods and the developing of zero-fault software.
Abstract: A practical introduction to the development of proofs and certified programs using Coq. An invaluable tool for researchers, students, and engineers interested in formal methods and the development of zero-fault software.

1,514 citations


"Idris, a general-purpose dependentl..." refers background or methods in this paper

  • ...• Tactics, such as those used in the Coq theorem prover (Bertot & Castéran, 2004), are a convenient abstraction for building proofs and programs by refinement....

    [...]

  • ...Dependently typed programming languages, such as Agda (Norell, 2007) and Coq (Bertot & Castéran, 2004), have emerged in recent years as a promising approach to ensuring the correctness of software....

    [...]

  • ...This opens up the possibility of implementing domain-specific decision procedures, or implementing user-defined tactics in a style similar to Coq’s Ltac language (Delahaye, 2000)....

    [...]

  • ...In contrast to Agda and Coq, which have arisen from the theorem proving community, IDRIS takes Haskell as its main influence....

    [...]

  • ...The type of types, Typei is parameterised by a universe level, to prevent Girard’s paradox (Coquand, 1986)....

    [...]

Dissertation
01 Jan 2007
TL;DR: This thesis is concerned with bridging the gap between the theoretical presentations of type theory and the requirements on a practical programming language.
Abstract: Dependent type theories have a long history of being used for theorem proving One aspect of type theory which makes it very powerful as a proof language is that it mixes deduction with computation This also makes type theory a good candidate for programming---the strength of the type system allows properties of programs to be stated and established, and the computational properties provide semantics for the programs This thesis is concerned with bridging the gap between the theoretical presentations of type theory and the requirements on a practical programming language Although there are many challenging research problems left to solve before we have an industrial scale programming language based on type theory, this thesis takes us a good step along the way

693 citations


"Idris, a general-purpose dependentl..." refers background or methods in this paper

  • ...The validity of a pattern clause is defined by the following rule: Γ;λ x : U f s : S Γ;λ x : U e : T Γ S T Γ var x : U.f s = e valid Patterns are separated into the accessible patterns (variables and constructor forms which may be inspected) and inaccessible patterns, following Agda (Norell, 2007) then implemented by compilation into case trees (Augustsson, 1985)....

    [...]

  • ...Dependently typed programming languages, such as Agda (Norell, 2007) and Coq (Bertot & Castéran, 2004), have emerged in recent years as a promising approach to ensuring the correctness of software....

    [...]

  • ...Dependently typed programming languages, such as Agda (Norell, 2007) and Coq (Bertot & Castéran, 2004), have emerged in recent years as a promising approach to ensuring the correctness of software....

    [...]

  • ...f s = e valid Patterns are separated into the accessible patterns (variables and constructor forms which may be inspected) and inaccessible patterns, following Agda (Norell, 2007) then implemented by compilation into case trees (Augustsson, 1985)....

    [...]

  • ...In contrast to Agda and Coq, which have arisen from the theorem proving community, IDRIS takes Haskell as its main influence....

    [...]

Proceedings ArticleDOI
01 Jan 2001
TL;DR: This work establishes the problem's intrinsic complexity, and gives a direct algorithm operating on "size-change graphs" (without the passage to automata), which turns out to be surprisingly high, complete for PSPACE, in spite of the simplicity of the principle.
Abstract: The "size-change termination" principle for a first-order functional language with well-founded data is: a program terminates on all inputs if every infinite call sequence (following program control flow) would cause an infinite descent in some data values.Size-change analysis is based only on local approximations to parameter size changes derivable from program syntax. The set of infinite call sequences that follow program flow and can be recognized as causing infinite descent is an ω-regular set, representable by a Buchi automaton. Algorithms for such automata can be used to decide size-change termination. We also give a direct algorithm operating on "size-change graphs" (without the passage to automata).Compared to other results in the literature, termination analysis based on the size-change principle is surprisingly simple and general: lexical orders (also called lexicographic orders), indirect function calls and permuted arguments (descent that is not in-situ) are all handled automatically and without special treatment, with no need for manually supplied argument orders, or theorem-proving methods not certain to terminate at analysis time.We establish the problem's intrinsic complexity. This turns out to be surprisingly high, complete for PSPACE, in spite of the simplicity of the principle. PSPACE hardness is proved by a reduction from Boolean program termination. An ineresting consequence: the same hardness result applies to many other analyses found in the termination and quasitermination literature.

471 citations


"Idris, a general-purpose dependentl..." refers methods in this paper

  • ...We use the size change principle (Lee et al., 2001) to determine whether (possibly mutually defined) recursive functions are guaranteed to terminate....

    [...]

Journal ArticleDOI
TL;DR: An abstract characterisation of an applicative style of effectful programming, weaker than Monads and hence more widespread, is introduced and a bracket notation is introduced that interprets the normal application syntax in the idiom of an Applicative functor.
Abstract: In this article, we introduce Applicative functors – an abstract characterisation of an applicative style of effectful programming, weaker than Monads and hence more widespread. Indeed, it is the ubiquity of this programming pattern that drew us to the abstraction. We retrace our steps in this article, introducing the applicative pattern by diverse examples, then abstracting it to define the Applicative type class and introducing a bracket notation that interprets the normal application syntax in the idiom of an Applicative functor. Furthermore, we develop the properties of applicative functors and the generic operations they support. We close by identifying the categorical structure of applicative functors and examining their relationship both with Monads and with Arrow.

415 citations


"Idris, a general-purpose dependentl..." refers methods in this paper

  • ...Full IDRIS is IDRIS− extended with do-notation, idiom brackets (McBride & Paterson, 2008), case expressions, pattern matching let, metavariables and tactic-based theorem proving....

    [...]

Proceedings ArticleDOI
16 Sep 2006
TL;DR: Wobbly types are presented, which express in a declarative way the uncertainty caused by the incremental nature of typical type-inference algorithms.
Abstract: Generalized algebraic data types (GADTs), sometimes known as "guarded recursive data types" or "first-class phantom types", are a simple but powerful generalization of the data types of Haskell and ML. Recent works have given compelling examples of the utility of GADTs, although type inference is known to be difficult. Our contribution is to show how to exploit programmer-supplied type annotations to make the type inference task almost embarrassingly easy. Our main technical innovation is wobbly types, which express in a declarative way the uncertainty caused by the incremental nature of typical type-inference algorithms.

347 citations


"Idris, a general-purpose dependentl..." refers methods in this paper

  • ...An inductive family is declared in a similar style to a Haskell GADT declaration (Peyton Jones et al., 2006) as follows: data T : t where D1 : t | . . . | Dn : t A constructor D of a family T must return a value in the family T....

    [...]