Exercise 1: Boolean logic: from truth table to circuit
This practice final covers the chapters of the course in order. We start with logic, on which everything else depends: a circuit, a condition in a program and a proof all obey the same laws.
- a) On the Karnaugh map in the figure, identify the two blocks of four cells and give the simplified expression of .
- b) Write the complete disjunctive normal form (canonical sum of products) of , before simplification, and count its terms.
- c) Give the truth table of as a function of and alone, and name the corresponding gate.
- d) Write the negation of the statement “for every user , there is a file such that can read ”.
- e) Is the implication equivalent to ? To ? Justify with a truth table.
Show the solution
Answers
- a) : and disappear
- b) Eight terms of four literals, that is 32 literals, against 4 after simplification
- c) , the XNOR gate
- d) There EXISTS a user such that FOR EVERY file , cannot read
- e) No to the converse, YES to the contrapositive: both equal 0 only on the row true, false
The first block gathers the four cells where and , that is minterms 0, 1, 4 and 5: it gives the term . The second gathers the cells where and , minterms 10, 11, 14 and 15: it gives . In both blocks, and take every value, so they DISAPPEAR. Hence . Both blocks of four are shaded in the figure.
The complete disjunctive normal form lists one term for each row equal to 1 in the table, that is EIGHT terms of four literals each: . The simplification in part a) took us from 8 terms of 4 literals to 2 terms of 2 literals, that is from 32 literals to 4: this is exactly what the saving in gates of a circuit measures.
The function depends only on and : it equals 1 when and when , that is when and are EQUAL, and 0 otherwise. This is the XNOR gate, also called the equivalence or coincidence gate. We write , where is the exclusive or.
The negation swaps the quantifiers and negates the predicate: “there EXISTS a user such that FOR EVERY file , can NOT read ”. In other words, at least one user cannot read any file. The rule is mechanical: every “for every” becomes “there exists”, every “there exists” becomes “for every”, and the final property is negated. Skipping a single swap produces a statement that has nothing to do with the original.
is NOT equivalent to its converse : with true and false, the first is false and the second is true. It IS equivalent to its contrapositive , as the table shows: both equal 0 only when is true and is false, and 1 in the other three cases. This is what justifies proof by contrapositive, and it is also why confusing the converse with the contrapositive is the most expensive mistake in logic.
Tick the exercises you have done or want to review: a free account, no password, keeps your ticks and your right answers from one visit to the next, tells you which chapter to tackle next and lets you ask for the exercise you are missing. Create your space, an email is enough.