100 likes | 236 Views
Refuting Untrue Verification Conditions. Diego S. Zaccai - The Ohio State University. Introduction. Most of the focus has been on proving VCs we assume to be right. Most programmers will make mistakes Our current tools time out most of the time when faced with a VC that is not true . True.
E N D
Refuting Untrue Verification Conditions Diego S. Zaccai - The Ohio State University
Introduction • Most of the focus has been on proving VCs we assume to be right. • Most programmers will make mistakes • Our current tools time out most of the time when faced with a VC that is not true True False Provable Refutable
An Example procedureMultiply (updates n: Natural, restores m: Natural) decreasesm variablezero: Natural ifAreEqual (m, zero) then Clear (n) else variableone: Natural Increment (one) ifIsGreater (m, one) then variablenCopy: Natural nCopy:= Replica (n) Decrement (m) Multiply (n, m) // Increment (m) Add (n, nCopy) endif endif endMultiply
A Sample Untrue VC Verification Condition #5 (state index: 14, parameter mode) ⌚ Prove m0– 1 = m0 Given • 0 ≤ n0 • 0 ≤ m0 • 0 ≤ 0 • 0 ≤ 0 + 1 • 0 ≤ m0 – 1 • 0 ≤ n0 × (m0 – 1) • 0 ≤ n0 × (m0 – 1) + n0 • 0 + 1 < m0 • m0 ≠ 0
Why don’t we disprove them? • Implicit Universal Quantification • Every variable in the VC can take every possible value • This is important when trying to disprove them • We only need a counter example! • Prove: m0 – 1 = m0 • Not necessarily untrue, there might be a contradiction • Can we assign some values to m0 and so n0 that the VC becomes false?
Small Scope Hypothesis • A high proportion of the bugs in code can be found by testing the program for all “small” inputs • Easy enough for Integers and Naturals • Start with zero and “count” up in each variable • Not so obvious for more complex types • Text: Create predefined Strings • Sets: The elements inside are usually not part of the VC • ArrayOfIntegerAsStringFacility? • We do have the model in the VC…
Improving the Search of States • Take into account simple enough givens • 0 ≤ n0 • 0 ≤ m0 • No all of them will be useful • 0 ≤ n0 × (m0 – 1) + n0 • Too complex to create a useful relation between the variables • Cannot replace the original test cases • Just improve on them by refining the state spaces we are interested in
Conclusion • We could take small steps towards providing negative answers • Huge step in terms of usability • Could be able to find counter examples • Is it finally the end of debugging as we know it? • Could potentially end up with yet another tool timing out…
Thank You • Questions? • Comments?