coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Blaudeau Clément <clement.blaudeau AT kes.eleves.polytechnique.fr>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Simplify proofs with nested pattern matching (cases explosion)
- Date: Wed, 1 Jul 2020 01:12:53 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=clement.blaudeau AT kes.eleves.polytechnique.fr; spf=None smtp.mailfrom=clement.blaudeau AT kes.eleves.polytechnique.fr; spf=None smtp.helo=postmaster AT mail-ed1-f54.google.com
- Ironport-phdr: 9a23:mbQBZx+FI+59eP9uRHKM819IXTAuvvDOBiVQ1KB+0+0SIJqq85mqBkHD//Il1AaPAdyFraodwLOI++C4ACpcuMvH6ChDOLV3FDY9wf0MmAIhBMPXQWbaF9XNKxIAIcJZSVV+9Gu6O0UGUOz3ZlnVv2HgpWVKQka3OgV6PPn6FZDPhMqrye+y54fTYwJVjzahfL9+Nhq7oRjQu8UMnYduN6k9xgbIr3BVf+ha2X5kKUickhrh5sq85oJv/zhVt/k868NOTKL2crgiQ7dFFjomKWc15MPqtRnHUwSC42YXX3sVnBRVHQXL9Qn2UZjtvCT0sOp9wzSaMtbtTb8oQzSi7rxkRwHuhSwaKjM26mDXish3jKJGvBKsogF0zoDIbI2JMvd1Y6XQds4YS2VcRMZcTzFPDIOiYYsBDOQPM+hXoIb/qFQSthaxHxWgCfn1xzNUiHL736s32PkhHwHc2wwgGsoDvWnQrNrvKacdTP66w7PVzTrbcf5W3S366I3WfRAnvfGHQLV9ftbVyUYxEgPKkFOQqZD/MzyO0uQCqXWb4Pd+Wu21lm4qsAJxrSa0xss2lIbJgpwayk7a+iVi2oo1Pdq4SEp7YN64DpRfqyGaN413QsM7XmFnpjw2yrMcuZOieiUB1ZsoyQLFZfOdb4iI/gzsVPyXITpgmn5pZK6yiRm2/EWjyODwS8m53VhFoCZbk9TBt24A2RLT58SZSfZx4Ees1CqS2w3c6uxKL0I5mKXUJZMixrM+mZweulnNEC/xnUX5lq6WdkM89+ip7eTneLTmqYWGO496kAHzNLkllM+nAekgLAQCQ2yW9f6/2bDj50H1XqlGg/4snqTZv53WPdoXqbSlDwNI14ss9w2wAyum3dkdnnQIMUxJdRyCgoT0JV3CPOz0APKkjFmvjThryfXLMaH/DpjNIHXOlanucqhh50FHzQc+zs1Q55xKBrwHPfn9QFX+tMbCAR88KwG0w/joCNF61o4GXGKAGK6ZMKfLvVCW++0jPvCAZIEVtTvyMfQl6PnujXg2mV8ZY6alx4cYaHe9Hvh+IkWZZ2TjgssZHGsUogYzSPbmhV6CXDJJeXq+Q6Ex6is7BY+pFYvDQ5qigL2F3Ce1BJ1WYWVGB0iQHnfsaYqEXukDaCSOIsN7iTMEUaKuS5I82h6wrgD61qFqLunK9S0Dr57sytx16PPNlR4s7jx4Fdyd02aJT2B0gmMHWSM53KB5oUx801eDzLZ3j+ZWFdxJ//9JSBs1NYbAz+xmDND/Qh7OftCQSFq/XtqmBSwxQckqzt8VY0d9Hs2igQrZ0yqrBb8Vjb2LC4Yu/qLSxXiib/p6nn3Bzewqi0QsaspJL2yvwKBlpCbJAIucuUGQiqqnfLkr9ypM8WqF0SLat0VVVQN2TePPWXkCakbfsPz661iEQrujF7k8dBNGzd+eJ6BKbNzwkFgASu21a4eWWH64h2rlXUXA/biLdoe/IzxMjhWYM1ANlkUoxVjDMAE/Aim7pGeEXW5tGEmpbkfh7+Rl7mu8Sl4owgqKaUx4yrfz9ARH3aXBGcNW5aoNvWIakxsxHFu52IiLWd+Jpg4kcakFJN1gvBFI0mXWswE7NZulffg72gwuNj9vtkar7C1ZT51amJJ7/nAn10x/La+G3UgHbzSczIz9Mb3RK3Dv8VahcfyO1w==
Thank you for your answer !
I’ve tried to use Function
,
but Coq cannot create the inductive predicate R_is_valid
as soon as I add the non-trivial cases :
is_valid is defined
is_valid is recursively defined (decreasing on 1st argument)
Warning: Cannot define graph(s) for is_valid [funind-cannot-define-graph,funind]
Warning: Cannot build inversion information [funind-cannot-build-inversion,funind
However, to me, my function looks like a valid pattern matching tree without dependent type (the two issues mentioned in the documentation). The cases that are not accepted by Coq are of the following form :
| N b1 (((N b2 _ ) as d2)::((N b3 _) as d3)::nil) => (* sequence of boolean tests *) && (is_valid d2) && (is_valid d3)
Am I missing something ?
Thank you again,
Best,
Clément
Le 29/06/2020 à 20:29, Julien Forest a écrit :
On Mon, 29 Jun 2020 18:08:34 +0200 Xavier Leroy <xavier.leroy AT college-de-france.fr> wrote:
On Mon, Jun 29, 2020 at 5:39 PM Gaëtan Gilbert < [...] [...] That's a very good trick, and it can be automated using Function instead of Definition, see ttps:// coq.inria.fr/distrib/current/refman/language/gallina-extensions.html#coq:cmd.function Function is_valid b := match b with | x00 | xff => true | _ => false (* 254 cases hidden in this _ *) end. will generate the inductive predicate R_is_valid and the proofs of equivalence with the is_valid function. Hope this helps, - Xavier Leroy
Just to illustrate both Gaëtan and Xavier ideas using Function. Cheers, Julien Forest
[...] [...] [...] [...] [...] [...] [...] [...] [...] [...] [...] [...] [...] [...] [...] [...] [...] [...] [...]
- Re: [Coq-Club] Simplify proofs with nested pattern matching (cases explosion), Blaudeau Clément, 06/30/2020
- Re: [Coq-Club] Simplify proofs with nested pattern matching (cases explosion), Blaudeau Clément, 07/01/2020
- Re: [Coq-Club] Simplify proofs with nested pattern matching (cases explosion), Pierre Courtieu, 07/01/2020
- Re: [Coq-Club] Simplify proofs with nested pattern matching (cases explosion), Yves Bertot, 07/02/2020
- Re: [Coq-Club] Simplify proofs with nested pattern matching (cases explosion), Blaudeau Clément, 07/01/2020
Archive powered by MHonArc 2.6.19+.