Beyond Quantifier-Free Interpolation in Extensions of Presburger Arithmetic Angelo Brillout, 1 Daniel Kroening, 2 ummer, 3 Thomas Wahl 2 Philipp R¨ 1 ETH Zurich 2 Oxford University 3 Uppsala University Deduction at Scale, March 10th, 2011 1 / 22
Motivation: invariant inference i n t a [ ] , i ; max = a [ 0 ] ; f o r ( i = 1; i < n ; ++i ) i f ( a [ i ] > max) max = a [ i ] ; a s s e r t (max > = a [ i / 2 ] ) ; Goal: infer post conditions of loop executions Instrument: inductive loop invariant φ pre ⇒ φ { φ } body { φ } φ ⇒ post { pre } body ∗ { post } φ can be found using Craig interpolation + fixed-point iteration [McMillan, 2003] 2 / 22
Interpolation: definition Definition (Craig interpolant) Given FO formulae A , B such that A ⇒ B is valid, an interpolant is a formula I such that 1. A ⇒ I , I ⇒ B 2. symb ( I ) ⊆ symb ( A ) ∩ symb ( B ) Example: p is an interpolant for p ∧ q ⇒ p ∨ r . If A , B are FO formulas with A ⇒ B , there is an interpolant. [W. Craig, 1957] 3 / 22
❼ ❼ In this talk . . . Starting point: ❼ Interpolation in quantifier-free Presburger Arithmetic (PA) [IJCAR, 2010] We investigate combination with: ❼ Quantifiers ❼ Uninterpreted predicates (UP) ❼ Uninterpreted functions (UF) ❼ Theory of arrays (AR) 4 / 22
In this talk . . . Starting point: ❼ Interpolation in quantifier-free Presburger Arithmetic (PA) [IJCAR, 2010] We investigate combination with: ❼ Quantifiers ❼ Uninterpreted predicates (UP) ❼ Uninterpreted functions (UF) ❼ Theory of arrays (AR) ❼ Paper: [VMCAI, 2011] ❼ Earlier version: [VERIFY, 2010] 4 / 22
Interesting questions ❼ Decidability of validity ❼ PA is decidable (also with quantifiers ⇒ QPA) ❼ PA+UP, PA+UF, PA+AR are decidable ❼ QPA+* is undecidable ❼ Closure under interpolation ❼ Practical interpolation procedures 5 / 22
Fragments of extensions of Presburger Arithmetic φ ∶∶= t = t ∣ t ≤ t ∣ α ∣ t ∣ p ( ¯ t ) ∣ φ ∧ φ ∣ φ ∨ φ ∣ ¬ φ ∣ ∀ x .φ ∣ ∃ x .φ t ∶∶= α ∣ c ∣ x ∣ α t + ⋯ + α t ∣ f ( ¯ t ) where φ is a formula t is a term α is an integer literal c / p / f is a constant/UP/UF (uninterpreted) x is an integer variable 6 / 22
Fragments of extensions of Presburger Arithmetic φ ∶∶= t = t ∣ t ≤ t ∣ α ∣ t ∣ p ( ¯ t ) ∣ φ ∧ φ ∣ φ ∨ φ ∣ ¬ φ ∣ ∀ x .φ ∣ ∃ x .φ t ∶∶= α ∣ c ∣ x ∣ α t + ⋯ + α t ∣ f ( ¯ t ) gives rise to various fragments/logics: ❼ PA: no UP, UF, quantifiers ❼ QPA: PA + quantifiers ❼ PA+UP, PA+UF ❼ QPA+UP, QPA+UF ❼ PA+AR: PA + distinguished functions select , store 6 / 22
Which fragments are closed under interpolation? Definition Fragment F is closed under interpolation if for all A , B ∈ F such that A ⇒ B , there is an interpolant expressible in F . [Kapur et al, 2006: “ F is interpolating ”] 7 / 22
Known results ⇒ (Q)PA closed under interpolation (as it allows quantifier elimination) ⇒ QPA+AR closed (add quantifiers for local variables) ⇒ PA+AR not closed (not even without PA, [Kapur et al, 2006]) ⇒ QPA+UP not closed QPA+UF (since interpolation could simulate second-order quantifier elimination) 8 / 22
❼ Is PA+UP closed under interpolation? 9 / 22
❼ Is PA+UP closed under interpolation? Consider example: ∶∶ ( 2 c = y ∧ p ( c )) ⇒ ( 2 d = y ⇒ p ( d )) φ 9 / 22
❼ Is PA+UP closed under interpolation? Consider example: ∶∶ ( 2 c = y ∧ p ( c )) ⇒ ( 2 d = y ⇒ p ( d )) φ “Feels-like interpolant”: p ( y 2 ) 9 / 22
❼ Is PA+UP closed under interpolation? Consider example: ∶∶ ( 2 c = y ∧ p ( c )) ⇒ ( 2 d = y ⇒ p ( d )) φ “Feels-like interpolant”: p ( y 2 ) I 1 ∶ ∃ c . ( 2 c = y ∧ p ( c )) strongest: I 2 ∶ ∀ d . ( 2 d = y ⇒ p ( d )) Really: weakest: Can we eliminate ∃ , ∀ in the φ example? 9 / 22
Is PA+UP closed under interpolation? Consider example: ∶∶ ( 2 c = y ∧ p ( c )) ⇒ ( 2 d = y ⇒ p ( d )) φ “Feels-like interpolant”: p ( y 2 ) I 1 ∶ ∃ c . ( 2 c = y ∧ p ( c )) strongest: I 2 ∶ ∀ d . ( 2 d = y ⇒ p ( d )) Really: weakest: Can we eliminate ∃ , ∀ in the φ example? No! ❼ I 1 , I 2 cannot be expressed in PA+UP (i.e., without quantifiers) 9 / 22
New negative result Theorem PA+UP is not closed under interpolation. (Similarly for PA+UF) 10 / 22
Closure results ⇒ (Q)PA closed under interpolation (as it allows quantifier elimination) ⇒ QPA+AR closed (add quantifiers for local variables) ⇒ PA+AR not closed (not even without PA, [Kapur et al, 2006]) ⇒ QPA+UP not closed QPA+UF (since interpolation could simulate second-order quantifier elimination) ⇒ PA+UP not closed ⇒ PA+UF not closed 11 / 22
Closure results ⇒ (Q)PA closed under interpolation (as it allows quantifier elimination) ⇒ QPA+AR closed (add quantifiers for local variables) ⇒ PA+AR not closed (not even without PA, [Kapur et al, 2006]) ⇒ QPA+UP not closed QPA+UF (since interpolation could simulate second-order quantifier elimination) ⇒ PA+UP not closed ⇒ PA+UF not closed Anything positive? 11 / 22
Positive results Lemma (interpolants with quantifiers) If A ⇒ B is a valid PA+UP formula, then there is a QPA+UP interpolant A ⇒ I ⇒ B. (Similarly for PA+UF, PA+AR.) Theorem (extension of PA+UP) There is a (natural) extension of PA+UP that is ❼ decidable, and ❼ closed under interpolation. (Similarly for PA+UF.) 12 / 22
Decidability by stack of encodings Theory of arrays + array axioms QPA+UF (unint. functions) + functionality axioms QPA+UP (unint. predicates) + consistency axioms QPA (Presburger Arithmetic) ⇒ Decision proc. for PA+AR, PA+UF, PA+UP ⇒ “Similar” to standard implementation in SMT solvers 13 / 22
❼ ❼ ❼ Interpolation by stack of encodings = PA+* calculus PA calculus + (ground) quantifier handling + theory axioms 14 / 22
Interpolation by stack of encodings = Interpolating } PA+* calculus PA calculus version in + (ground) quantifier handling VMCAI paper + theory axioms Interpolants from proofs ❼ recursively annotate proof with partial interpolants, according to interpolating rules ❼ “total” interpolants extracted from closed proofs ❼ proves existence of QPA+* interpolants. 14 / 22
How to close PA+UP under interpolation 15 / 22
How to close PA+UP under interpolation Need ability to use witness for α ∣ t in terms: ∶∶ ( 2 c = y ∧ p ( c )) ⇒ ( 2 d = y ⇒ p ( d )) φ with strongest interpolant ∃ x . ( 2 x = y ∧ p ( x )) 15 / 22
How to close PA+UP under interpolation Need ability to use witness for α ∣ t in terms: ∶∶ ( 2 c = y ∧ p ( c )) ⇒ ( 2 d = y ⇒ p ( d )) φ with strongest interpolant ∃ x . ( 2 x = y ∧ p ( x )) Definition PAID+UP = PA+UP plus guarded quantification: ∃ x . ( α x = t ∧ φ ) ∀ x . ( α x = t ⇒ φ ) ( α / = 0, x not in t ) 15 / 22
How to close PA+UP under interpolation Need ability to use witness for α ∣ t in terms: ∶∶ ( 2 c = y ∧ p ( c )) ⇒ ( 2 d = y ⇒ p ( d )) φ with strongest interpolant ∃ x . ( 2 x = y ∧ p ( x )) Definition PAID+UP = PA+UP plus guarded quantification: ∃ x . ( α x = t ∧ φ ) ∀ x . ( α x = t ⇒ φ ) ( α / = 0, x not in t ) Is this just to accommodate φ ’s interpolant?? 15 / 22
Interpolating in PAID+UP Theorem PAID+UP is closed under interpolation. (Similarly for PAID+UF) Proof: 1. Define a restricted version of our calculus that only generates PAID+UP interpolants ❼ Only unify atoms p ( ¯ s ) , p ( ¯ t ) or terms f ( ¯ s ) , f ( ¯ t ) if ¯ s = ¯ t has been derived 2. Show that the restricted calculus is still complete for PAID+UP 16 / 22
Expressiveness of guarded quantifiers They encode integer division: ∃ x . ( α x = t ∧ φ ) ≡ ( α ∣ t ) ∧ φ [ x → ( t ÷ α )] ∃ x . ( α x = t ∧ true ) ≡ α ⋅ ( t ÷ α ) = t �ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ�ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ� α ∣ t 17 / 22
PA+UP can be closed! PA � ⇘ QPA PA+UP Legend: ⇓ decidable PAID+UP undecidable ABCD = closed ⇓ under interpolation QPA+UP ⇓ = subset 18 / 22
What do we have? ❼ Sound + complete interpolating calculus for PAID+UP, PAID+UF, PAID+AR ❼ Generated interpolants stay within PAID+UP, PAID+UF, QPA+AR ❼ Calculus is close to procedures used in SMT solvers Future directions: ❼ Extensions of PAID+AR closed under interpolation? (+ decidable) ❼ Implementations ❼ Integration in Yorsh + Musuvathi’s combination framework? 19 / 22
Related work: integer arithmetic interpolation ❼ Reduction to FOL [Kapur, Majumdar, Zarba, 2006] ❼ Simplex-based [Lynch, Tang, 2008] ❼ Sequent calculus-based [Brillout, Kroening, R¨ ummer, Wahl, 2010] ❼ Again Simplex-based [Kroening, Leroux, R¨ ummer, 2010] ❼ Simplex-based, targetting SMT [Griggio, Le, Sebastiani, 2011] 20 / 22
Recommend
More recommend