scispace - formally typeset
Search or ask a question
Journal ArticleDOI

Parametricity, type equality, and higher-order polymorphism

01 Mar 2010-Journal of Functional Programming (Cambridge University Press)-Vol. 20, Iss: 2, pp 175-210
TL;DR: This paper shows that two examples of type equality propositions actually do reflect type equality; they are only inhabited when their arguments are equal and their proofs are unique (up to equivalence.)
Abstract: Propositions that express type equality are a frequent ingredient of modern functional programming – they can encode generic functions, dynamic types, and GADTs. Via the Curry–Howard correspondence, these propositions are ordinary types inhabited by proof terms, computed using runtime type representations. In this paper we show that two examples of type equality propositions actually do reflect type equality; they are only inhabited when their arguments are equal and their proofs are unique (up to equivalence.) We show this result in the context of a strongly normalizing language with higher-order polymorphism and primitive recursion over runtime-type representations by proving Reynolds's abstraction theorem. We then use this theorem to derive “free” theorems about equality types.

Summary (3 min read)

1 Type equivalence, isomorphism and equality

  • Type equivalence propositions assert that two types are isomorphic.
  • Type equivalence and type equality propositions may be used for many of the same applications, but there are subtle differences between them.
  • One element of type EQUIV (Int, Bool) (Bool, Int) is two copies of a function that swaps the components of a pair.
  • The authors derive these free theorems from the parametricity theorem for a language called Rω (Crary etal., 2002), which extends Girard’s Whereas free theorems for second-order polymorphism quantify over arbitrary relations, they are often instantiated with (the graphs of) functions expressible in the polymorphic λ-calculus (Wadler, 1989).

