coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Dan Dougherty <dougherty.dan AT gmail.com>
- To: coq-club AT inria.fr
- Subject: [Coq-Club] generalized rewriting question
- Date: Thu, 14 Mar 2019 12:24:53 -0400
- Authentication-results: mail2-smtp-roc.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-f172.google.com
- Ironport-phdr: 9a23:YaKQIx+oITl9Zv9uRHKM819IXTAuvvDOBiVQ1KB41OMcTK2v8tzYMVDF4r011RmVBN2ds6sMotGVmpioYXYH75eFvSJKW713fDhBt/8rmRc9CtWOE0zxIa2iRSU7GMNfSA0tpCnjYgBaF8nkelLdvGC54yIMFRXjLwp1Ifn+FpLPg8it2O2+5oHfbx9UiDagfLh/MAi4oQLNu8cMnIBsMLwxyhzHontJf+RZ22ZlLk+Nkhj/+8m94odt/zxftPw9+cFAV776f7kjQrxDEDsmKWE169b1uhTFUACC+2ETUmQSkhpPHgjF8BT3VYr/vyfmquZw3jSRMMvrRr42RDui9b9mRxDyiCkHOTA383zZhNJsg69AvBKtuwZyz5LIbI2JNvdzeL7Wc9MARWpGW8ZcTyJPDZm6b4ASAeQBOvtYr4b9p1QQtxu+GQmtD/7oxzBVgX/2wKI60+Q/HgHcwAwhH8gCv2nOo9XzL6oSXuW1w7PJzTXHdf9ZxTD96I3Rfx0nvPqCU7Vwcc/LxkkuEQPIlluRqZTkPz+PyOsCrnWb4ux9Xuysk24qsx99riSry8s2iYTEhpgZxk7a+Sln2oo5ON+1RFB9bNW5CpVfrTuaOJFzQs46Q2FnpiI6yroetJ6+ZicKyZAnywfGa/yEboSE+xzjWPuTLDtmnn5ld7W/hxG98Uik1OLwTNW70FFPriZdk9nMsG4C1wDL58SZVvdw+l2t1DWP2gzJ9O1IP144mbDGJ5Mj3LI8jp8Tvl7CHi/ylkX2lqiWdkA89+e17OTnf7rmpp+COI9ulgH/Mr4ildGlDuQ+KQUOUG2b9v691L3n50H2XLJKjvgunqnDrJ/aPdgbprK+AwJNzokj7A+/Ay6639QcgHkIN0lIeAmHjojsI1HBOur0Dfa5g1S2kTdk3erKPrP7AsaFEn+Wm7D4OL159kR0yQwpzNkZ6YgHMLwZJOPPXRr9s8HXDhIjLx3yz+/hINp434IaH2mIB/y3KqTX5HOB4KoDJPSDZIIPpCe1f/Qi+vHugGUliBkRdK+B0p4eaXT+FfNjdRbKKUHwi8sMRD9Z9jE1S/bn3QXbAGxjIk2qVqd53QkVTYevDIPNXIeo2eXT0yKyH5kQbWdDWAnVTSXYMr6cUvJJUxq8Z9d7m2VdB7ekQo4lkxqpsV2ikuc1Hq/v4iQd8Knb+p116unUz09g8DV1C4GE0DjIQTgrxCUHQDg52K05qkt4mA+O
(* 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/
- [Coq-Club] generalized rewriting question, Dan Dougherty, 03/14/2019
- Re: [Coq-Club] generalized rewriting question, Pierre Courtieu, 03/15/2019
- Re: [Coq-Club] generalized rewriting question, Dan Dougherty, 03/16/2019
- Re: [Coq-Club] generalized rewriting question, Pierre Courtieu, 03/18/2019
- Re: [Coq-Club] generalized rewriting question, Dan Dougherty, 03/16/2019
- Re: [Coq-Club] generalized rewriting question, Pierre Courtieu, 03/15/2019
Archive powered by MHonArc 2.6.18.