TH

ตรรกศาสตร์ (Logic) เป็นวิชาที่ว่าด้วยกฎเกณฑ์และเหตุผล การทำความเข้าใจ "ประพจน์" และ "ตัวเชื่อม" เป็นรากฐานสำคัญในการพิสูจน์ทฤษฎีบททางคณิตศาสตร์ และเป็นพื้นฐานที่สำคัญยิ่งในการเขียนโปรแกรมคอมพิวเตอร์และการออกแบบวงจรดิจิทัล

EN

Logic is the formal study of reasoning and rules. Understanding "propositions" and "logical connectives" is the foundation for proving mathematical theorems, and is heavily utilized in computer programming and digital circuit design.

1

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

TH

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

  • เป็นประพจน์: "1 + 1 = 2" (เป็นจริง), "พระอาทิตย์ขึ้นทางทิศตะวันตก" (เป็นเท็จ)
  • ไม่เป็นประพจน์: คำถาม, คำสั่ง, ขอร้อง, อ้อนวอน, ประโยคเปิดที่มีตัวแปร (เช่น "$x > 5$")
EN

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

  • Is a proposition: "1 + 1 = 2" (True), "The sun rises in the west" (False).
  • Not a proposition: Questions, commands, requests, open sentences with variables (e.g., "$x > 5$").
Example 1.1

ข้อความ: "ประเทศไทยมี 77 จังหวัด"

คำตอบ: เป็นประพจน์ เพราะเป็นประโยคบอกเล่าและสามารถบอกได้ว่ามีค่าความจริงเป็น จริง (True)

Statement: "Thailand has 77 provinces."

Answer: Is a proposition because it is a declarative sentence with a truth value of True.

Example 1.2

ข้อความ: "$1 + 1 = 3$"

คำตอบ: เป็นประพจน์ เพราะเป็นประโยคบอกเล่าและสามารถบอกได้ว่ามีค่าความจริงเป็น เท็จ (False)

Statement: "$1 + 1 = 3$"

Answer: Is a proposition because it has a definitive truth value of False.

Example 1.3

ข้อความ: "วันนี้คุณกินข้าวหรือยัง?"

คำตอบ: ไม่เป็นประพจน์ เพราะเป็นประโยคคำถาม ไม่สามารถบอกค่าความจริงว่าเป็นจริงหรือเท็จได้

Statement: "Have you eaten today?"

Answer: Not a proposition because it is a question and has no truth value.

Example 1.4

ข้อความ: "ห้ามเดินลัดสนาม"

คำตอบ: ไม่เป็นประพจน์ เพราะเป็นประโยคคำสั่ง ไม่มีค่าความจริง

Statement: "Do not walk on the grass."

Answer: Not a proposition because it is a command.

Example 1.5

ข้อความ: "$x + 5 = 10$"

คำตอบ: ไม่เป็นประพจน์ เรียกว่า "ประโยคเปิด" เพราะไม่ทราบค่า $x$ จึงสรุปไม่ได้ว่าเป็นจริงหรือเท็จ

Statement: "$x + 5 = 10$"

Answer: Not a proposition because it is an "open sentence". Its truth value depends on $x$.

Example 1.6

ข้อความ: "ว้าว! ทะเลสวยจังเลย"

คำตอบ: ไม่เป็นประพจน์ เพราะเป็นประโยคที่แสดงอารมณ์/คำอุทาน ไม่ใช่ข้อเท็จจริง

Statement: "Wow! The sea is so beautiful."

Answer: Not a proposition because it is an exclamation showing emotion.

Example 1.7

ข้อความ: "$5 < 2$"

คำตอบ: เป็นประพจน์ เพราะสามารถตัดสินได้อย่างชัดเจนว่ามีค่าความจริงเป็น เท็จ (False)

Statement: "$5 < 2$"

Answer: Is a proposition because it can be definitively evaluated as False.

Example 1.8

ข้อความ: "กรุณาถอดรองเท้าก่อนเข้าห้อง"

คำตอบ: ไม่เป็นประพจน์ เพราะเป็นประโยคขอร้อง ไม่มีค่าความจริง

Statement: "Please take off your shoes before entering."

Answer: Not a proposition because it is a request.

Example 1.9

ข้อความ: "เดือนธันวาคมไม่ได้มี 31 วัน"

