{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

logic-puzzle

# logic-puzzle - (a || b ==!a&&!b •(You can show this...

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

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 ([email protected]) and Notation : Java : && a b 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 !(a && b) == (!a || !b) The second part of DeMorgan's Law states that
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.grafﬂe: Created on Thu Feb 16 2006; modiﬁed on Sun Jul 09 2006; page 1 of 1 Copyright © 2006 Will C. Benton...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern