Lecture 5 Predicate Logic Spring 2013 1 Announcements Reading assignments Predicates and Quantifiers 14 15 7 th Edition 13 14 6 th Edition Hand in Homework 1 now Homework 2 is available on the website ID: 728477
Download Presentation The PPT/PDF document "CSE 311 Foundations of Computing I" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
CSE 311 Foundations of Computing I
Lecture 5Predicate LogicSpring 2013
1Slide2
Announcements
Reading assignmentsPredicates and Quantifiers1.4, 1.5 7th Edition1.3, 1.4 6th Edition
Hand in Homework 1 now
Homework 2 is available on the website
2Slide3
Highlights from Last Lecture
Sum-of-products canonical formAlso known as Disjunctive Normal Form (DNF)Also known as minterm
expansion
A B C F F’
0 0 0 0 1
0 0 1 1 0
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 0
F =
F’ = A’B’C’ + A’BC’ + AB’C’
F = 001 011 101 110 111
+ A’BC
+ AB’C
+ ABC’
+ ABC
A’B’C
3Slide4
Highlights from Last Lecture
Product-of-sums canonical formAlso known as Conjunctive Normal Form (CNF)Also known as maxterm expansion
A B C F F’
0 0 0 0 1
0 0 1 1 0
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 0
F =
000 010 100
F =
F’ = (A + B + C’) (A + B’ + C’) (A’ + B + C’) (A’ + B’ + C) (A’ + B’ + C’)
(A + B + C)
(A + B’ + C)
(A’ + B + C)
4Slide5
Highlights from Last Lecture
S-o-P, P-o-S, and de Morgan’s theoremComplement of function in sum-of-products form
F’ = A’B’C’ + A’BC’ + AB’C’
Complement again and apply de Morgan’s and
get the product-of-sums form
(F’)’ = (A’B’C’ + A’BC’ + AB’C’)’
F = (A + B + C) (A + B’ + C) (A’ + B + C)
Complement of function in product-of-sums form
F’ = (A + B + C’) (A + B’ + C’) (A’ + B + C’) (A’ + B’ + C) (A’ + B’ + C’)
Complement again and apply de Morgan’s and
get the sum-of-product form
(F’)’ = ( (A + B + C’)(A + B’ + C’)(A’ + B + C’)(A’ + B’ + C)(A’ + B’ + C’) )’F = A’B’C + A’BC + AB’C + ABC’ + ABC5Slide6
Predicate
or Propositional FunctionA function that returns a truth value“x is a cat”“x is prime”“student x has taken course
y
”
“x > y”“x
+
y
=
z
” or Sum(x, y, z)
NOTE: We will only use predicates with variables or constants as arguments.
6Predicate LogicPrime(65353)Slide7
Quantifiers
x P(x) : P(x) is true for every x in the domain
x P(x) : There is an x in the domain for which
P(x)
is true
Relate
and
to and 7Slide8
Statements with quantifiers
x Even(x)
x Odd(x)
x
(Even(
x) Odd(x
)) x (Even(x) Odd(x)) x Greater(x+1, x) x (Even(x) Prime(x))Even(x)Odd(
x)Prime(x)Greater(x
,y)Equal(x,y
)Domain:Positive Integers8Slide9
Statements with quantifiers
x y Greater (
y
,
x)
x
y Greater (x, y)
x y (Greater(y, x) Prime(y)) x (Prime(x) (Equal(x, 2) Odd(x)) x y(Sum(x, 2, y) Prime(x) Prime(y))
Even(x)Odd(
x)Prime(x)Greater(x
,y)Equal(x,y)Sum(
x,y,z)
Domain:Positive Integers
9Slide10
Statements with quantifiers
“There is an odd prime”“If x is greater than two, x is not an even prime”x
y
z ((Sum(x, y, z)
Odd(
x
)
Odd(y)) Even(
z))“There exists an odd integer that is the sum of two primes”Even(x)Odd(x)Prime(x)Greater(x,y)Sum(x,y,z)
Domain:Positive Integers10Slide11
Cat(
x)Red(
x
)
LikesTofu(
x
)
English to Predicate Calculus
“Red cats like tofu”
11Slide12
Domain:
Positive IntegersGoldbach’s Conjecture
Every even integer greater than two can be expressed as the sum of two primes
Even(
x
)
Odd(
x
)
Prime(
x
)Greater(x,y)Equal(x,y)
x
yz ((Greater(x, 2) Even(x))
(Equal(x, y+z) Prime(y) Prime(z))12Slide13
Scope of Quantifiers
Notlargest(x) y
Greater (
y
, x)
z
Greater (z
, x)Value doesn’t depend on y or z “bound variables”Value does depend on x “free variable”Quantifiers only act on free variables of the formula they quantify x ( y (P(x,y) x Q(y, x)))13Slide14
Scope of Quantifiers
x (P(x)
Q(
x)) vs
x
P(
x
)
x Q(x)14Slide15
Nested Quantifiers
Bound variable name doesn’t matter x y P(x, y)
a b P(a, b)Positions of quantifiers can change
x (Q(x)
y P(x, y))
x y (Q(x) P(x, y))BUT: Order is important...15Slide16
Quantification with two variables
ExpressionWhen true
When false
x
y P(x, y)
x
y P(x, y)
x y P(x, y) y x P(x, y)16Slide17
Negations of Quantifiers
Not every positive integer is primeSome positive integer is not primePrime numbers do not exist
Every positive integer is not prime
17Slide18
De Morgan’s Laws for Quantifiers
18
x P(x)
x
P(x)
x P(x) x P(x) Slide19
De Morgan’s Laws for Quantifiers
19
x
y ( x ≥ y)
x
y ( x ≥ y)
x y ( x ≥ y) x y (y > x)
“There is no largest integer”
“For every integer there is a larger integer”
x P(x)
x
P(x)
x P(x)
x P(x)