Upcoming SlideShare
×

# Nested loop

872 views
794 views

Published on

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

Published in: Education, Technology
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
872
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
16
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Nested loop

1. 1. <ul><li>Nepal College of </li></ul><ul><li>Informaiton Technology </li></ul><ul><li>Balkumari, Lalitpur </li></ul>May 18, 2010 ॐ NEPAL COLLEGE OF INFORMATION TECHNOLOGY  _ _ _ _ _ _ _ _ _ _ _ _ 2001
2. 2. <ul><li>make statements about individual subjects </li></ul><ul><li>predicate P(x) has two parts: </li></ul><ul><ul><li>variable ‘x’ is the subject of statement </li></ul></ul><ul><ul><li>propositional function P is the property that the subject can have </li></ul></ul><ul><li>property of an inference </li></ul>May 18, 2010
3. 3. <ul><li>property of description of subject in “domain or universe of discourse” </li></ul><ul><li>P(x) predicate </li></ul><ul><li>two condition: </li></ul><ul><ul><li>all values of ‘x’ true </li></ul></ul><ul><ul><li>some values of ‘x’ true </li></ul></ul>May 18, 2010 ‘ n’ objects ‘ x’ values
4. 4. <ul><li>dynamic in nature </li></ul><ul><li>logic operator are used so called predicate logic </li></ul><ul><li>quantifiers & variables are used & variables bound the quantifier (universal or existential or both) i.e. symbolic logic </li></ul>May 18, 2010
5. 5. <ul><li>P(x) : “x is man” </li></ul><ul><li>For all values of ‘x’, if P(x) is true then  x P(x) exists </li></ul><ul><li>For some values of ‘x’, if P(x) is true then  x P(x) exists </li></ul><ul><li>“ All students in this class love discrete structure.” </li></ul><ul><li> x love(x, discrete structure) </li></ul><ul><li>“ All student love some subject.” </li></ul><ul><li> x  y love(x, y) </li></ul>May 18, 2010
6. 6. <ul><li>Two quantifiers are nested if one is within the scope of </li></ul><ul><li>the other, such as </li></ul><ul><li>∀ x ∃y (x + y = 0) </li></ul><ul><li>Everything within the scope of a quantifier can be </li></ul><ul><li>thought of as a propositional function. Define the </li></ul><ul><li>propositional functions </li></ul><ul><li>Q(x) : ∃y P(x, y) </li></ul><ul><li>P(x, y) : x + y = 0 </li></ul><ul><li>Then, we have </li></ul><ul><li>∀ x ∃y (x + y = 0) ≡ ∀x ∃y P(x, y) ≡ ∀x Q(x) . </li></ul>May 18, 2010
7. 7. <ul><li>Translation of nested quantifiers can be done by: </li></ul><ul><li>write out what the quantifiers and predicates in the expression means </li></ul><ul><li>convert this meaning into a simpler sentence without using any of the variables </li></ul><ul><li>Statements involving nested quantifiers can be negated by applying the rules for negating statements involving a single quantifier </li></ul><ul><li>Table : Negating Quantifiers </li></ul>May 18, 2010 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 .
8. 8. <ul><li>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. </li></ul><ul><li>Table : Quantifications of Two Variables </li></ul>May 18, 2010 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.
9. 9. <ul><li>Example: Translate the statement “The sum of two positive integers is always positive” into a logical expression. </li></ul><ul><li>Solution: </li></ul>May 18, 2010
10. 10. <ul><li>K. Rosen, “ Discrete Mathematical Structures with Applications to Computer Science, WCB/ Mcgraw Hill ”, edition 6 2006 </li></ul><ul><li>http://www.slideshare.net/../predicate-logic </li></ul><ul><li>www.cs.odu.edu/~toida/nerzic/conten .. </li></ul><ul><li>www.earlham.edu/../terms3.htm </li></ul>May 18, 2010
11. 11. <ul><li>If you have any suggestion then let me know. </li></ul>May 18, 2010