Logic Expressions Statements In Logic we represent letters

  • Slides: 10
Download presentation
Logic Expressions

Logic Expressions

Statements • In Logic we represent letters like X, Y to represent statements •

Statements • In Logic we represent letters like X, Y to represent statements • A statement can be true or false • Statement X: It’s rainy • Statement Y: Its Tuesday • Command: Please open the door! • Conjunction connect statements to form compound statements

Truth Table: AND x y X AND Y T T F F F T

Truth Table: AND x y X AND Y T T F F F T F F

Truth Table: OR x y X OR Y T T F F F

Truth Table: OR x y X OR Y T T F F F

Truth Table: XOR x y X XOR Y T T F T F T

Truth Table: XOR x y X XOR Y T T F T F T T F F F

Truth Table: NOT X Not X T F F T

Truth Table: NOT X Not X T F F T

Order of precedence • The order of the precedence is the following. (No 1

Order of precedence • The order of the precedence is the following. (No 1 means higher precedence. ) 1. not 2. and 3. or, xor • You can use brackets to manipulate precedence like in algebra. – not (x or y) and y: “or” goes first, “not” goes second and “and” goes last.

De Morgan’s Law • De Morgan’s Law – not (x and y) = (not

De Morgan’s Law • De Morgan’s Law – not (x and y) = (not x) or (not y) – not (x or y) = (not x) and (not y) • We can show that two expressions are equivalent by drawing truth tables for them. • If their last columns match, then we have shown that they are equal. • Otherwise, we have shown that they are not equal.

Proving the Morgan’s Law X Y T X and y Not (x and Y)

Proving the Morgan’s Law X Y T X and y Not (x and Y) Y y T T F T F T F F NOT X NOT Y Not (x) Or Not(Y)

(NOT X ) OR (Y AND Z) X Y Z T T T F

(NOT X ) OR (Y AND Z) X Y Z T T T F F F T T F F F NOT X Y AND Z (NOT X ) OR (Y AND Z)