คำตอบ: เป็นประพจน์ ถึงแม้จะเป็นประโยคปฏิเสธ แต่สามารถบอกได้ว่ามีค่าความจริงเป็น เท็จ (False)

Statement: "December does not have 31 days."

Answer: Is a proposition. Even though it is a negative statement, it has a clear truth value of False.

Example 1.10

ข้อความ: "วิชาคณิตศาสตร์ง่ายที่สุด"

คำตอบ: ไม่เป็นประพจน์ เพราะเป็นความคิดเห็น (Opinion) ค่าความจริงขึ้นอยู่กับแต่ละบุคคล ไม่สามารถระบุชัดเจนตามหลักตรรกศาสตร์ได้

Statement: "Math is the easiest subject."

Answer: Not a proposition because it is a subjective opinion.

2

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

TH

ในตรรกศาสตร์ เรานิยมใช้อักษรภาษาอังกฤษตัวพิมพ์เล็ก เช่น $p, q, r, s$ แทนประพจน์ และใช้เครื่องหมายทางคณิตศาสตร์แทนคำเชื่อม เพื่อสร้าง ประพจน์เชิงประกอบ (Compound Propositions) ตัวเชื่อมหลักมี 5 ชนิด ได้แก่:

สัญลักษณ์ (Symbol) คำอ่านไทย ความหมาย
$\land$ และ เป็นจริงเมื่อ ทั้งคู่เป็นจริง นอกนั้นเท็จ
$\lor$ หรือ เป็นเท็จเมื่อ ทั้งคู่เป็นเท็จ นอกนั้นจริง
$\rightarrow$ ถ้า...แล้ว เป็นเท็จกรณีเดียวคือ หน้าจริง หลังเท็จ ($\text{T} \rightarrow \text{F}$)
$\leftrightarrow$ ก็ต่อเมื่อ เป็นจริงเมื่อ ค่าความจริงเหมือนกัน
$\sim$ นิเสธ / ไม่ เปลี่ยนค่าความจริงให้ ตรงข้าม
EN

In logic, we use lowercase letters like $p, q, r, s$ to represent propositions, and mathematical symbols to represent connectives, forming Compound Propositions. The 5 main connectives are:

Symbol Read As Meaning
$\land$ AND True only when both are true, otherwise false
$\lor$ OR False only when both are false, otherwise true
$\rightarrow$ IF...THEN False only when premise is true, conclusion is false ($\text{T} \rightarrow \text{F}$)
$\leftrightarrow$ IF AND ONLY IF True when truth values are identical
$\sim$ NOT Flips the truth value to its opposite
3

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

TH

ตารางสรุปค่าความจริงของตัวเชื่อมประพจน์ทั้งหมด (ให้สังเกตจุดเด่นที่ทำให้เกิดค่า $\text{T}$ หรือ $\text{F}$ ตามที่เน้นสีไว้ ซึ่งเป็นหลักการจำที่สำคัญที่สุด)

EN

Summary truth tables for all connectives. Pay attention to the highlighted unique cases for each operator—these are the key principles to memorize.

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

การหาค่าความจริง Evaluation

TH

ในการหาค่าความจริงของประพจน์ประกอบ เราจำเป็นต้องทราบ ค่าความจริงของประพจน์ย่อย แต่ละตัวก่อน จากนั้นจึงค่อยๆ แก้ค่าความจริงออกมาทีละขั้น ลองมาดูตัวอย่างการกำหนดค่าความจริงและการใช้แผนภาพต้นไม้ (Tree Diagram) ในการแก้ปัญหาต่อไปนี้

EN

To evaluate a compound proposition, we first need to know the truth values of its sub-propositions, then solve step-by-step. Let's look at examples of assigning truth values and using tree diagrams to solve the problems below.

Example 4.1

โจทย์: กำหนดให้ $p$ เป็นจริง (T) และ $r$ เป็นเท็จ (F) จงหาค่าความจริงของ $p \land r$

Problem: Given $p$ is True (T) and $r$ is False (F), evaluate $p \land r$

p r T F F
Example 4.2

โจทย์: กำหนดให้ $q$ เป็นจริง (T) และ $r$ เป็นเท็จ (F) จงหาค่าความจริงของ $r \lor q$

Problem: Given $q$ is True (T) and $r$ is False (F), evaluate $r \lor q$

r q F T T
Example 4.3

โจทย์: กำหนดให้ $p$ เป็นจริง (T) และ $r$ เป็นเท็จ (F) จงหาค่าความจริงของ $\sim p \rightarrow r$

