Discussion of Homotopy Type Theory and Univalent Foundations
 help / Atom feed
* [HoTT] Injective types
@ 2019-04-30 23:05 escardo.martin
  2019-05-01  2:50 ` Michael Shulman
  0 siblings, 1 reply; 11+ messages in thread
From: escardo.martin @ 2019-04-30 23:05 UTC (permalink / raw)
  To: Homotopy Type Theory

[-- Attachment #1.1: Type: text/plain, Size: 1366 bytes --]

I would like to advertise this paper, which investigates injective types 
and algebraically injective types, and their relationship 
(https://arxiv.org/abs/1903.01211).

In this paper, it is important to take universe levels seriously (for the 
reasons explained there). In the HoTT book, and in Coq, the universes are 
taken to be cumulative on the nose, and we pretend, notationally, that 
there is only one universe (this is called typical ambiguity). Based on the 
experience of this paper, I have the feeling that the loss of cumulativity, 
as in Agda, but also as in the infty-topos model of univalent type theory 
by Mike (https://arxiv.org/abs/1904.07004) is a good thing. In particular, 
I am not sure how typical ambiguity with cumulativity would be able to 
handle what is said in the above injectives paper.

When I say "would be able to handle" I don't mean just "accepting the 
constructions", but also present them to the (mathematical) user in such a 
way that is both understandable and usable as a blackbox (by quoting 
published resuls).

Martin

-- 
You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 1654 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [HoTT] Injective types
  2019-04-30 23:05 [HoTT] Injective types escardo.martin
@ 2019-05-01  2:50 ` Michael Shulman
  2019-05-01  6:25   ` escardo.martin
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Shulman @ 2019-05-01  2:50 UTC (permalink / raw)
  To: Martin Hotzel Escardo; +Cc: Homotopy Type Theory

Interesting point!  I definitely agree that we don't want to be
*forced* to be typically ambiguous; there are times when we need to
explicitly distinguish universes.  This was already the case in a few
places in the book, e.g. Lemmas 10.3.21 and 10.3.22.  And Coq's
universe polymorphism now also *allows* the user to explicitly specify
universe levels when desired.  (On the other hand, it's also nice to
not be forced to label all universes explicitly all the time.  But on
the third hard, at least in Coq as it is now, the interaction of
user-specified universes with automatically-deduced ones seems to be
fairly fragile.)

However, it's not clear to me why cumulativity would be a problem.  In
fact you wrote in the paper that "We don't assume that the universes
are cumulative... but we also don't assume that they are not".  Which
makes it sound as though cumulativity, though not necessary, wouldn't
be a problem if it did hold -- would it?

On Tue, Apr 30, 2019 at 4:05 PM <escardo.martin@gmail.com> wrote:
>
> I would like to advertise this paper, which investigates injective types and algebraically injective types, and their relationship (https://arxiv.org/abs/1903.01211).
>
> In this paper, it is important to take universe levels seriously (for the reasons explained there). In the HoTT book, and in Coq, the universes are taken to be cumulative on the nose, and we pretend, notationally, that there is only one universe (this is called typical ambiguity). Based on the experience of this paper, I have the feeling that the loss of cumulativity, as in Agda, but also as in the infty-topos model of univalent type theory by Mike (https://arxiv.org/abs/1904.07004) is a good thing. In particular, I am not sure how typical ambiguity with cumulativity would be able to handle what is said in the above injectives paper.
>
> When I say "would be able to handle" I don't mean just "accepting the constructions", but also present them to the (mathematical) user in such a way that is both understandable and usable as a blackbox (by quoting published resuls).
>
> Martin
>
> --
> You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [HoTT] Injective types
  2019-05-01  2:50 ` Michael Shulman
@ 2019-05-01  6:25   ` escardo.martin
  2019-05-01 16:55     ` Michael Shulman
  0 siblings, 1 reply; 11+ messages in thread
From: escardo.martin @ 2019-05-01  6:25 UTC (permalink / raw)
  To: Homotopy Type Theory

