我在应用De Morgan法则时遇到问题...反馈吗? [英] I'm having issues with applying De Morgan's Law ... Feedback?

查看:79
本文介绍了我在应用De Morgan法则时遇到问题...反馈吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次在作业中出现以下问题之一时,我都会弄错了……有人可以帮助我理解吗?还是老师的钥匙没了?(我没有办法知道答案,因为我没有得到正确的答案,只会让我知道我的错.)

Every time one of these questions comes up in my assignments I get it wrong...can anyone help me understand? Or is the teacher's key off? (There is no way for me to know as I'm not given the correct answer, it only lets me know that mine is wrong.)

假设 x = 7 y = 5 .应用德摩根定律,选择下面与以下逻辑表达式等效的逻辑表达式:!(x> 5)||!(y> 7)

Assume x = 7 and y = 5. Applying De Morgan's Law, select the logical expression below that is equivalent to the following logical expression: !(x>5)||!(y>7)

(a) !(x> 5)&&!(y> 7)

(b) !((x> 5)||(y> 7))

(c) !(x> 5)&&(y> 7)

(d) (x> 5)||!(y> 7)

(e)以上都不是

我会选择B作为答案,但是由于到目前为止我都把它们弄错了,我担心如果没有帮助的话,我会继续.

I would select B as the answer, but since I have gotten them all wrong so far I'm afraid to continue without some help.

据我所知,您可以将两个合并为一个,方法是将其放在整个语句的前面,并进行以下更改:

The way I understand this it that you can consolidate the two ! into one by putting it in front of the whole statement, changing:

!(a)||!(b)

!(((a)||(b))

推荐答案

根据维基百科,de Morgan的定律(对我来说,这只是我所知道的一件事)是

According to Wikipedia, de Morgan's Law (which to me was just a thing I knew) is

不是(P AND Q)=(不是P)或(不是Q)

NOT (P AND Q) = (NOT P) OR (NOT Q)

在您的问题中,P映射到(x> 5),而Q映射到(y> 7).因此!(((x> 5)&&(y> 7))是您的答案.但是您的清单中没有这样的人.(如果这是您的真正问题,您的老师会很草率,因为只有一个建议的答案带有双括号,这是一个很大的提示-您可以排除b,因为它仍然使用||,而排除其他人缺少双整数方括号,直接指向e.)

In your question, P maps to (x>5) and Q maps to (y>7). Therefore !((x>5)&&(y>7)) is your answer. But you don't have such a one in your list. (Your teacher is sloppy if this is your real question, since only one proposed answer has double round brackets, which is a huge clue - you can rule out b because it still uses || and rule out the others for a lack of double round brackets, going straight to e.)

如果您真的不能让这些事情停滞不前,请使用问题提供的示例值.(如有必要,请补足.)对于x = 7, x> 5 是正确的.对于y = 5, y> 7 为false.所以你有!true ||!false ,即 false ||true ,即 true .评估每个可能的表达式,并排除那些不能得出相同答案的表达式.如果仍然迷路,请选择其他样本值并重复.可能的答案之一将保持匹配,否则将不会匹配,因此您将选择以上都不是".即使您真的不明白为什么,也会为您赢得分数.

If you really can't make these things stand still for you, use the sample values the question provides. (If neccessary, make some up.) x>5 is true for x=7. y>7 is false for y=5. so you have !true || !false, which is false || true, which is true. Evaluate each of the possible expressions and rule out the ones that don't come out to the same answer. If you're still lost, pick different sample values and repeat. One of the possible answers will keep matching, or none will so you'll go with "none of the above." That will earn you the mark even if you don't really understand why.

为什么,这是由于&& || 的相反行为.从&& 获得真实的唯一方法是两面都为true.从 || 中获得错误的唯一方法是在两边都包含false.如果使用翻转参数,则可以翻转运算符并获得相反的结果.

As for why, it's because of the opposite behaviour of && and ||. The only way you get a true from && is with true on both sides. The only way you get a false from || is with false on both sides. If you flip the parameters with !, you can flip the operator and get the opposite result.

这篇关于我在应用De Morgan法则时遇到问题...反馈吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