Cody

# Problem 44374. Tautology

Solution 1331198

Submitted on 7 Nov 2017 by yurenchu
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))

ans = logical 0

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

ans = logical 1

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

ans = logical 0

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

ans = logical 0

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

ans = logical 1

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

ans = logical 0

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

ans = logical 0

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

ans = logical 0

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

ans = logical 0

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

ans = logical 1

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

ans = logical 1

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

ans = logical 1

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

ans = logical 1

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

ans = logical 1

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))

ans = logical 0

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))

ans = logical 1

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

ans = logical 0

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

ans = logical 1

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

ans = logical 1

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

ans = logical 0

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

ans = logical 1 ans = logical 0

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

ans = logical 0

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

ans = logical 0

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

ans = logical 1

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

ans = logical 1

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

ans = logical 0

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

ans = logical 0

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

ans = logical 1

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

ans = logical 1

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

ans = logical 0

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

ans = logical 1

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

ans = logical 0

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

ans = logical 0

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

ans = logical 0

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

ans = logical 1

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

ans = logical 0

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

ans = logical 0

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

ans = logical 1

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

ans = logical 0

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

ans = logical 0

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

ans = logical 1

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

ans = logical 1

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

ans = logical 1

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

ans = logical 1

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

ans = logical 0

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

ans = logical 0

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

ans = logical 1

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

ans = logical 0

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

ans = logical 1

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

ans = logical 0

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

ans = logical 1

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

ans = logical 1

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

ans = logical 1

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

ans = logical 1

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

ans = logical 0

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

ans = logical 1

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

ans = logical 0

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

ans = logical 0

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

ans = logical 1

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

ans = logical 0

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

ans = logical 1

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

ans = logical 0

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

ans = logical 1

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

ans = logical 1

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

ans = logical 0

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

ans = logical 1

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

ans = logical 0

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

ans = logical 1

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

ans = logical 1

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

ans = logical 0