administrivia
play

administrivia Course web: http://www.cs.washington.edu/311 Office - PowerPoint PPT Presentation

administrivia Course web: http://www.cs.washington.edu/311 Office hours: 8 office hours (by end of week) Me: MW 2:30-3:30pm or by appointment Call me: James or Professor James or Professor Lee Dont: Actually call me. Homework #1: Posted


  1. administrivia Course web: http://www.cs.washington.edu/311 Office hours: 8 office hours (by end of week) Me: MW 2:30-3:30pm or by appointment Call me: James or Professor James or Professor Lee Don’t: Actually call me. Homework #1: Posted this Friday, due next Friday before class (April 10 th ) Gradescope! (stay tuned) Extra credit: Not required to get a 4.0. Counts separately. In total, may raise grade by ~0.1 Don’t be shy (raise your hand in the back)! Do space out your participation. If you are not CSE yet, please do well!

  2. logical connectives p  q p q  p p T T T T F T F F F T F T F F F F NOT AND p  q p  q p q p q T T T T T F T F T T F T F T T F T T F F F F F F XOR OR

  3. 𝑞 → 𝑟 p  q p q • “If p , then q ” is a promise : F F T • Whenever p is true, then q is true F T T • Ask “has the promise been broken” T F F T T T If it’s raining, then I have my umbrella.

  4. related implications p  q • Implication: q  p • Converse:  q   p • Contrapositive:  p   q • Inverse: How do these relate to each other? How to see this?

  5. 𝑞 ↔ 𝑟 • p iff q • p is equivalent to q • p implies q and q implies p p  q p q

  6. Roger’s second sentence with a truth table p q r 𝒓 ⊕ 𝒔 ¬𝒓 (𝒓 ⊕ 𝒔 → ¬𝒓) 𝒒 → ( 𝒓 ⊕ 𝒔 → ¬𝒓) 𝒒 → ( 𝒓 ⊕ 𝒔 → ¬𝒓) ∧ 𝒒 T T T T T F T F T T F F F T T F T F F F T F F F Roger is only orange if whenever he either has tusks or toenails, he doesn't have tusks and he is an orange elephant.”

  7. cse 311: foundations of computing Fall 2014 Lecture 2: Digital circuits & more logic

  8. digital circuits Computing with logic – T corresponds to 1 or “ high ” voltage – F corresponds to 0 or “ low ” voltage Gates: – Take inputs and produce outputs (functions) – Several kinds of gates – Correspond to propositional connectives

  9. AND gate AND Connective AND Gate vs. p p  q OUT q AND p  q p q p q OUT T T T 1 1 1 T F F 1 0 0 F T F 0 1 0 F F F 0 0 0 p OUT AND q “ block looks like D of AND ”

  10. OR gate OR Connective OR Gate vs. p p  q OUT q OR p  q p q p q OUT T T T 1 1 1 T F T 1 0 1 F T T 0 1 1 F F F 0 0 0 p OUT OR q “ arrowhead block looks like ∨ ”

  11. NOT gate NOT Gate (Also called vs. NOT Connective inverter ) p OUT NOT  p  p p p OUT 1 0 T F 0 1 F T p OUT NOT

  12. “gee, thanks.” blobs are okay You can write gates using blobs instead of shapes. p OUT q AND p OUT q OR p OUT NOT

  13. combinational logic circuits NOT AND NOT AND OR Values get sent along wires connecting gates

  14. combinational logic circuits AND OR NOT AND Wires can send one value to multiple gates!

  15. logical equivalence Terminology: A compound proposition is a… Tautology if it is always true – – Contradiction if it is always false – Contingency if it can be either true or false Classify! p   p p  p ( p  q )  p ( p  q )  ( p   q )  (  p  q )  (  p   q )

  16. logical equivalence Terminology: A compound proposition is a… Tautology if it is always true – – Contradiction if it is always false – Contingency if it can be either true or false Classify! 𝑞 ∧ 𝑟 ∧ 𝑠 ∨ ¬𝑞 ∧ 𝑟 ∧ ¬𝑠 ∧ 𝑞 ∨ 𝑟 ∨ ¬𝑡 ∨ 𝑞 ∧ 𝑟 ∧ 𝑡 NOT AND NOT AND OR

  17. logical equivalence A and B are logically equivalent if and only if A  B is a tautology i.e. A and B have the same truth table The notation A  B denotes A and B are logically equivalent. Example: p    p  p   p p    p p

  18. A  B vs. A  B A  B says that two propositions A and B always mean the same thing. A  B is a single proposition that may be true or false depending on the truth values of the variables in A and B. but A  B and (A  B)  T have the same meaning. Note: Why write A  B and not A = B ? [We use A = B to say that A and B are precisely the same proposition (same sequence of symbols)]

  19. de Morgan’s laws My code compiles or there is a bug. [let’s negate it] “Always wear breathable fabrics Write NAND using NOT and OR: when you get your picture taken.”

  20. de Morgan’s laws Verify:  𝑞  𝑟 ≡ (¬ 𝑞 ∨ ¬ 𝑟)  p  q  p   q p  q  ( p  q )  ( p  q )  ( p   q ) p q T T T F F T F F

  21. de Morgan’s laws  (𝑞 𝑟) 𝑞 𝑟  (𝑞 𝑟) 𝑞 𝑟 if ! ( front != null && value > front.data ) front = new ListNode(value, front); else { ListNode current = front; while ! ( current.next == null || current.next.data >= value ) current = current.next; current.next = new ListNode(value, current.next); }

  22. law of implication 𝑞 → 𝑟 ≡ (¬ 𝑞 ∨ 𝑟) p  q  p  p  q ( p  q )  (  p  q ) p q T T T F F T F F

  23. computing equivalence Describe an algorithm for computing if two logical expressions/circuits are equivalent. What is the run time of the algorithm?

  24. some familiar properties of arithmetic • 𝑦 + 𝑧 = 𝑧 + 𝑦 (commutativity) • 𝑦 ⋅ 𝑧 + 𝑨 = 𝑦 ⋅ 𝑧 + 𝑦 ⋅ 𝑨 (distributivity) 𝑦 + 𝑧 + 𝑨 = 𝑦 + (𝑧 + 𝑨) • (associativity) Logic has similar algebraic properties

  25. some familiar properties of arithmetic • 𝑦 + 𝑧 = 𝑧 + 𝑦 (commutativity) – 𝑞 ∨ 𝑟 ≡ 𝑟 ∨ 𝑞 – 𝑞 ∧ 𝑟 ≡ 𝑟 ∧ 𝑞 • 𝑦 ⋅ 𝑧 + 𝑨 = 𝑦 ⋅ 𝑧 + 𝑦 ⋅ 𝑨 (distributivity) – 𝑞 ∧ 𝑟 ∨ 𝑠 ≡ 𝑞 ∧ 𝑟 ∨ (𝑞 ∧ 𝑠) – 𝑞 ∨ 𝑟 ∧ 𝑠 ≡ 𝑞 ∨ 𝑟 ∧ (𝑞 ∨ 𝑠) 𝑦 + 𝑧 + 𝑨 = 𝑦 + (𝑧 + 𝑨) (associativity) • – 𝑞 ∨ 𝑟 ∨ 𝑠 ≡ 𝑞 ∨ 𝑟 ∨ 𝑠 – 𝑞 ∧ 𝑟 ∧ 𝑠 ≡ 𝑞 ∧ (𝑟 ∧ 𝑠)

  26. properties of logical connectives You will always get this list. • Identity – 𝑞 ∧ T ≡ 𝑞 • Associative – 𝑞 ∨ F ≡ 𝑞 𝑞 ∨ 𝑟 ∨ 𝑠 ≡ 𝑞 ∨ 𝑟 ∨ 𝑠 𝑞 ∧ 𝑟 ∧ 𝑠 ≡ 𝑞 ∧ 𝑟 ∧ 𝑠 • Domination – 𝑞 ∨ T ≡ T • Distributive – 𝑞 ∧ F ≡ F 𝑞 ∧ 𝑟 ∨ 𝑠 ≡ 𝑞 ∧ 𝑟 ∨ (𝑞 ∧ 𝑠) 𝑞 ∨ 𝑟 ∧ 𝑠 ≡ 𝑞 ∨ 𝑟 ∧ (𝑞 ∨ 𝑠) • Idempotent • Absorption – 𝑞 ∨ 𝑞 ≡ 𝑞 𝑞 ∨ 𝑞 ∧ 𝑟 ≡ 𝑞 – 𝑞 ∧ 𝑞 ≡ 𝑞 𝑞 ∧ 𝑞 ∨ 𝑟 ≡ 𝑞 • Negation Commutative • 𝑞 ∨ ¬𝑞 ≡ T – 𝑞 ∨ 𝑟 ≡ 𝑟 ∨ 𝑞 𝑞 ∧ ¬𝑞 ≡ F – 𝑞 ∧ 𝑟 ≡ 𝑟 ∧ 𝑞

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend