Tags :
utility evidence
proof interpolant
evidence
utility
interpolant
proof
generalization
smt
retrospection
samples
generalizations
interpolants
correctness
clause
inductive
lazy
methods

Download Presentation

Download Presentation - The PPT/PDF document "Revisiting Generalizations" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

Revisiting Generalizations

Ken McMillanMicrosoft Research

Aws Albarghouthi

University of Toronto

Slide2Generalization

Interpolants are generalizationsWe use them as a way of forming conjectures and lemmasMany proof search methods uses interpolants as generalizationsSAT/SMT solversCEGAR, lazy abstraction, etc.Interpolant-based invariants, IC3, etc.

There is widespread use of the idea that

interpolants

are generalizations, and generalizations help to form proofs

Slide3In this talk

We will consider measures of the quality of these generalizationsI will argue:The evidence for these generalizations is often weakThis motivates a retrospective approach: revisiting prior generalizations in light of new evidenceThis suggests new approaches to interpolation and proof search methods that use it.

We’ll consider how these ideas

may apply

in SMT and

IC3.

Slide4Criteria for generalization

A generalization is an inference that in some way covers a particular case

Example: a learned clause in a SAT solver

We require two properties of a generalization:Correctness: it must be trueUtility: it must make our proof task easier

A useful inference is one that occurs in a simple proof

Let us consider what evidence we might produce for correctness and utility of a given inference…

Slide5What evidence can we provide?

Evidence for correctness:

Proof (best)

Bounded proof (pretty good)

True in a few cases (weak)

Evidence for utility:

Useful for one truth assignment

Useful for one program path

Slide6Interpolants as generalizations

Consider a bounded model checking formula:

Evidence for

interpolant

as conjectured invariant

Correctness: true after 3 steps

Utility: implies property after three steps

Note the duality

In invariant generation, correctness and utility are time-reversal duals.

interpolant

Slide7CDCL SAT solvers

A learned clause is a generalization (

interpolant

)

Evidence for correctness:

Proof by resolution (strong!)

Evidence for utility:

Simplifies proof of current assignment (weak!)

In fact, CDCL solvers produce many clauses of low utility that are later deleted.

Retrospection

CDCL has a mechanism of revisiting prior generalization in the light of new evidence

This is called “non-chronological backtracking”

Slide8Retrospection in CDCL

CDCL can replace an old generalization with a new one that covers more casesThat is, utility evidence of the new clause is better

The decision stack:

Conflict!

Learned clause

contradicts

Backtrack to here

Learned clause

contradicts

Backtrack to here

drops out of the proof on backtrack!

Slide9

Retrospection in CEGAR

Greater evidence for than Two cases against oneHowever, most CEGAR methods cannot remove the useless predicate at this point

This path has two possible refutations of equal utility

Use predicate

here

Next path can only be refuted using

CEGAR considers one counterexample path at a time

Slide10Retrospection and Lazy SMT

Lazy SMT is a form of CEGAR“program path” truth assignment (disjunct in DNF)A theory lemma is a generalization (interpolant)Evidence for correctness: proofEvidence for utility: Handles one disjunctCan lead to many irrelevant theory lemmasDifficulties of retrospection in lazy SMTIncrementally revising theory lemmasArchitecture may prohibit useful generalizations

Slide11

Diamond example with lazy SMT

Theory lemmas correspond to program paths:

… (16 lemmas, exponential in number of diamonds)

Lemmas have low utility because each covers only once case

Lazy SMT framework does not allow higher utility inferences

Slide12

Diamond example (cont.)

We can produce higher utility inferences by structurally decomposing the problemEach covers many pathsProof is linear in number of diamonds

Slide13

Compositional SMT

To prove unsatisfiability of Infer an interpolant such that and .The interpolant decomposes the proof structurallyEnumerate disjuncts (samples) of separately.

Choose

so and

If not then add a disjunct to and continue…

