CSE 20 DISCRETE MATH Prof Shachar Lovett http
- Slides: 30
CSE 20 DISCRETE MATH Prof. Shachar Lovett http: //cseweb. ucsd. edu/classes/wi 15/cse 20 -a/ Clicker frequency: CA
Todays topics • Algorithms: number systems, binary representation • Boolean logic • Sections 1. 3, 3. 2 -3. 4 in Jenkyns, Stephenson
Operations on binary numbers • Add, subtract, multiply, … … first, how do we add? A. 111 B. 100 C. 1011 D. 1111 E. None of the above
One bit addition 101 +110 1
One bit addition 101 +110 11
One bit addition Carry: 1 101 +110 011
One bit addition Carry: 1 101 +110 1011
How to add binary numbers? 110010101 +101101101 ? ? ? ? ?
How to add binary numbers? ? ? ? ? 110010101 +101101101 ? ? ? ? ? (carry)
How to add binary numbers? ? ? ? ? 110010101 +101101101 ? ? ? ? ? • Two basic operations: • One-Bit-Addition(bit 1, bit 2, carry) • Next-carry(bit 1, bit 2, carry) (carry)
Numbers … logic … circuits
One bit addition • One-Bit-Addition(bit 1, bit 2, carry) Bit 1 bit 2 carry One-Bit-Addition F F F T T F T F T F F T T F F T T T=1 F=0 Can we build this from “basic primitives”?
Logical operators JS pp. 82 -84 P ~P T F F T P Q P Q Pv. Q T T T T F F T F T F F T T F F F Truth table is the definition of the operator!
Logical operators JS pp. 82 -84 A. B. C. D. E. T, T, T, F, F, T, F, T F, F, F, T None of the above. P ~P T F F T P Q P Q Pv. Q P XOR Q T T T T ? T F F T T F ? F T F F T T F T ? F F F F ?
OR vs XOR • A OR B: Either A, or B, or both • A XOR B: Either A, or B, but not both • In spoken language, we sometimes confuse them • In mathematics, we needs to be precise
OR vs XOR • A OR B: Either A, or B, or both • A XOR B: Either A, or B, but not both • In spoken language, we sometimes confuse them • In mathematics, we needs to be precise • You are at a restaurant. The menu says you can have either a salad or a soup. Mathematically, this is: A. OR B. XOR C. Both D. Neither
OR vs XOR • A OR B: Either A, or B, or both • A XOR B: Either A, or B, but not both • In spoken language, we sometimes confuse them • In mathematics, we needs to be precise • You are at a birthday. The host asks: do you want ice-cream or cake (you can have both). Mathematically, this is: A. OR B. XOR C. Both D. Neither
Boolean expressions (P Q) (~R) • How to translate to a truth table? • Is there a unique way? A. Yes B. No JS p. 83
Boolean expressions (P Q) (~R) • How to translate to a truth table? • How many rows (not including header)? A. 2 B. 3 C. 4 D. 8
Boolean expressions (P Q) (~R) P Q R F F F T T T F F T T T P Q ~R (P Q) (~R)
Boolean expressions (P Q) (~R) P Q R P Q F F F T T F F F T F T T T T T ~R (P Q) (~R)
Boolean expressions (P Q) (~R) P Q R P Q ~R F F T F T T F F F T T T T F (P Q) (~R)
Boolean expressions (P Q) (~R) P Q R P Q ~R (P Q) (~R) F F T T F F F F T T F F F T T T T T F T
Truth table to expression P Q R ? ? ? T T T F F F F T T F F F F
DNFs • DNF = Disjunctive Normal Form • Literal: variable or its negation: P, ~P • Term: AND of literals: P ~Q • DNF: OR of terms: (P ~Q) (R P) ~P • Theorem: any Boolean expression can be written as a DNF
Truth table to expression P Q R ? ? ? T T T F F F F T T F F F F
Truth table to expression P Q R ? ? ? T T P Q R T T F T P Q ~R T F T T P ~Q R T F F F F T T F F F F (P Q R) (P Q ~R) (P ~Q R) (~P ~Q R) ~P ~Q R
Truth tables and Circuits • T • F “ 1” “ 0” High voltage Low voltage
4 bit adder
Next class • Quantifiers and paradoxes • Read sections 3. 2 -3. 4 in Jenkyns, Stephenson • Google “liar’s paradox”
- Shachar lovett
- Shachar tauber
- Mmt grades 0-5
- Jade lovett
- Lovett
- Marsha lovett
- Discrete mathematics
- Denying the antecedent fallacy
- Modeling computation discrete math
- Proof by contradiction discrete math
- Latihan soal matematika diskrit
- Discrete math propositional logic
- String in discrete mathematics
- Arrow diagram
- Proof of set identities
- Floor and ceiling discrete math
- Components of a mathematical system
- What does onto mean in discrete math
- Product rule discrete math
- What is discrete math
- Discrete math cartesian product
- Discrete mathematics with applications fourth edition
- Poset discrete math
- Counterexample discrete math
- Recursion in discrete mathematics
- Resolution example
- Recurrence discrete math
- Subtraction rule discrete math
- Knights and knaves discrete math
- Structural induction discrete math
- Discrete mathematics