Skip to Content.
Sympa Menu

coq-club - [Coq-Club] SSR rewrite with unfolded definition

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] SSR rewrite with unfolded definition


Chronological Thread 
  • From: Michael Sammler <sammler.michael AT web.de>
  • To: coq-club AT inria.fr
  • Subject: [Coq-Club] SSR rewrite with unfolded definition
  • Date: Wed, 30 May 2018 20:59:40 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=sammler.michael AT web.de; spf=Pass smtp.mailfrom=sammler.michael AT web.de; spf=None smtp.helo=postmaster AT mout.web.de
  • Ironport-phdr: 9a23:RuLx6xGrzrLTeYJehTEeC51GYnF86YWxBRYc798ds5kLTJ78ps6wAkXT6L1XgUPTWs2DsrQY07eQ6/iocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmDqwbaluIBmqsA7cqtQYjYx+J6gr1xDHuGFIe+NYxWNpIVKcgRPx7dqu8ZBg7ipdpesv+9ZPXqvmcas4S6dYDCk9PGAu+MLrrxjDQhCR6XYaT24bjwBHAwnB7BH9Q5fxri73vfdz1SWGIcH7S60/VDK/5KlpVRDokj8KOT4k/m/JicJ+gqxUrx29qBFkxo7YfJuYOeBicq7Tf94XQ3dKUMZLVyxGB4Oxd4wBD+sdMuZYtYbyuV8OpgajCwa2AePvzztIiWHs3aYn1OkhChvJ3AklH9IKrnvUts/5NKITUe+pzKnH1yvMb/dN1Dbz9ofHaQotruySUr9pd8fa1EohFxvdg1mOtIDpISmZ2voTv2WZ9eZsSOKih3Q6pwx+ujSixdkghpPUio8azl3I7yR0zYIvKdC2S0N2Z8OvHoFKuCGALYR2R9svQ2F2tyY+zb0LoZu7fC8XyJQ73RLeZeKIfJOS7h3+SumdOTZ4hHR7d7Kjnxu+71WsxvPmWsWqzlpHrDBJnsTMu3wXyhDe5dCLSv5n8Ueg3TaP2RrT6uZBIU0sjqrUMZshwrs0lpUNq0TPBCr2mETqg6+WbEor5Oyo5v/pY7r4vZCQLZJ7hR/mPqQ0hsO/Gfg4MhQJX2WD5eu806Tj8VTlT7VOk/05ibLUsIvaJMQevq62GRVZ0ocl6xalDjepys4UnXcdLAENRBXShI/wflrKPfrQDPGlgl3qni046erBO+jEA57NJ3XH2IzoeLN55lQUnBE6yNVb6ogSD7AKIPv+XmfuudaeAhJvYF/8+PruFNgojtBWYmmIGKLMaPqD42/N3fomJqy3XKFQvT/8L/Y/4Pu+32A0kxkRcPvwhMdFWDWDBv1jZn6hTz/0mN5RQ3gHtEwyQb6y0QDQYXtof3+3GpkEyHQ7BYahVNyRQ4ewnPqe0S39EpAEPm0=

Dear all,

I have a definition ded : form -> Prop and a definition equiv: form -> form -> form and I would like to rewrite with terms of the form ded (equiv A B) using the ssr rewrite. When I define a setoid for a compound definition ded_equiv(A B: form) := ded (equiv A B), I can rewrite with terms of the form ded_equiv A B using both ssr rewrite and setoid_rewrite, but terms of the form ded (equiv A B) only work with setoid_rewrite, but not with ssr rewrite, which gives "not a rewritable relation: (ded (equiv A B))".

I have attached an example, which shows the problem (and I have tried it with Coq 8.7.2, 8.8.0 and the dev version).

Is there a way to rewrite with ded (equiv A B) using ssr rewrite?

Best regards,

Michael Sammler

From Coq Require Export ssreflect ssrfun ssrbool.
Require Export Coq.Setoids.Setoid.
Require Export Relations.Relation_Definitions.
Require Export Classes.Morphisms.

Parameter form: Type.
Parameter equiv: form -> form -> form.
Parameter ded: form -> Prop.
Definition ded_equiv(A B : form) := ded (equiv A B).
Axiom ded_equiv_refl: reflexive _ ded_equiv.
Axiom ded_equiv_sym: symmetric _ ded_equiv.
Axiom ded_equiv_trans: transitive _ ded_equiv.
Add Parametric Relation : form ded_equiv
reflexivity proved by (ded_equiv_refl)
symmetry proved by (ded_equiv_sym)
transitivity proved by (ded_equiv_trans)
as ded_equiv_rel.

Goal forall (A B: form),
ded_equiv A B -> (ded (equiv A B)) -> ded_equiv A B.
Proof.
move => A B H1 H2.
(* ssreflect rewrite works, if the use ded_equiv *)
have ->:= H1.
(* but not if we unfold the definition *)
Fail have <-:= H2. (* fails with not a rewritable relation: (ded (equiv A
B)) in rule _top_assumption_ *)
(* but setoid_rewrite works with the unfolded definition *)
setoid_rewrite <-H2.
reflexivity.
Qed.

(* another try to define the setoid *)
Axiom ded_equiv2_refl: reflexive _ (fun A B => ded (equiv A B)).
Axiom ded_equiv2_sym: symmetric _ (fun A B => ded (equiv A B)).
Axiom ded_equiv2_trans: transitive _ (fun A B => ded (equiv A B)).
Add Parametric Relation : form (fun A B => ded (equiv A B))
reflexivity proved by (ded_equiv2_refl)
symmetry proved by (ded_equiv2_sym)
transitivity proved by (ded_equiv2_trans)
as ded_equiv2_rel.

Add Parametric Morphism : (ded) with signature
(fun A B => ded (equiv A B)) ==> (Basics.flip Basics.impl) as ded_mor.
Proof.
Admitted.

Goal forall (A B: form),
ded (equiv A B) -> (fun A B => ded (equiv A B)) A B -> ded A.
Proof.
move => A B H1 H2.
(* here ssreflect rewrite does not work as well *)
Fail have ->:= H1.
(* but setoid_rewrite works *)
setoid_rewrite H1.
(* not even with this version does ssr rewrite work *)
Fail have <-:= H2.
(* but setoid_rewrite works *)
setoid_rewrite <-H2.
Abort.


  • [Coq-Club] SSR rewrite with unfolded definition, Michael Sammler, 05/30/2018

Archive powered by MHonArc 2.6.18.

Top of Page