51
Boolean Algebra and Propositional Logic Laura Kovács

Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Embed Size (px)

Citation preview

Page 1: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra

and Propositional Logic

Laura Kovács

Page 2: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Processors

Page 3: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Processors

Page 4: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Processors are made of Switches (shalter)

� Switches, wires, resistors and capacitors� Pentium 4:

� Willamette: 42 million switches� Northwood: 55 million switches

� Memory chip has 256 million

Page 5: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Processors are made of Switches (Shalter)

� Switches, wires, resistors and capacitors� Pentium 4:

� Willamette: 42 million switches� Northwood: 55 million switches

� Memory chip has 256 million

+

a= 0

y= 0

Example of a switch function:

- Switch a is open (under low voltage);

- Output y without voltage (Spannung).

Page 6: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

+

a= 1

y= 1

Processors are made of Switches

� Switches, wires, resistors and capacitors� Pentium 4:

� Willamette: 42 million switches

� Northwood: 55 million switches

� Memory chip has 256 million

Example of a switch function:

- Switch a is closed (under high voltage);

- Output y under voltage.

Page 7: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Processors are made of Switches

� Switches, wires, resistors and capacitors� Pentium 4:

� Willamette: 42 million switches

� Northwood: 55 million switches

� Memory chip has 256 million

Multi-million switches are … HARD!We need an abstraction.

Page 8: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Processors are made of Switches (shalter)

� Switches, wires, resistors and capacitors� Pentium 4:

� Willamette: 42 million switches

� Northwood: 55 million switches

� Memory chip has 256 million

Multi-million switches are … HARD!We need an abstraction: Boolean Algebra.

(propositional logic)

Page 9: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra (Boole’sche Algebra)

George Boole (1815 – 1864)

� Algebra on two-valued (binary) variables � G. Boole (1850) and C. Shannon (1938)� Straight-forward mapping to switches

� High voltage (closed switch) fl 1 (True)

� Low voltage (opened switch) fl 0 (False)

Page 10: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra

+

a= 0

y= 0

- Switch a is open

- Output y without voltage

+

a= 1

y= 1

- Switch a is closed

- Output y under voltage

Page 11: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra

+

b= 0

y= 0

a= 0

- Switches a and b are open

- Output y without voltage

Page 12: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra

+

b= 0

y= 0

a= 0

+

b= 1

y= 0

a= 0

- Switches a and b are open

- Output y without voltage

- Switch a is open, b is closed

- Output y without voltage

Page 13: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra

+

b= 0

y= 0

a= 0

+

b= 1

y= 0

a= 0

+

b= 0

y= 0

a= 1

- Switches a and b are open

- Output y without voltage

- Switch a is open, b is closed

- Output y without voltage

- Switch a is closed, b is open

- Output y without voltage

Page 14: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra

+

b= 0

y= 0

a= 0

+

b= 1

y= 0

a= 0

+

b= 0

y= 0

a= 1

+

b= 1

y= 1

a= 1

- Switches a and b are open

- Output y without voltage

- Switch a is open, b is closed

- Output y without voltage

- Switch a is closed, b is open

- Output y without voltage

-Switches a and b are closed

- Output y without voltage

Page 15: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

+

b= 0

y= 0

a= 0

+

b= 1

y= 0

a= 0

+

b= 0

y= 0

a= 1

+

b= 1

y= 1

a= 1

- Switches a and b are open

- Output y without voltage

- Switch a is open, b is closed

- Output y without voltage

- Switch a is closed, b is open

- Output y without voltage

-Switches a and b are closed

- Output y without voltage

Output y under voltage if and only if switches a and b are closed.

Boolean Algebra → Serial Switches

Page 16: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra

� Algebra on two-valued (binary) variables ← booleanvariables (atoms)

� Boolean operators → to form boolean functions (formulas):

� Conjunction (AND): ∧∧∧∧a∧b = 1 if and only if a=1 and b=1

Page 17: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra → Serial Switches

+

b

y

a

Conjunction (AND): ∧∧∧∧

y = a ∧∧∧∧ b

00 0

ya b0 ∧∧∧∧ 0 = 0

Page 18: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra → Serial Switches

Conjunction (AND): ∧∧∧∧

y = a ∧∧∧∧ b

00

0 00 1

ya b0 ∧∧∧∧ 0 = 00 ∧∧∧∧ 1 = 0

+

b

y

a

Page 19: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra → Serial Switches

000

0 00 11 0

ya b

Conjunction (AND): ∧∧∧∧

y = a ∧∧∧∧ b

