cse 311 foundations of computing
play

CSE 311: Foundations of Computing Lecture 3: Digital Circuits & - PowerPoint PPT Presentation

CSE 311: Foundations of Computing Lecture 3: Digital Circuits & Equivalence Announcements Homework #1 is linked in the right column of the CSE 311 homepage Read Grading Guidelines before starting Read Submission


  1. CSE 311: Foundations of Computing Lecture 3: Digital Circuits & Equivalence

  2. Announcements • Homework #1 is linked in the right column of the CSE 311 homepage – Read “Grading Guidelines” before starting – Read “Submission Instructions” for everything you need to do for Gradescope submission • Full office hour slate is posted: – M 12:30-1:20, 2:30-4:00, 4:00-4:50 – T 1:00-1:50, 3:30-4:20 – W 10:30-11:20, 2:30-3:00 – F 2:30-3:00, 3:30-4:20 • If you don’t have a “tent card” come see me.

  3. Last class: Logical Equivalence A ≡ B A ≡ B is an assertion that two propositions A and B always have the same truth values. tautology A ≡ B and (A ↔ B) ≡ T have the same meaning. p ∧ q ≡ q ∧ p p q p ∧ q q ∧ p ( p ∧ q ) ↔ ( q ∧ p ) T T T T T T F F F T F T F F T F F F F T p ∧ q ≢ q ∨ p When p =T and q =F, p ∧ q is false, but q ∨ p is true

  4. Last class: De Morgan’s Laws De Morgan’s Laws � � ∧ � � �� ∨ �� � � ∨ � � �� ∧ ��

  5. Last class: Equivalences Related to Implication Law of Implication � → � ≡ �� ∨ � Contrapositive � → � ≡ �� → �� Biconditional � �� � ≡ (� � �) ∧ (� � �)

  6. Last class: Properties of Logical Connectives

  7. One more easy equivalence Double Negation � ↔ � � � p ¬ p ¬ ¬ p p ↔ ¬ ¬ p T F T T F T F T

  8. Last class: Digital Circuits – T corresponds to 1 or “ high ” voltage Computing With Logic – F corresponds to 0 or “ low ” voltage Gates es – Take inputs and produce outputs (functions) – Several kinds of gates – Correspond to propositional connectives (most of them)

  9. Last class: AND, OR, NOT Gates p q p q p ∧ q OUT AND Gate T T T 1 1 1 1 0 0 T F F p OUT AND q 0 1 0 F T F 0 0 0 F F F OR Gate p q p q p ∨ q OUT T T T 1 1 1 p 1 0 1 T F T OUT OR q 0 1 1 F T T 0 0 0 F F F NOT Gate p p ¬ p OUT 1 0 T F p OUT NOT 0 1 F T

  10. Last Class: Combinational Logic Circuits p AND q OUT OR NOT AND r Wires can send one value to multiple gates! � ∧ �� ∨ (�� ∧ �)

  11. Other Useful Gates NAND p q out p 0 0 1 �(� ∧ �) out 0 1 1 q 1 0 1 1 1 0 p q out NOR 0 0 1 p out �(� ∨ �) 0 1 0 q 1 0 0 1 1 0 p q out XOR p 0 0 0 out � ⊕ � 0 1 1 q 1 0 1 1 1 0 XNOR p q out � ↔ � 0 0 1 p out 0 1 0 q 1 0 0 1 1 1

  12. Understanding logic and circuits When do two logic formulas mean the same thing? When do two circuits compute the same function? What logical properties can we infer from other ones?

  13. Basic rules of reasoning and logic • Allow manipulation of logical formulas – Simplification – Testing for equivalence • Applications – Query optimization – Search optimization and caching – Artificial Intelligence – Program verification

  14. Computing Equivalence Given two propositions, can we write an algorithm to determine if they are equivalent? What is the runtime of our algorithm?

  15. Computing Equivalence Given two propositions, can we write an algorithm to determine if they are equivalent? Yes! Generate the truth tables for both propositions and check if they are the same for every entry. What is the runtime of our algorithm? Every atomic proposition has two possibilities (T, F). If there are � atomic propositions, there are � � rows in the truth table.

  16. Another approach: Logical Proofs To show A is equivalent to B – Apply a series of logical equivalences to sub-expressions to convert A to B To show A is a tautology – Apply a series of logical equivalences to sub-expressions to convert A to T

  17. Another approach: Logical Proofs To show A is equivalent to B – Apply a series of logical equivalences to sub-expressions to convert A to B Example: Let A be “ � ∨ (� ∧ �) ”, and B be “ � ”. Our general proof looks like: � ∨ � ∧ � ≡ ( ) ≡ �

  18. Logical Proofs Example: Let A be “ � ∨ (� ∧ �) ”, and B be “ � ”. Our general proof looks like: � ∨ � ∧ � ≡ ( ) ≡ �

  19. Logical Proofs Example: Let A be “ � ∨ (� ∧ �) ”, and B be “ � ”. Our general proof looks like: � ∨ � � ∨ � ∧ � ≡ ( ) Idempotent ≡ � Idempotent

  20. Logical Proofs To show A is a tautology – Apply a series of logical equivalences to sub-expressions to convert A to T Example: Let A be “ �� ∨ (� ∨ �) ”. Our general proof looks like: �� ∨ � ∨ � ≡ ( ) ≡ ( ) ≡ T

  21. Logical Proofs Example: Let A be “ �� ∨ (� ∨ �) ”. Our general proof looks like: �� ∨ � ∨ � ≡ ( ) ≡ ( ) ≡ T

  22. Logical Proofs Example: Let A be “ �� ∨ (� ∨ �) ”. Our general proof looks like: �� ∨ � �� ∨ � ∨ � ≡ ( ) Idempotent � ∨ �� ≡ ( ) Commutative Negation ≡ T

  23. Prove these propositions are equivalent: Option 1 Prove: p ∧ ( p → q ) ≡ p ∧ q Make a Truth Table and show: � ∧ (� → �) ⟷ � ∧ � ≡ T � � � → � � ∧ (� → �) � ∧ � � ∧ (� → �) ⟷ � ∧ � T T T T T T T F F F F T F T T F F T F F T F F T

  24. Prove these propositions are equivalent: Option 2 Prove: p ∧ ( p → q ) ≡ p ∧ q � ∧ � → � ≡ ≡ ≡ ≡ ≡ � ∧ �

  25. Prove these propositions are equivalent: Option 2 Prove: p ∧ ( p → q ) ≡ p ∧ q � ∧ � → � ≡ � ∧ (�� ∨ �) Law of Implication ≡ � ∧ �� ∨ (� ∧ �) Distributive ≡ F ∨ (� ∧ �) Negation ≡ � ∧ � ∨ F Commutative ≡ � ∧ � Identity

  26. Prove this is a Tautology: Option 1 ( p ∧ q ) → ( q ∨ p ) Make a Truth Table and show: � ∧ � → � ∨ � ≡ T � � � ∧ � � ∨ � � ∧ � → � ∨ � T T T T T T F F T T F T F T T F F F F T

  27. Prove this is a Tautology: Option 2 ( p ∧ q ) → ( q ∨ p ) Use a series of equivalences like so: � ∧ � → � ∨ � ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ T

  28. Prove this is a Tautology: Option 2 ( p ∧ q ) → ( q ∨ p ) Use a series of equivalences like so: � ∧ � → � ∨ � ≡ � � ∧ � ∨ (� ∨ �) Law of Implication ≡ �� ∨ �� ∨ (� ∨ �) DeMorgan ≡ �� ∨ (�� ∨ � ∨ � ) Associative ≡ �� ∨ ( �� ∨ � ∨ �) Associative ≡ �� ∨ (� ∨ �� ∨ � ) Commutative ≡ (�� ∨ �) ∨ �� ∨ � Associative ≡ (� ∨ ��) ∨ � ∨ �� Commutative (twice) ≡ T ∨ T Negation (twice) ≡ T Domination/Identity

  29. Logical Proofs of Equivalence/Tautology • Not smaller than truth tables when there are only a few propositional variables... • ...but usually much shorter than truth table proofs when there are many propositional variables • A big advantage will be that we can extend them to a more in-depth understanding of logic for which truth tables don’t apply.

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