Cody

# Problem 44374. Tautology

Solution 1382051

Submitted on 16 Dec 2017 by Gunther S
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
x = '0'; y_correct = false; assert(isequal(tautology(x),y_correct))

2   Pass
x = '1'; y_correct = true; assert(isequal(tautology(x),y_correct))

3   Pass
x = 'A'; y_correct = false; assert(isequal(tautology(x),y_correct))

4   Pass
x = '~A'; y_correct = false; assert(isequal(tautology(x),y_correct))

5   Pass
x = 'A|1'; y_correct = true; assert(isequal(tautology(x),y_correct))

6   Pass
x = '1&A'; y_correct = false; assert(isequal(tautology(x),y_correct))

7   Pass
x = 'A|B'; y_correct = false; assert(isequal(tautology(x),y_correct))

8   Pass
x = 'A&B'; y_correct = false; assert(isequal(tautology(x),y_correct))

9   Pass
x = 'A|A'; y_correct = false; assert(isequal(tautology(x),y_correct))

10   Pass
x = 'A|~A'; y_correct = true; assert(isequal(tautology(x),y_correct))

11   Pass
x = '0==0'; y_correct = true; assert(isequal(tautology(x),y_correct))

12   Pass
x = '~0'; y_correct = true; assert(isequal(tautology(x),y_correct))

13   Pass
x = '~(A & B) == (~A | ~B)'; y_correct = true; assert(isequal(tautology(x),y_correct))

14   Pass
x = '~(Z & Y) == (~Y | ~Z)'; y_correct = true; assert(isequal(tautology(x),y_correct))

15   Pass
x = 'A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|X|V|W|Y|Z'; y_correct = false; assert(isequal(tautology(x),y_correct))

16   Pass
x = 'A|B|C|D|E|F|G|H|I|J|K|L|M|~A|O|P|Q|R|S|T|U|X|V|W|Y|Z'; y_correct = true; assert(isequal(tautology(x),y_correct))

17   Pass
assert(isequal(tautology('(A|B)|C'),false));

18   Pass
assert(isequal(tautology('(A|B)|(C == C)'),true));

19   Pass
assert(isequal(tautology('(A == B)|(B == C)|(C == A)'),true));

20   Pass
assert(isequal(tautology('~(~(~(~(~(~(0))))))'),false));

21   Pass
assert(isequal(tautology('~(~(~(~(~(~(~0))))))'),true)); % provided by Alfonso: assert(isequal(tautology('((0&1)|~B)&~B'),false));

22   Pass
assert(isequal(tautology('((0&~B)&~B)'),false));

23   Pass
assert(isequal(tautology('((0|A)&~A)'),false));

24   Pass
assert(isequal(tautology('((0|A)|1)'),true));

25   Pass
assert(isequal(tautology('((0|~B)|1)'),true));

26   Pass
assert(isequal(tautology('((1&0)|B)'),false));

27   Pass
assert(isequal(tautology('((1&1)&A)'),false));

28   Pass
assert(isequal(tautology('((1|0)|A)'),true));

29   Pass
assert(isequal(tautology('((1|A)|0)'),true));

30   Pass
assert(isequal(tautology('((1|~A)&B)'),false));

31   Pass
assert(isequal(tautology('((A&1)|~A)|A'),true));

32   Pass
assert(isequal(tautology('((A&~A)&~B)|~A'),false));

33   Pass
assert(isequal(tautology('((A&~B)&1)|B'),false));

34   Pass
assert(isequal(tautology('((A|0)&1)&~B'),false));

35   Pass
assert(isequal(tautology('((A|A)&A)|~A'),true));

36   Pass
assert(isequal(tautology('((B|0)&B)'),false));

37   Pass
assert(isequal(tautology('((B|1)&B)&A'),false));

38   Pass
assert(isequal(tautology('((B|A)|~A)'),true));

39   Pass
assert(isequal(tautology('((~A&~A)&0)&B'),false));

40   Pass
assert(isequal(tautology('((~A&~A)|0)'),false));

41   Pass
assert(isequal(tautology('((~A&~A)|~A)|1'),true));

42   Pass
assert(isequal(tautology('((~A|A)|~B)&1'),true));

43   Pass
assert(isequal(tautology('((~A|B)|A)'),true));

44   Pass
assert(isequal(tautology('((~A|~A)|1)'),true));

45   Pass
assert(isequal(tautology('((~A|~B)&0)'),false));

46   Pass
assert(isequal(tautology('((~B&0)&A)'),false));

47   Pass
assert(isequal(tautology('(0&1)|1&1'),true));

48   Pass
assert(isequal(tautology('(0|~A&B)'),false));

49   Pass
assert(isequal(tautology('(1|A&0)'),true));

50   Pass
assert(isequal(tautology('(A&A&~B)'),false));

51   Pass
assert(isequal(tautology('(A&~A|1)'),true));

52   Pass
assert(isequal(tautology('(A|1)|B'),true));

53   Pass
assert(isequal(tautology('(A|A)|A|1'),true));

54   Pass
assert(isequal(tautology('(B&1)|~B'),true));

55   Pass
assert(isequal(tautology('(B&~B)&~B&0'),false));

56   Pass
assert(isequal(tautology('(B|~B)|B'),true));

57   Pass
assert(isequal(tautology('(~A&B&0)'),false));

58   Pass
assert(isequal(tautology('(~A|0)|~B&~A'),false));

59   Pass
assert(isequal(tautology('(~A|1)|1'),true));

60   Pass
assert(isequal(tautology('(~A|B&B)'),false));

61   Pass
assert(isequal(tautology('(~A|B)|~B'),true));

62   Pass
assert(isequal(tautology('(~A|~A)|0'),false));

63   Pass
assert(isequal(tautology('(~B&0)&1|1'),true));

64   Pass
assert(isequal(tautology('1&B|~B|0'),true));

65   Pass
assert(isequal(tautology('B&1&A&1'),false));

66   Pass
assert(isequal(tautology('~A&0&1|1'),true));

67   Pass
assert(isequal(tautology('~B&0&~A|B'),false));

68   Pass
assert(isequal(tautology('~B|1|1|~B'),true));

69   Pass
assert(isequal(tautology('~B|~B&1|1'),true));

70   Pass
assert(isequal(tautology('A==~A'),false));