Mathematics for Computer Science Propositional (Boolean) Logic 6.042J/18.062J A proposition is either True or False Propositions & Example: There are 5 regular solids. 6 Logical True False Operations Non-examples: Wake up! Where am I? It’s 3PM. February 11, 2015 propositional ops.1 February 11, 2015 propositional ops.2 Albert R Meyer Albert R Meyer English to Math English to Math Greeks carry Bronze or Copper swords Greeks carry Swords or Javelins G → (S ∨ J) G → (B ⊕ C) G (S J) G (B C) IMPLIES OR IMPLIES XOR Bronze or Copper but not both True even if a Greek carries both a Sword and a Javelin propositional ops.3 propositional ops.4 February 11, 2015 February 11, 2015 Albert R Meyer Albert R Meyer 1
Definition of OR Definition of XOR The value of (P OR Q) is T iff The value of (P XOR Q) is T iff P is T, or Q is T, or both are T. exactly one of P and Q is T. Truth Table for OR Truth Table for XOR P Q P XOR Q P Q P OR Q T T F T T T T F T T F T F T T F T T F iff both F F F F F F F F F P,Q are F February 11, 2015 propositional ops.5 February 11, 2015 propositional ops.6 Albert R Meyer Albert R Meyer Definition of AND Definition of NOT The value of (P AND Q) is T iff The value of NOT (P) is T iff both P and Q are T. the value of P is F. Truth Table for AND P Q P AND Q Truth Table for NOT ( P ) T iff both T T T T T T P,Q are T P NOT (P) T F F T F F T F F T F F F propositional ops.7 propositional ops.8 February 11, 2015 February 11, 2015 Albert R Meyer Albert R Meyer 2
Digital Logic Other Applications x :: = NOT (x) Java Logical Expressions: 1 :: = T 0 :: = F OR AND i :: = AND if ((x>0) || (x <= 0 && y>100)) ⋮ + :: = OR (more code) February 14, 2014 propositional ops.9 February 14, 2014 propositional ops.10 Albert R Meyer Albert R Meyer 3
MIT OpenCourseWare http://ocw.mit.edu 6.042J / 18.062J Mathematics for Computer Science Spring 20 15 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Recommend
More recommend