introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · introduction. greek...

59
Introduction

Upload: others

Post on 04-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Introduction

Page 2: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Greek Trivium

Page 3: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

History

Page 4: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

History of Logic

Page 5: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Logic in Human Affairs

Page 6: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Observations Abby likes Bess but Bess does not like Abby.

 Definitions

A triangle is a polygon with three sides. Physical Laws

Pressure times volume is proportional to temperature.

Logical Sentences

Page 7: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Logical Reasoning

Page 8: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Logical Proofs

Page 9: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

9

q(b,c)p(a,b)

∀x.∀y.(p(x,y) ⇒ q(x,y))

∃x.p(x,d)

¬p(b,d)

p(c,b)∨ p(c,d)

Computational Logic

Page 10: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Applications

Page 11: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Email Readers If the message is from “genesereth” and the topic is “logic”, Then the message goes in the “important” folder

eCommerce Systems If the product is a notebook and the customer is a student and the date is in December, Then the price is $5.99.

Logic-Enabled Computer Systems

Page 12: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

init(cell(1,1,b))init(cell(1,2,b))init(cell(1,3,b))init(cell(2,1,b))init(cell(2,2,b))init(cell(2,3,b))init(cell(3,1,b))init(cell(3,2,b))init(cell(3,3,b))init(control(x))

legal(P,mark(X,Y)) :- true(cell(X,Y,b)) & true(control(P))

legal(x,noop) :- true(control(o))

legal(o,noop) :- true(control(x))

next(cell(M,N,P)) :- does(P,mark(M,N))

next(cell(M,N,Z)) :- does(P,mark(M,N)) & true(cell(M,N,Z)) & Z#b

