1-3章在学习Propositional logic条件逻辑,现在开始学习predicate logic谓语逻辑
1.Predicate
A Predicate is a proposition whose truth depends on the value of a variable(s).
2.Quantifiers 量词
量词取反:都是 - 不都是(不是“都不是”),存在 - 不存在
2.1 Negating Quantified Expressions
2.2 Translating
1.所有人中是学生的都会数学 2.所有人都是学生且会数学。然而并不是所有人都是学生,如果条件真这样说那确实可以这样用
3.存在一个人既是学生又会数学。4.如果有人是学生则会数学。然而将其等价为另一个转述,有人不会数学则这个人不是学生,就能找到反例了,在正面表述是允许有人不是学生但是会数学的
If S(x) represents the statement that person x is in this class C(x), which is the statement “x has studied calculus
∀x(S(x) → C(x) ) For every person x, if person x is a student in this class then x has studied calculus.
[Caution! Our statement cannot be expressed as ∀x(S(x)∧ C(x)) because this statement says that all people are students in this class and have studied calculus!]
if S(x)to represent “x is a student in this class. M(x), which is the statement “x has visited Mexico.C(x)be “x has visited Canada
∃x(S(x)∧ M(x)) there is a person x who is a student in this class and who has visited Mexico
[Caution! Our statement cannot be expressed as ∃x(S(x) → M(x)), which is true when there is someone not in the class because, in that case, for such a person x, S(x) → M(x)becomes either F → T or F →F,bothof which are true.]
3.“For every x in this class, x has the property that x has visited Mexico or x has visited Canada.”
if the domain for x consists of the students inthis class, this second statementcanbeexpressedas∀x(C(x)∨ M(x)). However, if the domain for x consists of all people, our statement can be expressed as “For every person x,if x is a student in this class, then x has visited Mexico or x has visited Canada.” In this case, the statement can be expressed as ∀x(S(x) → (C(x) ∨ M(x)))
3.引入额外变量支持复杂逻辑
1.There is exactly one person whom everybody loves.
首先将口语化表述转化为逻辑清晰的同义句:当不同的所有人中,都喜欢至少一个人时,而这些至少的一个人是同一个人。这个逻辑明显需要用implies
∃x(∀yL(y, x) ∧∀z((∀wL(w,z)) → z = x))
2.There are exactly two people whom Lynn loves.林恩爱的人只有两个。
lynn喜欢A且lynn喜欢Blynn喜欢C,C=A / B,因为他不能同时爱两个人,所以引入中间变量让A/B选择其一,这个思想类似将A的变量赋值给B变量
∃x∃y(x = y ∧ L(Lynn,x)∧L(Lynn,y)∧ ∀z(L(Lynn,z)→ (z = x∨z=y)))
4.错题集
- Everyone loves himself or herself. ∀xL(x,x) 和下面形成对比,由于没有额外的意思,可跳过赋值步骤
There is someone who loves no one besides himself or herself. ∃x∀y (L(x,y) ↔ x = y)
很容易写成∃x(L(x,x)),但是这样没有体现loves no one besides,要强调的是无论y取何值都等于x
-
∃x(S(x) ∧ ∀y(F(y) 不要写成∃x∀y(S(x) ∧F(y))
3. Nested Quantifiers
1.Order matter
the order of the quantifiers is important, unless all the quantifiers are universal quantifiers or all are existential quantifiers.
eg1:The state ments ∃y∀xP(x,y) and∀x∃yP(x,y)arenot logically equivalent.
eg2:
∀x∀y∃zQ(x,y,z)
“For all real numbers x and for all real numbers y there is a real number z such that x +y =z,”
∃z∀x∀yQ(x,y,z)
“There is a real number z such that for all real numbers x and for all real numbers y it is true that x + y = z,”
2. Translating Mathematical Statements into Statements Involving Nested Quantifiers
“Every real number except zero has a multiplicative inverse.”
For every real number x, ifx= 0, then there exists a real number y such that xy = 1.
∀x((x= 0) →∃y(xy = 1))
3.Translating from Nested Quantifiers into English
∃x∀y∀z((F(x,y) ∧ F(x,z)∧ (y= z)) →¬F(y,z))
where F(a,b)means a and b are friends and the domain for x, y, and z consists of all students in your school.
there is a student x such that for all students y and all students z other than y,ifx and y are friends and x and z are friends, then y and z are not friends.
there is a student none of whose friends are also friends with each other
4.Translating English Sentences into Logical Expressions
5.错题集
1.出现each otther,错误:M(x,y),正确:M(x,y)∧ M(y,x)
2.Every student in the class has either received an e mail message or received a telephone call from an other student in the class.
容易犯的错误是没有将全称量词和存在量词分开,因为这决定了括号中用^还是->
错误:∀x∃y(x = y ∧ (M(y, x) ∨ T(y, x))) 正确:∀x(∃y(x = y ∧ (M(y, x) ∨ T(y, x))))
3.将范围分开写
There are two different students in your class who between themhavesentane-mailmessagetoortele phoned everyone else in the class.
n)∃x∃y(x= y ∧ ∀z((z= x ∧ z=y) → (M(x,z) ∨ M(y,z)∨ T(x,z)∨ T(y,z))))
4.处理含exactly的题目
Every user has access to exactly one mailbox.
∀u∃m(A(u,m) ∧∀n(n= m →¬A(u,n))) 首先正常描述存在一个,再描述其他的均不存在
There are exactly two systems that monitor every re mote server.
∃x∃y(x ≠ y ∧ ∀z((∀s M(z,s)) ↔ (z = x ∨ z = y)))
个人觉得按照上面的思路也可写为∃x∃y(x ≠ y ∧∀z∀O((M(x,z)->M(y,z)
5.因果顺序
All users on the campus network can access all web sites whose url has a .edu extension.
whose url has a .edu extension.是因所以需要写在implies的左侧 ∀u∀s(E(s,.edu) → A(u, s))
嵌套量词 Nested quatifiers
There is a person besides David Belcher who has visited all the websites that David Belcher
has visited. 前面两个都是条件,后面才是结论,条件之间用^
There are two different people who have visited exactly the same websites.
对于c:注意不是被动语态,被动语态要看谓语,谓语只要和predicate内主被动一致就不用交换次序。这个只用交换量词顺序 ∃y∀xL(x, y) 被动语态
对于d:因为不存在Nobody对应的量词,所以将没有一个人喜欢所有人翻译为,所有人都不喜欢某些人 ∀x∃y¬L(x, y) 翻译为容易表达的逻辑
对于g:将”大家都喜欢有且只有一个人“变为”大家都喜欢一个人a,大家也都喜欢也都喜欢一个人b,a等于b“ ∃x(∀yL(y, x) ∧∀z((∀wL(w,z)) → z = x))
对于h:同理,∃x∃y(x ≠ y ∧ L(Lynn,x)∧L(Lynn,y)∧ ∀z(L(Lynn,z)→ (z = x∨z=y))) 利用中间变量转化为数学语言
对于i: ∀xL(x,x) 自指
对于j:∃x∀y (L(x,y) ↔ x = y)