57
Introduction

lecture 01 alternate - Stanford University

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: lecture 01 alternate - Stanford University

Introduction

Page 2: lecture 01 alternate - Stanford University

Greek Trivium

Page 3: lecture 01 alternate - Stanford University

History

Page 4: lecture 01 alternate - Stanford University

History of Logic

Page 5: lecture 01 alternate - Stanford University

Logic in Human Affairs

Page 6: lecture 01 alternate - Stanford University

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: lecture 01 alternate - Stanford University

Logical Reasoning

Page 8: lecture 01 alternate - Stanford University

Logical Proofs

Page 9: lecture 01 alternate - Stanford University

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: lecture 01 alternate - Stanford University

Applications

Page 11: lecture 01 alternate - Stanford University

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: lecture 01 alternate - Stanford University

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: lecture 01 alternate - Stanford University

Possible Worlds

Page 14: lecture 01 alternate - Stanford University

Sorority World

Page 15: lecture 01 alternate - Stanford University

Sorority World

Page 16: lecture 01 alternate - Stanford University

Sorority World

Page 17: lecture 01 alternate - Stanford University

Sorority World

Page 18: lecture 01 alternate - Stanford University

Sorority World

Page 19: lecture 01 alternate - Stanford University

Logical Sentences

Page 20: lecture 01 alternate - Stanford University

Logical Sentences

Page 21: lecture 01 alternate - Stanford University

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: lecture 01 alternate - Stanford University

Sorority World

Page 23: lecture 01 alternate - Stanford University

Sorority World

Page 24: lecture 01 alternate - Stanford University

Sorority World

Page 25: lecture 01 alternate - Stanford University

Logical Entailment

Page 26: lecture 01 alternate - Stanford University

Possible Worlds

Page 27: lecture 01 alternate - Stanford University

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: lecture 01 alternate - Stanford University

Checking All Possible Worlds

Page 29: lecture 01 alternate - Stanford University

Proofs

Page 30: lecture 01 alternate - Stanford University

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: lecture 01 alternate - Stanford University

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: lecture 01 alternate - Stanford University

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

Sample Rule of Inference

Page 33: lecture 01 alternate - Stanford University

Sample Rule of Inference

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

Sample Rule of Inference

Page 34: lecture 01 alternate - Stanford University

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 35: lecture 01 alternate - Stanford University

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

Unsound Rule of Inference

Page 36: lecture 01 alternate - Stanford University

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 37: lecture 01 alternate - Stanford University

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

Using Unsound Rule of Inference

Page 38: lecture 01 alternate - Stanford University

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 39: lecture 01 alternate - Stanford University

Symbolic Logic

Page 40: lecture 01 alternate - Stanford University

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 41: lecture 01 alternate - Stanford University

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 42: lecture 01 alternate - Stanford University

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 43: lecture 01 alternate - Stanford University

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

Grammatical Ambiguity

Page 44: lecture 01 alternate - Stanford University

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 45: lecture 01 alternate - Stanford University

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

Good Reasoning

Page 46: lecture 01 alternate - Stanford University

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 47: lecture 01 alternate - Stanford University

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 48: lecture 01 alternate - Stanford University

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 49: lecture 01 alternate - Stanford University

Study Guide

Page 50: lecture 01 alternate - Stanford University

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

Symbolic Manipulation

Page 51: lecture 01 alternate - Stanford University

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 52: lecture 01 alternate - Stanford University

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 53: lecture 01 alternate - Stanford University

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 54: lecture 01 alternate - Stanford University

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 55: lecture 01 alternate - Stanford University

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 56: lecture 01 alternate - Stanford University

Logic and Computer Science

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

Page 57: lecture 01 alternate - Stanford University