def test_tautology_2var_expr(self):
     expr = '(!a | (b & !a))'
     s = PropositionStatement(expr)
     self.assertEqual(s.isTautology(), False)
 def test_tautology_4var_expr(self):
     expr = '(a & b) | (!a & b) | (c & d) | (!c & d)'
     s = PropositionStatement(expr)
     self.assertEqual(s.isTautology(), False)
 def test_tautology_3var_expr(self):
     expr = 'a & b | c'
     s = PropositionStatement(expr)
     self.assertEqual(s.isTautology(), False)
 def test_tautology_1var_expr(self):
     expr = '(!a | (a & a))'
     s = PropositionStatement(expr)
     self.assertEqual(s.isTautology(), True)
 def test_tautology_expr_true(self):
     expr = 'a | !a'
     s = PropositionStatement(expr)
     self.assertEqual(s.isTautology(), True)
 def test_tautology_complex_expr(self):
     expr = '(a & (!b | b)) | (!a & (!b | b))'
     s = PropositionStatement(expr)
     self.assertEqual(s.isTautology(), True)
 def test_tautology_divided_by_true_with_expression_and_or(self):
     expr = '((!a & a) | ((a & b) | (c | d) | (d & e) & (f & g)))'
     s = PropositionStatement(expr)
     self.assertEqual(s.isTautology(), False)
 def test_tautology_expr_simple(self):
     expr = 'a'
     s = PropositionStatement(expr)
     self.assertEqual(s.isTautology(), False)
 def test_tautology_4var_expr_all_negations_but_one_with_or_divided(self):
     expr = '((a & b) | (!a & b) | (c & d)) | ((!c & d) | (!b | d))'
     s = PropositionStatement(expr)
     self.assertEqual(s.isTautology(), True)
示例#10
0
 def test_tautology_4var_expr_all_negations_but_one(self):
     expr = '((a & b) | (!a & b) | (c & d)) | ((!c & d) | (!b & d))'
     s = PropositionStatement(expr)
     self.assertEqual(s.isTautology(), False)
示例#11
0
 def test_tautology_4var_expr_with_negations(self):
     expr = '(a & b) | (!a & b) | (c & d) | (!c & d) | (!b & !d)'
     s = PropositionStatement(expr)
     self.assertEqual(s.isTautology(), True)
#!/usr/bin/env python
#Author=Nimish Devasthali
#Date=24 March 2016

from tautology import PropositionStatement

#main
if __name__ == '__main__':
    while True:
        try:
	    print "Enter the Expression\n"
            expr = raw_input()
	    #print ("Test1 ")   --------just for debugging
            propostionStatement = PropositionStatement(expr)
	    #print ("Test2 ")    ----------for debugging
            if propostionStatement.isTautology():
                print ("True")
            else:
                print ("False")
        except Exception as e:
            break
    
#!/usr/bin/env python

from tautology import PropositionStatement

#main
if __name__ == '__main__':
    while True:
        try:
            expr = input()
            propostionStatement = PropositionStatement(expr)
            if propostionStatement.isTautology():
                print ("True")
            else:
                print ("False")
        except Exception as e:
            break