PHP Класс 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ⁿ
Наследование: extends PHPUnit_Framework_TestCase
Показать файл Открыть проект

Открытые методы

Метод Описание
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

Описание методов

dataProviderForSingleSet() публичный Метод

dataProviderForThreeSets() публичный Метод

dataProviderForTwoSets() публичный Метод

dataProviderForTwoSetsDifferent() публичный Метод

testACartesianProductWithEmptySetIsEmptySet() публичный Метод

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

testACrossUnsionBCEqualsACrossBUnionACrossC() публичный Метод

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() публичный Метод

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() публичный Метод

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

testAIntersectionAEqualsA() публичный Метод

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

testAIntersectionBIsSubsetOfA() публичный Метод

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

testAIntersectionEmptySetIsEmptySet() публичный Метод

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

testAIsSubsetOfAUnionB() публичный Метод

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

testASymmetricDifferentBEqualsUnionADiffBAndBDiffA() публичный Метод

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() публичный Метод

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

testAUnionEmptySetEqualsA() публичный Метод

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

testAUnsionBCrossCEqualsUnsionOfACRossCAndBCrossC() публичный Метод

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() публичный Метод

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() публичный Метод

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() публичный Метод

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() публичный Метод

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

testEqualSetsAreSubsetsInBothDirections() публичный Метод

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() публичный Метод

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

testIntersectionAssociative() публичный Метод

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() публичный Метод

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

testIntersectionDistributive() публичный Метод

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() публичный Метод

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

testUnionAbsorbtion() публичный Метод

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

testUnionCommutative() публичный Метод

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

testUnionDistributive() публичный Метод

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() публичный Метод

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