Zulip Chat Archive

Stream: Is there code for X?

Topic: unique from empty


view this post on Zulip Yakov Pechersky (Feb 17 2021 at 19:55):

Do we have something that can give:

example : option (fin 0)  unit := sorry

Something like pi.unique_of_empty but saying that unique [option α] when α ≃ empty.

view this post on Zulip Floris van Doorn (Feb 17 2021 at 20:10):

I guess you already know about docs#equiv_punit_of_unique? The other part seems like it's missing, but is very easy.

view this post on Zulip Mario Carneiro (Feb 17 2021 at 20:12):

the other direction sounds like the composition of two lemmas, equivs preserve unique and unique pempty

view this post on Zulip Mario Carneiro (Feb 17 2021 at 20:13):

I wouldn't make that into one lemma unless it's one half of an iff statement

view this post on Zulip Floris van Doorn (Feb 17 2021 at 20:13):

I think (\a -> false) -> unique (option \a) is a reasonable lemma to have.

view this post on Zulip Mario Carneiro (Feb 17 2021 at 20:14):

that could also be one half of an iff statement

view this post on Zulip Floris van Doorn (Feb 17 2021 at 20:14):

Honestly, I feel like we should add [is_empty \a] as a typeclass

view this post on Zulip Johan Commelin (Feb 17 2021 at 20:14):

I'm a fan

view this post on Zulip Mario Carneiro (Feb 17 2021 at 20:14):

that works for me

view this post on Zulip Mario Carneiro (Feb 17 2021 at 20:15):

there aren't that many instances but there are at least 2 or 3

view this post on Zulip Johan Commelin (Feb 17 2021 at 20:15):

We already have subsingleton, unique, nonempty and nontrivial. It's only reasonable to also have is_empty.

view this post on Zulip Mario Carneiro (Feb 17 2021 at 20:16):

Of course you have to keep in mind that because of the @[class] def thing this might not be easier to use than A -> false

view this post on Zulip Johan Commelin (Feb 17 2021 at 20:16):

empty, pempty, {x // x \in \empty}, false, prime_spectrum punit

view this post on Zulip Mario Carneiro (Feb 17 2021 at 20:16):

fin 0, A -> false where nonempty A

view this post on Zulip Floris van Doorn (Feb 17 2021 at 20:17):

↥∅ for in various types

view this post on Zulip Floris van Doorn (Feb 17 2021 at 20:17):

Mario Carneiro said:

A -> false where nonempty A

A -> Bwhere nonempty A and is_empty B :)

view this post on Zulip Johan Commelin (Feb 17 2021 at 20:17):

I think we have convincingly, and even constructively! proven Marios conjecture that there are at least 2 or 3 examples (-;

view this post on Zulip Mario Carneiro (Feb 17 2021 at 20:17):

lean has too many ways to say nothing :)

view this post on Zulip Johan Commelin (Feb 17 2021 at 20:18):

It's a hard problem! If you can fix it, I guess you solved the "canonical isomorphism" problem (-;

view this post on Zulip Gabriel Ebner (Feb 17 2021 at 20:18):

Floris van Doorn said:

Mario Carneiro said:

A -> false where nonempty A

A -> Bwhere nonempty A and is_empty B :)

I think you can drop the nonempty A assumption here.

view this post on Zulip Floris van Doorn (Feb 17 2021 at 20:18):

I don't think so

view this post on Zulip Mario Carneiro (Feb 17 2021 at 20:18):

false -> false is true

view this post on Zulip Gabriel Ebner (Feb 17 2021 at 20:18):

Oops. You're right of course.

view this post on Zulip Johan Commelin (Feb 17 2021 at 20:19):

If we introduce this class, there will be 37 files (or more) where we can replace (p)empty using this class.

view this post on Zulip Mario Carneiro (Feb 17 2021 at 20:20):

not all of those would necessarily be a good idea

view this post on Zulip Mario Carneiro (Feb 17 2021 at 20:20):

in particular we don't want algebraic classes for these types just because they are empty

view this post on Zulip Johan Commelin (Feb 17 2021 at 20:21):

Sure, but we prove things about mv_polynomial pempty R and also about mv_polynomial (fin 0) R

view this post on Zulip Mario Carneiro (Feb 17 2021 at 20:23):

certainly if be have any duplicated lemmas then that's a good candidate, but if you want the initial object of Set to inhabit a typeclass you probably don't want that to be generic

view this post on Zulip Mario Carneiro (Feb 17 2021 at 20:25):

docs#equiv.prod_empty looks like it could be generalized, although prod_punit isn't

view this post on Zulip Kevin Buzzard (Feb 17 2021 at 20:36):

When I was proving some instances of free_abelian_group I proved free_abelian_group pempty ≃+ unit and free_abelian_group punit ≃+ ℤ and then in the PR process Eric said I would be better off proving punit_equiv (T : Type*) [unique T] : free_abelian_group T ≃+ ℤ and pempty_unique : unique (free_abelian_group pempty). This does seem like a natural extension of this. The argument the other way is of course xkcd#927

view this post on Zulip Gabriel Ebner (Feb 17 2021 at 21:34):

Another lemma that would benefit from this type class:

lemma is_basis_empty [subsingleton M] (h_empty : ¬ nonempty ι) : is_basis R (λ x : ι, (0 : M)) :=

view this post on Zulip Eric Wieser (Feb 17 2021 at 21:36):

docs#is_basis_empty isn't yet stated exactly like that, but will be soon ;)

view this post on Zulip Mario Carneiro (Feb 17 2021 at 21:38):

oh, I spent a while looking at docs#is_basis_empty_bot trying to figure out why it's not a straight generalization of the lemma before it

view this post on Zulip Eric Wieser (Feb 17 2021 at 21:40):

Yeah, I have a PR that removes it

view this post on Zulip Eric Wieser (Feb 17 2021 at 21:41):

#6281

view this post on Zulip Mario Carneiro (Feb 17 2021 at 21:55):

No I mean a generalization in the other direction

view this post on Zulip Mario Carneiro (Feb 17 2021 at 21:56):

if you look at the two statements in docgen the only difference is that the _bot lemma has one fewer assumption

view this post on Zulip Eric Wieser (Feb 17 2021 at 22:52):

Yes, and it's proved in terms of the other lemma, so I don't understand what you're disagreeing with. Perhaps best to discuss in the PR.

view this post on Zulip Yury G. Kudryashov (Mar 02 2021 at 05:16):

We also have some lemmas about supr/infi over an empty type and filters on an empty type.

view this post on Zulip Eric Wieser (Mar 02 2021 at 07:14):

My impression is that now we're just waiting for someone to make the PR

view this post on Zulip Floris van Doorn (May 13 2021 at 05:31):

I've started this on branch#is_empty.

view this post on Zulip Yakov Pechersky (May 13 2021 at 05:45):

Awesome! (Bikeshedding comment) It's unfortunate that empty is taken, because now is_empty doesn't agree with nonempty


Last updated: May 16 2021 at 05:21 UTC