0 ∧∧∧∧ 0 = 00 ∧∧∧∧ 1 = 01 ∧∧∧∧ 0 = 0

+

b

y

a

Page 20: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra → Serial Switches

0001

0 00 11 01 1

ya b

Conjunction (AND): ∧∧∧∧

y = a ∧∧∧∧ b

0 ∧∧∧∧ 0 = 00 ∧∧∧∧ 1 = 01 ∧∧∧∧ 0 = 01 ∧∧∧∧ 1 = 1

+

b

y

a

Page 21: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra → Serial Switches

0001

0 00 11 01 1

ya b

Conjunction (AND): ∧∧∧∧

y = a ∧∧∧∧ b

0 ∧∧∧∧ 0 = 00 ∧∧∧∧ 1 = 01 ∧∧∧∧ 0 = 01 ∧∧∧∧ 1 = 1

+

b

y

a

SYNTAX

SEMANTICS

Page 22: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra → Serial Switches

0001

0 00 11 01 1

ya b

Conjunction (AND): ∧∧∧∧

y = a ∧∧∧∧ b

0 ∧∧∧∧ 0 = 00 ∧∧∧∧ 1 = 01 ∧∧∧∧ 0 = 01 ∧∧∧∧ 1 = 1

x ∧∧∧∧ 0 = 0

+

y

x

Page 23: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra → Serial Switches

0001

0 00 11 01 1

ya b

Conjunction (AND): ∧∧∧∧

y = a ∧∧∧∧ b

0 ∧∧∧∧ 0 = 00 ∧∧∧∧ 1 = 01 ∧∧∧∧ 0 = 01 ∧∧∧∧ 1 = 1

x ∧∧∧∧ 0 = 0x ∧∧∧∧ 1 = x

+

y

x

Page 24: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra → Serial Switches

0001

0 00 11 01 1

ya b

Conjunction (AND): ∧∧∧∧

y = a ∧∧∧∧ b

0 ∧∧∧∧ 0 = 00 ∧∧∧∧ 1 = 01 ∧∧∧∧ 0 = 01 ∧∧∧∧ 1 = 1

x ∧∧∧∧ 0 = 0x ∧∧∧∧ 1 = xx ∧∧∧∧ x = x

+

y

x

(Idempotence)

(Neutral Element 1)

Page 25: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra

� Algebra on two-valued (binary) variables ← booleanvariables

� Boolean operators:

� Conjunction (AND): ∧∧∧∧a∧b = 1 if and only if a=1 and b=1

� Disjunction (OR): ∨∨∨∨a∧b = 1 if and only if a=1 or b=1

Page 26: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra → Parallel Switches

00 0

ya b

Disjunction (OR): ∨∨∨∨

y = a ∨∨∨∨ b

0 ∨∨∨∨ 0 = 0

+

b

y

a

Page 27: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra → Parallel Switches

01

0 00 1

ya b

Disjunction (OR): ∨∨∨∨

y = a ∨∨∨∨ b

0 ∨∨∨∨ 0 = 00 ∨∨∨∨ 1 = 1

+

b

y

a

Page 28: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra → Parallel Switches

011

0 00 11 0

ya b

Disjunction (OR): ∨∨∨∨

y = a ∨∨∨∨ b

0 ∨∨∨∨ 0 = 00 ∨∨∨∨ 1 = 11 ∨∨∨∨ 0 = 1

+

b

y

a

Page 29: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra → Parallel Switches

0111

0 00 11 01 1

ya b

Disjunction (OR): ∨∨∨∨

y = a ∨∨∨∨ b

0 ∨∨∨∨ 0 = 00 ∨∨∨∨ 1 = 11 ∨∨∨∨ 0 = 11 ∨∨∨∨ 1 = 1

+

b

y

a

Page 30: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra → Parallel Switches

0111

0 00 11 01 1

ya b

Disjunction (OR): ∨∨∨∨

y = a ∨∨∨∨ b

0 ∨∨∨∨ 0 = 00 ∨∨∨∨ 1 = 11 ∨∨∨∨ 0 = 11 ∨∨∨∨ 1 = 1

x ∨∨∨∨ 0 = x(Neutral Element 0)

+

y

x

Page 31: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra → Parallel Switches

0111

0 00 11 01 1

ya b

Disjunction (OR): ∨∨∨∨

y = a ∨∨∨∨ b

0 ∨∨∨∨ 0 = 00 ∨∨∨∨ 1 = 11 ∨∨∨∨ 0 = 11 ∨∨∨∨ 1 = 1

x ∨∨∨∨ 0 = xx ∨∨∨∨ 1 = 1

(Neutral Element 0)

+

y

