加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

scala – 什么是同构和同态

发布时间:2020-12-16 09:57:05 所属栏目:安全 来源:网络整理
导读:我试图在编程环境中理解同构和同态,需要一些帮助. 在FPiS一书中,它解释了: 让我们从同态开始: "foo".length + "bar".length == ("foo" + "bar").length 这里,length是一个从String到Int的函数,它保留了幺半群结构. 为什么这是一个同态? 为什么它保留了幺
我试图在编程环境中理解同构和同态,需要一些帮助.

在FPiS一书中,它解释了:

enter image description here


enter image description here

让我们从同态开始:

"foo".length + "bar".length == ("foo" + "bar").length

这里,length是一个从String到Int的函数,它保留了幺半群结构.

>为什么这是一个同态?
>为什么它保留了幺半群结构?
>例如列表上的映射函数是同态吗?

关于同构,我从一本书中得到了以下解释:

A monoid isomorphism between M and N has two homomorphisms
f and g,where both f andThen g and g andThen f are an identity function.
For example,the String and List[Char] monoids with concatenation are isomorphic.
The two Boolean monoids (false,||) and (true,&&) are also isomorphic,
via the ! (negation) function.

为什么(false,||),(true,&&)和String和List [Char] monoid连接是同构的?

解决方法

Why is that a homomorphisms?

根据定义.

Why it preserve the monoid structure?

因为上面的表达式中的==.

Is for example map on list function a homomorphisms?

是.将“foo”和“bar”替换为两个列表,将.length替换为.map(f).然后很容易看到(并证明)方程式成立.

Why (false,&&) and String and List[Char] monoids with concatenation are isomorphism?

根据定义.证明是微不足道的,留作练习. (提示:采用同构的定义,用具体对象替换所有抽象对象,证明结果数学表达式是正确的)

编辑:以下是您在评论中提到的几个定义:

>同态:将一组转换为另一组,在第二组中保留第一组元素之间的关系.形式上f:A→B,其中A和B都具有*运算,使得f(x * y)= f(x)* f(y).> Monoid:具有单个关联二元运算和标识元素的代数结构.形式上(M,*,id)是Monoid iff(a * b)* c == a *(b * c)&& a * id == a&& id * a == a for a a,b,c in M.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读