520 likes | 677 Views
Abstraction for Falsification. Thomas Ball Orna Kupferman Greta Yorsh. Microsoft Research, Redmond, US Hebrew University, Jerusalem, Israel Tel Aviv University, Israel. CAV’05. Abstraction for Verification. Goal: prove properties Sound abstraction for verification
E N D
Abstraction for Falsification Thomas Ball Orna Kupferman Greta Yorsh Microsoft Research, Redmond, US Hebrew University, Jerusalem, Israel Tel Aviv University, Israel CAV’05
Abstraction for Verification • Goal: prove properties • Sound abstraction for verification • properties of abstract system hold for corresponding concrete system • : C A • if abstract state a satisfies property P then all concrete states represented by a satisfy P
Abstraction for Verification • Goal: prove properties • Sound abstraction for verification • properties of abstract system hold for corresponding concrete system • : C A • a A if a P then c C . (c)=a c P
Falsification detect errors Abstraction for Verification • Goal: prove properties • Sound abstraction for verification • properties of abstract system hold for corresponding concrete system • : C A • a A if a P then c C . (c)=a c P
Falsification detect errors falsification Abstraction for Verification • Goal: prove properties • Sound abstraction for verification • errors of the abstract system exist in corresponding concrete system • : C A • a A if a P then c C . (c)=a c P
Falsification detect errors falsification Abstraction for Verification • Goal: prove properties • Sound abstraction for verification • errors of the abstract system exist in corresponding concrete system • : C A • a A if a P then c C . (c)=a c P c C . (c)=a c P
Motivation • An abstraction that is sound for falsification need not be sound for verification. • Existing frameworks for abstraction for verification • Modal Transition System (MTS) • MTS, PKS,KMTS - equivalent in expressive power [ Godefroid,Jagadessan – VMCAI’03 ] • can be too restrictive for falsification
Main Results • New framework for abstraction • Ternary Modal Transition System (TMTS) • TMTS is stronger than MTS • Semantics of -calculus for TMTS • Weak reachability • TMTS with parameterized transitions gives tighter underapproximation • TMTS with assume-guarantee transitions for complete reasoning
Modal Transition Systems Concrete Abstract a (existential abstraction) MAY(a,a’) may c, c’ . c c’ (c) = a (c’) = a’ a’ a MUST+(a,a’) c. (c) = a c’ . (c’) = a’ c c’ must a’ [ T. Ball - FMCO’04 ] a MUST–(a,a’) c’. (c’) = a’ c. (c) = a c c’ must onto underapproximation a’ must may overapproximation total underapproximation must may must+ and must– are incomparable
TMTS strictly more expressive than MTS MTS • may and must+ transitions • precision preorder is logically characterized by PML ::= p | AX | | TMTS • may, must+ and must– transitions • precision preorder is logically characterized by full-PML ::= p | AX | AY | | • full-PML is strictly more expressive than PML [Pinter,Wolper - PODC’84] [Kupferman,Pnueli - LICS’95]
TMTS: what does it buy us? • Verifying specifications with past operators • Reasoning about specifications in falsification setting • must+ for verification and must- for falsification • Tighter weak reachability in abstract system • combine must+ and must- along the path
Semantics of -calculus for TMTS • : C A • (C, c1) • [ (A, a1) ] - the value of the -calculus formula in state a1 of TMTS A
Semantics of -calculus for TMTS • [ (A, a) ] = T • for all concrete state c with (c) = a, (C, c) • [ (A, a) ] = T • there exists a concrete state c with (c) = a and (C, c) • [ (A, a) ] = F • for all concrete state c with (c) = a, (C, c) • [ (A, a) ] = F • there exists a concrete state c with (c) = a and (C, c) • [ (A, a) ] = M • there exist concrete states c and c’ such that (c) = (c’) = a and (C, c) and (C, c’) • [ (A, a) ] =
Information Lattice Truth Lattice T T F F
Information Lattice Truth Lattice T T F M T M T F F F
Semantics of -calculus for TMTS • [ (A, a) 1 2 ] • [ (A, a) EX ] • [ (A, a) ]
[ (A, a) 1 2 ] = [ (A, a) 1 ] # [ (A, a) 2 ] 6-valued Semantics of 1 2
Information Lattice Truth Lattice T T F M T M T F F F
[ (A, a) EX ] = Semantics of EX F if for all a’, if may(a,a’) then [(A, a’) ] = F T if exists a’ s.t. must+(a,a’) and [(A,a’) ] = T Tif exists a’ s.t. must–(a,a’) and [(A,a’) ] T otherwise
EX = T a must– a’ = T c’ c if [ (A, a) EX ] = Tthen there exists c with (c) = a and c EX • [ (A, a) EX ] = T • exists a’ s.t. must–(a,a’) and [(A,a’) ] = T • exists c’ such that (c’)=a’ and c’ • for all c’ with (c’)=a’ there is c with (c)=a such that cc’ EX
Semantics of • The semantics of PML operators is monotonic • Least fixpoint operator can be computed by iterations from F is the usual way: • [(A,a) Z . (Z) ] = [ (A, a) *(F) ]
x > 6 ... 7 8 9 x:=x–3 x > 6 ... 7 8 9 Semantics of -calculus for TMTS • The 6-valued semantics is at least as precise as the standard 3-valued semantics of -calculus for MTS • [(A,a) ] = • 3-valued abstraction refinement of must+ transitions [Shoham,Grumberg – CAV’03] adapt for must- • Hypermust transitions • [Larsen,Xinxin-LICS‘90] [Shoham,Grumberg – CAV’04] • adapt for must– • MTS with hypermust+ is incomparable with TMTS x = 7 x = 10 EX(x>6) = ? EX(x>6) =T EX(x>6) F EX(x>6) T must – may
Semantics of -calculus for TMTS • The 6-valued semantics is at least as precise as the standard 3-valued semantics of -calculus for MTS • [(A,a) ] = • 3-valued abstraction refinement of must+ transitions [Shoham,Grumberg – CAV’03] adapt for must- • Hypermust transitions • [Larsen,Xinxin-LICS‘90] [Shoham,Grumberg – CAV’04] • adapt for must– • MTS with hypermust+ is incomparable with TMTS
c a a’ c’ Weak Reachability • a’ is weakly-reachable from a • c, c’ . (c)=a (c’)=a’ c * c’ initial state error trace error state Related to testing
L0: if x<6 then L1: x:= x + 3 L2: if x > 7 then L3: x :=x – 3 L4: Example Predicates: (x < 6) (x > 7) x<6 x>7 (x=6)(x=7) L0: FT L0: FF L1: TF must– must– may L2: TF L3: FT L2: FF may must– must– L4: TF L4: FT L4: FF
L0: if x<6 then L1: x:= x + 3 L2: if x > 7 then L3: x :=x – 3 L4: Example Predicates: (x < 6) (x > 7) x<6 x>7 (x=6)(x=7) L0: FT L0: FF L1: TF must– must– may L2: TF L3: FT L2: FF may must– must– L4: TF L4: FT L4: FF x = 5
Underapproximation of Weak Reachability • if [must+]*(a,a’) then a’ is weakly reachable from a • Arbitrary combinations of must+ and must– transitions do not preserve weak reachability • Find a tighter underapproximation of weak-reachability
L0: if x<6 then L1: x:= x + 3 L2: if x > 7 then L3: x :=x – 3 L4: x = 2 x = 6 x = 9 x = 5 Example Predicates: (x < 6) (x > 7) x<6 x>7 (x=6)(x=7) L0: FT L0: FF L1: TF must– must– may must – ? must + ? L2: TF L3: FT L2: FF may must– must– L4: TF L4: FT L4: FF
Underapproximation of Weak Reachability • if [must+]*(a,a’) then a’ is weakly reachable from a • Arbitrary combinations of must+ and must– transitions do not preserve weak reachability • Find a tighter underapproximation of weak-reachability
Observations • a3 is weakly reachable from a1 if there exists a2 such that must–(a1,a2) and must+(a2,a3) • Onto nature of must– is preserved by [must-]* • Total nature of must+ is preserved by [must+]* a1 must– a2 must+ a3 [T.Ball – FMCO’04]
a1 [must–]* a2 [must+]* a3 Underapproximation If there exists a1, a2, a3 such that [must–]*(a1,a2) and [must+]*(a2,a3) then a3 is weakly-reachable from a1 [T.Ball – FMCO’04]
L0: if x<6 then L1: x:= x + 3 L2: if x > 7 then L3: x :=x – 3 L4: Example Predicates: (x < 6) (x > 7) x<6 x>7 (x=6)(x=7) L0: FT L0: FF L1: TF must– must– may L2: TF L3: FT L2: FF may must– must– L4: TF L4: FT L4: FF
MUST+ ? ( total from a? ) MUST– ? ( onto a’ ?) Parameterized Transitions NO a NO a’ MAY
MUST+() c. (c) = a c c’ . (c’) = a’ c c’ total from a MUST–() c’. (c’) = a’ c’ c. (c) = a c c’ must–() a’ onto Parameterized Transitions a must+() a’ if is TRUE then must+() is must+ and must–() is must–
Observation a1 • a3 is weakly reachable from a1 if there exists a2 such that • must–(1)(a1,a2) • must+(2) (a2,a3) • 1 2 a2 is satisfiable must–(1) a2 1 2 must+(2) a3
Observation a1 • a3 is weakly reachable from a1 if there exists a2 such that • must–(1)(a1,a2) • must+(2) (a2,a3) • 1 2 a2 is satisfiable • Strongest parameters 1 and2 must–(1) a2 1 2 must+(2) a3
MUST– ( SP (s,a) ) a s c’. (c’) = a’ c’ c. (c) = a c c’ a’ if must–() then a ( SP(s,a)) Strongest Parameters MUST+ ( WP(s,a’) ) a s c. (c) = a c c’ . (c’) = a’ c c’ if must+() then a ( WP(s,a’)) a’ Generated automatically as part of the construction of TMTS
L0: if x<6 then L1: x:= x + 3 L2: if x > 7 then L3: x :=x – 3 L4: Example Predicates: (x < 6) (x > 7) x<6 x>7 (x=6)(x=7) L0: FT L0: FF L1: TF must– must– may L2: TF L3: FT L2: FF SP(x:=x+3, x<6) = x < 9 WP(x:=x-3, x<6) = x < 9 may must– must– L4: TF L4: FT L4: FF
L0: if x<6 then L1: x:= x + 3 L2: if x > 7 then L3: x :=x – 3 L4: Example Predicates: (x < 6) (x > 7) x<6 x>7 (x=6)(x=7) L0: FT L0: FF L1: TF must– must– must–(x<9) L2: TF L3: FT L2: FF must+(x<9) SP(x:=x+3, x<6) = x < 9 WP(x:=x-3, x<6) = x < 9 must– must– must– (x < 9) L4: TF L4: FT L4: FF must+ (x < 9)
[must–]* must–(1) must+(2) [must+]* Tighter Underapproximation a1 If there exists a1,...,a5 s.t. [must–]*(a1,a2) must–(1)(a2,a3) must+(2) (a3,a4) [must+]*(a4,a5) 1 2 a3 is satisfiable then a5 is weakly-reachable from a1 a2 a3 1 2 a4 a5
Complete Reasoning • a’ is reachable by a certain sequence of abstract transitions from a • a’ is weakly-reachable from a • Assume-guarantee transitions • another type of parameterized transitions: <> must+ <’>
< > MUST–< ’ > a c’. (c’) = a’ c’ ’ c . (c) = a c c c’ <>must–<‘ > a’ ’ Assume-Guarantee Transitions < > MUST+ < ’> a c. (c) = a c c’ . (c’) = a’ c’ ’ c c’ <>must+<‘ > a’ ’ Which and ’ predicates do we need?
a1 s1 a2 s2 a3 3 3 s3 a4 s4 a5 The idea... 1 = a1 2 = SP(s1, 1) a2 3 = SP(s2, 2) a3 <1>must– <2> <2>must– <3> 3 = WP(s3,4) a3 4 = WP(s4,5) a4 5 = a5 <3>must+ < 4> 3 3 is satisfiable <4>must+ < 5>
Assume-guarantee transitions • Complete Reasoning about Weak Reachability • a’ is reachable by a certain sequence of assume-guarantee transitions from a • a’ is weakly-reachable from a • Finding right parameters ~ computing loop invariants
[must–] * [must+]* [must–] * must–(1) must+(2) [must+]* Weak Reachability: Summary • Previous work [T.Ball – FMCO’04]: • Parameterized transitions • Assume-guarantee transitions • complete reasoning