Number of morphisms
Considering the category 𝗦𝗲𝘁,
the number of morphisms in full subcategories of 𝗦𝗲𝘁 spanned by
{ {}, {1}, {1, 2}, ..., {1, 2, ..., n} }
is calculated by the formula below.
For any natural number k
, consider the set X_k = {1, 2, ..., k}
. In particular, X_0
is empty. For any natural number n
, let S_n
be the full subcategory of 𝗦𝗲𝘁 category spanned by the objects X_0, X_1,...,X_n
. Then S_n
has some number of morphisms, #S_n
. When n = -1
, we consider S_n
to be empty. So this sequence is: #S_0, #S_1, #S_2, etc.
n
a(n)
+increase
type
0
1
0
Void
1
3
+2
Unit
2
11
+8
Bool
3
60
+49
Ordering
Subcategory of 𝗛𝗮𝘀𝗸 with 3 types
The 3 objects are: Void
, Unit
and Bool
There are 11 arrows in this subcategory:
#
function signature
1
id :: Void → Void
2
void2Unit :: Void → ()
4
void2Bool :: Void → Bool
10
unit2True :: () → Bool
11
unit2False :: () → Bool
3
id :: () → ()
9
bool2Unit :: Bool → ()
5
id :: Bool → Bool
6
not :: Bool → Bool
7
⟙ :: Bool → Bool
8
⟘ :: Bool → Bool
Summary
each type has an identity arrow, 3 id arrows total
the type
Void
is uninhabitedthe type
Unit
has 1 term (value)the type
Bool
has 2 terms (values)there are no functions going into
Void
(except id on Void)these functions cannot be constructed anyway
no function
∅ :: () → Void
since 0¹ = 0no function
∅ :: Bool → Void
since 0² = 0
there is 1 function from any type to
Void
, here1 function from
Void
toUnit
1 function from
Void
toBool
there are 7 functions into
Bool
Void to Bool exists but cannot be constructed
Unit to Bool comes in 2 variants:
a function that sends unit to True
a function that sends unit to False
there are 4 functions from Bool to Bool:
id, not, ⟙ (alwaysTrue), ⟘ (alwaysFalse)
Void domain
It is evident that there's only 1 function from Void to unit, but it might be strange there's only 1 function from Void to Bool - since Bool has two elements (terms or values), one might expect there are two constant functions, like 'always true' and 'always false'. This is indeed true when the domain is unit, but not in the case of Void because all functions from Void to Bool (or any other type a
) are (extensionally) the same. That is, there's no value of type Void to feed into such function, which makes all such functions collapse into one. A function devoid :: Void -> Bool
need not have a ody defined at all - we can just put undefined
since it will never be called anyway; it's futile to define it as devoid _ = False
as it is to define it as devoid _ = True
, so we just do devoid _ = undefined
. Also, because n⁰ = 1
hints that, no matter how many inhabitants a type n
has, there is only a single function from it to Void (which has 0 inhabitants). It may seem there are as many functions as there are elements in n
, but it turns out they are indistinguishable from each other with Void as domain.
Extensional equality: two functions are equal if, for every argument, they produce the same result. Or, conversely, to prove that two functions are different, you have to provide a value for the argument on which these two functions differ. Obviously, if the argument type is Void, you cannot do that.
Last updated
Was this helpful?