Boolean Algebras
(ブール代数)
Discrete Mathematics I
12th lecture, December 16, 2022
https://www.sw.it.aoyama.ac.jp/2022/Math1/lecture12.html
Martin J. Dürst

© 2005-22 Martin
J. Dürst Aoyama Gakuin
University
Today's Schedule
- Remaining schedule
- Summary and homework for last lecture
- Algebraic structures related to groups
- Boolean algebra
- Examples of Boolean algebras
- Bitstrings and Bitwise Operations
- Structure of Boolean algebras
Remaining Schedule
- December 16 (today): Boolean algebras
- December 23: 13th lecture (modular arithmetic)
- January 6: 14th lecture (Mathematical Induction and Other Proof
Methods)
- January 13: 15th lecture
- [January 20: makeup lectures/補講]
- January 27, 11:10-12:35 (85 min): Term Final Exam
- Please use your winter vacation to prepare seriously for the term final
exam!
Final Exam・期末試験
- Coverage:
- Complete contents of lecture and handouts
- Past exams:
- 2005,
2006,
2007,
2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, (2020
online) 2021
- How to view example solutions
- Press the [表示 (S)]
button or the [S] key.
- To revert, press the [非表示
(P)] button or press the [P] key.
- Sometimes, more than one key press is needed to start
switching.
- Some images and example solutions are missing.
- Please report any errors you find.
How to use Past Exams
Important: Do not browse the problems and solutions!
- Take time for a full exam (85 minutes)
- Print out one exam
- Solve this exam, with time limit
- Look at the example solutions to check your solutions
- Find out your weak points
- Learn more in the areas you have identified as your weak points
- Repeat starting at 1.
Important Points about Final Exam
- Most problems are in Japanese and English
- Most answers can be in Japanese or English
- Read problems carefully (distinguish between calculation, proof,
explanation,...)
- Be able to explain concepts in your own words
- Be able to do calculations (base conversions, truth tables,...)
speedily
- Combine and apply knowledge from
different lectures
- Write clearly
Summary of Last Lecture
- Algebraic structures are defined as sets with operations and
axioms
- Groups are the best known example of an algebraic structure, with a rich
theory
- Groups have one associtive binary operation, an identity
element, and inverse elements
- Examples of groups are (ℤ, +), (ℝ-{0}, ·), (ℝ+, ·),
and symmetric groups (permutations of n elements with
composition)
- Finite groups are represented by Cayley tables, and compared
using the concept of isomorphism (one-to-one mapping conserving
structure)
Create a Cayley table of the symmetric group of order 3. Use lexical order
for the permutations.
|
(1, 2, 3) |
(1, 3, 2) |
(2, 1, 3) |
(2, 3, 1) |
(3, 1, 2) |
(3, 2, 1) |
(1, 2, 3) |
(1, 2, 3) |
(1, 3, 2) |
(2, 1, 3) |
(2, 3, 1) |
(3, 1, 2) |
(3, 2, 1) |
(1, 3, 2) |
(1, 3, 2) |
(1, 2, 3) |
(3, 1, 2) |
(3, 2, 1) |
(2, 1, 3) |
(2, 3, 1) |
(2, 1, 3) |
(2, 1, 3) |
(2, 3, 1) |
(1, 2, 3) |
(1, 3, 2) |
(3, 2, 1) |
(3, 1, 2) |
(2, 3, 1) |
(2, 3, 1) |
(2, 1, 3) |
(3, 2, 1) |
(3, 1, 2) |
(1, 2, 3) |
(1, 3, 2) |
(3, 1, 2) |
(3, 1, 2) |
(3, 2, 1) |
(1, 3, 2) |
(1, 2, 3) |
(2, 3, 1) |
(2, 1, 3) |
(3, 2, 1) |
(3, 2, 1) |
(3, 1, 2) |
(2, 3, 1) |
(2, 1, 3) |
(1, 3, 2) |
(1, 2, 3) |
Last Week's Homerwork 2:
Non-Isomorphic Groups of Size 4
If we define isomorphic groups as being "the same", there are two different
groups of size 4. Give an example of each group as a Cayley table. Hint: Check
all the conditions (axioms) for a group. There will be a deduction if you use
the same elements of the group as another student.
Solution 1 (cyclic group of order 4)
Interesting examples: Addition modulo 4 (below), rotation by multiples of
90°, {1, 2, 3, 4} and multiplication modulo 5 (see next lecture)
|
0 |
1 |
2 |
3 |
0 |
0 |
1 |
2 |
3 |
1 |
1 |
2 |
3 |
0 |
2 |
2 |
3 |
0 |
1 |
3 |
3 |
0 |
1 |
2 |
Solution 2 (Klein four-group):
Interesting examples: bitstrings of length 2 with XOR (below), reflections
and rotations by 180°
|
00 |
01 |
10 |
11 |
00 |
00 |
01 |
10 |
11 |
01 |
01 |
00 |
11 |
10 |
10 |
10 |
11 |
00 |
01 |
11 |
11 |
10 |
01 |
00 |
Leftovers: Groups in Computer Science
Addition modulo 28, 216,
232, 264,...
Algebraic Structures Related to Groups
- Abelian group: Group where the operation is also commutative
Examples:
- All groups of size 3 or 4
- (ℤ; +): Integers with addition
- (ℝ-{0}; ·) Reals (excluding 0) with multiplication
- Semigroup: Group without unit element and without inverse
elements
More Algebraic Structures
- Ring: Two operations, 'addition' and 'multiplication'; forms an
Abelian group under addition and a semigroup under multiplication, and
addition distributes over multiplication.
Examples: ℝ, ring of polynomials
- Field: Same as ring, but commutative, and 'multiplication' has
to have an inverse for all non-zero elements.
- Lattice: Two operations; both operations are associative and
commutative, and respect absorption laws
Boolean Algebra
- A Boolean algebra is an algebraic structure
- A Boolean algebra has one set (B), two special elements
(0, 1), and three operations (⫬, △,
▽)
- B = (B, 0, 1,
⫬, △, ▽) is a Boolean algebra if and only if it meets the
following conditions:
- 0 ∈ B, 1 ∈
B (1 is called unit element,
0 is called zero element)
- ⫬ is an unary operation on B, △ and
▽ are binary operations on B
- △ and ▽are associative and commutative, and
distribute over each other
- ∀a∈B:
a▽0 = a,
a△1 = a
(0 is the neutral element for ▽, 1
is the neutral element for △)
- ∀a∈B:
a▽⫬a = 1,
a△⫬a =
0
- This definition (operations, axioms) can be simplified
- Boolean algebras define a (partial) order, with 1 at the
top and 0 at the bottom (∀a∈B:
0≤a≤1)
Boolean Algebra Example 1:
Basic Logic
- B is the set {false, true}
- 0 is false (0)
- 1 is true (1)
- ⫬ is negation (logical not, ¬)
- △ is conjunction (logical and, ∧)
- ▽ is disjunction (logical or, ∨)
- The (partial) order relation uses false<true , or a≤b ⇔
a→b
- Hasse diagram: BAbasic_logic.svg
Comments on Boolean Algebra
- Symbols 0, 1 (bold), ⫬, △, and ▽
are abstract and do not have any concrete meaning
- A Boolean algebra is a (partial) order and a lattice
- Boolean algebra is a general concept covering logical operations, set
operations, some (partial) orders, ...
- Because a Boolean algebra is a partial order, it can be shown with a
Hasse diagram
Boolean Algebra Example 2:
A Powerset with Set Operations
- B is the powerset of a (finite) set U (B
= P(U))
- 0 is the empty set ({})
- 1 is U (the universal set)
- ⫬ is the complementary set operation
- △ is set intersection (∩)
- ▽ is set union (∪)
- The (partial) order relation is ⊂ (subset)
- Hasse diagram for U={a, b, c}: BApowerset.svg
Bitwise Operations
- Inside a computer, information is represented as strings of bits (e.g.
a=00101011, b=10011100).
- Bitwise operations are bitwise logic operations.
- Bitwise not: ¬ is applied to each bit (
~
in C*,
e.g. ¬bitwisea=11010100)
- Bitwise and: ∧ is applied to bits in the same position
(
&
in C*, e.g.
a∧bitwiseb=00001000)
- Bitwise or: ∨ is applied to bits in the same position
(
|
in C*, e.g.
a∨bitwiseb=10111111)
- Bitwise xor: XOR (⊕) is applied to bits in the same position
(
^
in C*, e.g.
a⊕bitwiseb=10110111)
*) and many other programming languages
Boolean Algebra Example 3:
Bitstrings and Bitwise Operations
- B is the set of all the bit strings of length n
(e.g. for n=2, B={00, 01, 10, 11})
- 0 is the bit string of length n with all bits set to 0 (e.g.
00)
- 1 is the bit string of length n with all bits set to 1 (e.g.
11)
- ⫬ is bitwise
not
- △ is bitwise
and
- ▽ is bitwise
or
- The (partial) order relation is the conjunction of the order relation at
each bit position
(a≤b ↔ ∀i∈{1,...,n}:
ai≤bi;
a has 0 in all those bit positions where b has 0; in
C: ~(b|~a) ==
0).
- Hasse diagram for bit strings of length 4: BAbitstrings.svg
Boolean Algebra Example 4:
Integers and Divisibility
- B is formed by taking a set of n pairwise
coprime integers* (e.g. 2, 3, 5), and all the multiples
that include or exclude each of the integers (including 1) (e.g.
B = {1, 2, 3, 5, 6, 10, 15, 30})
- 0 is 1
- 1 is the product of all the original n
integers (e.g. 30)
- ⫬a is 1/a
- △ is the greatest common divisor
(GCD) of the operands
- ▽ is the least common multiple
(LCM) of the operands
- The (partial) order relation is divisibility
- Hasse diagram for {1, 2, 3,
5, 6, 10, 15, 30}: BAdivisibility.svg
*) This restriction can be slightly relaxed.
The Structure of Boolean Algebras
- The size of a finite boolean algebra is always |B| =
2n
- All boolean algebras have the same structure (an n-dimensional
cube)
(animation
of a 4-dimensional cube, even
higher dimensions (code))
- The Hasse diagram is the edges of the n-dimensional cube, when
placing 0 at the bottom and 1 at the
top
- The result of △ is the highest vertex equal or lower than both operands
(infimum, greatest lower bound)
- The result of ▽ is the lowest vertex equal or higher than both operands
(supremum, least upper bound)
- The result of ⫬ is the vertex diagonally oposite of its operand
- All boolean algebras of dimension n are isomorphic (have the
same structure)
- For all boolean algebras, the same laws apply (they can be proven from
the axioms)
Isomorphisms for Examples
- Basic logic is isomorphic to bitstrings of length 1 (0=false, 1=true)
- The subsets of a set of size n can be expressed as bit strings
of size n:
Each bit indicates presence (1) or absence (0) of the respective element
from the subset
- Set operations can be defined by logical operations
Examples: A ∪ B = {x|
x∈A ∨ x∈B}; A
∩ B = {x| x∈A ∧
x∈B}; Ac = {x|
¬(x∈A)}
- Examples with divisibility are constructed to include/exclude each
factor; this can be mapped to bitstrings or to set operations
Axioms for Boolean Algebras
The axioms for Boolean algebras are the same as the axioms for basic logic
(standard/Huntington/Robbins/Sheffer/Wolfram).
There is a choice between compactness and obviousness.
We obtained the axioms by starting with basic logic and trying to find
axiomatizations.
We obtain Boolean algebras by trying to find all objects that conform to
these axioms.
Basic logic ⇒ Axioms of basic logic/boolean algebras ⇒ Boolean
algebras
The Magic Garden of George B.
(The Magic Garden of George B. And Other Logic Puzzles, Raymond
Smullyan, Polimetrica, 2007)
- A very special garden: Flowers can change colors every day
(set of flowers F, set of days D, color of flower
a on day d: color(a, d))
- Each flower is either blue or
red for a whole day
(∀f∈F: ∀d∈D:
color(f,d)=red⊕color(f,d)=blue)
- For any flowers a and b, there is a flower
c that is red on all and
only those days on which a and b are both blue.
(∀a, b∈F: ∃c∈F:
∀d∈D:
color(a,d)=color(b,d)=blue ↔
color(c,d)=red)
- Any two different flowers a and b have different
colors on at least one day.
(∀a, b∈F:
∃d∈D:
a≠b→color(a,d)≠color(b,d))
- We know that the garden has more than 200 but less than 500 flowers.
(200<|F|<500)
- Question 1: How many flowers does the garden have?
- Question 2: What is the minimum of days that the flowers bloom?
- Question 3: Who is George B.?
How to Solve the Magic Garden Puzzle
- Let red stand for 1, blue for 0
- Let each day be a bit position
- Let each flower be a bit combination
- "there is a flower c that is red on all and only those days on which
a and b are both blue" means that bitwise NOR is always
defined
- Because any (bitwise) logical operation can be defined based on bitwise
NOR, all logical operations are defined
- The flowers therefore form a Boolean algebra
The Magic Garden Boolean Algebra
- B is F (set of
flowers)
- 0 is a flower that is always(*) blue
- 1 is a flower that is always(*) red (*assuming
|F|=2|D|)
- ⫬a is the flower that is
red on those days where a is blue
and blue on those days where a is
red
- △ is the flower that is red only on those days where
both its operands are red , otherwise blue
- ▽ is the flower that is red whenever one or more of
its operands are red , otherwise blue
- The (partial) order relation is: a flower a is smaller or
equal than a flower b if on all days where b is
blue,
a is also blue
- Hasse diagram for 32 flowers: BAgarden.svg
Answers to Magic Garden Quiz
- The size of a finite Boolean algebra is 2n, hence
200<|F|<500 → |F|=256=28;
min(|D|)=8
- Question 1: How many flowers does the garden have? 256
- Question 2: What is the minimum of days that the flowers bloom? 8 days (dimension of this Boolean
algebra)
- Question 3: Who is George B.? George Boole, after
which Boolean algebra is named
Summary
- Boolean algebra is (an example of) an algebraic structure
- Boolean algebras have one set (B), two special elements
(0 and 1), and three operations (⫬,
△, and ▽)
- The axioms of boolean algebra are the same as the axioms of basic logic;
there are various choices with tradeoffs between obviousness and
compactness
- Boolean algebras are (partial) orders and lattices
- There are many examples of Boolean algebras: basic logic (with logic
operations), bit strings (with bitwise logic operations), powersets (with
set operations), certain sets of integers (with divisibility), gardens with
flowers,...
- All finite Boolean algebras are of size 2n, and are
isomorphic to an n-dimensional cube
Homework
Deadline: December 22, 2022 (Thursday), 18:40.
Format: A4 single page (using both sides is okay; NO cover
page), easily readable handwriting (NO printouts), name (kanji
and kana) and student number at the top right
Where to submit: Box in front of room O-529 (building O, 5th floor)
Draw the Hasse diagram of a Boolean algebra of dimension 4 (16 elements).
There will be a deduction if you use the same elements as another student.
Additional Homework (no need to submit): Prepare for final exam using past
exams.
Additional Homework (no need to submit): Which Boolean function makes a
group out of any Boolean algebra?
Glossary
- coverage
- (試験) 範囲
- cyclic group
- 巡回群
- Klein four-group
- クラインの四元群
- Abelian group
- アベル群、可換群
- semigroup
- 半群
- ring
- 環 (かん)
- polynomial
- 多項式
- field
- 体 (たい)
- lattice
- 束 (そく)
- Boolean algebra
- ブール代数
- zero element
- 零元
- unary operation
- 単項演算
- binary operation
- 二項演算
- bitwise operation
- ビット毎演算
- bitwise not
- ビット毎否定
- bitwise and
- ビット毎論理積
- bitwise or
- ビット毎論理和
- bitwise xor (exclusive or)
- ビット毎排他的又は
- coprime
- 互いに素
- greatest common divisor
- 最大公約数
- least common multiple
- 最小公倍数
- coprime
- 互いに素
- pairwise coprime
- 対ごとに素、どの二つも互いに素
- n-dimensional
- n 次元 (の)
- cube
- 立方体
- supremum (least upper bound)
- 上限、最小上界
- infimum (greatest lower bound)
- 下限、最大下界