coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Tej Chajed <tchajed AT mit.edu>
- To: coq-club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] getting a definition as an equality theorem
- Date: Tue, 13 Nov 2018 07:48:37 -0500
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=tchajed AT mit.edu; spf=Pass smtp.mailfrom=tchajed AT mit.edu; spf=None smtp.helo=postmaster AT dmz-mailsec-scanner-2.mit.edu
- Ironport-phdr: 9a23:BQAjqhPJBCI7kUdHm+sl6mtUPXoX/o7sNwtQ0KIMzox0Lfz4rarrMEGX3/hxlliBBdydt6obzbKO+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZLebxlKiTanfb9+MAi9oBnMuMURnYZsMLs6xAHTontPdeRWxGdoKkyWkh3h+Mq+/4Nt/jpJtf45+MFOTav1f6IjTbxFFzsmKHw65NfqtRbYUwSC4GYXX3gMnRpJBwjF6wz6Xov0vyDnuOdxxDWWMMvrRr0yRD+s7bpkSAXwhSgIOT428mHZhMJzgqxGvhyuuwdyzJTIbIyPLvdyYr/RcNEcSGFcXshRTStBAoakYoUREeUBP/tTopf9p1QUrxuxGxSjD/7oxz9UmnD23bc10+Y/Hg7bxwEgGtMOsGjOoNrrKagSTPm4wa/VxjvAd/NbwSrx5YvSfh0lu/2AQ7J9fdDMxUQhDw/JkEmcpIj/Mz6W1ukBqXaX4/R+We61lmIqqRx9rz6yzck2kIbJnJgaylXc+CV53ok1Idq4RVZmbt6hEZpcriSaOJF3QsMmWGFnpjo1xqQduZGnZicKzpInyADFa/CebYSE+BfjVOeNITtimn1qZa+/iw6z8Uim1OL8StG53EtJoyZfltTArG4B2hzJ5sSaRPZx5kKh1iyO1wDX5OFEO0c0la/DJp493rEwloAcsUbdESDrg0j2ia6Wdlk+9ue29uvnf63qpoWAOI9slgH+LqMul9SjDuQ/KwgCRnSU+eCh1LL45kD5W7VLjvgukqbDqpzaJMIbprS4AwBPyIoj5Qy/XH+a14ETmmBCJ1ZYclrThI/wflrKPfrQDPGlgl3qni09lN7cObi0PpjPZlPDmbXscf4p90VcwQg+wfha5o4SB70cdqGgEnTtvcDVW0dqeze/xPzqXY0kh9EuHFmXC6rcC5v89FqB5+YhOe6JNd0QuSq7JvQ4tae30S0J3GQFdKzs5qM5LWiiF6U0JkSFJ3fgn4VZSDpYjk8FVOXvzWa6f3tTanK1BPtu6jQpTYevDIPYS4vom7eI2iG2BNgMIGVHFhaBHWq6L4g=
Coq doesn’t create such an equality for you. As Laurent explained, the theorem is just reflexivity and in many situations Coq will do the conversion for you.
There are some situations where such equalities are nonetheless useful, for controlled unfolding in combination with marking things opaque or in rewriting hint databases; here’s a way to produce roughly the statement you want automatically, wrapped up nicely in a tactic-in-term inside a notation (this trick is broadly useful when you want to write “functions” in Ltac):
Local Tactic Notation "unfolded_eq" constr(pf) :=
let x := (eval red in pf) in
exact (eq_refl : (pf = x)).
Notation unfolded_eq pf := ltac:(unfolded_eq pf) (only parsing).
Definition foo x y z := x + y + z.
Definition foo_eq := unfolded_eq foo.
Check foo_eq.
(*
foo_eq
: foo = (fun x y z : nat => x + y + z)
*)
On Tue, Nov 13, 2018 at 2:17 AM Jeremy Dawson <Jeremy.Dawson AT anu.edu.au> wrote:
Hi coq-club,
Having made a definition f x y z = a b c
how do I get this as an equality theorem that can be used to rewrite
a b c to f x y z?
(I realise I can set it out as a lemma and prove it using unfold, but
I'm assuming it's already there as a theorem that I just need to find
out how to get hold of it)
thanks
Jeremy
- [Coq-Club] getting a definition as an equality theorem, Jeremy Dawson, 11/13/2018
- Re: [Coq-Club] getting a definition as an equality theorem, Laurent Thery, 11/13/2018
- Re: [Coq-Club] getting a definition as an equality theorem, Tej Chajed, 11/13/2018
- Re: [Coq-Club] getting a definition as an equality theorem, Dominique Larchey-Wendling, 11/13/2018
- RE: [Coq-Club] getting a definition as an equality theorem, Jason -Zhong Sheng- Hu, 11/13/2018
Archive powered by MHonArc 2.6.18.