1.1 Contributions.

  • The primary contribution of this paper is the correctness of the equality type, which implies correctness properties of a type-safe cast operation that can produce it.
  • In addition, the authors use their framework to prove correctness for another equality proposition, which defines type equality as the smallest reflexive relation.
  • This paper offers a fully explicit and accessible roadmap to the proof of parametricity for higher-order polymorphism, using the technique of syntactic logical relations,1 and insisting on rigorous definitions.
  • Rigorous definitions are not only challenging to get right but important in practice, since their examples demonstrate that the “power” of the meta-logical functions involved in instantiating the free theorems determines the expressiveness of these free theorems.
  • Because of their attention to formal details, their development is particularly wellsuited for mechanical verification in proof assistants based on Type Theory (the meta-logic of choice in this paper), such as Coq (http://coq.inria.fr).

2 Constructing equivalence and equality types

  • In this section the authors give an informal introduction to Rω. Although they use Haskell syntax throughout the section (and all of the code is valid Haskell) their examples are intended to demonstrate Rω programming.
  • The important property of datatype R a is that the type index a changes with the data constructor.
  • Weirich (2004) defined two different versions of type-safe cast, cast and gcast, shown in Figure 1.
  • The authors implementations differ slightly from Weirich’s—namely they use Haskell’s Maybe type to account for potential failure, instead of an error primitive—but the essential structure is the same.
  • Again, the case for products has been decorated with type annotations—the first recursive call changes the type of the first component of the product, the second recursive call changes the type of the second component.

3.1 The Rω calculus.

  • Rω includes type representations Rint, R, R×, R+, and R→which must be fully applied to their arguments.
  • Each of these judgments uses a unified environment, Γ, containing bindings for type variables (a:κ) and term variables (x:τ).
  • The rest of this typing relation is standard.
  • In addition, the authors implicitly identify α-equivalent types, and treat them as syntactically equal in the rest of the paper.

3.2 Definition [(Typed-)Generalized Relations]:

  • GRelκ The notation P(term × term) stands for the space of binary relations on terms of Rω.
  • The authors define this predicate mutually with extensional equality on generalized relations (≡κ) and on Typed-Generalized relations (≡).
  • Because their wfGRelκ conditions depend on equality for type GRelκ, the authors cannot include those conditions in the definition of GRelκ itself.
  • Stating it in the simpler form would require the logic to include propositional extensionality.
  • The operation J×K lifts ρ and π to a relation between products such that the first components of the products belong in ρ̂, and the second in π̂.

Proof

  • As their logical relation implies equivalence, the authors show their result by showing that (e, λx.x) ∈.
  • Hence, despite the fact that the authors are showing a theorem about an Fω type, they need morphisms at higher kinds to accept both types and morphisms as arguments and dispatch on their type argument—a novel use of type-dispatching interpretations compared to recent work on free theorems for higher-order polymorphic functions (Voigtländer, 2009).
  • If the abstraction theorem remained true when this condition was violated then the authors could derive a false statement.
  • The first property that the authors show is that if gcast returns a function then the two types that instantiated gcast must be equal.

3.3 Behavioral equivalence

  • Is contained in a suitable behavioral equivalence relation for closed terms.
  • Intuitively, two terms are behaviorally equivalent if all uses of them produce the same result.

4.2 Another definition of type equality

  • In this section the authors discuss the properties of another proposition that defines type equality as the smallest reflexive relation.
  • Equality is the intersection of all such relations.
  • The code shown in Figure 10 includes a definition of the REqual gadt (of which REQUAL is the encoding).
  • In the product branch, pattern matching on the result of pcast ra0 ra0’ unifies the types a0 and a0’.
  • Because of the integration between this equality predicate and the Haskell type checker, a proof of type REqual t1 t2 is often easier to use than one of type EQUAL t1 t2.

Proof sketch

  • Furthermore, the authors can also show that these two definitions of equality are logically equivalent.
  • (For clarity, the authors write these terms in a Church-style variant, where all type abstractions and applications are explicit.).
  • Furthermore, by Theorems 4.3 and 4.11, the authors know that i and j form an isomorphism between the two equality types.

5.1 Injectivity

  • Not all properties of type equalities seem to be expressible as Rω or Fω terms.
  • But without such capability, such an injection does not seem possible.
  • On the other hand, the authors do not know how to show that the type of inj is uninhabited—they cannot assume the existence of a term inj and derive that (inj, inj) ∈ ∅ by using the fundamental theorem as they can for other empty types.
  • Some authors propose that the EQUIV type, which can define injectivity, be used instead.
  • In particular, the following code typechecks in GHC.

5.2 Relational interpretation and contextual equivalence.

  • The authors conjecture that for closed values their behavioral equivalence coincides with contextual equivalence.
  • In fact the 5 However, see Washburn and Weirich (Washburn & Weirich, 2005) for a related language that does show parametricity in the presence of such a construct.
  • Same problem is open even for System F even without any datatypes or representations.
  • A potential solution to this problem would involve modifying the clauses of the definition that correspond to sums (such as the J+K and R operations) by >>-closing them as Pitts suggests (Pitts, 2000; Pitts, 2005).

5.3 Representations of polymorphic types and non-termination.

  • Rω does not include representations of all types for a good reason.
  • This example begins by using gcast to enable a self-application term with a concise type.
  • This example demonstrates that the authors cannot extend the relational interpretation to Rid and the proof of the abstraction theorem in a straightforward manner as their proof implies termination.
  • K·} However, this definition is not well-formed.

5.4 Implicit versus explicit generalization and instantiation

  • Hence, it is to be expected that the derived free theorems in this paper will only be “morally” true (Danielsson etal., 2006) in a setting with non-termination.
  • Therefore, although the language Rω only contains the specific example of the representation type, the parametricity results in this paper could be extended to languages that include arbitrary gadts.
  • The easiest gadts to incorporate in this way are those that, like representation types, have inductive structure.
  • Such types do not introduce non-termination, so the necessary extensions to the definitions in this paper are localized.
  • Crary and Harper (Crary & Harper, 2007a) and Ahmed (Ahmed, 2006a) describe necessary extensions to to support their inclusion.

Did you find this useful? Give us your feedback

Content maybe subject to copyright    Report

