A Dependent Type Theory with Names and Binding.
ABSTRACT We consider the problem of providing formal support for working with abstract syntax involving variable binders. Gabbay and Pitts have shown in their work on Fraenkel-Mostowski (FM) set theory how to address this through first-class names: in this paper we present a dependent type theory for programming and reasoning with such names. Our development is based on a categorical axiomatisation of names, with freshness as its central notion. An associated adjunction captures constructions known from FM theory: the freshness quantifier, name-binding, and unique choice of fresh names. The Schanuel topos – the category underlying FM set theory – is an instance of this axiomatisation. Working from the categorical structure, we define a dependent type theory which it models. This uses bunches to integrate the monoidal structure corresponding to freshness, from which we define novel multiplicative dependent products Π * and sums Σ * , as well as a propositions-as-types generalisation of the freshness quantifier.
- SourceAvailable from: James Cheney
Article: A Simple Nominal Type Theory.[Show abstract] [Hide abstract]
ABSTRACT: Abstract Nominal logic is an extension of first-order logic with features useful for reasoning about abstract syntax with bound names. For computational applications such as programming and formal reasoning, it is desirable to develop constructive type theories for nominal logic which extend standard type theories for propositional, firstor higher-order logic. This has proven dicult, largely because of complex interactions between nominal logic’s name-abstraction operation and ordinary functional abstraction. This diculty,already arises in the case of propositional logic and simple type theory. In this paper we show how this diculty can be overcome, and present a simple nominal type theory which enjoys properties such as type soundness and strong normalization, and which can be soundly interpreted using existing nominal set models of nominal,logic. We also sketch how,recursion combinators for languages with binding structure can be provided. This is an important first step towards understanding the constructive content of nominal logic and incorporating it into existing constructive logics and type theories. Keywords: nominal terms, type systemsElectr. Notes Theor. Comput. Sci. 01/2009; 228:37-52.
- [Show abstract] [Hide abstract]
ABSTRACT: Graph transformation has been used to model concurrent systems in software engineering, as well as in biochemistry and life sciences. The application of a transformation rule can be characterised algebraically as construction of a double-pushout (DPO) diagram in the category of graphs. We show how intuitionistic linear logic can be extended with resource-bound quantification, allowing for an implicit handling of the DPO conditions, and how resource logic can be used to reason about graph transformation systems.Electronic Proceedings in Theoretical Computer Science. 01/2010;
Conference Paper: Nominal Domain Theory for Concurrency.[Show abstract] [Hide abstract]
ABSTRACT: This paper investigates a methodology of using FM (Fraenkel- Mostowski) sets, and the ideas of nominal set theory, to adjoin name generation to a semantic theory. By developing a domain theory for con- currency within FM sets the domain theory inherits types and operations for name generation, essentially without disturbing its original higher- order features. The original domain theory had a metalanguage HOPLA (Higher Order Process Language) and accordingly this expands to a met- alanguage, Nominal HOPLA, with name generation (closely related to an earlier language new-HOPLA). Nominal HOPLA possesses an oper- ational and denotational semantics which are related via soundness and adequacy results, again carried out within FM sets.Computer Science Logic, 23rd international Workshop, CSL 2009, 18th Annual Conference of the EACSL, Coimbra, Portugal, September 7-11, 2009. Proceedings; 01/2009
Appears in Computer Science Logic: Proceedings of the 18th International
Workshop CSL 2004, Karpacz, Poland, September 20–24, 2004, Lecture
Notes in Computer Science 3210, pages 235–249. Springer-Verlag, 2004.
A Dependent Type Theory with Names and Binding
Ulrich Sch¨ opp and Ian Stark
LFCS, School of Informatics, University of Edinburgh
JCMB, King’s Buildings, Edinburgh EH9 3JZ
Abstract. We consider the problem of providing formal support for working
with abstract syntax involving variable binders. Gabbay and Pitts have shown in
their work on Fraenkel-Mostowski (FM) set theory how to address this through
first-class names: in this paper we present a dependent type theory for program-
ming and reasoning with such names. Our development is based on a categori-
cal axiomatisation of names, with freshness as its central notion. An associated
adjunction captures constructions known from FM theory: the freshness quanti-
N , name-binding, and unique choice of fresh names. The Schanuel topos —
the category underlying FM set theory — is an instance of this axiomatisation.
Working from the categorical structure, we define a dependent type theory which
it models. This uses bunches to integrate the monoidal structure corresponding
to freshness, from which we define novel multiplicative dependent products Π∗
and sums Σ∗, as well as a propositions-as-types generalisation H of the freshness
assisted reasoning about programming languages and logics. The problem is that a sig-
nificant part of the formalisation effort may go into dealing with issues that are normally
suppressed in informal practice: namely that one is working with α-equivalence classes
of terms rather than raw terms.
Gabbay and Pitts have shown that FM set theory supports a notion of names that can
make precise the informal practise of using concrete names for α-equivalence classes.
and a freshness quantifier simplifies reasoning with names.
The approach of Gabbay and Pitts has been studied in a number of other set-
tings, among which are the first-order Nominal Logic , the higher-order logic FM-
HOL  as well as the programming language FreshML . Related  to FM the-
ory, the Theory of Contexts  provides an axiomatisation of reasoning with names
in dependent type theory. The ideas underlying FM have also proved useful in other
areas such as Spatial Logic  or programming with semi-structured data with hid-
den labels . These approaches typically focus either on programming with names, or
reasoning about them. The Theory of Contexts, for example, supports reasoning with
names, but does not admit functions that compare names or which (locally) choose fresh
In this paper we take the first steps towards a dependent type theory incorporating
FM concepts for both programming and reasoning with names. We introduce a depen-
dent type theory, using as guidance the categorical structure of Schanuel topos, which is
the category corresponding to FM set theory. In contrast to FM set theory, where swap-
ping is the primitive notion for working with names, we take freshness as the central
primitive of our type theory. This allows us to describe the constructions with names
and binding in terms of universal constructions, and also avoids problems with exten-
sional equality, which seems to be necessary for defining α-equivalence classes using
As the first contribution of the paper we introduce a bunched dependent type the-
ory. Since freshness corresponds to a monoidal structure, bunches provide a natural
way of integrating it into the type theory. Our bunched type theory may be seen as
a generalisation of the αλ-calculus of O’Hearn and Pym [17,20]. The αλ-calculus is
a simple type theory corresponding to a category which is both cartesian closed and
monoidal closed. Our type theory extends this situation, but only in the additive di-
rection: we consider a category which is locally cartesian closed as well as monoidal
Πx:A.B and Π∗x:C.D. The first comes from the locally cartesian closed structure and
consists of normal dependent functions. The second, which is subject to the restriction
that C is closed, comes from the monoidal closed structure and may be thought of as
consisting of functions which are only defined on arguments x : C that contain just
fresh names. In particular, with a type of names N, we can use Π∗n:N.D to model
α-equivalence classes, which corresponds to the well-known approach of modelling
α-equivalence classes as ‘fresh functions’ [7,4,9,5]. Another way of representing α-
equivalence classes, as given in , is to consider them as pairs n.x of a term x with a
distinguished name n in such a way that the identity of n is hidden in the pair. This rep-
resentation is also available in our type theory as fresh sum types Σ∗, dual to Π∗. The
inhabitants of Σ∗x:C.D may be thought of as pairs M.N where M :C and N :D(M)
and in which all the names in M have been hidden. To formulate Σ∗-types, we intro-
duce a type B∗(M:A), thought of as those elements of B which are free from all the
names in the term M :A. These freefrom types are used to enforce that no use of a pair
M.N in Σ∗x:C.D can reveal the hidden names.
As a second contribution of the paper, we give a new categorical axiomatisation of
names and binding. The main feature of this axiomatisation is a propositions as types
generalisation of the freshness quantifier of Gabbay and Pitts. To recall the freshness
quantifier, consider quantifiers ∃∗x:A.ϕ and ∀∗x:A.ϕ expressing ‘ϕ holds for some x
containing only fresh names’ and ‘ϕ holds for any x containing only fresh names’ re-
spectively. The freshness quantifier
arises because, for the type of names N, the
propositions ∃∗n:N.ϕ and ∀∗n:N.ϕ are equivalent; and
of them. We have a propositions-as-types correspondence between ∃∗and Σ∗as well as
between ∀∗and Π∗, so one may generalise the equivalence of ∃∗n:N.ϕ and ∀∗n:N.ϕ
to an isomorphism between Σ∗n:N.D and Π∗n:N.D.
This motivates our categorical axiomatisation of names. The central concept is
freshness, giving rise to a certain ‘fresh weakening’ functor W. The types Σ∗and Π∗
are left and right adjoints to W. Names are given by an object N having decidable
N n.ϕ is used to denote either
equality. Moreover, we require an isomorphism Σ∗
quantifier. We show that this structure includes not only the freshness quantifier, but
also binding (n.x) as in [7,16] as well as unique choice of fresh names (new n.M) as
in FreshML .
The semantics leads us to a type theory with names and binding. Based on the iso-
freshness quantifier. We may think of the elements of Hn.D as elements of Σ∗n:N.D,
i.e. pairs with hidden names, but also as elements of Π∗n:N.D, i.e. functions taking
only fresh names. In analogy to the freshness quantifier, which has the rules from both
∃∗and ∀∗, the rules for H are those from both Σ∗and Π∗. This dual view of hidden-
name types turns out to be useful for working with abstract syntax: it allows us to use
both HOAS-style constructions and FM-style constructions at the same time.
Ngeneralising the freshness
N, we introduce hidden-name types Hn.D as a generalisation of the
2A Bunched Dependent Type Theory
In this section we introduce a first-order bunched dependent type theory and identify
the categorical structure corresponding to it. The type theory has the following forms
of sequents: (? Γ Bunch) — Γ is a bunch, or context; (Γ ? A Type) — A is a
type in context Γ; (Γ ? M : A) — M is a term of type A in context Γ; as well as
corresponding sequents for definitional equalities.
2.1Bunches and Structural Rules
Bunches are built from the empty bunch ♦ using two kinds of extension. First, the fa-
miliar additive context extension from dependent type theory, which takes a bunch Γ to
the bunch Γ, x:A. Second, a multiplicative extension taking two bunches Γ and ∆ to
a new bunch Γ ∗ ∆. This extension is non-dependent in that no dependency is allowed
across the ∗. The bunch Γ ∗∆ should be thought of as the context Γ,∆ with the restric-
tion that the names occurring in Γ are disjoint from those in ∆. For example, if Lam is
a type which encodes object-level λ-terms, then the bunch (x:Lam,y:Lam)∗(z:Lam)
declares three terms x, y and z with the property that the names (representing the free
variables of the encoded terms) in x and y are disjoint from those in z.
? ♦ Bunch
In the side condition of these rules, we write v(Γ) for the set of variables declared in Γ.
We will frequently omit such side-conditions on the variable names, assuming tacitly
that we encounter only bunches in which no variable is declared more than once.
We use the notation Γ(∆) to indicate that Γ has a sub-bunch ∆, where sub-bunches
are defined as follows: ∆ is a sub-bunch of itself, and if ∆ is a sub-bunch of Γ then it
is also a subbunch of (Γ, x:A), and Γ ∗ Φ, and Φ ∗ Γ. We write Γ(Φ) for the bunch
which results from Γ(∆) by replacing the (unique) occurrence of ∆ in Γ with Φ.
Using this notation, we can formulate the structural rules:
Γ ? A Type
? Γ, x:A Bunch
x ?∈ v(Γ)
? Γ Bunch
? Γ ∗ ∆ Bunch
? ∆ Bunchv(Γ) ∩ v(∆)=∅
Γ ? A Type
Γ, x:A ? x : A
x ?∈ v(Γ)
(Weak)Γ(∆) ? J
∆ ? A Typex ?∈ v(Γ,∆)
Γ(∆, x:A) ? J
Γ(∆) ? J
= = = = = = = = = = =
Γ(∆ ∗ ♦) ? J
In these rules, we use J for an arbitrary judgement and double lines for bi-directional
rules. We highlight the rule (Unit) which requires the empty bunch ♦ to be a unit for ∗,
thus making ∗ affine. In particular, the multiplicative weakening rule
(∗-Weak)Γ(∆) ? J
Γ(∆ ∗ Φ) ? J
becomes admissible by using (Unit) together with (Weak).
Semantically, the bunches and structural rules can be modelled by a comprehension
category  that in addition has an affine (i.e. the unit is isomorphic to the termi-
nal object) symmetric monoidal structure ∗ in its base. We model the additive context-
extension Γ, x:A by the comprehension, and the multiplicative context-extension Γ∗∆
by the monoidal product. To simplify the development, we make an additional assump-
tion on the monoidal structure, given by the following definition .
(Subst)∆ ? M : AΓ(∆, x:A) ? J
Γ(∆)[M/x] ? J [M/x]
(Assoc)Γ((∆ ∗ Φ) ∗ Ψ) ? J
= = = = = = = = = = = = = = =
Γ(∆ ∗ (Φ ∗ Ψ)) ? J
(Unit)(Swap)Γ(∆ ∗ Φ) ? J
= = = = = = = = = = =
Γ(Φ ∗ ∆) ? J
? Γ(∆ ∗ Φ) Bunch
Definition 1. An affine linear category is a category B with finite products and an affine
symmetric monoidal structure ∗ such that, for any two objects A and B of B, the canon-
ical map ?π1,π2? : A ∗ B → A × B is a monomorphism.
In most of the paper, we take a special comprehension category: the codomain fibra-
tion cod : B→→ B for an affine linear category B having all pullbacks. Although tech-
nically the interpretation uses a corresponding split fibration to deal with well-known
coherence issues , in the following we elide such details. We assume the reader to be
familiar with the semantics of (first-order) dependent type theory, see e.g. [12,22,21].
In this section, we consider the types and terms, motivating them semantically. Starting
from a codomain fibration cod : B→→ B with an affine linear base B, we step-by-step
add more structure and introduce syntax based on it.
Type and term constants. Basic types and terms are given by constants. These can be
formulated as usual. For example, a type constant T in context Γ may be introduced
as (Γ ? T(x) Type), where x is the list of variables defined in Γ. That it is enough
to annotate the constants just with the list of variables in Γ, ignoring any bunching
structure, is a consequence of the assumption that the canonical map A ∗ B ? A × B
is a monomorphism.
Additive types (Σ, Π). Types found in Martin-L¨ of type theory can also be formulated
as usual. In this paper, we use dependent sums and products, but others such as identity
types can be added without problem. To model Π-types in the codomain fibration, we
assume B to be locally cartesian closed [21,12].
Monoidal product (*). We add types A∗B which internalise the context multiplica-
tion Γ ∗ ∆. The type A∗B may be thought of as containing all pairs ?M,N? in A×B
for which the sets of names underlying M and N are disjoint.
(∗-Ty)? A Type
? B Type
? A∗B Type
(∗-I)? A∗B TypeΓ ? M : A∆ ? N : B
Γ ∗ ∆ ? M∗N : A∗B
Γ(x:A ∗ y:B)[x∗y/z] ? N : C [x∗y/z]
(∗-E)Γ(z:A∗B) ? C Type
Note that the type A∗B requires both A and B to be closed. This is because of substitu-
tion, as (A∗B)[σ] and (A[σ]∗B[σ]) would not always have isomorphic interpretations.
Since the rule (∗-Weak) is admissible, we can derive an inclusion ıA,B of type
A∗B → A×B, given by the term ıA,B =df λp : A∗B.(let p be x∗y in ?x,y?). Us-
ing this, we can state the equations for the monoidal product:
∆ ? M : A∗B
Γ(∆)[M/z] ? (let M be x∗y in N) : C [M/z]
Γ ? let M∗N be x∗y in R : C
Γ ? (let M∗N be x∗y in R) = R[M/x][N/y] : C
∆ ? M : A∗B
Γ(∆)[M/z] ? N [M/z] = let M be x∗y in (N [x∗y/z]) : C[M/z]
Γ(z:A∗B) ? N : C
(Inject)Γ ? M : A∗BΓ ? N : A∗B
Γ ? M = N : A∗B
Γ ? ıA,B(M) = ıA,B(N) : A×B
Fresh dependent products (Π∗). We now make the further assumption on B that, for
eachobjectAinB,thefunctor−∗ApreservespullbacksandhasarightadjointA −∗ −.
This gives rise the following situation. Let gl(− ∗ A) be the fibration defined by
change-of-base as in the left square below. Let WA: B→→ B/(− ∗ A) be the functor
which maps an object f : B → G to f ∗A : B∗A → G∗A. The assumption that −∗A
preserves pullbacks amounts to saying thatWAis a fibred functor from cod to gl(−∗A).
Moreover, it follows that WAhas a fibred right adjoint Π∗
e.g. . Explicitly, Π∗
the pullback on the right.
A: B/(− ∗ A) → B→, see
Amaps an object g : C → G∗A to the the morphism Π∗
Ag as in
B/(− ∗ A)
A −∗ C
??A −∗ (G ∗ A)
Proposition 1. For any object A of B, the functor WAas defined above has a fibred
AifandonlyifA∗−preservespullbacksandhasarightadjointA −∗ −.
In this way, we can recast the monoidal closed structure in terms of a fibred adjunction,
and introduce syntax for the fibred adjunction as follows.
Γ ∗ x:A ? B Type
Γ ? Π∗x:A.B Type