Problem: Given $p$ is True (T) and $r$ is False (F), evaluate $\sim p \rightarrow r$

~ p r T F F T
Example 4.4

โจทย์: กำหนดให้ $p, q$ เป็นจริง (T) จงหาค่าความจริงของ $p \leftrightarrow q$

Problem: Given $p, q$ are True (T), evaluate $p \leftrightarrow q$

p q T T T
Example 4.5

โจทย์: กำหนดให้ $p$ เป็นจริง (T) และ $r, s$ เป็นเท็จ (F) จงหาค่าความจริงของ $p \lor (r \land s)$

Problem: Given $p$ is True (T), and $r, s$ are False (F), evaluate $p \lor (r \land s)$

p ( r s ) T F F F T
Example 4.6

โจทย์: กำหนดให้ $p$ เป็นจริง (T) และ $r$ เป็นเท็จ (F) จงหาค่าความจริงของ $(p \rightarrow r) \rightarrow p$

Problem: Given $p$ is True (T) and $r$ is False (F), evaluate $(p \rightarrow r) \rightarrow p$

( p r ) p T F T F T
Example 4.7

โจทย์: กำหนดให้ $p$ เป็นจริง (T) และ $r, s$ เป็นเท็จ (F) จงหาค่าความจริงของ $\sim(p \lor r) \leftrightarrow s$

Problem: Given $p$ is True (T), and $r, s$ are False (F), evaluate $\sim(p \lor r) \leftrightarrow s$

~ ( p r ) s T F F T F T
Example 4.8

โจทย์: กำหนดให้ $p, q$ เป็นจริง (T) และ $r, s$ เป็นเท็จ (F) จงหาค่าความจริงของ $(p \land q) \rightarrow (r \lor s)$

Problem: Given $p, q$ are True (T), and $r, s$ are False (F), evaluate $(p \land q) \rightarrow (r \lor s)$

( p q ) ( r s ) T T F F T F F
Example 4.9

โจทย์: กำหนดให้ $p, q$ เป็นจริง (T) และ $r$ เป็นเท็จ (F) จงหาค่าความจริงของ $(p \leftrightarrow \sim r) \land \sim q$

Problem: Given $p, q$ are True (T), and $r$ is False (F), evaluate $(p \leftrightarrow \sim r) \land \sim q$

( p ~ r ) ~ q T F T T F T F
Example 4.10

โจทย์: กำหนดให้ $p, q$ เป็นจริง (T) และ $r, s$ เป็นเท็จ (F) จงหาค่าความจริงของ $(r \land p) \rightarrow (\sim q \lor s)$

*ทริค: หากพจน์หน้าของ "ถ้า...แล้ว" เป็นเท็จ สรุปได้ทันทีว่าประพจน์รวมเป็น จริง เสมอ โดยไม่ต้องคำนวณพจน์หลังเลย

Problem: Given $p, q$ are True (T), and $r, s$ are False (F), evaluate $(r \land p) \rightarrow (\sim q \lor s)$

*Trick: In an IF-THEN statement, if the premise is False, the result is automatically True regardless of the conclusion.

( r p ) ( ~ q s ) F T F ? (Skip) T

🔍 ภาค 2: การหาค่าย้อนกลับ / Part 2: Reverse Evaluation

การหาค่าย้อนกลับ คือกระบวนการที่เราทราบ "ผลลัพธ์สุดท้าย" ของประพจน์เชิงประกอบแล้ว และเราต้องทำการวิเคราะห์ย้อนกลับโดยการแตกแขนงจากตัวเชื่อมหลักลงมายังตัวแปรย่อย เพื่อหาว่า $p, q, r, \dots$ แต่ละตัวมีค่าความจริงเป็นอะไร (ดังตัวอย่าง 10 ข้อด้านล่างนี้)

Reverse evaluation is the process where we know the "final result" of a compound proposition, and we must branch backward from the main connective to determine the truth values of the sub-propositions $p, q, r, \dots$ (as shown in the 10 examples below).

Example 4.11

โจทย์: กำหนดให้ประพจน์ $p \rightarrow q$ มีค่าความจริงเป็น เท็จ (F) จงหาค่าความจริงของ $p$ และ $q$

Problem: Given that $p \rightarrow q$ is False (F), find the truth values of $p$ and $q$.

p q F T F
Example 4.12

