{"action":"created","issue":{"url":"https://api.github.com/repos/non/algebra/issues/89","labels_url":"https://api.github.com/repos/non/algebra/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/non/algebra/issues/89/comments","events_url":"https://api.github.com/repos/non/algebra/issues/89/events","html_url":"https://github.com/non/algebra/issues/89","id":110539617,"number":89,"title":"Heyting#asCommutativeRing broken","user":{"login":"TomasMikula","id":433439,"avatar_url":"https://avatars.githubusercontent.com/u/433439?v=3","gravatar_id":"","url":"https://api.github.com/users/TomasMikula","html_url":"https://github.com/TomasMikula","followers_url":"https://api.github.com/users/TomasMikula/followers","following_url":"https://api.github.com/users/TomasMikula/following{/other_user}","gists_url":"https://api.github.com/users/TomasMikula/gists{/gist_id}","starred_url":"https://api.github.com/users/TomasMikula/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TomasMikula/subscriptions","organizations_url":"https://api.github.com/users/TomasMikula/orgs","repos_url":"https://api.github.com/users/TomasMikula/repos","events_url":"https://api.github.com/users/TomasMikula/events{/privacy}","received_events_url":"https://api.github.com/users/TomasMikula/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-10-08T20:57:27Z","updated_at":"2015-10-09T03:14:47Z","closed_at":null,"body":"`Heyting#asCommutativeRing` seems to be broken. The problem is with the [`negate`](https://github.com/non/algebra/blob/0f8f8df5b62473be5bea06266747657b56ff196a/core/src/main/scala/algebra/lattice/Heyting.scala#L58) method: `complement` is not an inverse with respect to `xor`.\r\n\r\nAs an example, consider the usual interpretation of the type `Boolean = {false, true}` as a Boolean algebra.\r\n\r\nFrom the additive group, we have the law\r\n\r\n    plus(x, negate(x)) = zero\r\n\r\nSubstituting `one` for `x` we get\r\n\r\n    plus(one, negate(one)) = zero\r\n\r\nAnd now replace `plus` by `xor`, `negate` by `¬`, `zero` by `false` and `one` by `true` (as defined in `asCommutativeRing`):\r\n\r\n    xor(true, ¬true) = false\r\n\r\ni.e.\r\n\r\n    xor(true, false) = false\r\n\r\nwhich is a contradiction.\r\n\r\nFWIW, I don't immediately see how this could be fixed, i.e. I don't see how every Heyting algebra gives rise to a commutative ring."},"comment":{"url":"https://api.github.com/repos/non/algebra/issues/comments/146744912","html_url":"https://github.com/non/algebra/issues/89#issuecomment-146744912","issue_url":"https://api.github.com/repos/non/algebra/issues/89","id":146744912,"user":{"login":"TomasMikula","id":433439,"avatar_url":"https://avatars.githubusercontent.com/u/433439?v=3","gravatar_id":"","url":"https://api.github.com/users/TomasMikula","html_url":"https://github.com/TomasMikula","followers_url":"https://api.github.com/users/TomasMikula/followers","following_url":"https://api.github.com/users/TomasMikula/following{/other_user}","gists_url":"https://api.github.com/users/TomasMikula/gists{/gist_id}","starred_url":"https://api.github.com/users/TomasMikula/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TomasMikula/subscriptions","organizations_url":"https://api.github.com/users/TomasMikula/orgs","repos_url":"https://api.github.com/users/TomasMikula/repos","events_url":"https://api.github.com/users/TomasMikula/events{/privacy}","received_events_url":"https://api.github.com/users/TomasMikula/received_events","type":"User","site_admin":false},"created_at":"2015-10-09T03:14:47Z","updated_at":"2015-10-09T03:14:47Z","body":"I have a situation where I need to talk about a Boolean algebra (potentially) without a unit. I don't have a good name for it, but there is a good name for a Boolean ring without a unit - Boolean rng (see also [my question on math.stackexchange](http://math.stackexchange.com/questions/1469539/name-for-a-boolean-ring-without-a-unit-element)). So I will have methods parameterized by `[A: BoolRng]`. If someone has a `Bool`, that should be good enough, except `Bool#asCommutativeRing` only returns a `CommutativeRing`, which is not enough. Anyway, this does not concern the current state of `algebra` directly (since it has no `BoolRng`), but this is the use case that I had in mind.\r\n\r\nAn example of a Boolean algebra without the top element is the set of finite subsets of an infinite set. For example, the type `Set[String]`."}}