coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Jonathan Leivent <jonikelee AT gmail.com>
- To: Coq Club <coq-club AT inria.fr>
- Subject: [Coq-Club] why are Coercions restricted to names?
- Date: Wed, 24 Feb 2016 11:33:36 -0500
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jonikelee AT gmail.com; spf=Pass smtp.mailfrom=jonikelee AT gmail.com; spf=None smtp.helo=postmaster AT mail-qg0-f41.google.com
- Ironport-phdr: 9a23:KcfEUxNaWGwG9TzjFEEl6mtUPXoX/o7sNwtQ0KIMzox0KPv5rarrMEGX3/hxlliBBdydsKIbzbeG+PC8EUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ35vxirD5q8GbSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6LoJvvRNWqTifqk+UacQTHF/azh0t4XXskzoShLHzX8BWC1CmR1RRgPB8RvSX5HrsyK8uPAriweAOsijb7cyUCii5qEjbBLplioBK3Zt8mbRi899iK9WiB2krh17hYXTZdfGZ7JFYqrBcIZCFiJ6VcFLWnkEW9vkYg==
This is a follow-up to the "overloading natural number notations for user types" thread.
Suppose one has a generic inductive type, such as:
Inductive foo(S : Set) : Set :=
| Foo(x : S).
And then wishes to declare coercions from various Sets, for example nat, to the corresponding foo. Coq does not allow the following:
Coercion (Foo nat) : nat >-> foo.
as it requires that the Coercion command's first arg is a name. It also doesn't allow using implicits, as in:
Arguments Foo {S} x.
Coercion Foo : nat >-> foo.
Instead, one must use an intermediate function for the coercion, such as:
Definition nat2foo := Foo nat.
Coercion nat2foo : nat >-> foo.
Why is there this restriction? Why doesn't Coq allow partially parameterized functions as coercions?
Note that this restriction would not be so bad if there was a way to declare nat2foo as "always unfolding". Meaning, not just something like "Strategy expand [nat2foo].", but that nat2foo is always immediately unfolded - that it behaves almost like a notation. Otherwise, consider a rewrite rule such as:
Variables F G : (foo nat) -> nat.
Axiom rw : F 1 = G 2.
Because rw was defined using the nat2foo coercion, it can't handle cases where nat2foo doesn't appear:
Goal F 1 = G 2.
cbv. (*unfolds nat2foo*)
Fail rewrite rw.
-- Jonathan
- Re: [Coq-Club] overloading natural number notations for user types, (continued)
- Re: [Coq-Club] overloading natural number notations for user types, Beta Ziliani, 02/21/2016
- Re: [Coq-Club] overloading natural number notations for user types, Beta Ziliani, 02/21/2016
- Re: [Coq-Club] overloading natural number notations for user types, Jason Gross, 02/21/2016
- Re: [Coq-Club] overloading natural number notations for user types, Pierre-Marie Pédrot, 02/21/2016
- Re: [Coq-Club] overloading natural number notations for user types, Jason Gross, 02/22/2016
- Re: [Coq-Club] overloading natural number notations for user types, Jonathan Leivent, 02/22/2016
- Re: [Coq-Club] overloading natural number notations for user types, Jason Gross, 02/22/2016
- Re: [Coq-Club] overloading natural number notations for user types, Gregory Malecha, 02/22/2016
- Re: [Coq-Club] overloading natural number notations for user types, Jonathan Leivent, 02/22/2016
- Re: [Coq-Club] overloading natural number notations for user types, Jonathan Leivent, 02/24/2016
- [Coq-Club] why are Coercions restricted to names?, Jonathan Leivent, 02/24/2016
- Re: [Coq-Club] why are Coercions restricted to names?, Jason Gross, 02/24/2016
- Re: [Coq-Club] why are Coercions restricted to names?, Jonathan Leivent, 02/25/2016
- Re: [Coq-Club] overloading natural number notations for user types, Pierre-Marie Pédrot, 02/21/2016
Archive powered by MHonArc 2.6.18.