对为什么所有单型形态与身份形态不相同的原因感到困惑

发布于 2025-02-09 16:29:24 字数 790 浏览 1 评论 0原文

我正忙于阅读Bartosz Milewski的程序员类别理论书籍,而我在描述非身份形态的描述是在描述单型物体作为一组和单型类别时的描述。

我了解到,当在的背景下查看单型(例如字符串)时,我们有兴趣描述使用“附加”特征的各种功能,例如一个函数附加“狗”或将“ mmm”附加到收到的输入的功能。这些功能将分别将其输入映射到字符串集中的另一个元素。这显然包括任何一无所有的可能性。

据我所知,当我们在的背景下查看此MONOID 时,据我了解,我们正在缩放到一个抽象级别,其中这种单体对象代表整个“字符串”类型,而我们没有对这种类型中元素互相映射的方式感兴趣,因为我们已经将整个类型表示为单数点/对象。

之后,我认为在此抽象级别上,“集合”上下文中描述的所有函数看起来都相同,因为它们都映射了字符串 - >细绳。在我看来,这意味着在类别的上下文中,身份函数(无附加)看起来与附录狗或附录函数相同,或者与此相关的任何其他函数。

不过,我的理由显然是不正确的,如看书中的这张图,从单型物体到自身的态度显示为独特的实体:

”

作为结尾语句/摘要: 我不明白为什么一旦我们将其提取为类别,我们仍然对在单体集中描述功能感兴趣。一旦集合成为一个类别中的对象,该对象代表整个类型,该集合中的所有功能都将不像身份函数,因为从我们的新优势开始,它们似乎都是从该类型开始的,并返回到此类型。

我希望我已经清楚地表明了我的困惑。 在此先感谢您的任何帮助!

I am busy reading Bartosz Milewski's Category Theory book for programmers and I'm struggling with the depiction of non-identity morphisms when moving between describing a monoid as a set and a monoid as a category.

I understand that when viewing a monoid (eg. a string) in the context of as a set, we are interested in describing various functions that make use of the 'append' characteristic, for example a function that appends "dog" or a function that appends "mmm" to whatever input it receives. These functions will, respectively, map their input to another element within the set of strings. This obviously includes the possibility of appending nothing.

When we view this monoid in the context of as a category, as far as I understand, we are zooming out to a level of abstraction where this monoid object represents the entire 'string' type and we are no longer interested in how elements are mapped to each other within this type, as we have represented this entire type as a singular dot/object.

Following from this, I would assume that at this level of abstraction, all functions that were described in the 'Set' context would look identical, as they all map string -> string. In my mind, this means that in the context of a category, the identity function (appending nothing) would look identical to the AppendDog or AppendMmm functions mentioned earlier, or any other function for that matter.

My reasoning is obviously incorrect though, as looking at this diagram in the book, morphisms that go from the monoid object to itself, are shown as unique entities:

Monoid as a category and set

As a closing statement/summary:
I do not understand why we are still interested in depicting functions within a monoid set once we have abstracted it to a category. Once the set becomes an object in a category, where that object represents the entire type, would all functions within that set not all look like identity functions, as from our new vantage point, they all seem to start from that type and return to that type.

I hope I've made my confusion clear.
Thanks in advance for any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

电影里的梦 2025-02-16 16:29:24

我相信您正在观察到的事实是,每个单人物都对微不足道的单体都是同态的。如果您只查看任何单体的点和箭头图,它也是微不足道的单体的有效图,但是该图不是整个图片。

当您“抽象”时,您实际上是在抛弃对单体的等价关系,并补充最弱的关系。附加“ mm”和附加“” 是不同的,但该图并未说明这一点。可以想象它们是平等的,您将获得有效的单体,但这会改变等效关系。

即使我们丢弃了一些细节,它们是不平等(或至少可能是不平等)的事实,也不应丢弃。这对结构很重要。

What I believe you are observing is the fact that every monoid is homomorphic to the trivial monoid. If you just look at the dot-and-arrow diagram of any monoid, it is also a valid diagram of the trivial monoid, but this diagram is not the whole picture.

When you are "abstracting" you are essentially throwing away the equivalence relation on the monoid and supplementing the weakest one possible. Append "mm" and Append "" are different, but the diagram doesn't illustrate that. It's possible to imagine that they are equal and you will get a valid monoid, but that changes the equivalence relation.

