Automating Asymptotics in a Theorem Prover Manuel Eberl Technical - - PowerPoint PPT Presentation

automating asymptotics in a theorem prover
SMART_READER_LITE
LIVE PREVIEW

Automating Asymptotics in a Theorem Prover Manuel Eberl Technical - - PowerPoint PPT Presentation

Automating Asymptotics in a Theorem Prover Manuel Eberl Technical University of Munich Formal Methods in Mathematics 6 January 2020 1 / 31 My Christmas Project I found some lovely 5-pages of lecture notes on Transcendental Number Theory by


slide-1
SLIDE 1

Automating Asymptotics in a Theorem Prover

Manuel Eberl

Technical University of Munich Formal Methods in Mathematics 6 January 2020

1 / 31

slide-2
SLIDE 2

My Christmas Project

I found some lovely 5-pages of lecture notes on Transcendental Number Theory by Filaseta:

2 / 31

slide-3
SLIDE 3

My Christmas Project

So I decided to formalise them:

3 / 31

slide-4
SLIDE 4

The Curse of de Bruijn

Mathematical proofs in a proof assistant (compared to pen-and-paper)

4 / 31

slide-5
SLIDE 5

The Curse of de Bruijn

Mathematical proofs in a proof assistant (compared to pen-and-paper)

◮ are much longer

4 / 31

slide-6
SLIDE 6

The Curse of de Bruijn

Mathematical proofs in a proof assistant (compared to pen-and-paper)

◮ are much longer ◮ take more time to write

4 / 31

slide-7
SLIDE 7

The Curse of de Bruijn

Mathematical proofs in a proof assistant (compared to pen-and-paper)

◮ are much longer ◮ take more time to write ◮ contain many tedious steps.

4 / 31

slide-8
SLIDE 8

The Curse of de Bruijn

Mathematical proofs in a proof assistant (compared to pen-and-paper)

◮ are much longer ◮ take more time to write ◮ contain many tedious steps.

There are many reasons for this.

4 / 31

slide-9
SLIDE 9

The Curse of de Bruijn

Mathematical proofs in a proof assistant (compared to pen-and-paper)

◮ are much longer ◮ take more time to write ◮ contain many tedious steps.

There are many reasons for this. But I want to talk about one in particular.

4 / 31

slide-10
SLIDE 10

Externalisation of Work in Paper Proofs

◮ Ambiguities and ‘handwaving’

5 / 31

slide-11
SLIDE 11

Externalisation of Work in Paper Proofs

◮ Ambiguities and ‘handwaving’

In a proof assistant, you have to define everything completely rigorously.

5 / 31

slide-12
SLIDE 12

Externalisation of Work in Paper Proofs

◮ Ambiguities and ‘handwaving’

In a proof assistant, you have to define everything completely rigorously.

◮ Side conditions not proven/dismissed as trivial

5 / 31

slide-13
SLIDE 13

Externalisation of Work in Paper Proofs

◮ Ambiguities and ‘handwaving’

In a proof assistant, you have to define everything completely rigorously.

◮ Side conditions not proven/dismissed as trivial

A proof assistant will force you to prove every single side condition.

5 / 31

slide-14
SLIDE 14

Externalisation of Work in Paper Proofs

◮ Ambiguities and ‘handwaving’

In a proof assistant, you have to define everything completely rigorously.

◮ Side conditions not proven/dismissed as trivial

A proof assistant will force you to prove every single side condition.

◮ A huge trove of ‘library’ results that one can use freely

5 / 31

slide-15
SLIDE 15

Externalisation of Work in Paper Proofs

◮ Ambiguities and ‘handwaving’

In a proof assistant, you have to define everything completely rigorously.

◮ Side conditions not proven/dismissed as trivial

A proof assistant will force you to prove every single side condition.

◮ A huge trove of ‘library’ results that one can use freely

Most mathematical results have not been formalised

5 / 31

slide-16
SLIDE 16

Externalisation of Work in Paper Proofs

◮ Ambiguities and ‘handwaving’

In a proof assistant, you have to define everything completely rigorously.

◮ Side conditions not proven/dismissed as trivial

A proof assistant will force you to prove every single side condition.

◮ A huge trove of ‘library’ results that one can use freely

Most mathematical results have not been formalised And even if: perhaps not in the system you use.

5 / 31

