Cody

# Problem 44374. Tautology

Solution 1336641

Submitted on 12 Nov 2017 by Marco Tullio
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))

xs = '0'

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

xs = '1'

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

xs = '0'

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

xs = '1'

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

xs = '1'

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

xs = '0'

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

xs = '0'

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

xs = '0'

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

xs = '0'

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

xs = '0|1'

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

xs = '1'

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

xs = '1'

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

xs = '~0==(1|1)'

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

xs = '~0==(1|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))

xs = '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))

xs = '0|1'

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

xs = '0|0'

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

xs = '0|1'

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

xs = '1|1|1'

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

xs = '~(~(~(~(~(~0)))))'

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

xs = '~(~(~(~(~(~1)))))' xs = '(1|1)&1'

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

xs = '0'

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

xs = '0'

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

xs = '(0|1)'

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

xs = '((0|1)|1)'

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

xs = '(0|0)'

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

xs = '0'

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

xs = '(1|0)'

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

xs = '(1|0)'

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

xs = '((1|1)&0)'

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

xs = '(1|1)|0'

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

xs = '0|1'

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

xs = '0|0'

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

xs = '0&1'

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

xs = '0|1'

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

xs = '0'

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

xs = '0&0'

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

xs = '(0|1)'

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

xs = '(1&0)&0'

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

xs = '(1|0)'

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

xs = '(1|1)|1'

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

xs = '(1|1)&1'

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

xs = '(1|0)'

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

xs = '((1|1)|1)'

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

xs = '((1|1)&0)'

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

xs = '0'

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

xs = '1|1'

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

xs = '(0|1)'

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

xs = '1'

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

xs = '0'

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

xs = '(0&~1)'

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

xs = '1|0'

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

xs = '0|1'

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

xs = '1|1'

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

xs = '0&1'

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

xs = '(0|1)|0'

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

xs = '1'

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

xs = '1|1&1'

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

xs = '(~1)|1'

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

xs = '1'

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

xs = '1|1'

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

xs = '(1|1)|0'

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

xs = '1&1'

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

xs = '0|1'

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

xs = '1'

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

xs = '~1'

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

xs = '1&1'

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

xs = '~1|1'

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

xs = '1|~1'

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

xs = '0==1'