monoid同态到底是什么? [英] What is monoid homomorphism exactly?

查看:163
本文介绍了monoid同态到底是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从 Monoid形态,产品和副产品,并且无法理解100%.

I've read about monoid homomorphism from Monoid Morphisms, Products, and Coproducts and could not understand 100%.

作者说(强调原文):

length函数从String映射到Int ,同时保留 单体结构.这样的功能,可以将一个半身像映射到 另一个以这种保存方式被称为 monoid homomorphism .在 一般而言,对于Monoid MN,同态f: M => N和所有值 x:My:M,以下等式成立:

The length function maps from String to Int while preserving the monoid structure. Such a function, that maps from one monoid to another in such a preserving way, is called a monoid homomorphism. In general, for monoids M and N, a homomorphism f: M => N, and all values x:M, y:M, the following equations hold:

f(x |+| y) == (f(x) |+| f(y))

f(mzero[M]) == mzero[N]

他的意思是说,由于数据类型StringInt是单面体,并且函数length映射String => Int保留单面体结构(Int是一个单面体),因此称为单面体同态,对吧?

Does he mean that, since the datatypes String and Int are monoids, and the function length maps String => Int preserving the monoid structure (Int is a monoid), it is called monoid homomorphism, right?

推荐答案

他的意思是说,数据类型String和Int是等宽的.

Does he mean, the datatype String and Int are monoid.

StringInt都不是类半体动物. id半群是一个三元组(S,&oplus ;, e),其中⊕是二元运算符⊕ :S× S→ S ,这样对于所有元素 a,b,c∈ S 都认为(a⊕ b)⊕ c = a⊕(b⊕ c),而 e∈ S 是一个身份元素",因此 a⊕ e = e⊕ a = a . StringInt是类型,因此基本上是一组值,但不是三元组.

No, neither String nor Int are monoids. A monoid is a 3-tuple (S, ⊕, e) where ⊕ is a binary operator ⊕ : S×S → S, such that for all elements a, b, c∈S it holds that (a⊕b)⊕c=a⊕(b⊕c), and e∈S is an "identity element" such that a⊕e=e⊕a=a. String and Int are types, so basically sets of values, but not 3-tuples.

文章说:

让我们将 String串联 Int添加 有关系的示例 monoids .

Let's take the String concatenation and Int addition as example monoids that have a relationship.

因此,作者显然也提到了二进制运算符(在String情况下为(++),在Int情况下为(+)).身份(在String情况下为空字符串,在Int情况下为0)保留为隐式;在非正式英语语篇中,将身份作为一种练习留给读者是很常见的.

So the author clearly also mentions the binary operators ((++) in case of String, and (+) in case of Int). The identities (empty string in case of String and 0 in case of Int) are left implicit; leaving the identities as an exercise for the reader is common in informal English discourse.

现在假设我们有两个单半体结构(M,&oplus ;, e m )(N,&otimes ;, e n ),函数 f:M→ N (例如length)然后称为 monoid同态 [wiki] ,因为它认为 f(m 1 ⊕ m 2 )= f(m 1 )⊗ f(m 2 )用于所有元素 m 1 ,m 2 ∈ M 并且该映射还保留了标识元素: f(e m )= e n .

Now given that we have two monoid structures (M, ⊕, em) and (N, ⊗, en), a function f : M → N (like length) is then called a monoid homomorphism [wiki] given it holds that f(m1⊕m2)=f(m1)⊗f(m2) for all elements m1, m2∈M and that mapping also preserves the identity element: f(em)=en.

例如length :: String -> Int是一个单面体同态,因为我们可以考虑这些单面体(String(++)"")(Int0).它认为:

For example length :: String -> Int is a monoid homomorphism, since we can consider the monoids (String, (++), "") and (Int, (+), 0). It holds that:

  1. length (s1 ++ s2) == length s1 + length s2(对于所有String s s1s2);和
  2. length "" == 0.
  1. length (s1 ++ s2) == length s1 + length s2 (for all Strings s1 and s2); and
  2. length "" == 0.

这篇关于monoid同态到底是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