coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Gregory Malecha <gmalecha AT gmail.com>
- To: Coq Club <coq-club AT inria.fr>
- Subject: [Coq-Club] simpl should reduce on constructor?
- Date: Sat, 29 Oct 2016 17:46:18 +0000
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gmalecha AT gmail.com; spf=Pass smtp.mailfrom=gmalecha AT gmail.com; spf=None smtp.helo=postmaster AT mail-vk0-f46.google.com
- Ironport-phdr: 9a23:hbizMB+H9urDe/9uRHKM819IXTAuvvDOBiVQ1KB91ewcTK2v8tzYMVDF4r011RmSDN+dtK8P0rOI+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2WVTerzWI4CIIHV2nbEwud76zRdOZ1p3pn8mJuLTrKz1SgzS8Zb4gZD6Xli728vcsvI15N6wqwQHIqHYbM85fxGdvOE7B102kvpT41NdZ/i9Ro/Ms8dJbGeW/JvxgDO8QMDNzGGcsrObvqBOLGQCI/z4XVngcuhtOGQnMqh/gCMTfqCz/48Vn1SadJ9y+aLkwVD+i5u8/RxrhjCoMNzcR/2Tei8g2h6Ve9kHy7ydjypLZNdnGfMF1ebnQKJZDHTJM
Hello --
I have three functions that look roughly like this:
Definition foo {a b : Type} (F : Type -> Type) (pf : a = b) : F a -> F b :=
match pf with
| eq_refl => fun x => x
end.
Definition bar {a b : Type} (pf : a = b) : a -> b :=
@foo a b (fun x => x) pf.
Definition baz {a b : Type} (pf : a = b) : b -> a :=
@bar b a (eq_sym pf).
I am writing the following annotations for simpl.
Arguments foo {_ _} _ !pf _.
Arguments bar {_ _} !pf _.
Arguments baz {_ _} !pf _.
And I get the following behavior:
Eval simpl in @foo nat nat (fun x => x) eq_refl 1. (* = 1 *)
Eval simpl in @bar nat nat eq_refl 1. (* = 1 *)
Eval simpl in @baz nat nat eq_refl 1. (* = baz eq_refl 1 *)
The first two of these are exactly what I expect, but the third seems wrong. If I understand correctly, the documentation says that baz should be reduced if the proof argument is a constructor (which it is: eq_refl). Once that unfolds, eq_sym should reduce since it is applied to a constructor (just to be sure I added an: Arguments eq_sym {_ _ _} !_.), and then bar should reduce and finally foo should reduce.
Is there any work-around that does not involve inlining the definition of `foo` inside `baz`?
Thanks.
--
- gregory malecha
gmalecha.github.io
- [Coq-Club] simpl should reduce on constructor?, Gregory Malecha, 10/29/2016
- Re: [Coq-Club] simpl should reduce on constructor?, Maxime Dénès, 10/29/2016
- Re: [Coq-Club] simpl should reduce on constructor?, Maxime Dénès, 10/29/2016
- Re: [Coq-Club] simpl should reduce on constructor?, Gregory Malecha, 10/30/2016
- Re: [Coq-Club] simpl should reduce on constructor?, Maxime Dénès, 10/29/2016
- Re: [Coq-Club] simpl should reduce on constructor?, Maxime Dénès, 10/29/2016
Archive powered by MHonArc 2.6.18.