ตรรกศาสตร์ (Logic) เป็นการศึกษาเกี่ยวกับเหตุผลและการตัดสินใจ หัวใจแรกคือ "ประพจน์" และการนำประพจน์มารวมกันผ่าน "ตัวเชื่อม" เพื่อสร้างเงื่อนไขใหม่ที่ซับซ้อนขึ้น

Logic is the study of reasoning. The foundation begins with "propositions" and combining them using "logical connectives" to form more complex conditions.

1

🗣️ ความหมายของประพจน์ / Meaning of Propositions

ประพจน์ (Proposition / Statement) คือ ประโยคบอกเล่า หรือ ประโยคปฏิเสธ ที่สามารถบอกได้ว่าเป็น จริง (True, T) หรือ เท็จ (False, F) อย่างใดอย่างหนึ่งเท่านั้น

ประโยคที่ไม่ใช่ประพจน์ เช่น คำถาม, คำสั่ง, ร้องขอ, อุทาน, หรือประโยคที่มีตัวแปรแต่ยังไม่ทราบค่า (ประโยคเปิด)

A proposition is a declarative sentence that is either strictly True (T) or strictly False (F), but not both.

Non-propositions include questions, commands, requests, exclamations, or sentences with unknown variables (open sentences).

เป็นประพจน์Propositions

  • กรุงเทพฯ เป็นเมืองหลวงของประเทศไทย Bangkok is the capital of Thailand.
    (จริง / T)
  • $5 \times 2 = 12$
    (เท็จ / F)
  • ดวงอาทิตย์เป็นดาวเคราะห์ The Sun is a planet.
    (เท็จ / F)
  • $1 + 1 = 2$
    (จริง / T)
  • $\sqrt{4} = 2$
    (จริง / T)
  • มนุษย์ทุกคนต้องการอาหาร Every human being needs food.
    (จริง / T)
  • จำนวนเฉพาะทุกตัวเป็นเลขคี่ Every prime number is odd.
    (เท็จ / F — เพราะ 2 เป็นเฉพาะและเป็นคู่) (F — because 2 is prime and even)

ไม่เป็นประพจน์Non-Propositions

  • กรุณาปิดประตู Please close the door.
    (คำสั่ง) (Command)
  • คุณชื่ออะไร? What is your name?
    (คำถาม) (Question)
  • $x + 5 = 10$
    (ประโยคเปิด — ยังไม่ทราบค่า $x$) (Open sentence — $x$ is unknown)
  • ว้าว สวยมาก! Wow, how beautiful!
    (อุทาน) (Exclamation)
  • ขอให้โชคดีนะ Good luck to you!
    (คำอวยพร / ร้องขอ) (Wish / Request)
  • $n$ เป็นจำนวนนับ $n$ is a natural number.
    (ประโยคเปิด — ยังไม่ทราบค่า $n$) (Open sentence — $n$ is unknown)
  • เธอสวยมาก She is very beautiful.
    (ความคิดเห็น — ตัดสินจริง/เท็จไม่ได้) (Opinion — cannot be objectively T or F)

💡 จุดสังเกตสำคัญKey Observations

  • ประโยค คำถาม, คำสั่ง, คำอ้อนวอน และ อุทาน ไม่ใช่ประพจน์ เพราะไม่สามารถบอกได้ว่าจริงหรือเท็จ
  • ประโยคเปิด ที่มีตัวแปรและยังไม่ทราบค่า เช่น $x + 3 = 7$ หรือ "$n$ เป็นเลขคู่" จะกลายเป็นประพจน์ได้ก็ต่อเมื่อแทนค่าตัวแปรลงไปแล้วเท่านั้น
  • ประโยคที่บอกความคิดเห็นส่วนตัว เช่น "เธอสวย" ก็ไม่เป็นประพจน์ เพราะขึ้นอยู่กับผู้พูด
  • Questions, commands, requests, and exclamations are not propositions because they cannot be assigned a definite truth value.
  • Open sentences with unspecified variables (e.g. $x + 3 = 7$ or "$n$ is even") become propositions only once the variable is given a specific value.
  • Subjective opinions (e.g., "She is beautiful") depend on the speaker's perspective and cannot be objectively T or F.
