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: roux cody <cody.roux AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Strict positivity description in CIC spec
  • Date: Wed, 7 Aug 2019 11:19:58 -0400
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=cody.roux AT gmail.com; spf=Pass smtp.mailfrom=cody.roux AT gmail.com; spf=None smtp.helo=postmaster AT mail-vs1-f52.google.com
  • Ironport-phdr: 9a23:Hp0c7hDs9NZDLRWHzKF3UyQJP3N1i/DPJgcQr6AfoPdwSPv5osbcNUDSrc9gkEXOFd2Cra4d0ayP6vqrCTJIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfK1+IA+roQnMqMUajohvJ6cswRbVv3VEfPhby3l1LlyJhRb84cmw/J9n8ytOvv8q6tBNX6bncakmVLJUFDspPXw7683trhnDUBCA5mAAXWUMkxpHGBbK4RfnVZrsqCT6t+592C6HPc3qSL0/RDqv47t3RBLulSwKMSMy/mPKhcxqlK9UrxyhqB5/zYDaY4+bKeRwcb/GcNwAWWZMRNxcWzBdDo6+aYYEEuoPPfxfr4n4v1YOtxy+BRSjBejy1jBIgWL53K0n2OkmDQ7G2xEvHtIUvHTOq9X1KagTXPu6zKnN1zrDbvdW1S3h54jPdxAsuPeBVq9+f8rWzEkgDQLFjlOIpIzkOTOVzOUNvHKB4+puT+KijXMspQJpojW32Msglo3EipgWx13E7yl13ps5KN+iREN7f9KpFoZbuTuAOItsWMwiRnlluCYkxb0Cvp62ZC0Kx44mxx7bcvCHbZOI7g/6WOafITp0mmhpeL24hxa1/kigzvPzWtOo31ZNqypJitjMtnYT2BzP8sWLVOdx80O71TuM1w3f8P9ILV02mKbBK5Mt3KY8lp8JvkTCGi/2ll/2jKiTdkg85ueo7PnoY7X8qp+GMI90lw7/P78hmsy6G+s4MwwOU3KH9uS70b3v5Vf5T6lSjv0qjqnZt4jXKtgcpq6gGgNazoIj6wukADq9y9QZnXwHLEpfdx6djojpPUvOIPHiAvuljVSsimQj+/eTNbr4R57JM3LrkbH7fL875VQP5hA0yIVF4I9EQroGLOO7DkT2uM2eFBgkIyS7xu/mDJN20YZICjHHObOQLK6H6QzA3ekoOeTZPNZE6ga4EOAs4rvVtVF8nFYceaez2p5OMSK3G/1nJwOSZn++245cQ1dPhRI3SanRsHPHUTNXYCzvDac15zV+Fpn/SImeHMaih7uO2Cr9FZpTNDgfVgK8VEzwfoDBYM8iLTqIK5Y4wDMBXLmlDYQm0EP2uQ==

Obviously not part of the CIC spec, but you might want to try Andreas Abel's thesis work "Termination Checking with Types", which describes a type system for handling these types of positivity constraints (and more complicated ones!). You can ignore the size types for now, though one might argue that they lead to a more robust termination analysis in any case.

The big missing component from this work is the dependent indices, but in a first approximation these can be erased.

Best,
Cody

On Tue, Aug 6, 2019 at 11:01 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