










































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!











































Content
Logic Operators :: NOT^ ¬^ P is true if and only if P is false Logic operators are used to construct new statements from old statements. There are three main logic operators, NOT, AND, OR. F T T F
Logic operators are used to construct new statements from old statements. There are three main logic operators, NOT, AND, OR.
More Logical Operators coffee “or” tea exclusive-or p q p^ q T T F T F T F T T F F F We can define more logical operators as we need. P Q R M(P,Q,R) T T T T T T F T T F T T T F F F F T T T F T F F F F T F F F F F majority
Content
Exclusive-Or Is there a more systematic way to construct such a formula? p q p^ q T T F T F T F T T F F F Idea 1: Look at the true rowsIdea 1: Look at the true rowsIdea 1: Look at the true rows Want the formula to be true exactly when the input belongs to a “true” row. The input is the second row exactly if this sub-formula is satisfied And the formula is true exactly when the input is the second row or the third row.
Exclusive-Or p q p^ q T T F T F T F T T F F F Idea 2: Look at the false rows Want the formula to be true exactly when the input does not belong to a “false” row. The input is the first row exactly if this sub-formula is satisfied And the formula is true exactly when the input is not in the 1 st row and the 4 th row. Is there a more systematic way to construct such a formula?
Writing Logical Formula for a Truth Table p q r output T T T F T T F T T F T T T F F F F T T T F T F T F F T T F F F F Use idea 1 or idea 2. (^) Idea 1: Look at the true rows and take the “or”. The formula is true exactly when the input is one of the true rows.
Writing Logical Formula for a Truth Table Idea 2: Look at the false rows, negate and take the “and”. The formula is true exactly when the input is not one of the false row. p q r output T T T F T T F T T F T T T F F F F T T T F T F T F F T T F F F F
DeMorgan’s Laws Logical equivalence : Two statements have the same truth table Statement: Tom is in the football team and the basketball team. Negation: Tom is not in the football team or not in the basketball team. De Morgan’s Law Why the negation of the above statement is not the following “Tom is not in the football team and not in the basketball team”? The definition of the negation is that exactly one of P or ¬P is true, but it could be the case that both the above statement and the original statement are false (e.g. Tom is in the football team but not in the basketball team).
DeMorgan’s Laws Logical equivalence : Two statements have the same truth table Statement: The number 783477841 is divisible by 7 or 11. Negation: The number 783477841 is not divisible by 7 and not divisible by 11. De Morgan’s Law Again, the negation of the above statement is not “The number 783477841 is not divisible by 7 or not divisible by 11”. In either case, we “flip” the inside operator from OR to AND or from AND to OR.
Simplifying Statement (Optional) See textbook for more identities. DeMorgan Distributive law The DeMorgan’s Law allows us to always “move the NOT inside”. We can use logical rules to simplify a logical formula.
Tautology, Contradiction A tautology is a statement that is always true. A contradiction is a statement that is always false. (negation of a tautology) In general it is “difficult” to tell whether a statement is a contradiction. It is one of the most important problems in CS – the satisfiability problem.