University of Pennsylvania University of Pennsylvania
ScholarlyCommons ScholarlyCommons
Departmental Papers (CIS) Department of Computer & Information Science
3-2010
Parametricity, Type Equality and Higher-order Polymorphism Parametricity, Type Equality and Higher-order Polymorphism
Dimitrios Vytiniotis
Microsoft Research
Stephanie Weirich
University of Pennsylvania
, sweirich@cis.upenn.edu
Follow this and additional works at: https://repository.upenn.edu/cis_papers
Part of the Computer Sciences Commons
Recommended Citation Recommended Citation
Dimitrios Vytiniotis and Stephanie Weirich, "Parametricity, Type Equality and Higher-order Polymorphism",
. March 2010.
Dimitrios Vytiniotis and Stephanie Weirich. Parametricity, Type Equality and Higher-order PolymorphismParametricity, Type Equality and Higher-order Polymorphism.
Journal of
Functional Programming
, 20(2):175-210, March 2010
Copyright © Cambridge University Press 2010 DOI: http://dx.doi.org/10.1017/S0956796810000079
This paper is posted at ScholarlyCommons. https://repository.upenn.edu/cis_papers/640
For more information, please contact repository@pobox.upenn.edu.

Parametricity, Type Equality and Higher-order Polymorphism Parametricity, Type Equality and Higher-order Polymorphism
Abstract Abstract
Propositions that express type equality are a frequent ingredient of modern functional programming|they
can encode generic functions, dynamic types, and GADTs. Via the Curry-Howard correspondence, these
propositions are ordinary types inhabited by proof terms, computed using runtime type representations. In
this paper we show that two examples of type equality propositions actually do re ect type equality; they
are only inhabited when their arguments are equal and their proofs are unique (up to equivalence.) We
show this result in the context of a strongly normalizing language with higher-order polymorphism and
primitive recursion over runtime type representations by proving Reynolds's abstraction theorem. We then
use this theorem to derive \free" theorems about equality types.
Disciplines Disciplines
Computer Sciences
Comments Comments
Dimitrios Vytiniotis and Stephanie Weirich. Parametricity, Type Equality and Higher-order PolymorphismParametricity, Type Equality and Higher-order Polymorphism.
Journal of Functional Programming
, 20(2):175-210, March 2010
Copyright © Cambridge University Press 2010 DOI: http://dx.doi.org/10.1017/S0956796810000079
This journal article is available at ScholarlyCommons: https://repository.upenn.edu/cis_papers/640

Under consideration for publication in J. Functional Programming
1
Parametricity, Type Equality and Higher-order
Polymorphism
DIMITRIOS VYTINIOTIS
Microsoft Research
STEPHANIE WEIRICH
University of Pennsylvania
Abstract
Propositions that express type equality are a frequent ingredient of modern functional
programming—they can encode generic functions, dynamic types, and GADTs. Via the
Curry-Howard correspondence, these propositions are ordinary types inhabited by proof
terms, computed using runtime type representations. In this paper we show that two exam-
ples of type equality propositions actually do reflect type equality; they are only inhabited
when their arguments are equal and their proofs are unique (up to equivalence.) We show
this result in the context of a strongly normalizing language with higher-order polymor-
phism and primitive recursion over runtime type representations by proving Reynolds’s
abstraction theorem. We then use this theorem to derive “free” theorems about equality
types.
1 Type equivalence, isomorphism and equality
Type equivalence propositions assert that two types are isomorphic. For example,
we may define such a proposition (in Haskell) as follows:
type EQUIV a b = (a -> b, b -> a)
Under the Curry-Howard correspondence, which identifies types and propositions,
EQUIV asserts logical equivalence between two propositions: a implies b and b im-
plies a. A proof of this equivalence, a pair of functions f and g, is a type isomor-
phism when the two functions compose to be the identity—in other words, when
f . g = id and g . f = id. In that case, if (f,g) is a proof of the proposition
EQUIV a Int, and x is an element of type a, then we can coerce x to be of type
Int with f.
In the past ten years, a number of authors have proposed the use of type equiva-
lence propositions in typed programming languages (mostly Haskell). Type equiva-
lence propositions have been used to implement heterogeneous data structures, type
representations and generic functions, dynamic types, logical frameworks, metapro-
gramming, GADTs, and forms of lightweight dependent types (Yang, 1998; Weirich,
2004; Cheney & Hinze, 2002; Baars & Swierstra, 2002; Kiselyov etal., 2004; Chen
etal., 2004; Sheard & Pasalic, 2004).

