論理と真理値表の基本
informationdiscrete-mathundergraduatelecture
1導入
この講義では、命題から複合命題を構成する論理結合子を定義し、真理値表によって論理式の性質を判定する方法を説明する。特に、含意の方向と必要条件・十分条件の対応を明確にする。
2命題と真理値
命題 とは、真または偽のいずれかに確定する平叙文である。命題が真であることを \mathrm{T}、偽であることを \mathrm{F} と表記し、この \mathrm{T} または \mathrm{F} を真理値という。疑問文や、変数の値を指定しなければ真偽が確定しない文は、そのままでは命題ではない。
3論理結合子
P,Q を命題とする。
- 否定 \neg P は、P と反対の真理値をもつ。
- 論理積 P\land Q は、P,Q がともに真であるとき、かつそのときに限り真である。
- 論理和 P\lor Q は、P,Q の少なくとも一方が真であるとき、かつそのときに限り真である。したがって、ここでの「または」は両方が真である場合も含む。
- 含意 P\to Q は、P が真で Q が偽である場合に限り偽である。P を前件、Q を後件という。
- 同値 P\leftrightarrow Q は、P,Q の真理値が一致するとき、かつそのときに限り真である。
4真理値表
真理値表 とは、構成要素となる命題の真理値のすべての組合わせについて、論理式の真理値を列挙した表である。二つの命題からなる基本的な論理式は、次の表で定義される。
\begin{array}{c|c|c|c|c|c}
P&Q&P\land Q&P\lor Q&P\to Q&P\leftrightarrow Q\\
\hline
\mathrm{T}&\mathrm{T}&\mathrm{T}&\mathrm{T}&\mathrm{T}&\mathrm{T}\\
\mathrm{T}&\mathrm{F}&\mathrm{F}&\mathrm{T}&\mathrm{F}&\mathrm{F}\\
\mathrm{F}&\mathrm{T}&\mathrm{F}&\mathrm{T}&\mathrm{T}&\mathrm{F}\\
\mathrm{F}&\mathrm{F}&\mathrm{F}&\mathrm{F}&\mathrm{T}&\mathrm{T}
\end{array}\begin{array}{c|c|c|c|c|c}
P&Q&P\land Q&P\lor Q&P\to Q&P\leftrightarrow Q\\
\hline
\mathrm{T}&\mathrm{T}&\mathrm{T}&\mathrm{T}&\mathrm{T}&\mathrm{T}\\
\mathrm{T}&\mathrm{F}&\mathrm{F}&\mathrm{T}&\mathrm{F}&\mathrm{F}\\
\mathrm{F}&\mathrm{T}&\mathrm{F}&\mathrm{T}&\mathrm{T}&\mathrm{F}\\
\mathrm{F}&\mathrm{F}&\mathrm{F}&\mathrm{F}&\mathrm{T}&\mathrm{T}
\end{array}
P\to Q について、前件 P が偽である二つの行では含意は真である。これは、P\to Q が因果関係を主張する表現ではなく、「P が真なのに Q が偽となる反例は存在しない」という条件だからである。
5恒真式・矛盾式・論理同値
恒真式 とは、構成要素の真理値にかかわらず常に真となる論理式である。矛盾式 とは、常に偽となる論理式である。たとえば、P\lor\neg P は恒真式であり、P\land\neg P は矛盾式である。
二つの論理式 A,B が、すべての真理値の割当てにおいて同一の真理値をもつとき、A と B は論理同値であるといい、A\equiv B と表記する。これは、A\leftrightarrow B が恒真式であることと同値である。例として、含意は
P\to Q\equiv \neg P\lor Q
と変形できる。
6含意の方向と必要十分条件
P\to Q において、P は Q の十分条件であり、Q は P の必要条件である。すなわち、P の成立は Q の成立を保証し、P が成立するためには Q が必要である。
Q\to P は P\to Q の逆であり、一般には元の含意から導出できない。これに対し、\neg Q\to\neg P は対偶であり、
P\to Q\equiv \neg Q\to\neg P
が成立する。変数を含む条件 P(x),Q(x) について、考察対象のすべての x で P(x)\to Q(x) と Q(x)\to P(x) が成立するとき、P(x)\leftrightarrow Q(x) が恒真となり、P(x) は Q(x) の必要十分条件である。単一の真理値割当で二つの含意がともに真であることだけでは、この関係は導出できない。
7例
整数 n に対し、P(n) を「n は 4 の倍数である」、Q(n) を「n は偶数である」とする。P(n),Q(n) は n を指定するまで命題ではなく、整数を真理値へ対応させる述語である。すべての整数 n について P(n)\to Q(n) が成立するため、「4 の倍数であること」は「偶数であること」の十分条件である。一方、Q(2) は真で P(2) は偽であるため、n=2 は Q(n)\to P(n) の反例である。
8要点
- 論理結合子の意味は、自然言語の印象ではなく真理値表によって確定する。
- 恒真式と矛盾式は、それぞれすべての行が真または偽となる論理式である。
- 論理同値は、すべての真理値の割当てにおける一致を意味する。
- P\to Q では P が十分条件、Q が必要条件であり、逆と対偶を混同してはならない。
9関連リンク
data/lecture/information/discrete-math/introduction-to-discrete-mathematics.lecture.n.md
data/lecture/information/discrete-math/sets-and-maps-basics.lecture.n.md
Logic and Truth Tables: Fundamentals
1Introduction
This lecture defines the logical connectives used to construct compound propositions and explains how truth tables determine properties of logical formulas. In particular, it clarifies the direction of implication and the roles of necessary and sufficient conditions.
2Propositions and Truth Values
A {proposition} is a declarative sentence that has exactly one of the two truth values: true or false. We write \mathrm{T} when a proposition is true and \mathrm{F} when it is false. A question, or a sentence whose truth cannot be determined until a variable is specified, is not itself a proposition.
3Logical Connectives
Let P and Q be propositions.
- The {negation} \neg P has the truth value opposite to that of P.
- The {conjunction} P\land Q is true if and only if both P and Q are true.
- The {disjunction} P\lor Q is true if and only if at least one of P and Q is true. Thus, this inclusive “or” includes the case in which both propositions are true.
- The {implication} P\to Q is false if and only if P is true and Q is false. We call P the antecedent and Q the consequent.
- The {biconditional} P\leftrightarrow Q is true if and only if P and Q have the same truth value.
4Truth Tables
A {truth table} lists the truth value of a logical formula for every assignment of truth values to its component propositions. The basic formulas involving two propositions are defined by the following table.
\begin{array}{c|c|c|c|c|c}
P&Q&P\land Q&P\lor Q&P\to Q&P\leftrightarrow Q\\
\hline
\mathrm{T}&\mathrm{T}&\mathrm{T}&\mathrm{T}&\mathrm{T}&\mathrm{T}\\
\mathrm{T}&\mathrm{F}&\mathrm{F}&\mathrm{T}&\mathrm{F}&\mathrm{F}\\
\mathrm{F}&\mathrm{T}&\mathrm{F}&\mathrm{T}&\mathrm{T}&\mathrm{F}\\
\mathrm{F}&\mathrm{F}&\mathrm{F}&\mathrm{F}&\mathrm{T}&\mathrm{T}
\end{array}\begin{array}{c|c|c|c|c|c}
P&Q&P\land Q&P\lor Q&P\to Q&P\leftrightarrow Q\\
\hline
\mathrm{T}&\mathrm{T}&\mathrm{T}&\mathrm{T}&\mathrm{T}&\mathrm{T}\\
\mathrm{T}&\mathrm{F}&\mathrm{F}&\mathrm{T}&\mathrm{F}&\mathrm{F}\\
\mathrm{F}&\mathrm{T}&\mathrm{F}&\mathrm{T}&\mathrm{T}&\mathrm{F}\\
\mathrm{F}&\mathrm{F}&\mathrm{F}&\mathrm{F}&\mathrm{T}&\mathrm{T}
\end{array}
For P\to Q, the implication is true in both rows in which the antecedent P is false. This convention reflects that P\to Q is not an assertion of causation; instead, it states that there is no counterexample in which P is true while Q is false.
5Tautologies, Contradictions, and Logical Equivalence
A {tautology} is a formula that is true under every assignment of truth values. A {contradiction} is a formula that is false under every assignment. For example, P\lor\neg P is a tautology, whereas P\land\neg P is a contradiction.
Two formulas A and B are {logically equivalent}, written A\equiv B, if they have the same truth value under every assignment. Equivalently, A\leftrightarrow B is a tautology. For example, implication satisfies
P\to Q\equiv \neg P\lor Q.
6Direction of Implication and Necessary and Sufficient Conditions
In P\to Q, P is a {sufficient condition} for Q, and Q is a {necessary condition} for P. That is, the truth of P guarantees the truth of Q, and Q must be true whenever P is true.
The statement Q\to P is the {converse} of P\to Q and, in general, does not follow from the original implication. In contrast, \neg Q\to\neg P is its {contrapositive}, and
P\to Q\equiv \neg Q\to\neg P.
For conditions P(x) and Q(x) containing a variable, if both P(x)\to Q(x) and Q(x)\to P(x) hold for every object x under consideration, then P(x)\leftrightarrow Q(x) is a tautology, and P(x) is a {necessary and sufficient condition} for Q(x). The fact that both implications are true under one particular truth-value assignment does not establish this relationship.
7Example
For an integer n, let P(n) mean “n is divisible by 4,” and let Q(n) mean “n is even.” Until n is specified, P(n) and Q(n) are not propositions; they are {predicates} that assign truth values to integers. The implication P(n)\to Q(n) holds for every integer n, so divisibility by 4 is sufficient for being even. In contrast, Q(2) is true and P(2) is false, so n=2 is a counterexample to Q(n)\to P(n).
8Key Points
- The meanings of logical connectives are determined by truth tables, not by informal impressions of natural-language expressions.
- A tautology is true in every row of its truth table, whereas a contradiction is false in every row.
- Logical equivalence means agreement under every assignment of truth values.
- In P\to Q, P is sufficient and Q is necessary; the converse must not be confused with the contrapositive.
9Related Links
data/lecture/information/discrete-math/introduction-to-discrete-mathematics.lecture.n.md
data/lecture/information/discrete-math/sets-and-maps-basics.lecture.n.md