Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Unexpected restriction in universe-polymorphic definition

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Unexpected restriction in universe-polymorphic definition


Chronological Thread 
  • From: Dominik Kirst <kirst AT ps.uni-saarland.de>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Unexpected restriction in universe-polymorphic definition
  • Date: Mon, 18 Sep 2017 11:41:04 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=kirst AT ps.uni-saarland.de; spf=Pass smtp.mailfrom=kirst AT ps.uni-saarland.de; spf=None smtp.helo=postmaster AT theia.rz.uni-saarland.de
  • Ironport-phdr: 9a23:rLDvCh3B8fabsuHjsmDT+DRfVm0co7zxezQtwd8ZsesQK/ad9pjvdHbS+e9qxAeQG96Eu7QZ06L/iOPJZy8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tLw6annrn5jkLXx77KABdJ+LvG4eUgd7k+fq1/sj/ZABJgju+KZBzNg6q5VHSt9MNnaN6MeAszBqMuXJBYeBfw28uKV/FzEW03du54JM2q3cYgPkm7cMVCag=

Thanks for the help!

Dominik




> On 14. Sep 2017, at 12:45, Amin Timany
> <amintimany AT gmail.com>
> wrote:
>
> Hi,
>
> Another solution, if you are using 8.7beta1 or the development branch of
> Coq, is to enable cumulativity for inductive types. In this case, the
> inferred cumulativity (subtyping) relation for trees is as that every small
> tree is also a large one.
>
> Set Universe Polymorphism.
> Set Polymorphic Inductive Cumulativity.
>
> Set Printing Universes.
>
> Inductive Tree : Type :=
> sup : forall A : Type, (A -> Tree) -> Tree.
>
> Fixpoint emb' (s : Tree) :=
> let (A, f) := s in
> sup A (fun a => emb' (f a)).
>
> Definition T := sup Tree emb’.
>
> Considering the code above “Print Tree.” command prints:
>
>
> Cumulative Inductive Tree@{Top.8} : Type@{Top.8+1} :=
> sup : forall A : Type@{Top.8},
> (A -> Tree@{Top.8}) -> Tree@{Top.8}
> (* Top.8 |=
>
> ~@{Top.8} <= ~@{Top.9} iff
> Top.8 <= Top.9
> *)
>
> For sup: Argument scopes are [type_scope function_scope]
>
>
> Here “ ~@{Top.8} <= ~@{Top.9} iff Top.8 <= Top.9” that any term of type
> Tree@{i} is also a term of type Tree@{j} whenever i <= j.
>
> Regards,
> Amin
>
>
>> On 14 Sep 2017, at 12:36, Guillaume Melquiond
>> <guillaume.melquiond AT inria.fr>
>> wrote:
>>
>> On 13/09/2017 10:26, Dominik Kirst wrote:
>>
>>> When tagging the function type explicitly with two (unconstrained)
>>> universe variables, the exact level of the codomain is kept variable and
>>> the supremum becomes definable. Is this behaviour an intended
>>> minimisation?
>>
>> I would not even qualify that behavior as minimization; it looks like
>> plain inference.
>>
>> For example, (fun x : Type => x) is inferred as (Type@{i} -> Type@{i}),
>> not as (Type@{i} -> Type@{j} | i <= j), and this is intended.
>>
>> So, if you want extra universes and constraints, just add them by hand:
>>
>> Fixpoint emb'@{i j} (s : Tree@{i}) : Tree@{j} :=
>> let (A, f) := s in
>> sup A (fun a => emb' (f a)).
>>
>> Best regards,
>>
>> Guillaume
>




Archive powered by MHonArc 2.6.18.

Top of Page