xacid: (Default)
[personal profile] xacid
http://www.cs.ox.ac.uk/people/daniel.james/iso/iso.pdf

When are two types the same? In this paper we argue that isomorphism is a more useful notion than equality. We explain a succinct and elegant approach to establishing isomorphisms, with our focus on showing their existence over deriving the witnesses. We use category theory as a framework, but rather than chasing diagrams or arguing with arrows, we present our proofs in a calculational style. In particular, we hope to showcase to the reader why the Yoneda lemma and adjunctions should be in their reasoning toolbox.

Date: 2020-05-11 09:17 pm (UTC)
From: [personal profile] sassa_nf
HoTT says isomorphism is equivalent to equality :)

Date: 2020-05-12 01:51 am (UTC)
juan_gandhi: (Default)
From: [personal profile] juan_gandhi
Фигасе. Я на такое и не надеялся по жизни. Думал, вообще, есть ли такие люди, что отличают скелет от целой категории.

Впрочем, как писал Бауэр, Хаск и не категория вовсе, а так.

Date: 2020-05-12 01:52 pm (UTC)
juan_gandhi: (Default)
From: [personal profile] juan_gandhi
Ха, надо этот переварить. И казалось бы, что должно было быть очевидно. Ан нет. Надо, надо обдумать. Все через представимые.

Date: 2020-05-12 02:06 pm (UTC)
juan_gandhi: (Default)
From: [personal profile] juan_gandhi
Скелет - это берем категорию и отождествляем все изоморфные объекты, так что в результате имеем по экземпляру каждого, а эти изоморфизмы мапим в identity (тут не уверен, надо посоображать).

Date: 2020-05-12 03:18 pm (UTC)
juan_gandhi: (Default)
From: [personal profile] juan_gandhi
Да не, мы ничего не вычисляем. Как это вычислить-то. Просто декларируем, мол, в скелете изоморфные объекты равны. А уж как скелет устроен - без разницы; ну две категории скелетов будут же изоморфны, а не просто эквивалентны.

Date: 2020-05-12 05:33 pm (UTC)
From: [personal profile] sassa_nf
> это ж функтор такой?

Why not? Just not a faithful functor. (Surjective)

> а как функтор вычисляет изоморфность обьектов?

No need. What you need, is map arrows that are isomorphisms into id of some object. Then a functor is bound to map the objects on both ends of isomorphism into the same object to preserve composition.

Date: 2020-05-12 05:17 pm (UTC)
From: [personal profile] sassa_nf
Do you understand their reasoning? I am not sure why the isomorphism they discuss in section 3 (Yoneda Lemma) does not imply that A is isomorphic to (A→⊥)→⊥.

I know it's the famous Yoneda Lemma, but in this light it looks strange.

I am still under impression that for inhabited types A type (A→⊥)→(A→⊥) is isomorphic to T because (A→⊥) cannot be inhabited, and (A→⊥)→(A→⊥) can only have one function, id, hence isomorphism to T.

If this is so, then how can A→A be isomorphic to (A→⊥)→(A→⊥)? But if it _is_ isomorphic, then how come (A→⊥)→(A→⊥) has more than one inhabitant?
Edited Date: 2020-05-12 05:39 pm (UTC)

Date: 2020-05-12 05:54 pm (UTC)
From: [personal profile] sassa_nf
I can't :) that's why I am wondering what I am missing. They shouldn't be isomorphic, and I am wondering how do we not end up with isomorphism like that.

I think I start to understand that my premise what polymorphic functions mean, is wrong. I used to imagine that ∀ X . A→X is a negation (I was told CPS is double-negation, that's why!), the same as A→⊥. But now I seem to get that it is not so. ∀ X means one more argument, and CPS is double negation only for X=⊥.
Edited Date: 2020-05-12 05:54 pm (UTC)

Date: 2020-05-13 07:06 am (UTC)
From: [personal profile] sassa_nf
(a →⊥)→⊥ = a in the negative (ie boolean) segment.

That is, for all a = b → ⊥ for some b.

Date: 2020-05-14 07:08 am (UTC)
From: [personal profile] sassa_nf
Maybe you know most of the below, I'll just state it for completeness.


Curry-Howard isomorphism establishes a correspondence between types and propositions, and proofs and programs.

That is, a proposition is true, if there is a program of the corresponding type. This means a type is inhabited.

A false is represented by a type postulated to be uninhabited, ⊥. (Notice "postulated" - this is the type whose emptiness does not require a proof)

A negation is represented as implication of false. You will recall this from the definition of implication.

That is, a proposition "not A" is a type A→⊥. You can easily see that for inhabited types A type A→⊥ is uninhabited, and for uninhabited types A type A→⊥ is inhabited. What is the latter one inhabited with? A function that establishes isomorphism of types A and ⊥ (or you could think of id in the skeleton category).

Then to see the former case, that A→⊥ is uninhabited for an inhabited type A, consider idA→⊥: (A→⊥)→(A→⊥). Given a witness of type A (given a proof that A is inhabited), (flip id) can produce a proof that (A→⊥) is isomorphic to ⊥ - i.e. A→((A→⊥)⊥). This is only one side of isomorphism.

The other part of isomorphism is always there: it is postulated that there is an arrow from uninhabited type ⊥ to every other type such that any diagrams with it commute. You can see this as the existence of ⊥→A - existence without a proof (because it is postulated). You can also see this as the part of implication where "everything follows from false premise - both false (id) and true".

The "any diagrams with it commute" means that ⊥→A≡B→A for any B, if B→A factors through ⊥ - that is, if at some point you are able to compute an "instance" of ⊥.


Now we can show that (B→⊥)→⊥≡B for B=A→⊥. You can see that this can be rewritten as ((A→⊥)→⊥)→⊥≡A→⊥, which is none other than a proof of extensional equality of two functions.

Extensional equality of functions f and g of type A→B is: given any value of type A they should produce equal values of type B. That is a proposition of type (a:A)→(f a≡g a). If this proposition is inhabited for given f and g, then we call type f≡g inhabited (equality of functions proven).


The proof is trivial:

flatten-triple : {A : Set} ((((A→⊥)→⊥)→⊥)) → (A→⊥)
flatten-triple f a = f (flip id a)

bool : {A : Set} (g : A→⊥) → flatten-triple (flip id g) ≡ g
bool g = ext λ a → ⊥-elim (g a) -- remember the function from ⊥ to any type? Here is the arrow to the type flatten-triple (flip id g) a ≡ g a

Then we use extentionality axiom to prove double negation of g and g are equal. Since we can do this for any witness g, we conclude the types are isomorphic: composition of (flip id) and flatten-triple is id; you can similarly show the opposite, too; two types have arrows whose composition is respective id - isomorphism established, and the types are proven equivalent (and equal, if we have univalence axiom).

If double negation of A is equal to A, the logic is boolean. So the whole negative segment of intuitionistic logic is boolean. (That is, the segment of types that are of the form A→⊥)

You can see why this is so. Remember that all types of the form A→⊥ are either empty (contain no functions; the type is isomorphic to ⊥) or contain one function, id (the type is isomorphic to T). This observation makes the negative segment so boring: it's all just ones or zeros!
Edited Date: 2020-05-14 07:49 am (UTC)

Date: 2020-05-14 03:04 pm (UTC)
From: [personal profile] sassa_nf
Yoneda Lemma doesn't imply that. But their paper uses weird notation and handwavy explanations (at least in the key moment where they transition from parametricity to functors), so all I am wondering is how they don't end up with isomorphism like that. :)

