22
Interpolants as Classifiers Rahul Sharma Joint work with Aditya Nori (MSR India) and Alex Aiken (Stanford)

Interpolants as Classifiers

  • Upload
    oriana

  • View
    45

  • Download
    0

Embed Size (px)

DESCRIPTION

Interpolants as Classifiers. Rahul Sharma Joint work with Aditya Nori (MSR India) and Alex Aiken (Stanford). Interpolants. If then an interpolant satisfies: contains only the variables common to and An interpolant is a simple proof - PowerPoint PPT Presentation

Citation preview

Page 1: Interpolants  as Classifiers

Interpolants as ClassifiersRahul SharmaJoint work with Aditya Nori (MSR India) and Alex Aiken (Stanford)

Page 2: Interpolants  as Classifiers

Interpolants

If then an interpolant satisfies:

contains only the variables common to and

An interpolant is a simple proof

Quantifier free formulas in linear arithmetic have quantifier free interpolants.

Page 3: Interpolants  as Classifiers

Example

x

y

Page 4: Interpolants  as Classifiers

Binary Classification

Input: labeled examples Positive examples: Negative examples:

Find true,false For all positives, true For all negatives, false

Page 5: Interpolants  as Classifiers

Verification and ML

Interpolant: separates from

Classifier: separates positive examples from negative examples

Is there a connection?

Page 6: Interpolants  as Classifiers

Yes!

Consider the common variables of and :

Interpolant if If :

separates ’s from ’s

Page 7: Interpolants  as Classifiers

Our Contributions

Main result: view interpolants as classifiers as positive example as negative example

Use state-of-the-art classification algorithms (SVMs) for computing interpolants

Encouraging empirical results

Page 8: Interpolants  as Classifiers

Parallels b/w Verification and ML Unroll the loops

Find interpolants Get general proofs (loop invariants)

Get positive and negative examples Find a classifier Get a predicate which generalizes

Page 9: Interpolants  as Classifiers

Support Vector Machine (SVM)

positive examples

negative examples

++

+

+

+

Page 10: Interpolants  as Classifiers

Support Vector Machine (SVM)

Separators

Separators

Separators

Separators

All separators are good candidates for interpolants

+

++

+

+

Page 11: Interpolants  as Classifiers

Support Vector Machine (SVM)

Optimal Margin Classifier+

+

+

+

Page 12: Interpolants  as Classifiers

Example

x = y = 0;while(*) x++; y++;while(x != 0) x--; y--;assert (y == 0);

x = y = 0;if(*) x++; y++;p:if(x != 0) x--; y--;if(x == 0) assert (y == 0);

Page 13: Interpolants  as Classifiers

Interpolants by SVM

x

y

(0,0)+

+ (1,1)

Page 14: Interpolants  as Classifiers

Basic Algorithm

Let be the common variables of and Generate from satisfying assignments of

Generate from satisfying assignments of

Call SVM with and

Return predicate containing

Page 15: Interpolants  as Classifiers

Two Problems

Data is not linearly separable

The candidate interpolant is not an interpolant

x

y

+

+

Page 16: Interpolants  as Classifiers

No separating inequality

For each SVM( )

return

Cannot generate linear separators with both and .

x

y

(0,0)+

+ (1,1)(0,1)

(1,0)

Page 17: Interpolants  as Classifiers

Candidate is not an Interpolant

while(true) { Find candidate interpolant if ( ) Add to and continue;

if ( ) Add to and continue;

break; Exit if interpolant found } return ;

Theorem: terminates iff output is an interpolant between and

Page 18: Interpolants  as Classifiers

Example

x

y

(0,0)+

+ (1,1)

Interpolant!

Page 19: Interpolants  as Classifiers

Evaluation

1000 lines of C++ LIBSVM for SVM queries Z3 theorem prover

Page 20: Interpolants  as Classifiers

Experiments

Page 21: Interpolants  as Classifiers

Related Work

Interpolants used in tools BLAST, IMPACT …

Interpolants from proofs Krajícek[97], Pudlák[97], McMillan[05],

Interpolants from constraint solving ARMC, Rybalchenko et al. [07]

Page 22: Interpolants  as Classifiers

Conclusion

Connect interpolants and classifiers

A sound interpolation procedure

Future work: non-linear interpolants

Integrate with a verification tool EUF, arrays, bit-vectors, etc.