MathPHP\SetTheory\Set::isProperSubset PHP Méthode

isProperSubset() public méthode

Proper subset (A ⊆ B & A ≠ B) Is the set a proper subset of the other set? In other words, does the other set contain all the elements of the set, and the set is not the same set as the other set?
public isProperSubset ( Set $B ) : boolean
$B Set
Résultat boolean
    public function isProperSubset(Set $B) : bool
    {
        $B_array = $B->asArray();
        $A∩B = array_intersect_key($this->A, $B_array);
        $A∖B = array_diff_key($this->A, $B_array);
        return count($A∩B) === count($this->A) && empty($A∖B) && count($this->A) === count($B);
    }

Usage Example

 /**
  * @dataProvider dataProviderForIsProperSet
  */
 public function testIsProperSubset(array $A, array $B)
 {
     $setA = new Set($A);
     $setB = new Set($B);
     $this->assertTrue($setA->isProperSubset($setB));
 }