Boolean Algebra
(ブール代数)
Discrete Mathematics I
12th lecture, Dec. 19, 2014
http://www.sw.it.aoyama.ac.jp/2014/Math1/lecture12.html
Martin J. Dürst
© 2005-14 Martin
J. Dürst Aoyama Gakuin
University
Today's Schedule
- Remaining schedule
- Summary and homework for last lecture
- Boolean algebra
- Examples of boolean algebras
- Bitstrings and Bitwise Operations
- Structure of Boolean algebras
Remaining Schedule
- 1月 9日: 13th lecture
- 1月16日: 14th lecture
- 1月23日 (makeup class): 15th
lecture
- 1月27日~2月3日: Final exams
About makeup classes: The material in the makeup class is part of the final
exam. If you have another makeup class at the same time, please inform the
teacher as soon as possible.
補講について:
補講の内容は期末試験の対象。補講が別の補講とぶつかる場合には事前に申し出ること。
Final Exam・期末試験
- Coverage:
- Complete contents of lecture and handouts
- Past exams: 2005,
2006,
2007,
2008, 2009, 2010, 2011, 2012, 2013
- How to view example solutions:
- Use Opera 12.17 (Windows/Mac/Linux)
For Google Chrome, install Style
Chooser
For Firefox, install Context
Style Switcher
Select solutions style (e.g. View → Style →
solutions)
Some solutions are missing
- Important points:
- 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 a sets with operations and axioms
- Examples of algebraic structures are:
Groups, Abelian groups, semigroups, rings, fields, latices
- Groups have one binary operation which is associative, and has an unit
element and inverse elements
- Examples of groups are (ℤ, +), (ℝ-{0}, ·), (ℝ+, ·),
and symmetric groups of order n (permutations of n
elements with composition)
Create a table of the symmetric group of order 3. Structure the table so
that it looks like a multiplication table, with a row and a column for each
permutation. Use lexical order for the permutations. (Use the row headings as
the left operand, the column headings as the right operand.)
[都合により削除]
Group Isomorphism
- Two groups (G, •) and (H, ∘) are
isomorphic if there is a function f so that:
- ∀g1,
g2∈G:g1≠g2
→
f(g1)≠f(g2)
- ∀h∈H: ∃g∈G:
h = f(g)
- ∀g1, g2∈G:
f(g1•g2) =
f(g1)∘f(g2)
- If two groups are isomorphic, they have the same number of elements
(|G|=|H|)
- They have the same structure
- From a mathematical viewpoint, they can be considered to be the
same
- Example 1: (ℝ, +) is isomorphic to (ℝ+, ·), with
f(x) = ax
(a>1)
- Example 2: Three isomorphic groups
G |
e |
a |
b |
e |
e |
a |
b |
a |
a |
b |
e |
b |
b |
e |
a |
K |
0 |
2 |
1 |
0 |
0 |
2 |
1 |
2 |
2 |
1 |
0 |
1 |
1 |
0 |
2 |
H |
0 |
1 |
2 |
0 |
0 |
1 |
2 |
1 |
1 |
2 |
0 |
2 |
2 |
0 |
1 |
Boolean Algebra
- A Boolean algebra is an algebraic structure
- B = (B, 0, 1,
¬, △, ▽) is a Boolean algebra if it meets the
following conditions:
- 0 ∈ B, 1 ∈
B (1 is called unit element,
0 is called zero element)
- ¬ is an unary operation onB, △ 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
- Definition (operations, axioms) can be simplified
Comments on Boolean Algebra
- Symbols such as 0, 1,
¬ (bold) are abstract and don't have any concrete
meaning
- A Boolean algebra is a (partial) order and a lattice
- Boolean algebra a general concept covering logical operations, set
operations, and some (partial) order
Example of Boolean Algebra:
Basic Logic
- B is the set {false, true}
- 0 is false
- 1 is true
- ¬ is negation (logical not)
- △ is conjunction (logical and)
- ▽ is disjunction (logical or)
- The (partial) order relation is false<true
- Hasse diagram: BAbasic_logic.svg
Example of Boolean Algebra:
A Powerset with Set Operations
- B is the powerset of a (finite) set 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.
- Bitwise operations are bitwise logic operations.
- Bitwise not: ¬ is applied to each bit (
~
in C)
- Bitwise and: ∧ is applied to bits in the same position
(
&
in C)
- Bitwise or: ∨ is applied to bits in the same position (
|
in C)
- Bitwise xor: XOR is applied to bits in the same position (
^
in C)
Example of Boolean Algebra:
Bitstrings and Bitwise Operations
- B is the set of all the bit strings of
length n
- 0 is the bit string of length
n with all bits set to 0
- 1 is the bit string of length
n with all bits set to 1
- ¬ 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
↔a has a 0 bit in at least those positions where b
has a 0 bit.
- Hasse diagram for bit strings of length 4: BAbitstrings.svg
Example of Boolean Algebra:
Integers and Divisibility
- B is formed by taking a set of
n distinct integers >1 and all the multiples that include or
exclude each of the integers
- 0 is 1
- 1 is the product of all the
original n integers
- ¬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
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)
- All boolean algebras of dimension n are isomorphic
- 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)}
Axioms for Boolean Algebra
The axioms for Boolean algebra 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 Algebra by trying to find all objects that conform to
these axioms.
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? 256
- Question 2: What is the minimum of days that the flowers bloom? 8 days
- Question 3: Who is George B.? George Boole, after
which Boolean algebra is named
How to Solve the Magic Garden Puzzle
- Let red stand for 1, blue for 0
- Let a day be a bit position
- Let a 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 logical operation can be defined based on bitwise NOR, all
logical operations are defined
- The flowers therefore form a Boolean algebra:
- B is F (set of
flowers)
- 0 is a flower that is
always(*) red
- 1 is a flower that is
always(*) blue (*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 blue
only on thosel days where both its operands are blue, otherwise
red
- ▽ is the flower that is blue
whenever one or more of its operands are blue, otherwise red
- The (partial) order relation is: a flower
a is smaller or equal than a flower b if on all
days where b is red, a is also red
- Hasse diagram for 32 flowers: BAgarden.svg
- The size of a finite Boolean algebra is 2n, hence
200<|F|<500 → |F|=256=28;
min(|D|)=8
This Week's Homework
Deadline: January 8, 2015 (Thursday), 19:00.
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)
Homework 1: 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.
Homework 2: Draw the Hasse diagram of a Boolean algebra of order 4 (16
elements). There will be a deduction if you use the same elements of the group
as another student.
Homework 3 (don't submit): Prepare for final exam using past exams.
Glossary
- coverage
- 試験範囲
- necessary condition
- 必要条件
- sufficient condition
- 十分条件
- group isomorphism
- 群同形
- isomorphic
- 同形の、同型の
- Boolean algebra
- ブール代数
- zero element
- 零元
- unary operation
- 単項演算
- binary operation
- 二項演算
- bitwise operation
- ビット毎演算
- bitwise not
- ビット毎否定
- bitwise and
- ビット毎論理積
- bitwise or
- ビット毎論理和
- bitwise xor (exclusive or)
- ビット毎排他的又は
- greatest common divisor
- 最大公約数
- least common multiple
- 最小公倍数
- n-dimensional
- n 次元 (の)
- cube
- 立方体