coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Jason Gross <jasongross9 AT gmail.com>
- To: Coq Club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Problem with constructive rewriting
- Date: Fri, 12 May 2017 18:23:11 +0000
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jasongross9 AT gmail.com; spf=Pass smtp.mailfrom=jasongross9 AT gmail.com; spf=None smtp.helo=postmaster AT mail-qk0-f176.google.com
- Ironport-phdr: 9a23:c3j+MxbPDuMuIurNFxl5Ylj/LSx+4OfEezUN459isYplN5qZr8y7bnLW6fgltlLVR4KTs6sC0LuK9fi4EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQtFiT6ybL9oMBm6sRjau9ULj4dlNqs/0AbCrGFSe+RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPCTQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjm58axlVAHnhzsGNz4h8WHYlMpwjL5AoBm8oxBz2pPYbJ2JOPZ7eK7WYNEUSndbXstJWCNBDIGzYYsBAeQCIOhWsZXyqkAUoheiHwShHv/jxiNKi3LwwKY00/4hEQbD3AE4G9wBqm/UrNLzNKwPUO611q7IzS7Yb/hL3jr96pLHcgsmofGKUrJwa83RyVI0Fw7BlViQponlMCmU1uQJqWSU8+1gVee2hmMhtgp/rD+vxsI2hYnIgIIY0lbE+jt3wYkvP924VE97YcW+H5tWrCGWLZd5QsQnQ2xupS00yaUGtIalcCQWzJkr3R3SZvydf4SW/B7vSPydLSp6iX9kfr+0mgy8/lK6yuLmU8m5yFZKoTRBktnLrn0N0gbc6smDSvdk50eh2iqD2xnd6u1ZI005lLDXK5Emwr43mZoTtVrMEjXql0Xxia+abkQk+u625OT7erjquIOQOotuhgz9MqkigNKzDfokPgQUQmSW++Wx2KXm/ULjQbVKivM2krPesJDfPckbpLS2AxRS0oYl5Ba/FTCm0M8DnXQDN19FdxeHgJLoO1HKOvz3EfC/g1G0nDdx2//GJqHhAonKLnXbjLjheq9951dAxwo30NBQ/IlZCqoBIfL2Qk/+rsbUDh4/MwyuwuboEs9x1o0EWTHHPqjMG6TL+XSM++hnd+KLfcoevCv3A/kj/f/ny3EjzwwzZ66siLkec3e+Vtt8JF6CKS7ui8wGF2gQuRElHcTljVSDVXhYYHPkDPF03S0yFI/zVdSLfYuqmrHUmX7jRpA=
What happens if you Set Printing Universes? It sounds like this might be a bug...
On Fri, May 12, 2017, 1:32 PM John Wiegley <johnw AT newartisans.com> wrote:
In the code below I'm trying to develop a notion of "isomorphism" that allows
for rewriting. However, I'm getting a strange error that I can't yet make any
sense of:
Error: Illegal application:
The term "@flip" of type "∀ A B C : Type, (A → B → C) → B → A → C"
cannot be applied to the terms
"Type" : "Type"
"Type" : "Type"
"Type" : "Type"
"arrow" : "Type → Type → Type"
The 4th term has type
"Type@{Top.8164} → Type@{Top.8165} → Type@{max(Top.8164, Top.8165)}"
which should be coercible to
"Type@{max(Coq.Classes.CEquivalence.6, Top.4)}
→ Type@{max(Coq.Classes.CEquivalence.6, Top.4)} → Type@{Top.8166}".
If instead I use transitivity, the same proof passes easily.
Below is the test case, if anyone has any thoughts.
Thank you,
John
Require Export
Coq.Unicode.Utf8
Coq.Program.Program
Coq.Classes.CEquivalence.
Close Scope nat_scope.
Notation "f ≈ g" := (equiv f g) (at level 79, only parsing).
Reserved Infix "~>" (at level 90, right associativity).
Reserved Infix "∘" (at level 40, left associativity).
Class Category := {
ob : Type;
uhom := Type : Type;
hom : ob -> ob -> uhom where "a ~> b" := (hom a b);
id {A} : A ~> A;
compose {A B C} (f: B ~> C) (g : A ~> B) : A ~> C
where "f ∘ g" := (compose f g);
id_left {X Y} (f : X ~> Y) : id ∘ f ≈ f;
comp_assoc {X Y Z W} (f : Z ~> W) (g : Y ~> Z) (h : X ~> Y) :
f ∘ (g ∘ h) ≈ (f ∘ g) ∘ h
}.
Notation "X ~> Y" := (@hom _ X Y) (at level 90, right associativity).
Notation "f ∘ g" := (@compose _ _ _ _ f g).
Coercion ob : Category >-> Sortclass.
Class Isomorphism `{C : Category} (X Y : C) : Type := {
to :> X ~> Y;
from : Y ~> X;
iso_to_from : to ∘ from ≈ id;
iso_from_to : from ∘ to ≈ id
}.
Ltac reassoc f :=
repeat match goal with
| [ |- context[(?F ∘ f) ∘ ?G] ] => rewrite <- (comp_assoc F f G)
| [ |- context[f ∘ (?G ∘ ?H)] ] => rewrite (comp_assoc f G H)
end.
Program Instance isomorphism_equivalence `{C : Category} :
Equivalence Isomorphism.
Next Obligation.
repeat intro.
apply Build_Isomorphism with (to:=id) (from:=id);
rewrite id_left; reflexivity.
Defined.
Next Obligation.
repeat intro; destruct X.
apply Build_Isomorphism with (to:=from0) (from:=to0); assumption.
Defined.
Next Obligation.
repeat intro; destruct X, X0.
apply Build_Isomorphism with (to:=to1 ∘ to0) (from:=from0 ∘ from1).
repeat match goal with
| [ H : equiv (?F ∘ ?G) _
|- context[(_ ∘ ?F) ∘ (?G ∘ _)] ] => reassoc F; rewrite H
| [ H : equiv (?F ∘ ?G) _
|- context[?F ∘ (?G ∘ _)] ] => reassoc F; rewrite H
| [ H : equiv (?F ∘ ?G) _
|- context[(_ ∘ ?F) ∘ ?G] ] => reassoc F; rewrite H
| [ H : equiv (?F ∘ ?G) _
|- context[?F ∘ ?G] ] => rewrite H
| [ |- equiv ?F ?F ] => reflexivity
| [ |- context[id ∘ ?F] ] => rewrite (id_left F)
end.
reassoc from1; rewrite iso_from_to1.
rewrite id_left; assumption.
Defined.
Notation "X ≅ Y" := (@Isomorphism _ X Y) (at level 91).
Goal forall `{C : Category} {X Y Z : C} (f : Y ≅ Z) (g : X ≅ Y), X ≅ Z.
intros.
(* transitivity Y; auto. *)
rewrite g.
--
John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2
- [Coq-Club] Problem with constructive rewriting, John Wiegley, 05/12/2017
- <Possible follow-up(s)>
- [Coq-Club] Problem with constructive rewriting, John Wiegley, 05/12/2017
- Re: [Coq-Club] Problem with constructive rewriting, Jason Gross, 05/12/2017
- Re: [Coq-Club] Problem with constructive rewriting, John Wiegley, 05/12/2017
- Re: [Coq-Club] Problem with constructive rewriting, Jason Gross, 05/12/2017
- Re: [Coq-Club] Problem with constructive rewriting, John Wiegley, 05/13/2017
- Re: [Coq-Club] Problem with constructive rewriting, Jason Gross, 05/12/2017
- Re: [Coq-Club] Problem with constructive rewriting, John Wiegley, 05/12/2017
- Re: [Coq-Club] Problem with constructive rewriting, Jason Gross, 05/12/2017
Archive powered by MHonArc 2.6.18.