truth, deduction, computation lecture b

23
Truth, Deduction, Computation Lecture B Quantifiers, part 1 Vlad Patryshev SCU 2013

Upload: vlad-patryshev

Post on 01-Nov-2014

383 views

Category:

Education


1 download

DESCRIPTION

My logic lectures at SCU Quantifiers, part 1

TRANSCRIPT

Page 1: Truth, deduction, computation   lecture b

Truth, Deduction, ComputationLecture B

Quantifiers, part 1Vlad PatryshevSCU2013

Page 2: Truth, deduction, computation   lecture b

Folding ∨ and ∧

● P1∨P

2∨...∨P

n - associativity! ∨

1..nPi

● P1∧P

2∧...∧P

n - associativity! ∧

1..nPi

Page 3: Truth, deduction, computation   lecture b

In Java

interface Predicate<X> { public boolean check(X x);}

boolean foreach<X>(Iterable<X> xs, Predicate<X> p) { for (x: xs) if (!p.check(xs)) return false; return true;}

boolean exists<X>(Iterable<X> xs, Predicate<X> p) { for (x: xs) if (p.check(xs)) return true; return false;}

Page 4: Truth, deduction, computation   lecture b

In Scala

type Predicate[X] = X => Boolean

def foreach[X](xs: Iterable[X], p: Predicate[X]) = { xs.foreach(p)}

boolean exists[X](xs: Iterable[X], p: Predicate[X]) { xs.exists(p)}

Page 5: Truth, deduction, computation   lecture b

In Scala

def foreach[X](xs: Iterable[X], p: X => Boolean) = xs foreach p

boolean exists[X](xs: Iterable[X], p: X => Boolean) = xs exists p

Page 6: Truth, deduction, computation   lecture b

In Logic, take 1

● P1∨P

2∨...∨P

n -> ∨

1..nPi

∃i=1..n

Pi

● P1∧P

2∧...∨P

n -> ∧

1..nPi

∀i=1..n

Pi

Page 7: Truth, deduction, computation   lecture b

In Logic, take 2: Example

● P1=Tet(a); P

2=Small(b); P

3=¬Red(c)

Not much to parameterize, all formulas are different…

● P1=Tet(a); P

2=Tet(b); P

3=Tet(c)

or:● x

1=a; x

2=b; x

3=c; P

i=Tet(x

i)

∀i=1..n

Tet(xi) or ∃

i=1..nTet(x

i)

or:● x

1=a; x

2=b; x

3=c; P

i=Tet(x

i)

∀x in {a,b,c}

Tet(x) or ∃x in {a,b,c}

Tet(x)

Page 8: Truth, deduction, computation   lecture b

In Logic, take 3

● Can we always enumerate arguments?● e.g. all real numbers from [0,1]

We Need Variables!

Page 9: Truth, deduction, computation   lecture b

In Logic, take 4: Introducing Variables

Anything that looks like an identifierEven _ can do if we know what we mean

Scala:

List(1,2,3) exists (_ % 2 == 0)

Page 10: Truth, deduction, computation   lecture b

Add Variables to Atomic Sentences

<atomic> ::= <predicateName>(<arguments>)

<predicateName> ::= <Capital>

<predicateName> ::= <Capital><letters>

<var> ::= /* choose a distinct set of words */

<name> ::= <objectName>|<var>

<arguments> ::= <name>|<arguments>,<name>

E.g. Left(x, a)

x is a variable

Page 11: Truth, deduction, computation   lecture b

Variables in the Exercises

Page 12: Truth, deduction, computation   lecture b

Build Formulas with Variables

● Tet(x)∧¬Cube(y)v(Left(a,x)∧Right(y,a))

● ∀x (Tet(x)∧(Left(a,x)∧Right(c,a))

● ∃x Between(x,a,b)

● ∀x ∀y ∃z Between(z,x,y)

Page 13: Truth, deduction, computation   lecture b

Bound Variables

● Tet(x)∧¬Cube(y)v(Left(a,x)∧Right(y,a))

● ∀x (Tet(x)∧(Left(a,x)∧Right(y,a))

● ∃x Between(x,a,b)

● ∀x ∀y ∃z Between(z,x,y)

Page 14: Truth, deduction, computation   lecture b

Formulas with Quantifiers, formally

<wff> ::= <atomic formula>

<wff> ::= ¬<wff>|(<wff>)

<wff> ::= <wff>v<wff>|<wff>∧<wff>

<wff> ::= <wff>→<wff>|<wff>↔<wff>

<wff> ::= ∀<var> <wff> // the var is bound here

<wff> ::= ∃<var> <wff> // the var is bound here

<sentence> ::= <wff /*where all vars are bound*/>

Page 15: Truth, deduction, computation   lecture b

Satisfaction

A wff P(x) with an unbound variable x is satisfied on a iff ⊨ P(a)

E.g. a small cube satisfies the formula Cube(x) ∧ ¬ Large(x)

Page 16: Truth, deduction, computation   lecture b

Satisfaction for Specific Formulas

Formula Kind How Satisfied

<atomic> find an object or objects

¬P find counterexample for P

PvQ find something that satisfies at least one of P and Q

P∧Q find something that satisfies P and Q

∀x P P is satisfied by all objects

∃x P we can find an object that satisfies P

Page 17: Truth, deduction, computation   lecture b

Problems with Domain

Formula Kind How Satisfied

<atomic> find an object or objects

¬P find counterexample for P

PvQ find something that satisfies at least one of P and Q

P∧Q find something that satisfies P and Q

∀x P P is satisfied by all objects

∃x P we can find an object that satisfies P

Page 18: Truth, deduction, computation   lecture b

Problems with Domain

● ∀x (Cube(x)∨Tet(x))

- how about 27? 28?

● ∃n (n*n > n*n*n)

- how about Claire’s cat?

Page 19: Truth, deduction, computation   lecture b

Translating Aristotelian Forms

Aristotle says We write

All P’s are Q’s ∀x (P(x) → Q(x))

Some P’s are Q’s ∃x (P(x) ∧ Q(x))

No P’s are Q’s ∀x (P(x) → ¬Q(x))

Some P’s are not Q’s ∃x (P(x) ∧ ¬Q(x))

How about∃x (P(x) → Q(x))

Or, e.g., ∀y(Tet(y) → Small(y))

Page 20: Truth, deduction, computation   lecture b

Ambiguousness with Aristotelian...

∀x (P(x) → ¬Q(x))

or¬∃x (P(x) ∧ Q(x))

In Boolean logic, they are semantically equivalent

Page 21: Truth, deduction, computation   lecture b

In Plain English

Existential noun phrase - involves “∃ x…”

Universal noun phrase - involves “∀ x…”

Page 22: Truth, deduction, computation   lecture b

Reformulating Previous Exercises

● ∀x ∀y ∀z ((FatherOf(x,y)∧FatherOf(y,z)) → Nicer(x,y))● ∀x ∀y (¬Even(x+y) → Even(x*y))

Page 23: Truth, deduction, computation   lecture b

That’s it for today