2

🔗 ตัวเชื่อมประพจน์ / Logical Connectives

เราสามารถสร้างประพจน์ใหม่ได้โดยการนำประพจน์ย่อยมาประกอบกันด้วย "ตัวเชื่อมประพจน์" (โดยทั่วไปให้ $p, q$ แทนประพจน์ใดๆ)

We can form new propositions by combining simple ones using "logical connectives" (typically letting $p, q$ represent any propositions).

$\land$

และ (AND)

เป็น จริง ได้กรณีเดียว คือ จริงทั้งคู่ (T $\land$ T = T)

True only if both are True.

$\lor$

หรือ (OR)

เป็น เท็จ ได้กรณีเดียว คือ เท็จทั้งคู่ (F $\lor$ F = F)

False only if both are False.

$\rightarrow$

ถ้า... แล้ว... (IF...THEN)

เป็น เท็จ ได้กรณีเดียว คือ หน้าจริง หลังเท็จ (T $\rightarrow$ F = F)

False only if True implies False.

$\leftrightarrow$

ก็ต่อเมื่อ (IF AND ONLY IF)

เหมือนกันเป็น จริง, ต่างกันเป็น เท็จ

True if they have the same value.

$\sim$

นิเสธ (NOT)

กลับค่าความจริงเป็น ตรงกันข้าม

Reverses the truth value.

3

📊 ตารางค่าความจริง / Truth Tables

ตารางค่าความจริงใช้สำหรับสรุปผลลัพธ์ที่เป็นไปได้ทั้งหมด เมื่อนำประพจน์มาเชื่อมกัน (T = True / จริง, F = False / เท็จ)

Truth tables summarize all possible outcomes when propositions are connected (T = True, F = False).

$p$ $q$ $\sim p$ $p \land q$ $p \lor q$ $p \rightarrow q$ $p \leftrightarrow q$
T T F T T T T
T F F F T F F
F T T F T T F
F F T F F T T
4

📝 ตัวอย่างการหาค่าความจริง / Evaluation Examples

กำหนดให้ประพจน์ $p, q, r, s$ มีค่าความจริงดังต่อไปนี้ จงหาค่าความจริงของประพจน์รวมแบบขั้นตอน

Given the following truth values for propositions $p, q, r, s$, evaluate the compound propositions step-by-step.

ตัวอย่างที่ 1 / Example 1

กำหนดให้ $p$ มีค่าความจริงเป็นจริง และ $q$ มีค่าความจริงเป็นเท็จ จงหาค่าของ $\sim p \lor q$
Let $p$ be True and $q$ be False. Evaluate $\sim p \lor q$
~ p q T F F F

ตัวอย่างที่ 2 / Example 2

กำหนดให้ $p$ มีค่าความจริงเป็นจริง, $q$ มีค่าความจริงเป็นเท็จ, $r$ มีค่าความจริงเป็นจริง จงหาค่าของ $(p \rightarrow q) \lor \sim r$
Let $p$ be True, $q$ be False, $r$ be True. Evaluate $(p \rightarrow q) \lor \sim r$
( p q ) ~ r T F T F F F

ตัวอย่างที่ 3 / Example 3

กำหนดให้ $p$ และ $q$ มีค่าความจริงเป็นเท็จ, $r$ และ $s$ มีค่าความจริงเป็นจริง จงหาค่าของ $(p \leftrightarrow q) \rightarrow (r \land \sim s)$
Let $p$ and $q$ be False, $r$ and $s$ be True. Evaluate $(p \leftrightarrow q) \rightarrow (r \land \sim s)$
( p q ) ( r ~ s ) F F T T T F F F

