logic and computation: introductiona23gao/cs245_f19/slides/lec01...logic and computation:...

29
Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245 Logic and Computation Fall 2019 Alice Gao 1 / 29

Upload: others

Post on 04-Mar-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Logic and Computation:Introduction

Alice GaoLecture 1

Come and sit in the front. I won’t pick on you. :D

CS 245 Logic and Computation Fall 2019 Alice Gao 1 / 29

Page 2: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Outline

Let’s get acquainted

What is Logic and Computation?

Logistics and Resources

CS 245 Logic and Computation Fall 2019 Alice Gao 2 / 29

Page 3: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Let’s get acquainted

What is Logic and Computation?

Logistics and Resources

CS 245 Logic and Computation Fall 2019 Alice Gao 3 / 29

Page 4: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Who am I?

My name is Alice Gao. I grew up in Beijing, China, and have livedin Vancouver, Toronto, Cambridge (MA), Cambridge (UK), NewYork City, and Waterloo.Research: artificial intelligence, game theory, education.My work/education history:

▶ Lecturer, Computer Science, University of Waterloo.▶ Postdoc, Computer Science, UBC.▶ Ph.D., Computer Science, Harvard University.▶ Undergraduate, Computer Science and Mathematics, UBC.

Hobbies: board games, escape room games, hiking, swimming, andtraveling.

CS 245 Logic and Computation Fall 2019 Alice Gao 4 / 29

Page 5: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Meet your peers

▶ In the next 2 minutes, introduce yourself to someone youdon’t know.

▶ Talk about courses, co-op, summer activities, dorms,extracurricular activities...

CS 245 Logic and Computation Fall 2019 Alice Gao 5 / 29

Page 6: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

I’d like to learn your names

On your index card, write An exampleYour name Xi Gao

Your preferred nameand tips for pronunciation Alice Gao

Student number 15270036

Something interesting about you I once had a pet hedgehognamed Ebbie.

CS 245 Logic and Computation Fall 2019 Alice Gao 6 / 29

Page 7: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Let’s get acquainted

What is Logic and Computation?

Logistics and Resources

CS 245 Logic and Computation Fall 2019 Alice Gao 7 / 29

Page 8: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

CQ: Did you bring your clicker today?

CS 245 Logic and Computation Fall 2019 Alice Gao 8 / 29

Page 9: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Your expectations of this course

What have you heard about this course?

How do you feel about this course?

What do you expect the course to be like?

CS 245 Logic and Computation Fall 2019 Alice Gao 9 / 29

Page 10: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Some questions to answer

▶ Is logic useful especially for computer science?▶ What is logic?▶ Why do we need a formal language for logic?

CS 245 Logic and Computation Fall 2019 Alice Gao 10 / 29

Page 11: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Is logic useful for computer science?

Yes, of course.

Think of at least one application of logic in computer science.

CS 245 Logic and Computation Fall 2019 Alice Gao 11 / 29

Page 12: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Logic in Computer Science

Circuit Design▶ Digital circuits are the basic building blocks of an electronic

computer.

▶ CS 251: Computer Organization and DesignCS 350: Operating Systems

CS 245 Logic and Computation Fall 2019 Alice Gao 12 / 29

Page 13: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Logic in Computer Science

Algorithms and Theory of Computing▶ How much time and memory space do we need to solve a

problem?▶ Are there problems that cannot be solved by algorithms?

▶ CS 341: Algorithm Design and AnalysisCS 360: Introduction to the Theory of Computing

CS 245 Logic and Computation Fall 2019 Alice Gao 13 / 29

Page 14: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Logic in Computer Science

Artificial Intelligence▶ 19 billion FCC spectrum auction: Buy airwaves from television

broadcasters and sell them to mobile phone carriers.▶ IBM Watson won the Jeopardy Man vs. Machine Challenge

▶ CS 486: Artificial IntelligenceCS 485: Machine Learning

CS 245 Logic and Computation Fall 2019 Alice Gao 14 / 29

Page 15: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Logic in Computer Science

Databases▶ Structural Query Language (SQL) ≈ first-order logic▶ Efficient query evaluation based on relational algebra▶ Scale to large databases with parallel processors

▶ CS 348: Introduction to Database ManagementCS 448: Database Systems Implementation

CS 245 Logic and Computation Fall 2019 Alice Gao 15 / 29

Page 16: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Logic in Computer Science