โจทย์: กำหนดให้ประพจน์ $p \lor q$ มีค่าความจริงเป็น เท็จ (F) จงหาค่าความจริงของ $p$ และ $q$

Problem: Given that $p \lor q$ is False (F), find the truth values of $p$ and $q$.

p q F F F
Example 4.13

โจทย์: กำหนดให้ประพจน์ $p \land q$ มีค่าความจริงเป็น จริง (T) จงหาค่าความจริงของ $p$ และ $q$

Problem: Given that $p \land q$ is True (T), find the truth values of $p$ and $q$.

p q T T T
Example 4.14

โจทย์: กำหนดให้ประพจน์ $\sim p \rightarrow q$ มีค่าความจริงเป็น เท็จ (F) จงหาค่าความจริงของ $p$ และ $q$

Problem: Given that $\sim p \rightarrow q$ is False (F), find the truth values of $p$ and $q$.

~ p q F T F F
Example 4.15

โจทย์: กำหนดให้ประพจน์ $p \rightarrow (q \lor r)$ มีค่าความจริงเป็น เท็จ (F) จงหาค่าความจริงของ $p, q$ และ $r$

Problem: Given that $p \rightarrow (q \lor r)$ is False (F), find the truth values of $p, q$, and $r$.

p ( q r ) F F T F F
Example 4.16

โจทย์: กำหนดให้ประพจน์ $(p \land q) \rightarrow r$ มีค่าความจริงเป็น เท็จ (F) จงหาค่าความจริงของ $p, q$ และ $r$

Problem: Given that $(p \land q) \rightarrow r$ is False (F), find the truth values of $p, q$, and $r$.

( p q ) r F T T T F
Example 4.17

โจทย์: กำหนดให้ประพจน์ $(p \rightarrow q) \lor r$ มีค่าความจริงเป็น เท็จ (F) จงหาค่าความจริงของ $p, q$ และ $r$

Problem: Given that $(p \rightarrow q) \lor r$ is False (F), find the truth values of $p, q$, and $r$.

( p q ) r F F T F F
Example 4.18

โจทย์: กำหนดให้ประพจน์ $\sim(p \rightarrow q)$ มีค่าความจริงเป็น จริง (T) จงหาค่าความจริงของ $p$ และ $q$

Problem: Given that $\sim(p \rightarrow q)$ is True (T), find the truth values of $p$ and $q$.

~ ( p q ) T F T F
Example 4.19

โจทย์: กำหนดให้ประพจน์ $p \rightarrow (q \rightarrow r)$ มีค่าความจริงเป็น เท็จ (F) จงหาค่าความจริงของ $p, q$ และ $r$

Problem: Given that $p \rightarrow (q \rightarrow r)$ is False (F), find the truth values of $p, q$, and $r$.

p ( q r ) F F T T F
Example 4.20

โจทย์: กำหนดให้ $(p \land \sim q) \rightarrow (r \lor s)$ มีค่าความจริงเป็น เท็จ (F) จงหาค่าความจริงของ $p, q, r, s$

Problem: Given that $(p \land \sim q) \rightarrow (r \lor s)$ is False (F), find the truth values of $p, q, r, s$.

( p ~ q ) ( r s ) F T F T T F F F
5

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

TH

กรณีที่เราไม่ทราบค่าความจริงของประพจน์ย่อย เราต้องพิจารณาทุกกรณีที่เป็นไปได้ โดยใช้สูตร $2^n$ กรณี (เมื่อ $n$ คือจำนวนประพจน์ย่อย) ต่อไปนี้คือตัวอย่างการสร้างตาราง 10 รูปแบบที่พบบ่อย

EN

When the truth values of sub-propositions are unknown, we must consider all possible cases using the formula $2^n$ cases (where $n$ is the number of variables). Here are 10 common table construction examples.