ตัวอย่าง ง / Example D

จงหาค่าความจริงของคาดการณ์: "ถ้า 2 เป็นจำนวนคู่ และ 3 เป็นจำนวนคี่ แล้ว $2+3=6$"
Evaluate the truth value of: "If 2 is even and 3 is odd, then $2+3=6$"

กำหนดให้:
$p$ แทนประโยค “2 เป็นจำนวนคู่” — มีค่าความจริงเป็นจริง
$q$ แทนประโยค “3 เป็นจำนวนคี่” — มีค่าความจริงเป็นจริง
$r$ แทนประโยค “$2+3=6$” — มีค่าความจริงเป็นเท็จ
เขียนในรูปสัญลักษณ์: $(p \land q) \rightarrow r$

Let:
$p$ represents “2 is even” — its truth value is True
$q$ represents “3 is odd” — its truth value is True
$r$ represents “$2+3=6$” — its truth value is False
Symbolic form: $(p \land q) \rightarrow r$

p q r (p ∧ q) → r
T T F F
T F T T
F T F T
F F F T

ตัวอย่างที่ 5 / Example 5 (Backward Evaluation)

กำหนดให้ประพจน์ $p \rightarrow (q \lor r)$ มีค่าความจริงเป็น เท็จ (F) จงหาค่าความจริงของ $p, q$ และ $r$
Given that $p \rightarrow (q \lor r)$ is False (F). Find the truth values of $p, q$, and $r$.
p ( q r ) F T F T F F

สรุป: เนื่องจาก $p \rightarrow (q \lor r)$ เป็นเท็จ ซึ่งนัยสำคัญจะเป็นเท็จก็ต่อเมื่อ เหตุเป็นจริงและผลเป็นเท็จ
ดังนั้น $p$ มีค่าความจริงเป็นจริง และ $q \lor r$ มีค่าความจริงเป็นเท็จ
เมื่อ $q \lor r$ เป็นเท็จ แสดงว่า $q$ และ $r$ ต่างมีค่าความจริงเป็นเท็จ ทั้งคู่

Conclusion: Since $p \rightarrow (q \lor r)$ is False, an implication is false only when the hypothesis is true and the conclusion is false.
Therefore $p$ is True and $q \lor r$ is False.
Since $q \lor r$ is False, both $q$ and $r$ must be False.

ตัวอย่างที่ 6 / Example 6

กำหนดให้ $p$ มีค่าความจริงเป็นจริง และ $q$ มีค่าความจริงเป็นจริง จงหาค่าของ $p \land \sim q$
Let $p$ be True and $q$ be True. Evaluate $p \land \sim q$
p ~ q T T F F

ตัวอย่างที่ 7 / Example 7

กำหนดให้ $p$ มีค่าความจริงเป็นเท็จ และ $q$ มีค่าความจริงเป็นเท็จ จงหาค่าของ $p \rightarrow q$
Let $p$ be False and $q$ be False. Evaluate $p \rightarrow q$
p q F F T

ตัวอย่างที่ 8 / Example 8

กำหนดให้ $p$ มีค่าความจริงเป็นจริง และ $q$ มีค่าความจริงเป็นจริง จงหาค่าของ $p \leftrightarrow \sim q$
Let $p$ be True and $q$ be True. Evaluate $p \leftrightarrow \sim q$
p ~ q T T F F

ตัวอย่างที่ 9 / Example 9

กำหนดให้ $p$ มีค่าความจริงเป็นเท็จ, $q$ มีค่าความจริงเป็นจริง จงหาค่าของ $\sim(p \lor q)$
Let $p$ be False, $q$ be True. Evaluate $\sim(p \lor q)$
~ ( p q ) F T T F

ตัวอย่างที่ 10 / Example 10 (Backward Evaluation)

กำหนดให้ $p \land q$ มีค่าความจริงเป็นจริง จงหาค่าความจริงของ $p$ และ $q$
Given that $p \land q$ is True. Find the truth values of $p$ and $q$.
p q T T T

