Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] generalized rewriting question

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] generalized rewriting question


Chronological Thread 
  • From: Dan Dougherty <dougherty.dan AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] generalized rewriting question
  • Date: Sat, 16 Mar 2019 09:22:43 -0400
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=dougherty.dan AT gmail.com; spf=Pass smtp.mailfrom=dougherty.dan AT gmail.com; spf=None smtp.helo=postmaster AT mail-qk1-f178.google.com
  • Ironport-phdr: 9a23:KIpEAR9hm6flCv9uRHKM819IXTAuvvDOBiVQ1KB42+8cTK2v8tzYMVDF4r011RmVBN2ds6sMotGVmpioYXYH75eFvSJKW713fDhBt/8rmRc9CtWOE0zxIa2iRSU7GMNfSA0tpCnjYgBaF8nkelLdvGC54yIMFRXjLwp1Ifn+FpLPg8it2O2+5oHfbx9UiDagfLh/MAi4oQLNu8cMnIBsMLwxyhzHontJf+RZ22ZlLk+Nkhj/+8m94odt/zxftPw9+cFAV776f7kjQrxDEDsmKWE169b1uhTFUACC+2ETUmQSkhpPHgjF8BT3VYr/vyfmquZw3jSRMMvrRr42RDui9b9mRxDmiCgFLT438G/ZhM9tgqxFvB2vqAdyw5LNYIyPKPZyYr/RcNEcSGFcXshRTStBAoakYoUBFeUBO/tToYf6p1sTohu+BRejBPnzyj5Im3T72rA10+M8EQHJ3AwvAcgOsGjUrdnvKagdS+a1wbLHzTXGdfxW2DP95JLUfRAmpPGBRLR9etffx0koEgPKlFSQqYr9MjKbzuQNsnKX4PR9WuKyjWMstgJ/oiC3y8syloXEgpgZx1PE+Clj3oo5O8O0RFRmbdOmE5ZdsTyROZFsTcM4WW5ovT43yr0Ytp6/eygH0JEnyATea/yDaoSI+xHjWPuILTd2mX5oerGyiwy98Uinze38Wc2030hQoiVZldnMs2gB1x3V6seZVvtw5lmt1SqL2gzJ6exJIVo4mbTFJ5I/2LI8i5gevEfbEi/zgkr2jauWdks++uiv7uTqeqjpppiBN497igHxLL4umtC/AOgiLwcBRW6b9P+z1L3m50L5QbFKgucqnanetZDWPd4bqbKhAw9JzoYj7A6yACuh0NQBhHUIMFZFeA+cgIXyIFHPIPX4De+ljFi2kTdrwerGPrz7DZnXIHjDiuSpQbEo4ElFjQE30Np35pROC7hHLuigYELpsM3kCUo1NBG7w+v9FMQ72ooYcW2KC66ddqjVtAym/OUqdsWFYsc5vyvyK/U/+++m2XM+hFAdcLO1zN0bYXaQEfFvIkHfan3p1IRSWVwWtxYzGbS5wGaJViReMi7rDvAMowojAYfjNr/tA4WkgbiPxiC+R8QEaWVPC1TKGnDtJdzdB6U8LRmKK8okqQQqEKC7QtZ4hx6rvQ7+jbFgK7iMo3BKhdfYzNFwotbru1Qy+DhzVZrP1miMSyRtnTpNSWZpjOZwpktyzlrF2q990aRV

I should have said more in my original post. I have tried
(essentially) what Pierre suggested, and several other things that
ought to work in the sense that they made sense semantically. And
having proved various compatibility lemmas, I can _apply_ them and get
the results I need. But when I want to declare a parametric morphism
and _rewrite_ then I get the infamous setoid rewrite error.

My impression that my problem is to find a way to fit a natural
compatibility result and ensuing morphism declaration into a format
that generalized rewriting will accept.

thanks in advance for any help.

Dan

