Cody

# Problem 44374. Tautology

Solution 2015085

Submitted on 12 Nov 2019
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   Fail
x = 'A|1'; y_correct = true; assert(isequal(tautology(x),y_correct))

Assertion failed.

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   Fail
x = 'A|~A'; y_correct = true; assert(isequal(tautology(x),y_correct))

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

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

Assertion failed.

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

Assertion failed.

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

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

Assertion failed.

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

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

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

Assertion failed.

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

Assertion failed.

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

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

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

Assertion failed.

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

Assertion failed.

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

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

Assertion failed.

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   Fail
assert(isequal(tautology('((A|A)&A)|~A'),true));

Assertion failed.

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

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

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

Assertion failed.

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

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

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

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

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

Assertion failed.

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

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

Assertion failed.

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

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

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

Assertion failed.

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

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

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

Assertion failed.

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

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

Assertion failed.

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

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

Assertion failed.

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

Assertion failed.

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

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

Assertion failed.

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

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

Assertion failed.

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

Assertion failed.

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