สรุป: เนื่องจาก $p \land q$ เป็นจริง การเชื่อม AND จะให้ค่าจริงก็ต่อเมื่อ ทั้งสองประพจน์เป็นจริง
ดังนั้น $p$ มีค่าความจริงเป็นจริง และ $q$ มีค่าความจริงเป็นจริง

Conclusion: Since $p \land q$ is True, a conjunction is true only when both propositions are true.
Therefore $p$ is True and $q$ is True.

ตัวอย่างที่ 11 / Example 11 (Backward Evaluation)

กำหนดให้ $p \rightarrow q$ มีค่าความจริงเป็นเท็จ จงหาค่าความจริงของ $p$ และ $q$
Given that $p \rightarrow q$ is False. Find the truth values of $p$ and $q$.
p q F T F

สรุป: เนื่องจาก $p \rightarrow q$ เป็นเท็จ นัยสำคัญจะเป็นเท็จก็ต่อเมื่อ เหตุเป็นจริงและผลเป็นเท็จ เท่านั้น
ดังนั้น $p$ มีค่าความจริงเป็นจริง และ $q$ มีค่าความจริงเป็นเท็จ (กรณีเดียวที่เป็นไปได้)

Conclusion: Since $p \rightarrow q$ is False, an implication is false only when the hypothesis is true and the conclusion is false.
Therefore $p$ is True and $q$ is False — the only possible case.

ตัวอย่างที่ 12 / Example 12 (Backward Evaluation)

กำหนดให้ $p \leftrightarrow q$ มีค่าความจริงเป็นจริง และทราบว่า $p$ มีค่าความจริงเป็นเท็จ จงหาค่าความจริงของ $q$
Given that $p \leftrightarrow q$ is True and $p$ is False. Find the truth value of $q$.
p q T F F

สรุป: เนื่องจาก $p \leftrightarrow q$ เป็นจริง การสมมูลจะเป็นจริงก็ต่อเมื่อ ทั้งสองประพจน์มีค่าความจริงเท่ากัน
เมื่อทราบว่า $p$ มีค่าความจริงเป็นเท็จ จึงสรุปได้ว่า $q$ ต้องมีค่าความจริงเป็นเท็จ เช่นเดียวกัน

Conclusion: Since $p \leftrightarrow q$ is True, a biconditional is true only when both propositions share the same truth value.
Given $p$ is False, it follows that $q$ must also be False.

ตัวอย่างที่ 13 / Example 13 (Backward Evaluation)

กำหนดให้ $(p \land q) \rightarrow r$ มีค่าความจริงเป็นเท็จ จงหาค่าความจริงของ $p$, $q$ และ $r$
Given that $(p \land q) \rightarrow r$ is False. Find the truth values of $p$, $q$, and $r$.
( p q ) r F T F T T

สรุป: เนื่องจาก $(p \land q) \rightarrow r$ เป็นเท็จ จึงต้องมี เหตุเป็นจริงและผลเป็นเท็จ
กล่าวคือ $p \land q$ ต้องเป็นจริง ซึ่งบังคับให้ $p$ เป็นจริง และ $q$ เป็นจริง ด้วย
ส่วน $r$ ต้องมีค่าความจริงเป็นเท็จ

Conclusion: Since $(p \land q) \rightarrow r$ is False, the hypothesis must be true and the conclusion false.
So $p \land q$ must be True, forcing both $p$ and $q$ to be True.
And $r$ must be False.

ตัวอย่างที่ 14 / Example 14 (Backward Evaluation)

กำหนดให้ $p \lor (q \land r)$ มีค่าความจริงเป็นเท็จ จงหาค่าความจริงของ $p$, $q$ และ $r$
Given that $p \lor (q \land r)$ is False. Find the truth values of $p$, $q$, and $r$.
p ( q r ) F F F F F

