التعبيرات البوليانية والتبسيط
تغطي هذه الوحدة النظريات الأساسية للجبر البولياني، البوابات المنطقية، جداول الحقيقة، وكيفية تبسيط التعبيرات المنطقية باستخدام الحدود الصغرى (Minterms) ومجموع المضروبات (SOP).
Boolean Expression & Simplification
This module covers the basic theorems of Boolean algebra, logic gates, truth tables, and how to simplify boolean expressions using minterms and Sum of Products (SOP).
أهداف التعلم
- تعريف الدوال والتعبيرات البوليانية.
- تعلم كيفية التعبير عن الدالة البوليانية في الصيغ القياسية والقانونية.
- التعرف على رموز البوابات المنطقية وجداول الحقيقة الخاصة بها.
- تعلم كيفية معالجة التعبيرات البوليانية لتقليل عدد البوابات المنطقية المطلوبة.
- Define Boolean functions/Boolean expression.
- Learn how to express a Boolean function in canonical and standard forms.
- Learn the logic gates symbols and their truth tables.
- Learn how to manipulate Boolean expression to reduce the required number of logic gates.
1 النظريات والمسلمات الأساسية للجبر البولياني
1 Basic Theorems and Postulates of Boolean Algebra
هي القواعد الرياضية الأساسية التي تحكم المنطق الرقمي، وتُستخدم لتبسيط التعبيرات المعقدة.
The fundamental mathematical rules governing digital logic, used to simplify complex expressions.
يعتمد الجبر البولياني على مسلمات (Postulates) لا تحتاج إلى إثبات، ونظريات (Theorems) تُثبت باستخدام المسلمات أو جداول الحقيقة. من أهمها:
- التطابق (Identity)،
- الصفر/الواحد (Null)،
- التحايد (Idempotent)،
- النفي المزدوج (Involution)،
- التبديل (Commutative)،
- التجميع (Associative)،
- التوزيع (Distributive)،
- نظرية دي مورغان (DeMorgan)،
- والامتصاص (Absorption).
Boolean algebra relies on postulates (axioms needing no proof) and theorems (proven from postulates or truth tables). Key rules include:
- Identity,
- Null,
- Idempotent,
- Involution,
- Commutative,
- Associative,
- Distributive,
- DeMorgan's,
- and Absorption theorems.
تُثبت النظريات إما جبرياً باستخدام المسلمات، أو عن طريق جداول الحقيقة حيث يتم التحقق من تطابق كلا الجانبين لجميع الاحتمالات الممكنة للمتغيرات.
مبدأ الثنائية (Duality) يتيح استنتاج نظريات جديدة بتبديل كل AND بـ OR وكل 0 بـ 1.
Theorems are proven either algebraically using postulates or via truth tables by checking if both sides yield identical results for all variable combinations.
The principle of duality allows deriving new theorems by swapping AND with OR, and 0 with 1.
كيف يمكن استخدام نظرية الامتصاص لتقليل تكلفة بناء دائرة منطقية؟ How can the absorption theorem be used to reduce the cost of building a logic circuit?
من خلال تطبيق نظرية الامتصاص (x + xy = x)، يمكننا إزالة بوابة AND وبوابة OR بالكامل، وتوصيل المدخل x مباشرة إلى المخرج، مما يوفر المساحة والطاقة والتكلفة.
By applying the absorption theorem (x + xy = x), we can completely remove an AND gate and an OR gate, routing input x directly to the output, saving space, power, and cost.
2 أولوية المعاملات المنطقية
2 Operator Precedence
ترتيب تنفيذ العمليات المنطقية: الأقواس أولاً، ثم النفي، ثم العطف، وأخيراً الفصل.
The order of evaluating logic operations: Parentheses first, then NOT, AND, and finally OR.
عند تقييم التعبيرات البوليانية، يجب اتباع ترتيب محدد للعمليات لضمان النتيجة الصحيحة:
- الأقواس (Parentheses)،
- النفي (NOT)،
- العطف (AND)،
- الفصل (OR).
ونتيجة لذلك، تظهر الأقواس عادةً حول تعبيرات OR إذا كان يجب تقييمها قبل AND.
When evaluating Boolean expressions, a specific order of operations must be followed to ensure the correct result:
- Parentheses,
- NOT,
- AND,
- OR.
Consequently, parentheses often appear around OR expressions if they need to be evaluated before an AND operation.
هذا الترتيب يشبه العمليات الحسابية التقليدية حيث يمثل AND الضرب ويمثل OR الجمع.
تجاهل هذا الترتيب يؤدي إلى بناء دوائر منطقية خاطئة تماماً.
This precedence mirrors traditional arithmetic where AND acts like multiplication and OR acts like addition.
Ignoring this order leads to constructing completely incorrect logic circuits.
ماذا يحدث إذا قمنا بتقييم التعبير A + B * C من اليسار إلى اليمين بدون مراعاة الأولوية؟ What happens if we evaluate the expression A + B * C from left to right without considering precedence?
سنقوم بحساب (A + B) أولاً ثم نضرب الناتج في C، وهذا يعطي نتيجة خاطئة. الترتيب الصحيح هو حساب (B * C) أولاً ثم جمع الناتج مع A.
We would compute (A + B) first and then AND it with C, yielding an incorrect result. The correct order is to compute (B * C) first, then OR it with A.
3 البوابات المنطقية وجداول الحقيقة
3 Logic Gates and Truth Tables
البوابات المنطقية هي اللبنات الأساسية للدوائر الرقمية، وجدول الحقيقة يوضح جميع المخرجات الممكنة لكل احتمالات المدخلات.
Logic gates are the building blocks of digital circuits, and a truth table spells out all possible outputs for every input combination.
الدوال البوليانية تستخدم العمليات المنطقية فقط. يمكن تمثيل هذه الدوال باستخدام جداول الحقيقة أو المخططات المنطقية (Logic Diagrams).
جدول الحقيقة لعدد n من المتغيرات يحتوي على 2^n صف. البوابات الشائعة تشمل:
- AND,
- OR,
- Inverter (NOT),
- Buffer,
- NAND,
- NOR,
- XOR,
- XNOR.
Boolean functions use logic operations exclusively. These functions can be represented using truth tables or logic diagrams.
A truth table for n variables has 2^n rows. Common gates include:
- AND,
- OR,
- Inverter (NOT),
- Buffer,
- NAND,
- NOR,
- XOR,
- and XNOR.
تحويل التعبير البولياني إلى جدول حقيقة يتطلب إيجاد قيم المتغيرات الوسيطة أولاً.
على سبيل المثال، للدالة F = X + Y'Z، نجد أولاً Y' ثم Y'Z ثم نجمعها مع X.
هذا التدرج يمنع الأخطاء ويطابق تدفق الإشارات في الدائرة الفعلية.
Converting a Boolean expression to a truth table requires finding intermediate variable values first.
For F = X + Y'Z, we first find Y', then Y'Z, and finally OR it with X.
This step-by-step approach prevents errors and mirrors the signal flow in the actual circuit.
لماذا نحتاج إلى بوابة Buffer إذا كانت لا تغير قيمة المدخل؟ Why do we need a Buffer gate if it doesn't change the input value?
تُستخدم بوابة Buffer لتقوية الإشارة الكهربائية (زيادة التيار) أو لإضافة تأخير زمني متعمد في الدائرة.
A Buffer gate is used to amplify the electrical signal (increase current drive capability) or to introduce a deliberate time delay in the circuit.
4 متمم الدالة
4 Complement of a Function
هو عكس الدالة تماماً؛ حيث يتحول كل 1 إلى 0 وكل 0 إلى 1 في جدول الحقيقة.
The exact opposite of a function; every 1 becomes 0 and every 0 becomes 1 in the truth table.
يمكن إيجاد متمم الدالة (F') جبرياً بطريقتين:
- الأولى بتطبيق نظرية دي مورغان على التعبير بأكمله.
- الثانية باستخدام طريقة الثنائي (Dual)، حيث نأخذ الثنائي للدالة (بتبديل AND بـ OR والعكس) ثم نقوم بتتميم كل متغير (Literal) على حدة.
The complement of a function (F') can be derived algebraically in two ways:
- First, by applying DeMorgan's theorem to the entire expression.
- Second, by taking the dual of the function (swapping AND with OR and vice versa) and then complementing each literal individually.
الفرق الجوهري بين الثنائي (Dual) والمتمم (Complement) هو أن:
- الثنائي يغير المعاملات (Operators) والثوابت (0 و 1) فقط دون المساس بالمتغيرات،
- بينما المتمم يغير المعاملات والثوابت والمتغيرات معاً.
The fundamental difference between Dual and Complement is that:
- the Dual only changes operators and constants (0 and 1) without affecting the literals,
- whereas the Complement changes operators, constants, AND the literals.
إذا كانت الدالة F = 1، فما هو الثنائي لها وما هو المتمم؟ If function F = 1, what is its dual and what is its complement?
الثنائي للرقم 1 هو 0. والمتمم للرقم 1 هو أيضاً 0.
The dual of 1 is 0. The complement of 1 is also 0.
5 الحدود الصغرى ومجموع الحدود الصغرى
5 Minterms and Sum of Minterms (SOM)
الحد الأصغر هو حد ضرب يحتوي على جميع المتغيرات، ومجموع الحدود الصغرى يمثل الصفوف التي نتيجتها 1 في جدول الحقيقة.
A minterm is a product term containing ALL variables, and SOM represents the truth table rows where the output is 1.
الحد الأصغر (Minterm) هو حد ضرب (Product Term) تظهر فيه جميع المتغيرات مرة واحدة (سواء كانت منفية أو غير منفية).
لعدد n من المتغيرات، يوجد 2^n حد أصغر.
يمكن التعبير عن أي دالة بوليانية كـ "مجموع الحدود الصغرى" (Sum of Minterms - SOM) عن طريق عمل OR لجميع الحدود الصغرى التي تقابل القيمة 1 في جدول الحقيقة.
A Minterm is a product term in which ALL variables appear exactly once (complemented or not).
For n variables, there are 2^n minterms.
Any Boolean function can be expressed as a logical sum of minterms (SOM) by ORing all the minterms that correspond to a 1 in the truth table.
صيغة مجموع الحدود الصغرى تُعرف بالصيغة القانونية (Canonical Form).
متمم الدالة يحتوي ببساطة على الحدود الصغرى التي لم يتم تضمينها في الدالة الأصلية.
الدالة التي تحتوي على جميع الحدود الصغرى الممكنة تساوي منطقياً 1.
The sum-of-minterms form is a canonical algebraic expression.
The complement of a function simply contains those minterms NOT included in the original function.
A function that includes all 2^n minterms is logically equal to 1.
هل الحد XY يعتبر حداً أصغر (Minterm) في دالة تحتوي على 3 متغيرات (X, Y, Z)؟ Is the term XY considered a minterm in a function with 3 variables (X, Y, Z)?
لا، الحد XY هو مجرد حد ضرب (Product Term) لأنه يفتقر إلى المتغير Z. الحد الأصغر يجب أن يحتوي على جميع المتغيرات الثلاثة.
No, the term XY is just a product term because it lacks the variable Z. A minterm must contain all three variables.
6 مجموع المضروبات (SOP)
6 Sum of Products (SOP) Standard Form
هو النسخة المبسطة من مجموع الحدود الصغرى، ويُنفذ عادة كدائرة سريعة من مستويين.
The simplified version of SOM, typically implemented as a fast 2-level logic circuit.
بينما يحتوي مجموع الحدود الصغرى (SOM) على الحد الأقصى من المتغيرات في كل حد، فإن تبسيط هذا التعبير ينتج ما يسمى "مجموع المضروبات" (Sum of Products - SOP)، وهو صيغة قياسية (Standard Form).
يتم تنفيذ SOP عادة كدائرة ذات مستويين (2-level implementation): مستوى من بوابات AND يغذي بوابة OR واحدة.
While the sum-of-minterms (SOM) contains the maximum number of literals in each term, simplifying this expression yields the "Sum of Products" (SOP), which is a standard form.
SOP is typically implemented as a 2-level circuit: a level of AND gates feeding into a single OR gate.
التنفيذ ذو المستويين (2-level) مفضل لأنه يقلل من تأخير البوابات (Gate Delay) مقارنة بالتنفيذ ذي الثلاثة مستويات (مثل إخراج عامل مشترك).
ومع ذلك، قد نضطر لاستخدام 3 مستويات إذا كانت البوابات المتاحة لدينا محدودة بعدد معين من المداخل (مثلاً بوابات بمدخلين فقط).
A 2-level implementation is preferred because it minimizes gate delay compared to a 3-level implementation (e.g., factoring out a variable).
However, a 3-level design might be necessary if we are restricted by fan-in limits, such as only having 2-input gates available.
| SOM (Sum of Minterms) | SOP (Sum of Products) | |
|---|---|---|
| عدد المتغيرات في كل حد Literals per term | الحد الأقصى (جميع المتغيرات موجودة) Maximum (all variables present) | مبسط (متغيرات أقل) Simplified (fewer variables) |
| نوع الصيغة Form Type | صيغة قانونية (Canonical) Canonical Form | صيغة قياسية (Standard) Standard Form |
| الاستخراج Derivation | مباشرة من جدول الحقيقة Directly from truth table | يتطلب تبسيطاً جبرياً Requires algebraic simplification |
| 2-level (e.g., AB + CD + CE) | 3-level (e.g., AB + C(D+E)) | |
|---|---|---|
| تأخير البوابات (السرعة) Gate Delay (Speed) | تأخير أقل (أسرع) Less delay (Faster) | تأخير أكبر (أبطأ) More delay (Slower) |
| عدد البوابات / المداخل المطلوبة Gates / Fan-in required | قد يتطلب بوابات بمداخل كثيرة May require gates with many inputs | يمكن تنفيذه ببوابات ذات مدخلين فقط Can be implemented with 2-input gates |
أيهما أسرع في معالجة الإشارات: دائرة ذات مستويين أم دائرة ذات 3 مستويات؟ ولماذا؟ Which is faster in processing signals: a 2-level circuit or a 3-level circuit? Why?
الدائرة ذات المستويين أسرع، لأن كل بوابة تضيف تأخيراً زمنياً (Gate Delay). مرور الإشارة عبر بوابتين أسرع من مرورها عبر ثلاث بوابات.
A 2-level circuit is faster because every gate introduces a propagation delay (Gate Delay). Passing through two gates is faster than passing through three.