Discussion:
[TYPES] Types theories with first-class definitional extensions
Jacques Carette
2016-11-02 02:43:44 UTC
Permalink
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]

I am looking for literature on (higher-order, potentially dependent)
type theories where a context (telescope) can contain not just
declarations, but also definitions.

Of course, from a semantic point of view, this is entirely unnecessary,
as such definitions can simply be expanded away. However, from a
categorical standpoint (amongst others), things are not so trivial: what
is the proper meaning of morphisms (substitutions) in such a case?

The motivation comes from the remark that the category of contexts for a
type theory is the opposite category of that of theory presentations
(aka algebraic theories, algebraic specifications, etc). By applying
the 'little theories' approach, it is really the theory morphisms that
carry the most interesting information. And that, in practice, one uses
"conservative extensions" of theories all the time.

Some concrete examples:
- in Agda, in a parametric record definition, one can also define
generic functions which 'depend' on the fields of the record;
- in Haskell, in a typeclass definition, one can define default
implementations;
- in Scala, in a trait, one can similarly define default implementations.
These 3 things are essentially the same idea, of a conservative
extension of a theory.

The problem arises when one wants to build theory morphisms (which would
be typeclass-to-typeclass functions in Haskell, or trait-to-trait
functions in Scala, neither of which are available AFAIK): what to do
with the definitions? Again, from a semantic point-of-view, there is no
intrinsic difficulty, and multiple different designs are equivalent.
The question only really becomes interesting when considering the
pragmatics. Some designs lead to huge combinatorial explosions of
definitions once your theory library gets into the 100s of theories,
never mind the 1000s, which is what a realistic library of
mathematics+CS needs.

This is not entirely straightforward. For example, the old theorem
prover IMPS actually has 4 different ways to handle the transport of
definitional extension along theory morphisms.

I have tried to look into the literature for related work, but I have
not been successful. Thus this query.

Jacques
Robert Harper
2016-11-02 13:51:30 UTC
Permalink
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]

See my papers with Chris Stone, and his dissertation, on singleton kinds/types, and also David Aspinall’s work on singletons.

Bob Harper
Post by Jacques Carette
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]
I am looking for literature on (higher-order, potentially dependent) type theories where a context (telescope) can contain not just declarations, but also definitions.
Of course, from a semantic point of view, this is entirely unnecessary, as such definitions can simply be expanded away. However, from a categorical standpoint (amongst others), things are not so trivial: what is the proper meaning of morphisms (substitutions) in such a case?
The motivation comes from the remark that the category of contexts for a type theory is the opposite category of that of theory presentations (aka algebraic theories, algebraic specifications, etc). By applying the 'little theories' approach, it is really the theory morphisms that carry the most interesting information. And that, in practice, one uses "conservative extensions" of theories all the time.
- in Agda, in a parametric record definition, one can also define generic functions which 'depend' on the fields of the record;
- in Haskell, in a typeclass definition, one can define default implementations;
- in Scala, in a trait, one can similarly define default implementations.
These 3 things are essentially the same idea, of a conservative extension of a theory.
The problem arises when one wants to build theory morphisms (which would be typeclass-to-typeclass functions in Haskell, or trait-to-trait functions in Scala, neither of which are available AFAIK): what to do with the definitions? Again, from a semantic point-of-view, there is no intrinsic difficulty, and multiple different designs are equivalent. The question only really becomes interesting when considering the pragmatics. Some designs lead to huge combinatorial explosions of definitions once your theory library gets into the 100s of theories, never mind the 1000s, which is what a realistic library of mathematics+CS needs.
This is not entirely straightforward. For example, the old theorem prover IMPS actually has 4 different ways to handle the transport of definitional extension along theory morphisms.
I have tried to look into the literature for related work, but I have not been su
Michael Greenberg
2016-11-02 15:58:42 UTC
Permalink
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]

Hi Jacques,