next(cell(M,N,b)) :- does(P,mark(J,K)) & true(cell(M,N,b)) & (M#J | N#K)

next(control(x)) :- true(control(o))

next(control(o)) :- true(control(x))

terminal :- line(P)terminal :- ~open

goal(x,100) :- line(x)goal(x,50) :- drawgoal(x,0) :- line(o)

goal(o,100) :- line(o)goal(o,50) :- drawgoal(o,0) :- line(x)

row(M,P) :- true(cell(M,1,P)) & true(cell(M,2,P)) & true(cell(M,3,P))

column(N,P) :- true(cell(1,N,P)) & true(cell(2,N,P)) & true(cell(3,N,P))

diagonal(P) :- true(cell(1,1,P)) & true(cell(2,2,P)) & true(cell(3,3,P))

diagonal(P) :- true(cell(1,3,P)) & true(cell(2,2,P)) & true(cell(3,1,P))

line(P) :- row(M,P)line(P) :- column(N,P)line(P) :- diagonal(P)

open :- true(cell(M,N,b))

draw :- ~line(x) & ~line(o)

Logic Programming

Page 13: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Possible Worlds

Page 14: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Sorority World

Page 15: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Sorority World

Page 16: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Sorority World

Page 17: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Sorority World

Page 18: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Sorority World

Page 19: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Logical Sentences

Page 20: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Logical Sentences

Page 21: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Logical Sentences

Dana likes Cody.Abby does not like Dana.

Dana does not like Abby.Bess likes Cody or Dana.

Abby likes everyone that Bess likes.

Cody likes everyone who likes her.

Nobody likes herself.

Page 22: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Sorority World

Page 23: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Sorority World

Page 24: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Sorority World

Page 25: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Logical Entailment

Page 26: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Possible Worlds

Page 27: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

A set of premises logically entails a conclusion if and only if every world that satisfies the premises satisfies the conclusion.

Premises: Conclusions:Dana likes Cody. Bess likes Cody.Abby does not like Dana. Bess does not like Dana.Dana does not like Abby. Everybody likes somebody.Bess likes Cody or Dana. Everybody is liked by somebody.Abby likes everyone that Bess likes.Cody likes everyone who likes her.Nobody likes herself.

Logical Entailment

Page 28: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Checking All Possible Worlds

Page 29: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Proofs

Page 30: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Abby likes everyone that Bess likes.Abby does not like Dana.Therefore, Bess does not like Dana.

Bess likes Cody or Dana.Bess does not like DanaTherefore, Bess likes Cody.

Proofs

Page 31: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

A rule of inference is a reasoning pattern consisting of some premises and some conclusions.

If we believe the premises, a rule of inference tell us that we should also believe the conclusions.

Rules of Inference

Page 32: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

All of Abby's friends are Bess's friends.All of Bess's friends are Cody's friends. Therefore, all of Abby's friends are Cody's friends.

Sample Rule of Inference

Page 33: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

All Accords are Hondas.All Hondas are Japanese. Therefore, all Accords are Japanese.

Sample Rule of Inference

Page 34: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Sample Rule of Inference

All borogoves are slithy toves.All slithy toves are mimsy. Therefore, all borogoves are mimsy.

Sample Rule of Inference

Page 35: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

All x are y.All y are z. Therefore, x are z.

Which patterns are correct?How many rules do we need?

Sound Rule of Inference

Page 36: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

All x are y.Some y are z.Therefore, some x are z.

Unsound Rule of Inference

Page 37: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

All Toyotas are Japanese cars.Some Japanese cars are made in America.Therefore, some Toyotas are made in America.

Using Unsound Rule of Inference

Page 38: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

All Toyotas are cars.Some cars are Porsches.Therefore, some Toyotas are Porsches.

Using Unsound Rule of Inference

Page 39: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

All of Abby's friends are Bess's friends.Some of Bess's friends are Abby's enemies.Therefore, some of Abby's friends are Abby's enemies.

Example: Abby likes Cody, and Bess likes Cody. Bess likes Dana, but Abby does not like Dana.

Using Unsound Rule of Inference

Page 40: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

A conclusion is provable for a set of premises if and only if every there is a finite sequence of sentences in which every element is either a premise or the result of applying a sound rule of inference to earlier members in the sequence.

As we shall see, for well-behaved logics, logical entailment and provability are identical - a set of premises logically entails a conclusion if and only if the conclusion is provable from the premises. This is a very big deal.

Provability

Page 41: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Symbolic Logic

Page 42: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Logical Sentences

Dana likes Cody.Abby does not like Dana.

Dana does not like Abby.Bess likes Cody or Dana.

Abby likes everyone that Bess likes.

Cody likes everyone who likes her.

Nobody likes herself.

Page 43: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

One grammatically correct sentence:

The cherry blossoms in the spring.

Another grammatically correct sentence:

The cherry blossoms in the spring sank.

Complexity of Natural Language

Page 44: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

The University may terminate this lease when the Lessee, having made application and executed this lease in advance of enrollment, is not eligible to enroll or fails to enroll in the University or leaves the University at any time prior to the expiration of this lease, or for violation of any provisions of this lease, or for violation of any University regulation relative to resident Halls, or for health reasons, by providing the student with written notice of this termination 30 days prior to the effective data of termination; unless life, limb, or property would be jeopardized, the Lessee engages in the sales of purchase of controlled substances in violation of federal, state or local law, or the Lessee is no longer enrolled as a student, or the Lessee engages in the use or possession of firearms, explosives, inflammable liquids, fireworks, or other dangerous weapons within the building, or turns in a false alarm, in which cases a maximum of 24 hours notice would be sufficient.

Michigan Lease Termination Clause

Page 45: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

There’s a girl in the room with a telescope.

Grammatical Ambiguity

Page 46: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Crowds Rushing to See Pope Trample 6 to Death

British Left Waffles on Falkland Islands

Scientists Grow Frog Eyes and Ears

Food Stamp Recipients Turn to Plastic

Fried Chicken Cooked in Microwave Wins Trip

Indian Ocean Talks

Headlines

Page 47: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Champagne is better than beer.Beer is better than soda. Therefore, champagne is better than soda.

Good Reasoning

Page 48: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Champagne is better than beer.Beer is better than soda. Therefore, champagne is better than soda.

Bad sex is better than nothing.Nothing is better than good sex. Therefore, bad sex is better than good sex.

Bad Reasoning

Page 49: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Xavier is three times as old as Yolanda. Xavier's age and Yolanda's age add up to twelve. How old are Xavier and Yolanda?

x − 3y = 0x + y = 12−4y = −12

Algebra

y = 3x = 9

Page 50: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

If Mary loves Pat, then Mary loves Quincy. If it is Monday and raining, then Mary loves Pat or Quincy. If it is Monday and raining, does Mary love Quincy?

p ⇒ q m ∧ r ⇒ p ∨ q

m ∧ r ⇒ q ∨ q m ∧ r ⇒ q

Symbolic Logic

Page 51: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Study Guide

Page 52: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

x − 3y = 0x + y = 12−4y = −12

Symbolic Manipulation

Page 53: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Sets{a, b, c} ∪ {b, c, d} = {a, b, c, d}

a ∈ {a, b, c}

{a, b, c} ⊆{a, b, c, d}

Functions and Relationsf(a, b) = c

r(a, b, c)

Mathematical Background

Page 54: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Materials of the Course Lectures Lecture Notes Additional Readings Exercises

Discussion Groups Read discussion Post questions Answer questions Work with others!

Hints on How to Take the Course

Page 55: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Propositional Logic

If it is raining, the ground is wet.

Relational LogicIf x is a parent of y, then y is a child of x.

Herbrand LogicThe father of a person is older than the person.

Multiple Logics

Page 56: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

We frequently write sentences about sentences.

Sentence: When it rains, it pours.Metasentence: That sentence contains two verbs.

We will frequently prove things about proofs.

Proofs: formalMetaproofs: informal

Meta

Page 57: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Logic

“You are not thinking; you are just being logical.”- Niels Bohr to Albert Einstein

“Mathematics (Logic) may be defined as the subject in which we never know what we are talking about nor whether what we are saying is true.''

- Bertrand RussellTranslation: “Garbage in, garbage out."Translation: “Treasure in, treasure out.”

Page 58: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes

Logic and Computer Science

Logic is the mathematics of Computer Science as Calculus is the mathematics of Physics.

Page 59: Introductionintrologic.stanford.edu/lectures/lecture_01.pdf · 2020-05-20 · Introduction. Greek Trivium. History. History of Logic. Logic in Human Affairs. Observations Abby likes