[-- Attachment #1.1: Type: text/plain, Size: 3200 bytes --]

On 01/05/2019 03:50, Michael Shulman wrote:> Interesting point!  I 
definitely agree that we don't want to be
> *forced* to be typically ambiguous; there are times when we need to
> explicitly distinguish universes.  This was already the case in a few
> places in the book, e.g. Lemmas 10.3.21 and 10.3.22.  And Coq's
> universe polymorphism now also *allows* the user to explicitly specify
> universe levels when desired.  (On the other hand, it's also nice to
> not be forced to label all universes explicitly all the time.  But on
> the third hard, at least in Coq as it is now, the interaction of
> user-specified universes with automatically-deduced ones seems to be
> fairly fragile.)
Right.

> However, it's not clear to me why cumulativity would be a problem.
In Agda each type gets a unique universe (or at most one universe) and
often (but not always) the system is able to infer them if we write
question marks "?" for them (but not always).

Cumulativity is not "on the nose" in the sense that from X : U_l you
would get X : U_m for m ≥ l. Instead, if you need to have (a copy of)
X in U_m, you need to use an explicit embedding U_l → U_m. (I only
ever used this embedding to show that U_l is a retract of U_m if we
assume propositional resizing.)

In practice, however, I never needed to use this embedding, as the
closure properties for universes work with more than one universe at a
time. For instance,

  if X:U_l and A : X → U_m, then Π X A : U_{max l m}.

With this kind of closure property, I haven't encountered the
practical need for cumulativity.

It is nice, in practice, that universes are uniquely
determined. Insted of thousands of level constraints, we have a
unique, small, (polymorphic) level assignment.

> In fact you wrote in the paper that "We don't assume that the
> universes are cumulative... but we also don't assume that they are
> not".  Which makes it sound as though cumulativity, though not
> necessary, wouldn't be a problem if it did hold -- would it?
In theory it wouldn't be a problem if it holds. However, if Agda did
have cumulativity, it would lose the unique-level assignment property
that I use to infer the levels of the results from my given levels of
the data. However, in the absence of a concrete proof assistant with
the option to enable and disable cumulativity, it is impossible to
perform experiments to confirm or reject this conjectural impression.

I consider the universe-level system of Agda to be excellent in
practice, and easy to use. Moreover, as I said, if I publish a
mathematical theorem developed in Agda, I think it is fair to the
reader to let them know what the universe level assignments are rather
than just say that they exist. In some cases, as injectivity, the
universe levels are crucial, and if we ignore them we get false
claims.

Best,
Martin

-- 
You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 4066 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [HoTT] Injective types
  2019-05-01  6:25   ` escardo.martin
@ 2019-05-01 16:55     ` Michael Shulman
  2019-05-02 20:46       ` escardo.martin
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Shulman @ 2019-05-01 16:55 UTC (permalink / raw)
  To: Martin Hotzel Escardo; +Cc: Homotopy Type Theory

On Tue, Apr 30, 2019 at 11:25 PM <escardo.martin@gmail.com> wrote:
> It is nice, in practice, that universes are uniquely
> determined. Insted of thousands of level constraints, we have a
> unique, small, (polymorphic) level assignment.
> ...
> I think it is fair to the
> reader to let them know what the universe level assignments are rather
> than just say that they exist. In some cases, as injectivity, the
> universe levels are crucial, and if we ignore them we get false
> claims.

Yes, this is a good point in favor of Agda-style non-cumulative
Russell universes over Coq-style cumulative Russell universes.

But isn't there a middle ground with Tarski universes?  Suppose we
have explicit lifting operators Lift : U_i -> U_{i+1}, so that as in
Agda we have unique small polymorphic level assignments.  But then
suppose we have *definitional* equalities El(Lift(A)) == El(A).  Then
on the (rare) occasions when we do have to explicitly lift types from
one universe to another, we would get stronger cumulativity behavior.
(And I could imagine a proof assistant that implements this and sugars
away the El to look like Russell universes to the user.)

-- 
You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [HoTT] Injective types
  2019-05-01 16:55     ` Michael Shulman
@ 2019-05-02 20:46       ` escardo.martin
  2019-05-03 11:45         ` Michael Shulman
  2019-05-07 12:42         ` Nils Anders Danielsson
  0 siblings, 2 replies; 11+ messages in thread
From: escardo.martin @ 2019-05-02 20:46 UTC (permalink / raw)
  To: Homotopy Type Theory

[-- Attachment #1.1: Type: text/plain, Size: 2704 bytes --]



On Wednesday, 1 May 2019 17:55:50 UTC+1, Michael Shulman wrote
>
>
> Yes, this is a good point in favor of Agda-style non-cumulative 
> Russell universes over Coq-style cumulative Russell universes. 
>
> But isn't there a middle ground with Tarski universes?  


It would be nice to have such a middle ground, particularly because 
formulating universe assumptions in each single definition and theorem is 
unfamiliar in mathematical practice, and so "typical ambiguity" (pretending 
there is only one universe) is potentially a good idea for many (or even 
most) examples. But not in the paper I advertised in this thread.

Here I post an example when Giraud did precisely that, namely to assume two 
arbitrary universes U and V, explaining why this is needed in that level of 
generality after the formulation of a theorem and its proof, given to me by 
Thierry Coquand:

  https://www.cs.bham.ac.uk/~mhe/giraud-universes.pdf (photo of one page of 
a book).
 
The book is “Cohmologie non abelienne” (1971, 
https://www.springer.com/gp/book/9783540053071).

Suppose we 
> have explicit lifting operators Lift : U_i -> U_{i+1}, so that as in 
> Agda we have unique small polymorphic level assignments.  But then 
> suppose we have *definitional* equalities El(Lift(A)) == El(A).  Then 
> on the (rare) occasions when we do have to explicitly lift types from 
> one universe to another, 


I can confirm from a 26k line Agda development (with comments and repeated 
blank lines removed in this counting of the number of lines) that not once 
did I need to embed a universe into a larger universe, except when I wanted 
to state the theorem that any universe is a retract of any larger universe 
if one assumes the propositional resizing axiom (any proposition in a 
universe U has an equivalent copy in any universe V). So I would say that 
such situations are *extremely rare* in practice.
 

> we would get stronger cumulativity behavior. 
> (And I could imagine a proof assistant that implements this and sugars 
> away the El to look like Russell universes to the user.)

 
At the moment we can choose cumulativity (Coq) or non-cumulativity (Agda), 
and there is no system that combines the virtues of Coq and Agda regarding 
universe handling. (And I fear that such a system would potentially 
multiply the vices of both. :-) )

M.

-- 
You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 3538 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [HoTT] Injective types
  2019-05-02 20:46       ` escardo.martin
@ 2019-05-03 11:45         ` Michael Shulman
  2019-05-03 13:25           ` Kenji Maillard
  2019-05-07 12:42         ` Nils Anders Danielsson
  1 sibling, 1 reply; 11+ messages in thread
From: Michael Shulman @ 2019-05-03 11:45 UTC (permalink / raw)
  To: Martin Hotzel Escardo; +Cc: Homotopy Type Theory

I am more optimistic: I think there's a good chance we could do better
than both Coq and Agda.  Of course sometimes when we try new things
they flop; but we can't make progress without trying new things.

For one thing, I don't think we should conflate typical ambiguity with
cumulativity.  It just so happens that Coq has both and Agda has
neither, but in principle I see no reason they have to go together.  I
see typical ambiguity as basically syntactic sugar or abuse of
notation, analogous to the use of implicit arguments: the reader or
proof assistant is tasked (if they feel like it) to go through and
insert level parameters as needed, accumulating constraints on these
parameters according to how the instance are used and thereby
"elaborating" a typically ambiguous development to a fully precise one
with (polymorphic) universe levels.  Usually this will be possible,
but occasionally if the writer was careless there may be a universe
inconsistency.

It seems to me that this could be done in both a cumulative and a
non-cumulative system.  True, in a non-cumulative system we get
different constraints, e.g. if we ever write "A=B" then it must be
that A and B live in the same universe, whereas in a cumulative system
we could be looser about such constraints.  But your evidence (and
that of other universe-polymorphic users of Agda) suggests that such
constraints arising from non-cumulativity are not in practice a
problem.  In fact, the unique assignment of levels in a non-cumulative
system suggests that the universe inference algorithm in a
hypothetical typically-ambiguous non-cumulative proof assistant would
probably be *simpler*, and less error-prone, than that of Coq.  So I
don't see any argument here against typical ambiguity, as long as
there is the *option* to be unambiguous when necessary (which again,
even Coq now supports).

In particular, note that when a development is formalized in a
typically ambiguous proof assistant, it's not necessary for the
universe levels to be written in the source code, or even thought
about by the author, in order for the interested reader -- or even the
author themselves! -- to learn about what the universe constraints
are.  They only have to compile the code, in particular running it
through the universe checker/elaborator, and then inspect the
resulting universe levels/constraints.  I've done this in present-day
Coq myself, although the proliferation of universe parameters makes
the output hard to undertsand; I expect it would only be easier in a
hypothetical typically-ambiguous non-cumulative proof assistant.  So
it seems to me that it should be possible to be "fair to the reader",
as you say, and still retain (some of) the advantages of typical
ambiguity.

I also think there's a good chance we can retain some cumulativity
without losing the benefits of non-cumulativity, by using a
Tarski-style lifting coercion as I sketched in my last email.  (Isn't
this in the literature somewhere?  I didn't think I'd made it up.)  I
agree that it's rare to need this, but neither is it unheard-of; so if
we can make it more convenient to use with no drawback, why not?  (Of
course, cumulativity is also trickier to model semantically, but
probably possible.)





On Thu, May 2, 2019 at 1:46 PM <escardo.martin@gmail.com> wrote:
>
>
>
> On Wednesday, 1 May 2019 17:55:50 UTC+1, Michael Shulman wrote
>>
>>
>> Yes, this is a good point in favor of Agda-style non-cumulative
>> Russell universes over Coq-style cumulative Russell universes.
>>
>> But isn't there a middle ground with Tarski universes?
>
>
> It would be nice to have such a middle ground, particularly because formulating universe assumptions in each single definition and theorem is unfamiliar in mathematical practice, and so "typical ambiguity" (pretending there is only one universe) is potentially a good idea for many (or even most) examples. But not in the paper I advertised in this thread.
>
> Here I post an example when Giraud did precisely that, namely to assume two arbitrary universes U and V, explaining why this is needed in that level of generality after the formulation of a theorem and its proof, given to me by Thierry Coquand:
>
>   https://www.cs.bham.ac.uk/~mhe/giraud-universes.pdf (photo of one page of a book).
>
> The book is “Cohmologie non abelienne” (1971, https://www.springer.com/gp/book/9783540053071).
>
>> Suppose we
>> have explicit lifting operators Lift : U_i -> U_{i+1}, so that as in
>> Agda we have unique small polymorphic level assignments.  But then
>> suppose we have *definitional* equalities El(Lift(A)) == El(A).  Then
>> on the (rare) occasions when we do have to explicitly lift types from
>> one universe to another,
>
>
> I can confirm from a 26k line Agda development (with comments and repeated blank lines removed in this counting of the number of lines) that not once did I need to embed a universe into a larger universe, except when I wanted to state the theorem that any universe is a retract of any larger universe if one assumes the propositional resizing axiom (any proposition in a universe U has an equivalent copy in any universe V). So I would say that such situations are *extremely rare* in practice.
>
>>
>> we would get stronger cumulativity behavior.
>> (And I could imagine a proof assistant that implements this and sugars
>> away the El to look like Russell universes to the user.)
>
>
> At the moment we can choose cumulativity (Coq) or non-cumulativity (Agda), and there is no system that combines the virtues of Coq and Agda regarding universe handling. (And I fear that such a system would potentially multiply the vices of both. :-) )
>
> M.
>
> --
> You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [HoTT] Injective types
  2019-05-03 11:45         ` Michael Shulman
@ 2019-05-03 13:25           ` Kenji Maillard
  2019-05-03 18:23             ` Thierry Coquand
  0 siblings, 1 reply; 11+ messages in thread
From: Kenji Maillard @ 2019-05-03 13:25 UTC (permalink / raw)
  To: HomotopyTypeTheory

I think the paper "A calculus of constructions with explicit subtyping"
by Ali Assaf that can be found at https://hal.inria.fr/hal-01097401 is
a relevant reference for coercive lifts between Tarski style universes.

K.

On 03/05/2019 13:45, Michael Shulman wrote:
> I am more optimistic: I think there's a good chance we could do better
> than both Coq and Agda.  Of course sometimes when we try new things
> they flop; but we can't make progress without trying new things.
>
> For one thing, I don't think we should conflate typical ambiguity with
> cumulativity.  It just so happens that Coq has both and Agda has
> neither, but in principle I see no reason they have to go together.  I
> see typical ambiguity as basically syntactic sugar or abuse of
> notation, analogous to the use of implicit arguments: the reader or
> proof assistant is tasked (if they feel like it) to go through and
> insert level parameters as needed, accumulating constraints on these
> parameters according to how the instance are used and thereby
> "elaborating" a typically ambiguous development to a fully precise one
> with (polymorphic) universe levels.  Usually this will be possible,
> but occasionally if the writer was careless there may be a universe
> inconsistency.
>
> It seems to me that this could be done in both a cumulative and a
> non-cumulative system.  True, in a non-cumulative system we get
> different constraints, e.g. if we ever write "A=B" then it must be
> that A and B live in the same universe, whereas in a cumulative system
> we could be looser about such constraints.  But your evidence (and
> that of other universe-polymorphic users of Agda) suggests that such
> constraints arising from non-cumulativity are not in practice a
> problem.  In fact, the unique assignment of levels in a non-cumulative
> system suggests that the universe inference algorithm in a
> hypothetical typically-ambiguous non-cumulative proof assistant would
> probably be *simpler*, and less error-prone, than that of Coq.  So I
> don't see any argument here against typical ambiguity, as long as
> there is the *option* to be unambiguous when necessary (which again,
> even Coq now supports).
>
> In particular, note that when a development is formalized in a
> typically ambiguous proof assistant, it's not necessary for the
> universe levels to be written in the source code, or even thought
> about by the author, in order for the interested reader -- or even the
> author themselves! -- to learn about what the universe constraints
> are.  They only have to compile the code, in particular running it
> through the universe checker/elaborator, and then inspect the
> resulting universe levels/constraints.  I've done this in present-day
> Coq myself, although the proliferation of universe parameters makes
> the output hard to undertsand; I expect it would only be easier in a
> hypothetical typically-ambiguous non-cumulative proof assistant.  So
> it seems to me that it should be possible to be "fair to the reader",
> as you say, and still retain (some of) the advantages of typical
> ambiguity.
>
> I also think there's a good chance we can retain some cumulativity
> without losing the benefits of non-cumulativity, by using a
> Tarski-style lifting coercion as I sketched in my last email.  (Isn't
> this in the literature somewhere?  I didn't think I'd made it up.)  I
> agree that it's rare to need this, but neither is it unheard-of; so if
> we can make it more convenient to use with no drawback, why not?  (Of
> course, cumulativity is also trickier to model semantically, but
> probably possible.)
>
>
>
>
>
> On Thu, May 2, 2019 at 1:46 PM <escardo.martin@gmail.com> wrote:
>>
>>
>> On Wednesday, 1 May 2019 17:55:50 UTC+1, Michael Shulman wrote
>>>
>>> Yes, this is a good point in favor of Agda-style non-cumulative
>>> Russell universes over Coq-style cumulative Russell universes.
>>>
>>> But isn't there a middle ground with Tarski universes?
>>
>> It would be nice to have such a middle ground, particularly because formulating universe assumptions in each single definition and theorem is unfamiliar in mathematical practice, and so "typical ambiguity" (pretending there is only one universe) is potentially a good idea for many (or even most) examples. But not in the paper I advertised in this thread.
>>
>> Here I post an example when Giraud did precisely that, namely to assume two arbitrary universes U and V, explaining why this is needed in that level of generality after the formulation of a theorem and its proof, given to me by Thierry Coquand:
>>
>>    https://www.cs.bham.ac.uk/~mhe/giraud-universes.pdf (photo of one page of a book).
>>
>> The book is “Cohmologie non abelienne” (1971, https://www.springer.com/gp/book/9783540053071).
>>
>>> Suppose we
>>> have explicit lifting operators Lift : U_i -> U_{i+1}, so that as in
>>> Agda we have unique small polymorphic level assignments.  But then
>>> suppose we have *definitional* equalities El(Lift(A)) == El(A).  Then
>>> on the (rare) occasions when we do have to explicitly lift types from
>>> one universe to another,
>>
>> I can confirm from a 26k line Agda development (with comments and repeated blank lines removed in this counting of the number of lines) that not once did I need to embed a universe into a larger universe, except when I wanted to state the theorem that any universe is a retract of any larger universe if one assumes the propositional resizing axiom (any proposition in a universe U has an equivalent copy in any universe V). So I would say that such situations are *extremely rare* in practice.
>>
>>> we would get stronger cumulativity behavior.
>>> (And I could imagine a proof assistant that implements this and sugars
>>> away the El to look like Russell universes to the user.)
>>
>> At the moment we can choose cumulativity (Coq) or non-cumulativity (Agda), and there is no system that combines the virtues of Coq and Agda regarding universe handling. (And I fear that such a system would potentially multiply the vices of both. :-) )
>>
>> M.
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [HoTT] Injective types
  2019-05-03 13:25           ` Kenji Maillard
@ 2019-05-03 18:23             ` Thierry Coquand
  0 siblings, 0 replies; 11+ messages in thread
From: Thierry Coquand @ 2019-05-03 18:23 UTC (permalink / raw)
  To: Kenji Maillard; +Cc: HomotopyTypeTheory

[-- Attachment #1: Type: text/plain, Size: 7311 bytes --]

 Indeed!
 There is also

http://www.math.ias.edu/Voevodsky/files/files-annotated/Dropbox/Unfinished_papers/Type_systems/UPTS_current/Universe_polymorphic_type_sytem.pdf

 Thierry

On 3 May 2019, at 15:25, Kenji Maillard <chocobodralliam@gmail.com<mailto:chocobodralliam@gmail.com>> wrote:

I think the paper "A calculus of constructions with explicit subtyping"
by Ali Assaf that can be found at https://hal.inria.fr/hal-01097401 is
a relevant reference for coercive lifts between Tarski style universes.

K.

On 03/05/2019 13:45, Michael Shulman wrote:
I am more optimistic: I think there's a good chance we could do better
than both Coq and Agda.  Of course sometimes when we try new things
they flop; but we can't make progress without trying new things.

For one thing, I don't think we should conflate typical ambiguity with
cumulativity.  It just so happens that Coq has both and Agda has
neither, but in principle I see no reason they have to go together.  I
see typical ambiguity as basically syntactic sugar or abuse of
notation, analogous to the use of implicit arguments: the reader or
proof assistant is tasked (if they feel like it) to go through and
insert level parameters as needed, accumulating constraints on these
parameters according to how the instance are used and thereby
"elaborating" a typically ambiguous development to a fully precise one
with (polymorphic) universe levels.  Usually this will be possible,
but occasionally if the writer was careless there may be a universe
inconsistency.

It seems to me that this could be done in both a cumulative and a
non-cumulative system.  True, in a non-cumulative system we get
different constraints, e.g. if we ever write "A=B" then it must be
that A and B live in the same universe, whereas in a cumulative system
we could be looser about such constraints.  But your evidence (and
that of other universe-polymorphic users of Agda) suggests that such
constraints arising from non-cumulativity are not in practice a
problem.  In fact, the unique assignment of levels in a non-cumulative
system suggests that the universe inference algorithm in a
hypothetical typically-ambiguous non-cumulative proof assistant would
probably be *simpler*, and less error-prone, than that of Coq.  So I
don't see any argument here against typical ambiguity, as long as
there is the *option* to be unambiguous when necessary (which again,
even Coq now supports).

In particular, note that when a development is formalized in a
typically ambiguous proof assistant, it's not necessary for the
universe levels to be written in the source code, or even thought
about by the author, in order for the interested reader -- or even the
author themselves! -- to learn about what the universe constraints
are.  They only have to compile the code, in particular running it
through the universe checker/elaborator, and then inspect the
resulting universe levels/constraints.  I've done this in present-day
Coq myself, although the proliferation of universe parameters makes
the output hard to undertsand; I expect it would only be easier in a
hypothetical typically-ambiguous non-cumulative proof assistant.  So
it seems to me that it should be possible to be "fair to the reader",
as you say, and still retain (some of) the advantages of typical
ambiguity.

I also think there's a good chance we can retain some cumulativity
without losing the benefits of non-cumulativity, by using a
Tarski-style lifting coercion as I sketched in my last email.  (Isn't
this in the literature somewhere?  I didn't think I'd made it up.)  I
agree that it's rare to need this, but neither is it unheard-of; so if
we can make it more convenient to use with no drawback, why not?  (Of
course, cumulativity is also trickier to model semantically, but
probably possible.)





On Thu, May 2, 2019 at 1:46 PM <escardo.martin@gmail.com<mailto:escardo.martin@gmail.com>> wrote:


On Wednesday, 1 May 2019 17:55:50 UTC+1, Michael Shulman wrote

Yes, this is a good point in favor of Agda-style non-cumulative
Russell universes over Coq-style cumulative Russell universes.

But isn't there a middle ground with Tarski universes?

It would be nice to have such a middle ground, particularly because formulating universe assumptions in each single definition and theorem is unfamiliar in mathematical practice, and so "typical ambiguity" (pretending there is only one universe) is potentially a good idea for many (or even most) examples. But not in the paper I advertised in this thread.

Here I post an example when Giraud did precisely that, namely to assume two arbitrary universes U and V, explaining why this is needed in that level of generality after the formulation of a theorem and its proof, given to me by Thierry Coquand:

  https://www.cs.bham.ac.uk/~mhe/giraud-universes.pdf (photo of one page of a book).

The book is “Cohmologie non abelienne” (1971, https://www.springer.com/gp/book/9783540053071).

Suppose we
have explicit lifting operators Lift : U_i -> U_{i+1}, so that as in
Agda we have unique small polymorphic level assignments.  But then
suppose we have *definitional* equalities El(Lift(A)) == El(A).  Then
on the (rare) occasions when we do have to explicitly lift types from
one universe to another,

I can confirm from a 26k line Agda development (with comments and repeated blank lines removed in this counting of the number of lines) that not once did I need to embed a universe into a larger universe, except when I wanted to state the theorem that any universe is a retract of any larger universe if one assumes the propositional resizing axiom (any proposition in a universe U has an equivalent copy in any universe V). So I would say that such situations are *extremely rare* in practice.

we would get stronger cumulativity behavior.
(And I could imagine a proof assistant that implements this and sugars
away the El to look like Russell universes to the user.)

At the moment we can choose cumulativity (Coq) or non-cumulativity (Agda), and there is no system that combines the virtues of Coq and Agda regarding universe handling. (And I fear that such a system would potentially multiply the vices of both. :-) )

M.

--
You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com<mailto:HomotopyTypeTheory+unsubscribe@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com<mailto:HomotopyTypeTheory+unsubscribe@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 10524 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [HoTT] Injective types
  2019-05-02 20:46       ` escardo.martin
  2019-05-03 11:45         ` Michael Shulman
@ 2019-05-07 12:42         ` Nils Anders Danielsson
  2019-05-07 13:51           ` Andreas Nuyts
  1 sibling, 1 reply; 11+ messages in thread
From: Nils Anders Danielsson @ 2019-05-07 12:42 UTC (permalink / raw)
  To: Homotopy Type Theory

On 02/05/2019 22.46, escardo.martin@gmail.com wrote:
> I can confirm from a 26k line Agda development (with comments and
> repeated blank lines removed in this counting of the number of lines)
> that not once did I need to embed a universe into a larger universe,
> except when I wanted to state the theorem that any universe is a
> retract of any larger universe if one assumes the propositional
> resizing axiom (any proposition in a universe U has an equivalent copy
> in any universe V). So I would say that such situations are *extremely
> rare* in practice.

I once wrote some code where I made use of univalence at three different
levels. Does anyone know if one can prove that univalence at one level
implies univalence at lower levels, without making use of cumulativity?

-- 
/NAD

-- 
You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/HomotopyTypeTheory/5fa99a80-56ed-abc5-d64f-876c192bca6a%40cse.gu.se.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [HoTT] Injective types
  2019-05-07 12:42         ` Nils Anders Danielsson
@ 2019-05-07 13:51           ` Andreas Nuyts
  2019-05-07 22:06             ` Martín Hötzel Escardó
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Nuyts @ 2019-05-07 13:51 UTC (permalink / raw)
  To: Nils Anders Danielsson, Homotopy Type Theory

Even with cumulativity, that sounds suspicious, because cumulativity of 
U in a bigger universe V does not obviously give you a map

(A B : U) -> Id V A B -> Id U A B.

The J-rule does not allow you to build this map.

On 7/05/19 14:42, Nils Anders Danielsson wrote:
> On 02/05/2019 22.46, escardo.martin@gmail.com wrote:
>> I can confirm from a 26k line Agda development (with comments and
>> repeated blank lines removed in this counting of the number of lines)
>> that not once did I need to embed a universe into a larger universe,
>> except when I wanted to state the theorem that any universe is a
>> retract of any larger universe if one assumes the propositional
>> resizing axiom (any proposition in a universe U has an equivalent copy
>> in any universe V). So I would say that such situations are *extremely
>> rare* in practice.
>
> I once wrote some code where I made use of univalence at three different
> levels. Does anyone know if one can prove that univalence at one level
> implies univalence at lower levels, without making use of cumulativity?
>

-- 
You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/HomotopyTypeTheory/49d95599-153c-d641-4ae9-a3f7c02b1cc3%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [HoTT] Injective types
  2019-05-07 13:51           ` Andreas Nuyts
@ 2019-05-07 22:06             ` Martín Hötzel Escardó
  0 siblings, 0 replies; 11+ messages in thread
From: Martín Hötzel Escardó @ 2019-05-07 22:06 UTC (permalink / raw)
  To: Homotopy Type Theory

[-- Attachment #1.1: Type: text/plain, Size: 3219 bytes --]

On 07/05/2019 14:51, Andreas Nuyts wrote:
> Even with cumulativity, that sounds suspicious, because cumulativity of 
> U in a bigger universe V does not obviously give you a map
> 
> (A B : U) -> Id V A B -> Id U A B.
> 
> The J-rule does not allow you to build this map.

Indeed.

In the non-cumulative system, with V bigger than U, you have a map
f : U → V with f A ≃ A. For example, if C is any contractible type in
V, you can take f A := A × C.

If both U and V are univalent, then any map f : U → V with f A ≃ A is
an embedding for all A : U, meaning that the canonical map

  Id U A B → Id V (f A) (f B)
  
is equivalence (or equivalently that the fibers of f are propositions).
I checked this in Agda.

The reformulation of your statement above with an explicit inclusion
f : U → V, namely

 (A B : U) -> Id V (f A) (f B) -> Id U A B,

which amounts to the left-cancellability of f, is a consequence of f
being an embedding, and in general strictly weaker than f being an
embedding.

But I don't see how to prove even the left-cancellability of f without
assuming univalence in the smaller universe U.

Assuming that V is univalent, Id V (f A) (f B) gives f A ≃ f B, and
then composing with the equivalences A ≃ f A and f B ≃ B we get A ≃ B.
If U were univalent we would get Id U A B and hence f would be
left-cancellable. But, as I said, the univalence of U and V gives
more, namely that f is an embedding.

And if V is univalent and f is an embedding, then U is univalent, for
A ≃ B is equivalent to f A ≃ f B and hence to Id V (f A) (f B), and
hence to Id U A B, using the embedding property in the last step.

So if V is univalent, then the smaller universe U is univalent iff
every map f : U → V with f A ≃ A for all A : U is an embedding (iff
some given such map is an embedding).

Martin

> 
> On 7/05/19 14:42, Nils Anders Danielsson wrote:
>> On 02/05/2019 22.46, escardo.martin@gmail.com wrote:
>>> I can confirm from a 26k line Agda development (with comments and
>>> repeated blank lines removed in this counting of the number of lines)
>>> that not once did I need to embed a universe into a larger universe,
>>> except when I wanted to state the theorem that any universe is a
>>> retract of any larger universe if one assumes the propositional
>>> resizing axiom (any proposition in a universe U has an equivalent copy
>>> in any universe V). So I would say that such situations are *extremely
>>> rare* in practice.
>>
>> I once wrote some code where I made use of univalence at three different
>> levels. Does anyone know if one can prove that univalence at one level
>> implies univalence at lower levels, without making use of cumulativity?

-- 
You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group.
To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/HomotopyTypeTheory/6bae18da-1ecc-4633-a565-9df222140d87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 4371 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, back to index

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-30 23:05 [HoTT] Injective types escardo.martin
2019-05-01  2:50 ` Michael Shulman
2019-05-01  6:25   ` escardo.martin
2019-05-01 16:55     ` Michael Shulman
2019-05-02 20:46       ` escardo.martin
2019-05-03 11:45         ` Michael Shulman
2019-05-03 13:25           ` Kenji Maillard
2019-05-03 18:23             ` Thierry Coquand
2019-05-07 12:42         ` Nils Anders Danielsson
2019-05-07 13:51           ` Andreas Nuyts
2019-05-07 22:06             ` Martín Hötzel Escardó

Discussion of Homotopy Type Theory and Univalent Foundations

Archives are clonable: git clone --mirror http://inbox.vuxu.org/hott

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.hott


AGPL code for this site: git clone https://public-inbox.org/ public-inbox