Most refinement type systems can do something _like_ adding equalities using “selfified” types (Ou et al., TCS 2004) like {x:Int | x = 5}, i.e., x is an Int such that x is 5. The Sage language (Knowles et al., Scheme Workshop 2006) adds equalities to the context in a more direct way. Knowles and Flanagan have a technical report that uses existentials to tame the holes in the dyke of abstraction introduced by dependent types <https://sage.soe.ucsc.edu/UCSC-SOE-08-17.pdf>.

Cheers,
Michael
Post by Jacques Carette
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]
I am looking for literature on (higher-order, potentially dependent) type theories where a context (telescope) can contain not just declarations, but also definitions.
Of course, from a semantic point of view, this is entirely unnecessary, as such definitions can simply be expanded away. However, from a categorical standpoint (amongst others), things are not so trivial: what is the proper meaning of morphisms (substitutions) in such a case?
The motivation comes from the remark that the category of contexts for a type theory is the opposite category of that of theory presentations (aka algebraic theories, algebraic specifications, etc). By applying the 'little theories' approach, it is really the theory morphisms that carry the most interesting information. And that, in practice, one uses "conservative extensions" of theories all the time.
- in Agda, in a parametric record definition, one can also define generic functions which 'depend' on the fields of the record;
- in Haskell, in a typeclass definition, one can define default implementations;
- in Scala, in a trait, one can similarly define default implementations.
These 3 things are essentially the same idea, of a conservative extension of a theory.
The problem arises when one wants to build theory morphisms (which would be typeclass-to-typeclass functions in Haskell, or trait-to-trait functions in Scala, neither of which are available AFAIK): what to do with the definitions? Again, from a semantic point-of-view, there is no intrinsic difficulty, and multiple different designs are equivalent. The question only really becomes interesting when considering the pragmatics. Some designs lead to huge combinatorial explosions of definitions once your theory library gets into the 100s of theories, never mind the 1000s, which is what a realistic library of mathematics+CS needs.
This is not entirely straightforward. For example, the old theorem prover IMPS actually has 4 different ways to handle the transport of definitional extension along theory morphisms.
I have tried to look into the literature for related work, but I have not been suc
William J. Bowman
2016-11-02 16:26:30 UTC
Permalink
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]
Post by Jacques Carette
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]
I am looking for literature on (higher-order, potentially dependent) type
theories where a context (telescope) can contain not just declarations, but
also definitions.
I may misunderstand your question, but doesn't CIC have this (and other languages with dependent let)?

The typing rule for dependent let adds a definition to the context:

Δ;Γ ⊢ e : t
Δ;Γ,x = e :t ⊢ e' : t
----------------------
Δ;Γ ⊢ let x = e in e' : t[e/x]

https://coq.inria.fr/refman/Reference-Manual006.html

This also reminds me of translucency.
A translucent type add a definition to the type declaration:

(x = e : t) -> t'
∃ (x = e : t). t

The original work on translucent sums:
https://www.cs.cmu.edu/~rwh/theses/lillibridge.pdf

I've also seen translucent functions here, which has a good explanation of translucency and more
citations to chase:
http://dl.acm.org/citation.cfm?id=237791
--
William J. Bowman
Northeastern University
College of Computer and Information
Frédéric Blanqui
2016-11-03 07:17:35 UTC
Permalink
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]

Hello.

For pure type systems with definitions, see the LFCS'94 paper of Poll &
Severi: http://dx.doi.org/10.1007/3-540-58140-5_30.

For a module calculus for PTSs, see the TLCA'97 paper of Courant,
http://dx.doi.org/10.1007/3-540-62688-3_32, and its journal version in
JFP'07: http://dx.doi.org/10.1017/S0956796806005867.

Best regards,

