Skip to content

Commit

Permalink
Merge pull request twitter#339 from twitter/addCommentSemiring
Browse files Browse the repository at this point in the history
Add a commment to close 334
  • Loading branch information
ianoc committed Sep 2, 2014
2 parents 5b78506 + 96d6a0c commit f1fcc80
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions algebird-core/src/main/scala/com/twitter/algebird/Ring.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ import scala.annotation.implicitNotFound
* - additive identity aka zero
* - addition
* - multiplication
*
*
* Note, if you have distributive property, additive inverses, and multiplicative identity you
* can prove you have a commutative group under the ring:
*
* 1. (a + 1)*(b + 1) = a(b + 1) + (b + 1)
* 2. = ab + a + b + 1
* 3. or:
* 4.
* 5. = (a + 1)b + (a + 1)
* 6. = ab + b + a + 1
* 7.
* 8. So: ab + a + b + 1 == ab + b + a + 1
* 9. using the fact that -(ab) and -1 exist, we get:
* 10. a + b == b + a
*/

@implicitNotFound(msg = "Cannot find Ring type class for ${T}")
Expand Down

0 comments on commit f1fcc80

Please sign in to comment.