问题描述
我试图在编程的背景下理解同构和同构,并且需要一些帮助.
I tried to understand isomorphism and homomorphisms in context of programming and need some help.
在FPiS书中,它解释了:
In the book FPiS it explains:
让我们从同构开始:
"foo".length + "bar".length == ("foo" + "bar").length
在这里,长度是String to Int
中的一个函数,它保留了类半球形结构.
Here, length is a function from String to Int
that preserves the monoid structure.
-
为什么是同态的?
Why is that a homomorphisms?
为什么保留monoid结构?
Why it preserve the monoid structure?
例如list
上的map
是否具有同态功能?
Is for example map
on list
function a homomorphisms?
关于同构,我有以下解释是我从书中摘录的:
About isomorphism, I have following explaination that I took it from a book:
为什么(false, ||), (true, &&)
和String and List[Char] monoids with concatenation
是同构的?
推荐答案
按定义.
由于上面的表达式中的==
.
Because of the ==
in the expression above.
是的.将"foo"
和"bar"
替换为两个列表,将.length
替换为.map(f)
.这样就很容易看到(证明)该方程式成立.
Yes. Replace "foo"
and "bar"
by two lists, and .length
by .map(f)
. It's then easy to see (and prove) that the equation holds.
按定义.证明是微不足道的,留作练习. (提示:采用同构的定义,用具体对象替换所有抽象对象,证明所得到的数学表达式正确)
By definition. The proof is trivial, left as an exercise. (Hint: take the definition of an isomorphism, replace all abstract objects with concrete objects, prove that the resulting mathematical expression is correct)
编辑:这是您在评论中要求的几个定义:
Edit: Here are the few definitions you asked in comments:
-
同态:从一个集合到另一个集合的转换,在第二个集合中保留了第一个集合之间的关系.正式
f: A → B
,其中A
和B
都具有*
操作,使得f(x * y) = f(x) * f(y)
.
Homomorphism: a transformation of one set into another that preserves in the second set the relations between elements of the first. Formally
f: A → B
where bothA
andB
have a*
operation such thatf(x * y) = f(x) * f(y)
.
Monoid:具有单个关联二进制运算和一个恒等式元素的代数结构.正式(M, *, id)
是Monoid iff (a * b) * c == a * (b * c) && a * id == a && id * a == a for all a, b, c in M
.
Monoid: algebraic structure with a single associative binary operation and an identity element. Formally (M, *, id)
is a Monoid iff (a * b) * c == a * (b * c) && a * id == a && id * a == a for all a, b, c in M
.
这篇关于什么是同构和同构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!