Method: Cantor::RelativeComplement#intersection

Defined in:
lib/cantor/relative_complement.rb

#intersection(other) ⇒ Object



53
54
55
56
57
58
59
60
61
# File 'lib/cantor/relative_complement.rb', line 53

def intersection(other)
  if other.is_a?(RelativeComplement)
    # ¬A ∩ ¬B = ¬(A ∪ B)
    complement.union(other.complement).complement
  else
    # ¬A ∩ B = B ∖ A
    Cantor.build(other).difference(complement)
  end
end