Title: TelAviv University Programming Languages Seminar
1Measuring the Precision of Abstract
Interpretations
- Alessandra Di Pierro and Herbert Wiklicky
- Moderator Roman Manevich
2Motivation
Neil D.Jones and Flemming Nielson.Abstract
interpretation A semantic-based tool for program
analysis
One shortcoming of the development ... is that
a correct analysis may be so imprecise as to be
practically useless. ... The notion of
correctness is topological in nature but we
would ideally like something that was a bit more
metric in nature so that we could express how
imprecise a correct analysis is. Unfortunately
no one has been able to develop an adequate
metric for these purposes.
3Outline
- Probabilistic abstract interpretation
- Construction of probabilistic abstract
interpretations - Measuring probabilistic abstract interpretations
- Examples
- Related Work
4Probabilistic Semantics
- Probabilistic programs
- coin flipping determines flow of information
(probabilistic execution) - Distribution of results (r,prob(r))
- Generalize deterministic programs
5Classical Abstract Interpretation
- Introduced by Patrick and Radhia Cousot 1977
- Two semantics
- Reference standard (concrete) semantics
- Approximate (abstract) semantics
- Over two domains lattices
- The relation between them given byGalois
Connection
6Complete Lattices Reminder
- A poset (L, ? ) is a complete lattice if every
subset has least and upper bounds - L (L, ?) (L, ?, ?, ?, ?, ?)
- ? ? ? ? L
- ? ? L ? ?
- Lemma For every poset (L, ? ) the following
conditions are equivalent - L is a complete lattice
- Every subset of L has a least upper bound
- Every subset of L has a greatest lower bound
7Galois Connections Revisited
- Definition 1
- Let C(C,?) and D(D, ?) be two posets
- If ?C?D and ? D?C s.t for all c?C and
d?Dc??(d) iff ?(c)?d - (C,?,?,D) forms a Galois Connection
8Galois Connections Revisited
D
C
d
?
?(d)
?(c)
?
c
9Galois Connections Revisited
- Definition 2
- Let C(C,?) and D(D, ?) be two posets
- If ?C?D and ? D?C s.t ? and ? are monotone ?
? ? is reductive? ? ? is extensive - (C,?,?,D) forms a Galois Connection
10Galois Connections Revisited
D
C
d
?
?(?(d))
?(?(c))
?
c
11Galois Connections Revisited
C
C
???
12Galois Connections Revisited
D
D
???
13Probabilistic Abstract Interpretation
- Probabilistic semantics
- Two semantics
- Reference standard (concrete) semantics
- Approximate (abstract) semantics
- Over two (probabilistic) domains vector spaces
- The relation between them given by Moore-Penrose
pseudo-inverse
14Projections
- A linear operator TV?V is a projection if T?TT
- If T(V)W then for every v?Vvv?v?
- v? will be abstracted T(v?)0v? will be
preserved T(v?)v?
15Projection Example
y
?((x,y))x?(x)(x,0)
x
16Adjoint Orthogonal Operators
- If T is a linear operator
- exists unique T such that ?T(u),v??u,T(v)?
- TTTTI ? TT-1
- ?T(u),T(v)??u,v?
- ?T(u)??u?
17Orthogonal Projections
- T is an orthogonal projection iff TT
- For a linear map ?V?VThe map of ? ?(V)?W (a
subspace of V) - There is a unique orthogonal projection??(v)W?W
s.t. ??(v)(W)?(V)
18Classic ? Probabilistic
- ?,? Monotone ? Linear
- ???(c)?c ? ?????
- ???(d)?d ? ?????
19Moore-Penrose Pseudo Inverse
- C, D finite dimensional vector spaces
- ?C?D
- ??D?C is the (unique) Moore-Penrose Pseudo
Inverse iff - ?????
- ?????
20Alternative Characterization
- ?????? (also holds for GC)
- ?????? (also holds for GC)
- (???)???
- (???)???
21Probabilistic Abstract Interpretation
- C,D two probabilistic domains
- ?C?D and ? D?C linear maps
- ?,? moore-penrose pseudo-inverse
22Projection as Approximation
- Let ?WV?V be an orthogonal projection.
- For every x?V ?W(x) is the unique vector in
Ws.t. ?x- ?W(x)? is minimal
23Construction of ProbabilisticAbstract
Interpretations
- Probabilistic induced analysis
- Vector space lifting
- General construction
- Infinite dimensional abstractions
24Vector Space Lifting
- Recasting cpo based semantics in vector space
setting - Similar to power space
- If C is a cpo V(C)?xcc xc??, c?C
25General (Classic) Construction
?
A
A
?
f
f
?
B
B
?
26General (Classic) Construction
- f A ? B is correct approximation of f
iff? ? f ?B f ? ? - Best iff f ? ? f ? ?
- Complete iff? ? f f ? ?
27Measuring ProbabilisticAbstract Interpretations
- Pseudo-quotient?(? ? f ) ? (f ? ?)? B ?
B - (A,B, f ) is correct iff ????1complete iff
???1
28Examples
- Rule of sign
- Multiplication
- Addition
- Cast out of nine
29Rule of Signs
30Rule of Signs Multiplication
?
V(Z2)
V(Sign2)
?
?
?
V(Z)
V(Sign)
31Lifting Multiplication
- V(Sign) R3- ? (1,0,0) 0 ? (0,1,0) ?
(0,0,1) - V(Sign2) R6- ? - ? (1,0,0,0,0,0) - ? 0
? (0,1,0,0,0,0) 0 ? ? (0,0,1,0,0,0) 0 ? 0
? (0,0,0,1,0,0) 0 ? ? (0,0,0,0,1,0) ?
? (0,0,0,0,0,1)
(? ? ?) ? (? ? ?2) id ???1
32Rule of Signs Addition
- Qn(? ? ) ? ( ? ?2) for truncated
computations in -n,n converges to - (1.0 0.0 0.0 0.0)(0.0 1.0 0.0 0.0)(0.0 0.0
1.0 0.0)(0.5 0.0 0.5 0.0) - ???1.5
33Cast by d
- eval(abc) eval(a,b,c) - true if abc-
false otherwise - ?N3?D3
- eval D3?B ?false, ?true
34Cast by d
?
V(D3)
V(N3)
eval
eval
id
V(B)
V(B)
35Cast by d
- SdV(B)?V(B)true ? (1,0)false ? (0,1)
- Numerical experiments gave?S2?11.93 vs.
?S9?11.72
36Related Work
- Concurrent Constraint Programming Towards
Probabilistic Abstract Interpretation /
Alessandra Di Pierro and Herbert Wiklicky - Making Abstract Interpretations Complete
/Roberto Giacobazzi, Francesco Ranzato - Data Flow Frequency Analysis / Ramalingam
37The End