Lecture 4
Lecture 4
Dr. E. T. Tchao
Quotes about Shannon
• ”What is information? Sidestepping questions about
meaning, Shannon showed that it is a measurable
commodity”.
Noise
Example: Morse Code
telegraph wire
transmitter receiver
dots, dashes ∙─_
A, …, Z Encoding Decoding A, …, Z
spaces
keyer recognizer
shortwave radio
0.7 b
0.7 b
P(Xk+1 = a | Xk = a) = 0.3
0.7 b
P(Xk+2 = a | Xk+1 = b) = 0
• Definition:
• T is prefix-free if for any distinct x,y 2 T,
• if |x| < |y|, then x is not a prefix of y
• Example:
• {000, 001, 1, 01} is prefix-free
• {0, 01, 10, 11, 101} is not.
Prefix-free Code for S
• Let S be any set.
• If we see
• 00011011111100…
• we know it must be
• 0 0 0 110 1111 110 0 …
• and hence
• apple apple apple mango orange mango
apple …
Morse Code is not Prefix-free!
0 1 0 1
0 1 0 1
A = 100
0 1
B = 010
C = 101 0 1 0 1
D = 011
É F
É = 00 0 1 0 1
F = 11
B D A C
0 1 0 1
É 0 1 0 1 F
B D A C
• If you see: 1000101000111011001100
0 1 0 1
É 0 1 0 1 F
B D A C
• If you see: 1000101000111011001100
0 1 0 1
É 0 1 0 1 F
B D A C
• If you see: 1000101000111011001100
0 1 0 1
É 0 1 0 1 F
B D A C
• If you see: 1000101000111011001100
0 1 0 1
É 0 1 0 1 F
B D A C
• If you see: 1000101000111011001100
0 1 0 1
É 0 1 0 1 F
B D A C
0 1 0 1
É 0 1 0 1 F
B D A C
• If you see: 1000101000111011001100
0 1 0 1
É 0 1 0 1 F
B D A C
• If you see: 1000101000111011001100
0 1 0 1
É 0 1 0 1 F
B D A C
• If you see: 1000101000111011001100
Theorem:
if and only if
0 1 0 1
É F 0 1 0 1
0 1
B D A C 0 1
B D A C
É G F
H
Theorem:
if and only if
Kraft Inequality:
w2 S D-li · 1