a linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf ·...

43
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A linear lower bound for incrementing a space-optimal integer representation in the bit-probe model Michael Raskin, [email protected] LaBRI, Université de Bordeaux July 13, 2017 Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 1 / 18

Upload: others

Post on 23-Mar-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

A linear lower bound for incrementing a space-optimalinteger representation in the bit-probe model

Michael Raskin, [email protected]

LaBRI, Université de Bordeaux

July 13, 2017

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 1 / 18

Page 2: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

A linear lower bound for incrementing a space-optimalinteger representation in the bit-probe model

Michael Raskin, [email protected]

LaBRI, Université de Bordeaux

This work was mostly done in Aarhus University

July 13, 2017

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 1 / 18

Page 3: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

How to count from 0 to 2n − 1 using n bits?

000, 001, 010, …Worst case (1111→0000): n reads, n writes

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 2 / 18

Page 4: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

How to count from 0 to 2n − 1 using n bits?

[Gray1953] Frank Gray. Pulse code communicationWorst case: n reads, 1 write

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 3 / 18

Page 5: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

How to count from 0 to 2n − 1 using n bits?

[BGPS2014]Gerth Stølting Brodal, Mark Greve, Vineet Pandey, Srinivasa Rao Satti.Integer Representations towards Efficient Counting in the Bit Probe ModelWorst case: n − 1 reads, 3 writes

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 4 / 18

Page 6: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

How to count from 0 to 2n − 1 using n bits?

[Gray1953] n reads, 1 write[BGPS2014] n − 1 reads, 3 writes

Can we do even better?

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 5 / 18

Page 7: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Redundant case

[RM2010] M. Ziaur Rahman, J. Ian Munro. Integer Representation andCounting in the Bit Probe Model.

One extra bit for representation, worst case: log2 n + O(1) reads, O(1)writes

(one possible idea: increment n-bit normal binary counter over n stepswith Gray-coded pointer and carry bit)

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 6 / 18

Page 8: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Previous lower bound

[FMS1997]Gudmund Skovbjerg Frandsen and Peter Bro Miltersen and Sven SkyumDynamic word problems

Cannot write unread bitsEvery bit needs to be written at some pointReading at most k bits → reading 2k − 1 distinct bits in total

Lower bound log2 n upper bound n − 1

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 7 / 18

Page 9: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

The main claim

Lower bound log2 n, upper bound n − 1

Redundant case: log2 n + O(1)

This talk: non-redundant counter needs to read at least ⌊n2⌋ bits

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 8 / 18

Page 10: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

The main claim

Lower bound log2 n, upper bound n − 1

Redundant case: log2 n + O(1)

This talk: non-redundant counter needs to read at least ⌊n2⌋ bits

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 8 / 18

Page 11: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling

Code: a vertex of the n-dimensional hypercube

Fixing some bits: a block (a hypercube of lower dimension)

Changing fixed bits: parallel translation

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 9 / 18

Page 12: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

The [BGPS2014] example

Initial representation: a decision treex0

x1 x2

x3 x3 x1 x3

x0 ← 1; x1 ← 1; x0 ← 1; x3 ← 0; x0 ← 0,x2 ← 1;

x0 ← 0,x1 ← 0;

x3 ← 1; x2 ← 0;

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 10 / 18

Page 13: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 14: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 15: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 16: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 17: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 18: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 19: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 20: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 21: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 22: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 23: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 24: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 25: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 26: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 27: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 28: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 29: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 30: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 31: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 32: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 33: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 34: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 35: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 36: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling and [BGPS2014]

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 11 / 18

Page 37: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube shuffling as a permutation

Increment is a function0 → 1 → … → 2n − 1 → 0Permutation inc on codes; a cycle of length 2n

Lexicographical order of codes (first bit is least significant bit)Inversion: x < y, σ(x) > σ(y)Permutation sign: parity of total number of inversionsPermutation inc on codes; a cycle of length 2n; and odd permutation

Enough to prove: shifting ⌈n2⌉+ 1-dimensional blocks is even permutation

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 12 / 18

Page 38: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube enumeration

Leaves of decision tree — blocks in hypercube, a partition

Two partitions: before and after the translations

Enumerating hypercube vertices: lexicographically; block-by-block,lexicographically inside block

Blocks can be before or after shift

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 13 / 18

Page 39: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Hypercube enumeration

Before(k): code of k-th vertex in enumeration block-by-block beforetranslations

After(k): code of k-th vertex in enumeration block-by-block aftertranslations

inc : Before(k) 7→ After(k).

Needed: inc = After ◦ Before−1 is even unless ⌊n2⌋ bits read in the worst

case.Enough to show Before and After are even when we read fewer than ⌊n

2⌋bits

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 14 / 18

Page 40: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Blocks and the inversions

Inside the same block: monotonous enumeration, no inversions

Different blocks A,B: need parity of number of pairs(x, y) : x > y, x ∈ A, y ∈ B

Total number is even → block order is irrelevant

Two blocks have < ⌊n2⌋ fixed coordinates each?

They share ⩾ 2 free coordinates

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 15 / 18

Page 41: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Inversions in similar pairs of codes

At least 2 common free positions.p: most significant common free position

Compare codes in the pair; classify by most significant position wherecodes differ

Case 1. More significant than p, involution: flip both at pCase 2. Less significant than p, equality at p, involution: flip both at pCase 3. Exactly p, involution: flip at less significant free position

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 16 / 18

Page 42: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Putting things together

For each block there are no inversions inside the block.For each two blocks, there is an even number of inversions between thetwo blocks.Therefore, the total number of inversions is even, and the permutation(Before or After) is even.

Therefore inc = After ◦ Before−1 is an even permutation, particularly, nota cycle of length 2n.

Therefore we need to read at least ⌊n2⌋ bits in the worst case.

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 17 / 18

Page 43: A linear lower bound for incrementing a space-optimal ...raskin/binary-counter-slides-icalp.pdf · Counting in the Bit Probe Model. One extra bit for representation, worst case: log2

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

...

.

Thanks for your attention.

Questions?

Michael Raskin, [email protected] (LaBRI) Linear lower bound for increment July 13, 2017 18 / 18