What are isomorphism and homomorphisms

Viewed 940

I tried to understand isomorphism and homomorphisms in context of programming and need some help.

In the book FPiS it explains:

enter image description here enter image description here

Let start with a homomorphisms:

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

Here, length is a function from String to Int that preserves the monoid structure.

  • Why is that a homomorphisms?

  • Why it preserve the monoid structure?

  • Is for example map on list function a homomorphisms?

About isomorphism, I have following explaination that I took it from a book:

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.

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

2 Answers
Related