coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Nathanaël Courant <nathanael.courant AT ens.fr>
- To: coq-club AT inria.fr
- Subject: [Coq-Club] Creating induction principles with additional hypotheses
- Date: Thu, 27 Aug 2020 12:13:04 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=nathanael.courant AT ens.fr; spf=Pass smtp.mailfrom=nathanael.courant AT ens.fr; spf=None smtp.helo=postmaster AT nef.ens.fr
- Ironport-phdr: 9a23:8WhI4hQGNufFLGOa2d/hPisHd9psv+yvbD5Q0YIujvd0So/mwa6yZhyN2/xhgRfzUJnB7Loc0qyK6v6mADZcqszb+Fk5M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aFRrwLxd6KfroEYDOkcu3y/qy+5rOaAlUmTaxe7x/IAi3oAnLq8Uan4RvJqkvxhfXv3BFZ/lYyWR0KFyJgh3y/N2w/Jlt8yRRv/Iu6ctNWrjkcqo7ULJVEi0oP3g668P3uxbDSxCP5mYHXWUNjhVIGQnF4wrkUZr3ryD3q/By2CiePc3xULA0RTGv5LplRRP0lCsKMSMy/WfKgcJyka1bugqsqRxizYDKY4+bOvRxcazBct0VXmdBQsVcWjZdDo+gYYYCDewMNvtYoYnnoFsOqAOzCxG2C+Pzyj9HnHn20rcm1OQlCQ7LwgsgH88UsHvOqtX1KLoZXOezzKbS0TXDb+lZ2THn54fWdhAtu+2DXbVtccrL00YvER/Fg06OpozjJDOZzOoNs3KC4udmSOmghHIppRtrrTiz2scjlJPJhoQNx1za9St0xJg5K9O7RUJmfNKoDIdcuiOEO4ZoX88vQ39ltSU0x7EYpJO2ciwHxZAnyRPcdvCKfIeF7w//WeqNLjl1gm9udrGnhxuq7ESs1OnxWtOp3FtOqidJiN3Bu3EX2xHc9sSLUuZx8lml1DqVygze7uVJLVopmabBNZIt3Lg9nYcJv0vZBC/5gkD2gbeWdko6/uio7PzqYrP4qZ+SLYN7lAf+Mr80lsyxG+Q0KgkOX26F9uSgzLDv4FP1TbFQgvErlqTUtIrWKMAaq6KjDAJZzp4v6xOlADen1NQYk2MHLFVAeB+fiYjmIU3OIPDiAve5mVujjjNry+raMb3mH5XNNGLMkLH9fbtm9UFczhEzwcpR55JOEr0BOu78WlfttNzECR80KxC7w+H+CNlkyoweXX+PDbSCPaPJsV6I4/ovLPOWaI8Uvjb9Mfkl6OT0gX83g19ONZWuiJAQcTWzGulsC0Sfe3vlxNkbQkkQuQ9rauX2iFSEWL1XUF21Qrg14C1zXISvEYfKQImghPqK2zqhF5tKTm1AERaCCyG7JM2/R/4QZXfKcYdamTseWO35Et5z5VSVrAb/joFfAK/R8ywcu4jk0Ygn6uvI0x8op2UtUpatllqVRmQxpVsmAj872Kcm+x57x1nF3K5jxfJCR4QKu6F5FzwiPJuZ9NRUTsjoU1KTc9GSDli8EI2r
Hi all,
I have a complicated inductive proposition:
Inductive red: X -> Prop :=
| case_1 : ...
...
| case_N : ...
I also have some proposition P : X -> Prop.
I have goals of the form:
forall x, red x -> P x -> Q x.
which I prove by induction on red x. I can prove that if red x and P x, then P y is true for all y appearing as recursive calls to red in the constructor of red x.
However, each time I want to prove such a result, I have to prove P is true for each of the recursive calls, and I want to avoid such code duplication.
One possibility would be to create a custom induction principle, but since red is very complicated, this would amount to duplicate a lot of code, which I would rather avoid.
Another possibility I tried was to switch to open recursion:
Inductive red_ (rec : X -> Prop) : X -> Prop :=
...
Inductive red := red_intro : forall x, red_ red x -> red x.
Then I proved:
forall H x, red_ (fun x => red x /\ H x) x -> P x ->
red_ (fun x => red x /\ H x /\ P x) x
and
forall x, red_ (fun x => red x /\ P x /\ Q x) x -> Q x
which, combined, allow to prove forall x, red x -> P x -> Q x, and the deduplication of the work is done thanks to the first proof, which does not depend on Q.
This works well on that simple case, however, the case I have is a bit more complicated: P is not of type X -> Prop, but of type X -> A -> Prop, for some other type A.
I still have that if red x and P x a are true, then P y b are true for all y appearing as recursive calls to red in the constructor of red x (i.e. as calls to rec in red_ rec x), but it is for some b that depends on the recursive call and the constructor used.
Thus, I can still prove the same thing as in the open recursion case, but with the proposition (fun x => exists a, P x a). However, I want to be able to use the correct value of a for the recursive calls in the second part of the proof when I want to prove Q, and I can't, because it is hidden away by the exists, since I have to prove:
forall x, red_ (fun x => red x /\ (exists a, P x a) /\ Q x) x -> Q x.
Finally, I tried to create a function to extract the values of a needed from the constructor used to prove red x, but I'm getting a universe inconsistency, since red is a Prop.
Does anyone have an idea about how to extend recursion schemes for induction propositions, while proving some property is preserved as above, without getting a lot of code duplication in the way?
Thanks,
Nathanaël
- [Coq-Club] Creating induction principles with additional hypotheses, Nathanaël Courant, 08/27/2020
- Re: [Coq-Club] Creating induction principles with additional hypotheses, Li-yao Xia, 08/27/2020
- Re: [Coq-Club] Creating induction principles with additional hypotheses, Nathanaël Courant, 08/27/2020
- Re: [Coq-Club] Creating induction principles with additional hypotheses, Pierre Courtieu, 08/29/2020
- Re: [Coq-Club] Creating induction principles with additional hypotheses, Nathanaël Courant, 08/27/2020
- Re: [Coq-Club] Creating induction principles with additional hypotheses, Li-yao Xia, 08/27/2020
Archive powered by MHonArc 2.6.19+.