Towards Efficient Quantifier Elimination in Mathematica Katherine - - PowerPoint PPT Presentation

towards efficient quantifier elimination in mathematica
SMART_READER_LITE
LIVE PREVIEW

Towards Efficient Quantifier Elimination in Mathematica Katherine - - PowerPoint PPT Presentation

Towards Efficient Quantifier Elimination in Mathematica Katherine Cordwell 15824 December 11, 2018 Katherine Cordwell (15824) QE December 11, 2018 1 / 29 Introduction What is quantifier elimination (QE)? Example: x 1 x 2 ( x 1


slide-1
SLIDE 1

Towards Efficient Quantifier Elimination in Mathematica

Katherine Cordwell

15824

December 11, 2018

Katherine Cordwell (15824) QE December 11, 2018 1 / 29

slide-2
SLIDE 2

Introduction

What is quantifier elimination (QE)?

  • Example: ∀x1∃x2(x1 + x2 = 0) becomes “True”

1Adapted from Pablo Parillo’s lecture notes

Katherine Cordwell (15824) QE December 11, 2018 2 / 29

slide-3
SLIDE 3

Introduction

What is quantifier elimination (QE)?

  • Example: ∀x1∃x2(x1 + x2 = 0) becomes “True”
  • Example: ∀x1∀x2(x2

1 + ax2 2 ≤ 1) → ax2 1 − a2x1x2 + 2 ≥ 0 becomes

(a ≥ 0) ∧ (a3 − 8a − 16) ≤ 01

1Adapted from Pablo Parillo’s lecture notes

Katherine Cordwell (15824) QE December 11, 2018 2 / 29

slide-4
SLIDE 4

Introduction

Two seminal results

  • Quantifier elimination is decidable (Tarski, 1930).
  • Cylindrical algebraic decomposition (CAD) algorithm (Collins,

1975)

Katherine Cordwell (15824) QE December 11, 2018 3 / 29

slide-5
SLIDE 5

Introduction

Why is QE important in theorem proving?

  • Safety proofs of hybrid systems reduce to real arithmetic questions.
  • Efficient QE is key for efficient proofs.

Katherine Cordwell (15824) QE December 11, 2018 4 / 29

slide-6
SLIDE 6

Introduction

Why is QE important in theorem proving?

  • Safety proofs of hybrid systems reduce to real arithmetic questions.
  • Efficient QE is key for efficient proofs.
  • KeYmaera X outsources QE calls to Mathematica.

Katherine Cordwell (15824) QE December 11, 2018 4 / 29

slide-7
SLIDE 7

Introduction

Our Goal

Improve quantifier elimination in Mathematica, with a view towards increasing the efficiency of KeYmaera X.

Katherine Cordwell (15824) QE December 11, 2018 5 / 29

slide-8
SLIDE 8

Approach

Our Approach

  • Focus on the universal fragment of decision problems

∀x1, ∀x2, . . . , ∀xk φ(x1, . . . , xk)

Katherine Cordwell (15824) QE December 11, 2018 6 / 29

slide-9
SLIDE 9

Approach

Our Approach

  • Focus on the universal fragment of decision problems

∀x1, ∀x2, . . . , ∀xk φ(x1, . . . , xk)

  • Because we can put formulas into CNF, we focus on disjunctions.

Katherine Cordwell (15824) QE December 11, 2018 6 / 29

slide-10
SLIDE 10

Approach

Our Approach

Two sub-approaches:

  • Analyze the structures of the input polynomials.
  • Analyze the structures of the polynomials computed during CAD.

Katherine Cordwell (15824) QE December 11, 2018 7 / 29

slide-11
SLIDE 11

Approach

Our Approach

Two sub-approaches:

  • Analyze the structures of the input polynomials.
  • Analyze the structures of the polynomials computed during CAD.

Katherine Cordwell (15824) QE December 11, 2018 8 / 29

slide-12
SLIDE 12

Polynomials

Odd Degree Variables

Example 1 ∀v, w, x, y, z(−6 − 7v2w3x + 9v2w3xyz + 6v3w2z2 > 0 ∨ 6 − 5v2w2xy + 7v3wx3yz + vy3z > 0)

Katherine Cordwell (15824) QE December 11, 2018 9 / 29

slide-13
SLIDE 13

Polynomials

Odd Degree Variables

Example 1 ∀v, w, x, y, z(−6 − 7v2w3x + 9v2w3xyz + 6v3w2z2 > 0 ∨ 6 − 5v2w2xy + 7v3wx3yz + vy3z > 0)

  • Notice that v has odd degree in both polynomials.

Katherine Cordwell (15824) QE December 11, 2018 10 / 29

slide-14
SLIDE 14

Polynomials

Odd Degree Variables

Example 1 ∀v, w, x, y, z(−6 − 7v2w3x + 9v2w3xyz + 6v3w2z2 > 0 ∨ 6 − 5v2w2xy + 7v3wx3yz + vy3z > 0)

  • Notice that v has odd degree in both polynomials.
  • Find values of w, x, y, z so that 6w2z2 and 7wx3yz are either both

positive or both negative. (E.g. w = x = y = z = 1.)

Katherine Cordwell (15824) QE December 11, 2018 10 / 29

slide-15
SLIDE 15

Polynomials

Odd Degree Variables

Example 1 ∀v, w, x, y, z(−6 − 7v2w3x + 9v2w3xyz + 6v3w2z2 > 0 ∨ 6 − 5v2w2xy + 7v3wx3yz + vy3z > 0)

  • Notice that v has odd degree in both polynomials.
  • Find values of w, x, y, z so that 6w2z2 and 7wx3yz are either both

positive or both negative. (E.g. w = x = y = z = 1.)

  • Return FALSE with “v is −∞, all other variables are 1” as a

witness.

Katherine Cordwell (15824) QE December 11, 2018 10 / 29

slide-16
SLIDE 16

Polynomials

Set a Variable to 0

Example 2 ∀v, w, x, y, z (1 − 10vw2y − v3x3yz2 − v3wx2yz3 > 0 ∨ −7 + 9w2xy3z + 8v2w3xz2 > 0)

Katherine Cordwell (15824) QE December 11, 2018 11 / 29

slide-17
SLIDE 17

Polynomials

Set a Variable to 0

Example 2 ∀v, w, x, y, z (1 − 10vw2y−v3x3yz2 − v3wx2yz3 > 0 ∨ −7 + 9w2xy3z + 8v2w3xz2 > 0)

  • Notice that if we set w = 0 in each polynomial, we get 1 − v3x3yz2

and −7.

Katherine Cordwell (15824) QE December 11, 2018 12 / 29

slide-18
SLIDE 18

Polynomials

Set a Variable to 0

Example 2 ∀v, w, x, y, z (1 − 10vw2y−v3x3yz2 − v3wx2yz3 > 0 ∨ −7 + 9w2xy3z + 8v2w3xz2 > 0)

  • Notice that if we set w = 0 in each polynomial, we get 1 − v3x3yz2

and −7.

  • Notice that we can find values of v, x, y, and z so that −7 ≤ 0 and

1 − v3x3yz2 ≤ 0. (E.g. v = x = y = z = 1.)

Katherine Cordwell (15824) QE December 11, 2018 12 / 29

slide-19
SLIDE 19

Polynomials

Set a Variable to 0

Example 2 ∀v, w, x, y, z (1 − 10vw2y−v3x3yz2 − v3wx2yz3 > 0 ∨ −7 + 9w2xy3z + 8v2w3xz2 > 0)

  • Notice that if we set w = 0 in each polynomial, we get 1 − v3x3yz2

and −7.

  • Notice that we can find values of v, x, y, and z so that −7 ≤ 0 and

1 − v3x3yz2 ≤ 0. (E.g. v = x = y = z = 1.)

  • Return FALSE with “w is 0, all other variables are 1” as a witness.

Katherine Cordwell (15824) QE December 11, 2018 12 / 29

slide-20
SLIDE 20

Polynomials

Set all Variables Equal

Example 3 ∀v, w, x, y, z − 10 − 5v2w3y2z − 10vxyz3 > 0 ∨ 8 + 2v3wy2z + 4v3x2z2 − 4v2wxy3z3 > 0

Katherine Cordwell (15824) QE December 11, 2018 13 / 29

slide-21
SLIDE 21

Polynomials

Set all Variables Equal

Example 3 ∀v, w, x, y, z − 10−5v2w3y2z − 10vxyz3 > 0 ∨ 8 + 2v3wy2z + 4v3x2z2−4v2wxy3z3 > 0

  • Notice that the highest degree monomial in the first polynomial is

−5v2w3y2z and the highest degree monomial in the second polynomial is −4v2wxy3z3.

Katherine Cordwell (15824) QE December 11, 2018 14 / 29

slide-22
SLIDE 22

Polynomials

Set all Variables Equal

Example 3 ∀v, w, x, y, z − 10−5v2w3y2z − 10vxyz3 > 0 ∨ 8 + 2v3wy2z + 4v3x2z2−4v2wxy3z3 > 0

  • Notice that the highest degree monomial in the first polynomial is

−5v2w3y2z and the highest degree monomial in the second polynomial is −4v2wxy3z3.

  • Notice that both have negative real coefficients.

Katherine Cordwell (15824) QE December 11, 2018 14 / 29

slide-23
SLIDE 23

Polynomials

Set all Variables Equal

Example 3 ∀v, w, x, y, z − 10−5v2w3y2z − 10vxyz3 > 0 ∨ 8 + 2v3wy2z + 4v3x2z2−4v2wxy3z3 > 0

  • Notice that the highest degree monomial in the first polynomial is

−5v2w3y2z and the highest degree monomial in the second polynomial is −4v2wxy3z3.

  • Notice that both have negative real coefficients.
  • Return FALSE with “All variables are ∞ (i.e. set all variables

equal and sufficiently large)” as a witness.

Katherine Cordwell (15824) QE December 11, 2018 14 / 29

slide-24
SLIDE 24

Polynomials

Analyze Leading Coefficients

Example 4 ∀v, w, z, w, y (−8 + 8v2w3z + 6v2w3y2z − 7vx3yz2 > 0 ∨ −5 − 10v2w2x2 + 7vwx3yz − 7v3wxz2 > 0)

Katherine Cordwell (15824) QE December 11, 2018 15 / 29

slide-25
SLIDE 25

Polynomials

Analyze Leading Coefficients

Example 4 ∀v, w, z, w, y (−8 + 8v2w3z + 6v2w3y2z−7vx3yz2 > 0 ∨ −5 − 10v2w2x2 + 7vwx3yz−7v3wxz2 > 0)

  • Notice that the leading coefficients of z are −7vx3y and −7v3wx.

Katherine Cordwell (15824) QE December 11, 2018 16 / 29

slide-26
SLIDE 26

Polynomials

Analyze Leading Coefficients

Example 4 ∀v, w, z, w, y (−8 + 8v2w3z + 6v2w3y2z−7vx3yz2 > 0 ∨ −5 − 10v2w2x2 + 7vwx3yz−7v3wxz2 > 0)

  • Notice that the leading coefficients of z are −7vx3y and −7v3wx.
  • Notice that we can find values of v, x, y, and x to make both of

these negative. (E.g. y = x = w = v = 1.)

Katherine Cordwell (15824) QE December 11, 2018 16 / 29

slide-27
SLIDE 27

Polynomials

Analyze Leading Coefficients

Example 4 ∀v, w, z, w, y (−8 + 8v2w3z + 6v2w3y2z−7vx3yz2 > 0 ∨ −5 − 10v2w2x2 + 7vwx3yz−7v3wxz2 > 0)

  • Notice that the leading coefficients of z are −7vx3y and −7v3wx.
  • Notice that we can find values of v, x, y, and x to make both of

these negative. (E.g. y = x = w = v = 1.)

  • Return FALSE with “z = ∞, all other variables are 1” as a

witness.

Katherine Cordwell (15824) QE December 11, 2018 16 / 29

slide-28
SLIDE 28

Polynomials

Polynomial Properties

  • For each of these examples, we have a corresponding theorem.
  • We implemented an algorithm for each theorem in Mathematica.

Katherine Cordwell (15824) QE December 11, 2018 17 / 29

slide-29
SLIDE 29

Experimental Results

Benchmarks

We tested on several sets of benchmarks.

  • 328 decision problems from KeYmaera 3.2

2Thanks to Stefan Mitsch. 3Mulligan et. al. Quantifier elimination for reasoning in economics, arXiv preprint (2018)

Katherine Cordwell (15824) QE December 11, 2018 18 / 29

slide-30
SLIDE 30

Experimental Results

Benchmarks

We tested on several sets of benchmarks.

  • 328 decision problems from KeYmaera 3.2
  • 44 decision problems from Mulligan et. al.3

2Thanks to Stefan Mitsch. 3Mulligan et. al. Quantifier elimination for reasoning in economics, arXiv preprint (2018)

Katherine Cordwell (15824) QE December 11, 2018 18 / 29

slide-31
SLIDE 31

Experimental Results

Benchmarks

We tested on several sets of benchmarks.

  • 328 decision problems from KeYmaera 3.2
  • 44 decision problems from Mulligan et. al.3
  • Decision problems we generate ourselves.

2Thanks to Stefan Mitsch. 3Mulligan et. al. Quantifier elimination for reasoning in economics, arXiv preprint (2018)

Katherine Cordwell (15824) QE December 11, 2018 18 / 29

slide-32
SLIDE 32

Experimental Results

Performance

Katherine Cordwell (15824) QE December 11, 2018 19 / 29

slide-33
SLIDE 33

Experimental Results

Performance

Katherine Cordwell (15824) QE December 11, 2018 19 / 29

slide-34
SLIDE 34

Experimental Results

Performance

Katherine Cordwell (15824) QE December 11, 2018 19 / 29

slide-35
SLIDE 35

Experimental Results

Performance

Katherine Cordwell (15824) QE December 11, 2018 19 / 29

slide-36
SLIDE 36

Experimental Results

Performance

  • The third set of benchmarks is not fixed.
  • Set of polynomials pseudorandomly generated each time our

testing method is called.

  • Generates many examples which our heuristics very quickly

determine are false and on which Mathematica runs slowly.

Katherine Cordwell (15824) QE December 11, 2018 20 / 29

slide-37
SLIDE 37

Experimental Results

Performance

In fact, all of Examples 1–4 were generated by running our testing method and finding an example where our algorithms return almost instantly but Mathematica stalls.

Katherine Cordwell (15824) QE December 11, 2018 21 / 29

slide-38
SLIDE 38

Conclusion

Conclusion

Katherine Cordwell (15824) QE December 11, 2018 22 / 29

slide-39
SLIDE 39

Conclusion

Conclusion

Katherine Cordwell (15824) QE December 11, 2018 22 / 29

slide-40
SLIDE 40

Additional Material Cylindrical Algebraic Decomposition

CAD

  • Input: A set of polynomials in n variables
  • Output: A sign-invariant decomposition of Rn composed of cells

and a sample point for each cell (called a CAD)

  • The signs of the polynomials at the (finitely many) sample points

are representative of the signs of the polynomials on the entirety of Rn

Katherine Cordwell (15824) QE December 11, 2018 23 / 29

slide-41
SLIDE 41

Additional Material Cylindrical Algebraic Decomposition

CAD

  • Two phases: projection and lifting

Katherine Cordwell (15824) QE December 11, 2018 24 / 29

slide-42
SLIDE 42

Additional Material Cylindrical Algebraic Decomposition

CAD

  • The projection operator is designed so that the projections of

different cells are either disjoint or identical

  • So if CAD A is lifted from CAD B, the cells in CAD A are

cylindrically arranged over the cells in CAD B

4Jirstrand, Algebraic methods for inequality constraints in control, Ph.D. thesis (1998)

Katherine Cordwell (15824) QE December 11, 2018 25 / 29

slide-43
SLIDE 43

Additional Material Cylindrical Algebraic Decomposition

CAD

  • The projection operator is designed so that the projections of

different cells are either disjoint or identical

  • So if CAD A is lifted from CAD B, the cells in CAD A are

cylindrically arranged over the cells in CAD B

Figure 1: Modified from Jirstrand4

4Jirstrand, Algebraic methods for inequality constraints in control, Ph.D. thesis (1998)

Katherine Cordwell (15824) QE December 11, 2018 25 / 29

slide-44
SLIDE 44

Additional Material Cylindrical Algebraic Decomposition

CAD over the years

Many people have worked to improve CAD.

  • Brown, McCallum: Improved projection operator
  • Collins, Hong: Partial CAD
  • McCallum: Full dimensional CAD
  • Strzebo´

nski: GCAD

Katherine Cordwell (15824) QE December 11, 2018 26 / 29

slide-45
SLIDE 45

Additional Material Discriminants and Resultants

Properties of Discriminants and Resultants

Multiple Zeros of f Given a polynomial f ∈ R[x1, . . . , xn], if Disc(f, x1)(q) = 0 for some point q ∈ Rn−1 and the leading coefficient of x1 in f (which is a polynomial in R[x2, . . . , xn]) evaluated at q is nonzero, then the decision problem ∀x1, . . . , xn f(x1, . . . , xn) > 0 is false. Common Roots of f and g Given f, g ∈ R[x1, . . . , xn], if there exists a point q ∈ Rn−1 where Res(f, g, x1)(q) = 0 and the leading coefficients of x1 in f and g (which are polynomials in R[x2, . . . , xn]) are nonzero when evaluated at q, then the decision problem ∀x1, . . . , xn (f(x1, . . . , xn) > 0 ∨ g(x1, . . . , xn) > 0 is false.

Katherine Cordwell (15824) QE December 11, 2018 27 / 29

slide-46
SLIDE 46

Additional Material Discriminants and Resultants

Properties of Discriminants and Resultants

Discriminant Lemma Take a polynomial f = a2nx2n + · · · + a0 with real coefficients and a2n = 0 (i.e., an even-degree polynomial). If n is even and the discriminant of f is ≤ 0, then f has real roots, and if n is odd and the discriminant of f is ≥ 0, then f has real roots.

Katherine Cordwell (15824) QE December 11, 2018 28 / 29

slide-47
SLIDE 47

Additional Material Discriminants and Resultants

Discriminant Algorithm

Katherine Cordwell (15824) QE December 11, 2018 29 / 29