Nested loop

11
Nepal College of Informaiton Technology Balkumari, Lalitpur May 18, 2010 1 _ _ _ _ _ _ _ _ _ _ _ _ 2001

description

Presentation on Predicate Logic as Symbolic Logic & the Concept of Nested Loops in Predicate Logic

Transcript of Nested loop

Page 1: Nested loop

Nepal College ofInformaiton TechnologyBalkumari, Lalitpur

May 18, 2010 1

_ __ __ _

_ __ __ _

2001

Page 2: Nested loop

make statements about individual subjects predicate P(x) has two parts:

variable ‘x’ is the subject of statement propositional function P is the property that the subject

can have property of an inference

May 18, 2010 2

Page 3: Nested loop

property of description of subject in “domain or universe of discourse”

P(x) predicate

two condition: all values of ‘x’ true some values of ‘x’ true

May 18, 2010 3

‘n’ objects

‘x’ values

Page 4: Nested loop

dynamic in nature logic operator are used so called predicate logic quantifiers & variables are used & variables bound the

quantifier (universal or existential or both) i.e. symbolic logic

May 18, 2010 4

Page 5: Nested loop

P(x) : “x is man” For all values of ‘x’, if P(x) is true then x P(x) exists For some values of ‘x’, if P(x) is true then x P(x) exists

“All students in this class love discrete structure.” x love(x, discrete structure)

“All student love some subject.” x y love(x, y)

May 18, 2010 5

Page 6: Nested loop

Two quantifiers are nested if one is within the scope of

the other, such as

∀x y (x + y = 0) ∃ Everything within the scope of a quantifier can be

thought of as a propositional function. Define the

propositional functions

Q(x) : y P(x, y)∃

P(x, y) : x + y = 0

Then, we have

∀x y (x + y = 0) ≡ x y P(x, y) ≡ x Q(x) .∃ ∀ ∃ ∀

May 18, 2010 6

Page 7: Nested loop

Translation of nested quantifiers can be done by: write out what the quantifiers and predicates in the expression means convert this meaning into a simpler sentence without using any of the

variables

Statements involving nested quantifiers can be negated by applying the rules for negating statements involving a single quantifier

Table : Negating Quantifiers

May 18, 2010 7

Negation Equivalent Statement

When Is Negation True? When False?

x P(x)

x P(x)

x P(x)

x P(x)

For every x, P(x) is false.

There is an x for which P(x) is false.

There is an x for which P(x) is true.P(x) is true for every x.

Page 8: Nested loop

For example, to evaluate x y P(x, y) we loop through all the values of x, and for each x we loop through all the values of y.

Table : Quantifications of Two Variables

May 18, 2010 8

Statement When True? When False?

x y P(x, y)y x P(x, y)

P(x, y) is true for every pair x, y.

There is a pair x, y for which P(x, y) is false.

x y P(x, y) For every x there is a y for which P(x, y) is true.

There is an x such that P(x, y) is false for all y.

x y P(x, y) There is an x for which P(x, y) is true for all y.

For every x there is a y for which P(x, y) is false.

x y P(x, y)y x P(x, y)

There is a pair x, y for which P(x, y) is true.

P(x, y) is false for every pair x, y.

Page 9: Nested loop

Example: Translate the statement “The sum of two positive integers is always positive” into a logical expression.

Solution:

May 18, 2010 9

Page 10: Nested loop

K. Rosen, “Discrete Mathematical Structures with Applications to Computer Science, WCB/ Mcgraw Hill”, edition 6 2006

http://www.slideshare.net/../predicate-logic www.cs.odu.edu/~toida/nerzic/conten.. www.earlham.edu/../terms3.htm

May 18, 2010 10

Page 11: Nested loop

If you have any suggestion then let me know.

May 18, 2010 11