Type Theory in Programming Language▶ Propositions in logic ↔ types in a programming language▶ Proofs of a proposition ↔ programs with the type▶ Simplifications of proofs ↔ evaluations of the programs

▶ CS 241: The compiler courseCS 442: Principles of Programming LanguagesCS 444: Compiler Construction

CS 245 Logic and Computation Fall 2019 Alice Gao 16 / 29

Page 17: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Logic in Computer Science

Formal Verification▶ Prove that a program is bug free. Bugs can be costly and

dangerous in real life.▶ Intel’s Pentium FDIV bug (1994) cost them half a billion

dollars.▶ Cancer patients died due to severe overdoses of radiation.

▶ CS 360: Theory of Computing (Finite Automata)

CS 245 Logic and Computation Fall 2019 Alice Gao 17 / 29

Page 18: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

What is logic?

▶ Logic: Logykos (Greek) - pertaining to reasoning

▶ Logic = the science of reasoning, inference, and deduction.

▶ Logic = the analysis of arguments.

CS 245 Logic and Computation Fall 2019 Alice Gao 18 / 29

Page 19: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Being logical

CS 245 Logic and Computation Fall 2019 Alice Gao 19 / 29

Page 20: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

An example of logical deduction

Let’s look at two clips from the TV series Sherlock.

Series 1, Episode 1, 9:23Series 1, Episode 1, 18:00

CS 245 Logic and Computation Fall 2019 Alice Gao 20 / 29

Page 21: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Logical Arguments

▶ Logic is the analysis of arguments.▶ An argument is a set of statements, consisting of one or more

premises and a conclusion.▶ Logic studies the forms of the arguments.

It does not study the content.

CS 245 Logic and Computation Fall 2019 Alice Gao 21 / 29

Page 22: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

CQ: Is this argument valid?

The sun rises from the West. (premise)If the sun rises from the West, then I will eat my hat. (premise)————————————————————I will eat my hat. (conclusion)

CQ: Is the above argument valid?(A) Yes, it is valid.(B) No, it is not valid.(C) I don’t know...

CS 245 Logic and Computation Fall 2019 Alice Gao 22 / 29

Page 23: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Why do we need a formal language for logic?

▶ The English language is imprecise and ambiguous.

▶ Common sense is not always sufficient and reliable.

CS 245 Logic and Computation Fall 2019 Alice Gao 23 / 29

Page 24: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

McDonald’s Cheeseburger v.s. Eternal Happiness

Claim: McDonald’s cheeseburger is better than eternal happiness.Proof.McDonald’s cheeseburger is better than nothing.Nothing is better than eternal happiness.Since 𝑎 > 𝑏 and 𝑏 > 𝑐, we can conclude 𝑎 > 𝑐.Then, McDonald’s cheeseburger is better than eternalhappiness.

CS 245 Logic and Computation Fall 2019 Alice Gao 24 / 29

Page 25: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Russell’s paradox

Let 𝑅 be the set of all sets that are not members of themselves.

𝑅 = {𝑥|𝑥 ∉ 𝑥}

Is 𝑅 a member of itself?

CS 245 Logic and Computation Fall 2019 Alice Gao 25 / 29

Page 26: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Let’s get acquainted

What is Logic and Computation?

Logistics and Resources

CS 245 Logic and Computation Fall 2019 Alice Gao 26 / 29

Page 27: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Grading

▶ Clicker questions (5%)▶ Weekly assignments (20%)▶ Midterm (25%)

▶ Thursday, November 7, 4:30 pm to 6:20 pm▶ Final exam (50%)

CS 245 Logic and Computation Fall 2019 Alice Gao 27 / 29

Page 28: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

Resources

▶ Course website: things that do not change,e.g. office hours and lecture schedule.

▶ Piazza: things that do change,e.g. announcements, questions, and discussions.

▶ Learn: assignments, tutorial notes, assignment and examsolutions, and marks.

CS 245 Logic and Computation Fall 2019 Alice Gao 28 / 29

Page 29: Logic and Computation: Introductiona23gao/cs245_f19/slides/lec01...Logic and Computation: Introduction Alice Gao Lecture 1 Come and sit in the front. I won’t pick on you. :D CS 245

How do I succeed in this course?

▶ Engage during lectures and tutorials.▶ Practice with the assignments and take advantage of office

hours.▶ Use learning goals as a study guide.▶ Struggling is necessary for learning.

CS 245 Logic and Computation Fall 2019 Alice Gao 29 / 29