Cody

# Problem 44374. Tautology

Solution 2032539

Submitted on 23 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   Fail
x = '0'; y_correct = false; assert(isequal(tautology(x),y_correct))

Assertion failed.

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

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

Assertion failed.

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

Assertion failed.

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

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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   Fail
assert(isequal(tautology('(A|B)|C'),false));

Assertion failed.

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

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

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

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

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

Assertion failed.

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

Assertion failed.

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

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

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

Assertion failed.

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

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

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

Assertion failed.

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

Assertion failed.

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

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

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

Assertion failed.

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

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

Assertion failed.

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   Fail
assert(isequal(tautology('(B&~B)&~B&0'),false));

Assertion failed.

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

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

Assertion failed.

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

Assertion failed.

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

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

Assertion failed.

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

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

Assertion failed.

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

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

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

Assertion failed.

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

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

Assertion failed.

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

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

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

Assertion failed.