slide-17
SLIDE 17

The Curse of de Bruijn

Solution: No idea. :(

6 / 31

slide-18
SLIDE 18

The Curse of de Bruijn

Solution: No idea. :( Partial solutions:

6 / 31

slide-19
SLIDE 19

The Curse of de Bruijn

Solution: No idea. :( Partial solutions: (in my opinion)

6 / 31

slide-20
SLIDE 20

The Curse of de Bruijn

Solution: No idea. :( Partial solutions: (in my opinion)

◮ Good, concise notation

6 / 31

slide-21
SLIDE 21

The Curse of de Bruijn

Solution: No idea. :( Partial solutions: (in my opinion)

◮ Good, concise notation ◮ Good automation

6 / 31

slide-22
SLIDE 22

The Curse of de Bruijn

Solution: No idea. :( Partial solutions: (in my opinion)

◮ Good, concise notation ◮ Good automation

When writing a formal proof, we can externalise work to the reader as well.

6 / 31

slide-23
SLIDE 23

The Curse of de Bruijn

Solution: No idea. :( Partial solutions: (in my opinion)

◮ Good, concise notation ◮ Good automation

When writing a formal proof, we can externalise work to the reader as well. The reader is the proof assistant.

6 / 31

slide-24
SLIDE 24

Domain-Specific Automation

Human mathematicians have a large repertoire of domain-specific automation procedures in their brain:

◮ How to solve a quadratic equation

7 / 31

slide-25
SLIDE 25

Domain-Specific Automation

Human mathematicians have a large repertoire of domain-specific automation procedures in their brain:

◮ How to solve a quadratic equation ◮ How to take a derivative

7 / 31

slide-26
SLIDE 26

Domain-Specific Automation

Human mathematicians have a large repertoire of domain-specific automation procedures in their brain:

◮ How to solve a quadratic equation ◮ How to take a derivative ◮ How to expand into partial fractions

7 / 31

slide-27
SLIDE 27

Domain-Specific Automation

Human mathematicians have a large repertoire of domain-specific automation procedures in their brain:

◮ How to solve a quadratic equation ◮ How to take a derivative ◮ How to expand into partial fractions

This saves lots of time when writing mathematical papers.

7 / 31

slide-28
SLIDE 28

Domain-Specific Automation

Human mathematicians have a large repertoire of domain-specific automation procedures in their brain:

◮ How to solve a quadratic equation ◮ How to take a derivative ◮ How to expand into partial fractions

This saves lots of time when writing mathematical papers. For effective formalisation of mathematics, we need to teach proof assistants these skills.

7 / 31

slide-29
SLIDE 29

Examples for Domain-Specific Automation

◮ Cancelling common factors from equations

8 / 31

slide-30
SLIDE 30

Examples for Domain-Specific Automation

◮ Cancelling common factors from equations ◮ Linear arithmetic (Chaieb/Nipkow)

8 / 31

slide-31
SLIDE 31

Examples for Domain-Specific Automation

◮ Cancelling common factors from equations ◮ Linear arithmetic (Chaieb/Nipkow) ◮ Approximation using interval arithmetic (Hölzl)

8 / 31

slide-32
SLIDE 32

Examples for Domain-Specific Automation

◮ Cancelling common factors from equations ◮ Linear arithmetic (Chaieb/Nipkow) ◮ Approximation using interval arithmetic (Hölzl) ◮ Evaluating √

16 = 4 etc.

8 / 31

slide-33
SLIDE 33

Examples for Domain-Specific Automation

◮ Cancelling common factors from equations ◮ Linear arithmetic (Chaieb/Nipkow) ◮ Approximation using interval arithmetic (Hölzl) ◮ Evaluating √

16 = 4 etc.

◮ Proving primality using Pratt certificates (Wimmer/E.)

8 / 31

slide-34
SLIDE 34

Examples for Domain-Specific Automation

◮ Cancelling common factors from equations ◮ Linear arithmetic (Chaieb/Nipkow) ◮ Approximation using interval arithmetic (Hölzl) ◮ Evaluating √

16 = 4 etc.

◮ Proving primality using Pratt certificates (Wimmer/E.) ◮ Evaluating winding numbers (Li)

8 / 31

slide-35
SLIDE 35

Examples for Domain-Specific Automation

◮ Cancelling common factors from equations ◮ Linear arithmetic (Chaieb/Nipkow) ◮ Approximation using interval arithmetic (Hölzl) ◮ Evaluating √

16 = 4 etc.

◮ Proving primality using Pratt certificates (Wimmer/E.) ◮ Evaluating winding numbers (Li) ◮ Real asymptotics (E.)

8 / 31

slide-36
SLIDE 36

Automating Real Asymptotics in Isabelle/HOL

9 / 31

slide-37
SLIDE 37

◮ Interactive theorem prover; mostly Higher Order Logic

10 / 31

slide-38
SLIDE 38

◮ Interactive theorem prover; mostly Higher Order Logic ◮ Unlike Coq/Lean: No dependent types

10 / 31

slide-39
SLIDE 39

◮ Interactive theorem prover; mostly Higher Order Logic ◮ Unlike Coq/Lean: No dependent types ◮ Large library of real and complex analysis

10 / 31

slide-40
SLIDE 40

◮ Interactive theorem prover; mostly Higher Order Logic ◮ Unlike Coq/Lean: No dependent types ◮ Large library of real and complex analysis ◮ Archive of Formal Proofs:

Large collection of Isabelle proof developments

10 / 31

slide-41
SLIDE 41

Let’s talk about asymptotics in a proof assistant.

11 / 31

slide-42
SLIDE 42

Let’s talk about asymptotics in a proof assistant. Suppose you write a formal proof and sudenly have to prove lim

x→∞ x2 − x = ∞ .

11 / 31

slide-43
SLIDE 43

Let’s talk about asymptotics in a proof assistant. Suppose you write a formal proof and sudenly have to prove lim

x→∞ x2 − x = ∞ .

Any ‘real’ mathematician would rightly dismiss this as trivial.

11 / 31

slide-44
SLIDE 44

Let’s talk about asymptotics in a proof assistant. Suppose you write a formal proof and sudenly have to prove lim

x→∞ x2 − x = ∞ .

Any ‘real’ mathematician would rightly dismiss this as trivial. But in a theorem prover, even something this trivial requires some thinking and several lines of proofs

11 / 31

slide-45
SLIDE 45

Let’s talk about asymptotics in a proof assistant. Suppose you write a formal proof and sudenly have to prove lim

x→∞ x2 − x = ∞ .

Any ‘real’ mathematician would rightly dismiss this as trivial. But in a theorem prover, even something this trivial requires some thinking and several lines of proofs If you have to do this every 5 minutes, it gets annoying.

11 / 31

slide-46
SLIDE 46

Example: Stieltjes constants

γn =

k=1

lnn k k

− lnn+1(k + 1) − lnn+1 k

n + 1

  • 12 / 31
slide-47
SLIDE 47

Example: Stieltjes constants

γn =

k=1

lnn k k

− lnn+1(k + 1) − lnn+1 k

n + 1

  • Why does this sum exist?

12 / 31

slide-48
SLIDE 48

Example: Stieltjes constants

γn =

k=1

lnn k k

− lnn+1(k + 1) − lnn+1 k

n + 1

  • Why does this sum exist?

Because the summand is ∼ (k−2 lnn k) ∈ O(k−3/2)

12 / 31

slide-49
SLIDE 49

Example: Stieltjes constants

γn =

k=1

lnn k k

− lnn+1(k + 1) − lnn+1 k

n + 1

  • Why does this sum exist?

Because the summand is ∼ (k−2 lnn k) ∈ O(k−3/2) and ∑ kx is summable for any x < −1!

12 / 31

slide-50
SLIDE 50

Example: Stieltjes constants

γn =

k=1

lnn k k

− lnn+1(k + 1) − lnn+1 k

n + 1

  • Why does this sum exist?

Because the summand is ∼ (k−2 lnn k) ∈ O(k−3/2) and ∑ kx is summable for any x < −1! But proving those asymptotics by hand is a lot of work.

12 / 31

slide-51
SLIDE 51

Example: Lemma required for Akra–Bazzi

lim

x→∞

  • 1 −

1 b log1+ε x p  1 + 1 logε/2 bx +

x log1+ε x

 −

  • 1 +

1 logε/2 x

  • = 0+

13 / 31

slide-52
SLIDE 52

Example: Lemma required for Akra–Bazzi

lim

x→∞

  • 1 −

1 b log1+ε x p  1 + 1 logε/2 bx +

x log1+ε x

 −

  • 1 +

1 logε/2 x

  • = 0+

Original author: ‘Trivial, just Taylor-expand it!’

13 / 31

slide-53
SLIDE 53

In Isabelle: lemma akra_bazzi_aux: filterlim

(λx. (1 − 1/(b ∗ ln x ˆ(1 + ε)) ˆ p) ∗ (1 + ln (b ∗ x + x/ln x ˆ(1 + ε)) ˆ(−ε/2)) − (1 + ln x ˆ(−ε/2))) (at_right 0) at_top

14 / 31

slide-54
SLIDE 54

In Isabelle: lemma akra_bazzi_aux: filterlim

(λx. (1 − 1/(b ∗ ln x ˆ(1 + ε)) ˆ p) ∗ (1 + ln (b ∗ x + x/ln x ˆ(1 + ε)) ˆ(−ε/2)) − (1 + ln x ˆ(−ε/2))) (at_right 0) at_top

Omitted: 700 lines of messy proofs

14 / 31

slide-55
SLIDE 55

In Isabelle: lemma akra_bazzi_aux: filterlim

(λx. (1 − 1/(b ∗ ln x ˆ(1 + ε)) ˆ p) ∗ (1 + ln (b ∗ x + x/ln x ˆ(1 + ε)) ˆ(−ε/2)) − (1 + ln x ˆ(−ε/2))) (at_right 0) at_top

Omitted: 700 lines of messy proofs Luckily, we now have automation for this: by real_asymp

14 / 31

slide-56
SLIDE 56

In Isabelle: lemma akra_bazzi_aux: filterlim

(λx. (1 − 1/(b ∗ ln x ˆ(1 + ε)) ˆ p) ∗ (1 + ln (b ∗ x + x/ln x ˆ(1 + ε)) ˆ(−ε/2)) − (1 + ln x ˆ(−ε/2))) (at_right 0) at_top

Omitted: 700 lines of messy proofs Luckily, we now have automation for this: by real_asymp How does it work?

14 / 31

slide-57
SLIDE 57

Multiseries Expansions

15 / 31

slide-58
SLIDE 58

Multiseries Expansions

Disclaimer: None of this was invented by me. Related Work:

◮ Asymptotic Expansions of exp–log Functions

by Richardson, Salvy, Shackell, van der Hoeven

◮ On Computing Limits in a Symbolic Manipulation System

by Gruntz

◮ Verified Real Asymptotics in Isabelle/HOL

by E.

15 / 31

slide-59
SLIDE 59

Multiseries Expansions

Power series expansions are insufficient for many important functions: exp(x), ln(x), Γ(x) for x → ∞

16 / 31

slide-60
SLIDE 60

Multiseries Expansions

Power series expansions are insufficient for many important functions: exp(x), ln(x), Γ(x) for x → ∞ Example:

(x + ln(x))−1 ∼

1 2x−1 − 1 4x−2 ln(x) + 1 8x−3 ln(x)2 + . . .

Solution: Multiseries

◮ Like an asymptotic power series, but may contain powers

  • f several ‘basis functions’ b1(x), . . . , bn(x)

16 / 31

slide-61
SLIDE 61

Multiseries Expansions

Power series expansions are insufficient for many important functions: exp(x), ln(x), Γ(x) for x → ∞ Example:

(x + ln(x))−1 ∼

1 2x−1 − 1 4x−2 ln(x) + 1 8x−3 ln(x)2 + . . .

Solution: Multiseries

◮ Like an asymptotic power series, but may contain powers

  • f several ‘basis functions’ b1(x), . . . , bn(x)

◮ Formally: R[B1, . . . , Bn] or R[Bn] . . . [B1]

16 / 31

slide-62
SLIDE 62

Multiseries Expansions

Power series expansions are insufficient for many important functions: exp(x), ln(x), Γ(x) for x → ∞ Example:

(x + ln(x))−1 ∼

1 2x−1 − 1 4x−2 ln(x) + 1 8x−3 ln(x)2 + . . .

Solution: Multiseries

◮ Like an asymptotic power series, but may contain powers

  • f several ‘basis functions’ b1(x), . . . , bn(x)

◮ Formally: R[B1, . . . , Bn] or R[Bn] . . . [B1] ◮ The basis must be ordered descendingly by ‘growth class’: ∀i. ln bi+1(x) ∈ o(ln bi(x))

16 / 31

slide-63
SLIDE 63

Multiseries Expansions

Power series expansions are insufficient for many important functions: exp(x), ln(x), Γ(x) for x → ∞ Example:

(x + ln(x))−1 ∼

1 2x−1 − 1 4x−2 ln(x) + 1 8x−3 ln(x)2 + . . .

Solution: Multiseries

◮ Like an asymptotic power series, but may contain powers

  • f several ‘basis functions’ b1(x), . . . , bn(x)

◮ Formally: R[B1, . . . , Bn] or R[Bn] . . . [B1] ◮ The basis must be ordered descendingly by ‘growth class’: ∀i. ln bi+1(x) ∈ o(ln bi(x)) ◮ Typical basis: exp(x2), exp(x), x, ln x, ln ln x

16 / 31

slide-64
SLIDE 64

A coalgebraic view of Multiseries

type Basis = (R → R) list

17 / 31

slide-65
SLIDE 65

A coalgebraic view of Multiseries

type Basis = (R → R) list datatype MS : Basis → Type where Const : R → MS [] Series : LList (MS bs × R) → MS (b :: bs)

17 / 31

slide-66
SLIDE 66

A coalgebraic view of Multiseries

type Basis = (R → R) list datatype MS : Basis → Type where Const : R → MS [] Series : LList (MS bs × R) → MS (b :: bs) Additionally: bases and series must be ‘sorted’.

17 / 31

slide-67
SLIDE 67

A coalgebraic view of Multiseries

type Basis = (R → R) list datatype MS : Basis → Type where Const : R → MS [] Series : LList (MS bs × R) → MS (b :: bs) Additionally: bases and series must be ‘sorted’. Example for a simple operation: negate : MS bs → MS bs

17 / 31

slide-68
SLIDE 68

A coalgebraic view of Multiseries

type Basis = (R → R) list datatype MS : Basis → Type where Const : R → MS [] Series : LList (MS bs × R) → MS (b :: bs) Additionally: bases and series must be ‘sorted’. Example for a simple operation: negate : MS bs → MS bs negate (Const c)

= Const (−c)

17 / 31

slide-69
SLIDE 69

A coalgebraic view of Multiseries

type Basis = (R → R) list datatype MS : Basis → Type where Const : R → MS [] Series : LList (MS bs × R) → MS (b :: bs) Additionally: bases and series must be ‘sorted’. Example for a simple operation: negate : MS bs → MS bs negate (Const c)

= Const (−c)

negate (Series ts) = Series [(negate c, e) | (c, e) ← ts]

17 / 31

slide-70
SLIDE 70

More Complicated Operations

◮ Basic operations (defined corecursively):

constants, identity, addition, multiplication

18 / 31

slide-71
SLIDE 71

More Complicated Operations

◮ Basic operations (defined corecursively):

constants, identity, addition, multiplication

◮ Substitution into convergent power series:

Gives us division; ln, exp, sin, etc. at non-singular points

18 / 31

slide-72
SLIDE 72

More Complicated Operations

◮ Basic operations (defined corecursively):

constants, identity, addition, multiplication

◮ Substitution into convergent power series:

Gives us division; ln, exp, sin, etc. at non-singular points

◮ exp and ln at singular points require specialised

procedures and may add new basis elements

18 / 31

slide-73
SLIDE 73

More Complicated Operations

◮ Basic operations (defined corecursively):

constants, identity, addition, multiplication

◮ Substitution into convergent power series:

Gives us division; ln, exp, sin, etc. at non-singular points

◮ exp and ln at singular points require specialised

procedures and may add new basis elements

◮ For operations like Γ, erf, li:

factor out singularities and treat them separately

18 / 31

slide-74
SLIDE 74

Connecting Series and Functions

For simple power series, f ∼ ts can be expressed coinductively: f (x) ∈ O(xe) f (x) − c xe ∼ ts f (x) ∼ (c, e) :: ts

19 / 31

slide-75
SLIDE 75

Connecting Series and Functions

For simple power series, f ∼ ts can be expressed coinductively: f (x) ∈ O(xe) f (x) − c xe ∼ ts f (x) ∼ (c, e) :: ts Operations are defined corecursively; correctness is proven

  • coinductively. Both are straightforward.

The same works for multiseries quite similarly.

19 / 31

slide-76
SLIDE 76

Finding Expansions

We can construct expansions for functions ‘bottom up’:

20 / 31

slide-77
SLIDE 77

Finding Expansions

We can construct expansions for functions ‘bottom up’:

Example

Find an expansion for sin(1/x) + exp(x) for x → ∞:

20 / 31

slide-78
SLIDE 78

Finding Expansions

We can construct expansions for functions ‘bottom up’:

Example

Find an expansion for sin(1/x) + exp(x) for x → ∞:

◮ 1/x has the trivial expansion x−1 w. r. t. the basis [x]

20 / 31

slide-79
SLIDE 79

Finding Expansions

We can construct expansions for functions ‘bottom up’:

Example

Find an expansion for sin(1/x) + exp(x) for x → ∞:

◮ 1/x has the trivial expansion x−1 w. r. t. the basis [x] ◮ substitute the series x−1 into the Taylor expansion of sin

20 / 31

slide-80
SLIDE 80

Finding Expansions

We can construct expansions for functions ‘bottom up’:

Example

Find an expansion for sin(1/x) + exp(x) for x → ∞:

◮ 1/x has the trivial expansion x−1 w. r. t. the basis [x] ◮ substitute the series x−1 into the Taylor expansion of sin ◮ exp(x) has to be added as a new basis element

20 / 31

slide-81
SLIDE 81

Finding Expansions

We can construct expansions for functions ‘bottom up’:

Example

Find an expansion for sin(1/x) + exp(x) for x → ∞:

◮ 1/x has the trivial expansion x−1 w. r. t. the basis [x] ◮ substitute the series x−1 into the Taylor expansion of sin ◮ exp(x) has to be added as a new basis element ◮ exp(x) then has the trivial expansion exp(x)

20 / 31

slide-82
SLIDE 82

Finding Expansions

We can construct expansions for functions ‘bottom up’:

Example

Find an expansion for sin(1/x) + exp(x) for x → ∞:

◮ 1/x has the trivial expansion x−1 w. r. t. the basis [x] ◮ substitute the series x−1 into the Taylor expansion of sin ◮ exp(x) has to be added as a new basis element ◮ exp(x) then has the trivial expansion exp(x) ◮ our expansion for sin(1/x) must be lifted to the new

basis [exp(x), x]

20 / 31

slide-83
SLIDE 83

Finding Expansions

We can construct expansions for functions ‘bottom up’:

Example

Find an expansion for sin(1/x) + exp(x) for x → ∞:

◮ 1/x has the trivial expansion x−1 w. r. t. the basis [x] ◮ substitute the series x−1 into the Taylor expansion of sin ◮ exp(x) has to be added as a new basis element ◮ exp(x) then has the trivial expansion exp(x) ◮ our expansion for sin(1/x) must be lifted to the new

basis [exp(x), x]

◮ add expansions for sin(1/x) and exp(x)

20 / 31

slide-84
SLIDE 84

Finding Expansions

End result: Theorem that sin(1/x) + exp(x) has the following expansion w. r. t. basis (exp(x), x):

21 / 31

slide-85
SLIDE 85

Finding Expansions

End result: Theorem that sin(1/x) + exp(x) has the following expansion w. r. t. basis (exp(x), x): lift_expansion (sin_ms (Series [(1, −1)])) + Series [(Series [(1, 0)], 1)]

21 / 31

slide-86
SLIDE 86

Finding Expansions

End result: Theorem that sin(1/x) + exp(x) has the following expansion w. r. t. basis (exp(x), x): lift_expansion (sin_ms (Series [(1, −1)])) + Series [(Series [(1, 0)], 1)] which evaluates to exp(x) + x−1 − 1 6x−3 + 1 120x−5 − . . .

21 / 31

slide-87
SLIDE 87

Sign Determination

Problem:

◮ Many operations involve comparisons of real numbers

22 / 31

slide-88
SLIDE 88

Sign Determination

Problem:

◮ Many operations involve comparisons of real numbers ◮ ‘Trimming’ expansions involves zeroness tests of real

functions

22 / 31

slide-89
SLIDE 89

Sign Determination

Problem:

◮ Many operations involve comparisons of real numbers ◮ ‘Trimming’ expansions involves zeroness tests of real

functions

◮ Both of these are difficult or even undecidable

22 / 31

slide-90
SLIDE 90

Sign Determination

Solution: Heuristic approach using Isabelle’s automation

23 / 31

slide-91
SLIDE 91

Sign Determination

Solution: Heuristic approach using Isabelle’s automation

◮ Use automation to determine signs – might fail

23 / 31

slide-92
SLIDE 92

Sign Determination

Solution: Heuristic approach using Isabelle’s automation

◮ Use automation to determine signs – might fail ◮ Use automation to determine if function is identically zero

– might cause non-termination

23 / 31

slide-93
SLIDE 93

Sign Determination

Solution: Heuristic approach using Isabelle’s automation

◮ Use automation to determine signs – might fail ◮ Use automation to determine if function is identically zero

– might cause non-termination

◮ Optionally: Use approximation by interval arithmetic

23 / 31

slide-94
SLIDE 94

Sign Determination

Solution: Heuristic approach using Isabelle’s automation

◮ Use automation to determine signs – might fail ◮ Use automation to determine if function is identically zero

– might cause non-termination

◮ Optionally: Use approximation by interval arithmetic ◮ User may have to supply additional facts

23 / 31

slide-95
SLIDE 95

Sign Determination

Solution: Heuristic approach using Isabelle’s automation

◮ Use automation to determine signs – might fail ◮ Use automation to determine if function is identically zero

– might cause non-termination

◮ Optionally: Use approximation by interval arithmetic ◮ User may have to supply additional facts

This works surprisingly well

23 / 31

slide-96
SLIDE 96

Proof Method

With some pre-processing, we can automatically prove statements of the form

◮ f (x) − → c ◮ f (x) ∼ g(x) ◮ f (x) < g(x) eventually ◮ f (x) ∈ L(g(x)) for any Landau symbol L

as x → l for l ∈ R ∪ {±∞}

24 / 31

slide-97
SLIDE 97

Proof Method

With some pre-processing, we can automatically prove statements of the form

◮ f (x) − → c ◮ f (x) ∼ g(x) ◮ f (x) < g(x) eventually ◮ f (x) ∈ L(g(x)) for any Landau symbol L

as x → l for l ∈ R ∪ {±∞} f and g can be built from + − · / ln exp min max ˆ | · |

n

√·

without restrictions

24 / 31

slide-98
SLIDE 98

Proof Method

With some pre-processing, we can automatically prove statements of the form

◮ f (x) − → c ◮ f (x) ∼ g(x) ◮ f (x) < g(x) eventually ◮ f (x) ∈ L(g(x)) for any Landau symbol L

as x → l for l ∈ R ∪ {±∞} f and g can be built from + − · / ln exp min max ˆ | · |

n

√·

without restrictions sin, cos, tan at finite points also possible.

24 / 31

slide-99
SLIDE 99

Proof Method

Problem: What about ‘oscillating’ functions like sin, ⌊·⌋, mod?

25 / 31

slide-100
SLIDE 100

Proof Method

Problem: What about ‘oscillating’ functions like sin, ⌊·⌋, mod? Example:

  • ⌊x⌋ = √x + o(1)

25 / 31

slide-101
SLIDE 101

Proof Method

Problem: What about ‘oscillating’ functions like sin, ⌊·⌋, mod? Example:

  • ⌊x⌋ = √x + o(1)

Obvious solution: Asymptotic interval arithmetic:

25 / 31

slide-102
SLIDE 102

Proof Method

Problem: What about ‘oscillating’ functions like sin, ⌊·⌋, mod? Example:

  • ⌊x⌋ = √x + o(1)

Obvious solution: Asymptotic interval arithmetic:

◮ sin x ∈ [−1; 1]

25 / 31

slide-103
SLIDE 103

Proof Method

Problem: What about ‘oscillating’ functions like sin, ⌊·⌋, mod? Example:

  • ⌊x⌋ = √x + o(1)

Obvious solution: Asymptotic interval arithmetic:

◮ sin x ∈ [−1; 1] ◮ ⌊x⌋ ∈ [x − 1; x]

25 / 31

slide-104
SLIDE 104

Proof Method

Problem: What about ‘oscillating’ functions like sin, ⌊·⌋, mod? Example:

  • ⌊x⌋ = √x + o(1)

Obvious solution: Asymptotic interval arithmetic:

◮ sin x ∈ [−1; 1] ◮ ⌊x⌋ ∈ [x − 1; x]

Result: Pair of asymptotic lower/upper bound with known multiseries expansion

25 / 31

slide-105
SLIDE 105

Proof Method

Problem: What about ‘oscillating’ functions like sin, ⌊·⌋, mod? Example:

  • ⌊x⌋ = √x + o(1)

Obvious solution: Asymptotic interval arithmetic:

◮ sin x ∈ [−1; 1] ◮ ⌊x⌋ ∈ [x − 1; x]

Result: Pair of asymptotic lower/upper bound with known multiseries expansion Works in many cases, but does not cope well with cancellations.

25 / 31

slide-106
SLIDE 106

Proof Method

Problem: What about ‘oscillating’ functions like sin, ⌊·⌋, mod? Example:

  • ⌊x⌋ = √x + o(1)

Obvious solution: Asymptotic interval arithmetic:

◮ sin x ∈ [−1; 1] ◮ ⌊x⌋ ∈ [x − 1; x]

Result: Pair of asymptotic lower/upper bound with known multiseries expansion Works in many cases, but does not cope well with

  • cancellations. Good enough.

25 / 31

slide-107
SLIDE 107

Proof Method

26 / 31

slide-108
SLIDE 108

Proof Method

Example

lemma (λn. (1 + 1/n) ˆ n) −

→ exp 1

by real_asymp

27 / 31

slide-109
SLIDE 109

Proof Method

Example

lemma (λn. (1 + 1/n) ˆ n) −

→ exp 1

by real_asymp

Example

lemma (λn. (1 + a/n) ˆ n) −

→ exp a

by real_asymp

27 / 31

slide-110
SLIDE 110

Usage

◮ ∼180 uses of real_asymp in the Archive of Formal Proofs

28 / 31

slide-111
SLIDE 111

Usage

◮ ∼180 uses of real_asymp in the Archive of Formal Proofs

(most of them by me – but not all of them)

28 / 31

slide-112
SLIDE 112

Usage

◮ ∼180 uses of real_asymp in the Archive of Formal Proofs

(most of them by me – but not all of them)

◮ Most uses are for fairly trivial examples

28 / 31

slide-113
SLIDE 113

Usage

◮ ∼180 uses of real_asymp in the Archive of Formal Proofs

(most of them by me – but not all of them)

◮ Most uses are for fairly trivial examples ◮ But: Some others would have been quite painful without

the method.

28 / 31

slide-114
SLIDE 114

Usage

◮ ∼180 uses of real_asymp in the Archive of Formal Proofs

(most of them by me – but not all of them)

◮ Most uses are for fairly trivial examples ◮ But: Some others would have been quite painful without

the method.

◮ And: The benefit of not having to stop and think about

trivialities like x2 − x → ∞ should not be underestimated!

28 / 31

slide-115
SLIDE 115

My Personal Experience

When formalising some paper and reaching a page full of limits, integrals, and uniform convergence, I used to feel like this:

29 / 31

slide-116
SLIDE 116

My Personal Experience

When formalising some paper and reaching a page full of limits, integrals, and uniform convergence, I used to feel like this: Now I feel like this:

29 / 31

slide-117
SLIDE 117

Future Work

What could be improved?

30 / 31

slide-118
SLIDE 118

Future Work

What could be improved?

◮ Incomplete support for Γ, ψ(n), erf, arctan

30 / 31

slide-119
SLIDE 119

Future Work

What could be improved?

◮ Incomplete support for Γ, ψ(n), erf, arctan ◮ Zeroness tests could be improved

30 / 31

slide-120
SLIDE 120

Future Work

What could be improved?

◮ Incomplete support for Γ, ψ(n), erf, arctan ◮ Zeroness tests could be improved ◮ Laurent series expansions for complex functions

30 / 31

slide-121
SLIDE 121

Future Work

What could be improved?

◮ Incomplete support for Γ, ψ(n), erf, arctan ◮ Zeroness tests could be improved ◮ Laurent series expansions for complex functions = ⇒ automatic computation of poles, residues, etc.

30 / 31

slide-122
SLIDE 122

Questions? Demo?

31 / 31