Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] is there a way to use Definitional UIP to avoid needing Prop UIP for inversions

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] is there a way to use Definitional UIP to avoid needing Prop UIP for inversions


Chronological Thread 
  • From: Jason Gross <jasongross9 AT gmail.com>
  • To: Jonathan <jonikelee AT gmail.com>
  • Cc: coq-club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] is there a way to use Definitional UIP to avoid needing Prop UIP for inversions
  • Date: Sun, 6 Jun 2021 00:34:49 -0400
  • Authentication-results: mail3-smtp-sop.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-io1-f49.google.com
  • Ironport-hdrordr: A9a23:Z2hM26EGWX3oDCPapLqE18eALOsnbusQ8zAXPo5KOGVom62j5riTdZEgvyMc5wxhPU3I9erwWpVoBEmslqKdgrNxAV7BZniDhILAFugLhrcKgQeBJ8SUzJ876U4PSdkZNDQyNzRHZATBjTVQ3+xO/DBPys6Vuds=
  • Ironport-phdr: A9a23:H44hbx36Cy9st5+LsmDORgQyDhhOgF0UFjAc5pdvsb9SaKPrp82kYBWOo6410BSXBs3y0LFts6LuqafuWGgNs96qkUspV9hybSIDktgchAc6AcSIWgXRJf/uaDEmTowZDAc2t360PlJIF8ngelbcvmO97SIIGhX4KAF5Ovn5FpTdgsiq0+2+4ZPebxlHiTayYL5/Igi9oBnMuMURnYZsMLs6xAHTontPdeRWxGdoKkyWkh3h+Mq+/4Nt/jpJtf45+MFOTav1f6IjTbxFFzsmKHw65NfqtRbYUwSC4GYXX3gMnRpJBwjF6wz6Xov0vyDnuOdxxDWWMMvrRr0yRD+s7bpkSAXwhSgIOT428mHZhMJzgqxGvhyuuwdyzJTIbIyPLvdyYr/RcNEcSGFcXshRTStBAoakYoULFeUBJuFYr4/grFUPtxu+AhKsBPjywTJPhH/5x7Y60+MnEQHJxgwgGMkOsG/QodjuO6cSVPq6zKjMzTnZc/xW3jL95ZHOfxs8rv6CQah+ftDNyUkzCQzFlFOQpJT7Mz6a2ekDs2uW4ep8We+xi2Mqqh19riSzysoiiYTFm4MYxk3K+Ch2wos4Jt61RUpnbdCrDpZcqyKXOpZ4TM4+RWxjpSg0yroDuZGhfSgKzowqxx/Za/ydcoiH+AjvVOiLITp+mXlre6q/ig6s/US8zuDwTMq53VZQoiZYk9TBt2oB2hPX58WBV/Bz5F2u2SyV2ADW8uxEIV47la7cK5M5x74/jJsTsUDaEi/3n0X6kbaadksr9+Ws8ejnbbLmppiTN49wlA7yKLghmsu6AeggMwgOWXaU+fik2bH94UH0RK9Gg/42n6XDrZzXJMUWqrS2DgJRyooj7gywDzai0NQWh3kHK1dFdQqFj4fzIFHOJ/b4Dfilg1Srizdr3PTLM6buApXINHfDkbPhcaxh5E5bzQo/1cpf6I5MCrEdPPLzXVf8u8DfDh8gKgC73+LnCMhm2Y4FQmKOAqqZMLvIvlOS5+IvJfOMZI4PtzrnJfgl/a2msXhsu1gbdLWp1J1fPHK/GPVlLkGUbFLjh94AFSEBuQ9oH8Lwj1jXczdIYHD6cLg7/SpzXICvFoDFSZqqm6fQ9Ci+F5xSIGtBDwbfQj/Ta4yYVqJUO2qpKch7n2lcPVBOY4Ak3BCq8gT9zug+RgI10igRtJam1d8souOPxFc98jt7C8nb2GaIHTkcdoYgSDo/3aQ5qkt4mA/r7A==

You should be able to go a bit further: you can implement an alternate version of `inversion_sigma` which uses alternate versions of the the *_rect lemmas where all transports across equality proofs are instead transports across `seq2eq (eq2seq e)`, and then you won't need to explicitly invoke UIP at all, as things will just reduce.  Alternatively, you can add yet another postprocessing tactic which looks for equality proofs in the context which are used in places not under eq2seq and replaces all uses of them with a round-trip through seq.

On Sat, Jun 5, 2021, 23:19 jonikelee AT gmail.com <jonikelee AT gmail.com> wrote:
Thanks, Jason!  Here it is:

Set Definitional UIP.

Inductive seq {A} (a:A) : A -> SProp :=
  srefl : seq a a.

Definition seq2eq{T}{a b:T}(s:seq a b) : a=b :=
  match s with srefl _ => eq_refl end.

Definition eq2seq{T}{a b:T}(e:a=b) : seq a b :=
  match e with eq_refl => srefl _ end.

Lemma invseqeq: forall {T}{a b:T}(e:a = b), e = seq2eq (eq2seq e).
Proof.
  intros T a b e. destruct e. reflexivity.
Qed.

Lemma UIP_refl: forall T (a:T)(e:a = a), e = eq_refl.
Proof.
  intros T a e. rewrite (invseqeq e). reflexivity.
Qed.


On Sat, 5 Jun 2021 22:11:47 -0400
Jason Gross <jasongross9 AT gmail.com> wrote:

> Based on the documentation in
> https://coq.inria.fr/refman/addendum/sprop.html#coq:flag.Definitional-UIP,
> it looks like you should be able to define a function `f : seq x y ->
> x = y` and then you can prove that this function is the inverse of
> the function `g : x = y -> seq x y`.  With this flag on, it should be
> the case that matches on `f (g p)` will reduce away whenever x and y
> are definitionally equal, hence avoiding the need to invoke UIP
> explicitly.
>
> Does this work?
>
> On Sat, Jun 5, 2021, 20:16 jonikelee AT gmail.com <jonikelee AT gmail.com>
> wrote:
>
> > I just noticed Set Definitional UIP.  Is there a way to use this to
> > avoid needing to define a normal Prop (non SProp) UIP to handle
> > inversions that result in sigT equalities?  Normally, these cases
> > involve inversion; inversion_sigma; UIP to replace the equality arg
> > of the eq_rect with eq_refl to allow it to reduce. Do I still need
> > normal Prop UIP for such cases, or is there a way to bypass it?
> >
> >
> > 




Archive powered by MHonArc 2.6.19+.

Top of Page