Optimal Storage of Combinatorial State Spaces Alfons Laarman ( - - PowerPoint PPT Presentation
Optimal Storage of Combinatorial State Spaces Alfons Laarman ( - - PowerPoint PPT Presentation
Optimal Storage of Combinatorial State Spaces Alfons Laarman ( alfons@laarman.com ) Theory Group, LIACS . 1 / 25 Optimal Storage of Combinatorial State Spaces Optimal Compression u u + w + k Uncompressed Information Theory This
Optimal Storage of Combinatorial State Spaces
2 / 25
Optimal Compression
u k +ǫ u +ǫ w Uncompressed Information Theory This paper
Optimal Storage of Combinatorial State Spaces
3 / 25
Model Checking
Optimal Storage of Combinatorial State Spaces
4 / 25
Enumerative Model Checking
Example (Peterson mutex protocol)
1
bool flag[2] = {0,0};
2
bool turn = 0;
1
flag[0] = 1;
2
turn = 1;
3
!flag[1] || turn==0; /* critical section */
4
flag[0] = 0; goto 1;
1
flag[1] = 1;
2
turn = 0;
3
!flag[0] || turn==1; /* critical section */
4
flag[1] = 0; goto 1;
Transition System (S,I,δ)
Optimal Storage of Combinatorial State Spaces
4 / 25
Enumerative Model Checking
Example (Peterson mutex protocol)
1
bool flag[2] = {0,0};
2
bool turn = 0;
1
flag[0] = 1;
2
turn = 1;
3
!flag[1] || turn==0; /* critical section */
4
flag[0] = 0; goto 1;
1
flag[1] = 1;
2
turn = 0;
3
!flag[0] || turn==1; /* critical section */
4
flag[1] = 0; goto 1;
Transition System (S,I,δ)
- S : pc1,pc2,flag[0],flag[1],turn
Optimal Storage of Combinatorial State Spaces
4 / 25
Enumerative Model Checking
Example (Peterson mutex protocol)
1
bool flag[2] = {0,0};
2
bool turn = 0;
1
flag[0] = 1;
2
turn = 1;
3
!flag[1] || turn==0; /* critical section */
4
flag[0] = 0; goto 1;
1
flag[1] = 1;
2
turn = 0;
3
!flag[0] || turn==1; /* critical section */
4
flag[1] = 0; goto 1;
Transition System (S,I,δ)
- S : pc1,pc2,flag[0],flag[1],turn
- I := {1,1,0,0,0}
Optimal Storage of Combinatorial State Spaces
4 / 25
Enumerative Model Checking
Example (Peterson mutex protocol)
1
bool flag[2] = {0,0};
2
bool turn = 0;
1
flag[0] = 1;
2
turn = 1;
3
!flag[1] || turn==0; /* critical section */
4
flag[0] = 0; goto 1;
1
flag[1] = 1;
2
turn = 0;
3
!flag[0] || turn==1; /* critical section */
4
flag[1] = 0; goto 1;
Transition System (S,I,δ)
- S : pc1,pc2,flag[0],flag[1],turn
- I := {1,1,0,0,0}
- Defining δ:
- δ(1,1,0,0,0) =
Optimal Storage of Combinatorial State Spaces
4 / 25
Enumerative Model Checking
Example (Peterson mutex protocol)
1
bool flag[2] = {0,0};
2
bool turn = 0;
1
flag[0] = 1;
2
turn = 1;
3
!flag[1] || turn==0; /* critical section */
4
flag[0] = 0; goto 1;
1
flag[1] = 1;
2
turn = 0;
3
!flag[0] || turn==1; /* critical section */
4
flag[1] = 0; goto 1;
Transition System (S,I,δ)
- S : pc1,pc2,flag[0],flag[1],turn
- I := {1,1,0,0,0}
- Defining δ:
- δ(1,1,0,0,0) = {2,1,1,0,0,1,2,0,1,0}
- δ(2,1,1,0,0) = ..., etc
Optimal Storage of Combinatorial State Spaces
5 / 25
Enumerative Model Checking
1,1,0,0,0
peterson(i ∈ {0,1})
1 flag[i] = 1; 2 turn = 1 − i; 3 !flag[1 − i] || turn==i; / critical section / 4 flag[i] = 0; goto 1;
Reachability from I := {1,1,0,0,0}
- S : pc1,pc2,flag[0],flag[1],turn
Optimal Storage of Combinatorial State Spaces
5 / 25
Enumerative Model Checking
1,1,0,0,0 2,1,1,0,0 1,2,1,0,0
peterson(i ∈ {0,1})
1 flag[i] = 1; 2 turn = 1 − i; 3 !flag[1 − i] || turn==i; / critical section / 4 flag[i] = 0; goto 1;
Reachability from I := {1,1,0,0,0}
- S : pc1,pc2,flag[0],flag[1],turn
Optimal Storage of Combinatorial State Spaces
5 / 25
Enumerative Model Checking
1,1,0,0,0 2,1,1,0,0 1,2,1,0,0 3,1,1,0,1 2,2,1,1,0 1,3,0,1,0 4,1,1,0,1 1,4,0,1,0 3,2,1,1,1 2,3,1,1,0 4,2,1,1,1 2,4,1,1,0 3,3,1,1,1 3,3,1,1,0 3,4,1,1,1 4,3,1,1,0
peterson(i ∈ {0,1})
1 flag[i] = 1; 2 turn = 1 − i; 3 !flag[1 − i] || turn==i; / critical section / 4 flag[i] = 0; goto 1;
Reachability from I := {1,1,0,0,0}
- S : pc1,pc2,flag[0],flag[1],turn
Optimal Storage of Combinatorial State Spaces
5 / 25
Enumerative Model Checking
1,1,0,0,0 2,1,1,0,0 1,2,1,0,0 3,1,1,0,1 2,2,1,1,0 1,3,0,1,0 4,1,1,0,1 1,4,0,1,0 3,2,1,1,1 2,3,1,1,0 4,2,1,1,1 2,4,1,1,0 3,3,1,1,1 3,3,1,1,0 3,4,1,1,1 4,3,1,1,0
peterson(i ∈ {0,1})
1 flag[i] = 1; 2 turn = 1 − i; 3 !flag[1 − i] || turn==i; / critical section / 4 flag[i] = 0; goto 1;
Reachability from I := {1,1,0,0,0}
- S : pc1,pc2,flag[0],flag[1],turn
- Reachability from I
- Check invariant ϕ ¬(pc1 = pc2 = 4)
Optimal Storage of Combinatorial State Spaces
5 / 25
Enumerative Model Checking
1,1,0,0,0 2,1,1,0,0 1,2,1,0,0 3,1,1,0,1 2,2,1,1,0 1,3,0,1,0 4,1,1,0,1 1,4,0,1,0 3,2,1,1,1 2,3,1,1,0 4,2,1,1,1 2,4,1,1,0 3,3,1,1,1 3,3,1,1,0 3,4,1,1,1 4,3,1,1,0
peterson(i ∈ {0,1})
1 flag[i] = 1; 2 turn = 1 − i; 3 !flag[1 − i] || turn==i; / critical section / 4 flag[i] = 0; goto 1;
Reachability from I := {1,1,0,0,0}
- S : pc1,pc2,flag[0],flag[1],turn
- Reachability from I
- Check invariant ϕ ¬(pc1 = pc2 = 4)
- Also: LTL, CTL, modal µ-calculus, etc
Optimal Storage of Combinatorial State Spaces
6 / 25
Locality in Model Checking
Example (Peterson)
1 flag[i] = 1; 2 turn = 1 − i; 3 !flag[1 − i] || turn==i; / critical section / 4 flag[i] = 0; goto 1;
1 1 0 0 0 2 1 1 0 0 3 1 1 0 1 4 1 1 0 1 1 1 0 0 1
Optimal Storage of Combinatorial State Spaces
6 / 25
Locality in Model Checking
Example (Peterson)
1 flag[i] = 1; 2 turn = 1 − i; 3 !flag[1 − i] || turn==i; / critical section / 4 flag[i] = 0; goto 1;
1 1 0 0 0 2 1 1 0 0 3 1 1 0 1 4 1 1 0 1 1 1 0 0 1
Observations
- Locality
Optimal Storage of Combinatorial State Spaces
6 / 25
Locality in Model Checking
Example (Peterson)
1 flag[i] = 1; 2 turn = 1 − i; 3 !flag[1 − i] || turn==i; / critical section / 4 flag[i] = 0; goto 1;
1 1 0 0 0 2 1 1 0 0 3 1 1 0 1 4 1 1 0 1 1 1 0 0 1
Observations
- Locality
- Combinatorial
(Similar vectors of size k · u bit)
Optimal Storage of Combinatorial State Spaces
7 / 25
Analysis of Compression Potential
Optimal Storage of Combinatorial State Spaces
8 / 25
Claude Shannon (1916 — 2001)
“Father of Information Theory”
Optimal Storage of Combinatorial State Spaces
9 / 25
Information Theory Refresher
Information Entropy
- Encoding a random English text takes log2(±30) bit/char
Optimal Storage of Combinatorial State Spaces
9 / 25
Information Theory Refresher
Information Entropy
- Encoding a random English text takes log2(±30) bit/char
- How some characters occur more frequent than others
- Idea: use shorter bit patterns to encode frequent characters
Optimal Storage of Combinatorial State Spaces
9 / 25
Information Theory Refresher
Information Entropy
- Encoding a random English text takes log2(±30) bit/char
- How some characters occur more frequent than others
- Idea: use shorter bit patterns to encode frequent characters
- H(A) = −Σα∈Ap(α)log2(p(α)) bits
Optimal Storage of Combinatorial State Spaces
10 / 25
Optimum Compression
1,1,0,0,0,0 1,2,0,0,0,0 1,2,0,1,2,0
Information theoretical lower bound
- View states as stream:
- v1
1,...v1 K
- ,
- v2
1,...v2 K
- ,...
Optimal Storage of Combinatorial State Spaces
10 / 25
Optimum Compression
1,1,0,0,0,0 1,2,0,0,0,0 1,2,0,1,2,0 p( 1
k )
p( k−1
k )
Information theoretical lower bound
- View states as stream:
- v1
1,...v1 K
- ,
- v2
1,...v2 K
- ,...
- p(vi
j vi−1 j
) = 1
k
(locality!)
- p(vi
j = vi−1 j
) = k−1
k
Optimal Storage of Combinatorial State Spaces
10 / 25
Optimum Compression
1,1,0,0,0,0 1,2,0,0,0,0 1,2,0,1,2,0 p( 1
k )
p( k−1
k )
Information theoretical lower bound
- View states as stream:
- v1
1,...v1 K
- ,
- v2
1,...v2 K
- ,...
- p(vi
j vi−1 j
) = 1
k
(locality!)
- p(vi
j = vi−1 j
) = k−1
k
- Entropy per state ≈ u + log2(k) + ǫ bits
Optimal Storage of Combinatorial State Spaces
10 / 25
Optimum Compression
1,1,0,0,0,0 1,2,0,0,0,0 1,2,0,1,2,0 p( 1
k )
p( k−1
k )
Information theoretical lower bound
- View states as stream:
- v1
1,...v1 K
- ,
- v2
1,...v2 K
- ,...
- p(vi
j vi−1 j
) = 1
k
(locality!)
- p(vi
j = vi−1 j
) = k−1
k
- Entropy per state ≈ u + log2(k) + ǫ bits
- Store differences as new-value (u) × location (log2(k)):
1,1,0,0,0,0 2@1 1@3,2@4
Optimal Storage of Combinatorial State Spaces
10 / 25
Optimum Compression
1,1,0,0,0,0 1,2,0,0,0,0 1,2,0,1,2,0 p( 1
k )
p( k−1
k )
Information theoretical lower bound
- View states as stream:
- v1
1,...v1 K
- ,
- v2
1,...v2 K
- ,...
- p(vi
j vi−1 j
) = 1
k
(locality!)
- p(vi
j = vi−1 j
) = k−1
k
- Entropy per state ≈ u + log2(k) + ǫ bits
- Store differences as new-value (u) × location (log2(k)):
1,1,0,0,0,0 2@1 1@3,2@4
- Yields O(n2) data structure
[Evangelista et al. — ATVA’13]
Optimal Storage of Combinatorial State Spaces
11 / 25
Tree Compression
Optimal Storage of Combinatorial State Spaces
12 / 25
Tree Compression Idea
1 0 0 0 0 0 2 0 0 0 0 0
n−1 0 0
0 0 0 n 0 0 0 0 0 u u u u u k 1 2
n−1
n × 0 0 0 0 0 − →
Best-case compression
- Ω(n · k · u)
vs Ω(n · u)
Optimal Storage of Combinatorial State Spaces
12 / 25
Tree Compression Idea
1 0 0 0 0 0 2 0 0 0 0 0
n−1 0 0
0 0 0 n 0 0 0 0 0 u u u u u k 1 2
n−1
n × 0 0 0 0 0 − → 1 0 2 0
n−1 0
n 0 0 0 0 0 0
Best-case compression
- Ω(n · k · u)
vs Ω(n · u)
Optimal Storage of Combinatorial State Spaces
13 / 25
Tree Compression
Inserting a vector in the tree
- Fold vectors in binary tree
- Propagate hashed tuples back up
3,5,5,4,1,3
Optimal Storage of Combinatorial State Spaces
13 / 25
Tree Compression
Inserting a vector in the tree
- Fold vectors in binary tree
- Propagate hashed tuples back up
3,5,5,4,1,3 3,5,5 4,1,3
Optimal Storage of Combinatorial State Spaces
13 / 25
Tree Compression
Inserting a vector in the tree
- Fold vectors in binary tree
- Propagate hashed tuples back up
3,5,5,4,1,3 3,5,5 4,1,3 3,5 4,1
Optimal Storage of Combinatorial State Spaces
13 / 25
Tree Compression
Inserting a vector in the tree
- Fold vectors in binary tree
- Propagate hashed tuples back up
3,5,5,4,1,3 3 5 4 1 3,5,5 4,1,3 3,5 4,1
Optimal Storage of Combinatorial State Spaces
13 / 25
Tree Compression
Inserting a vector in the tree
- Fold vectors in binary tree
- Propagate hashed tuples back up
3,5,5,4,1,3 5 3 3 5 4 1 3,5,5 4,1,3 3,5 4,1
Optimal Storage of Combinatorial State Spaces
13 / 25
Tree Compression
Inserting a vector in the tree
- Fold vectors in binary tree
- Propagate hashed tuples back up
3,5,5,4,1,3 6 5 1 3 3 5 4 1 3,5,5 4,1,3 3,5 4,1
Optimal Storage of Combinatorial State Spaces
13 / 25
Tree Compression
Inserting a vector in the tree
- Fold vectors in binary tree
- Propagate hashed tuples back up
3,5,5,4,1,3 2 5 6 5 1 3 3 5 4 1 3,5,5 4,1,3 3,5 4,1
Optimal Storage of Combinatorial State Spaces
14 / 25
Tree Compression
5 1 2 1 2 1 2 1 2 1 1 1 2 2 2 1 1 1 1 1 1 6 8 5 6 6 8 5 5 8 4 3 3 4 3 3 4 3 3 4 3 3 5 4 5 5 4 5 5 4 5 5 4 4 4 4 4 4 4 4 4 4 1 4 4 4 5 5 5 6 6 6 3 3 3 3 3 3 5 6 1 1 2 3 3 5 6 8
O(n · k) Ω(2n · (k − 1))
Optimal Storage of Combinatorial State Spaces
14 / 25
Tree Compression
5 1 2 1 2 1 2 1 2 1 1 1 2 2 2 1 1 1 1 1 1 6 8 5 6 6 8 5 5 8 4 3 3 4 3 3 4 3 3 4 3 3 5 4 5 5 4 5 5 4 5 5 4 4 4 4 4 4 4 4 4 4 1 4 4 4 5 5 5 6 6 6 3 3 3 3 3 3 5 6 1 1 2 3 3 5 6 8
O(n · k) Ω(2n · (k − 1)) n √n √n
Optimal Storage of Combinatorial State Spaces
14 / 25
Tree Compression
5 1 2 1 2 1 2 1 2 1 1 1 2 2 2 1 1 1 1 1 1 6 8 5 6 6 8 5 5 8 4 3 3 4 3 3 4 3 3 4 3 3 5 4 5 5 4 5 5 4 5 5 4 4 4 4 4 4 4 4 4 4 1 4 4 4 5 5 5 6 6 6 3 3 3 3 3 3 5 6 1 1 2 3 3 5 6 8
O(n · k) Ω(2n · (k − 1)) n √n √n
Compression
✓ Combinatorial ⇒ balanced tree (n + 2√n + 4 4
- (n)··· ≈ n tuples)
Optimal Storage of Combinatorial State Spaces
14 / 25
Tree Compression
5 1 2 1 2 1 2 1 2 1 1 1 2 2 2 1 1 1 1 1 1 6 8 5 6 6 8 5 5 8 4 3 3 4 3 3 4 3 3 4 3 3 5 4 5 5 4 5 5 4 5 5 4 4 4 4 4 4 4 4 4 4 1 4 4 4 5 5 5 6 6 6 3 3 3 3 3 3 5 6 1 1 2 3 3 5 6 8
O(n · k) Ω(2n · (k − 1)) n √n √n
Compression
✓ Combinatorial ⇒ balanced tree (n + 2√n + 4 4
- (n)··· ≈ n tuples)
✓ Can compresses states of length k to almost 2 · w bits! (w bits for pointers)
Optimal Storage of Combinatorial State Spaces
14 / 25
Tree Compression
5 1 2 1 2 1 2 1 2 1 1 1 2 2 2 1 1 1 1 1 1 6 8 5 6 6 8 5 5 8 4 3 3 4 3 3 4 3 3 4 3 3 5 4 5 5 4 5 5 4 5 5 4 4 4 4 4 4 4 4 4 4 1 4 4 4 5 5 5 6 6 6 3 3 3 3 3 3 5 6 1 1 2 3 3 5 6 8
O(n · k) Ω(2n · (k − 1)) n √n √n
Compression
✓ Combinatorial ⇒ balanced tree (n + 2√n + 4 4
- (n)··· ≈ n tuples)
✓ Can compresses states of length k to almost 2 · w bits! (w bits for pointers) ✗ What about access times?
Optimal Storage of Combinatorial State Spaces
15 / 25
Incremental Tree Compression
[Laarman, van de Pol, Weber spin11]
Incremental insertion
- Fold vectors in binary tree
3,5,5,4,1,3
Optimal Storage of Combinatorial State Spaces
15 / 25
Incremental Tree Compression
[Laarman, van de Pol, Weber spin11]
Incremental insertion
- Fold vectors in binary tree
3,5,5,4,1,3 3,5,5 4,1,3
Optimal Storage of Combinatorial State Spaces
15 / 25
Incremental Tree Compression
[Laarman, van de Pol, Weber spin11]
Incremental insertion
- Fold vectors in binary tree
3,5,5,4,1,3 3,5,5 4,1,3 3,5 4,1
Optimal Storage of Combinatorial State Spaces
15 / 25
Incremental Tree Compression
[Laarman, van de Pol, Weber spin11]
Incremental insertion
- Fold vectors in binary tree
- Propagate hashed tuples back up
3,5,5,4,1,3 3 5 4 1 3,5,5 4,1,3 3,5 4,1
Optimal Storage of Combinatorial State Spaces
15 / 25
Incremental Tree Compression
[Laarman, van de Pol, Weber spin11]
Incremental insertion
- Fold vectors in binary tree
- Propagate hashed tuples back up
3,5,5,4,1,3 5 3 3 5 4 1 3,5,5 4,1,3 3,5 4,1
Optimal Storage of Combinatorial State Spaces
15 / 25
Incremental Tree Compression
[Laarman, van de Pol, Weber spin11]
Incremental insertion
- Fold vectors in binary tree
- Propagate hashed tuples back up
3,5,5,4,1,3 6 5 1 3 3 5 4 1 3,5,5 4,1,3 3,5 4,1
Optimal Storage of Combinatorial State Spaces
15 / 25
Incremental Tree Compression
[Laarman, van de Pol, Weber spin11]
Incremental insertion
- Fold vectors in binary tree
- Propagate hashed tuples back up
3,5,5,4,1,3 2 5 6 5 1 3 3 5 4 1 3,5,5 4,1,3 3,5 4,1
Optimal Storage of Combinatorial State Spaces
15 / 25
Incremental Tree Compression
[Laarman, van de Pol, Weber spin11]
Incremental insertion
- Fold vectors in binary tree
- Propagate hashed tuples back up
- Incremental updates: (K − 1) → log2(K − 1) lookups
3,5,5,4,1,3 2 5 6 5 1 3 3 5 4 1 3,5,5 4,1,3 3,5 4,1
Optimal Storage of Combinatorial State Spaces
15 / 25
Incremental Tree Compression
[Laarman, van de Pol, Weber spin11]
Incremental insertion
- Fold vectors in binary tree
- Propagate hashed tuples back up
- Incremental updates: (K − 1) → log2(K − 1) lookups
3,5,5,4,1,3 3,5,9,4,1,3 2 5 6 5 1 3 3 5 4 1 3,5,5 4,1,3 3,5 4,1
Optimal Storage of Combinatorial State Spaces
15 / 25
Incremental Tree Compression
[Laarman, van de Pol, Weber spin11]
Incremental insertion
- Fold vectors in binary tree
- Propagate hashed tuples back up
- Incremental updates: (K − 1) → log2(K − 1) lookups
3,5,5,4,1,3 3,5,9,4,1,3 2 5 6 5 1 3 3 5 4 1 3,5,5 4,1,3 3,5 4,1 ? 5 6 9
Optimal Storage of Combinatorial State Spaces
16 / 25
Compact Tree Compression
Optimal Storage of Combinatorial State Spaces
17 / 25
Compact Tree Idea
2 2 1 2 2 1 1 1
Idea: store the universe of tuples in tree compactly
- log2(|U|) = 2w
(internal pointers)
Optimal Storage of Combinatorial State Spaces
17 / 25
Compact Tree Idea
2 2 1 2 2 1 1 1 n
Idea: store the universe of tuples in tree compactly
- log2(|U|) = 2w
(internal pointers)
Optimal Storage of Combinatorial State Spaces
17 / 25
Compact Tree Idea
2 2 1 2 2 1 1 1 n √n ≤ L ≤ n √n ≤ R ≤ n
Idea: store the universe of tuples in tree compactly
- log2(|U|) = 2w
(internal pointers)
Optimal Storage of Combinatorial State Spaces
17 / 25
Compact Tree Idea
2 2 1 2 2 1 1 1 n √n ≤ L ≤ n √n ≤ R ≤ n log2(L · R)
Idea: store the universe of tuples in tree compactly
- log2(|U|) = 2w
(internal pointers)
Optimal Storage of Combinatorial State Spaces
17 / 25
Compact Tree Idea
2 2 1 2 2 1 1 1 n √n ≤ L ≤ n √n ≤ R ≤ n log2(L · R)
Idea: store the universe of tuples in tree compactly
- log2(|U|) = 2w
(internal pointers)
- |U| = L · R
Optimal Storage of Combinatorial State Spaces
17 / 25
Compact Tree Idea
2 2 1 2 2 1 1 1 n √n ≤ L ≤ n √n ≤ R ≤ n log2(L · R)
Idea: store the universe of tuples in tree compactly
- log2(|U|) = 2w
(internal pointers)
- |U| = L · R
- n ≤ |U| ≤ n2
Optimal Storage of Combinatorial State Spaces
17 / 25
Compact Tree Idea
2 2 1 2 2 1 1 1 n √n ≤ L ≤ n √n ≤ R ≤ n log2(L · R)
Idea: store the universe of tuples in tree compactly
- log2(|U|) = 2w
(internal pointers)
- |U| = L · R
- n ≤ |U| ≤ n2
- Can still be larger than optimal: 2w > u + log2(k) + ǫ
Optimal Storage of Combinatorial State Spaces
18 / 25
Storing Tuples for log2(|U|) ∈ O(log2(n))
[Cleary ’84] [Geldenhuys, Valmari – spin’03][vdVegt, Laarman – memics’11]
Keys K |K| ≤ |T | ≤ |U| Universe U |U| = 2x k1 k2 k3 k4 r1 r3 r4 r2 q(k1) q ( k2 ) q ( k3 ) q ( k4 ) ∀i : ri = rem(ki) ∀i : ki = ri · |T | + q(ki) Cleary table T b = r + 3 2m
- Cleary compact table ‘splits’ keys into quotient & remainder
- Quotient is used to hash (therefore is log2(|T|) bit)
Optimal Storage of Combinatorial State Spaces
18 / 25
Storing Tuples for log2(|U|) ∈ O(log2(n))
[Cleary ’84] [Geldenhuys, Valmari – spin’03][vdVegt, Laarman – memics’11]
Keys K |K| ≤ |T | ≤ |U| Universe U |U| = 2x k1 k2 k3 k4 r1 r3 r4 r2 q(k1) q ( k2 ) q ( k3 ) q ( k4 ) ∀i : ri = rem(ki) ∀i : ki = ri · |T | + q(ki) Cleary table T b = r + 3 2m
- Cleary compact table ‘splits’ keys into quotient & remainder
- Quotient is used to hash (therefore is log2(|T|) bit)
- Only remainder is stored (r = log2(|U|) − log2(|T|) bit)
(additionally, 3 administration bits are needed to resolve collisions.)
Optimal Storage of Combinatorial State Spaces
18 / 25
Storing Tuples for log2(|U|) ∈ O(log2(n))
[Cleary ’84] [Geldenhuys, Valmari – spin’03][vdVegt, Laarman – memics’11]
Keys K |K| ≤ |T | ≤ |U| Universe U |U| = 2x k1 k2 k3 k4 r1 r3 r4 r2 q(k1) q ( k2 ) q ( k3 ) q ( k4 ) ∀i : ri = rem(ki) ∀i : ki = ri · |T | + q(ki) Cleary table T b = r + 3 2m
- Cleary compact table ‘splits’ keys into quotient & remainder
- Quotient is used to hash (therefore is log2(|T|) bit)
- Only remainder is stored (r = log2(|U|) − log2(|T|) bit)
(additionally, 3 administration bits are needed to resolve collisions.)
- In practice, compression from 2w up to w
(i.e., often close to optimal)
Optimal Storage of Combinatorial State Spaces
19 / 25
Theorem about compression
1 k +ǫ 1 +ǫ
u w−o+7
Uncompressed Information Theory This paper
Theorem
Let Treeopt be the best-case compact-tree compressed vector sizes. We have Treeopt ≤ w−o+7
u
Entropy provided 8 ≤ k ≤
4
√n + 4.
Optimal Storage of Combinatorial State Spaces
20 / 25
Experiments [±500 models]
Language Models DVE All benchmarks from the BEEM database Promela All SPIN case studies, e.g.: GARP/i/x509/BRP protocols, etc Petri nets Subset from MCC 2016 competition also considered by [Jensen et al. NASA FM’17] mcrl2 process algebra Several industrial case studies
Model Checkers
- LTSmin
[Kant, Laarman, et al. – TACAS’15]
- SPIN, only Promela
[Holzmann ’97]
- verifypn
[Jensen et al. NASA FM’17]
Optimal Storage of Combinatorial State Spaces
20 / 25
Experiments [±500 models]
Language Models DVE All benchmarks from the BEEM database Promela All SPIN case studies, e.g.: GARP/i/x509/BRP protocols, etc Petri nets Subset from MCC 2016 competition also considered by [Jensen et al. NASA FM’17] mcrl2 process algebra Several industrial case studies
Model Checkers
- LTSmin
[Kant, Laarman, et al. – TACAS’15]
- SPIN, only Promela
[Holzmann ’97]
- verifypn
[Jensen et al. NASA FM’17]
Tree Configuration
- w = u = 30
- Optimal is compressed size is 4 bytes / state
Optimal Storage of Combinatorial State Spaces
21 / 25
Experiments: Compression
20 50 100 200 500 1000 5 10 15 20 25 State length (Bytes) Bytes/state (Compact Tree)
- dve
mcrl2 petrinet promela avg=6.89 min=4B
1e+04 1e+06 1e+08 1e+10 5 10 15 20 25 Number of states Bytes/state (Compact Tree)
- dve
mcrl2 petrinet promela avg=6.89 min=4B
Compression reaches information theoretic optimum
- Lossless compression up to 4 bytes / state
- Mean compression of 6.9 bytes / state
- Also for long vectors and large state spaces
Optimal Storage of Combinatorial State Spaces
22 / 25
Experiments: Compression
- ● ●●
- ●
1e+03 1e+05 1e+07 50 100 150 Number of states Compression (Bytes / state)
- SPIN
Tree
- 1e+06
5e+06 2e+07 1e+08 20 40 60 80 Number of states Compression (Bytes / state)
- Trie
Compact Tree (petrinet)
Comparison
- SPIN uses collapse compression
[Holzmann ’97]
- verifypn uses a trie
[Jensen et al. NASA FM’17]
Optimal Storage of Combinatorial State Spaces
23 / 25
Experiments: Performance
!"!#$ !"#!$ #"!!$ #!"!!$ #!!"!!$ !"!#$ !"#!$ #"!!$ #!"!!$ #!!"!!$ !"##$%&#'($$ )*&+$,*-.#$%&#'($ %&'(&)*+,$-()*.&$/0&12$ 34$15-&$-()*.&$/0&12$ 6$7$8$
Runtime performance and parallel scalability
- As fast as hash table
Optimal Storage of Combinatorial State Spaces
23 / 25
Experiments: Performance
!"!#$ !"#!$ #"!!$ #!"!!$ #!!"!!$ !"!#$ !"#!$ #"!!$ #!"!!$ #!!"!!$ !"##$%&#'($$ )*&+$,*-.#$%&#'($ %&'(&)*+,$-()*.&$/0&12$ 34$15-&$-()*.&$/0&12$ 6$7$8$ 1e−02 1e+00 1e+02 1e+04 1e−02 1e+00 1e+02 1e+04 Compact Tree 1x (sec) Concurrent Compact Tree 48x (sec)
- dve
mcrl2 petrinet promela 48x speedup equilibrium
Runtime performance and parallel scalability
- As fast as hash table
- Scalable on 48 core machine
Optimal Storage of Combinatorial State Spaces
24 / 25
Experiments: BDD Comparison
- 1e−01
1e+01 1e+03 1e−01 1e+01 1e+03 LTSmin with BDD (Bytes per state) Compact Tree (Bytes per state)
- dve
mcrl2 petrinet promela min=4B equilibrium
- 1e−01
1e+01 1e+03 1e−01 1e+01 1e+03 LTSmin with BDD (sec) Compact Tree (sec)
- dve
mcrl2 petrinet promela timeout (10h) equil.
Compact Tree vs BDDs
- BDD compression is non-linear
- Performance is input-dependent
Optimal Storage of Combinatorial State Spaces
25 / 25
“Optimal” Compression for Free
Conclusion
- “Optimal” compression for free
- Parallelizable
Optimal Storage of Combinatorial State Spaces
25 / 25
“Optimal” Compression for Free
Conclusion
- “Optimal” compression for free
- Parallelizable
Future Work
- Apply tree compression elsewhere
- Apply information theory to decision diagrams
(non-linear)
- Distributed tree with bit array