Regression Verification: Project Proposal
Presentation by Dennis Felsing within the Projektgruppe Formale Methoden der Softwareentwicklung SS 2013
1 / 18
Regression Verification: Project Proposal Presentation by Dennis - - PowerPoint PPT Presentation
Regression Verification: Project Proposal Presentation by Dennis Felsing within the Projektgruppe Formale Methoden der Softwareentwicklung SS 2013 1 / 18 Introduction How to prevent regressions in software development? 2 / 18 Introduction
Presentation by Dennis Felsing within the Projektgruppe Formale Methoden der Softwareentwicklung SS 2013
1 / 18
2 / 18
Formal Verification
Formally prove correctness of software ⇒ Requires formal specification
Regression Testing
Discover new bugs by testing for them ⇒ Requires test cases
3 / 18
Formal Verification
Formally prove correctness of software ⇒ Requires formal specification
Regression Testing
Discover new bugs by testing for them ⇒ Requires test cases
Regression Verification
Formally prove there are no new bugs
3 / 18
Overview
Function f (val n; ret r) Function f without recursions Static Single Assignment Sf Function g (val x; ret y) Function g without recursions Static Single Assignment Sg (n = x ∧ Sf ∧ Sg) → r = y Valid / Invalid Equivalent? Uninterpreted Functions SMT Solver
4 / 18
Formally prove there are no new bugs
5 / 18
Formally prove there are no new bugs
int f ( int n) { int r = 0; i f (n ≤ 0) { r = n ; } else { r = n + f (n − 1 ) ; } return r ; } int g ( int x ) { int y = 0; i f (x ≤ 1) { y = x ; } else { y = x + g ( x − 1 ) ; } return y ; }
5 / 18
Formally prove there are no new bugs
int f ( int n) { int r = 0; i f (n ≤ 0) { r = n ; } else { r = n + f (n − 1 ) ; } return r ; } int g ( int x ) { int y = 0; i f (x ≤ 1) { y = x ; } else { y = x + g ( x − 1 ) ; } return y ; }
5 / 18
Overview
Function f (val n; ret r) Function f without recursions Static Single Assignment Sf Function g (val x; ret y) Function g without recursions Static Single Assignment Sg (n = x ∧ Sf ∧ Sg) → r = y Valid / Invalid Equivalent? Uninterpreted Functions SMT Solver
6 / 18
returns the same outputs.
f (n − 1) = g(n − 1) int f ( int n) { int r = 0; i f (n ≤ 0) { r = n ; } else { r = n + U (n − 1 ) ; } return r ; } int g ( int x ) { int y = 0; i f (x ≤ 1) { y = x ; } else { y = x + U ( x − 1 ) ; } return y ; }
7 / 18
Overview
Function f (val n; ret r) Function f without recursions Static Single Assignment Sf Function g (val x; ret y) Function g without recursions Static Single Assignment Sg (n = x ∧ Sf ∧ Sg) → r = y Valid / Invalid Equivalent? Uninterpreted Functions SMT Solver
8 / 18
9 / 18
int f ( int n) { int r = 0; i f (n ≤ 0) { r = n ; } else { r = n + U (n − 1 ) ; } return r ; } Sf = r0 = 0
9 / 18
int f ( int n) { int r = 0; i f (n ≤ 0) { r = n ; } else { r = n + U (n − 1 ) ; } return r ; } Sf = r0 = 0 ∧ n ≤ 0 → r1 = n
9 / 18
int f ( int n) { int r = 0; i f (n ≤ 0) { r = n ; } else { r = n + U (n − 1 ) ; } return r ; } Sf = r0 = 0 ∧ n ≤ 0 → r1 = n ∧ n > 0 → r1 = n + U(n − 1)
9 / 18
int f ( int n) { int r = 0; i f (n ≤ 0) { r = n ; } else { r = n + U (n − 1 ) ; } return r ; } Sf = r0 = 0 ∧ n ≤ 0 → r1 = n ∧ n > 0 → r1 = n + U(n − 1) ∧ r = r1
9 / 18
Overview
Function f (val n; ret r) Function f without recursions Static Single Assignment Sf Function g (val x; ret y) Function g without recursions Static Single Assignment Sg ( n = x
Equal inputs
∧Sf ∧ Sg) → r = y
Equal outputs
Equivalent? Uninterpreted Functions
10 / 18
Overview
Function f (val n; ret r) Function f without recursions Static Single Assignment Sf Function g (val x; ret y) Function g without recursions Static Single Assignment Sg (n = x ∧ Sf ∧ Sg) → r = y Valid / Invalid Equivalent? Uninterpreted Functions SMT Solver
11 / 18
f (n) = −1 if n = 0 g(n)
12 / 18
f (n) = −1 if n = 0 g(n)
int f ( int n) { int r = 0; i f (n ≤ 0) { r = n ; } else { r = n + f (n − 1 ) ; } return r ; } int g ( int x ) { int y = 0; i f ( x ≤ 1) { y = x ; } else { y = x + g ( x − 1 ) ; } return y ; }
12 / 18
f (n) = −1 if n = 0 g(n)
int f ( int n) { int r = 0; i f (n ≤ 0) { r = n ; } else { r = n + f (n − 1 ) ; } return r ; } int g ( int x ) { int y = 0; i f ( x ≤ 1) { y = x ; } else { y = x + g ( x − 1 ) ; } return y ; }
f (0) = 0
12 / 18
Finding Counter Examples
Function f (val n; ret r) Function f without recursions Static Single Assignment Sf Function g (val x; ret y) Function g without recursions Static Single Assignment Sg (n = x ∧ Sf ∧ Sg) → r = y Valid / Invalid Counter Example Equivalent? Uninterpreted Functions SMT Solver Execute
13 / 18
Determining Corner Cases
Function f (val n; ret r) Function f without recursions Static Single Assignment Sf Function g (val x; ret y) Function g without recursions Static Single Assignment Sg (n = x ∧ Sf ∧ Sg∧ U(0) = 0 ) → r = y Valid / Invalid Counter Example Equivalent? Uninterpreted Functions SMT Solver Execute Add
14 / 18
Functional Condition Extraction
Function f (val n; ret r) Function f without recursions Static Single Assignment Sf Function g (val x; ret y) Function g without recursions Static Single Assignment Sg (n = x ∧ Sf ∧ Sg∧ α ) → r = y Valid / Invalid Functional Condition Equivalent? SMT Solver Add
15 / 18
Relational Equivalence
Function f (val n; ret r) Function f without recursions Static Single Assignment Sf Function g (val x; ret y) Function g without recursions Static Single Assignment Sg ( n ≥ 0 ∧ n = x ∧Sf ∧ Sg) → r ∼ y Valid / Invalid Equivalent? Uninterpreted Functions SMT Solver
16 / 18
17 / 18
Regression Verification
18 / 18