Conyac で依頼された翻訳結果を公開

[英語から日本語への翻訳依頼] ド・モルガンの法則による論理表現の反転 Javaスクリプトの表現は、適切な方法で書かれた場合には、より直感的な(そして理解しやすい)ものとなる。しか...

翻訳依頼文
Inverting Logical Expressions with De Morgan's Laws

A Javascript expression will sometimes be more intuitive (and easier to understand) when written a certain way - but we may actually need the inverse of the expression. For example in listing 1 our code only needs to react if (x && y) is false. We need to invert the expression.
De Morgan's laws describe how to invert a logical expression. In listing 2 let's look at De Morgan's Laws in Javascript syntax.

The rule is to invert each logical term and invert each logical operator.

In listing 3 we invert the expression from listing 1 by applying De Morgan's Laws.
Sometimes a logical term is more complex than a simple boolean variable. A logical term may be a relational expression such as (p < q) from listing 4. We must invert the relational expression as a whole.
Let's invert the expression step by step.

Note that this expression is of the same form as our original expression in listing 1 (x && y) where x is replaced with (p < q) and y is replaced with (r != s). De Morgan's rule is to invert each logical term and invert each logical operator.
Inverting the first logical term (p < q) we get (p >= q)
Inverting the next logical term (r != s) we get (r == s)
Inverting the logical operator && we get ||
Our result is in lst5.
So if you find yourself struggling with a Javascript problem, pick up an old math textbook - your solution is probably in there.

ysasaki さんによる翻訳
ド・モルガンの法則による論理表現の反転

Javaスクリプトの表現は、適切な方法で書かれた場合には、より直感的な(そして理解しやすい)ものとなる。しかし、表現の反転が必要となる場合もあるかもしれない。例えば、リスト1において、我々のコードは、(x && y)が偽の場合にのみ反応を要する。表現の反転が必要である。
ド・モルガンの法則は、論理表現を反転する方法について述べている。リスト2において、そのJavaスクリプト構文を見てみよう。

そのルールは、それぞれの論理記号とオペレータを反転させる、というものである。

リスト3で、ド・モルガンの法則を用いて、リスト1から反転を行っている。
時には、論理記号は、単純なプール変数よりも複雑になることがある。
論理項は、リスト4の(p < q)のように、関係を表現するものである場合がある。これについては、その全体を反転する必要がある。この表現を、ステップを追って反転してみよう。

この表現は、リスト1の元の表現である(x && y)において、xを(p < q)に、yを(r != s)にそれぞれ置き換えたものと同じであることに着目しよう。ド・モルガンの法則は、それぞれの論理項と演算子を反転することであった。
第1項の(p < q) の反転により、(p >= q)を得る。
次の項の(r != s)の反転により、(r == s)を得る。
演算子の&&の反転により、||を得る。
その結果が、リスト5である。
以上より、もしJavaスクリプトの問題に直面したら、昔の数学の教科書を持ってこよう。答えは恐らくそこにあるだろう。

Conyac で翻訳した結果

依頼文字数
1402文字
翻訳言語
英語 → 日本語
金額 (スタンダード依頼の場合)
3,154.5円
翻訳時間
約1時間
フリーランサー
ysasaki ysasaki
Starter