=============================================================== Lect 5 - October 8, 2008 - ECS 20 - Fall 2008 - Phil Rogaway =============================================================== Today: o Quantification logic o Sets Announcements: no quiz (I like to defy expectations) ------------------------------------------- 1. Adding quantifiers -- First order logic ------------------------------------------- 0. Lewis Carol: All lions are fierce (\forall x) (L(x) -> F(x)) Some lions do not drink coffee (\exists x) (L(x) and \neg C(x)) Some fierce creatures do not drink coffee (\exists x) (F(x) and \neg C(x)) 1. "Nobody likes a sore loser" universe of discourse = human beings (is this really unambiguous?) L(x,y) - predicate - true iff person x likes y (is this really unambiguous?) S(x) - person x is a sore loser (\forall x) (S(x) -> (\forall y) \neg L(y,x) (apparently, a sore loser doesn't like even himself) 2. "If anyone in the dorm has a friend who has the measles, then EVERYONE in the dorm will have to be quarantined." universe of discourse - people D(x) - person x lives in some (unspecified but understood) dorm Q(x) - person x must be quarantines F(x,y) - person x is friends with person y M(x) - person x has the measles (oh no!) not forall (exists x) (D(x) and (exists y)(F(x,y) and F(y))) -> (forall x)(D(x) -> Q(x)) *Universe of discourse* = what quantifiers range over 3. T/F: universe of discourse : **Natural numbers 8* (forall x)(exists y) (x (\exists x) (\neg \phi) \neg(\exists x \phi) <==> (\forall x) (\neg \phi) negate this: (\exists x)(all y) (y>x -> exists z (z^2 + 5z = y)) soln" \neg (\exists x)(\forall y) (y>x -> exists z (z^2 + 5z = y)) (\forall x) \neg (\forall y) (y>x -> exists z (z^2 + 5z = y)) (\forall x) (\exists y) \neg (y>x -> exists z (z^2 + 5z = y)) \neg(A -> B) <=> \neg (\neg A or B) <=>h (A and \neg B) Example: negligible functions Say it in English. Then write it formally. Then invert. f: N -> r is NEGLIGIBLE if (\forall c>0) (\exists N) (\forall n>=N) f(n) <= n^-c "eventually, you're less than n^-c for ANY c" So what would it mean to say that f is NOT negligible? "there is a c s.t., infinitely often, you're bigger than n^-c" Even grad students and researchers get confused about this! \neg (\forall c>0) (\exists N) (\forall n>=N) f(n) <= n^-c = (\exists c>0) \neg (\exists N) (\forall n>=N) f(n) <= n^-c = (\exists c>0) (\forall N) \neg (\forall n>=N) f(n) <= n^-c = (\exists c>0) (\forall N) (\exists n>=N) \neg f(n) <= n^-c = (\exists c>0) (\forall N) (\exists n>=N) f(n) > n^-c you are i.o. bigger than n^-c ------------------------------------ 3. Definitional Sketch of the SYNTAX ------------------------------------ Below, not a formal treatment, but a formal treatment can be found in any standard logic book, eg., Enderton. In general: vocabulary consists of: LOGICAL SYMBOLS 1. Parenthesis (, ) 2. Sentential connectives \neg, -> , v, \land, <-> 3. Variables v_1, v_2, ... (name points in the universe) 4. Equality symbol: = (usually) PARAMETERS: 1. \forall, \exists 2. predicate symbols // return true of false -- functions from the universe U to {0,1} 3. constant symbols // each names a point in the universe U 4. function symbols // maps a tuple of points in the universe U to a point in the universe U --------------------- 4. Important Examples --------------------- // note for next time: invert order: number theory then set theory 1. EXAMPLE: Set Theory predicate symbols: 2-ary \in function symbol: \emptyset Note "syntactic sugar" -- write a \in A instead of \in(a,A). But that doesn't change that \in is a 2-ary predicate. "For any pair of sets, x and y, there an a set x u y that contains all of the elements of x and y" (\forall x)(\forall y)(\exists z) (\all u) (u\in z <-> (u\in x) v (u \in y)) Seems very spare, just \in. What are other operators on sets, and how would we define them? A \subseteq B: (another 2-ary predicate) a \not\in A = \neg (a \in A) A \subseteq B = (if x\in A -> x\in B) A \supseteq B = (if x\in B -> x\in A) 2. EXAMPLE: Number Theory 1. constant symbol: 0 2. predicate symbol: < 3. function symbol: succ (1-ary) + (2-wary) * (2-ary) E (2-ary) "Any number other than 0 is the successor of some number" (forall x) (\neg(x=0) -> (\exists y) (succ(y)=x)) // A note for next time: add some more interesting examples. // Student question: how to treat subtraction: add something on this. --------------------- 5. Sets --------------------- S = {dog, cat} S = \emptyset \N = {1,2,3,...} // some books include 0, some don't \R = {x: x is a real number} \Z = {...,-2,-1,0,1,2,...} \Q = { m/n: m,n\in Z, n\ne 0} What set is this? A = {2i+1: i \in Z} Sets can be named in many ways. Other ways to name A: = {...,-5,-3,-1,1,3,5,...} = {x: x is an odd integer} = {n: n\in\Z and \neg(\exists j\in\Z)(2j=n)} Def: S = T iff x\in S <-> x\in T |S| = the number of element in S if S is finite, \infinity otherwise A= {{a},b,\emptyset}. |A| = 3 A = {emptyset, {emptyset}, {{emptyset}}} |A|3. Def: S\subseteq T if x\in S -> x\in T {a,b} \subseteq {a,b,c} YES {a,b} \subseteq {a,b} YES {a,b} \subseteq {a,d,e} NO \emptyset \subseteq {a,b,c} YES (explain) {emptyset} \subseteq {a,b,c} NO {emptyset} \subseteq {{emptyset}} YES T/F: for all S, \emptyset \subeteq S: True UNION A \cup B = {x: x\in A or x\in B} // not really very rigorous: {x : blah} before the colon, the universe should be clear, with what comes after a narrowing of that. Velleman doesn't seem to stick to this, but that's what I learned! S = Everything *** NO -- invalid ** {a,b} \cup {\emptyset,a} = {a,b,\emptyset} A cup \emptyset = A \cup_{i\in I} A_i eg, \cup{i\in\N} {2i-1} = the set of odd positive number \cup_{a\in N} {a^i: i\in N} 1 1 1 1 2 2^2 2^3 2^4 ... 3 3^2 3^3 .. "powers of integers" {a^i: a,i\in N} INTERSECTION {1,2,3} \cap {2,5,8} = {2} {1,2,3} \cap {4,5,8} = \emptyset {1,2,3} \cap \emptyset = \emptyset T/F S \cap \emptyset = \emptyset True