automated error diagnosis using abductive inference
play

Automated Error Diagnosis Using Abductive Inference Isil Dillig 1 - PowerPoint PPT Presentation

Automated Error Diagnosis Using Abductive Inference Isil Dillig 1 Thomas Dillig 1 Alex Aiken 2 1 Department of Computer Science College of William & Mary, Virginia, USA 2 Department of Computer Science Stanford University, CA, USA PLDI 2012


  1. Automated Error Diagnosis Using Abductive Inference Isil Dillig 1 Thomas Dillig 1 Alex Aiken 2 1 Department of Computer Science College of William & Mary, Virginia, USA 2 Department of Computer Science Stanford University, CA, USA PLDI 2012 Severin Heiniger Severin Heiniger Research Topics in Software Engineering May 13th, 2013 1 / 22

  2. An Ordinary Day in a Developer’s Life 1 void foo ( i n t f l a g , unsigned i n t n ) { i n t k = 0 , i = 0 , j = 0 , z = 0; 2 i f ( f l a g ) k = n ; 3 e l s e k = 1; 4 5 w h i l e ( i < = n ) { 6 i = i + 1; 7 j = j + i ; 8 } 9 i n t z = k + i + j ; 10 a s s e r t ( z > 2 ∗ n ) ; 11 12 } Severin Heiniger Research Topics in Software Engineering May 13th, 2013 2 / 22

  3. An Ordinary Day in a Developer’s Life 1 void foo ( i n t f l a g , unsigned i n t n ) { i n t k = 0 , i = 0 , j = 0 , z = 0; 2 i f ( f l a g ) k = n ; 3 e l s e k = 1; 4 5 w h i l e ( i < = n ) { 6 i = i + 1; 7 j = j + i ; 8 } 9 i n t z = k + i + j ; 10 a s s e r t ( z > 2 ∗ n ) ; 11 12 } Static analysis tool error report Assertion z > 2 ∗ n may not always hold. Severin Heiniger Research Topics in Software Engineering May 13th, 2013 2 / 22

  4. Manual Report Classification Program Some Static Analysis Success Potential Error Report User Decides Genuine Bug False Alarm Severin Heiniger Research Topics in Software Engineering May 13th, 2013 3 / 22

  5. Manual Report Classification Time-consuming User repeats all successful reasoning by tool Error-prone Effect Major impediment to adoption of static analysis tools Severin Heiniger Research Topics in Software Engineering May 13th, 2013 4 / 22

  6. Semi-Automated Report Classification Program Some Static Analysis Success Potential Error Report Inferred Invariants This paper: Assist User Genuine Bug False Alarm Severin Heiniger Research Topics in Software Engineering May 13th, 2013 5 / 22

  7. Semi-Automated Report Classification Program with Inferred Invariants and Potential Error Report Identify Sources of Incompleteness Yes or No Check User If uncertain: Small, relevant query Genuine Bug False Alarm Severin Heiniger Research Topics in Software Engineering May 13th, 2013 6 / 22

  8. Queries Proof Obligation Query: Is property P an invariant? If yes, the program is certainly error-free (false alarm) Failure Witness Query: Can property P arise in some execution? If yes, the program is certainly buggy Strategy Pose queries in order of increasing cost (easiest first) to minimize the amount of trusted information the user must supply Severin Heiniger Research Topics in Software Engineering May 13th, 2013 7 / 22

  9. We are Here Program with Inferred Invariants and Potential Error Report Identify Sources of Incompleteness Yes or No Check User If uncertain: Small, relevant query Genuine Bug False Alarm Severin Heiniger Research Topics in Software Engineering May 13th, 2013 8 / 22

  10. Input Program with parameters, local variables, conditionals and while loops Only linear arithmetic, no function calls While loops annotated with inferred post-condition p ′ : while(p) { s } [ p ′ ] Program ends with an assert (p) Severin Heiniger Research Topics in Software Engineering May 13th, 2013 9 / 22

  11. Identify Sources of Incompleteness Symbolically evaluate the program. At each point in the program, environment S maps program variables to symbolic value sets . S ( i ) = { . . . , ( π, φ ) , . . . } Under constraint φ , the value of variable i is the symbolic expression π Constraints φ keep values from different paths separate. π can contain Input Variables ν For unknown program inputs Abstraction Variables α For unknown values due to imprecisions, e.g., after loops Severin Heiniger Research Topics in Software Engineering May 13th, 2013 10 / 22

  12. Example 1 void foo ( i n t f l a g , unsigned i n t n ) { i n t k = 0 , i = 0 , j = 0 , z = 0; 2 S ( k ) = { (0 , true ) } S ( i ) = { (0 , true ) } . . . 3 i f ( f l a g ) k = n ; 4 e l s e k = 1; 5 S ( k ) = { (1 , ¬ ν flag ) , ( ν n , ν flag ) } 6 w h i l e ( i < = n ) { 7 i = i + 1; 8 j = j + i ; 9 } S ( i ) = { ( α i , true ) } S ( j ) = { ( α j , true ) } 10 i n t z = k + i + j ; S ( z ) = { (1 + α i + α j , ¬ ν flag ) , ( ν n + α i + α j , ν flag ) } 11 a s s e r t ( z > 2 ∗ n ) ; 12 13 } abc Severin Heiniger Research Topics in Software Engineering May 13th, 2013 11 / 22

  13. Example 1 void foo ( i n t f l a g , unsigned i n t n ) { i n t k = 0 , i = 0 , j = 0 , z = 0; 2 S ( k ) = { (0 , true ) } S ( i ) = { (0 , true ) } . . . 3 i f ( f l a g ) k = n ; 4 e l s e k = 1; 5 S ( k ) = { (1 , ¬ ν flag ) , ( ν n , ν flag ) } 6 w h i l e ( i < = n ) { 7 i = i + 1; 8 j = j + i ; 9 } [ i ≥ 0 ∧ i > n ] S ( i ) = { ( α i , true ) } S ( j ) = { ( α j , true ) } 10 i n t z = k + i + j ; S ( z ) = { (1 + α i + α j , ¬ ν flag ) , ( ν n + α i + α j , ν flag ) } 11 a s s e r t ( z > 2 ∗ n ) ; 12 13 } Propagate inferred invariants as constraints on abstract variables I = ( α i ≥ 0 ∧ α i > ν n ∧ ν n ≥ 0) Severin Heiniger Research Topics in Software Engineering May 13th, 2013 11 / 22

  14. Example 1 void foo ( i n t f l a g , unsigned i n t n ) { i n t k = 0 , i = 0 , j = 0 , z = 0; 2 S ( k ) = { (0 , true ) } S ( i ) = { (0 , true ) } . . . 3 i f ( f l a g ) k = n ; 4 e l s e k = 1; 5 S ( k ) = { (1 , ¬ ν flag ) , ( ν n , ν flag ) } 6 w h i l e ( i < = n ) { 7 i = i + 1; 8 j = j + i ; 9 } [ i ≥ 0 ∧ i > n ] S ( i ) = { ( α i , true ) } S ( j ) = { ( α j , true ) } 10 i n t z = k + i + j ; S ( z ) = { (1 + α i + α j , ¬ ν flag ) , ( ν n + α i + α j , ν flag ) } 11 a s s e r t ( z > 2 ∗ n ) ; 12 13 } Symbolically evaluate the assertion predicate φ = (1 + α i + α j > 2 ∗ ν n ∧ ¬ ν flag ) ∨ ( ν n + α i + α j > 2 ∗ ν n ∧ ν flag ) Severin Heiniger Research Topics in Software Engineering May 13th, 2013 11 / 22

  15. Result The result is a pair of symbolic constraints I All known invariants on abstract variables φ Condition under which the assertion evaluates to true Severin Heiniger Research Topics in Software Engineering May 13th, 2013 12 / 22

  16. Result The result is a pair of symbolic constraints I All known invariants on abstract variables φ Condition under which the assertion evaluates to true Lemma If I | = φ , then the program is error-free (assertion always succeeds) If I | = ¬ φ , then the program must be buggy (assertion always fails) Severin Heiniger Research Topics in Software Engineering May 13th, 2013 12 / 22

  17. We are Here Program with Inferred Invariants and Potential Error Report Identify Sources of Incompleteness I , φ Yes or No Check User If uncertain: Small, relevant query Genuine Bug False Alarm Severin Heiniger Research Topics in Software Engineering May 13th, 2013 13 / 22

  18. Proof Obligation Given known facts I and success condition φ , a proof obligation is a formula Γ that – together with I – proves φ : Γ ∧ I | = φ and SAT (Γ ∧ I ) Severin Heiniger Research Topics in Software Engineering May 13th, 2013 14 / 22

  19. Proof Obligation Given known facts I and success condition φ , a proof obligation is a formula Γ that – together with I – proves φ : Γ ∧ I | = φ and SAT (Γ ∧ I ) Cost (Γ) 1 · # abstraction variables α ∈ Vars (Γ) + | Vars ( φ ) ∪ Vars ( I ) | · # input variables ν ∈ Vars (Γ) The fewer variables, the better No input variables if possible Severin Heiniger Research Topics in Software Engineering May 13th, 2013 14 / 22

  20. Failure Witness Given known facts I and success condition φ , a failure witness is a formula Υ that – together with I – proves ¬ φ : Υ ∧ I | = ¬ φ and SAT (Υ ∧ I ) Cost (Υ) | Vars ( φ ) ∪ Vars ( I ) | · # abstraction variables α ∈ Vars (Υ) + 1 · # input variables ν ∈ Vars (Υ) The fewer variables, the better Prefer input variables Severin Heiniger Research Topics in Software Engineering May 13th, 2013 15 / 22

  21. Weakest Minimum Queries Weakest Minimum Proof Obligation Γ costs less than or equal to any other proof obligation, and is no stronger than any other proof obligations with same cost Weakest Minimum Failure Witness Υ Dito Severin Heiniger Research Topics in Software Engineering May 13th, 2013 16 / 22

  22. Ask the User Ask the user the one with lower cost Does Γ hold in all program executions? Yes Program is error-free (because Γ ∧ I | = φ ) No Add ¬ Γ to known witnesses and maybe ask another query May Υ arise in some execution? Yes Programm is buggy (because Υ ∧ I | = ¬ φ ) No Add ¬ Υ to known facts I and maybe ask another query Severin Heiniger Research Topics in Software Engineering May 13th, 2013 17 / 22

  23. Example 1 void foo ( i n t f l a g , unsigned i n t n ) { i n t k = 0 , i = 0 , j = 0 , z = 0; 2 i f ( f l a g ) k = n ; 3 e l s e k = 1; 4 5 w h i l e ( i < = n ) { 6 i = i + 1; 7 j = j + i ; 8 } 9 i n t z = k + i + j ; I = ( α i ≥ 0 ∧ α i > ν n ∧ ν n ≥ 0) 10 a s s e r t ( z > 2 ∗ n ) ; φ = (1 + α i + α j > 2 ∗ ν n ∧ ¬ ν flag ) ∨ 11 12 } ( ν n + α i + α j > 2 ∗ ν n ∧ ν flag ) Weakest Minimum Proof Obligation Γ = ( α j ≥ ν n ) Weakest Minimum Failure Witness Υ = ( ¬ ν flag ∧ α i + α j < 0) Severin Heiniger Research Topics in Software Engineering May 13th, 2013 18 / 22

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend