cpsc 121 models of computation 2018 summer section v01
play

CPSC 121: Models of Computation 2018 Summer, section V01 - PowerPoint PPT Presentation

CPSC 121: Models of Computation 2018 Summer, section V01 Introduction & Motivation Meghan Allen, based on notes by Steve Wolfman, Patrice Belleville and others 1 This work is licensed under a Creative Commons Attribution 3.0 Unported


  1. CPSC 121: Models of Computation 2018 Summer, section V01 Introduction & Motivation Meghan Allen, based on notes by Steve Wolfman, Patrice Belleville and others • 1 This work is licensed under a Creative Commons Attribution 3.0 Unported License.

  2. Learning Goals: In-Class By the end of the unit, you should be able to: – Give an example of how we can apply formal reasoning and computers to a simple, real-world task. – Give an example of how a computational solution to a simple task might go wrong. – Describe the two “big stories” of CS121: reasoning about computation and building computers. 2

  3. Outline • Introductions • Introductions Exercise • The CS121 Story • Course Administration • Next Lecture Notes 3

  4. Introductions Meghan Allen <meghana@cs.ubc.ca> ICCS 243, ORCH 4015 office hours Mondays 3-4pm (except May 28), Thursdays 10:30am-11:30am in ICCS 243 I also have an open door policy: If my door is open, come in and talk! And, you can make appointments with me. Additionally, you can use the many other staff office hours (to be posted on the website soon!) 4

  5. Outline • Introductions • Introductions Exercise • The CS121 Story • Course Administration • Next Lecture Notes 5

  6. More Introductions Introduce yourselves… how ? 6

  7. Introduce yourself to me Please take a blue paper and write - Your legal name - Your preferred name - Why you are taking this course - Something fun about yourself that you’d like to share with me 7

  8. Introduce Yourselves in Groups of 4-ish FIND ~3 people around you, preferably people you don’t know well. Form a group. Have everyone in the group introduce themselves to everyone else in the group. (Count the number of intros this takes.) Tell everyone why you’re here, your favorite career that you’ll never have, and one unusual thing about you. 8

  9. Problem : How Many Introductions? Problem : How many introductions does it take for everyone in a group to meet everyone else in a group? 9

  10. Concept Q: Intros for 4 How many introductions does a group of 4 people take? a. 3 b. 4 c. 6 d. 12 e. None of these 10

  11. Problem : How Many Introductions? Problem : How many introductions does it take for everyone in a group to meet everyone else in a group? To solve this problem, we need to model it more formally. 11

  12. How Many Introductions? Model: One “introduction” is one person introducing themselves to another person. (Two people need two introductions to introduce themselves to each other.) A group has “introduced themselves” when every group member has introduced themselves to every other member. (No self-introductions!) Hi, I’m Hi Grace, Intro #1 Grace H. I’m Alan T. Intro #2 12

  13. How Many Introductions? Problem: How many introductions does it take for a group of n people to introduce themselves? 13

  14. How Many Introductions? For 2 people? Our examples. Should 0 and 1 be examples? For 3 people? For 4 people? For 5 people? … For n people? 14

  15. How Many Introductions? For 100 people? For 8675309 people? For 1526097757 people? 15

  16. Program for Introductions int introductions(int n) { return n * (n - 1); (in Java) } (define (introductions n) (* n (- n 1))) (in BSL) Do you believe it? 16

  17. Program for Introductions: Testing Java version with 100: 9900 Do you believe it? 17

  18. Program for Introductions: Testing Java version with 100: 9900 Java version with 8675309: 265642364 Do you believe it? 18

  19. Program for Introductions: Testing Java version with 100: 9900 Java version with 8675309: 265642364 Java version with 1526097757: -645820308 Um.. Do you believe it? Does this fit with your “model” of computation? 19

  20. Program for Introductions: Testing BSL version with 100: 9900 BSL version with 8675309: 75260977570172 BSL version with 1526097757: 2328974362394333292 Do you believe it? Will BSL always get the right answer? 20

  21. Alternate Introductions Program ;; Model in math, translate to BSL. (define (introductions n) (* n (- n 1))) ;; Model as “I know what happens ;; a) in a group of 0 people, and ;; b) when someone new enters a group.” ;; Translate to BSL. (define (introductions n) (if (= n 0) 0 (+ (introductions (- n 1))) ; the smaller group (* 2 (- n 1))) ; the extra intros 21 Are both correct?

  22. Outline • Introductions • Introductions Exercise • The CS121 Story • Course Administration • Next Lecture Notes 22

  23. Questions that CPSC121 Answers How can we prove that our formula for the number of introductions is correct? ( predicate logic proof for n*(n-1) version, induction for “recursive” version) What went wrong in our Java implementation but right in our BSL implementation? ( number representation ) How does the computer (or DrRacket) decide if the characters of your program represent a name, a number, or something else? How does it figure out if you have mismatched " " or ( )? ( DFAs ) How do we model and reason about computational systems at various levels of abstraction? ( propositional and predicate logic, proof, sets, functions, DFAs, relations, ... ) 23

  24. CPSC 121: The Big Stories Theory Hardware How do we model How do we build devices that computational systems can compute out of real (programs/computers) in materials (“sand and rocks order to design and analyze and water”)? them? Grand goal : break Grand goal : Reason about down a full computer what is and isn’t into simple “gates”. possible to compute. Bonus end goal : Develop tools to communicate computational ideas clearly and precisely. 24

  25. Our Working Computer The whole thing (mostly wires connecting boxes). 25

  26. Our Working Computer (zoomed in on one “box”) Just the “ALU” (Arithmetic/Logic Unit). You’ll see a 26 pared-down version in lab in a couple of weeks.

  27. CPSC 121: The (By?)Products Theory Hardware Products: Products: • Propositional logic • Gates • Predicate logic • Combinational circuits • Sets and functions • Binary data representations • Proof techniques ( especially • Sequential circuits induction!) • A full computer • Finite Automata/Regular Expressions • Universal machines • Uncomputability 27

  28. What is CPSC 121 Good For? With CPSC121’s help, you will be able to: • model important problems so that they are easier to discuss, reason about, solve, and test. • learn new modeling formalisms more easily. • communicate clearly and unambiguously with other CS experts on complex topics. • characterize algorithms (CS problem solutions), such as proving their correctness or comparing their performance. • critically read proofs: justifying why each step is correct and judging what the proof means. 28

  29. Outline • Introductions • Introductions Exercise • The CS121 Story • Course Administration • Next Lecture Notes 29

  30. Course Administration Explore the CPSC 121 website: http://www.ugrad.cs.ubc.ca/~cs121/2018S-Vant You are required to be familiar with the course website. Ignorance of information on the website may harm you . Our course syllabus information, including grading policies, is all on the website. At minimum: read everything in the “course info” area, skimming the detailed learning goals. Join Piazza! (access code is models) 30

  31. Additional Administrative Notes We’ll double your mark on the first quiz to a max of 100%. (So, if you earn more than 50%, it will count as 100%.) BUT IT’S DUE BY NEXT CLASS! Check the Scheduling page for when labs and tutorials start. 31

  32. Course Communication If you have questions about course content – post on Piazza (also, answer your classmates’ questions on Piazza!) If you have administrative questions (e.g. you were sick, want something regraded) – email Eka, our course coordinator, at cpsc121v- admin@cs.ubc.ca If you have a question that’s so personal that you don’t feel comfortable asking it in either of the ways described above, email Meghan 32

  33. Outline • Introductions • Introductions Exercise • The CS121 Story • Course Administration • Next Lecture Notes 33

  34. Learning Goals: In-Class By the end of the unit, you should be able to: – Give an example of how we can apply formal reasoning and computers to a simple, real-world task. – Give an example of how a computational solution to a simple task might go wrong. – Describe the two “big stories” of CS121: reasoning about computation and building computers. 34

  35. Next Lecture Learning Goals: Pre-Class By the start of class, you should be able to: – Translate back and forth between simple natural language statements and propositional logic. – Evaluate the truth of propositional logic statements using truth tables. – Translate back and forth between propositional logic statements and circuits that assess the truth of those statements. 35

  36. Next Lecture Prerequisites Read Sections 1.1 and 1.4/2.1 and 2.4 Read propositional logic supplement: http://www.ugrad.cs.ubc.ca/~cs121/2018S- Vant/handouts/prop-circuit-xlate.html You should have completed the open-book, untimed (two-part!) quiz on Canvas that’s due by 7PM the day before class. (You are responsible for ensuring that you have submitted the quiz by its deadline!) Readings: 3 rd ed in black/4 th ed in red 36

Recommend


More recommend