A Semilattice consists of a set S
and a closed binary operation ⊕
which is
- associative, ie ∀ x, y, z ∈ S: x ⊕ (y ⊕ z) = (x ⊕ y) ⊕ z
- commutative, ie ∀ x, y ∈ S: x ⊕ y = y ⊕ x
- idempotent, ie ∀ x ∈ S: x ⊕ x = x
if we have some type S
and some binary function ⊕
which together form a Semilattice, then can we define a case class C(s: S)
which is also a Semilattice?