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] any down side to making all definitions Instances?
- Date: Wed, 7 Sep 2016 13:38:36 -0400
- 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-qk0-f173.google.com
- Ironport-phdr: 9a23:GSqTnxfZ+GCd6NfOOMb+0d5nlGMj4u6mDksu8pMizoh2WeGdxc66bB7h7PlgxGXEQZ/co6odzbGH6ua+ACdZuM7J8ChbNscTB1ld0YRetjdjKfDGIHWzFOTtYS0+EZYKf35e1Fb/D3JoHt3jbUbZuHy44G1aMBz+MQ1oOra9QdaK3Iyfntq/8JzLYghOmCH1IfYrdE33/k3tsZw9hpIqAaIswFOdqXxRPu9S2GlAJFSJnh+66N3mr7B59CEFmfUn/tJAWKOyW6k5U7FeEHxyMWcz5c7msRTOZQSK73oYFG4Rl0wbUED+8BjmU8Kp4WPBve1n1XzfZJWuQA==
I've been experimenting with ways to refer to things by their type instead of by name. One that seems obvious is using a very generic typeclass for all definitions that aren't already Instances of some other typeclass:
Class Witness (signature : Type) := witness : signature.
Then, for any Definition/Lemma of the form : "Lemma Foo : <quantifers> -> T", I would instead define "Instance Foo : <quantifiers> -> Witness T". The proof just needs an extra "unfold Witness" at the beginning. The definitions are still usable by name. But, because they are now instances, I can also look them up by type, as with "pose proof (witness : T)". A Generalize_Witness instance allows a single other instance to be found by any of its possible generalizations:
Instance Generalize_Witness{A : Type}{B : A -> Type}(H : forall a, Witness (B a)) : Witness (forall a, B a).
Proof.
red. apply H.
Defined.
The question is - is there a down side to doing this for all definitions? Would I be slowing down instance resolution on non-Witness classes as a result? Also, might there be some way a definition can be used such that an Instance in its place won't work as well?
-- Jonathan
- [Coq-Club] any down side to making all definitions Instances?, Jonathan Leivent, 09/07/2016
- Re: [Coq-Club] any down side to making all definitions Instances?, Théo Zimmermann, 09/08/2016
- Re: [Coq-Club] any down side to making all definitions Instances?, Jonathan Leivent, 09/08/2016
- Re: [Coq-Club] any down side to making all definitions Instances?, Théo Zimmermann, 09/08/2016
- Re: [Coq-Club] any down side to making all definitions Instances?, Jonathan Leivent, 09/08/2016
- Re: [Coq-Club] any down side to making all definitions Instances?, Jonathan Leivent, 09/08/2016
- Re: [Coq-Club] any down side to making all definitions Instances?, Jonathan Leivent, 09/08/2016
- Re: [Coq-Club] any down side to making all definitions Instances?, Théo Zimmermann, 09/08/2016
- Re: [Coq-Club] any down side to making all definitions Instances?, Jonathan Leivent, 09/08/2016
- Re: [Coq-Club] any down side to making all definitions Instances?, Théo Zimmermann, 09/08/2016
Archive powered by MHonArc 2.6.18.