Cody

# Problem 44374. Tautology

Solution 1314549

Submitted on 25 Oct 2017
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   Pass
x = 'A|1'; y_correct = true; assert(isequal(tautology(x),y_correct))

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test14 (line 1) assert(isequal(tautology('(A|B)|C'),false));

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

Undefined function or variable 'expr'. Error in tautology>splitExpr (line 35) expr(cellfun(@isempty, expr)) = []; Error in tautology>splitExpr (line 40) expr{k} = splitExpr(expr{k}); Error in tautology (line 4) x = splitExpr(x); Error in Test15 (line 1) assert(isequal(tautology('(A|B)|(C == C)'),true));

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

Cell contents reference from a non-cell array object. Error in tautology>isTrueExp (line 69) if ~iscell(x{1}) && strcmp(x{1},'~') Error in tautology>isTrueExp (line 76) z = isTrueExp(x{1},vars, vals) == isTrueExp(x{3},vars, vals); Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test16 (line 1) assert(isequal(tautology('(A == B)|(B == C)|(C == A)'),true));

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

Subscripted assignment dimension mismatch. Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test17 (line 1) assert(isequal(tautology('~(~(~(~(~(~(0))))))'),false));

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

Subscripted assignment dimension mismatch. Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test18 (line 1) assert(isequal(tautology('~(~(~(~(~(~(~0))))))'),true));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test19 (line 1) assert(isequal(tautology('((0&~B)&~B)'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test20 (line 1) assert(isequal(tautology('((0|A)&~A)'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test21 (line 1) assert(isequal(tautology('((0|A)|1)'),true));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test22 (line 1) assert(isequal(tautology('((0|~B)|1)'),true));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test23 (line 1) assert(isequal(tautology('((1&0)|B)'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test24 (line 1) assert(isequal(tautology('((1&1)&A)'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test25 (line 1) assert(isequal(tautology('((1|0)|A)'),true));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test26 (line 1) assert(isequal(tautology('((1|A)|0)'),true));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test27 (line 1) assert(isequal(tautology('((1|~A)&B)'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test28 (line 1) assert(isequal(tautology('((A&1)|~A)|A'),true));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test29 (line 1) assert(isequal(tautology('((A&~A)&~B)|~A'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test30 (line 1) assert(isequal(tautology('((A&~B)&1)|B'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test31 (line 1) assert(isequal(tautology('((A|0)&1)&~B'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test32 (line 1) assert(isequal(tautology('((A|A)&A)|~A'),true));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test33 (line 1) assert(isequal(tautology('((B|0)&B)'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test34 (line 1) assert(isequal(tautology('((B|1)&B)&A'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test35 (line 1) assert(isequal(tautology('((B|A)|~A)'),true));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test36 (line 1) assert(isequal(tautology('((~A&~A)&0)&B'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test37 (line 1) assert(isequal(tautology('((~A&~A)|0)'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test38 (line 1) assert(isequal(tautology('((~A&~A)|~A)|1'),true));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test39 (line 1) assert(isequal(tautology('((~A|A)|~B)&1'),true));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test40 (line 1) assert(isequal(tautology('((~A|B)|A)'),true));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test41 (line 1) assert(isequal(tautology('((~A|~A)|1)'),true));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test42 (line 1) assert(isequal(tautology('((~A|~B)&0)'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test43 (line 1) assert(isequal(tautology('((~B&0)&A)'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test44 (line 1) assert(isequal(tautology('(0&1)|1&1'),true));

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

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

Assertion failed.

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

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

Assertion failed.

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test49 (line 1) assert(isequal(tautology('(A|1)|B'),true));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test50 (line 1) assert(isequal(tautology('(A|A)|A|1'),true));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test51 (line 1) assert(isequal(tautology('(B&1)|~B'),true));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test52 (line 1) assert(isequal(tautology('(B&~B)&~B&0'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test53 (line 1) assert(isequal(tautology('(B|~B)|B'),true));

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

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test55 (line 1) assert(isequal(tautology('(~A|0)|~B&~A'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test56 (line 1) assert(isequal(tautology('(~A|1)|1'),true));

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

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test58 (line 1) assert(isequal(tautology('(~A|B)|~B'),true));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test59 (line 1) assert(isequal(tautology('(~A|~A)|0'),false));

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

Output argument "z" (and maybe others) not assigned during call to "tautology>isTrueExp". Error in tautology (line 9) z(1) = isTrueExp(x, vars, v(1,:)); Error in Test60 (line 1) assert(isequal(tautology('(~B&0)&1|1'),true));

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

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

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

Assertion failed.

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

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

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

Assertion failed.