{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info icon This 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 ([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
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" first. 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 finding logical equivalences. logic-puzzle.graffle: Created on Thu Feb 16 2006; modified on Sun Jul 09 2006; page 1 of 1 Copyright © 2006 Will C. Benton...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern