Zulip Chat Archive

Stream: general

Topic: display of inhabited


ZHAO Jinxiang (Aug 17 2022 at 16:41):

#eval inhabited 
#eval inhabited  × 
#eval nat.add (1 : ) (inhabited )
#eval inhabited (Type*)

I found all of these are

result type does not have an instance of type class 'has_repr', dumping internal representation
#0

Is there any way to display it?

Eric Wieser (Aug 17 2022 at 16:42):

What do you want it to display?

Eric Wieser (Aug 17 2022 at 16:42):

What should #eval inhabited empty display?

ZHAO Jinxiang (Aug 17 2022 at 16:43):

I want to know what will happen if I calculate it.

Eric Wieser (Aug 17 2022 at 16:44):

What do you mean by "calculate"? What does #eval ℕ mean to you, and what does it calculate?

Eric Wieser (Aug 17 2022 at 16:44):

(I think the real answer here is that you meant to write #eval (default : ℕ))

ZHAO Jinxiang (Aug 17 2022 at 16:48):

Yes, default is what I need.

ZHAO Jinxiang (Aug 17 2022 at 16:49):

What's the meaning of #eval (default : Type*).
I think this is the terminal object of category_theory.types

So I think this is unit


Oh, the display of #eval ℕ is also #0

ZHAO Jinxiang (Aug 17 2022 at 17:01):

Oh, I find it works.

#eval (unit.star : (default : Type*))

ZHAO Jinxiang (Aug 17 2022 at 17:03):

Is there other way to check default : Type* is unit?

Kyle Miller (Aug 17 2022 at 17:03):

You'll have better luck with #reduce

#reduce (default : Type*)
-- punit

Kyle Miller (Aug 17 2022 at 17:03):

#eval uses the VM compiler and evaluation, but #reduce uses term reduction

ZHAO Jinxiang (Aug 17 2022 at 17:04):

Thanks!

ZHAO Jinxiang (Aug 17 2022 at 17:47):

Another question:

#reduce (category_theory.with_terminal.inhabited Type*).default
#reduce (category_theory.with_initial.inhabited Type*).default
#reduce (category_theory.with_terminal.inhabited Group).default
#reduce (category_theory.with_initial.inhabited Group).default

Why both initial object and terminal object of category_theory.types is punit?

ZHAO Jinxiang (Aug 17 2022 at 17:58):

In the category of sets, the initial object is the empty set.
Why in category of type, the initial object is not pempty?

Adam Topaz (Aug 17 2022 at 18:02):

pempty is an initial object. There is no "the" initial object.

Adam Topaz (Aug 17 2022 at 18:03):

punit is not an initial object in Type*

Adam Topaz (Aug 17 2022 at 18:04):

with_initial formally adds an initial object. I think that's the source of your confusion.

ZHAO Jinxiang (Aug 17 2022 at 18:05):

#reduce (category_theory.with_initial.inhabited Type*).default
-- with_initial.of punit

Adam Topaz (Aug 17 2022 at 18:05):

And?

ZHAO Jinxiang (Aug 17 2022 at 18:05):

I don't understand the result of it.

Adam Topaz (Aug 17 2022 at 18:06):

docs#category_theory.with_initial

Adam Topaz (Aug 17 2022 at 18:06):

As I said, that construction formally adds an initial object. It has an inhabited instance, and the default elemt happens to be punit.star

ZHAO Jinxiang (Aug 17 2022 at 18:08):

Oh, I see. Thank you.

ZHAO Jinxiang (Aug 17 2022 at 18:08):

Is there any lemma told me that pempty is an initial object for type category.

Adam Topaz (Aug 17 2022 at 18:09):

Existence of initial and terminal objects is handled by the typeclass system. See docs#category_theory.limits.initial

Adam Topaz (Aug 17 2022 at 18:09):

docs#category_theory.type.is_initial_pempty perhaps?

Adam Topaz (Aug 17 2022 at 18:10):

Hmmm... sorry I'm on mobile right now so I can't help much.

ZHAO Jinxiang (Aug 17 2022 at 18:13):

category_theory.limits.types.initial_iso

category_theory.limits.types.terminal_iso


Last updated: Dec 20 2023 at 11:08 UTC