coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Jacques-Henri Jourdan <jacques-henri.jourdan AT inria.fr>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Rewrite everywhere
- Date: Wed, 23 Mar 2016 15:55:48 +0100
Hi Matthieu,
Thank you for the answer. Perhaps you could help us understand by explaining us what is the process followed by setoid_rewrite (i.e., what instances is searched for, and how two instances you give here are used). Thanks, -- JH Le 23/03/2016 15:10, Matthieu Sozeau a écrit : Hi,
I think setoid_rewrite should be able to infer all those instances, and adding a subrelation is the right way to make it use extensionality. However, the way subtyping is implemented only Proper eq f for any f is inferred, independently of the arity of f. Here one must show the subrelation relation for eq <= (pointwise_relation A eq ==> ?) that was infered from the rewrite. For the [Proper (pointwise_relation A eq ==> eq) exist'] instances to be automatically inferred, you hence need to add also the following two instances: (* Proper eq exists' is infered automatically, and we need
to show eq <= (pointwise_relation A eq ==> eq) *)
Instance : forall A (R : relation A) (refl : Reflexive R)
, subrelation eq R.
Proof.
reduce. subst. apply refl.
Qed.
(** This show that (pointwise_relation A eq ==> eq) is
Reflexive *)
Instance reflexive_pointwise: forall A B C (R : relation
C), Reflexive R -> Reflexive (pointwise_relation A (@eq
B) ==> R)%signature.
Proof.
reduce. red in H0.
apply functional_extensionality_dep in H0. subst.
reflexivity.
Qed.
Cheers,
-- Matthieu
Le mar. 22 mars 2016 à 18:55, Jacques-Henri
Jourdan <jacques-henri.jourdan AT inria.fr> a
écrit :
To reformulate Jacques-Pascal question:
How to tell setoid_rewrite to use functional extensionality to rewrite under lambdas ? We are able to define the following instance (which is basically functional extensionality) : Program Instance : forall A B, subrelation (@pointwise_relation A B eq) eq. So that rewriting happens when the context of the
lambda is simple. We can then use setoid_rewrite to
prove the following lemma:
forall A B (f g:A->B), (forall x, f x = g x) -> (fun x => f x) = (fun x => g x). But if now we define : Definition exists' {A:Type} P := exists (x:A), P x. And we try to prove : Lemma L : forall A (P1 P2:A -> Prop), (forall x, P1 x = P2 x) -> exists' (fun x => P1 x) = exists' (fun x => P2 x). This does not work, because the lambda is applied to something. We need to define the instance : Program Instance : forall A B (f : A -> B), Proper (eq ==> eq) f. But this does not work if the lambda is not the
last parameter of exist'. then we need all the others
instances...
So the question becomes : is there any way to tell setoid_rewrite that any context is respectful of Liebniz equality ? -- JH Le 22/03/2016 18:22, Benoît Viguier a écrit :
|
Attachment:
signature.asc
Description: OpenPGP digital signature
- [Coq-Club] Rewrite everywhere, Jacques-Pascal Deplaix, 03/22/2016
- Re: [Coq-Club] Rewrite everywhere, Benoît Viguier, 03/22/2016
- Re: [Coq-Club] Rewrite everywhere, Jacques-Henri Jourdan, 03/22/2016
- Re: [Coq-Club] Rewrite everywhere, Matthieu Sozeau, 03/23/2016
- Re: [Coq-Club] Rewrite everywhere, Jacques-Pascal Deplaix, 03/23/2016
- Re: [Coq-Club] Rewrite everywhere, Jacques-Henri Jourdan, 03/23/2016
- Re: [Coq-Club] Rewrite everywhere, Matthieu Sozeau, 03/24/2016
- Re: [Coq-Club] Rewrite everywhere, Matthieu Sozeau, 03/23/2016
- Re: [Coq-Club] Rewrite everywhere, Jacques-Henri Jourdan, 03/22/2016
- Re: [Coq-Club] Rewrite everywhere, Benoît Viguier, 03/22/2016
Archive powered by MHonArc 2.6.18.