Frédéric.
Post by Jacques Carette
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]
Post by Jacques Carette
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]
I am looking for literature on (higher-order, potentially dependent) type
theories where a context (telescope) can contain not just declarations, but
also definitions.
I may misunderstand your question, but doesn't CIC have this (and other languages with dependent let)?
Δ;Γ ⊢ e : t
Δ;Γ,x = e :t ⊢ e' : t
----------------------
Δ;Γ ⊢ let x = e in e' : t[e/x]
https://coq.inria.fr/refman/Reference-Manual006.html
This also reminds me of translucency.
(x = e : t) -> t'
∃ (x = e : t). t
https://www.cs.cmu.edu/~rwh/theses/lillibridge.pdf
I've also seen translucent functions here, which has a good explanation of translucency and more
citations
Herman Geuvers
2016-11-03 19:08:27 UTC
Permalink
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]

We define and treat a system lambda-D in our book (Calculus of
Constructions with definitions):

Rob Nederpelt and Herman Geuvers
Type Theory and Formal Proof, An Introduction, Cambridge University
Press, December 2014.

See also
http://www.win.tue.nl/~wsinrpn/book_type_theory.htm


Another source is

Fairouz Kamareddine, Twan Laan and Rob Nederpelt: A Modern Perspective
on Type Theory, From its Origins until Today, Kluwer Academic
Publishers, Applied Logic Series, Vol. 29, 2004 – Chapter 10: Pure Type
Systems with parameters and definitions.

Best

Herman Geuvers
Post by Jacques Carette
[ The Types Forum,
http://lists.seas.upenn.edu/mailman/listinfo/types-list ]
Hello.
For pure type systems with definitions, see the LFCS'94 paper of Poll &
Severi: http://dx.doi.org/10.1007/3-540-58140-5_30.
For a module calculus for PTSs, see the TLCA'97 paper of Courant,
http://dx.doi.org/10.1007/3-540-62688-3_32, and its journal version in
JFP'07: http://dx.doi.org/10.1017/S0956796806005867.
Best regards,
Frédéric.
Post by Jacques Carette
[ The Types Forum,
http://lists.seas.upenn.edu/mailman/listinfo/types-list ]
Post by Jacques Carette
[ The Types Forum,
http://lists.seas.upenn.edu/mailman/listinfo/types-list ]
I am looking for literature on (higher-order, potentially dependent) type
theories where a context (telescope) can contain not just
declarations, but
also definitions.
I may misunderstand your question, but doesn't CIC have this (and
other languages with dependent let)?
Δ;Γ ⊢ e : t
Δ;Γ,x = e :t ⊢ e' : t
----------------------
Δ;Γ ⊢ let x = e in e' : t[e/x]
https://coq.inria.fr/refman/Reference-Manual006.html
This also reminds me of translucency.
(x = e : t) -> t'
∃ (x = e : t). t
https://www.cs.cmu.edu/~rwh/theses/lillibridge.pdf
I've also seen translucent functions here, which has a good
explanation of translucency and more
h
Jacques Carette
2016-11-02 20:21:04 UTC
Permalink
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]

Thanks for the many answers. Some of my comments below could have been
attached to other answers as well - I am not targetting CIC or
transculent sums in particular!
Post by William J. Bowman
Post by Jacques Carette
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]
I am looking for literature on (higher-order, potentially dependent) type
theories where a context (telescope) can contain not just declarations, but
also definitions.
I may misunderstand your question, but doesn't CIC have this (and other languages with dependent let)?
Δ;Γ ⊢ e : t
Δ;Γ,x = e :t ⊢ e' : t
----------------------
Δ;Γ ⊢ let x = e in e' : t[e/x]
https://coq.inria.fr/refman/Reference-Manual006.html
This also reminds me of translucency.
(x = e : t) -> t'
∃ (x = e : t). t
https://www.cs.cmu.edu/~rwh/theses/lillibridge.pdf
I've also seen translucent functions here, which has a good explanation of translucency and more
http://dl.acm.org/citation.cfm?id=237791
This seems really close, but there is something I don't see: how are the
morphisms defined in the Contextual Category that corresponds to Coq's
CIC's term language? The 'obvious' definition of substitution works,
but has very unpleasant properties, especially if you are trying to
build a nice user interface. The language of "with" for type signatures
is very impoverished, and not up to the job of doing that.

