Theory
वो lift जो चलने से इनकार कर देती है
एक lift तभी चलेगी (output 1) जब ये rule पूरा हो: दरवाजा बंद है (A) AND किसी ने floor का button दबाया है (B).
दरवाजा खुला है, button दबा हुआ है? रुकी रहेगी। दरवाजा बंद है, button नहीं दबाया? रुकी रहेगी। दरवाजा बंद और button दबा हुआ? अब चलेगी।
यही rule, जिसमें inputs अंदर जाते हैं और एक 0/1 का decision बाहर आता है, वही तो है एक Boolean function, और हर digital device इन्हीं हजारों functions का एक bundle है।
Theory
एक decision box
एक sealed box की कल्पना कीजिए जिसमें n input wires हैं और बिलकुल एक output wire, और हर wire पर या तो 0 है या 1. आप कोई भी input pattern डालिए, box जवाब देगा 0 या 1, और एक ही pattern के लिए हर बार वही जवाब देगा। इस box की पूरी personality बस उसकी answer list है, और वो list finite होती है: 2ⁿ rows.
Theory
Definition
n variables का एक Boolean function {0,1}ⁿ के हर combination को {0,1} में से किसी एक value पर map करता है।
2 inputs → 2² = 4 combinations. 3 inputs → 2³ = 8. हर combination को exactly एक output मिलता है, इसलिए पूरा function एक ऐसी table में समा जाता है जिसमें 2ⁿ rows होती हैं।
अपनी lift देखिए: f(A, B) = A·B. 4 rows, और output 1 इनमें से exactly एक row में।
Theory
Expression → truth table
लीजिए f(A, B) = A·B + ¬A·B. अब columns को step by step बनाते हैं:
A B A·B ¬A·B f
0 0 0 0 0
0 1 0 1 1
1 0 0 0 0
1 1 1 0 1
पहले intermediate columns, और आखिर में final OR. (ध्यान दिया? f तभी 1 है जब B 1 है, यानी ये पूरा expression simplify होकर बस B रह जाता है। Simplification अगला topic है।)
Quiz
एक Boolean function में 4 input variables हैं। इसकी पूरी truth table में कितनी rows चाहिए?
- 4
- 8
- 16
- ये expression पर depend करता है
Show the answer
16
चारों variables independently 0 या 1 ले सकते हैं, तो combinations multiply होते हैं: 2⁴ = 16. हर variable पर संख्या double होती जाती है (2, 4, 8, 16...). Expression कितना भी complex हो, वो सिर्फ intermediate columns बदलता है, rows की गिनती कभी नहीं; rows सिर्फ variables की संख्या से तय होती हैं।
Theory
Truth table → expression (sum of products)
उल्टा जाना भी एक recipe की तरह है:
1. हर वो row ढूंढिए जहाँ output 1 है
2. ऐसी हर row के लिए सारे variables को AND कीजिए: variable अगर उस row में 1 है तो plain, और अगर 0 है तो complemented
3. इन सारे terms को आपस में OR कर दीजिए
Example: output सिर्फ rows (A=0, B=1) और (A=1, B=1) में 1 है → f = ¬A·B + A·B. ये sum-of-products form table को बिलकुल हूबहू reproduce कर देता है।
Think first
A और B का एक function exactly एक row में 1 output देता है: A = 1, B = 0.
इसका sum-of-products expression मन ही मन बना लीजिए, फिर tap कीजिए।
Show the answer
f = A·¬B
Output-1 वाली एक ही row का मतलब है एक ही term. उस row में A 1 है तो plain रहेगा; B 0 है तो complemented होकर आएगा। Term को वापस पढ़कर check कीजिए: A·¬B तभी 1 है जब A = 1 और B = 0. Row ही तो term है, बस यही पूरा खेल है।
Theory
वो named functions जो पहचानने लायक हैं
कुछ two-variable functions इतने काम के हैं कि उनके नाम पड़ गए हैं: AND, OR, NAND (AND का NOT), NOR (OR का NOT), XOR (जब inputs अलग हों तब 1), XNOR (जब inputs एक जैसे हों तब 1).
3 variables के साथ majority function तब 1 output देता है जब कम से कम 2 inputs 1 हों: f = A·B + B·C + A·C. असली chips इसी से voting करते हैं।
Quiz
A और B का XOR तब exactly 1 output देता है जब inputs अलग हों। इसका sum-of-products expression क्या होगा?
- A·B + ¬A·¬B
- ¬A·B + A·¬B
- A + B
- A·B
Show the answer
¬A·B + A·¬B
"Inputs अलग हों" ये 2 rows में होता है: (0,1) से term ¬A·B, और (1,0) से A·¬B; इन्हें OR कर दीजिए। Option A दरअसल XNOR है, यानी वो rows जहाँ inputs MATCH करते हैं, ये classic उल्टी गलती है। A + B इसलिए गलत है क्योंकि जब दोनों 1 हों तब भी वो 1 देता है, जबकि वहाँ XOR तो 0 होता है।
Watch out
Sum-of-products में कहाँ गड़बड़ होती है
3 गलतियों पर नजर रखिए: output-0 वाली rows के लिए term लिख देना (term सिर्फ 1-rows को मिलता है), जो variables उस row में 0 हैं उन्हें complement करना भूल जाना, और rows को पूरा miss कर देना क्योंकि combinations systematically list नहीं की गईं (हर बार क्रम से 00, 01, 10, 11)।
Theory
ये आपको फिर कहाँ मिलेगा
हर processor instruction दरअसल silicon पर उकेरे गए Boolean functions ही हैं, और अकेला XOR parity checks, RAID storage और simple encryption को power देता है। ठीक अगले topics आज के sum-of-products output को उठाकर उसे छोटा करते हैं: representation और minimization, जहाँ कम terms का मतलब है सस्ते circuits.
Summary
Key takeaways
- Boolean function 2ⁿ input combinations में से हर एक को एक 0/1 output पर map करता है।
- Expression से table: row by row evaluate कीजिए, बीच में intermediate columns बनाते हुए।
- Table से expression: हर output-1 row के लिए एक AND term (1 के लिए plain, 0 के लिए complemented), फिर terms को OR कर दीजिए: sum of products.
- Named functions याद रखिए: AND, OR, NAND, NOR, XOR (अलग), XNOR (मैच), majority.
- Memory hook: row ही तो term है।