Discovering affine equalities using random interpretation

被引:11
作者
Gulwani, S [1 ]
Necula, GC [1 ]
机构
[1] Univ Calif Berkeley, Berkeley, CA 94720 USA
关键词
algorithms; theory; verification; affine relationships; linear equalities; random interpretation; randomized algorithm;
D O I
10.1145/640128.604138
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
We present a new polynomial-time randomized algorithm for discovering affine equalities involving variables in a program. The key idea of the algorithm is to execute a code fragment on a few random inputs, but in such a way that all paths are covered on each run. This makes it possible to rule out invalid relationships even with very few runs. The algorithm is based on two main techniques. First, both branches of a conditional are executed on each run and at joint points we perform an affine combination of the joining states. Secondly, in the branches of an equality conditional we adjust the data values on the fly to reflect the truth value of the guarding boolean expression. This increases the number of affine equalities that the analysis discovers. The algorithm is simpler to implement than alternative deterministic versions, has better computational complexity, and has an extremely small probability of error for even a small number of runs. This algorithm is an example of how randomization can provide a trade-off between the cost and complexity of program analysis, and a small probability of unsoundness.
引用
收藏
页码:74 / 84
页数:11
相关论文
共 12 条
[1]   Detecting races in Relay Ladder Logic programs [J].
Aiken A. ;
Fähndrich M. ;
Su Z. .
International Journal on Software Tools for Technology Transfer, 2000, Springer Verlag (03) :93-105
[2]  
Alpern B., 1988, Conference Record of the Fifteenth Annual ACM Symposium on Principles of Programming Languages, P1, DOI 10.1145/73560.73561
[3]   EQUIVALENCE OF FREE BOOLEAN GRAPHS CAN BE DECIDED PROBABILISTICALLY IN POLYNOMIAL-TIME [J].
BLUM, M ;
CHANDRA, AK ;
WEGMAN, MN .
INFORMATION PROCESSING LETTERS, 1980, 10 (02) :80-82
[4]  
COUSOT P, 1977, P 4 ACM S PRINC PROG, P234
[5]  
Cousot P., 1978, POPL 1978, V84, P97, DOI DOI 10.1145/512760.512770
[6]   Dynamically discovering likely program invariants to support program evolution [J].
Ernst, MD ;
Cockrell, J ;
Griswold, WG ;
Notkin, D .
IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2001, 27 (02) :99-123
[7]  
FAHNDRICH M, 1998, P 1998 ACM SIGPLAN C, P85
[8]  
HAMLET D, 1994, ENCY SOFTWARE ENG, P970
[9]   AFFINE RELATIONSHIPS AMONG VARIABLES OF A PROGRAM [J].
KARR, M .
ACTA INFORMATICA, 1976, 6 (02) :133-151
[10]   Translation validation for an optimizing compiler [J].
Necula, GC .
ACM SIGPLAN NOTICES, 2000, 35 (05) :83-94