Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] existT

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] existT


Chronological Thread 
  • From: Chris Dams <chris.dams.nl AT gmail.com>
  • To: coq-club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] existT
  • Date: Wed, 2 Oct 2019 14:47:14 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=chris.dams.nl AT gmail.com; spf=Pass smtp.mailfrom=chris.dams.nl AT gmail.com; spf=None smtp.helo=postmaster AT mail-wm1-f41.google.com
  • Ironport-phdr: 9a23:QyRCMReNm2igBH1/iYqrxq1plGMj4u6mDksu8pMizoh2WeGdxcu4Zh7h7PlgxGXEQZ/co6odzbaP6Oa8ByddvN6oizMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpTEdFQ/iOgVrO+/7BpDdj9it1+C15pbffxhEiCCybL9vIhi6twrcu8gZjYZiKqs61wfErGZPd+lK321jOEidnwz75se+/Z5j9zpftvc8/MNeUqv0Yro1Q6VAADspL2466svrtQLeTQSU/XsTTn8WkhtTDAfb6hzxQ4r8vTH7tup53ymaINH2QLUpUjms86tnVBnlgzoBOjUk8m/Yl9ZwgbpUrxKvpRNxw4DaboKIOvRgYqzQZskVSXZbU8tLSyBNHoGxYo0SBOQBJ+ZYqIz9qkMQoBu+HwmsBfjvwSJGiHDs2K06yPkqHAba0wwgBdIOsW/UoM/oO6gIVOC117PEzTPHb/5N1jf97ZLHchElof2WQb1wds/RxFApGgjYjVuQsZToMy2J2ukJqWSW7OptWfiyh2I5qAx9uDeiytoqh4LUnIwa0ErE+j98wIstJd23Vkp7Ydm8HZtVrS6aNo92TtosQmFtpSo207MGtJGmcCQQx5QnwBnfa/ODc4eW+B7sSOGRITJgiHJkfrKwmQqy/FC+xuHgUsS4ylVHoypfntXRqHwA1Abf58eaRvdl+0euwzeP1wTd6uFeJkA0kLLWJIIhwr4ql5oTql7PETLsl0Xzl6+abEMk+uyz5uToZ7XpvJ6cN4tuhg7iNaQun9SzAf4kPQgWQ2ib5eO82aX/8k3+WbVGl+E5kq3EsJ/BPskbva64AwpN0ok58Rq/DjGm0M4ZnXYdNl5FdgiH3MDVPATFJ+m9BvOiiRz4mzBygvvCI7fJA5PXL3GFnq23Lphn7EsJ4wopzMsXy5tREflVK/LpW1S3uNXdFVk/NyS7xu/mDJN20YZICjHHObOQLK6H6QzA3ekoOeTZPNZJ6ga4EOAs4rvVtVF8gUUUJPD70p4eaXT+FfNjcR3AMCjcx+wZGGJPhTIQCenjiVmMSzlWPi/gUKc15zV9A4WjX96aG9KdxYeZ1SL+JaV4I2BLDlfWTCXtfoSAHugJMWecfpYnnTsDWrysDYQm0EP2uQ==

Hello all,

Actually, under some conditions existT is injective. It is the case if
the underlying type has decidable equality. See proof below. IIRC
a proof of this nowadays is also in the standard library, but I do not
seem to be able to find it that quickly.

Good luck,
Chris

Definition sigT_get_proof:
   forall T: Type,
   forall eq_dec_T: forall t t': T, {t = t'} + {~ t = t'},
   forall P: T -> Type,
   forall t: T,
   P t ->
   sigT P ->
   P t.
intros T eq_dec_T P t H1 H2.
destruct H2 as [t' H2].
destruct (eq_dec_T t t') as [H3|H3].
rewrite H3.
exact H2.
exact H1.
Defined.

Theorem sigT_get_proof_existT_same:
   forall T: Type,
   forall eq_dec_T: forall t t': T, {t = t'} + {~ t = t'},
   forall P: T -> Type,
   forall t: T,
   forall H1 H2: P t,
   sigT_get_proof eq_dec_T t H1 (existT P t H2) = H2.
Proof.
intros T eq_dec_T P t H1 H2.
unfold sigT_get_proof.
destruct (eq_dec_T t t) as [H3|H3].
unfold eq_rect_r.
symmetry.
exact (eq_rect_eq_dec eq_dec_T (fun t: T => P t) H2 (sym_eq H3)).
tauto.
Qed.

Theorem existT_injective:
   forall T,
   (forall t1 t2: T, { t1 = t2 } + { t1 <> t2 }) ->
   forall P: T -> Type,
   forall t: T,
   forall pt1 pt2: P t,
   existT P t pt1 = existT P t pt2 ->
   pt1 = pt2.
Proof.
intros T T_dec P t pt1 pt2 H1.
pose (H2 := f_equal (sigT_get_proof T_dec t pt1) H1).
repeat rewrite sigT_get_proof_existT_same in H2.
assumption.
Qed.




Archive powered by MHonArc 2.6.18.

Top of Page