Cody

# Problem 44374. Tautology

Solution 1663277

Submitted on 31 Oct 2018 by James Seaward
• Size: 7
• This is the leading solution.
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))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint1 (line 3) In solutionTest (line 3)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint2 (line 3) In solutionTest (line 5)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint3 (line 3) In solutionTest (line 7)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint4 (line 3) In solutionTest (line 9)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint5 (line 3) In solutionTest (line 11)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint6 (line 3) In solutionTest (line 13)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint7 (line 3) In solutionTest (line 15)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint8 (line 3) In solutionTest (line 17)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint9 (line 3) In solutionTest (line 19)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint10 (line 3) In solutionTest (line 21)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint11 (line 3) In solutionTest (line 23)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint12 (line 3) In solutionTest (line 25)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint13 (line 3) In solutionTest (line 27)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint14 (line 3) In solutionTest (line 29)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint15 (line 3) In solutionTest (line 31)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint16 (line 3) In solutionTest (line 33)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint17 (line 1) In solutionTest (line 35)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint18 (line 1) In solutionTest (line 37)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint19 (line 1) In solutionTest (line 39)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint20 (line 1) In solutionTest (line 41)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint21 (line 1) In solutionTest (line 43)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint21 (line 3) In solutionTest (line 43)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint22 (line 1) In solutionTest (line 45)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint23 (line 1) In solutionTest (line 47)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint24 (line 1) In solutionTest (line 49)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint25 (line 1) In solutionTest (line 51)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint26 (line 1) In solutionTest (line 53)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint27 (line 1) In solutionTest (line 55)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint28 (line 1) In solutionTest (line 57)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint29 (line 1) In solutionTest (line 59)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint30 (line 1) In solutionTest (line 61)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tautology (line 2) In ScoringEngineTestPoint31 (line 1) In solutionTest (line 63)]

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