สรุป: เนื่องจาก $p \lor (q \land r)$ เป็นเท็จ การเชื่อม OR จะให้ค่าเท็จก็ต่อเมื่อ ทั้งสองฝั่งเป็นเท็จ
ดังนั้น $p$ มีค่าความจริงเป็นเท็จ และ $q \land r$ มีค่าความจริงเป็นเท็จ
เมื่อ $q \land r$ เป็นเท็จ (กรณีที่ง่ายที่สุด) คือ $q$ เป็นเท็จ และ $r$ เป็นเท็จ

Conclusion: Since $p \lor (q \land r)$ is False, a disjunction is false only when both sides are false.
Therefore $p$ is False and $q \land r$ is False.
The simplest case: $q$ is False and $r$ is False.

ตัวอย่างที่ 15 / Example 15 (Backward Evaluation)

กำหนดให้ $(p \rightarrow q) \land (q \rightarrow r)$ มีค่าความจริงเป็นเท็จ และทราบว่า $p \rightarrow q$ มีค่าความจริงเป็นจริง จงหาค่าความจริงของ $q$ และ $r$
Given that $(p \rightarrow q) \land (q \rightarrow r)$ is False and $p \rightarrow q$ is True. Find the truth values of $q$ and $r$.
( p q ) ( q r ) F T F T F

สรุป: เนื่องจาก $(p \rightarrow q) \land (q \rightarrow r)$ เป็นเท็จ และทราบว่า $p \rightarrow q$ เป็นจริง
การเชื่อม AND จะเป็นเท็จต้องมีส่วนประกอบที่เป็นเท็จ ดังนั้น $q \rightarrow r$ ต้องเป็นเท็จ
นัยสำคัญ $q \rightarrow r$ เป็นเท็จ บังคับให้ $q$ เป็นจริง และ $r$ เป็นเท็จ

Conclusion: Since $(p \rightarrow q) \land (q \rightarrow r)$ is False and $p \rightarrow q$ is True,
the conjunction must fail on the right side, so $q \rightarrow r$ must be False.
An implication $q \rightarrow r$ is false only when $q$ is True and $r$ is False.

📊

📊 การหาค่าความจริงด้วยตาราง / Truth Table Construction

ตารางค่าความจริงเป็นเครื่องมือที่ใช้แสดงค่าความจริงของประพจน์รวม ทุกกรณีที่เป็นไปได้ หากมีตัวแปร $n$ ตัว จะมีแถวทั้งหมด $2^n$ แถว

A truth table is a tool that displays the truth value of a compound proposition for every possible case. With $n$ variables, there are $2^n$ rows.

ตัวอย่าง 1 / Example 1  —  $p \land q$

สร้างตารางค่าความจริงของ $p \land q$ (ตัวเชื่อม AND)

Construct the truth table for $p \land q$ (AND connective)

$p$ $q$ $p \land q$
T T T
T F F
F T F
F F F

💡 $p \land q$ เป็นจริงก็ต่อเมื่อ ทั้งสองประพจน์เป็นจริงพร้อมกัน เท่านั้น

💡 $p \land q$ is True only when both propositions are True simultaneously.

ตัวอย่าง 2 / Example 2  —  $p \to q$

สร้างตารางค่าความจริงของ $p \to q$ (ตัวเชื่อมนัยสำคัญ)

Construct the truth table for $p \to q$ (implication)

$p$ $q$ $p \to q$
T T T
T F F
F T T
F F T

💡 $p \to q$ เป็นเท็จได้กรณีเดียวเท่านั้น คือ เหตุจริง ($p$=T) แต่ผลเท็จ ($q$=F)

💡 $p \to q$ is False in only one case: when the hypothesis is True ($p$=T) but the conclusion is False ($q$=F).

ตัวอย่าง 3 / Example 3  —  $(p \lor q) \to \sim p$

สร้างตารางค่าความจริงของ $(p \lor q) \to \sim p$ ทีละขั้น