x

Page 32: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra → Parallel Switches

0111

0 00 11 01 1

ya b

Disjunction (OR): ∨∨∨∨

y = a ∨∨∨∨ b

0 ∨∨∨∨ 0 = 00 ∨∨∨∨ 1 = 11 ∨∨∨∨ 0 = 11 ∨∨∨∨ 1 = 1

x ∨∨∨∨ 0 = xx ∨∨∨∨ 1 = 1x ∨∨∨∨ x = x

(Neutral Element 0)

(Idempotence)

+

y

x

Page 33: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra

� Algebra on two-valued (binary) variables ← booleanvariables

� Boolean operators:

� Conjunction (AND): ∧∧∧∧a∧b = 1 if and only if a=1 and b=1

� Disjunction (OR): ∨∨∨∨a∧b = 1 if and only if a=1 or b=1

� Negation (NOT): ¬¬¬¬¬ a =1 if and only if a=0

Page 34: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra

Negation (NOT): ¬¬¬¬

y = ¬¬¬¬ a

¬¬¬¬ 0 = 1¬¬¬¬ 1 = 01

001

ya

+

y

a

Page 35: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

� Algebra on two-valued (binary) variables ← booleanvariables

� Boolean operators (lowest to highest precedence): ∧∧∧∧, ∨∨∨∨, ¬¬¬¬

Boolean Algebra

0

1

11

0 0

0 1

1 01 1

a ∨ ba b

0

0

01

0 0

0 1

1 01 1

a ∧ ba b

1

0

0

1

¬aa

Truth Tables (Wahrheitstafel)

Example: Construct the truth table of the boolean function f=a ∨∨∨∨ (¬¬¬¬ b ∧∧∧∧ c).

Page 36: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra – Axioms/Laws (Gesetz)

a ∨ (b ∨ c) = (a ∨ b) ∨ c

a ∨ ¬ a = 1

a ∨ a = a

a ∨ b = b ∨ a

a ∨ 0 = a

a ∨ 1 = 1

a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c)

a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c)Distributive

a ∧ (b ∧ c) = (a ∧ b) ∧ cAssociative

a ∧ b = b ∧ aCommutative

a ∧ ¬ a = 0Negation

a ∧ a = aIdempotence

a ∧ 0 = 0Zero elements

a ∧ 1 = aNeutral elements (identity)

Note: Every axiom has a dual one: replace ∨, 0 with ∧, 1.

Duality: ¬ f(x,y) = g(¬x, ¬y)

Page 37: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra – DeMorgan Axioms

� DeMorgan’s Theorems for negating a boolean function:� Negate boolean variables;

� Change ∧ to ∨ and ∨ to ∧ ;

� DeMorgan’s axioms:

¬¬¬¬ (a ∧∧∧∧ b) = (¬¬¬¬ a) ∨∨∨∨ (¬¬¬¬ b) called a NAND

¬¬¬¬ (a ∨∨∨∨ b) = (¬¬¬¬ a) ∧∧∧∧ (¬¬¬¬ b) called a NOR

Page 38: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra – Axioms with DeMorgan’s Axioms

¬ (a ∧ b) = (¬ a) ∨ (¬ b)DeMorgan’s

a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c)

a ∨ (b ∨ c) = (a ∨ b) ∨ c

a ∨ ¬ a = 1

a ∨ a = a

a ∨ b = b ∨ a

a ∨ 0 = a

a ∨ 1 = 1

¬ (a ∨ b) = (¬ a) ∧ (¬ b)

a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c)Distributive

a ∧ (b ∧ c) = (a ∧ b) ∧ cAssociative

a ∧ b = b ∧ aCommutative

a ∧ ¬ a = 0Negation

a ∧ a = aIdempotence

a ∧ 0 = 0Zero elements

a ∧ 1 = aNeutral elements (identity)

Page 39: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

� Axioms can be used to prove new theorems:� Theorems are of the form f=g (f, g are boolean functions);

� Proof by using simplifications of f to yield g.� Simplification of f:

- transforming f by repeated application of axioms;

- yields an equivalent new function with fewer boolean operators.

� Examples:� ¬(a ∨ b) ∧ ¬((¬ a) ∨ (¬ b)) = 0� Absorption Axioms:

a ∨ (a ∧ b) = aa ∧ (a ∨ b) = a

Proof using Axioms

Page 40: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra – Special Boolean Functions

XOR: Exclusive OR (Antivalenz)

y = a ≠ b

0110

0 00 11 01 1

ya b0 ≠≠≠≠ 0 = 00 ≠≠≠≠ 1 = 11 ≠≠≠≠ 0 = 11 ≠≠≠≠ 1 = 0

