LARA

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
sav07_lecture_3_skeleton [2007/03/20 21:13]
vkuncak
sav07_lecture_3_skeleton [2007/03/21 09:25]
vkuncak
Line 90: Line 90:
 We can apply these rules to reduce the size of formulas. We can apply these rules to reduce the size of formulas.
  
-==== Abstraction ==== 
  
-  ​for proving properties +==== Approximation ==== 
-  * for finding errors+ 
 +If (F -> G) is value, we say that F is stronger than F and we say G is weaker than F. 
 + 
 +When a formula would be too complicated,​ we can instead create a simpler approximate formula. ​ To be sound, if our goal is to prove a property, we need to generate a *larger* relation, which corresponds to a weaker formula describing a relation, and a stronger verification condition. ​ (If we were trying to identify counterexamples,​ we would do the opposite). 
 + 
 +We can replace "​assume F" with "​assume F1" where F1 is weaker. ​ Consequences:​ 
 +  * omtiting complex if conditionals (assuming both branches can happen - as in most type systems) 
 +  * replacing complex assignments with arbitrary change to variable: because x=t is havoc(x);​assume(x=t) and we drop the assume 
 + 
 +This idea is important in static analysis. 
 + 
  
 ==== Symbolic execution ==== ==== Symbolic execution ====
  
 Symbolic execution converts programs into formulas by going forward. ​ It is therefore somewhat analogous to the way an [[interpreter]] for the language would work.  It is based on the notion of strongest postcondition. Symbolic execution converts programs into formulas by going forward. ​ It is therefore somewhat analogous to the way an [[interpreter]] for the language would work.  It is based on the notion of strongest postcondition.
 +
  
  
Line 103: Line 114:
  
 While symbolic execution computes formula by going forward along the program syntax tree, weakest precondition computes formula by going backward. While symbolic execution computes formula by going forward along the program syntax tree, weakest precondition computes formula by going backward.
 +
 +==== Inferring Loop Invariants ====
 +
 +Suppose we compute strongest postcondition in a program where we unroll loop k times.
 +  * What does it denote?  ​
 +  * What is its relationship to loop invariant?
 +
 +Weakening strategies
 +  * maintain a conjunction
 +  * drop conjuncts that do not remain true
 +
 +Alternative:​
 +  * decide that you will only loop for formulas of restricted form, as in abstract interpretation and data flow analysis (next week)
  
 ===== Proving quantifier-free linear arithmetic formulas ===== ===== Proving quantifier-free linear arithmetic formulas =====