PHP Class MathPHP\SetTheory\SetAxiomsTest

If all the set logic is implemented properly, these tests should all work out according to the axioms. Axioms tested: - Subsets - Ø ⊆ A - A ⊆ A - A = B iff A ⊆ B and B ⊆ A - Union - A ∪ B = B ∪ A - A ∪ (B ∪ C) = (A ∪ B) ∪ C - A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) - A ∪ (A ∩ B) = A - A ⊆ (A ∪ B) - A ∪ A = A - A ∪ Ø = A - |A ∪ B| = |A| + |B| - |A ∩ B| - Intersection - A ∩ B = B ∩ A - A ∩ (B ∩ C) = (A ∩ B) ∩ C - A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) - A ∩ (A ∪ B) = A - (A ∩ B) ⊆ A - A ∩ A = A - A ∩ Ø = Ø - Complement (difference) - A ∖ B ≠ B ∖ A for A ≠ B - A ∖ A = Ø - Symmetric difference - A Δ B = (A ∖ B) ∪ (B ∖ A) - Cartesian product - A × Ø = Ø - A × (B ∪ C) = (A × B) ∪ (A × C) - (A ∪ B) × C = (A × C) ∪ (B × C) - |A × B| = |A| * |B| - Power set - |S| = n, then |P(S)| = 2ⁿ
Inheritance: extends PHPUnit_Framework_TestCase
Exibir arquivo Open project: markrogoyski/math-php

Public Methods

Method Description
dataProviderForSingleSet ( )
dataProviderForThreeSets ( )
dataProviderForTwoSets ( )
dataProviderForTwoSetsDifferent ( )
testACartesianProductWithEmptySetIsEmptySet ( Set $A ) Axiom: A × Ø = Ø A cartesian product with empty set is the empty set
testACrossUnsionBCEqualsACrossBUnionACrossC ( Set $A, Set $B, Set $C ) Axiom: A × (B ∪ C) = (A × B) ∪ (A × C) A cross union of B and C is the union of A cross B and A cross C
testADiffBDifferentFromBDiffAWhenNotEqual ( Set $A, Set $B ) Axiom: A ∖ B ≠ B ∖ A for A ≠ B A diff B does not equal B diff A if A and B are different sets
testADiffItselfIsEmptySet ( Set $A ) Axiom: A ∖ A = Ø A diff itself is the empty set
testAIntersectionAEqualsA ( Set $A ) Axiom: A ∩ A = A A intersection A equals A
testAIntersectionBIsSubsetOfA ( Set $A, Set $B ) Axiom: (A ∩ B) ⊆ A A intersect B is a subset of A
testAIntersectionEmptySetIsEmptySet ( Set $A ) Axiom: A ∩ Ø = Ø A union empty set is A
testAIsSubsetOfAUnionB ( Set $A, Set $B ) Axiom: A ⊆ (A ∪ B) A is a subset of A union B
testASymmetricDifferentBEqualsUnionADiffBAndBDiffA ( Set $A, Set $B ) Axiom: A Δ B = (A ∖ B) ∪ (B ∖ A) A symmetric different B equals union of A diff B and B diff A
testAUnionAEqualsA ( Set $A ) Axiom: A ∪ A = A A union A equals A
testAUnionEmptySetEqualsA ( Set $A ) Axiom: A ∪ Ø = A A union empty set is A
testAUnsionBCrossCEqualsUnsionOfACRossCAndBCrossC ( Set $A, Set $B, Set $C ) Axiom: (A ∪ B) × C = (A × C) ∪ (B × C) A union B cross C is the union of A cross C and B cross C
testCardinalityOfCartesianProduct ( Set $A, Set $B ) Axiom: |A × B| - |A| * |B| The cardinality (count) of the cartesian product is the product of the cardinality of A and B
testCardinalityOfPowerSet ( Set $A ) Axiom: |S| = n, then |P(S)| = 2ⁿ The cardinality (count) of a power set of S is 2ⁿ if the cardinality of S is n.
testCardinalityOfUnion ( Set $A, Set $B ) Axiom: |A ∪ B| = |A| + |B| - |A ∩ B| The cardinality (count) of unsion of A and B is equal to the cardinality of A + B minus the cardinality of A intersection B
testEmptySetSubsetOfEverySet ( Set $A ) Axiom: Ø ⊆ A The empty set is a subset of every set
testEqualSetsAreSubsetsInBothDirections ( Set $A ) Axiom: A = B iff A ⊆ B and B ⊆ A Sets are equal if and only if they are both subsets of each other.
testIntersectionAbsorbtion ( Set $A, Set $B ) Axiom: A ∩ (A ∪ B) = A Intersection absorbtion law
testIntersectionAssociative ( Set $A, Set $B, Set $C ) Axiom: A ∩ (B ∩ C) = (A ∩ B) ∩ C Intersection is associative
testIntersectionCommutative ( Set $A, Set $B ) Axiom: A ∩ B = B ∩ A Intersection is commutative
testIntersectionDistributive ( Set $A, Set $B, Set $C ) Axiom: A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) Intersection is distributive
testSetIsSubsetOfItself ( Set $A ) Axiom: A ⊆ A Every set is a subset of itself
testUnionAbsorbtion ( Set $A, Set $B ) Axiom: A ∪ (A ∩ B) = A Union absorbtion law
testUnionCommutative ( Set $A, Set $B ) Axiom: A ∪ B = B ∪ A Union is commutative
testUnionDistributive ( Set $A, Set $B, Set $C ) Axiom: A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) Union is distributive
testUnsionAssociative ( Set $A, Set $B, Set $C ) Axiom: A ∪ (B ∪ C) = (A ∪ B) ∪ C Unsion is associative

