coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Samuel Gruetter <gruetter AT mit.edu>
- To: "coq-club AT inria.fr" <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] autorewrite neglects sub-patterns?
- Date: Mon, 11 Jun 2018 23:08:06 +0000
- Accept-language: en-US
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gruetter AT mit.edu; spf=Pass smtp.mailfrom=gruetter AT mit.edu; spf=None smtp.helo=postmaster AT dmz-mailsec-scanner-2.mit.edu
- Ironport-phdr: 9a23:Blq6xhJ3frU24+/iU9mcpTZWNBhigK39O0sv0rFitYgeKv7xwZ3uMQTl6Ol3ixeRBMOHs68C07KempujcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgppPOT1HZPZg9iq2+yo9JDffwVFiCChbb9uMR67sRjfus4KjIV4N60/0AHJonxGe+RXwWNnO1eelAvi68mz4ZBu7T1et+ou+MBcX6r6eb84TaFDAzQ9L281/szrugLdQgaJ+3ART38ZkhtMAwjC8RH6QpL8uTb0u+ZhxCWXO9D9QLYpUjqg8qhrUgflhicZOTAk7GHZhM9+jKxZrxKguxNxzIHbbZqJNPVlZK7RYc8WSXZDU8tXSidPApm8b4wKD+cZIOhXtYz9p0YQohu6GAKiBfnvyiJWiX/qwa01zf4hGhzB0QwvBdIOrWrbrMnpNKgMS+C416zIzTTfb/9Mxzjy9ZXIfwknrPqRU7xwds/RxlMuFwPDlliQpo3lPy+V1uQQqGeX9fZvVeWqi2Mhtgp/oSCvy98xhoTKnI4YzkrI+Tt5zYovONG1RlZ3bcO6HJZTrS2XOZd6TtkmTm1ypio3xL0LtYamcCULzJkr3QDTZvyIfoSS/x7vTvudLDR3iX9jZbmxnQy98VK6xe35TsS00EhFri5CktTUq38N0h3S5tGCSvRn/0eh3S2P2B7P5e1dOkA7ibDUK5gnwrEujJofqFrPEjXzmEX3kK+abFsr9fW16+j/Y7XmoIGTN5Nshw3jMakigMiyDf4mPgUORWSX5Oqx2KXm/ULjQbVKivM2krPesJDfPckbqbS5AxJL3YY/9xawES2m3c8dnXkGMFJJYgyIgJX0O13WOvD3Ee+/g0iwkDds3/3JIrrhAozUInfflLfhYK1y5lVHyAszyNBf/4hbBqsAIPL1QE/xtcbXAgU3MwyukK7bD4A33YQHHGmLH6WxMaXIsFbO6Phla72HY5ZQszLgIdAk4eTvhDk3gwlOU7Ou2M4sYXWlE/AuDF+EbGbwj81JRWgQowciUOHwoFiDTXhea2vkDPF03S0yFI/zVdSLfYuqmrHUhH7qTK0TXXhPDxW3KVmtcoyFX/kWbyfDcMpgjnoJWaXzEtZ9hyHrjxfzzv9cFsSR4jcR5MDm1cQz6uHOx0lrqG5ESv+F2mTIdFla22MFQzhthfJzpF44z16C1bN1iLlDHtVV4f5TF118MJ/AieF2FoKqVw==
"rewrite ... by tac" and autorewrite with hints of the form "... using tac"
do not backtrack to other matching occurrences if "tac" fails.
I think this is very unfortunate, but apparently that's the intended
behavior.
To get backtracking, there's an undocumented "rewrite*" and "autorewrite*",
but it seems that "autorewrite*" does not work:
https://github.com/coq/coq/issues/7672
On Thu, 2018-06-07 at 13:02 -0500, Kevin Hamlen wrote:
> Dear Coq users,
>
> I'm finding that "autorewrite" fails to consider rewriting opportunities
> within patterns that match a hint but fail it. Is this behavior
> intentional? Here's an example:
>
> Require Import NArith.
> Open Scope N.
>
> Hint Rewrite N.mod_small using assumption : mydb.
>
> Goal forall x y z, x < y -> (x mod y) mod z = x mod z.
> intros.
> Fail progress (autorewrite with mydb).
> (* This unfortunately fails to progress even though it could
> successfully rewrite "x mod y" to "x". It fails because it first tries
> rewriting "(x mod y) mod z" to "x mod y" and is unsuccessful, and then
> never looks for rewrite opportunities within the matched pattern. *)
>
> (* If I manually strip the "_ mod z" part, it finds the pattern and
> rewrites it: *)
> apply (f_equal (fun n => n mod z)).
> progress (autorewrite with mydb).
> reflexivity.
> Qed.
>
> Is there any work-around? This behavior unfortunately makes autorewrite
> useless for most of my patterns, forcing me to resort to much slower Ltacs.
>
> Cheers,
> Kevin
>
>
- [Coq-Club] autorewrite neglects sub-patterns?, Kevin Hamlen, 06/07/2018
- Re: [Coq-Club] autorewrite neglects sub-patterns?, Matthieu Sozeau, 06/07/2018
- Re: [Coq-Club] autorewrite neglects sub-patterns?, Kevin Hamlen, 06/08/2018
- Re: [Coq-Club] autorewrite neglects sub-patterns?, Matthieu Sozeau, 06/12/2018
- Re: [Coq-Club] autorewrite neglects sub-patterns?, Kevin Hamlen, 06/08/2018
- Re: [Coq-Club] autorewrite neglects sub-patterns?, Samuel Gruetter, 06/12/2018
- Re: [Coq-Club] autorewrite neglects sub-patterns?, Matthieu Sozeau, 06/07/2018
Archive powered by MHonArc 2.6.18.