Truth, deduction, computation lecture b
-
Upload
vlad-patryshev -
Category
Education
-
view
382 -
download
1
description
Transcript of Truth, deduction, computation lecture b
Truth, Deduction, ComputationLecture B
Quantifiers, part 1Vlad PatryshevSCU2013
Folding ∨ and ∧
● P1∨P
2∨...∨P
n - associativity! ∨
1..nPi
● P1∧P
2∧...∧P
n - associativity! ∧
1..nPi
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;}
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)}
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
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
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)
In Logic, take 3
● Can we always enumerate arguments?● e.g. all real numbers from [0,1]
We Need Variables!
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)
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
Variables in the Exercises
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)
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)
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*/>
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)
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
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
Problems with Domain
● ∀x (Cube(x)∨Tet(x))
- how about 27? 28?
● ∃n (n*n > n*n*n)
- how about Claire’s cat?
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))
Ambiguousness with Aristotelian...
∀x (P(x) → ¬Q(x))
or¬∃x (P(x) ∧ Q(x))
In Boolean logic, they are semantically equivalent
In Plain English
Existential noun phrase - involves “∃ x…”
Universal noun phrase - involves “∀ x…”
Reformulating Previous Exercises
● ∀x ∀y ∀z ((FatherOf(x,y)∧FatherOf(y,z)) → Nicer(x,y))● ∀x ∀y (¬Even(x+y) → Even(x*y))
That’s it for today