Method Details

dataProviderForSingleSet() public method

dataProviderForThreeSets() public method

dataProviderForTwoSets() public method

dataProviderForTwoSetsDifferent() public method

testACartesianProductWithEmptySetIsEmptySet() public method

Axiom: A × Ø = Ø A cartesian product with empty set is the empty set

testACrossUnsionBCEqualsACrossBUnionACrossC() public method

Axiom: A × (B ∪ C) = (A × B) ∪ (A × C) A cross union of B and C is the union of A cross B and A cross C
public testACrossUnsionBCEqualsACrossBUnionACrossC ( Set $A, Set $B, Set $C )
$A Set
$B Set
$C Set

testADiffBDifferentFromBDiffAWhenNotEqual() public method

Axiom: A ∖ B ≠ B ∖ A for A ≠ B A diff B does not equal B diff A if A and B are different sets
public testADiffBDifferentFromBDiffAWhenNotEqual ( Set $A, Set $B )
$A Set
$B Set

testADiffItselfIsEmptySet() public method

Axiom: A ∖ A = Ø A diff itself is the empty set
public testADiffItselfIsEmptySet ( Set $A )
$A Set

testAIntersectionAEqualsA() public method

Axiom: A ∩ A = A A intersection A equals A
public testAIntersectionAEqualsA ( Set $A )
$A Set

testAIntersectionBIsSubsetOfA() public method

Axiom: (A ∩ B) ⊆ A A intersect B is a subset of A
public testAIntersectionBIsSubsetOfA ( Set $A, Set $B )
$A Set
$B Set

testAIntersectionEmptySetIsEmptySet() public method

Axiom: A ∩ Ø = Ø A union empty set is A
public testAIntersectionEmptySetIsEmptySet ( Set $A )
$A Set

testAIsSubsetOfAUnionB() public method

Axiom: A ⊆ (A ∪ B) A is a subset of A union B
public testAIsSubsetOfAUnionB ( Set $A, Set $B )
$A Set
$B Set

testASymmetricDifferentBEqualsUnionADiffBAndBDiffA() public method

