Nested Antichains for WS1S
Tom´ aˇ s Fiedor1,2 Luk´ aˇ s Hol´ ık2
1Red Hat, Czech Republic
Ondˇ rej Leng´ al2 Tom´ aˇ s Vojnar2
2Brno University of Technology, Czech Republic
AVM’15
Nested Antichains for WS1S s Fiedor 1 , 2 k 2 Tom a Luk a s Hol - - PowerPoint PPT Presentation
Nested Antichains for WS1S s Fiedor 1 , 2 k 2 Tom a Luk a s Hol 1 Red Hat, Czech Republic al 2 s Vojnar 2 Ond rej Leng Tom a 2 Brno University of Technology, Czech Republic AVM15 WS1S weak monadic second-order
Tom´ aˇ s Fiedor1,2 Luk´ aˇ s Hol´ ık2
1Red Hat, Czech Republic
Ondˇ rej Leng´ al2 Tom´ aˇ s Vojnar2
2Brno University of Technology, Czech Republic
AVM’15
weak monadic second-order logic of one successor
◮ second-order ⇒ quantification over relations; ◮ monadic ⇒ relations are unary (i.e. sets); ◮ weak ⇒ sets are finite; ◮ of one successor ⇒ reasoning about linear structures.
corresponds to finite automata [B¨ uchi’60] decidable
Nested Antichains for WS1S AVM’15 2 / 17
weak monadic second-order logic of one successor
◮ second-order ⇒ quantification over relations; ◮ monadic ⇒ relations are unary (i.e. sets); ◮ weak ⇒ sets are finite; ◮ of one successor ⇒ reasoning about linear structures.
corresponds to finite automata [B¨ uchi’60] decidable — but NONELEMENTARY
◮ constructive proof via translation to finite automata
Nested Antichains for WS1S AVM’15 2 / 17
allows one to define rich invariants famous decision procedure: the MONA tool
◮ often efficient (in practice)
used in tools for checking structural invariants
◮ Pointer Assertion Logic Engine (PALE) ◮ STRucture ANd Data (STRAND)
many other applications
◮ program and protocol verifications, linguistics, theorem provers . . .
Nested Antichains for WS1S AVM’15 3 / 17
allows one to define rich invariants famous decision procedure: the MONA tool
◮ often efficient (in practice)
used in tools for checking structural invariants
◮ Pointer Assertion Logic Engine (PALE) ◮ STRucture ANd Data (STRAND)
many other applications
◮ program and protocol verifications, linguistics, theorem provers . . .
but sometimes the complexity strikes back
◮ unavoidable in general ◮ however, we try to push the usability border further
Nested Antichains for WS1S AVM’15 3 / 17
Syntax:
◮ term ψ ::= X ⊆ Y | Sing(X) | X = {0} | X = σ(Y) ◮ formula ϕ ::= ψ | ϕ ∧ ϕ | ϕ ∨ ϕ | ¬ϕ | ∃X.ϕ
Interpretation: over finite subsets of N
◮ models of formulae = assignments of sets to variables
sets can be encoded as binary strings:
◮ {1, 4, 5} →
Index: Membership: Encoding: 012345 xxx 010011
,
0123456 xxxx 0100110
01234567 xxxxx 01001100
. . .
for each variable we have one track in the alphabet
◮ e.g.
Example: {X1 → ∅, X2 → {4, 2}} | = ϕ def ⇔ X1:
X2: 1 1
Nested Antichains for WS1S AVM’15 4 / 17
example of base automaton for X = σ(Y)
1 2 X: Y:
Y: 1
Y: 1
Y:
¬(X ⊆ Y) ∧ ∃Z. Sing(Z) ∨ ∃W. W = σ(Z)
Nested Antichains for WS1S AVM’15 5 / 17
example of base automaton for X = σ(Y)
1 2 X: Y:
Y: 1
Y: 1
Y:
¬(X ⊆ Y) ∧ ∃Z. Sing(Z) ∨ ∃W. W = σ(Z)
A1 A2 A3
Nested Antichains for WS1S AVM’15 5 / 17
example of base automaton for X = σ(Y)
1 2 X: Y:
Y: 1
Y: 1
Y:
¬(X ⊆ Y) ∧ ∃Z. Sing(Z) ∨ ∃W. W = σ(Z)
A1 project W A2 A3 A4
Nested Antichains for WS1S AVM’15 5 / 17
example of base automaton for X = σ(Y)
1 2 X: Y:
Y: 1
Y: 1
Y:
¬(X ⊆ Y) ∧ ∃Z. Sing(Z) ∨ ∃W. W = σ(Z)
A1 project W A2 ∪ A4 A2 A3 A4
Nested Antichains for WS1S AVM’15 5 / 17
example of base automaton for X = σ(Y)
1 2 X: Y:
Y: 1
Y: 1
Y:
¬(X ⊆ Y) ∧ ∃Z. Sing(Z) ∨ ∃W. W = σ(Z)
A1 project W A2 ∪ A4 A2 project Z A3 A7 A4
Nested Antichains for WS1S AVM’15 5 / 17
example of base automaton for X = σ(Y)
1 2 X: Y:
Y: 1
Y: 1
Y:
¬(X ⊆ Y) ∧ ∃Z. Sing(Z) ∨ ∃W. W = σ(Z)
A1 project W A2 ∪ A4 A2 project Z A3 complement A6 A7 A4
Nested Antichains for WS1S AVM’15 5 / 17
example of base automaton for X = σ(Y)
1 2 X: Y:
Y: 1
Y: 1
Y:
¬(X ⊆ Y) ∧ ∃Z. Sing(Z) ∨ ∃W. W = σ(Z)
A1 project W A2 ∪ A4 A2 project Z A6 ∩ A7 A3 complement A6 A7 A4
Nested Antichains for WS1S AVM’15 5 / 17
issue with projection (existential quantification)
◮ after removing of the tracks not all models would be accepted ◮ so we need to adjust the final states 1 2 3 X: Y: 1
Y:
Y: 1
Y:
Nested Antichains for WS1S AVM’15 6 / 17
issue with projection (existential quantification)
◮ after removing of the tracks not all models would be accepted ◮ so we need to adjust the final states 1 2 3 X: Y: 1
Y:
Y: 1
Y:
1 2 3 X: Y: 1
Y:
Y: 1
Y:
Nested Antichains for WS1S AVM’15 6 / 17
issue with projection (existential quantification)
◮ after removing of the tracks not all models would be accepted ◮ so we need to adjust the final states 1 2 3 X: Y: 1
Y:
Y: 1
Y:
1 2 3 X: Y: 1
Y:
Y: 1
Y:
Nested Antichains for WS1S AVM’15 6 / 17
issue with projection (existential quantification)
◮ after removing of the tracks not all models would be accepted ◮ so we need to adjust the final states 1 2 3 X: Y: 1
Y:
Y: 1
Y:
1 2 3 X: Y: 1
Y:
Y: 1
Y:
1 2 3 Y: [1] Y: [0] Y: [0] Y: [0]
→ Adjust states to accept models: 1, 01, 001, . . .
Nested Antichains for WS1S AVM’15 6 / 17
issue with projection (existential quantification)
◮ after removing of the tracks not all models would be accepted ◮ so we need to adjust the final states 1 2 3 X: Y: 1
Y:
Y: 1
Y:
1 2 3 X: Y: 1
Y:
Y: 1
Y:
1 2 3 Y: [1] Y: [0] Y: [0] Y: [0]
→ Adjust states to accept models: 1, 01, 001, . . .
Nested Antichains for WS1S AVM’15 6 / 17
we consider only formulae in Prenex Normal Form (∃PNF)
◮ we focus on dealing with prefix and alternations of quantifications
based on number of alternations m ϕ = ¬ ∃Xm ¬. . . ¬ ∃X2 ¬ ∃X1 : ϕ0(X)
...
(1)
Nested Antichains for WS1S AVM’15 7 / 17
we consider only formulae in Prenex Normal Form (∃PNF)
◮ we focus on dealing with prefix and alternations of quantifications
based on number of alternations m ϕ = ¬ ∃Xm ¬. . . ¬ ∃X2 ¬ ∃X1 : ϕ0(X)
...
(1) → hierarchical family of automata defined as follows:
◮ Aϕ0 = by composition of atomic automata (previously described) ◮ Aϕm = (22···2Q0
m
, ∆m, Im, Fm)
Nested Antichains for WS1S AVM’15 7 / 17
Key observation for ground formulae
ϕ | = iff Im ∩ Fm = ∅
Key observation for ground formulae
ϕ | = iff Im ∩ Fm = ∅ Why?
◮ eventually the symbols degenerate to empty ones . . . 1 2 3 Y: [1] Y: [0] Y: [0] Y: [0]
A∃X.X=σ(Y)
1 2 3 Y: [1] Y: [0] Y: [0] Y: [0]
→ Projection
Nested Antichains for WS1S AVM’15 8 / 17
Key observation for ground formulae
ϕ | = iff Im ∩ Fm = ∅ Why?
◮ eventually the symbols degenerate to empty ones . . . 1 2 3 Y: [1] Y: [0] Y: [0] Y: [0]
A∃X.X=σ(Y)
1 2 3 Y: [1] Y: [0] Y: [0] Y: [0]
→ Projection
Nested Antichains for WS1S AVM’15 8 / 17
Key observation for ground formulae
ϕ | = iff Im ∩ Fm = ∅ Why?
◮ eventually the symbols degenerate to empty ones . . . 1 2 3 Y: [1] Y: [0] Y: [0] Y: [0]
A∃X.X=σ(Y)
1 2 3 Y: [1] Y: [0] Y: [0] Y: [0]
→ Projection
1 2 3 [] [] [] []
A∃Y,X.X=σ(Y)
Nested Antichains for WS1S AVM’15 8 / 17
Key observation for ground formulae
ϕ | = iff Im ∩ Fm = ∅ Why?
◮ eventually the symbols degenerate to empty ones . . . 1 2 3 Y: [1] Y: [0] Y: [0] Y: [0]
A∃X.X=σ(Y)
1 2 3 Y: [1] Y: [0] Y: [0] Y: [0]
→ Projection
1 2 3 [] [] [] []
A∃Y,X.X=σ(Y)
Nested Antichains for WS1S AVM’15 8 / 17
Constructing the whole automaton for ϕm is unnecessary!
◮ we construct initial/final states only ◮ and test whether they intersect
Nested Antichains for WS1S AVM’15 9 / 17
Constructing the whole automaton for ϕm is unnecessary!
◮ we construct initial/final states only ◮ and test whether they intersect
construction of initial states is straightforward; starting from I0:
Nested Antichains for WS1S AVM’15 9 / 17
Constructing the whole automaton for ϕm is unnecessary!
◮ we construct initial/final states only ◮ and test whether they intersect
construction of initial states is straightforward; starting from I0:
◮ I1 = {I0}
Nested Antichains for WS1S AVM’15 9 / 17
Constructing the whole automaton for ϕm is unnecessary!
◮ we construct initial/final states only ◮ and test whether they intersect
construction of initial states is straightforward; starting from I0:
◮ I1 = {I0} ◮ I2 = {I1} = {{I0}}
Nested Antichains for WS1S AVM’15 9 / 17
Constructing the whole automaton for ϕm is unnecessary!
◮ we construct initial/final states only ◮ and test whether they intersect
construction of initial states is straightforward; starting from I0:
◮ I1 = {I0} ◮ I2 = {I1} = {{I0}}
. . .
◮ Im = {Im−1} = {{. . . {
m
I0} . . .}}
Nested Antichains for WS1S AVM’15 9 / 17
Constructing the whole automaton for ϕm is unnecessary!
◮ we construct initial/final states only ◮ and test whether they intersect
construction of initial states is straightforward; starting from I0:
◮ I1 = {I0} ◮ I2 = {I1} = {{I0}}
. . .
◮ Im = {Im−1} = {{. . . {
m
I0} . . .}}
final states are more tricky
◮ issue with projection (previously described) ◮ multiple levels of determinisation
Nested Antichains for WS1S AVM’15 9 / 17
we already have:
◮ formula in ∃PNF: ϕ = ¬ ∃Xm ¬ . . . ¬ ∃X2 ¬ ∃X1 : ϕ0(X) ◮ base automaton for ϕ0
Nested Antichains for WS1S AVM’15 10 / 17
we already have:
◮ formula in ∃PNF: ϕ = ¬ ∃Xm ¬ . . . ¬ ∃X2 ¬ ∃X1 : ϕ0(X) ◮ base automaton for ϕ0
◮ is based on generalized backward reachability of final states ◮ works on symbolic representation of states, sets of states, sets of
sets of states . . .
(Intuition) states reaching final states become non-final after negation
(Intuition) states leading outside of non-final states become final after negation
◮ prunes states on all levels of the hierarchy to achieve minimal
representation
Nested Antichains for WS1S AVM’15 10 / 17
Motivating example: ¬∃X.ϕ
◮ Q = {0, 1, 2, 3} ◮ F = {3} 1 2 3 X: Y: 1
Y: 1 1
Y: 1
Nested Antichains for WS1S AVM’15 11 / 17
Motivating example: ¬∃X.ϕ
◮ Q = {0, 1, 2, 3} ◮ F = {3} 1 2 3 X: Y: 1
Y: 1 1
Y: 1
◮ F ∃ = {2, 3} ◮ N∃ = Q \ F ∃ = {0, 1}
Nested Antichains for WS1S AVM’15 11 / 17
Motivating example: ¬∃X.ϕ
◮ Q = {0, 1, 2, 3} ◮ F = {3} 1 2 3 X: Y: 1
Y: 1 1
Y: 1
◮ F ∃ = {2, 3} ◮ N∃ = Q \ F ∃ = {0, 1}
After negation:
◮ F1 = F¬∃ = {{0}, {1}, {0, 1}} ◮ N1 = {{2}, {3}, {2, 0}, {3, 0}, . . . {2, 3, 0}, {2, 3, 1}, . . . {0, 1, 2, 3}}
Nested Antichains for WS1S AVM’15 11 / 17
Motivating example: ¬∃X.ϕ
◮ Q = {0, 1, 2, 3} ◮ F = {3} 1 2 3 X: Y: 1
Y: 1 1
Y: 1
◮ F ∃ = {2, 3} ◮ N∃ = Q \ F ∃ = {0, 1}
After negation:
◮ F1 = F¬∃ = {{0}, {1}, {0, 1}} ◮ N1 = {{2}, {3}, {2, 0}, {3, 0}, . . . {2, 3, 0}, {2, 3, 1}, . . . {0, 1, 2, 3}}
Nested Antichains for WS1S AVM’15 11 / 17
Motivating example: ¬∃X.ϕ
◮ Q = {0, 1, 2, 3} ◮ F = {3} 1 2 3 X: Y: 1
Y: 1 1
Y: 1
◮ F ∃ = {2, 3} ◮ N∃ = Q \ F ∃ = {0, 1}
After negation:
◮ F1 = F¬∃ = {{0}, {1}, {0, 1}}
= ↓ {{0, 1}}
◮ N1 = {{2}, {3}, {2, 0}, {3, 0}, . . . {2, 3, 0}, {2, 3, 1}, . . . {0, 1, 2, 3}}
= ↑ {{2}, {3}}
Nested Antichains for WS1S AVM’15 11 / 17
Motivating example: ¬∃X.ϕ
◮ Q = {0, 1, 2, 3} ◮ F = {3} 1 2 3 X: Y: 1
Y: 1 1
Y: 1
◮ F ∃ = {2, 3} ◮ N∃ = Q \ F ∃ = {0, 1}
After negation:
◮ F1 = F¬∃ = {{0}, {1}, {0, 1}}
= ↓ {{0, 1}}
◮ N1 = {{2}, {3}, {2, 0}, {3, 0}, . . . {2, 3, 0}, {2, 3, 1}, . . . {0, 1, 2, 3}}
= ↑ {{2}, {3}}
so why not work with this symbolic representation only?
Nested Antichains for WS1S AVM’15 11 / 17
Given ϕ = ¬ ∃Xm ¬ . . . ¬ ∃X2 ¬ ∃X1 : ϕ0(X)
Nested Antichains for WS1S AVM’15 12 / 17
Given ϕ = ¬ ∃Xm ¬ . . . ¬ ∃X2 ¬ ∃X1 : ϕ0(X)
1 Extend set of final states after ∃: F ∃ 0 = {µZ.F ∪ pre0(Z)}
Nested Antichains for WS1S AVM’15 12 / 17
Given ϕ = ¬ ∃Xm ¬ . . . ¬ ∃X2 ¬ ∃X1 : ϕ0(X)
1 Extend set of final states after ∃: F ∃ 0 = {µZ.F ∪ pre0(Z)} 2 Negate the final states: N1 =↑ {F ∃ 0 }
Nested Antichains for WS1S AVM’15 12 / 17
Given ϕ = ¬ ∃Xm ¬ . . . ¬ ∃X2 ¬ ∃X1 : ϕ0(X)
1 Extend set of final states after ∃: F ∃ 0 = {µZ.F ∪ pre0(Z)} 2 Negate the final states: N1 =↑ {F ∃ 0 } 3 Reduce set of non-final states after ∃: N∃ 1 = {νZ.N1 ∩ cpre0(Z)}
◮ Notice the duality with step 1.
∩ → ∪ cpre0 → pre0 ν → µ (2)
Nested Antichains for WS1S AVM’15 12 / 17
Given ϕ = ¬ ∃Xm ¬ . . . ¬ ∃X2 ¬ ∃X1 : ϕ0(X)
1 Extend set of final states after ∃: F ∃ 0 = {µZ.F ∪ pre0(Z)} 2 Negate the final states: N1 =↑ {F ∃ 0 } 3 Reduce set of non-final states after ∃: N∃ 1 = {νZ.N1 ∩ cpre0(Z)}
◮ Notice the duality with step 1.
∩ → ∪ cpre0 → pre0 ν → µ (2)
4 Negate the non-final states: F2 =↓ {N∃ 1}
Nested Antichains for WS1S AVM’15 12 / 17
Given ϕ = ¬ ∃Xm ¬ . . . ¬ ∃X2 ¬ ∃X1 : ϕ0(X)
1 Extend set of final states after ∃: F ∃ 0 = {µZ.F ∪ pre0(Z)} 2 Negate the final states: N1 =↑ {F ∃ 0 } 3 Reduce set of non-final states after ∃: N∃ 1 = {νZ.N1 ∩ cpre0(Z)}
◮ Notice the duality with step 1.
∩ → ∪ cpre0 → pre0 ν → µ (2)
4 Negate the non-final states: F2 =↓ {N∃ 1}
. . .
5 and keep alternating between computing final and non-final states
until Fm as follows:
◮ Fi+1 =↓ {νZ.Ni ∩ cpre0(Z)} ◮ Ni+1 =↑ {µZ.Fi ∪ pre0(Z)}
Nested Antichains for WS1S AVM’15 12 / 17
Can we compute cpre0/pre0 of symbolic states?
Nested Antichains for WS1S AVM’15 13 / 17
Can we compute cpre0/pre0 of symbolic states? Yes!
Nested Antichains for WS1S AVM’15 13 / 17
Can we compute cpre0/pre0 of symbolic states? Yes!
cpre0(↑ {Q}) =↑ {pre0(Q)}
CPRE pre
note that we define the dual lemma for downward closed sets
Nested Antichains for WS1S AVM’15 13 / 17
Can we compute cpre0/pre0 of symbolic states? Yes!
cpre0(↑ {Q}) =↑ {pre0(Q)}
CPRE pre
note that we define the dual lemma for downward closed sets
Nested Antichains for WS1S AVM’15 13 / 17
Can we compute cpre0/pre0 of symbolic states? Yes!
cpre0(↑ {Q}) =↑ {pre0(Q)}
CPRE
note that we define the dual lemma for downward closed sets
Nested Antichains for WS1S AVM’15 13 / 17
Can we compute cpre0/pre0 of symbolic states? Yes!
cpre0(↑ {Q}) =↑ {pre0(Q)}
CPRE
breaks the predecessors into new generators that cover the Q note that we define the dual lemma for downward closed sets
Nested Antichains for WS1S AVM’15 13 / 17
Can we compute cpre0/pre0 of symbolic states? Yes!
cpre0(↑ {Q}) =↑ {pre0(Q)}
CPRE
breaks the predecessors into new generators that cover the Q note that we define the dual lemma for downward closed sets
Nested Antichains for WS1S AVM’15 13 / 17
Can we compute cpre0/pre0 of symbolic states? Yes!
cpre0(↑ {Q}) =↑ {pre0(Q)} U
CPRE
breaks the predecessors into new generators that cover the Q note that we define the dual lemma for downward closed sets
Nested Antichains for WS1S AVM’15 13 / 17
Can we compute cpre0/pre0 of symbolic states? Yes!
cpre0(↑ {Q}) =↑ {pre0(Q)} U U U
CPRE
breaks the predecessors into new generators that cover the Q note that we define the dual lemma for downward closed sets
Nested Antichains for WS1S AVM’15 13 / 17
We showed the nested structure of Fm is very complex,
Nested Antichains for WS1S AVM’15 14 / 17
We showed the nested structure of Fm is very complex,
◮ but we only work with the symbolic representation of the generators
(with antichains)
◮ . . . and the generators of the generators and . . . ◮ this itself is the first source of space reduction
Nested Antichains for WS1S AVM’15 14 / 17
We showed the nested structure of Fm is very complex,
◮ but we only work with the symbolic representation of the generators
(with antichains)
◮ . . . and the generators of the generators and . . . ◮ this itself is the first source of space reduction
further we prune the generators subsumed by other generators
◮ the subsumption relation is computed on nested structure of
symbolic representation of lower levels
Nested Antichains for WS1S AVM’15 14 / 17
implemented in dWiNA compared with MONA:
◮ on generated and real formulae ◮ in generic and ∃PNF form
MONA dWiNA Time [s] Space [states] Time [s] Space [states] real normal ∃PNF normal ∃PNF Prefix Prefix list-reverse-after-loop 0.01 0.01 179 1 326 0.01 100 list-reverse-in-loop 0.02 0.47 1 311 70 278 0.02 260 bubblesort-else 0.01 0.45 1 285 12 071 0.01 14 bubblesort-if-else 0.02 2.17 4 260 116 760 0.23 234 bubblesort-if-if 0.12 5.29 8 390 233 372 1.14 28 generated 3 alternations
0.01 50 4 alternations
0.02 58 5 alternations
0.02 70 6 alternations
0.47 90
Nested Antichains for WS1S AVM’15 15 / 17
Future work
◮ extension to WS2S
◮ generalization of symbolic tree representation
Conclusion
◮ WS1S = Great expressivity, yet decidable! ◮ Novel approach based on antichains ◮ Encouraging results in terms of space reduction
Nested Antichains for WS1S AVM’15 16 / 17
Nested Antichains for WS1S AVM’15 17 / 17