coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Cyprien Mangin <cyprien.mangin AT m4x.org>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] proving UIP on decidable domains
- Date: Thu, 15 Dec 2016 10:27:37 +0100
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=Pass smtp.pra=cyprien.mangin AT m4x.org; spf=Pass smtp.mailfrom=SRS0=l3QM=X6=m4x.org=cyprien.mangin AT bounces.m4x.org; spf=Pass smtp.helo=postmaster AT mx1.polytechnique.org
- Ironport-phdr: 9a23:NHlIvBA9jUrwXFOZdGb/UyQJP3N1i/DPJgcQr6AfoPdwSPT5osbcNUDSrc9gkEXOFd2CrakV0KyI4+jJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fdbghMijexe7J/IRarpgjNq8cahpdvJLwswRXTuHtIfOpWxWJsJV2Nmhv3+9m98p1+/SlOovwt78FPX7n0cKQ+VrxYES8pM3sp683xtBnMVhWA630BWWgLiBVIAgzF7BbnXpfttybxq+Rw1DWGMcDwULs5Xymp4aV2Rx/ykCoINTA5/mHZhMJzkaxVvg6uqgdlzILIeoyYLuZycr/fcN4cWGFPXtxRVytEAo6kcYYOD/IBPfxZr4bjoVsFsBywChOqBOPgyz9IgGL90Kom3OUhCQHGxg0gEMwIsHjOqdX6LqESUe+0zKnO1jjDavxb2Djn5IjPaBAhruiBULRtesTfzkkvEhnKjlSWqYH9PjOV0P4Ns2mB4OZ6W+KvkWgqoBxyrDi33sogl5fFi4YPxlzZ6Sl0z5w5KNOkREJhb9OpH4Ncuz+GO4ZyWM8vQGFltDwkxrEbu5O3ZjUGxZc6yxPZdveJaZKH4gj5W+aUOTp4hGxqeLa4hxuq9EihxfDwWtOs0FZNqipEksXMuW4R2BzT7MiHS+J9/lq/1jqV0ADT8O5ELVg1lardNZEh3qY9mocNvUnHBCP6hVn6gaCMekgq5uSk8erqb7r+qp+ZLYB0iwX+Mqo0msy4BOQ1KhUAUXSG9+igzLDj+UP0Tq5NgPAuk6bUsYjXJcEUq6+2GQNV1Zwj6xmnAji60NUYhWMHLFNbdxKBlYTpPkvBIPb3Dfe+hVShiyxkx/fbPr3nHprCMGPDnK3kfbty5E9Q0g0zzcpQ555MELEOPOrzWlPttNzfFhI2Lwu0w//+BNph0oMeRHmAD7SCMKLStF+I/vggL/ONZI8Tojb9KuIq6+TgjX8jyhchevyi2oJSY3SlFNxnJV+YaDzimIQvC2AP6yEvVPbrhVvKdDdVaHe0F/Y39ykhCY+gS4LKQI+shpSEgDf9GYdZMDMVQmuQGGvlIt3XE8wHbzifd5ds
You actually only need any constant function x = y -> x = y (see below), so your projection function will work too. nu is just the most simple constant function you can define from decidable equality.
Section eqdep_cons.
Variable A : Type.
Variable nu : forall (x y : A), x = y -> x = y.
Arguments nu [_ _] _.
Variable nu_cons : forall x y (p q : x = y), nu p = nu q.
Definition nu_inv {x y : A} (p : x = y) : x = y :=
eq_ind _ (fun a => a = y) p _ (nu eq_refl).
Lemma nu_left_inv : forall x y (p : x = y), nu_inv (nu p) = p.
Proof.
destruct p. unfold nu_inv. destruct (nu eq_refl).
reflexivity.
Qed.
Lemma UIP : forall (x y : A) (p q : x = y), p = q.
Proof.
intros.
replace p with (nu_inv (nu p)) by (apply nu_left_inv).
replace q with (nu_inv (nu q)) by (apply nu_left_inv).
f_equal. apply nu_cons.
Qed.
End eqdep_cons.
Section eqdep_cons.
Variable A : Type.
Variable nu : forall (x y : A), x = y -> x = y.
Arguments nu [_ _] _.
Variable nu_cons : forall x y (p q : x = y), nu p = nu q.
Definition nu_inv {x y : A} (p : x = y) : x = y :=
eq_ind _ (fun a => a = y) p _ (nu eq_refl).
Lemma nu_left_inv : forall x y (p : x = y), nu_inv (nu p) = p.
Proof.
destruct p. unfold nu_inv. destruct (nu eq_refl).
reflexivity.
Qed.
Lemma UIP : forall (x y : A) (p q : x = y), p = q.
Proof.
intros.
replace p with (nu_inv (nu p)) by (apply nu_left_inv).
replace q with (nu_inv (nu q)) by (apply nu_left_inv).
f_equal. apply nu_cons.
Qed.
End eqdep_cons.
On Thu, Dec 15, 2016 at 10:09 AM, ikdc <ikdc AT mit.edu> wrote:
The idea is that nu is a sort of "normalization" function which takes all equalities between x and y and maps them all to the same canonical equality between x and y. This is the intuition behind nu_constant.On 12/15/2016 04:05 AM, Chunhui He wrote:
Hi all,
I'm reading the proof of UIP on decidable domains in the standard
library of coq:
source: theories/Logic/Eqdep_dec.v
doc: https://coq.inria.fr/library/Coq.Logic.Eqdep_dec.html
The proof "eq_proofs_unicity_on" uses some definitions like "nu" and "nu_inv".
I think the proof is confusing, does anyone know the meaning of "nu"
and "nu_inv"?
I try to simplify the proof by inlining (see below).
I find we can use a projection instead of "nu" and "nu_inv".
maybe it seem cleaner than the original proof?
Thanks!
Chunhui
---
Section eqdep_dec.
Variable A : Type.
Variable A_dec : forall (x y : A), x = y \/ x <> y.
Definition or_proj {x' y : A} (oreq : x' = y \/ x' <> y)
(x : A) (def : x = y) : x = y :=
match oreq with
| or_introl H =>
match A_dec x' x with
| or_introl e =>
match e in _ = y' return y' = y with
| eq_refl => H
end
| or_intror _ => def
end
| or_intror _ => def
end.
Lemma or_proj_eq : forall {x y : A} (u : x = y), or_proj (A_dec x y) x u = u.
Proof.
intros x y u.
unfold or_proj.
case u.
case (A_dec x x) as [Heq | Hneq].
{ case Heq. apply eq_refl. }
{ exfalso; apply (Hneq eq_refl). }
Qed.
Theorem eq_proofs_unicity : forall {x y : A} (p1 p2 : x = y), p1 = p2.
Proof.
intros x y p1 p2.
case (or_proj_eq p1).
case (or_proj_eq p2).
unfold or_proj.
case (A_dec x y) as [Heq | Hneq].
{ case (A_dec x x) as [Heq' | Hneq'] .
{ apply eq_refl. }
{ exfalso; apply (Hneq' eq_refl). } }
{ exfalso; apply (Hneq p1). }
Qed.
End eqdep_dec.
- [Coq-Club] proving UIP on decidable domains, Chunhui He, 12/15/2016
- Re: [Coq-Club] proving UIP on decidable domains, ikdc, 12/15/2016
- Re: [Coq-Club] proving UIP on decidable domains, Cyprien Mangin, 12/15/2016
- Re: [Coq-Club] proving UIP on decidable domains, Chunhui He, 12/15/2016
- Re: [Coq-Club] proving UIP on decidable domains, Cyprien Mangin, 12/15/2016
- Re: [Coq-Club] proving UIP on decidable domains, Thorsten Altenkirch, 12/15/2016
- Re: [Coq-Club] proving UIP on decidable domains, Jonathan Leivent, 12/15/2016
- Re: [Coq-Club] proving UIP on decidable domains, Gabriel Scherer, 12/15/2016
- Re: [Coq-Club] proving UIP on decidable domains, Jonathan Leivent, 12/15/2016
- Re: [Coq-Club] proving UIP on decidable domains, Emilio Jesús Gallego Arias, 12/15/2016
- Re: [Coq-Club] proving UIP on decidable domains, Jonathan Leivent, 12/15/2016
- Re: [Coq-Club] proving UIP on decidable domains, Gabriel Scherer, 12/15/2016
- Re: [Coq-Club] proving UIP on decidable domains, ikdc, 12/15/2016
Archive powered by MHonArc 2.6.18.