On Fri, Mar 15, 2019 at 5:10 AM Pierre Courtieu
<pierre.courtieu AT gmail.com>
wrote:
>
> I guess you need to define a relation for the list of terms. Something like:
>
> C1: eqv x x’ -> like x::l == x’::l
> C2:l ==l’ -> x::l ==x::l’
> Ctrans: ...
>
> P
>
> Le ven. 15 mars 2019 à 07:59, Dan Dougherty
> <dougherty.dan AT gmail.com>
> a écrit :
>>
>> (* Hi all,
>>
>> I'm having trouble setting up a generalized (setoid) rewriting
>> mechanism. A simplified version of my setting is as follows.
>>
>> I'm working with first order terms and an inductive relation defining
>> provable equality based on some axioms, and I want to be able to
>> rewrite modulo that relation. All is straightforward if I define
>> terms using the function symbols as constructors (see the second
>> snippet) but I'd prefer to define terms more generally using the first
>> "term" definition below.
>>
>> My question is, how can I define a parametric morphism, analogous to
>> what is done for A' and Lemma ok in the latter snippet, that allows
>> rewriting to succeed in Lemma not_ok?
>>
>> thanks in advance,
>> Dan
>> *)
>> Require Export List.
>> Export ListNotations.
>> Require Export Setoid.
>> Require Export SetoidClass.
>> Require Export Morphisms.
>>
>> Inductive FunSym : Type := A | M.
>>
>> Inductive term: Type :=
>> | V : nat -> term
>> | T : FunSym -> list term -> term .
>>
>> Inductive eqv : term -> term -> Prop :=
>> (* some equations ...*)
>>
>> | eqv_ref: forall x, eqv x x
>> | eqv_sym: forall x y, eqv x y -> eqv y x
>> | eqv_trans: forall x y z, eqv x y -> eqv y z -> eqv x z
>>
>> | A_compat : forall x x' ,
>> eqv x x' -> forall y y' ,
>> eqv y y' -> eqv (T A [x ; y] ) (T A [x' ; y']).
>> Hint Constructors eqv.
>>
>> Add Parametric Relation : term eqv
>> reflexivity proved by @eqv_ref
>> symmetry proved by @eqv_sym
>> transitivity proved by @eqv_trans
>> as eqv_rel.
>>
>> (* MY QUESTION: how to add some parametric morphism so that rewrites
>> like the following succeed? *)
>>
>> Lemma not_ok : forall x x' y,
>> eqv x x' ->
>> eqv (T A [x;y]) (T A [x'; y]).
>> Proof.
>> intros x x' y H.
>> try rewrite H.
>> Abort.
>>
>> (* ********* below works fine ****************** *)
>>
>> Inductive term' : Type :=
>> | V' : nat -> term'
>> | A' : term' -> term' -> term' .
>>
>> Inductive eqv' : term' -> term' -> Prop :=
>> (* some equations ...*)
>>
>> | eqv'_ref: forall x, eqv' x x
>> | eqv'_sym: forall x y, eqv' x y -> eqv' y x
>> | eqv'_trans: forall x y z, eqv' x y -> eqv' y z -> eqv' x z
>>
>> | A'_compat : forall x x' ,
>> eqv' x x' -> forall y y' ,
>> eqv' y y' -> eqv' (A' x y) (A' x' y').
>> Hint Constructors eqv'.
>>
>> Add Parametric Relation : term' eqv'
>> reflexivity proved by @eqv'_ref
>> symmetry proved by @eqv'_sym
>> transitivity proved by @eqv'_trans
>> as eqv'_rel.
>>
>> Add Parametric Morphism : A' with
>> signature eqv' ==> eqv' ==> eqv' as A'_mor.
>> exact A'_compat.
>> Qed.
>>
>> Lemma ok : forall x x' y,
>> eqv' x x' ->
>> eqv' (A' x y) (A' x' y).
>> Proof.
>> intros x x' y H.
>> now rewrite H.
>> Qed.
>>
>>
>> --
>> Dan Dougherty
>> 231 Fuller Labs
>> Worcester Polytechnic Institute
>>
>> WPI Department of Computer Science:
>> http://web.cs.wpi.edu/~dd/
>> Ombuds:
>> http://www.wpi.edu/offices/ombuds/



--
Dan Dougherty
231 Fuller Labs
Worcester Polytechnic Institute

WPI Department of Computer Science:
http://web.cs.wpi.edu/~dd/
Ombuds:
http://www.wpi.edu/offices/ombuds/



Archive powered by MHonArc 2.6.18.

Top of Page