2 Dimitrios Vytiniotis and Stephanie Weirich
Many of these authors point out that it is also possible to define a proposition
that asserts that two types are not just equivalent, but that they are in fact equal.
Equality is a stronger relation than equivalence as it must be substitutive as well
as reflexive, symmetric and transitive [See (Kleene, 1967) page 157]. Type equality
propositions are also called equality types.
One definition of type equality is Leibniz equality—two types are equal iff one
may be replaced with the other in all contexts. In Haskell, we may define the Leibniz
equality proposition using higher-order polymorphism to quantify over all contexts.
type EQUAL a b = forall c. c a -> c b
Type equivalence and type equality propositions may be used for many of the
same applications, but there are subtle differences between them. Equivalence holds
for types that are not definitionally equal; for example, the types (Int, Bool) and
(Bool, Int) are not equal in the Haskell type system, but they are isomorphic. One
element of type EQUIV (Int, Bool) (Bool, Int) is two copies of a function that
swaps the components of a pair. However, not all inhabitants of isomorphic types
are type isomorphisms—for example, the term (const 0, const 1) inhabits the
type EQUIV Int Int. Finally, some equivalent types are not isomorphic at all. For
example, the proposition EQUIV Int Bool is provable, but not by any isomorphism
between the types.
In contrast, equality only holds for equal types and equal types are trivially
isomorphic. There are no (terminating) inhabitants of type EQUAL Int Bool or
of EQUAL (Int, Bool) (Bool, Int). We know this because of parametricity: for
the latter type an inhabitant would need to know how to swap the components
of the pair in an arbitrary context. Furthermore, the only inhabitants of type
EQUAL Int Int are identity functions. Again, the reason is parametricity—because
the context is abstract the function has no choice but to return its argument.
These observations about the difference between the properties of type equiva-
lence and of type equality are informal, and we would like to do better. In this paper,
we make the previous arguments about type equality rigorous by deriving free theo-
rems (Reynolds, 1983; Wadler, 1989) about equality types from Reynolds’s abstrac-
tion theorem. Reynolds’s abstraction theorem (also referred to as the “parametricity
theorem” (Wadler, 1989) or the “fundamental theorem” of logical relations) asserts
that every well-typed expression of the polymorphic λ-calculus (System F) (Girard,
1972) satisfies a property directly derivable from its type.
We derive these free theorems from the parametricity theorem for a language
called R
ω
(Crary etal., 2002), which extends Girard’s F
ω
with constructs that are
useful for programming with type equivalence propositions (see the next section).
Using these constructs in R
ω
we can define a type-safe cast operation which com-
pares types and produces an equality proof when they are the same. This extension
comes at little cost as the necessary modifications to the F
ω
parametricity theorem
are modest and localized. Like F
ω
, R
ω
is a (provably, using the results in this paper)
terminating language, which simplifies our development and allows us to focus on
the parametricity properties of higher-order polymorphism. Of course, our results
will not carry over to full languages like Haskell without extension.

