Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 10 CS 1813 – Discrete Mathematics Quantify What? Reasoning with Predicates.

Similar presentations


Presentation on theme: "CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 10 CS 1813 – Discrete Mathematics Quantify What? Reasoning with Predicates."— Presentation transcript:

1 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 10 CS 1813 – Discrete Mathematics Quantify What? Reasoning with Predicates

2 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 2 More Examples with Forall  — the Universal Quantifier  L — predicate about qsort  L(n)  length(qsort[a 1, a 2, …, a n ] ) = n  Universe of discourse: U = N = {0, 1, 2, … }   n.L(n) — Do you expect  n.L(n) to be True?  I — another predicate about qsort  I(n, k)  (qsort[a 1, a 2, …, a n ] = [b 1, b 2, …, b n ] )  (b k  b k+1 )  Universe of discourse: U = {(n, k)  N  N | 0  k  n}   (n, k).I(n, k) A predicate calculus formula because each I(n, k) is a proposition (a non-atomic one in this case) Do you expect  (n, k).I(n, k) to be True? Alternative formulation:  n  1.  0  k  n. I(n, k) –I(n, k) is a proposition –So,  0  k  n. I(n, k) is a WFF in predicate calculus –So,  n  1.  0  k  n. I(n, k) is a WFF in predicate calc

3 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 3 Still More Examples with Forall  — the Universal Quantifier  Predicates about (++)  C(n, m)  length( [a 1, a 2, …, a n ] ++ [b 1, b 2, …, b m ] ) = n + m Universe of discourse –U = N  N = {(0,0), (1,0), (0,1), (2,0), …}  (n, k).C(n, k) –Do you expect  (n, k).C(n, k) to be True? A more common way to express this idea –Universe of discourse: U = N –  n.  k. C(n, k) –Nested formula, same universe of discourse on each level  A(xs, ys, zs)  xs ++ (ys ++ zs) = (xs ++ ys) ++ zs Universe of discourse: U = {xs | xs :: [a] }, a  Haskell types  xs.  ys.  zs. A(xs, ys, zs) –Note three levels of nesting –Do you expect this formula to be True?

4 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 4  —the Existential Quantifier, There Exists   x.P(x)  This formula is a WFF of predicate calculus whenever P(x) is a WFF of predicate calculus  True if there is at least one x in the universe of discourse for which the proposition P(x) is True  False if  x.  P(x) is True  Equivalent to forming the Logical Or of all P(x)’s  Example – E predicate about maximum  E(n, k)  maximum[s 1, s 2, …, s n ] = s k   k.E(23, k) Universe of discourse: U = {1, 2, …, 23}  k.E(23, k) means E(23,1)  E(23,2)  …  E(23,23) Do you think  k.E(23, k) is True? Note: When U is finite, quantifiers not required –Clumsy to write big formulas without quantifiers, though –Without quantifiers, reasoning can be more complex, too

5 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 5 Another Example with There Exists  — the Existential Quantifier  R —predicate about qsort  R(n, j, k)  (qsort[a 1, a 2, …, a n ] = [b 1, b 2, …, b n ] )  (a j = b k )  Universe of discourse Triples of non-zero natural numbers where no number in the triple exceeds the first number in the triple U = {(n, j, k)  N  N  N | 0  k  n, 0  j  n}   k.R(1009, 503, k) Universe of discourse: U = {1, 2, 3, …, 1009} Do you expect  k.R(1009, 503, k) to be True?  Forall and There Exists, in combination  n  0.  0  j  n.  0  k  n. R(n, j, k) Universe of discourse: U = N = {0, 1, 2, … } Must use nesting in this case (because of mixture of  and  ) The universe of discourse is actually different for n than for j and k in this formula, but the constraints spell this out

6 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 6 Free Variables and Bound Variables  Variables in WFFs of predicate calculus  Denoted by lower-case letters  Examples of predicate calculus WFFs with variables F(p, q)  G(q, r)variables: p, q, r (  x.F(x))  (G(y)  H(y))variables: x, y (  x.F(x, y)  G(y))  (H(z)  K(x))variables: x, y, z  Free variables and bound variables  Let e stand for a WFF of predicate calculus  Bound variable  x. ex is bound in the formula  x. e  x. ex is bound in the formula  x. e  Free variables are variables that are not bound Which variables are free?

7 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 7 Arbitrary Variables  A variable is arbitrary in a proof if it does not occur free in any undischarged assumption of that proof  Examples  x. F(x)  {  E} F(x) G(x, y)  {  I}  y. G(x, y) x arbitrary? P(x)  Q  {  E L } P(x)  {  I} P(x)  Q  P(x)  {  I}  x. P(x)  Q  P(x) x arbitrary? discharged Yes No Yes

8 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 8 Inference Rules of Predicate Calculus...plus the inference rules of propositional calculus Which rules trigger discharges?  x. F(x) {universe is not empty}  {  E} F(x) F(x) {x arbitrary}  {  I}  x. F(x)  x. F(x) F(x) |– A {x not free in A}  {  E} A F(x)  {  I}  x. F(x)  x. F(x) {y not in F(x)}  {  R}  y. F(y)  x. F(x) {y not in F(x)}  {  R}  y. F(y) Renaming Variables Introducing/Eliminating Quantifiers F(x) {x, y arbitrary, y not in F(x)}  {R} F(y)

9 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 9  {  E}  y.F(x,y)  x.  y.F(x,y) An Easy Proof, Just to Warm Up using {  I} and {  E} Theorem (  commutes)  x.  y. F(x,y) |–  y.  x. F(x,y) proof  {  E} F(x,y) {note: x arbitrary}  {  I}  x. F(x,y) {note: y arbitrary}  {  I}  y.  x. F(x,y)  x.F(x)  {  E} F(x) plays role of F(x) in {  E} rule F(x) {x arb}  {  I}  x.F(x)

10 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 10  x. F(x) F(x) |– A {x not free in A}  {  E} A  x. P(x)  Q(x)  {  E} P(x)  Q(x) Existential Elimination something like {  E} Theorem 31  x. P(x),  x. P(x)  Q(x) |–  x. Q(x) proof  {  E} Q(x)  {  E}  x. Q(x) {x not free in  x.Q(x)}  x. P(x) discharge  P(x)  x. Q(x)  x  U. Q(x)plays role of A in {  E} rule P plays role of F in {  E} rule {  I}

11 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 11 Bad Theorem  x. P(x),  x. P(x)  Q(x) |–  x. Q(x) An Incorrect Proof So, {  I} rule is not properly cited. F(x) {x arbitrary}  {  I}  x. F(x) y is free in this assumption Problem is here  {  I}  x. Q(x)  x. P(x)  Q(x)  {  E} P(x)  Q(x)  {  E} Q(x)  {  E}  x. Q(x)  x. P(x) P(x) Purported proof

12 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 12  y. F(x, y)  {  E} F(x, y) Existential Qualifier Can Move In but it can’t move out — like a roach motel Theorem 32  x.  y.F(x, y) |–  y.  x. F(x, y)  {  I}  x. F(x, y)  {  E}  y.  x.F(x, y)  x.  y.F(x, y)  {  I}  y.  x. F(x, y) {y arb} F(y) {y arbitrary}  {  I}  y. F(y)  x. F(x) F(x) |– A {x not free in A}  {  E} A  y. F(y)  {  E} F(y) F(x)  {  I}  x. F(x) F( , y)  x.F(x,  )  y.F( , y) F(x,  )

13 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 13 End of Lecture


Download ppt "CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 10 CS 1813 – Discrete Mathematics Quantify What? Reasoning with Predicates."

Similar presentations


Ads by Google