Axiom: A Δ B = (A ∖ B) ∪ (B ∖ A) A symmetric different B equals union of A diff B and B diff A
public testASymmetricDifferentBEqualsUnionADiffBAndBDiffA ( Set $A, Set $B )
$A Set
$B Set

testAUnionAEqualsA() public method

Axiom: A ∪ A = A A union A equals A
public testAUnionAEqualsA ( Set $A )
$A Set

testAUnionEmptySetEqualsA() public method

Axiom: A ∪ Ø = A A union empty set is A
public testAUnionEmptySetEqualsA ( Set $A )
$A Set

testAUnsionBCrossCEqualsUnsionOfACRossCAndBCrossC() public method

Axiom: (A ∪ B) × C = (A × C) ∪ (B × C) A union B cross C is the union of A cross C and B cross C
public testAUnsionBCrossCEqualsUnsionOfACRossCAndBCrossC ( Set $A, Set $B, Set $C )
$A Set
$B Set
$C Set

testCardinalityOfCartesianProduct() public method

Axiom: |A × B| - |A| * |B| The cardinality (count) of the cartesian product is the product of the cardinality of A and B
public testCardinalityOfCartesianProduct ( Set $A, Set $B )
$A Set
$B Set

testCardinalityOfPowerSet() public method

Axiom: |S| = n, then |P(S)| = 2ⁿ The cardinality (count) of a power set of S is 2ⁿ if the cardinality of S is n.
public testCardinalityOfPowerSet ( Set $A )
$A Set

testCardinalityOfUnion() public method

Axiom: |A ∪ B| = |A| + |B| - |A ∩ B| The cardinality (count) of unsion of A and B is equal to the cardinality of A + B minus the cardinality of A intersection B
public testCardinalityOfUnion ( Set $A, Set $B )
$A Set
$B Set

testEmptySetSubsetOfEverySet() public method

Axiom: Ø ⊆ A The empty set is a subset of every set
public testEmptySetSubsetOfEverySet ( Set $A )
$A Set

testEqualSetsAreSubsetsInBothDirections() public method

Axiom: A = B iff A ⊆ B and B ⊆ A Sets are equal if and only if they are both subsets of each other.
public testEqualSetsAreSubsetsInBothDirections ( Set $A )
$A Set

testIntersectionAbsorbtion() public method

Axiom: A ∩ (A ∪ B) = A Intersection absorbtion law
public testIntersectionAbsorbtion ( Set $A, Set $B )
$A Set
$B Set

testIntersectionAssociative() public method

Axiom: A ∩ (B ∩ C) = (A ∩ B) ∩ C Intersection is associative
public testIntersectionAssociative ( Set $A, Set $B, Set $C )
$A Set
$B Set
$C Set

testIntersectionCommutative() public method

Axiom: A ∩ B = B ∩ A Intersection is commutative
public testIntersectionCommutative ( Set $A, Set $B )
$A Set
$B Set

testIntersectionDistributive() public method

Axiom: A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) Intersection is distributive
public testIntersectionDistributive ( Set $A, Set $B, Set $C )
$A Set
$B Set
$C Set

testSetIsSubsetOfItself() public method

Axiom: A ⊆ A Every set is a subset of itself
public testSetIsSubsetOfItself ( Set $A )
$A Set

testUnionAbsorbtion() public method

Axiom: A ∪ (A ∩ B) = A Union absorbtion law
public testUnionAbsorbtion ( Set $A, Set $B )
$A Set
$B Set

testUnionCommutative() public method

Axiom: A ∪ B = B ∪ A Union is commutative
public testUnionCommutative ( Set $A, Set $B )
$A Set
$B Set

testUnionDistributive() public method

Axiom: A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) Union is distributive
public testUnionDistributive ( Set $A, Set $B, Set $C )
$A Set
$B Set
$C Set

testUnsionAssociative() public method

Axiom: A ∪ (B ∪ C) = (A ∪ B) ∪ C Unsion is associative
public testUnsionAssociative ( Set $A, Set $B, Set $C )
$A Set
$B Set
$C Set