coq-club AT inria.fr
Subject: The Coq mailing list
List archive
Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions
Chronological Thread
- From: Erik Martin-Dorel <e.mdorel AT gmail.com>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions
- Date: Wed, 8 Jul 2020 21:32:48 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=e.mdorel AT gmail.com; spf=Pass smtp.mailfrom=e.mdorel AT gmail.com; spf=None smtp.helo=postmaster AT mail-ed1-f67.google.com
- Ironport-phdr: 9a23:hDgWKB9zO/O1EP9uRHKM819IXTAuvvDOBiVQ1KB+0+gUIJqq85mqBkHD//Il1AaPAdyFrasbwLON4+igATVGvc/c9ihaMdRlbFwssY0uhQsuAcqIWwXQDcXBSGgEJvlET0Jv5HqhMEJYS47UblzWpWCuv3ZJQk2sfQV6Kf7oFYHMks+5y/69+4HJYwVPmTGxfa5+IA+5oAnMt8Qam5ZuJ6Q+xhfUrHZFePldyWd0KV6OhRrx6dq88Z55/yhMp/4t8tNLXLnncag/UbFWFiktPXov5M3suxnDTA+P6WUZX24LjBdGABXL4Q/jUJvpvST0quRy2C+BPc3rVr80Qiit771qSBDzligKMSMy/XzNhcxxiKJbpw+hpwB6zoXJboyZKOZyc6XAdtwdWGRBQ91RVzRfDYygc4sBAe0BPeNCoIn8oVsFsB+yCAaoCe/qzDJDm3340rAg0+k5Hg7G0g4vH8gOvnrar9v7KbkcXvyuwabS0TnOdelb1Svh5IXKdB0qvPGCXah3ccrU0UQhGBnFjlSTqYf4OD2azP4Ns3Sa7+pmTO6hhWknqxtvrTir28whjZfGipgQyl/Z8iV52pg6JdmjRU50ZN6rCppQtyWAO4RqRcMiRnhltSAnwbIJpZC1ZjIFyIg7xxHBcfyHdZCF7g7tWuuNLjp1hnxodr2xihuy8kWt1uPxWte13VtUoSRIlsXAum4D2RHS5cWLV/Vz8Eeh1DuT2Q3e6eFKLV07m6fdNpUvzLkwlp8JvkTCGC/7gEr2jK6KdkUk5+in8P7rYrThppOELYB0ixr+Mrg0lsywBuQ0KAoOX3CD9eS9zr3j/FH5TK9Ejv0siqXZtYrVJd4Hpq64BQ9Zy5ss6xGlDzi41NQUh34HLEhKeB+BkoPnOEnOLejmAfujh1mgijRmyvDcMrH/HpnALWLPnbbjcLt79kVS0hA8zcpF6JJRErwBIOz8Wkv2tNHACx82KQ20w+L+BNpjy4wSRHuDAqGYPa7Qq1OI6eUvI+6DZI8RpjnxMeQq5/nrjXMhmF8de7em3YcPZXymAvhrJ1+VbHnsj9sbD2sGogkzQPbrhVCASTJTYmy9X6M45jE1EoKmCoLDS5izj7Cb2Se0A5pWZnpYBVCICnroeICEVO0NaCKWOMNujjsEVb25R487yR6urBP6y6ZgLufM5iIYsovj2MFp6O3XiBE97id5D9+d0mGIV2F7hHkERz4w3KBloExy0E2P0aZig68QKdsG7PRQFww+KJT0zupgCtm0VBiSRNqRTEeaRYCrGzAyCNc42cMPZQNxHM+vijjO2THvB64SkfqMHpNn3Ljb2i3cPcd+g1PPzrUgiRwKRdFCMSXyi+h6+w/JCorhnECQlqLsfqMZin2evFyfxHaD6RkLGDV7Vr/ICCxOPxeEnZHC/krHCoSWJ/E/KAIYkJyNL6JLbpviilAUHK6+auSbWHq4niKLPTjNxr6Ia9C3KWAU3SGYBURd1g5NojCJMg8xAirnqGXbXmQ3RADfJnj0+Ow7k0uVC0o9zgWEdUpkjuPn9RschPjaQPQWjOsJ
Hi,
Just to give a few pointers that give further details on Laurent's suggestions:
- the name of the mathcomp library supported indexed sums is called bigop:
https://math-comp.github.io/htmldoc/mathcomp.ssreflect.bigop.html - the under tactic requires a Coq version ≥ 8.10, and is documented in:
- Coq's refman: https://coq.github.io/doc/master/refman/proof-engine/ssreflect-proof-language.html?highlight=under#rewriting-under-binders
- this presentation given at the Coq Workshop 2019:
Best regards,
Erik MD
Le mer. 8 juil. 2020 à 21:11, Laurent Thery <Laurent.Thery AT inria.fr> a écrit :
Hi,
if you are using intensively indexed sums I would recommend to use the
mathcomp library. It has lots of support for indexed sums.
You can also only use the ssreflect tactic language extension where
there is a under tactic that does exactly what you want:
Require Import List PeanoNat.
Require Import ssreflect.
Goal forall l, map (fun x => 2 + x) l = nil.
intros l.
under map_ext do rewrite Nat.add_comm.
Otherwise you can mimic it using erewrite.
For example:
Require Import List PeanoNat.
Ltac map_tac r :=
erewrite map_ext; [idtac |
let x := fresh "x" in
intros x; rewrite r; apply refl_equal].
Goal forall l, map (fun x => 2 + x) l = nil.
intros l.
map_tac Nat.add_comm.
Hope this helps!
--
Laurent
--
- [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions, Agnishom Chattopadhyay, 07/08/2020
- Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions, Laurent Thery, 07/08/2020
- Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions, Erik Martin-Dorel, 07/08/2020
- Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions, Agnishom Chattopadhyay, 07/08/2020
- Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions, Laurent Thery, 07/08/2020
- Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions, Agnishom Chattopadhyay, 07/09/2020
- Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions, Laurent Thery, 07/09/2020
- Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions, Agnishom Chattopadhyay, 07/09/2020
- Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions, Kyle Stemen, 07/09/2020
- Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions, Kyle Stemen, 07/09/2020
- Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions, Laurent Thery, 07/09/2020
- Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions, Agnishom Chattopadhyay, 07/09/2020
- Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions, Laurent Thery, 07/08/2020
- Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions, Agnishom Chattopadhyay, 07/08/2020
- Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions, Erik Martin-Dorel, 07/08/2020
- Re: [Coq-Club] Rewriting inside map expressions to manipulate finite/indexed sum expessions, Laurent Thery, 07/08/2020
Archive powered by MHonArc 2.6.19+.