coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: "Kumar, Ashish" <azk640 AT psu.edu>
- To: "coq-club AT inria.fr" <coq-club AT inria.fr>
- Subject: [Coq-Club] How to avoid code-duplication in this proof?
- Date: Sun, 13 Sep 2020 15:10:11 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=psu.edu; dmarc=pass action=none header.from=psu.edu; dkim=pass header.d=psu.edu; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gyLd5ElKiHJbw05XzO+eHuaoybeqMX9m/jkir0diWR8=; b=OwezmUqHWDziyRgOXsbIcf3b2BnADZ0s9uJoFba454qmpGiOdOnVhjf63LypauprIuc21qrEI/PAU4jvDl43M23RLznQaySgps+iQzxSqyzY20TlciCU/2NxPYKvCq45/76JmaQlxbYpqfxF4mSqBR5bFWjJEDnyqeoVDjn5vn5YQSQO9WzrLeH/UQv79S5PCPDOhoO+sLIl3dvw722lSo1s76+qJqk98h0HMmabsM+rP65bRkSU7+ERq+tursttmSxasOzLJQWv45RiO38f3xwOxP69aNnjBitcHEmkKk6X8ZoxbERKHDyEmqjlulsSv0sTtGi6GTu56YFXdDoGbg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NobrejWmPkg8puzHPmbFGR542VkA4iC9DMODU+hhmHOcoIE/TXApYu3pO1EiMQB+WYmyfuxxjzH0QoZwE6758+W/8aXkTcZOUCI+ZsFucmYNjU7xhsGQ8DmwpQ4hFcmQrfvj+6R1YjnGoLz61vIwadOMgtF6PN5GLi7vuJj3qElR+qDsm2FuT2GrUqODuAbecP7hZOTJ5G5n8mcCeuKPZ9dOazCjY1eCEk9CC8BqAfOeqTz7ty/VWpJfmEWf+ZE0tEvYbW5xcskmjG+yE9zffiaGcIHKefz4Ioq8gUqJiRLsqJ0KvTXNWTW/SV1zFl4xBycQBVR8tRJ5sYEbZJI+gg==
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=azk640 AT psu.edu; spf=Pass smtp.mailfrom=azk640 AT psu.edu; spf=Pass smtp.helo=postmaster AT NAM12-BN8-obe.outbound.protection.outlook.com
- Ironport-phdr: 9a23:mArYfB/SL8Llxv9uRHKM819IXTAuvvDOBiVQ1KB20uocTK2v8tzYMVDF4r011RmVBNudsqgYwLqP+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZLebxhJiTanfL9+Mhq7oQrSu8ULnIBvNrs/xhzVr3VSZu9Y33loJVWdnxb94se/4ptu+DlOtvwi6sBNT7z0c7w3QrJEAjsmNXs15NDwuhnYUQSP/HocXX4InRdOHgPI8Qv1Xpb1siv9q+p9xCyXNtD4QLwoRTiv6bpgRRn1gykFKjE56nnahMxugqxGvBKvqR9xw4/Ib46aL/dxZL/Rcc8ASGZdQspdSipMCZ68YYsVCOoBOP5Vo4f4qVsTqBuxHxOsCPvywTJUnX/23aw60/8hEQ3IwQctGMgBsXXXrNj0O6oeTfu4zLHTzTXedf9Zxyry6JXRfx0nvPqDUq5+f9DLxkkzCwPKkE+QqYr9Mj2V1ukAs2yW4/RhWO+slWIppAN8rDegyMkjl4TEh4YYx1/a+Shk3Ys4JNO1RUxnbdCqHpVduSKXO5ZoTs48Xm1lvjsxxL4euZOjcyUG1I4rywPDZ/GFaYSE/BzuWeSLLTtlmX5pZaqziwuu/UWv0OHxWMq53ExFoyZbiNXBt20B2wTN5sWGVvdw8EKs1SuT2w/I6+xJJF44mbbYJpMkwrM9kp8evEHeEiPrnkj9kbWYeV8++uey7uTqerXmqYGYN49zkgzwKrgjlMuiDegmKwQDQnCV9Oel2L3k5kL2Xq9GjvorkqnFq5/aItkbpqikDANPyoYj8RG/Dyu439sEgXkHLVVFeBSdg4juJlHOPPT4DfC4g1Svijtk2/fGPrj5DpXMKHjMjqvhcK5y5kJA0gY/0MxT6pBOBr0fLv/+WFX9uMHFAhMkKwC0xvzoCNR51oMQQ2KPBaqZPbvIvl6J5eIiIuaBaJMOtTblMPgl+uTigmEkll8AZaWpx4cYaGikHvR6JEWUeWbjgtAYEWsTogU+SPHqh0aZXD5IZ3eyWro86SshBIKnC4fDXIGtj6ab0Ce1BJ0FLlxBXxqHFm6tfIGZUd8NbjiTK4lviHZMAbOmUsoq0QyknA780btuaOTOrH42r5XmgZJW+ujaj1V63Cd0Dt+dmSnZRnN3wD9QbyctweZyrVErmQTL6rRxn/ENTY8b3PhOSApvbceNndw/MMj7X0f6RvnMTV+nRtu8BjRgHMoq3pkDb1svQoz+3CCG5DKjBvour5LOHIY9o/DExGW3KspgmS6fifsRymI+S84KDlWIw65y8w+PWNzvumDAzeOAU/RZ2yTAsmCe0WCJoUdUFhZqVrnIVmweYU2Qqsnl4kTFTPmlDrF1awY=
Hi,
I am trying to prove a theorem (proof code given below). The issue is there is a lot of repeated code in the proof, which I would like to avoid. Is there a way to do so?
Proof has been summarized below to show only relevant details - In below proof,
(1) Let T1 and T2 denote a sequence of tactics of the form t1 ; t2 ; t3 ... ; tn.
(2) Let S1 be some lemma statement, which has type Prop.
(3) Let L1 be a lemma proved earlier.
Proof.
intros. split; intros H'; inversion_clear H'; T1.
+ assert (H" : S1). { apply L1; assumption. }
T2 ; apply H''.
+ assert (H" : S1). { apply L1; assumption. }
T2; symmetry in H''; apply H''.
Qed.
After the intros, we have a goal of the form (A -> B) /\ (B -> A).
The inversion_clear H' statement generates a total of 4 subgoals from the 2 subgoals generated by split, and T1 solves 2 of these 4 subgoals.
As you can see the proof code for the remaining 2 subgoals is almost identical (excluding the symmetry tactic). Note that I cannot push the assert statement earlier in the proof, as inversion_clear H' generates a variable st'0 which is used in the assert statements.
I have 2 issues:
(1) Is there a way I can write a customized tactic 'symmetric_apply H' which applies either H or the reversed version of H, and fails if both fail.
(2) Once (1) is done, the proof statement of the remaining 2 subgoals becomes exactly identical (using 'symmetric_apply' instead of apply).
Then is there a way, I could use the tactical ';' with the assert statement - Coq doesn't seem to be allowing me to do so?
Or if there is some other way of avoiding the code duplication, that would be great.
With regards,
Ashish
- [Coq-Club] How to avoid code-duplication in this proof?, Kumar, Ashish, 09/13/2020
- Re: [Coq-Club] How to avoid code-duplication in this proof?, Jasper Hugunin, 09/13/2020
- Re: [Coq-Club] How to avoid code-duplication in this proof?, Kumar, Ashish, 09/14/2020
- Re: [Coq-Club] How to avoid code-duplication in this proof?, Jasper Hugunin, 09/13/2020
Archive powered by MHonArc 2.6.19+.