Number of morphisms

https://oeis.org/A231344

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.

arrows :: Integral a => a -> a
arrows n = sum [ i ^ j | i <- [0..n], j <- [0..n] ]
The formula is
  a(n) = sum_{ 0 <= i,j <= n } i^j
that is
  a(n) = ฮฃ mแต  for m=[0..n], k=[0..n]

n    n
โŽฒ  โŽฒ
โŽณ  โŽณ  mแต
m=0 k=0


for m in 0..n:
  for k in 0..n:
    mแต

if n = 0 then a(n) = 1:
  0โฐ = 1

if n = 1 then a(n) = 3:
  0โฐ + 0ยน  =  1 + 0 = 1
  1โฐ + 1ยน  =  1 + 1 = 2

if n = 2 then a(n) = 11:
  0โฐ + 0ยน + 0ยฒ       =    1 + 0 + 0       = 1
  1โฐ + 1ยน + 1ยฒ       =    1 + 1 + 1       = 3
  2โฐ + 2ยน + 2ยฒ       =    1 + 2 + 4       = 7

if n = 3 then a(n) = 60:
  0โฐ + 0ยน + 0ยฒ + 0ยณ  =    1 + 0 + 0 + 0   = 1
  1โฐ + 1ยน + 1ยฒ + 1ยณ  =    1 + 1 + 1 + 1   = 3+1
  2โฐ + 2ยน + 2ยฒ + 2ยณ  =    1 + 2 + 4 + 8   = 7+8
  3โฐ + 3ยน + 3ยฒ + 3ยณ  =    1 + 2 + 4 + 27  = 7+27


0โฐ        0ยน + 0ยฒ + 0ยณ + 0โด + 0โต + 0โถ + 0โท
1โฐ + 1ยน        1ยฒ + 1ยณ + 1โด + 1โต + 1โถ + 1โท
2โฐ + 2ยน + 2ยฒ        2ยณ + 2โด + 2โต + 2โถ + 2โท
3โฐ + 3ยน + 3ยฒ + 3ยณ        3โด + 3โต + 3โถ + 3โท
4โฐ + 4ยน + 4ยฒ + 4ยณ + 4โด        4โต + 4โถ + 4โท
5โฐ + 5ยน + 5ยฒ + 5ยณ + 5โด + 5โต        5โถ + 5โท
6โฐ + 6ยน + 6ยฒ + 6ยณ + 6โด + 6โต + 6โถ        6โท
7โฐ + 7ยน + 7ยฒ + 7ยณ + 7โด + 7โต + 7โถ + 7โท

Subcategory of ๐—›๐—ฎ๐˜€๐—ธ with 3 types

The 3 objects are: Void, Unit and Bool

There are 11 arrows in this subcategory:

Summary

  • each type has an identity arrow, 3 id arrows total

  • the type Void is uninhabited

  • the 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ยน = 0

    • no function โˆ… :: Bool โ†’ Void since 0ยฒ = 0

  • there is 1 function from any type to Void, here

    • 1 function from Void to Unit

    • 1 function from Void to Bool

  • 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