离散数学英文课件:DM_lecture1_3_4Predicate Logic_第1页
离散数学英文课件:DM_lecture1_3_4Predicate Logic_第2页
离散数学英文课件:DM_lecture1_3_4Predicate Logic_第3页
离散数学英文课件:DM_lecture1_3_4Predicate Logic_第4页
离散数学英文课件:DM_lecture1_3_4Predicate Logic_第5页
已阅读5页,还剩26页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、1.3 Predicate Logic,Predicate logic is an extension of propositional logic that permits concisely reasoning about whole classes of entities. Propositional logic (recall) treats component propositions (sentences) as atomic entities. In contrast, predicate logic distinguishes the subject of a sentence

2、 from its predicate. Remember these English grammar terms?,Subjects and Predicates,In the sentence “The dog is sleeping”: The phrase “the dog” denotes the subject - the object or entity that the sentence is about. The phrase “is sleeping” denotes the predicate- a property that is true of the subject

3、. In predicate logic, a predicate is modeled as a function P() from objects to propositions. P(x) = “x is sleeping” (where x is any object).,More About Predicates,Convention: Lowercase variables x, y, z. denote objects/entities; uppercase variables P, Q, R denote predicates. Keep in mind that the re

4、sult of applying a predicate P to an object x is the proposition P(x). But the predicate P itself (e.g. P=“is sleeping”) is not a proposition (not a complete sentence). E.g. if P(x) = “x is a prime number”, P(3) is the proposition “3 is a prime number.”,Applications of Predicate Logic,It is the form

5、al notation for writing perfectly clear, concise, and unambiguous mathematical definitions, axioms, and theorems for any branch of mathematics. Predicate logic with function symbols, the “=” operator, and a few proof-building rules is sufficient for defining any conceivable mathematical system, and

6、for proving anything that can be proved within that system!,Practical Applications of Predicate Logic,It is the basis for clearly expressed formal specifications for any complex system. It is the basis for automatic theorem provers and many other Artificial Intelligence systems. E.g. automatic progr

7、am verification systems. Predicate-logic like statements are supported by some of the more sophisticated database query engines and container class libraries,Universes of Discourse,The power of distinguishing objects from predicates is that it lets you state things about many objects at once. E.g.,

8、let P(x)=“x+1x”. We can then say,“For any number x, P(x) is true” instead of(0+10) (1+11) (2+12) . The collection of values that a variable x can take is called xs universe of discourse.,Binding Variables,Predicates become propositions once every variable is bounded by assigning it a value from the

9、Universe of Discourse quantifying it E.g. P(y) P(0) is not a proposition. The variable y has not been bound. However, P(3) P(0) is a proposition which is true.,Quantifier Expressions,Quantifiers provide a notation that allows us to quantify (count) how many objects in the u.d. satisfy a given predic

10、ate. “” is the FOR ALL or universal quantifier.x P(x) means for all x in the u.d., P holds. “” is the EXISTS or existential quantifier.x P(x) means there exists an x in the u.d. (that is, 1 or more) such that P(x) is true.,The Universal Quantifier ,Example: Let the u.d. of x be parking spaces at UES

11、TC. Let P(x) be the predicate “x is full.” Then the universal quantification of P(x), x P(x), is the proposition: “All parking spaces at UESTC are full.” i.e., “Every parking space at UESTC is full.”,The Existential Quantifier ,Example: Let the u.d. of x be parking spaces at UESTC Let P(x) be the pr

12、edicate “x is full.”Then the existential quantification of P(x), x P(x), is the proposition: “Some parking space at UESTC is full.” “There is at least one parking space at UESTC that is full.”,Precedence of Quantifiers, have higher precedence than all binary operators from Propositional Logic. So x

