coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Li-yao Xia <lysxia AT gmail.com>
- To: Nathanaël Courant <nathanael.courant AT ens.fr>
- Cc: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Creating induction principles with additional hypotheses
- Date: Thu, 27 Aug 2020 09:26:35 -0400
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=lysxia AT gmail.com; spf=Pass smtp.mailfrom=lysxia AT gmail.com; spf=None smtp.helo=postmaster AT mail-vk1-f175.google.com
- Ironport-phdr: 9a23:2sbajhyXTds5zTLXCy+O+j09IxM/srCxBDY+r6Qd2+0VIJqq85mqBkHD//Il1AaPAdyFrase16GN7ujJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fcbglVhTexe65+IAu5oAneuMQbgZZpJ7osxBfOvnZGYfldy3lyJVKUkRb858Ow84Bm/i9Npf8v9NNOXLvjcaggQrNWEDopM2Yu5M32rhbDVheA5mEdUmoNjBVFBRXO4QzgUZfwtiv6sfd92DWfMMbrQ704RSiu4qF2QxLzliwJKyA2/33WisxojaJUvhShpwBkw4XJZI2ZLedycr/Bcd8fQ2dKQ8RfWDFbAo6kcoUBEeQBM+ZboYfzqVQBohmxChWjCu701j9FhWX70bEm3+kvEwzL2hErEdIUsHTTqdX4LKEcUeGswKjI1zrDaO5d1jb86IfSbxsspvWMXLJrccveyEkgDRjIjlqVqYP/PjOV0v4BvHSc7+plTO+ijXMspA5trDa13MgslpXJiZwPylDC7Sh3z5o4KN26RUNnfdKqEJteuj+aOYZyQM4sQ3xktDg0x7AItpO2fCcExYo7yhPQZPGLb4yF7BLhWeuRLzl1mm5pdbSijBix6Uit0vPwWtWw3VpQrSdIksPAum4T2xDO8MSLV/lw80e51TqRywze6/tILV0qmafbMZIsw6A8moANvUnDGCL9hV/4g7WMdko+/+il8+Tnbavipp+bL4J0jxvxMqUqmsCmH+Q4MRUCU3GV+eih1rDu/Vf1QLpNjv0xnanZtI7VKd4Hqa6+Bg9Zyocj6xChADe6yNkUg2ULIVZfdB+Ej4XlIU/CLO7lAfulnlihkjdmy+jDPrL7A5XNKnbDkK3mfbZ480NczAoyzctQ5pJVEL4MO/3zWkrru9zZCh81KRC7w+HiCNllzIMRRXqPArOFMKPVqVKH+uUvI/CVaIAJvDb9NuMq6uX1jX45nF8dZbOm0YEWaHC+BPRmIl+WbWDigtcbQi82uV8YRfDqgVuL0jpkTHGvRas6+nlvDou6DY7FT42pxreGwT2yGIF+a2ZdTF6WRyTGbYKBDtMNLTObJYdRkzVMAbywUJ8g3DmhsQb7z/xsKe+CqX5Qjo7qyNUgv76brho17zEhSp3FizjQHVExpXsBQnoN5I46oUF5zQ3dg61xgvgdC98Kov0QDVp8OpnbwOh3Tdv1X1CZJ4bbeBOdWtyjRAoJYJc0yt4KbVx6Hoz73B/G1iuuRbQSku7SXcBmwufnx3H0Yv1F5TPezqB41gspR8JOMSutgastrwU=
Hi Nathanaël,
One idea is to generalize the open recursion so the recursive predicate takes an A parameter:
Inductive red_ (rec : X -> A -> Prop) : X -> Prop.
Would there be any problem doing that?
Cheers,
Li-yao
On 8/27/2020 6:13 AM, Nathanaël Courant wrote:
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+.