Zulip Chat Archive

Stream: Is there code for X?

Topic: Equivalence of type with an element to an option type


Bolton Bailey (Mar 01 2024 at 21:51):

Do we have something that, given (a : A), establishes an equivalence between A and Option {b : A // a \neq b}? I would have assumed this would be called docs#Equiv.optionSubtype, but that is something else.

Floris van Doorn (Mar 01 2024 at 22:11):

Isn't that Equiv.optionSubtype a |>.symm (.refl _) |>.1?

Bolton Bailey (Mar 01 2024 at 22:12):

does that complete the sorry here somehow?

lemma Equiv.toOption (A : Type) (a : A) [DecidableEq A] : Σ B : Type, A  Option B := sorry

Floris van Doorn (Mar 01 2024 at 22:14):

import Mathlib.Logic.Equiv.Option

lemma Equiv.toOption (A : Type) (a : A) [DecidableEq A] : Σ B : Type, A  Option B :=
  _, Equiv.optionSubtype a |>.symm (.refl _) |>.1.symm

Yaël Dillies (Mar 02 2024 at 02:00):

We do have this directly too. Look around docs#Pointed, specifically the equivalence with docs#PartFun

Bolton Bailey (Mar 02 2024 at 15:28):

Yaël Dillies said:

We do have this directly too. Look around docs#Pointed, specifically the equivalence with docs#PartFun

I don't see this in that file, and the second link is broken, can you point it out?

Bolton Bailey (Mar 02 2024 at 15:29):

#11095 can be scrapped if this object exists somewhere

Timo Carlin-Burns (Mar 02 2024 at 17:01):

docs#PartialFun

Yaël Dillies (Mar 02 2024 at 18:46):

It's used within the categorical equivalence. Sorry I'm not at a computer


Last updated: May 02 2025 at 03:31 UTC