If not then add a disjunct to and continue…

is

unsatisfiable

!

Use SMT solver

As block box

Chose to cover the samples as simply as possible

With each new sample, we reconsider the

interpolant

to maximize utility

Slide14Example in linear rational arithmetic

and

can be seen as sets of convex

polytopes

An

interpolant

is a separator for these sets.

Slide15

Compositional approach

1. Choose two samples from and and compute an interpolant

Point (1,3) is in

, but not

2. Add new sample

containing point (1,3) and update interpolant to

3.

Interpolant now covers all disjuncts

Notice we reconsidered our first interpolant choice in light of further evidence.

Slide16Comparison to Lazy SMT

Interpolant from a lazy SMT solver proof:

Each half-space corresponds to a theory lemma

Theory lemmas have low utilityFour lemmas cover six cases

Slide17

B

3

Why is the simpler proof better?

A simple fact that covers many cases may indicate an emerging pattern...

B

4

Greater complexity allows

overfitting

Especially important in invariant generation

Slide18Finding simple interpolants

We break this problem into two partsSearch for large subsets of the samples that can be separated by linear half-spaces.Synthesize an interpolant as a Boolean combination of these separators.

The first part can be accomplished by well-established methods, using an LP solver and

Farkas

’ lemma. The Boolean function synthesis problem is also well studied, though we may wish to use more light-weight methods.

Slide19Farkas’ lemma and linear separators

Farkas’ lemma says that inconsistent rational linear constraints can be refuted by summation:

()()

(

)

constraints

s

olve

The proof of

unsat

can be found by an LP solver

We can use this to discover a linear

interpolant

for two sets of convex

polytopes

and

.

Slide20

Finding separating half-spaces

Use LP to simultaneously solve for:A linear separator of the form A proof that for each in A proof that for each in The separator is an interpolant for The evidence for utility of is the size of and Thus, we search for large sample sets that can be linearly separated.We can also make simpler by setting as many coefficients in to zero as possible.

Slide21

Half-spaces to interpolants

When every pair of samples in are separated by some half space, we can build an interpolant as a Boolean combination.

Each region is a cube over half-spaces

Must be true

Must be false

Don’t care

In practice, we don’t have to synthesize an optimal combination

Slide22Sequential verification

We can extend our notions of evidence and retrospection to sequential verificationA “case” may be some sequence of program stepsConsider a simple sequential program:

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

{y

x}

Wish to discover invariant

:

Slide23{y = 0}

{y = 1}

{y = 2}

{y = 1}

{y = 0}

{False}

{True}

{x

y}

{x

y}

{x y}

{x y}

{x y}

{False}

{True}

Execute the loops twice

These interpolants cover all the cases with just one predicate.In fact, they are inductive.

These predicates have low utility, since each covers just one case.As a result, we “overfit” and do not discover the emerging pattern.

x = y = 0;x++; y++;x++; y++;[x!=0];x--; y--;[x!=0];x--; y--;[x == 0][y > 0]

Choose

interpolants

at each step, in hope of obtaining inductive invariant.

Slide24

Sequential interpolation strategy

Compute

interpolants

for all steps simultaneously

Collect

(pre) and

(post) samples at each step

Utility of a half-space measured by how many sample pairs it separates in total.

Step 0: low evidence

(bad!)

Step 1: better evidence

(good!)

Slide25

Occam’s razor says simplicity prevents over-fittingThis is not the whose story, howeverConsider different separators of similar complexity

Are simple interpolants enough?

(good!)

(yikes!)

Simplicity of the

interpolant

may not be sufficient for a good generalization.

Slide26Proof simplicity criterion

Empirically, the strange separators seem to be avoided by minimizing proof complexity

Maximize zero coefficients in

Farkas

proofs

This can be done in a greedy way

Note the difference between applying Occam’s razor in synthetic and analytic cases

We are generalizing not from data but from an

argument

We want the argument to be as simple as possible

