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: Tue, 30 Jun 2020 10:29:25 +0200
- Authentication-results: mail3-smtp-sop.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-wm1-f50.google.com
- Ironport-phdr: 9a23:VafinRa7MahUn8GKhOCv6lH/LSx+4OfEezUN459isYplN5qZpsy5Zh7h7PlgxGXEQZ/co6odzbaP7ua6ATVIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfLN/IA+ooQnNq8UdnJdvJLs2xhbVuHVDZv5YxXlvJVKdnhb84tm/8Zt++ClOuPwv6tBNX7zic6s3UbJXAjImM3so5MLwrhnMURGP5noHXWoIlBdDHhXI4wv7Xpf1tSv6q/Z91SyHNsD4Ubw4RTKv5LptRRT1iikIKiQ5/XnKhMJugqJVoBGvqRJxzIHbYo6aKOFzcbnBcd4AX2dNQshcWi5HD4ihb4UPFe0BPeNAooTgo1sBtwa+ChSyC+z11z9HnmH73akg1OQkDw7G2hAgFM8JvXvIqNX6KqISXv6zzKnU1znMdPdW1i3g6IfVbB8uu+yMUKlzccXP0kkjDR3KjlGOpoz7ITyVzf4Bs3Cc7+pkVeOvl3AopB1xojipx8csk5TJiZwPxlDK7yV02YA4LsC3R0Bne9CrCodQtz2EOItsRMMvW2NltSU4x7AFp5O2fisHxpQkyhPfafGKb4aG7xHsWeufIjp1h25oda67ihqu70StxfPwWMm13VtLsCZIltrBuHAL2hfO5MaHTf598V2g2TaJzw3T6+dEIVo1laXBMZIhzKQwm5wOukrABi/7gFv6gLOSe0k++eWl6/7rbqj4qpKfLYN5ih3yPrwwlsOlHeg0Lw0DUHSA9uig1LDu+E70T6hUgvA4l6TVrY7WKdgHqqO8GABY0Zss6xi6Aji6ztgVnXcKIVdbdx2Zk4TmIFTDLfPlAvexnVihlipgyercMb37GJrNK2DOkLf/crZ57E5R0A8zwspe55JQE70ALvfzVlLouNzWDhI1Lxa4w+ngCNV62YMeXXyADrWFP6PVtF+E/uMvI++Sa48JoDvxNeQp6vr0gXI6mVIRZ7Sl0YUUZXyiHvlqP12VYX/2jdcAFWcKsBA+TOvviFCaTTFTY2i9X6ci6TE9FIKqF5zMRoS3j7ycwSi0AIdZZn1dB1CPD3jobJ+IVOkIaC2MPM9ujCcEWaK5S48m0RGvtBP6xKR7IerU/C0YtIvj1MVr6OHJmxEy7yR4D96B3GGVU2F0gmQISicq06B4uExx00uM0axlg/NDDtFT/PNIUgIiNZHG1eB6CtbyWhjAftiTUlqmTM+mUnkNSYc6xMZLaEJgEf2jiArC1mykGew7jbuOUbYw+7/Q0nHsEO15SnPL0rVp21IiT85CM3HgjKp26gTeDpPhkEiC0auueLoRx2jV82OS0WeFvEdZSRN9F6vfCyNMLnDKpMj0sxuRB4SlDq4qZ1MYlJyyb5BSY9istm1oAffuPNOEPjC0kma0QAmNn/aCMdKsdGIa0yHQTkMDllJLpCfUBU0FHi6k5lnmInlrHFPrbVnr9LMv+nC2VQk5ywyUYlYnz72x6wIYjvyaSuoO0/QKonV58mkmLBOGx9vTTuG4iU95ZqwGMIE+7UwB2GbUqQFmeISnK7F+i1UedQVuok6o2Q8lUog=
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+.