Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] A reduction for the nat recursor

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] A reduction for the nat recursor


Chronological Thread 
  • From: roux cody <cody.roux AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] A reduction for the nat recursor
  • Date: Tue, 2 Jan 2018 07:47:53 -0500
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=cody.roux AT gmail.com; spf=Pass smtp.mailfrom=cody.roux AT gmail.com; spf=None smtp.helo=postmaster AT mail-vk0-f50.google.com
  • Ironport-phdr: 9a23:8hMZwBIQFD0QD53hGtmcpTZWNBhigK39O0sv0rFitYgRK/nxwZ3uMQTl6Ol3ixeRBMOHs6sC07KempujcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgppPOT1HZPZg9iq2+yo9JDffxhEiCChbb9uMR67sRjfus4KjIV4N60/0AHJonxGe+RXwWNnO1eelAvi68mz4ZBu7T1et+ou+MBcX6r6eb84TaFDAzQ9L281/szrugLdQgaJ+3ART38ZkhtMAwjC8RH6QpL8uTb0u+ZhxCWXO9D9QLYpUjqg8qhrUgflhyUJNzA5/m/ZidF+grxHrx+6vRNz35TZbZuJOPZifK7Qe84RS2pbXsZWUixMGpm8b4wSD+sOIO1Xs479qEYOrBCjAgSjGOTvxSJIh3Psx6061PkhEA7d0QwvGtIBqnXUrNHvOKgOVuC1ybDFwDPeZP1Y3jf97ZLHchEnofyUUrJwcNbRyUkyFwzelFmftYvlPzaT2+8QsGab9/JtWfyzh2MjsQ18oTiiyt0yhoXUiI8Z0FDJ+Tl/zY0oP9O3UlR7bsShEJZItyGVKY92QsQ6TmFtoik6y7kGtYelfCgJ1Jgr3hDfZvybf4SS7RLjU+GRITh8hH17Yr6wmxGy8U24xu39UMm7zkpKozJbntXQsn0BzR/e58idRvdj40us1yyD2gDP5u1cJEA7j6vbK5ovwr4qkZoTtFzOETPxmErrjK6abF8k+u+16+XoebjmqZqcOJV1igH6KKghhsu/AeEgPggUQ2eb4fi81KHk/UDhXLpKieQ2nrDFv5DeOMQUvbW0AxRV04Ym8xawFS2q0NUenXkdLVJKYgiLj4bzOwKGHPetBvCmxl+ojT1DxvbcP7SnDI+eAGLEleL7eqtto0VbxBt7mdtY64MSELYcMNr8X0bwsJrTCRpvYF/8+PruFNgojtBWYmmIGKLMaK4=

Hi Jasper!

    This rule is sometimes called "eta for inductives" or "commutative conversions". In some versions it may break confluence, and in general is quite difficult to implement in Coq.

See also this discussion:  https://github.com/coq/coq/issues/3119

If you post your complete example, someone may have a workaround which does not require such a powerful conversion rule!

Best,
Cody

On Tue, Jan 2, 2018 at 2:20 AM, Jasper Hugunin <jasperh AT cs.washington.edu> wrote:
Hello,

I ran into the following function:
(fix shift n := match n with O => a | S m => shift m end) : nat -> A
which clearly on any concrete n reduces to a.

It would be very convenient if this was judgmentally equal to (fun _ => a).
Of course, this is not implemented in Coq, but I haven't been able find any references discussing such a reduction. Does anyone know what the cost of adding such a reduction would be?
(does it break decidable type-checking, or introduce unreasonable computational overhead?)

Where this comes from, is that I actually have a family of types A : nat -> Type, along with
forall n, A n = A (S n), and a0 : A 0. My function then looks like (fun n => nat_rect A a0 (coerce) n),
but for some specific instances A is actually independent of n, and the equalities are eq_refl.
In the general case, I don't see how to do a useful reduction, but when given such nice data I would
have liked to return just a, independent of n.

- Jasper Hugunin





Archive powered by MHonArc 2.6.18.

Top of Page