예제 #1
0
def absorbtion(A, B):
    global count
    assert identity(union([A, intersection([A.clone(), B.clone()])]), A.clone())
    assert identity(intersection([A, union([A.clone(), B.clone()])]), A.clone())


    count += 1
예제 #2
0
def transitivity(A, B, C):
    global count
    Bnew = union([A.clone(), B.clone()])  # => Bnew = superset of A
    Cnew = union([Bnew.clone(), C.clone()])  # => Cnew = superset of Bnew
    assert superset(Bnew.clone(), A.clone())
    assert superset(Cnew.clone(), Bnew.clone())
    assert superset(Cnew.clone(), A.clone())

    count += 1
예제 #3
0
def de_morgan(A, B):
    global count
    assert identity(
        complement(union([A.clone(), B.clone()])),
        intersection([complement(A.clone()),
                      complement(B.clone())]))
    assert identity(complement(intersection([A.clone(), B.clone()])),
                    union([complement(A.clone()),
                           complement(B.clone())]))
    count += 1
예제 #4
0
def distributivity(A, B, C):
    global count
    first  = union([A.clone(), intersection([B.clone(), C.clone()])])
    second = intersection([union([A.clone(), B.clone()]), union([A.clone(),C.clone()])])
    assert identity(first, second)

    first  = intersection([A.clone(), union([B.clone(), C.clone()])])
    second = union([intersection([A.clone(), B.clone()]), intersection([A.clone(),C.clone()])])
    assert identity(first, second)

    count += 1
예제 #5
0
def commutativity(A, B):
    global count
    first  = union([A.clone(), B.clone()])
    second = union([B.clone(), A.clone()])
    assert identity(first, second)

    first  = intersection([A.clone(), B.clone()]) 
    second = intersection([B.clone(), A.clone()]) 
    assert identity(first, second)

    count += 1
예제 #6
0
def uniqueness(A):
    """Uniqueness of complement:
        
              A u B = Universal   and    A n B = Empty

           => A = complement B  and vice versa

       Involution:
            
              A = complement(complement(A))
    """
    global count

    B = difference(DFA.Universal(), A)
    # => A u B = Universal   and    A n B = Empty
    assert identity(union([A, B]), DFA.Universal())
    assert identity(intersection([A, B]), DFA.Empty())

    # Uniqueness of complement
    assert identity(A, complement(B))
    assert identity(B, complement(A))

    # Involution/Double Complement
    assert identity(A, complement(complement(A)))
    assert identity(B, complement(complement(B)))
    count += 1
예제 #7
0
파일: domination.py 프로젝트: smmckay/quex3
def domination(A):
    global count
    first  = union([A, DFA.Universal()])
    assert identity(first, DFA.Universal())

    first  = intersection([A, DFA.Empty()]) 
    assert identity(first, DFA.Empty())

    count += 1
예제 #8
0
def complement_laws(A):
    global count
    first = union([A.clone(), complement(A.clone())])
    assert identity(first, DFA.Universal())

    first = intersection([A.clone(), complement(A.clone())])
    assert identity(first, DFA.Empty())

    count += 1
예제 #9
0
파일: identity.py 프로젝트: smmckay/quex3
def identity_vs_empty_and_universal(A):
    global count
    count += 1
    # if count != 3: return
    first = union([A.clone(), DFA.Empty()])
    assert identity(first, A.clone())

    first = intersection([A.clone(), DFA.Universal()])
    assert identity(first, A)
예제 #10
0
def join_and_meets(A, B):
    global count
    Join = union([A.clone(), B.clone()])
    assert superset(Join.clone(), A.clone())
    assert superset(Join.clone(), B.clone())

    Meet = intersection([A.clone(), B.clone()])
    assert superset(A.clone(), Meet.clone())
    assert superset(B.clone(), Meet.clone())
    count += 1