It is not so much just having definitional extensions which are of
interest (as that's been around for a long time), but having good
behaviour, especially good *syntactic* behaviour, under repeated transport.

For an extreme example of this, see
Adrian Mathias, A Term of Length 4,523,659,424,929
<http://www.dpmms.cam.ac.uk/%7Eardm/inefff.dvi>, Synthese 133 (2002) 75--86.
https://www.dpmms.cam.ac.uk/~ardm/inefff.pdf

Buried in an answer on
http://mathoverflow.net/questions/14356/bourbakis-epsilon-calculus-notation
you can also find similar numbers for ZFC.

Without care, the same can happen in a type theory, if definitional
extensions are not treated as having important syntactic content, along
with its (trivial!) semantic content.

Jacques
Frank Pfenning
2016-11-12 20:56:47 UTC
Permalink
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]

Since you are mentioning the pragmatics, we did quite a bit of work in
Twelf to handle notational definitions efficiently, which doesn't seem to
be widely known. First, there is the notion of *strict definitions*

Frank Pfenning and Carsten Schürmann. Algorithms for equality and
unification in the presence of notational definitions
<http://www.cs.cmu.edu/~fp/papers/types98.pdf>, TYPES'98.

which, in the implementation, is combined with a "depth index" to steer
minimal incremental expansion of definitions for the purpose of equality
testing and unification. This has been extended to encompass proof
irrelevance.

Jason Reed, Proof Irrelevance and Strict Definitions in a Logical Framework
<http://reports-archive.adm.cs.cmu.edu/anon/2002/CMU-CS-02-153.pdf>, TR
CMU-CS-02-153, June 2002

and there also has been quite a bit on redundancy elimination in dependent
type theories, which interacts with notational definitions.
Jason Reed. Redundancy Elimination for LF
<http://www.cs.cmu.edu/~jcreed/papers/lfm2004.ps>. LFM'04.

- Frank
Post by Jacques Carette
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]
I am looking for literature on (higher-order, potentially dependent) type
theories where a context (telescope) can contain not just declarations, but
also definitions.
Of course, from a semantic point of view, this is entirely unnecessary, as
such definitions can simply be expanded away. However, from a categorical
standpoint (amongst others), things are not so trivial: what is the proper
meaning of morphisms (substitutions) in such a case?
The motivation comes from the remark that the category of contexts for a
type theory is the opposite category of that of theory presentations (aka
algebraic theories, algebraic specifications, etc). By applying the
'little theories' approach, it is really the theory morphisms that carry
the most interesting information. And that, in practice, one uses
"conservative extensions" of theories all the time.
- in Agda, in a parametric record definition, one can also define generic
functions which 'depend' on the fields of the record;
- in Haskell, in a typeclass definition, one can define default
implementations;
- in Scala, in a trait, one can similarly define default implementations.
These 3 things are essentially the same idea, of a conservative extension
of a theory.
The problem arises when one wants to build theory morphisms (which would
be typeclass-to-typeclass functions in Haskell, or trait-to-trait functions
in Scala, neither of which are available AFAIK): what to do with the
definitions? Again, from a semantic point-of-view, there is no intrinsic
difficulty, and multiple different designs are equivalent. The question
only really becomes interesting when considering the pragmatics. Some
designs lead to huge combinatorial explosions of definitions once your
theory library gets into the 100s of theories, never mind the 1000s, which
is what a realistic library of mathematics+CS needs.
This is not entirely straightforward. For example, the old theorem prover
IMPS actually has 4 different ways to handle the transport of definitional
extension along theory morphisms.
I have tried to look into the literature for related work, but I have not
been successful. Thus this query.
Jacques
--
Frank Pfenning, Professor and Head
Department of Computer Science
Carnegie Mellon University
Pittsburgh, PA 15213-3891

http://www.cs.cmu.
Loading...