c++ - Simplify these boolean expressions? -
i not sure if simplifying these boolean expressions correctly:
1. (a && b) || b 2. (a || b) && 3. !(a || b) && 4. !(a && b) || !b
simplified expressions:
1. && b 2. || b 3. !b && 4. !a || !b
fairly easy sort out truth tables
1. (a && b) || b b | e 0 0 | 0 0 1 | 1 1 0 | 0 1 1 | 1 simplified: b ################ 2. (a || b) && b | e 0 0 | 0 0 1 | 0 1 0 | 1 1 1 | 1 simplified: algebraically: using our identity we've derived part 1: (a || b) && --> (a && a) || (a && b) --> || (a && b) --> ################# 3. !(a || b) && b | e 0 0 | 0 0 1 | 0 1 0 | 0 1 1 | 0 simplified: 0 algebraically (via demorgans) !(a||b)&&a --> (!a && !b) && --> !a && !b && --> (a && !a) && !b --> 0 && !b --> 0 ################## 4. !(a && b) || !b b | e 0 0 | 1 0 1 | 1 1 0 | 1 1 1 | 0 simplified: !a || !b
most of these can done algebraically well, truth tables make life easy.
Comments
Post a Comment