Zulip Chat Archive

Stream: maths

Topic: How to get the unique term is a type of "cardinal 1"


Joël Riou (Jan 06 2022 at 23:30):

Is there a better proof for this (e.g. without using choice):

import logic.unique

noncomputable def unique_of_existence_and_uniqueness {X : Type*}
  (existence :  (x : X), true) (uniqueness :  (x y : X), x=y) : unique X :=
let h : nonempty X := exists_true_iff_nonempty.mp existence in
{ default := h.some,
  uniq := λ x, uniqueness x h.some, }

Adam Topaz (Jan 06 2022 at 23:32):

One way to do this is using docs#nonempty and docs#subsingleton . I'm not sure if we have a unique instance given both nonempty and subsingleton

Adam Topaz (Jan 06 2022 at 23:33):

I don't think you can avoid choice

Yakov Pechersky (Jan 06 2022 at 23:34):

import logic.unique

variables {X : Type*}

noncomputable def unique_of_existence_and_uniqueness
  (existence :  (x : X), true) (uniqueness :  (x y : X), x=y) : unique X :=
by letI : subsingleton X := uniqueness; exact unique_of_subsingleton existence.some

Yakov Pechersky (Jan 06 2022 at 23:35):

You can't avoid choice, you can't get data (and unique is data) from the existensial proposition.

Eric Rodriguez (Jan 06 2022 at 23:36):

you definitely can't avoid choice, what if my type is {x : R // x is chaitin's constant}

Kevin Buzzard (Jan 06 2022 at 23:44):

This is a difference between set theory and type theory. In ZFC you wouldn't need choice.

Kevin Buzzard (Jan 06 2022 at 23:45):

In Lean it's very clear when you need it -- it is the only route from the Prop universe to the Type universe

Yakov Pechersky (Jan 06 2022 at 23:50):

Computable, using a computable existensial:

import logic.unique

variables {X : Type*}

def unique_of_existence_and_uniqueness
  (existence : trunc X) (uniqueness :  (x y : X), x=y) : unique X :=
by letI : subsingleton X := uniqueness; exact unique_of_subsingleton (existence.lift id uniqueness)

Yakov Pechersky (Jan 06 2022 at 23:52):

trunc X is quot (λ _ _, true) of X. So a term of trunc X is equal to any other term of trunc X.

Yakov Pechersky (Jan 06 2022 at 23:53):

And since lean quotients are computable, we can "lift" the data out of trunc X, the x : X that is wrapped in the quotient, and provide it as the data-witness to unique, and this is legal because we have a proof that all x y : X are equal.

Yakov Pechersky (Jan 06 2022 at 23:54):

So it didn't matter if it was x : X "inside" the trunc X or y : X inside.

Joël Riou (Jan 06 2022 at 23:57):

Thanks for your answers! Then, similarly, if we have R : set (X × Y) such that (∀ (x : X), ∃ (y : Y), ⟨x,y⟩ ∈ R) ∧ (∀ xy xy', xy ∈ R → xy' ∈ R → xy.1 = xy.1 → xy.2 = xy.2), then we cannot define a term of type X → Y without using choice. That is indeed a big difference between ZF(C) and type theory!

For my particular case, I am afraid the computable existensial trick will not work :-(

Yakov Pechersky (Jan 06 2022 at 23:59):

Can I ask, why do you need to it to be computable? If you want computable functions, you probably wouldn't be working with set X anyway, since set can be arbitrarily large, infinite, uncountable, etc

Yakov Pechersky (Jan 07 2022 at 00:00):

Did you construct such a set, or do you want to just prove things about it?

Yakov Pechersky (Jan 07 2022 at 00:00):

You can for sure prove that this set.nonempty R as long as [nonempty X].

Joël Riou (Jan 07 2022 at 00:11):

My question was a minimal working example based on the situation I was in while working in the simplex category. I do not need computability or anything: I was only unsatisfied that choice had to be used!


Last updated: Dec 20 2023 at 11:08 UTC