Build the truth table for $(p \lor q) \to \sim p$ step by step

$p$ $q$ $\sim p$ $p \lor q$ $(p \lor q) \to \sim p$
T T F T F
T F F T F
F T T T T
F F T F T

💡 วิธีเติมตาราง: สร้างคอลัมน์กลางก่อน ($\sim p$ และ $p \lor q$) จากนั้นจึงคำนวณคอลัมน์สุดท้าย

💡 Strategy: Fill intermediate columns first ($\sim p$ and $p \lor q$), then compute the final column.

ตัวอย่าง 4 / Example 4  —  $p \lor q$

สร้างตารางค่าความจริงของ $p \lor q$ (ตัวเชื่อม OR)

Construct the truth table for $p \lor q$ (OR connective)

$p$ $q$ $p \lor q$
T T T
T F T
F T T
F F F

💡 $p \lor q$ เป็นเท็จได้กรณีเดียวเท่านั้น คือ เมื่อทั้งสองเป็นเท็จพร้อมกัน

💡 $p \lor q$ is False in only one case: when both propositions are False.

ตัวอย่าง 5 / Example 5  —  $p \leftrightarrow q$

สร้างตารางค่าความจริงของ $p \leftrightarrow q$ (ตัวเชื่อม "ก็ต่อเมื่อ")

Construct the truth table for $p \leftrightarrow q$ (Biconditional)

$p$ $q$ $p \leftrightarrow q$
T T T
T F F
F T F
F F T

💡 $p \leftrightarrow q$ เป็นจริงเมื่อ ค่าความจริงเหมือนกัน (T ทั้งคู่ หรือ F ทั้งคู่)

💡 $p \leftrightarrow q$ is True when truth values are identical (both T or both F).

ตัวอย่าง 6 / Example 6  —  $\sim(p \land q) \leftrightarrow (\sim p \lor \sim q)$

ตรวจสอบความสมมูล (Tautology) ของกฎ De Morgan

Verify the equivalence (Tautology) of De Morgan's Law

$p$ $q$ $\sim(p \land q)$ $\sim p \lor \sim q$ $\sim(p \land q) \leftrightarrow (\sim p \lor \sim q)$
T T F F T
T F T T T
F T T T T
F F T T T

💡 หากผลลัพธ์เป็น T ทั้งหมด แสดงว่าเป็นประพจน์ที่เป็น สัจนิรันดร์ (Tautology)

💡 If all results are T, the compound proposition is a Tautology.

ตัวอย่าง 7 / Example 7  —  $(p \land q) \to r$

สร้างตารางสำหรับ 3 ตัวแปร (จะมีทั้งหมด $2^3 = 8$ กรณี)

Construct a table for 3 variables ($2^3 = 8$ possible cases)

$p$ $q$ $r$ $p \land q$ $(p \land q) \to r$
T T T T T
T T F T F
T F T F T
T F F F T
F T T F T
F T F F T
F F T F T
F F F F T

คำศัพท์ที่น่าสนใจ / Key Vocabulary

คำศัพท์ตรรกศาสตร์ภาษาอังกฤษ พร้อมรากศัพท์

คำศัพท์ รากศัพท์ / Root ความหมาย / Meaning
Proposition / Statement proponere (to propose) ประพจน์ · ประโยคบอกเล่าหรือปฏิเสธที่มีค่าความจริงเป็นจริงหรือเท็จอย่างใดอย่างหนึ่ง
Logical Connective connectere (to bind together) ตัวเชื่อมประพจน์ · คำที่ใช้เชื่อมประพจน์ย่อยเข้าด้วยกัน
Negation negare (to deny) นิเสธ · การเปลี่ยนค่าความจริงของประพจน์ให้เป็นตรงข้าม
Truth Value - ค่าความจริง · สถานะของประพจน์ว่าเป็นจริง (True) หรือเท็จ (False)