13、P(x) Q(x) (x P(x) Q(x),and is not logically equivalent to x (P(x) Q(x) x P(x) x (P(x),Negation of Quantifiers,“There is no student who can ” “Not all professors are bad.” x P(x) x P(x) why? x P(x) x P(x) Careful: The negation of “Every Canadian loves Hockey” is NOT “No Canadian loves Hockey”! Many,

14、many students make this mistake!,Free and Bound Variables,An expression like P(x) is said to have a free variable x (meaning, x is undefined). A quantifier (either or ) operates on an expression having one or more free variables, and binds one or more of those variables, to produce an expression hav

15、ing one or more bound variables.,Example of Binding,P(x,y) has 2 free variables, x and y. x P(x,y) has 1 free variable, and one bound variable. “P(x), where x=3” is another way to bind x. An expression with zero free variables is a bona-fide (actual) proposition. An expression with one or more free

16、variables is still only a predicate: e.g. let Q(y) = x P(x,y),Extra Definitions,An assertion involving predicates is valid if it is true for every universe of discourse. An assertion involving predicates is satisfiable if there is an interpretation for which the assertion is true. Else it is unsatis

17、fiable. The scope of a quantifier is the part of an assertion in which variables are bound by the quantifier. E.g. x P(x,y) Q(x),1.4 Nested Quantifiers,Example: Let the u.d. of x & y be people. Let L(x,y)=“x likes y” (a predicate w. 2 f.v.s) Then y L(x,y) = “There is someone whom x likes.” (A predic

18、ate w. 1 free variable, x) Then x (y L(x,y) = “Everyone has someone whom they like.” (A _ with _ free variables.),Proposition,0,Remember: A predicate is not a proposition until all variables have been bound either by quantification or assignment of a value!,Example of Nested Quantifiers,Example: Let

19、 U = 1,2,3. Find an expression equivalent to x y P(x, y) Expand from inside out or outside in. Outside in: yP(1, y) yP(2, y) yP(3, y) P(1,1) P(1,2) P(1,3) P(2,1) P(2,2) P(2,3) P(3,1) P(3,2) P(3,3),Nested Quantifier Exercises,x : For all x y : There exist a y If R(x,y)=“x relies upon y,” express the

20、following in unambiguous English: x(y R(x,y)= y(x R(x,y)= x(y R(x,y)= y(x R(x,y)= x(y R(x,y)=,Everyone has someone to rely on.,Theres someone whom everyone relies upon (including himself)!,Theres someone who relies upon everybody (including himself).,Everyone has someone who relies upon them.,Everyo

21、ne relies upon everybody, (including themselves)!,Nested Quantifier Exercises,x y (x + y = 0) is true over the integers Assume an arbitrary integer x. Choose y = -x. Clearly y is an integer, and thus is in the domain. So x + y = x + (-x) = x x = 0. Since we assumed nothing about x (other than it is

22、an integer), the argument holds for any integer x. Therefore, the proposition is TRUE.,More Conventions,Sometimes the universe of discourse is restricted within the quantification, e.g., x0: P(x) is shorthand for“For all x that are greater than zero, P(x).”=x (x0 P(x) x0: P(x) is shorthand for“There

23、 is an x greater than zero such that P(x).”=x (x0 P(x),Still More Conventions,Unique existential quantifier: ! !xP(x) : P(x) is true for one and only one x in the universe of discourse. E.g. U=1,2,3 P(1) P(2) P(3) !xP( x) 0 0 1 1 0 1 0 1 1 0 0 1,More to Know About Binding,x x P(x) - x is not a free

24、variable in x P(x), therefore the x binding isnt used. (x P(x) Q(x) - The variable x is outside of the scope of the x quantifier, and is therefore free. Not a complete proposition! (x P(x) (x Q(x) This is legal, because there are 2 different xs!,Quantifier Equivalence Laws,Definitions of quantifiers

25、: If u.d.=a,b,c, x P(x) P(a) P(b) P(c) x P(x) P(a) P(b) P(c) From those, we can prove the laws:x P(x) x P(x)x P(x) x P(x) Which propositional equivalence laws can be used to prove this?,DeMorgans,More Equivalence Laws,x y P(x,y) y x P(x,y)x y P(x,y) y x P(x,y) x (P(x) Q(x) (x P(x) (x Q(x)x (P(x) Q(x

26、) (x P(x) (x Q(x) Exercise: See if you can prove these yourself.,Dangerous situations,x y P(x,y) y x P(x,y) ? Caveat: In general, order matters! Consider the following propositions over the integer domain: x y (x y) and y x (x y) x y (x y) : “there is no maximum integer” y x (x y) : “there is a maxi

27、mum integer” Not the same meaning at all!,Dangerous situations,x y P(x,y) y x P(x,y) ? suppose the u.d. consists of two objects a and b. Then, x y P(x,y) ( y P(a,y) / ( y P(b,y) (P(a,a) / P(a,b) / (P(b,a) / P(b,b). y x P(x,y) ( x P(x,a) / ( x P(x,b) (P(a,a) / P(b,a) / (P(a,b) / P(b,b). suppose only

28、P(a,a) and P(b,b) are true. Then, the first proposition is true, but, the second proposition is false.,Dangerous situations,x (P(x) Q(x) (x P(x) (x Q(x) ? x (P(x) Q(x) (x P(x) (x Q(x) ? xP( x) Q( x) xP(x) xQ( x) ? x (P(x) Q(x) (x P(x) (x Q(x) ? E.g., U=1,2, P(1)=T, P(2)=F, Q(1)=F, Q(2)=T,Negation of Nested Quantifiers,E

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论