prev

next

of 46

View

243Download

0

Embed Size (px)

Nelson-Oppen reviewxy = 0 z = 0 f(f(x) f(z)) f(z) f(f(y) f(z)) f(z)

Nelson-Oppen reviewxy = 0 z = 0 f(f(x) f(z)) f(z) f(f(y) f(z)) f(z)

Drawback of Nelson-Oppen

Drawback of Nelson-OppenTheory must be convex, otherwise must backtrackSome large overheads:Each decision procedure must maintain its own equalitiesThere are a quadratic number of equalities that can be propagated

Shostaks approachAlternate approach to combining theories that addresses some of the performance drawbacks of Nelson-OppenPublished in 1984 in JACM, but the original formulation was later found to be flawed in several waysLong line of work to correct these mistakesCulminating in Deconstructing Shostak by Ruess and Shankar, which gives sound and complete version of ShostakUnpublished manuscript by Crocker from 1988 showing that Shostak is 10 times faster than Nelson-OppenRecent paper by Barrett, Dill and Stump in 2002 shows that Shostak can be seen as a special case of Nelson-Oppen

Shostaks approachShostak is used in a variety of theorem provers, including PVS and SVCWe will cover the intuition behind Shostaks approach, but we wont see the details

The key idea in ShostakKeep one congruence closure data-structure S for all theoriesEach individual decision procedure finds new equalities based on the ones that are already in SAs individual decision procedures find equalities, add them to S

Adding equalities to SStraightforward to encode equalities over uninterpreted function symbols in SSince S is a congruence-closure data structure, since congruence closure was originally intended for exactly these kinds of equalitiesInterpreted functions symbols require more careFor example, an equality y + 1 = x + 2 cannot be processed by simply putting y + 1 and x + 2 in the same equivalence class, since the original equality in fact entails a multitude of equalities, such as y = x + 1, y 1 = x, y -2 = x -1, etc.

Impose two restrictionsTheories must be solvable: any set of equalities in the theory must have an equivalent solved formEqualities are in solved form if the left hand side of the equalities are only variables and the right-hand sides are expressions that dont reference any of the left-hand side variables

x + y = z + 3x y = 3z + 1

Impose two restrictionsTheories must be solvable: any set of equalities in the theory must have an equivalent solved formEqualities are in solved form if the left hand side of the equalities are only variables and the right-hand sides are expressions that dont reference any of the left-hand side variables

x + y = z + 3x y = 3z + 1

Impose two restrictionsTheories must be solvable: any set of equalities in the theory must have an equivalent solved formEqualities are in solved form if the left hand side of the equalities are only variables and the right-hand sides are expressions that dont reference any of the left-hand side variablesWill use this to substitute solved variables in all terms

Impose two restrictions2.Theory must be canonizableThere is a canonizer function such that if a = b, then (a) is syntactically equal to (b)Canonizer for linear arithmetic: transform terms into ordered monomials (a + 3c + 4b + 3 + 2a + 4) = 3a + 4b + 3c + 7The intuition is that by canonizing all terms, we can then use syntactic equality to determine semantic equality

Putting it all togetherf(x 1) 1 = x + 1 f(y) + 1 = y 1 y + 1 =x

Putting it all togetherf(x 1) 1 = x + 1 f(y) + 1 = y 1 y + 1 =x

ACL2 decision proceduresACL2 architectureGiven a goal, ACL2 has a set of strategies it can applyFor example: rewriting, simplification, inductionApplying a strategy produces sub-goals from the given goalEach sub-goal needs to be proven recursively

Adding linear arithmeticFirst attempt was to just use the decision procedures directly as a strategyNot found to be useful, because it was rarely the case that the goal would reduce to TRUE using linear arithmeticRather, they found they needed to add linear arithmetic in the rewrite systemA rewrite rule: A ) T1 = T2To trigger, need to establish AThey often needed linear arithmetic to establish A

Keep a linear arith DBA rewrite rule: A ) T1 = T2To establish A, add : A to the current database of linear equalities and inequalitiesIf an inconsistency is reached, we know A holdsWe can perform the rewriteRemove : A from the database, and add AAs in Simplify, the arith DB is used for matching heuristic to instantiate quantifiers

Decision procedures summaryCommunication between decision proceduresNelson-Oppen (simplify), Shostak (PVS, SVC)Communication from heuristic prover to decision proceduresassert formulas (most theorem provers)Communication from decision procedures to heuristic theorem proveryes/no answers (all theorem provers)terms to use for matching (Simplify, ACL2)proofs to prune search space (Verifun)

So farE-graphCommunication between decision procedures and between prover and decision proceduresDPLLBacktrackingIncremental SATMatching,skolemizationNext

