Raw

2. Methodical guidelines / Методичні вказівки

This section is self-contained: it collects all the theory needed for the theme — Boolean formulas, truth tables, the laws of Boolean algebra, and the two normal forms — together with the techniques used to solve the tasks in 3classroom.md. No outside material is required.

2.1 Boolean formulas

A Boolean (propositional) variable takes one of two values, 11 (true) or 00 (false). Formulas are built from variables, the constants 00 and 11, and the connectives:

Connective Symbol Value
Negation (NOT) ¬A\neg A (also A\overline{A}) 11 iff A=0A=0
Conjunction (AND) ABA \wedge B (also ABAB) 11 iff both are 11
Disjunction (OR) ABA \vee B 11 iff at least one is 11
Implication ABA \to B 00 only when A=1, B=0A=1,\ B=0; equals ¬AB\neg A \vee B
Equivalence ABA \leftrightarrow B 11 iff AA and BB are equal

Two shorthands used throughout: an overline A\overline{A} means ¬A\neg A, and juxtaposition ABAB means ABA \wedge B.

Precedence. To drop parentheses, connectives bind in the order

¬  >    >    >    >  .\neg \;>\; \wedge \;>\; \vee \;>\; \to \;>\; \leftrightarrow.

So xyztx \vee \overline{y}\,z \to t reads (x(yz))t\big(x \vee (\overline{y} \wedge z)\big) \to t. When in doubt, parenthesise.

2.2 From a formula to a truth table

A formula in nn variables defines a Boolean function; its truth table lists the value on each of the 2n2^n interpretations (assignments of 0/10/1 to the variables). To build it:

  1. write the 2n2^n rows in the standard order — read the variable values as a binary number counting up from 000\ldots0 to 111\ldots1;
  2. for each row, substitute the values and evaluate the formula inside-out, respecting precedence;
  3. record the result in the last column.

For example, one row of f(x,y,z,t)=xy(zxy)tf(x,y,z,t)=x \vee \overline{y}(z \vee \overline{x}\, \overline{y}) \to t at (x,y,z,t)=(0,0,0,0)(x,y,z,t)=(0,0,0,0) evaluates as

00(000)0=01(01)0=010=10=0.0 \vee \overline{0}\,(0 \vee \overline{0}\,\overline{0}) \to 0 = 0 \vee 1(0 \vee 1) \to 0 = 0 \vee 1 \to 0 = 1 \to 0 = 0.

The number of the row (its binary value) doubles as the number of the interpretation.

2.3 The laws of Boolean algebra

These identities let you transform a formula without changing the function it computes. They come in dual pairs (swap \wedge\leftrightarrow\vee and 010\leftrightarrow1).

Law For \wedge For \vee
Double negation (\overline{\overline{A}} = A)
Complement (excluded middle) AA=0A \wedge \overline{A} = 0 AA=1A \vee \overline{A} = 1
Constants A0=0,A1=AA \wedge 0 = 0,\quad A \wedge 1 = A A0=A,A1=1A \vee 0 = A,\quad A \vee 1 = 1
Idempotence AA=AA \wedge A = A AA=AA \vee A = A
Absorption A(AB)=AA \wedge (A \vee B) = A A(AB)=AA \vee (A \wedge B) = A
Combining (AB)(AB)=A(A \vee B)(A \vee \overline{B}) = A ABAB=AAB \vee A\overline{B} = A
Commutativity AB=BAA \wedge B = B \wedge A AB=BAA \vee B = B \vee A
Associativity A(BC)=(AB)CA(BC) = (AB)C A(BC)=(AB)CA \vee (B \vee C) = (A \vee B) \vee C
Distributivity A(BC)=ABACA(B \vee C) = AB \vee AC ABC=(AB)(AC)A \vee BC = (A \vee B)(A \vee C)
De Morgan AB=AB\overline{A \wedge B} = \overline{A} \vee \overline{B} AB=AB\overline{A \vee B} = \overline{A} \wedge \overline{B}

The two workhorses for normal forms are De Morgan (a bar over a group flips the operation and complements each part) and distributivity.

2.4 Literals, DNF and CNF

  • A literal is a variable or its negation: xx or x\overline{x}.
  • A term (elementary conjunction, “product”) is an AND of literals, e.g. xyzx\,\overline{y}\,z.
  • A clause (elementary disjunction, “sum”) is an OR of literals, e.g. xyzx \vee \overline{y} \vee z.

The two standard shapes are:

  • Disjunctive normal form (DNF) — an OR of terms (a sum of products), e.g. (xy)(xz)(x\,\overline{y}) \vee (\overline{x}\,z);
  • Conjunctive normal form (CNF) — an AND of clauses (a product of sums), e.g. (xy)(xz)(x \vee \overline{y})(\overline{x} \vee z).

CNF is an AND of OR-clauses; DNF is an OR of AND-terms

Every formula has both forms. DNF makes satisfiability obvious (a term with no clashing literals is satisfiable); CNF is the input format expected by SAT solvers.

2.5 Reducing a formula to DNF or CNF

Follow the same first two steps, then distribute in the appropriate direction:

  1. Eliminate \to and \leftrightarrow. Replace ABA \to B by AB\overline{A} \vee B, and ABA \leftrightarrow B by (AB)(BA)(\overline{A} \vee B)(\overline{B} \vee A).
  2. Push negations inward with De Morgan and double negation until every ¬\neg sits on a single variable (this is negation normal form).
  3. Distribute:
    • for DNF, distribute \wedge over \vee until the formula is an OR of AND-terms;
    • for CNF, distribute \vee over \wedge until it is an AND of OR-clauses.
  4. Simplify with idempotence, the complement laws (xx=0x \wedge \overline{x} = 0, xx=1x \vee \overline{x} = 1), absorption, and the constant laws. A term that contains both xx and x\overline{x} is 00 (drop it from a DNF); a clause that contains both is 11 (drop it from a CNF). If everything cancels, the formula is a constant: 00 (a contradiction) or 11 (a tautology).

Algebraic reduction: apply one law per step until the formula reaches its target shape

2.6 Working checklist

  • For a truth-table task, list all 2n2^n rows in binary order and evaluate inside-out; a final algebraic simplification of the formula is a good cross-check (the table and the simplified formula must agree).
  • For a normal-form task, always start by removing \to and \leftrightarrow, then apply De Morgan to reach negation normal form before distributing.
  • DNF distributes \wedge over \vee; CNF distributes \vee over \wedge — keep straight which one the task asks for.
  • Cite one law per step, and finish by simplifying; watch for a term/clause collapsing to 00 or 11.

Practical/Practical3/2method.md · 6.0 KB · updated 2026-08-01 18:44