Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] normalize all closed terms of a given type

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] normalize all closed terms of a given type


Chronological Thread 
  • From: Abhishek Anand <abhishek.anand.iitg AT gmail.com>
  • To: coq-club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] normalize all closed terms of a given type
  • Date: Thu, 15 Oct 2020 14:55:10 -0700
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=abhishek.anand.iitg AT gmail.com; spf=Pass smtp.mailfrom=abhishek.anand.iitg AT gmail.com; spf=None smtp.helo=postmaster AT mail-il1-f172.google.com
  • Ironport-phdr: 9a23:Ii4GWBUPrulrM0wDWQTMgRUmOQ3V8LGtZVwlr6E/grcLSJyIuqrYbRSGt8tkgFKBZ4jH8fUM07OQ7/m/HzJbqs/d4DgrS99lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUhrwOhBoKevrB4Xck9q41/yo+53Ufg5EmCexbal9IRmrrwjdrMgbjIVtJqosxRbEoWZDdvhLy29vOV+dhQv36N2q/J5k/SRQuvYh+NBFXK7nYak2TqFWASo/PWwt68LlqRfMTQ2U5nsBSWoWiQZHAxLE7B7hQJj8tDbxu/dn1ymbOc32Sq00WSin4qx2RhLklDsLOjgk+2zRl8d+jr9UoAi5qhNwzY7bYoGbOvR9cK3AY90VWXFMUdxNWyFbGI6wc5cDAugHMO1Fr4f9vVwOrR6mCASwH+zvyj5IhmT23aIk0OQqDB3L3Ao6ENIIrXvfsdL4O70JXuC1zanI1jXDYO1V2Tvn8ofIdAouofeRUr5qcMrRyFUvFwzeg1WfrIzqJTKV1uAXv2eH6OpgUPuihmg6oA5+vjah3N0jipXVho0L0FDE8z10zYI1KNGkVkN3f9CqHZVQuSybKYd6Xt4uTWFotig61LELt4K2cTQExZg62hPTdf6KfpSU7x/iW+icLjd1iW9kdb+5mh28/0+gyujmWcm11lZHtjZKkt7WtnALyRPT7syHRuFj8Ui8xDaC0R3Y5OJcIU0si6bXN5oszqQzm5cTq0jPAy77lUTsgKOLdEgo5O6l4Pn9bLr8vJ+TLYp0hxn+Mqswnsy/Bvw1Mg0UUGia/eSwzbzj/UnkTLlTgP06j6vUvI7AKcQUoa65BABV0oI95BqlEzim19EYkWEGLFJDZh2Hk5DkN0/SLP38F/uygFShnC12y/3HP7DtGIjBI3rdnLv5eLZy8U9cyA49zdBF4JJUD6kML+joVU/xtdzYFR85PBK3w+r9Etp90JkRWWSSDaODMaPSsEOI5u00LumDYY8aojf9K/w/6/Hyin85nEcRfbO10psPdHC4AvNmLl2Fbnrrm9cNCHsFvg4jTOPxk1CCSj5SZ3OqX60m/D07CYSmDZ3CRo+3mrCB0j27TdVqYTVNDUnJGnP1fc3QUPAVLSmWP8VJkzoeVLHnRZV3hj+0swqv4rBnL/HU9y5QnJTq0tQ9s+TZlRAp9TF3Sc2b2meBCWB1gmwgSDo/3aQ5qkt4nATQmZNkiuBVQIQAr8hCVR03YMaFkr5KTuvqUweERe+nDVarRtL8X2M0R9M1ht4KOgNzQor4yB/E2CWuDvkekLnZXMVooJKZ5GD4IoNG81iDzLMo1gB0Tc5GNGngjal6pVCKVtz51n6BnqPvTpwymSvE9WON122L5RgKXwt5UKGDVncaNBLb

Yeah, closed means no evars and no local variables.
For example, in the proof below, I want 2^64 to be normalized and leave everything else unchanged.
I can use the tactic `norm` below to manually pick terms to normalize. But I wish there was an automatic way to pick all closed terms of a given type.


Require Import ZArith.
Open Scope Z_scope.
Ltac norm T :=
  match goal with
    [ |- context[T] ] => let Tc := eval vm_compute in T in
                       change T with Tc
  end.

Lemma xx (x:Z) : (2^64)*x=1.
  norm (2^64).



On Thu, Oct 15, 2020 at 5:44 AM Beta Ziliani <beta AT mpi-sws.org> wrote:
I was going to ask the same question. Perhaps an example could help?

On Thu, Oct 15, 2020 at 3:08 AM Fabian Kunze <fabian.kunze AT cs.uni-saarland.de> wrote:
By closed, do you mean no evars, or no local variables?

15 Oct 2020 07:42:39 Abhishek Anand <abhishek.anand.iitg AT gmail.com>:

Sorry, I was not clear. I want to only strongly normalize closed subterms of the type and leave the rest unchanged.

On Wed, Oct 14, 2020 at 6:54 PM Jason Gross <jasongross9 AT gmail.com> wrote:
Sorry, that only does goal, but doing the context isn't much different

On Wed, Oct 14, 2020, 20:53 Jason Gross <jasongross9 AT gmail.com> wrote:
Here is a slow tactic to do this:
Ltac norm T :=
  repeat match goal with
          | [ |- context [?e] ] => let e' := eval vm_compute in (e : T) in progress change e with e'
         end.

You may want a different typing check if you don't want coercion insertion or only want to check up to syntactic typing rather than unification.

On Wed, Oct 14, 2020, 20:20 Abhishek Anand <abhishek.anand.iitg AT gmail.com> wrote:
Is there a tactic to strongly normalize all closed terms of a given type in the Coq goal and context?
Is there a way to write such a tactic in Ltac/Ltac2/Mtac2.... ?




Archive powered by MHonArc 2.6.19+.

Top of Page