Parametricity, Type Equality and Higher-order Polymorphism 3
After proving a version of the abstraction theorem for R
ω
, we show how to apply
it to the type EQUAL to show that it is inhabited only when the source and target
types are the same, in which case that inhabitant must be the identity.
Our use of free theorems for higher-order polymorphism exhibits an intriguing
behavior. Whereas free theorems for second-order polymorphism quantify over ar-
bitrary relations, they are often instantiated with (the graphs of) functions express-
ible in the polymorphic λ-calculus (Wadler, 1989). By contrast, in our examples we
instantiate free theorems with (the graphs of) non-parametric functions.
1.1 Contributions.
The primary contribution of this paper is the correctness of the equality type,
which implies correctness properties of a type-safe cast operation that can produce
it. In addition, we use our framework to prove correctness for another equality
proposition, which defines type equality as the smallest reflexive relation. We show
that this latter proposition also holds only for equal types, is inhabited by a single
member, and that the two equality types are isomorphic.
Along with these results, we consider our proof of parametricity for R
ω
to be a
significant contribution. This paper offers a fully explicit and accessible roadmap
to the proof of parametricity for higher-order polymorphism, using the technique
of syntactic logical relations,
1
and insisting on rigorous definitions. Rigorous def-
initions are not only challenging to get right but important in practice, since our
examples demonstrate that the “power” of the meta-logical functions involved in
instantiating the free theorems determines the expressiveness of these free theorems.
Because of our attention to formal details, our development is particularly well-
suited for mechanical verification in proof assistants based on Type Theory (the
meta-logic of choice in this paper), such as Coq (http://coq.inria.fr). To this
end, we offer a Coq formalization of the definitions in the Appendix.
2 Constructing equivalence and equality types
In this section we give an informal introduction to R
ω
. Although we use Haskell
syntax throughout the section (and all of the code is valid Haskell) our examples
are intended to demonstrate R
ω
programming.
Type equivalence and equality propositions can be constructed through dynamic
type analysis. By comparing two types at runtime, we can produce a proof that they
are isomorphic. Despite the fact that R
ω
is a parametric language, dynamic type
analysis is possible through representation types (Crary etal., 2002). The key idea
is simple: Because the behavior of parametrically polymorphic functions cannot be
influenced by the types at which they are instantiated, type analyzing functions
dispatch on term arguments that represent types.
Although native to R
ω
, representation types may be implemented in Haskell by a
1
The term “syntactic” refers to logically interpreting types as relations between syntactic terms,
as opposed to semantic denotations of terms.

Citations
More filters
Journal ArticleDOI
TL;DR: It is shown how a typing judgement in System F can be translated into a relational statement (in second-order predicate logic) about inhabitants of the type, and it is obtained that for pure type systems (PTSs) there is a PTS that can be used as a logic for parametricity.
Abstract: Reynolds' abstraction theorem (Reynolds, J. C. (1983) Types, abstraction and parametric polymorphism, Inf. Process.83(1), 513-523) shows how a typing judgement in System F can be translated into a relational statement (in second-order predicate logic) about inhabitants of the type. We obtain a similar result for pure type systems (PTSs): for any PTS used as a programming language, there is a PTS that can be used as a logic for parametricity. Types in the source PTS are translated to relations (expressed as types) in the target. Similarly, values of a given type are translated to proofs that the values satisfy the relational interpretation. We extend the result to inductive families. We also show that the assumption that every term satisfies the parametricity condition generated by its type is consistent with the generated logic.

77 citations


Cites background or result from "Parametricity, type equality, and h..."

  • ...• The result is already exposed by Vytiniotis & Weirich (2010), but it is remarkable that its proof is one line long given our framework....

    [...]

  • ...We also show that the assumption that every term satisfies the parametricity condition generated by its type is consistent with the generated logic....

    [...]

  • ...Recent works (Takeuti 2004, personal communication; Johann & Voigtländer 2006; Neis et al. 2009; Vytiniotis & Weirich 2010) have developed parametricity results for several such calculi, but not in a common framework....

    [...]

Proceedings ArticleDOI
29 Aug 2015
TL;DR: A translation from DCC into Fω is presented and it is proved that the translation preserves noninterference and a notion of observer-sensitive equivalence is defined that makes essential use of both first-order and higher-order polymorphism.
Abstract: The dependency core calculus (DCC) is a framework for studying a variety of dependency analyses (e.g., secure information flow). The key property provided by DCC is noninterference, which guarantees that a low-level observer (attacker) cannot distinguish high-level (protected) computations. The proof of noninterference for DCC suggests a connection to parametricity in System F, which suggests that it should be possible to implement dependency analyses in languages with parametric polymorphism. We present a translation from DCC into Fω and prove that the translation preserves noninterference. To express noninterference in Fω, we define a notion of observer-sensitive equivalence that makes essential use of both first-order and higher-order polymorphism. Our translation provides insights into DCC's type system and shows how DCC can be implemented in a polymorphic language without loss of the noninterference (security) guarantees available in DCC. Our contributions include proof techniques that should be valuable when proving other secure compilation or full abstraction results.

65 citations

Proceedings ArticleDOI
08 Jan 2014
TL;DR: This paper constructs parametric models of predicative and impredicative dependent type theory in terms of reflexive graphs, and is the first account of parametricity for dependent types that is able to lift the useful deduction of the existence of initial algebras in parametric model of System F to the dependently typed setting.
Abstract: Reynolds' theory of relational parametricity captures the invariance of polymorphically typed programs under change of data representation. Reynolds' original work exploited the typing discipline of the polymorphically typed lambda-calculus System F, but there is now considerable interest in extending relational parametricity to type systems that are richer and more expressive than that of System F.This paper constructs parametric models of predicative and impredicative dependent type theory. The significance of our models is twofold. Firstly, in the impredicative variant we are able to deduce the existence of initial algebras for all indexed=functors. To our knowledge, ours is the first account of parametricity for dependent types that is able to lift the useful deduction of the existence of initial algebras in parametric models of System F to the dependently typed setting. Secondly, our models offer conceptual clarity by uniformly expressing relational parametricity for dependent types in terms of reflexive graphs, which allows us to unify the interpretations of types and kinds, instead of taking the relational interpretation of types as a primitive notion. Expressing our model in terms of reflexive graphs ensures that it has canonical choices for the interpretations of the standard type constructors of dependent type theory, except for the interpretation of the universe of small types, where we formulate a refined interpretation tailored for relational parametricity. Moreover, our reflexive graph model opens the door to generalisations of relational parametricity, for example to higher-dimensional relational parametricity.

58 citations

Proceedings ArticleDOI
27 Sep 2010
TL;DR: Reynolds' abstraction theorem shows how a typing judgement in System F can be translated into a relational statement about inhabitants of the type, and a similar result is obtained for a single lambda calculus, in which terms, types and their relations are expressed.
Abstract: Reynolds' abstraction theorem shows how a typing judgement in System F can be translated into a relational statement (in second order predicate logic) about inhabitants of the type. We (in second order predicate logic) about inhabitants of the type. We obtain a similar result for a single lambda calculus (a pure type system), in which terms, types and their relations are expressed. Working within a single system dispenses with the need for an interpretation layer, allowing for an unusually simple presentation. While the unification puts some constraints on the type system (which we spell out), the result applies to many interesting cases, including dependently-typed ones.

52 citations


Cites background from "Parametricity, type equality, and h..."

  • ...Vytiniotis and Weirich [2009] use parametricity to show that certain casting functions are equivalent to the identity....

    [...]

  • ...Vytiniotis and Weirich [2009] show that this theorem can be deduced from the type of gcast alone, by parametricity....

    [...]

References
More filters
Proceedings Article
01 Jan 1983
TL;DR: The findings of a Web-based questionnaire aimed at discovering both patterns of use of videoconferencing systems within HP and the reasons people give for either not using, or for using such systems are discussed.
Abstract: In this report we discuss the findings of a Web-based questionnaire aimed at discovering both patterns of use of videoconferencing systems within HP and the reasons people give for either not using, or for using such systems. The primary motivation was to understand these issues for the purpose of designing new kinds of technology to support remote work rather than as an investigation into HP’s internal processes. The questionnaire, filled out via the Web by 4532 people across HP, showed that most participants (68%) had not taken part in a videoconference within the last 3 years, and only 3% of the sample were frequent users. Of those who had used videoconference systems, the main benefits were perceived to be the ability to: see people they had never met before, see facial expressions and gestures, and follow conversations with multiple participants more easily. The main problems that users of videoconference technology perceived were: the high overhead of setting up and planning videoconferencing meetings, a lack of a widespread base of users, the perception that videoconference technology did not add value over existing communication tools, and quality and reliability issues. Non-users indicated that the main barriers were lack of access to videoconference facilities and tools and a perception that they did not need to use this tool because other tools were satisfactory. The findings from this study in a real work setting are related to findings in the research literature, and implications for system design and research are identified.

904 citations


"Parametricity, type equality, and h..." refers methods in this paper

  • ...In this paper, we make the previous arguments about type equality rigorous by deriving free theorems (Reynolds 1983; Wadler 1989) about equality types from Reynolds’s abstraction theorem....

    [...]

Proceedings ArticleDOI
01 Nov 1989
TL;DR: From the type of a polymorphic function the authors can derive a theorem that it satisfies, courtesy of Reynolds’ abstraction theorem for the polymorphic lambda calculus, which provides a free source of useful theorems.
Abstract: From the type of a polymorphic function we can derive a theorem that it satisfies. Every function of the same type satisfies the same theorem. This provides a free source of useful theorems, courtesy of Reynolds’ abstraction theorem for the polymorphic lambda calculus.

773 citations


"Parametricity, type equality, and h..." refers background or methods in this paper

  • ...Reynolds’s abstraction theorem (also referred to as the “parametricity theorem” (Wadler 1989) or the “fundamental theorem” of logical relations) asserts that every well-typed expression of the polymorphic λ-calculus (System F) (Girard 1972) satisfies a property directly derivable from its type....

    [...]

  • ...In this paper, we make the previous arguments about type equality rigorous by deriving free theorems (Reynolds 1983; Wadler 1989) about equality types from Reynolds’s abstraction theorem....

    [...]

  • ...Whereas free theorems for second-order polymorphism quantify over arbitrary relations, they are often instantiated with (the graphs of) functions expressible in the polymorphic λ-calculus (Wadler 1989)....

    [...]

Book ChapterDOI
16 Mar 1993
TL;DR: This paper describes the rules for inductive definitions in the system Coq and proves strong normalization for a subsystem of Coq corresponding to the pure Calculus of Constructions plus Inductive Definitions with only weak eliminations.
Abstract: In the pure Calculus of Constructions, it is possible to represent data structures and predicates using higher-order quantification. However, this representation is not satisfactory, from the point of view of both the efficiency of the underlying programs and the power of the logical system. For these reasons, the calculus was extended with a primitive notion of inductive definitions [8]. This paper describes the rules for inductive definitions in the system Coq. They are general enough to be seen as one formulation of adding inductive definitions to a typed lambda-calculus. We prove strong normalization for a subsystem of Coq corresponding to the pure Calculus of Constructions plus Inductive Definitions with only weak eliminations.

464 citations


"Parametricity, type equality, and h..." refers background in this paper

  • ...However, in an expressive enough meta-logic, such as CIC (Paulin-Mohring 1993) or ZF set theory, such a definition is indeed well formed, as there exists a type containing both spaces (e.g. Type in CIC (see Appendix 7), or pure ZF sets in ZF set theory)....

    [...]

  • ...However, in an expressive enough meta-logic, such as CIC (Paulin-Mohring 1993) or ZF set theory, such a definition is indeed well formed, as there exists a type containing both spaces (e....

    [...]

  • ...Our work was developed in CIC instead of untyped set theory, but there are similarities....

    [...]

Book
01 Jan 1967
TL;DR: This is a set of lecture notes for introductory courses in mathematical logic offered at the Pennsylvania State University.

349 citations


"Parametricity, type equality, and h..." refers background in this paper

  • ...Equality is a stronger relation than equivalence as it must be substitutive as well as reflexive, symmetric, and transitive (see Kleene 1967, p. 157)....

    [...]

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


"Parametricity, type equality, and h..." refers methods in this paper

  • ...…types may be implemented in Haskell by a Generalized Algebraic Datatype (gadt) called R a, which represents its type index a (Sheard & Pasalic 2004; Jones et al. 2006). data R a where Rint :: R Int Runit :: R () Rprod :: R a -> R b -> R (a,b) Rsum :: R a -> R b -> R (Either a b) Rarr :: R a -> R…...

    [...]

  • ...Although native to Rω , representation types may be implemented in Haskell by a Generalized Algebraic Datatype (gadt) called R a, which represents its type index a (Sheard & Pasalic 2004; Jones et al. 2006)....

    [...]

Frequently Asked Questions (2)
Q1. What have the authors contributed in "Parametricity, type equality and higher-order polymorphism" ?

In this paper the authors show that two examples of type equality propositions actually do re ect type equality ; they are only inhabited when their arguments are equal and their proofs are unique ( up to equivalence. ) The authors show this result in the context of a strongly normalizing language with higher-order polymorphism and primitive recursion over runtime type representations by proving Reynolds 's abstraction theorem. This journal article is available at ScholarlyCommons: https: //repository. 

If the authors wished to use these results to reason about Haskell implementations of gcast, they must extend their model to include more—in particular, general recursion and recursive types ( Melliès & Vouillon, 2005 ; Johann & Voigtländer, 2004 ; Appel & McAllester, 2001 ; Ahmed, 2006b ; Crary & Harper, 2007a ). The authors believe that the techniques developed here are independent of those for advanced language features. Thanks to Aaron Bohannon, Jeff Vaughan, Steve Zdancewic, and anonymous reviewers for their feedback and suggestions.