Example 5.1
โจทย์: จงสร้างตารางค่าความจริงของรูปแบบประพจน์ $\sim p \lor q$
Problem: Construct a truth table for the proposition $\sim p \lor q$
$p$ $q$ $\sim p$ $\sim p \lor q$
T T F T
T F F F
F T T T
F F T T
Example 5.2
โจทย์: จงสร้างตารางค่าความจริงของรูปแบบประพจน์ $\sim(p \land q)$
Problem: Construct a truth table for the proposition $\sim(p \land q)$
$p$ $q$ $p \land q$ $\sim(p \land q)$
T T T F
T F F T
F T F T
F F F T
Example 5.3
โจทย์: จงสร้างตารางค่าความจริงของรูปแบบประพจน์ $p \rightarrow \sim q$
Problem: Construct a truth table for the proposition $p \rightarrow \sim q$
$p$ $q$ $\sim q$ $p \rightarrow \sim q$
T T F F
T F T T
F T F T
F F T T
Example 5.4
โจทย์: จงสร้างตารางค่าความจริงของรูปแบบประพจน์ $(p \land q) \rightarrow p$
Problem: Construct a truth table for the proposition $(p \land q) \rightarrow p$
$p$ $q$ $p \land q$ $(p \land q) \rightarrow p$
T T T T
T F F T
F T F T
F F F T
Example 5.5
โจทย์: จงสร้างตารางค่าความจริงของรูปแบบประพจน์ $p \land \sim p$
Problem: Construct a truth table for the proposition $p \land \sim p$
$p$ $\sim p$ $p \land \sim p$
T F F
F T F
Example 5.6
โจทย์: จงสร้างตารางค่าความจริงของรูปแบบประพจน์ $p \leftrightarrow \sim p$
Problem: Construct a truth table for the proposition $p \leftrightarrow \sim p$
$p$ $\sim p$ $p \leftrightarrow \sim p$
T F F
F T F
Example 5.7
โจทย์: จงสร้างตารางค่าความจริงเพื่อเปรียบเทียบรูปแบบประพจน์ $p \rightarrow q$ และ $\sim q \rightarrow \sim p$
Problem: Construct a truth table to compare the propositions $p \rightarrow q$ and $\sim q \rightarrow \sim p$.
$p$ $q$ $p \rightarrow q$ $\sim q \rightarrow \sim p$
T T T T
T F F F
F T T T
F F T T
Example 5.8
โจทย์: จงสร้างตารางค่าความจริงเพื่อเปรียบเทียบรูปแบบประพจน์ $\sim(p \lor q)$ และ $\sim p \land \sim q$
Problem: Construct a truth table to compare the propositions $\sim(p \lor q)$ and $\sim p \land \sim q$.
$p$ $q$ $\sim(p \lor q)$ $\sim p \land \sim q$
T T F F
T F F F
F T F F
F F T T
Example 5.9
โจทย์: จงสร้างตารางค่าความจริงของรูปแบบประพจน์ $p \rightarrow (p \lor q)$
Problem: Construct a truth table for the proposition $p \rightarrow (p \lor q)$
$p$ $q$ $p \lor q$ $p \rightarrow (p \lor q)$
T T T T
T F T T
F T T T
F F F T
Example 5.10
โจทย์: จงสร้างตารางค่าความจริงแบบ 3 ตัวแปร สำหรับ $(p \lor q) \land r$
Problem: Construct a 3-variable truth table for $(p \lor q) \land r$.
$p$ $q$ $r$ $p \lor q$ $(p \lor q) \land r$
T T T T T
T T F T F
T F T T T
T F F T F
F T T T T
F T F T F
F F T F F
F F F F F

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

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

คำศัพท์ รากศัพท์ / Root ความหมาย / Meaning
Proposition pro- (forth) + ponere (to place) ประพจน์ · ประโยคที่บอกค่าความจริงเป็นจริงหรือเท็จได้อย่างใดอย่างหนึ่ง
Connective con- (together) + nectere (to bind) ตัวเชื่อม · สัญลักษณ์ที่ใช้เชื่อมประพจน์เข้าด้วยกัน เช่น และ, หรือ
Conjunction con- (together) + jungere (to join) การเชื่อมด้วย "และ" ($\land$) · จะเป็นจริงเมื่อประพจน์ย่อยเป็นจริงทั้งคู่
Disjunction dis- (apart) + jungere (to join) การเชื่อมด้วย "หรือ" ($\lor$) · จะเป็นเท็จเมื่อประพจน์ย่อยเป็นเท็จทั้งคู่
Tautology tauto- (same) + -logy (study/saying) สัจนิรันดร์ · รูปแบบของประพจน์ที่มีค่าความจริงเป็น "จริง" เสมอในทุกกรณี
Contradiction contra- (against) + dicere (to speak) ข้อขัดแย้ง · รูปแบบของประพจน์ที่มีค่าความจริงเป็น "เท็จ" เสมอในทุกกรณี