MathPHP\SetTheory\Set::isProperSuperset PHP Method

isProperSuperset() public method

Superset (A ⊇ B & A ≠ B) Is the set a superset of the other set? In other words, does the the set contain all the elements of the other set, and the set is not the same set as the other set?
public isProperSuperset ( Set $B ) : boolean
$B Set
return boolean
    public function isProperSuperset(Set $B) : bool
    {
        $B_array = $B->asArray();
        $A∩B = array_intersect_key($this->A, $B_array);
        $A∖B = array_diff_key($B_array, $this->A);
        return count($A∩B) === $B->length() && empty($A∖B) && $this != $B;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @dataProvider dataProviderForIsProperSet
  */
 public function testIsProperSuperset(array $A, array $B)
 {
     $setA = new Set($B);
     $setB = new Set($A);
     $this->assertFalse($setA->isProperSuperset($setB));
 }