coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: "Soegtrop, Michael" <michael.soegtrop AT intel.com>
- To: "coq-club AT inria.fr" <coq-club AT inria.fr>
- Cc: Théo Zimmermann <theo.zimmi AT gmail.com>
- Subject: RE: [Coq-Club] Making COq do more of the search work
- Date: Wed, 14 Mar 2018 13:17:49 +0000
- Accept-language: de-DE, en-US
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=michael.soegtrop AT intel.com; spf=Pass smtp.mailfrom=michael.soegtrop AT intel.com; spf=None smtp.helo=postmaster AT mga07.intel.com
- Ironport-phdr: 9a23:WbAUsRPIw1zI15TuFx0l6mtUPXoX/o7sNwtQ0KIMzox0Ivn5rarrMEGX3/hxlliBBdydt6ofzbKO+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZLebxlGiTanfb9+MAi9oBnMuMURnYZsMLs6xAHTontPdeRWxGdoKkyWkh3h+Mq+/4Nt/jpJtf45+MFOTav1f6IjTbxFFzsmKHw65NfqtRbYUwSC4GYXX3gMnRpJBwjF6wz6Xov0vyDnuOdxxDWWMMvrRr0yRD+s7bpkSAXwhSkHKTA37X3XhMJzgqJVoh2hpgBwzIHPbY6PKPZzernQcc8GSWZcWMtaSixPApm7b4sKF+cNM/tWr47jqFsBsRu+Hw6sBPv3xjRVgXH23LE10+Q7Hg7Y2AwsEc8FvXPRrNX0KKgSUfq6w7fMzTnZdPNW3iny6IfUchA7pvGMRal9ccvXyUkzCQzFik+cppDiPzOQz+kAtXWQ4eRnVeKqkWEnqgdxryCuxscqlonGmIYVxkrZ+ipnxos+ON62SFZjbNK5HpZduDuWO5Z4T84tWW1kpSg3x7wctZKmYCQG1IwrywPeZvGJaYSF7BzuWPyPLTp2gH9pYq+zihWv/US41+HxV8253ExUoidFndTArG4B2wbO5sSbTPZ2412v1iyV1w/J7+FJOUA0mrTfK54m2rMwk5UTvl7fEiL0gkn2jamWdlk69eis8ejofrLmppqEO491jAHxLLgul9SiDek2PQUCRXWX9Oqz2bH54EH0TrRHgucrnqXFrJzWPcEbqbS4Aw9R3IYj8RG/DzK+3dQdnHkIMFJFdwiZgIjtIV3OO/f4Aumwg1SwijdrwOjGM6bgApXLMnjMjrPhcaxh5E5bzQo/1cpf6I5MCrEdPPLzXVf8u8DfDh8gKgC73+LnCMhm2Y4FQmKOAqqZMLvIvlOS5+IvJfOMZI4PtzrnJfgl/a2msXhs01QaZOyi2YYdQHG+BPVvZUuDKzK4idAYVGwOowAWTerwiVTEXyQFNFioWKdprAo8BY26F4DbAsiIgbeB1Sq/VNUCY2FNClmBFTHzcIiLR+0LcAqTJNNslnoPUr33GNxp7g2nqAKvk+kvFeHT4CBN7cuyhugw3PXakFQJzRIxCs2c12+XSGQtxzEJQSM72OZ0pkkvkw7fg5g9uORREJlo390MSh0zbMeOzupmBtS0UQXELI/QFQSWB+6+CDR0deofht8DZ0EkRIengRmbgGyrBaMYk/qAA5lmqq8=
Dear Théo, Armaël,
yes, I sticked with the current Ltac implementation waiting for Ltac-2. As I said, it is kind of a dirty hack and also looks a bit ugly in the code, but it works and for the time being I can live with it.
But let me put some more words on the search strategy I use – and for which I think it makes sense to have some sort of native support in Coq.
The reasoning behind splitting proof search in forward (hypothesis based) and backward (goal based) search is as follows:
1.) Assume that the total search depth is N and you have an average branching factor (number of possibilities tried at each step) of B. If you do just forward or backward search, you need B^N apply tries. If you do half of the steps forward and half of the steps backwards, the number of things to try is just 2*B^(N/2), which is 2x the square root of the former.
An example: it is quite feasible (not really efficient but doable) to solve a Rubic’s cube by brute force search from both ends. Usually it can be solved in 14 steps where each steps has 27 possibilities (3 rotation axes x 3 slices x 3 possible angles). If you search from one end (from where you are towards the goal or from the goal to where you are), there are 27^14 steps, which is 10^20. If you search from both ends, there 2x27^7 steps which is 2*10^10. But in practice point 2 below gives a much better improvement, and both can be combined.
2.) For most lemmas the branching factor B is different for forward and backward search. If you have some lemmas with very specific conclusion, but very generic hypothesis, the backward branching factor might be 1 (only one lemma applies to any given goal) while the forward branching factor would be much larger (many lemmas can be instantiated in the given context, but the conclusions are useless). For lemmas with very specific hypothesis but very general goal, the opposite is true. So you end up with BF^NF + BB^NB as number of applies. Here BF and BB are the forward and backward branching factors, which are both much smaller than B. NF and NB are the forward and backward depth, which add up to N. BF^NF + BB^NB is usually orders of magnitude smaller than B^N, especially if lemmas are upfront designed such that they have a very small forward or backward branching factor. I sometimes use additional gating to ensure this. It is definitely much easier to get a lemma working efficiently in a hint database in one or the other direction than it is when one sticks to one search direction only. I use tracing and scripts to ensure that hint databases are well designed and lead on average to branching factors close to 1.
3.) Some lemmas don’t work at all in backward mode, e.g. if you can prove an equality from hypothesis using forward search and simplify the goal with a substitution, there is no way to see that this would be possible with backward search.
What would help for this strategy is native support for forward search and some hint database management/analysis tools, which give some estimates on branch factors or warn about cyclic applicability of lemmas.
Best regards,
Michael
Michael Soegtrop
Intel Deutschland GmbH |
- [Coq-Club] Making COq do more of the search work, Jim Fehrle, 03/12/2018
- RE: [Coq-Club] Making COq do more of the search work, Soegtrop, Michael, 03/12/2018
- Re: [Coq-Club] Making COq do more of the search work, Abhishek Anand, 03/12/2018
- Re: [Coq-Club] Making COq do more of the search work, Matthieu Sozeau, 03/12/2018
- RE: [Coq-Club] Making COq do more of the search work, Soegtrop, Michael, 03/12/2018
- Re: [Coq-Club] Making COq do more of the search work, Théo Zimmermann, 03/12/2018
- Re: [Coq-Club] Making COq do more of the search work, Armaël Guéneau, 03/13/2018
- Re: [Coq-Club] Making COq do more of the search work, Matthieu Sozeau, 03/13/2018
- Re: [Coq-Club] Making COq do more of the search work, Clément Pit-Claudel, 03/13/2018
- RE: [Coq-Club] Making COq do more of the search work, Soegtrop, Michael, 03/14/2018
- Re: [Coq-Club] Making COq do more of the search work, Armaël Guéneau, 03/13/2018
- Re: [Coq-Club] Making COq do more of the search work, Théo Zimmermann, 03/12/2018
- RE: [Coq-Club] Making COq do more of the search work, Soegtrop, Michael, 03/12/2018
- Re: [Coq-Club] Making COq do more of the search work, R. Pollack, 03/12/2018
- Re: [Coq-Club] Making COq do more of the search work, Matthieu Sozeau, 03/12/2018
- Re: [Coq-Club] Making COq do more of the search work, Abhishek Anand, 03/12/2018
- RE: [Coq-Club] Making COq do more of the search work, Soegtrop, Michael, 03/12/2018
Archive powered by MHonArc 2.6.18.