Even if we discard some of the specifics, the fact that they are unequal (or at least might be unequal) should not be discarded. It's important to the structure.

只等公子 2025-02-16 16:29:24

也许一个具体的例子会使这更容易讨论。因此,这是我的具体示例:

   t
┌────┐
│    ▼
└─── • ◀──┐
     │    │
     └────┘
       f

这是一个具有一个对象()和两个形态(tf)的类别。这是一个完整的类别定义吗?不,我们需要另一件事,即构图的定义。我将其作为查找表。

f ∘ f = f
f ∘ t = t
t ∘ f = t
t ∘ t = f

这是一个完整的类别定义吗?不,我们还需要一件事,即我们需要确定每个对象的形态,以作为一个身份。对于此类别,只有一个对象,f具有适合该对象的正确行为。

这是一个完整的类别定义吗?是的!您可能需要验证类别定律 - f x = x f f = x ,然后( x y )∘ z = x ∘() y z ) - 但是,您也欢迎您相信我。 如果它有助于您对这些证明的直觉,则可能需要将f读为“ false”,t为“ true”,而为Xor。)

( 那是一个对象类别。希望很明显,并非所有的形态都是一样的。肯定是正确的和错误似乎是不同的概念!

现在,将类别的上述定义与monoid的以下定义进行比较。要定义一个单体,我们必须给出一个集合的三重(M, +,0),二进制操作和身份。定义:

M = {f, t}
f + f = f
f + t = t
t + f = t
t + t = f
0 = f

这指定了XOR下的布尔值。请注意我们的两个发展有多相似。对于类别,我们给出了一个点和箭头图,该图确定了两个箭头,ft,而对于monoid定义,我们给出了一个包含两个元素的集合, ft。对于该类别,我们给了一个组成操作员,将两个形态结合在一起,而对于Monoid来说,我们给了一个操作员,该操作员占据了两个元素并返回了一个元素。对于类别,我们将f识别为身份形态,而对于monoid,我们将f确定为身份元素。对于该类别,我们证明了∘是关联的,而对于Monoid来说,我们证明了 +是关联的。对于该类别,我们证明了具有f的构图什么都不做,而对于Monoid,我们证明了添加到f中,没有任何作用。

我们需要提供的数据来定义一个单体,并且我们需要提供的数据来定义单对象类别是相同的!

Perhaps a concrete example would make this easier to discuss. So here's my concrete example:

   t
┌────┐
│    ▼
└─── • ◀──┐
     │    │
     └────┘
       f

This is a category with one object () and two morphisms (t and f). Is this a complete category definition? No, we need another thing, namely the definition of composition. I'll give it as a lookup table.

f ∘ f = f
f ∘ t = t
t ∘ f = t
t ∘ t = f

Is this a complete category definition? No, we need one more thing, which is we need to identify one morphism per object that serves as an identity. For this category, there is just one object, and f has the right behavior for that object.

Is this a complete category definition? Yes! You might want to verify the category laws -- that fx = xf = x, and that (xy) ∘ z = x ∘ (yz) -- but you're also welcome to take my word for it. (If it helps your intuition for those proofs, you might want to read f as "false", t as "true", and ∘ as XOR.)

Okay, so that's a one object category. Hopefully it's clear that not all the morphisms are the same. Surely true and false seem like distinct concepts!

Now compare the above definition of a category to the following definition of a monoid. To define a monoid, we have to give a triple (M, +, 0) of a set, a binary operation, and an identity. Define:

M = {f, t}
f + f = f
f + t = t
t + f = t
t + t = f
0 = f

This specifies the monoid of booleans under xor. Note how similar our two developments were. For the category, we gave a dots-and-arrows diagram that identified two arrows, f and t, while for the monoid definition, we gave a set containing two elements, f and t. For the category, we gave a composition operator that combined two morphisms into one, while for the monoid, we gave an operator that took two elements of the set and returned an element. For the category, we identified f as the identity morphism, while for the monoid, we identified f as the identity element. For the category, we proved that ∘ was associative, while for the monoid, we proved that + was associative. For the category, we proved that composition with f does nothing, while for the monoid, we proved that adding to f does nothing.

The data we need to provide to define a monoid and the data we need to provide to define a one-object category are identical!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文