Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Strict positivity description in CIC spec

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Strict positivity description in CIC spec


Chronological Thread 
  • From: Hans Jacob Fehrmann Rojas <hans.jfehrmann AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Strict positivity description in CIC spec
  • Date: Wed, 7 Aug 2019 12:02:12 -0400
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=hans.jfehrmann AT gmail.com; spf=Pass smtp.mailfrom=hans.jfehrmann AT gmail.com; spf=None smtp.helo=postmaster AT mail-wr1-f67.google.com
  • Ironport-phdr: 9a23:D35tfBDpt/z+AHrtHUIyUyQJP3N1i/DPJgcQr6AfoPdwSPT5p8bcNUDSrc9gkEXOFd2Cra4d0ayP6vqrCDdIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfK1+IA+roQnMqMUajo9vJ6gswRbVv3VEfPhby3l1LlyJhRb84cmw/J9n8ytOvv8q6tBNX6bncakmVLJUFDspPXw7683trhnDUBCA5mAAXWUMkxpHGBbK4RfnVZrsqCT6t+592C6HPc3qSL0/RDqv47t3RBLulSwKMSMy/mPKhcxqlK9UrxyhqB5/zYDaY4+bKeRwcb/GcNwAWWZMRNxcWzBdDo6+aYYEEuoPPfxfr4n4v1YArwGxBQ+3BOjyzjFHnGP53aoh3O88EQ/JwgwgH8gLsHvOqtX1MroZX/yyzKnK1zrDdO5d1DD96IfSdBAhuuuAXbB+ccXPyUkvDQbFgU+WqYzjJD6V2eENvHKa7+pkT+6gl2knqwRorzWp28wihI7JhocPxVDF8yV02Ic1JduiSE56e9GoCpVQtzuCO4t3RMMtXn1ouSYiyrIYo5K7eSwKxZI6zBDcc/yKa5aE7g7nWeqLIjp1hGhpdKyhixqv60Sty+/xW8+p21hQtCVFiMPDtnUV2hzT9MeHTvx981+k2TmV1gDT7vhIIE4ulabGMpIhzL89m5gJvUTMGS/2n0r2jKuIeUk+5ueo7OHnbq3npp+aKYB0lhnzProylsG7G+g1MQgDU3KF9eiiybHv50z0TbdSgv0ziKbZsZTaJcoBpq6+Bg9YyoYj5Ay5Dze9ytgYn3cHI0xFeBKdiojmIVfOIPbjAPewhlSjijZrx/TcMrL9BZXNK2DPkK39crZl905c1A0zwMhD6JJTE7ENOe78WkvstNPDFRI5KAy1w+P/CNpnzI8eWGSPArWYMKzIq1OI6PgvcKGwY9oevy+4IPw47dbvi2U4kBkTZ/qHx5wSPVCxGO8uAUySZnCkrNoBC2IDuAx2duvogUbKBT5aYW30Xawx5is+AYSgJYjGT4GpxreG2XHoTdVtemlaBwXUQj/TfIKeVqJUMX7AEopaijUBEIOZZco5zxj37V31zrNmKqzf/ShK7cu+hugw3PXakFQJzRIxD8mZ1DvQHWR9n2dNWCVvma4h/gpyzVCM1aU+iPtdR4QKtqF5FzwiPJuZ9NRUTtX7WwbPZNCMEQ/0TdCvADV3RdU0kYYD

Hi William,

I'm not an expert but a very sutil interpretation of the rules seems that the nested positive condition should be applied only considering the arity of the inductives without the parameters as if the `List (Rose A)` would be a new inductive.

So for your example:

Inductive Rose (A : Set) : Set :=
| rose : (List (Rose A)) -> Rose A.

Should check the positivity condition with respect to (assuming is a valid declaration)

Inductive ListRose : Set :=
| nil : ListRose
| cons : Rose A -> ListRose -> ListRose.
 
This is the argument in Certified Programming with Dependent Types (3.8 Nested Inductive Types)

Also, it seems that the check of the positive condition for an inductive definition is done in coq sources in checker/indtype.ml, specifically the function `check_positivity` and it seems that the parameters are not taking in consideration when checking the positivity condition, so the arguments of Chlipala seems right

Hope these helps

Best,
Hans.

On Tue, Aug 6, 2019 at 11:00 PM William J. Bowman <wjb AT williamjbowman.com> wrote:
I just finished implementing the CIC positivity checker as specified in the Coq
docs, but the docs seem under specified about how the strict positivity
algorithm should work.

  https://coq.inria.fr/doc/language/cic.html#positivity-condition

If I try to implement the rules as specified, I get stuck in an infinite loop
when checking nested inductive types.

Consider rose trees:

Inductive List (A : Set) : Set :=
| nil : List A
| cons : A -> List A -> List A.

Inductive Rose (A : Set) : Set :=
| rose : (List (Rose A)) -> Rose A.

I must show `Rose` occurs strictly positively in `(List (Rose A))`, from the
type of the constructor `rose`.

Loop:
To show that `Rose` occurs strictly positively in `List (Rose A)`,
since `List (Rose A)` is of the form `(I p_0 ... p_m u ...)` and `List` is not
mutually inductive, we must show the nested positivity condition for each
constructor of `List` after instantiating the types of the constructors with the
parameter `(Rose A)`.

There are two cases:
- nil : `(List (Rose A))` satisfies nested positivity w.r.t. `Rose` trivially.

- cons : `Rose A -> List (Rose A) -> List (Rose A)`
To show this satisfies nested positivity w.r.t. `Rose`, we must show that `Rose`
occurs strictly positively in `List (Rose A)`.
goto Loop


For now, I've "fixed" this by allowing myself to assume strict positivity holds
for `List (Rose A)` while checking nested positivity.
This seems okay, in a vague, intuitive, "something something greatest
fixpoints?" kind of way, but I'd like to be a little more formal than that.

Does anyone know what's missing from the Coq docs or what reference I should
look at?

I usually start from the Coq docs as they have the most readable and complete
CIC spec in one place.
I tried reading the Coq kernel code but.. failed.
I also tried Paulin-Mohring's "Inductive Definitions in the system Coq Rules and
Properties", but can't find anything about nested inductive types.

--
William J. Bowman



Archive powered by MHonArc 2.6.18.

Top of Page