logic-puzzle - !(a || b) == (!a &&...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Many logical expressions are equivalent. It can sometimes be advantageous to rewrite an expression using different connectives. If two expressions have the same truth tables, then they are equivalent. (More complicated expressions can be proved equivalent by using techniques like tableaux or natural deduction.) Some well-known equivalences are given by theorems like DeMorgan's Law. Logical operators and equivalences handout for CS 302 by Will Benton (willb@cs) and Notation : Java : a b F F F F T F T F F T T T or Notation : Java : || a b a || b F F F F T T T T F T T T not Notation : ¬ Java : ! a !a F T T F DeMorgan's Law states that a negated conjunction is equivalent to a disjunction of negations and that a negated disjunction is equivalent to a conjunction of negations. Whew! Let's unpack that: Note that "conjunction" means "and," while "disjunction" means "or." Therefore, the first part of DeMorgan's Law states that The second part of DeMorgan's Law states that
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: !(a || b) == (!a && !b) (You can show this by making truth tables for the expressions on either side of the == operator.) mystery operator Notation : a b a b F F T F T T T T F T F T Equivalence puzzle Let's say you have a "mystery operator," notated and with the truth-table given at right. Using only the mystery operator, devise expressions that are equivalent to a && b , a || b , and !a . Hint 1: Solve "not" rst. Hint 2: Use DeMorgan's Law Goals: This handout gives an overview of the basic logical connectives: their names, their symbols in logical notation, and the operators to express them in Java syntax. It also presents DeMorgan's Law and features a puzzle involving nding logical equivalences. logic-puzzle.grafe: Created on Thu Feb 16 2006; modied on Sun Jul 09 2006; page 1 of 1 Copyright 2006 Will C. Benton...
View Full Document

Ask a homework question - tutors are online