The two statements ` set of formulasone formulaentails, or modelsis provable from In all worlds where the formulas in hold, holds is provable from assumptions SemanticSyntactic

Link between and `Soundness: ` implies Completeness: implies `

Virtually all inference systems are soundTherefore, to establish , all one needs to do is find a derivation of `

Goal: find a proofNeed two things:A proof systemA seach strategyThese two are heavily intertwinedLets start by looking at some proof systems

Hilbert-style systemsMany axioms and usually just one inference rule, modus ponens

X ) ( Y ) X)(X ) (Y ) Z)) ) ((X ) Y) ) (X ) Z))F ) XX ) T : : X ) XX ) (: X ) Y)Axiom (schemas)A A ) BB MPInference ruleComing up with a complete set of axiom schemas is not trivial

Example proofShow: P ) PX ) ( Y ) X)(X ) (Y ) Z)) ) ((X ) Y) ) (X ) Z))F ) XX ) T : : X ) XX ) (: X ) Y)A A ) BB MP

Example proofShow: P ) PInstantiate 2 with X being P, Y being P ) P, and Z being P:(P ) ((P) P) ) P)) ) ((P ) (P ) P)) ) (P ) P))Instantiate 1, taking X to be P and Y to be P ) P:P ) ( (P) P) ) P)Instantiate 1 with X and Y to be P:P ) (P ) P)X ) ( Y ) X)(X ) (Y ) Z)) ) ((X ) Y) ) (X ) Z))F ) XX ) T : : X ) XX ) (: X ) Y)A A ) BB MP

Example proofShow: P ) PInstantiate 2 with X being P, Y being P ) P, and Z being P:(P ) ((P) P) ) P)) ) ((P ) (P ) P)) ) (P ) P)) *Instantiate 1, taking X to be P and Y to be P ) P:P ) ( (P) P) ) P) **Instantiate 1 with X and Y to be P:P ) (P ) P) ***Apply MP on * and **:(P ) (P ) P)) ) (P ) P) ****Apply MP on *** and ****:P ) PX ) ( Y ) X)(X ) (Y ) Z)) ) ((X ) Y) ) (X ) Z))F ) XX ) T : : X ) XX ) (: X ) Y)A A ) BB MP

Hilbert-style systemsDoes not mimic the way humans do proofsTo prove A ) B in a Hilbert-style system, must find the right way instantiate axioms and then apply MP to get A ) BHow does a human prove A ) B?

Hilbert-style systemsDoes not mimic the way humans do proofsTo prove A ) B in a Hilbert-style system, must find the right way instantiate axioms and then apply MP to get A ) BHow does a human prove A ) B?Assume A, and show BIn this context, showing P ) P is very easy

Natural deductionThe system of natural deduction was developed by Gentzen in 1935 out of dissatisfaction with Hilbert-style axiomatic systems, which did not closely mirror the way humans usually perform proofsGentzen wanted to create a system that mimics the natural way in which humans think

Natural deduction rule for A ) B, A ` B ` A ) B

Natural deduction rule for A ) BThis is called an introduction rule, since it introduces the ) connective, A ` B ` A ) B )I

Natural deduction rule for A ) BThis is called an introduction rule, since it introduces the ) connectiveEach connective also has an elimination rule

, A ` B ` A ) B )I

Natural deduction rule for A ) BThis is called an introduction rule, since it introduces the ) connectiveEach connective also has an elimination rule, A ` B ` A ) B )I ` A ` A ) B ` B )E

Natural deduction ` A B ` A BIE ` A B I ` A BE

Natural deduction ` : A : I ` : A : E ` F FI ` F FE ` T TI ` T TE

Natural deduction ` A ` B ` A B ` A B ` A ` A B ` B, A ` B ` A ) B ` A ` A ) B ` B , A ` AIE1E2Assume)I)E ` A ` A B I1 ` B ` A B I2 ` A B ` C E, A ` C , B ` C

Natural deduction, A ` F ` : A : I ` : : A ` A : E ` A ` : A ` F FI ` F ` A FE ` T TINo T elminationNote: one can get rid of the FE without losing expressiveness. Can someone see why?

Once we have a proof systemOnce we have a proof system, the goal is to devise a search algorithm to find a proofSearch algorithm sound: proofs that it finds are correctSearch algorithm complete: if there is a proof, the algorithm will find itThese soundness and completeness properties relate the search algorithm to the proof system, and should not be confused with soundness and completeness of the proof system

Two main strategiesGiven a formula to prove:One can start from axioms and apply inference rules forward, until a derivation of the given formula is foundOne can start from the formula to prove (the goal) and apply inference rules backward to find sub-goals until all sub-goals are axiomsThe forward version is sometimes called forward chaining, the backward version backward chaining

Forward searchKeep a knowledge base, which is the set of formulas that have been proved so farGiven goal to prove:S