coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Matthieu Sozeau <mattam AT mattam.org>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat
- Date: Wed, 06 Sep 2017 09:36:04 +0000
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=mattam AT mattam.org; spf=Pass smtp.mailfrom=matthieu.sozeau AT gmail.com; spf=None smtp.helo=postmaster AT mail-ua0-f174.google.com
- Ironport-phdr: 9a23:FV1IvxwVYmYhOyLXCy+O+j09IxM/srCxBDY+r6Qd0u8QIJqq85mqBkHD//Il1AaPBtqLra8cw8Pt8IneGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2NBXupSi56idXERHiPyJ0IP70E8jclZeZzee3rrjafxlIhTegKYh1Phi/sE2Fs8AKnYJnAqM41gfApz1PYesAljAgHk6agxupvpT4x5Vk6SkF4/8=
Indeed, that's how it works: the "template" part is about instantiating the type of the template polymorphic inductive so that its conclusion depends on the levels of the actual parameters, and can hence get lower than the original declared universe. However the constraints are not touched at all and we hence must add constraints between the actual parameters and the declared ones in case the constructors introduce constraints on them. What you describe is what the "full" universe polymorphism mechanism does, instantiating the constraints. Example why it is necessary:
Set Printing Universes.
Polymorphic Definition lt@{i j} := let X := Type@{i} : Type@{j} in unit.
Universe k.
Inductive foo@{l} (A : Type@{l}) : Type :=
| bar (B : lt@{l k}) : A -> foo A.
Print foo.
(* Inductive foo (A : Type@{l}) : Type@{max(Set, l)} := bar : lt@{l k} -> A -> foo A
(* l |= l < k *) *)
Variables B : Type@{k}.
Fail Definition baz' := foo B.
The term "B" has type "Type@{k}" while it is expected to have type "Type@{Top.75}"
(universe inconsistency: Cannot enforce k <= Top.75 because Top.75 < k).
(* Top.75 is l *)
Hope this helps,
-- Matthieu
On Wed, Sep 6, 2017 at 11:20 AM Jacques-Henri Jourdan <jacques-henri.jourdan AT normalesup.org> wrote:
Ok, I see that.
But then my question is : why is this even called "polymorphism"?
Perhaps, what I am asking for is some sort of explanation of what is
template universe polymorphism, actually.
--
JH
Le 06/09/2017 à 10:51, Guillaume Melquiond a écrit :
> On 06/09/2017 10:42, Jacques-Henri Jourdan wrote:
>> My naive understanding is that it would create a fresh (set of) universe
>> variable, and copy all the edges of the existing universe variable of
>> the list inductive type. But there should not be any direct constraint
>> between the fresh universe to the one of the original list definition.
> I don't think it has ever worked that way. (That said, I never
> understood why it was called "template", so maybe it was meant to work
> that way). For instance, if you type
>
> Check (fun T : Type => list T).
>
> you get a constraint between the Type type here and the one from the
> definition of list:
>
> Top.1 |= Top.1 <= Coq.Init.Datatypes.44
>
> Best regards,
>
> Guillaume
- [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Jan-Oliver Kaiser, 09/06/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Guillaume Melquiond, 09/06/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Jacques-Henri Jourdan, 09/06/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Guillaume Melquiond, 09/06/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Jacques-Henri Jourdan, 09/06/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Guillaume Melquiond, 09/06/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Jacques-Henri Jourdan, 09/06/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Matthieu Sozeau, 09/06/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Jacques-Henri Jourdan, 09/06/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Guillaume Melquiond, 09/06/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Jacques-Henri Jourdan, 09/06/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Jan-Oliver Kaiser, 09/11/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Matthieu Sozeau, 09/12/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Jacques-Henri Jourdan, 09/13/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Ralf Jung, 09/14/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Jacques-Henri Jourdan, 09/06/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Guillaume Melquiond, 09/06/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Jacques-Henri Jourdan, 09/06/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Guillaume Melquiond, 09/06/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Jacques-Henri Jourdan, 09/06/2017
- Re: [Coq-Club] Mysterious Universes introduced by List.tl and List.repeat, Guillaume Melquiond, 09/06/2017
Archive powered by MHonArc 2.6.18.