The weird notation is:

C(A,B) ≅ ∀ X . C(B,X) → C(A,X)

The _→_ is not just a function from a set to a set here. What does ∀ X mean? They mean many more unsaid things. Because it really should be a Hom-set for a category of functors from C to Set - eg commutativity implied (for C(B,X)→C(A,X) and C(B,Y)→C(A,Y) for all functions f : X→Y).
Edited Date: 2020-05-14 03:16 pm (UTC)

Date: 2020-05-15 10:13 am (UTC)
From: [personal profile] sassa_nf
> categorical language
> ∀X : C(B, X) -> C(A, X)

What's this in categorical language?

Suppose this is a set, because C(A,B) is a set. Does it describe a set of all functions between sets C(B,X) and C(A,X)? No, it should not, because X is not fixed.

Is this then a set of functions (X : Set) -> C(B, X) -> C(A, X)? That is, a function from a set of types (it is a set, because C is small) to a set of functions from C(B,X) to C(A,X)? No, Yoneda lemma specifically restricts this to such a set of functions that make things commute.

I know Yoneda lemma means Hom(C(B,_), C(A,_)) in this place. It is this fact that makes things commute in that notation - that is, the fact that this set is the set of arrows between functors in the category SetC.

Besides, this is exactly what they don't explain - how one jumps from parametricity to natural transformations. I know everyone does it, but this notation is hardly an explanation.
Edited Date: 2020-05-15 10:49 am (UTC)

Date: 2020-05-14 07:53 am (UTC)
From: [personal profile] sassa_nf
As for (a -> r) -> r, I haven't grasped yet how that is double negation of a. True, if r is free, then this is a family of functions that includes (a -> ⊥) -> ⊥, but not yet sure why they call the whole generic thing double negation.

Date: 2020-05-14 03:18 pm (UTC)
From: [personal profile] sassa_nf
Well, if it is not a logical negation, then maybe.

ncatlab speaks of continuation monad working one way: A→(A→B)→B. That's not problematic. What I am curious about, is it working the opposite way - ((A→B)→B)→A. That would mean the logic of CCC is boolean. I did not think it was.
Edited Date: 2020-05-14 03:33 pm (UTC)

Date: 2020-05-14 05:44 pm (UTC)
From: [personal profile] sassa_nf
Not convinced.

((α → β) → α) → α is not problematic. ((α → β) → α) → α comparison to ((α → ⊥) → ⊥) → α is problematic. For example, where will call-cc get α from? How do they get call-cc return type is α? Why is it not ((α → ⊥) → ⊥) → ⊥? (Not problematic again)
Edited Date: 2020-05-14 06:39 pm (UTC)

Date: 2020-05-15 11:31 pm (UTC)
From: [personal profile] sassa_nf
Why do you freely replace β with ⊥?

Say, in Haskell ignoring β does not imply that it is ⊥ - it is kept for side-effects.

Date: 2020-05-16 07:17 am (UTC)
From: [personal profile] sassa_nf
The problem is with the ability to populate uninhabited type α→⊥ - if you replace β with ⊥, you get a call-cc that declares it is able to construct one such function.

It doesn't matter whether you are going to get α from ¬¬α after that: you simply end up with a broken logic.

In Haskell call-cc is in ContT, and the type is ((a->m b)->m a)->m a for some monad m. Replacing m b with ⊥ would be very brave. (And it's obvious the function that receives m b can only use the result for side-effects, whatever they may be in monad m.)
Edited Date: 2020-05-16 07:31 am (UTC)

Profile

xacid: (Default)
xacid

April 2021

S M T W T F S
    123
45678910
11121314151617
18192021222324
252627282930 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 18th, 2025 07:49 am
Powered by Dreamwidth Studios