x ≠≠≠≠ 0 = xx ≠≠≠≠ 1 = ¬¬¬¬xx ≠≠≠≠ x = 0

y is 1 if exactly one of the variables a and b is 1.

Page 41: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra – Special Boolean Functions

Implication fly = a fl b = ¬a ∨∨∨∨ b

1101

0 00 11 01 1

ya b

y is 1 if and only if a is 0 or b is 1

a implies b

if a is 1 then b is also 1

Page 42: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra – Special Boolean Functions

Implication fly = a fl b = ¬a ∨∨∨∨ b

1101

0 00 11 01 1

ya b

y is 1 if and only if a is 0 or b is 1

a implies b

if a is 1 then b is also 1

Page 43: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra – Special Boolean Functions

Equivalence ñ

y = a ñ b = (a fi b) ∧∧∧∧ (b fia)

1001

0 00 11 01 1

ya b

Page 44: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra – Precedence of Boolean Operators

1Equivalenceï

2Implicationfi

3Disjunction∨∨∨∨

3Conjunction∧∧∧∧

4Negation¬¬¬¬

Priority(Precedence)

NameOperator

Example: ¬ a ∧ b fl c ∨ d ñ e

Page 45: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra – truth value (Wahrheit) of a boolean function f

� f is a tautology if:

f =1 in all situations (f is always 1)

Example: (a ∧ (a fl b)) fl b (Modus Ponens Axiom)

� f is contradiction if:

f = 0 in all situations (f is always 0)

Example: a ∧ ¬a

� f is satisfiable (valid, erfüllbar) if:

f = 1 in some situation

Example: (a fl b) ∧ (a ∧ b fl c) fl (a fl c) is a tautology and thus satisfiable.(a fl b) ∧ c is satisfiable, but is not a tautology

Page 46: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra – checking satisfiability is hard

I can’t get no satisfactionAnd I try,And I try,And I try,And I try, …

The Rolling Stones

Page 47: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Boolean Algebra – All Boolean Functions with 2 Parameters

y7 = a∨b0111

y6 = a≠b0110

y5 = b0101

y4 = ¬a∧b0100

y3 = a0011

y2 = a∧¬b0010

y1 = a∧b0001

y0 = 00000

a 0011b 0101

y8 = ¬a∧¬b1000

y9 = añb1001

y10 = ¬b1010

y11 = a∨¬b1011

y12 = ¬a1100

y13 = ¬a∨b1101

y14 = ¬a∨¬b1110

y15 = 11111

a 0011b 0101

Page 48: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Half Adder (Halbaddierwerk)

&

�1 OR-Gate (Gatter)

AND-Gate

||

Page 49: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Half Adder

0 00 10 11 0

0 00 11 01 1

c sa b

s = (¬¬¬¬a ∧∧∧∧ b) ∨∨∨∨ (a ∧∧∧∧ ¬¬¬¬b)c = (a ∧∧∧∧ b)

�1

& a

b

s

& a

b c

& a

b

XOR

||

Page 50: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Half Adder – Simplifications

s = (¬¬¬¬a ∧∧∧∧ b) ∨∨∨∨ (a ∧∧∧∧ ¬¬¬¬b) == ((¬¬¬¬a ∧∧∧∧ b) ∨∨∨∨ a) ∧∧∧∧ ((¬¬¬¬a ∧∧∧∧ b) ∨∨∨∨ ¬¬¬¬b) == (¬¬¬¬a ∨∨∨∨ a) ∧∧∧∧ (b ∨∨∨∨ a) ∧∧∧∧ (¬¬¬¬a ∨∨∨∨ ¬¬¬¬b) ∧∧∧∧ (b ∨∨∨∨ ¬¬¬¬b) == (b ∨∨∨∨ a) ∧∧∧∧ (¬¬¬¬a ∨∨∨∨ ¬¬¬¬b) == (a ∨∨∨∨ b) ∧∧∧∧ ¬¬¬¬ (a ∧∧∧∧ b)

c = (a ∧∧∧∧ b)

Page 51: Boolean Algebra - files.ifi.uzh.ch · Boolean Algebra –truth value (Wahrheit)of a booleanfunction f f is a tautology if: f =1 in all situations (f is always 1) Example: (a ∧(a

Half Adder - Optimized

0 00 10 11 0

0 00 11 01 1

c sa b

s = (a ∨∨∨∨ b) ∧∧∧∧ ¬¬¬¬(a ∧∧∧∧ b)c = (a ∧∧∧∧ b)

&

�1

&

a

a

b

b

s

c

||