Slide27Value of retrospection

30 small programs over integersTricky inductive invariants involving linear constraintsSome disjunctive, most conjunctive

ToolComp. SMTCPACheckerUFOInvGenwith AIInvGen w/o AI% solved10057577060

Better evidence for generalizations

Better fits the observed cases

Results in better convergence

Still must trade off cost v. utility in generalizing

Avoid excessive search while maintaining convergence

Slide28Value of retrospection (cont)

Bounded model checking of inc/dec programApply compositional SMT to the BMC unfoldingFirst half of unfolding is , second half is Compare to standard lazy SMT using Z3

Exponential theory lemmas achieved in practice.

Computing one

interpolant

gives power ½ speedup.

Slide29Incremental inductive methods (IC3)

Compute a sequence interpolant by local proof

Interpolant

successively weakens

Check:

Cex:

Check:

Cex:

Check:

Goal:

Goal:

is inductive

relative

to

Inductive generalization

Infer clause

satisfying:

Valid!

Slide30Generalization in IC3

Think of inferred clauses as speculated invariantsEvidence for correctnessClause is proved up to stepsRelative inductiveness (except initial inferences)Clause is “as good as” previous speculationsEvidence for utilityRules out one bad sampleNote the asymmetry hereCorrectness and utility are dualIC3 prefers correctness to utilityIs the cost paid for this evidence too high?

(bad state)

Inductive generalization

Slide31Retrospection in IC3?

Find a relatively inductive clause that covers as many bad states as possible

Search might be inefficient, since each test is a SAT problem

Possible solution: relax correctness evidence

Sample on both A and B side

Correctness evidence is invariance in a sample of behaviors rather than all up to depth k.

Slide32True in all A samples

Generalization problem

separator

A samples

(reachable states)

False in many B samples

B

samples

(bad states)

Find a clause to separate A and B samples

This is another two-level logic optimization problem. This suggests logic optimization techniques could be applied to computing

interpolants

in incremental inductive style.

Slide33Questions to ask

For a given inference technique we can ask

Where does generalization occur?

Is there good evidence for

generalizations?

Can retrospection be applied?

What form do separators take?

How can I solve for separators? At what cost?

Theories: arrays, nonlinear arithmetic,…

Can I

improve the cost?

Shift the tradeoff of utility and correctness

Can proof complexity be minimized?

Ultimately, is the cost of better generalization justified?

Slide34Conclusion

Many

proof search

methods rely

on

interpolants

as generalizations

Useful to the extent the make the proof simpler

Evidence of

u

tility in existing methods

is

weak

Usually amounts to utility in one case

Can lead to many useless inferences

Retrospection: revisit inferences on new evidence

For example, non-chronological backtracking

Allows more global view of the problem

Reduces commitment to inferences based on little evidence

Slide35Conclusion (cont)

Compositional SMT

Modular approach to interpolation

Find simple proofs covering many cases

Constraint-based search

method

Improves convergence of invariant discovery

Exposes emerging pattern in loop

unfoldings

Think about methods in terms of

The form of generalization

Quality of evidence for correctness and utility

Cost v. benefit of the evidence provided

Slide36Cost of retrospection

Early retrospective approach due to

Anubhav

Gupta

Finite-state localization abstraction method

Finds optimal localization covering all abstract

cex’s

.

In practice, “quick and dirty” often better than optimal

Compositional SMT usually slower than direct SMT

However, if bad generalizations imply divergence, then the cost of retrospection is justified.

Need to understand when revisiting generalizations is justified.

Slide37Inference problem

Find a clause to separate A and B samples

Clause must have a literal from every A sample

Literals must be false in many B samples

This is a binate covering problem

Wells studied in logic synthesis

Relate to

Bloem

et al

Can still use relative inductive strengthening

Better utility and evidence

Slide38Slide39

Slide40

© 2020 docslides.com Inc.

All rights reserved.