coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Vadim Zaliva <vzaliva AT cmu.edu>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Proper morphisms for family of functions
- Date: Thu, 31 Dec 2015 09:27:34 -0800
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=vadim.zaliva AT west.cmu.edu; spf=None smtp.mailfrom=vadim.zaliva AT west.cmu.edu; spf=None smtp.helo=postmaster AT mail-pa0-f41.google.com
- Ironport-phdr: 9a23:gs/tLBzVr87LdkbXCy+O+j09IxM/srCxBDY+r6Qd0ekVIJqq85mqBkHD//Il1AaPBtWFrawewLOO6ujJYi8p39WoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09fr2zQd6MyZrtnLnqotX6WEZhunmUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO9MxGlldhq5lhf44dqsrtY4q3wD86Fpy8kVWqLjOq88ULZwDTI8Mmlz6te4mwPESF6x73cdVy0kmx5JHQGNuA/oV5PwrCLSve9gniSWIJulHvgPRT2+4vIzG1fTgyAdOmth/Q==
Gregory,
Thanks for your analysis. I concur what is the source of the problem. I am hoping there is a some kind of workaround. I need to enforce that X arguments are instances of O and I need to be able to rewrite them.
I do not know deeply how type classes are implemented, so ideas below could be very naive. Few thoughts I have are:
1. To use just O_o2 instead of o2, if there is a way to extract o2 from the O_o2 instance later.
2. Try to combine o2 and O_o2 into a single object, like Abishek did in previous example. Perhaps a specification or a custom inductive type.
Does any of these directions sound promising?
Vadim
On Dec 30, 2015, at 23:06 , Gregory Malecha <gmalecha AT gmail.com> wrote:Hello --It does not look like you have any morphisms defined for 'X' and as it is it is probably difficult to define one. The issue, as the error message states, is that the type of [X] is dependent on the argument it is given. You can see this by printing implicit arguments.Set Printing Implicit.Here you will see that your problem is actually:X o1 o2 O_o1 O_o2 = X o1 o2' O_o1 O_o2'.In this problem, [setoid_rewrite] does not support rewriting like this. Supporting it would require finding a new instance to replace [O_o2] on the left-hand side of the equality and it would need to know that the value of [O_o2] can be replaced with another one. Writing these types of morphisms is a bit more complicated.Your best bet to get this to work is remove the two [O] instances in the definition of X.On Wed, Dec 30, 2015 at 5:13 PM, Vadim Zaliva <vzaliva AT cmu.edu> wrote:On Dec 29, 2015, at 19:05 , Abhishek Anand <abhishek.anand.iitg AT gmail.com> wrote:I typically combine the dependent arguments with their indices, and pick an appropriate equality for the combination.Thanks! I have another related question about Proper, this time with Type classes. In this caseI am working with functions, which are declared to be instances of a type class ‘O’. In examplebelow this class have just one field, f_proper, but may have more fields. I understand the sourceof the problem: I try to rewrite o2, but there is dependent argument O_o2 which needs to be replacedas well. What would be a good way to deal with this?Here is a complete example:Require Import MathClasses.interfaces.canonical_names.Require Import MathClasses.theory.setoids.Require Import MathClasses.implementations.peano_naturals.Class O (op: nat -> nat) :=f_proper : Proper ((=) ==> (=)) (op).Definition o1 := plus 1.Definition o2 := plus 2.Definition o2' := compose (plus 1) (plus 1).Instance O_o1: O o1. Admitted.Instance O_o2: O o2. Admitted.Instance O_o2': O o2'. Admitted.Lemma oo: o2 = o2'. Proof. reflexivity. Qed.Definition X(f: nat -> nat)(g: nat -> nat)`{!O f}`{!O g} := compose f g.Lemma foo:X o1 o2 = X o1 o2'.Proof.(* The following fails with:Error: build_signature: no constraint can apply on a dependent argument*)setoid_rewrite oo.Qed.Sincerely,
Vadim Zaliva--CMU ECE PhD candidateMobile: +1(510)220-1060Skype: vzaliva--gregory malecha
Sincerely,
Vadim Zaliva
Vadim Zaliva
--
CMU ECE PhD candidate
Mobile: +1(510)220-1060
Skype: vzaliva
- [Coq-Club] Proper morphisms for family of functions, Vadim Zaliva, 12/30/2015
- Re: [Coq-Club] Proper morphisms for family of functions, Abhishek Anand, 12/30/2015
- Re: [Coq-Club] Proper morphisms for family of functions, Vadim Zaliva, 12/31/2015
- Re: [Coq-Club] Proper morphisms for family of functions, Gregory Malecha, 12/31/2015
- Re: [Coq-Club] Proper morphisms for family of functions, Vadim Zaliva, 12/31/2015
- Re: [Coq-Club] Proper morphisms for family of functions, Gregory Malecha, 12/31/2015
- Re: [Coq-Club] Proper morphisms for family of functions, Vadim Zaliva, 12/31/2015
- Re: [Coq-Club] Proper morphisms for family of functions, Abhishek Anand, 12/30/2015
Archive powered by MHonArc 2.6.18.