Numerical proofs using Function Interval Arithmetic Michal Konečný and Jan Duracz {m.konecny,duraczja}@aston.ac.uk School of Engineering and Applied Science Aston University Birmingham, UK Wed, Apr 20th , 2011 BCTCS 2011 Michal Konečný, Jan Duracz Numerical proofs 1/19 Introduction Outline 1 Introduction Target problems Overview of proof approaches Proof by rigorous interval approximations Main points of this talk 2 Arithmetic in the interval lattice Anti-consistent intervals Approximation monotonicity 16-case Kaucher multiplication 3 Functional interval arithmetic Mixed consistency intervals 1-case Kaucher multiplication Integration and polynomial approximation 4 Conclusion AERN (Approximating Exact Real Numbers) library Other (potential) applications of AERN Summary — main points of this talk Michal Konečný, Jan Duracz Numerical proofs 2/19 Introduction Target problems: real inequalities assume we want to decide statements such as x 2 + y 2 ≤ 22 ∨ 2 2 2 ∀x , y ∈ [−3, 3] : (x + 1.5) + (y − 1.5) ≤ 0.8 ∧ y − x ≥ 2.5 ∨ ∧ (x − 1.5)2 + (y − 1.5)2 ≤ 0.82 ∧ y + x ≥ 2.5 (x + 1)2 + (y − 1)2 ≤ 0.42 ∧ (x + 0.9)2 + (y − 0.9)2 > 0.42 ∨ (x − 1)2 + (y − 1)2 ≤ 0.42 ∧ (x − 0.9)2 + (y − 0.9)2 > 0.42 ∨ ¬ x 2 + (y − 0.3)2 ≤ 0.42 ∧ y ≥ 0.3 ∨ 2 2 x +y ≤1 ∧ y ≤0 automatically, i. e. computing a formal proof or a counter example Michal Konečný, Jan Duracz Numerical proofs 3/19 Introduction Target problems true near boundary untrue Michal Konečný, Jan Duracz Numerical proofs 4/19 Introduction Target problems: interval inclusions or how about automatically deciding statements such as: ∀x , y ∈ [−1.5, 1.5] : [x 3 + y 3 − x − y − 0.5, x 3 + y 3 − x − y + 0.5] ⊆ [−1, 1] Michal Konečný, Jan Duracz Numerical proofs 5/19 Introduction Overview of proof approaches symbolic, applying known rules and lemmas using tactics e. g. prove ∀x , y : (x − y )2 ≥ 0 using the lemma ∀x : x 2 ≥ 0 numeric, using rigorous interval approximation e. g. prove ∀x ∈ [0, 1] : sin(x ) ≤ 0.9 by sin([0, 1]) ⊆ [0, 0.85] combinations both approaches, eg: numerical results guiding the choice of tactics rules provide bounds for variables Michal Konečný, Jan Duracz Numerical proofs 6/19 Introduction Proof by rigorous interval approximations: essence naive approach: whole domain interval evaluation inequality: both sides outwards rounded inclusion: outwards rounded inside inwards rounded Michal Konečný, Jan Duracz Numerical proofs 7/19 Introduction Proof by rigorous interval approximations: problems severe information loss wrapping errors dependency errors possible solutions splitting the domain — but exponential cost using continuous function intervals approximating the endpoints: real numbers ∼ floating point numbers continuous functions ∼ polynomials Michal Konečný, Jan Duracz Numerical proofs 8/19 Introduction Main points of this talk 1 function intervals (FIs) can reduce information loss in practice 2 limited degree (term size) polynomials are useful in approximating FIs 3 anti-consistent intervals are useful when proving inclusions > g ih v f hi =⇒ g v f 00000000000000000000000000000000 11111111111111111111111111111111 111111111111111111111111111111111 000000000000000000000000000000000 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 f ih 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 f 00000000000000000000000000000000 11111111111111111111111111111111 f 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 f hi f hi 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 g ih 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 IL(D → R) 11111111111111111111111111111111 g g ih g g hi ⊥ Michal Konečný, Jan Duracz Numerical proofs 9/19 Arithmetic in the interval lattice Anti-consistent intervals (1/2) inwards rounding requires anti-consistent intervals: e. g. in ∀x ∈ [0, 1]: sin(x ) ∈ x − x 3 /6 ± 0.01 x on RHS assigned the “interval” [1, 0]: sin(x ) sin([0, 1]) [0, 0.85] [0, 0.85] [0, 0.85] ∈ ⊆? ⊆? ⊆? ⊆? x − x 3 /6 ± 0.01 [1, 0] − [1, 0]3 /6 ± 0.01 [1, 0] − [1/6, 0] ± 0.01 [1, −1/6] ± 0.01 [0.99, −0.156 . . .] need for subdivision in this case. . . Michal Konečný, Jan Duracz Numerical proofs 10/19 Arithmetic in the interval lattice Anti-consistent intervals (2/2) after some splitting this succeeds: e. g. in ∀x ∈ [0, 0.001]: sin(x ) ∈ x − x 3 /6 ± 0.01 x on RHS assigned the “interval” [0.001, 0]: sin(x ) sin([0, 0.001]) [0, 0.001] [0, 0.001] [0, 0.001] ∈ ⊆? ⊆? ⊆? ⊆? x − x 3 /6 ± 0.01 [0.001, 0] − [0.001, 0]3 /6 ± 0.01 [0.001, 0] − [0.000000001/6, 0] ± 0.01 [0.001, −0.000000001/6] ± 0.01 [−0.009, 0.009 . . .] Michal Konečný, Jan Duracz Numerical proofs 11/19 Arithmetic in the interval lattice Approximation monotonicity these generalised intervals form a lattice all operations must be monotone in this lattice to correctly propagate rounding e. g. x 3 /6 Michal Konečný, Jan Duracz Numerical proofs 12/19 Arithmetic in the interval lattice 16-case Kaucher multiplication most real operations extended easily to anti-consistent intervals extending multiplication [a , a ] × [b , b ] is hard, done by Kaucher: a ≤ 0, a ≤ 0 a ≤ 0, 0 ≤ a 0 ≤ a, a ≤ 0 0 ≤ a, 0 ≤ a b ≤ 0, b≤0 [ab , ab ] [ab , ab ] [ab , ab ] [ab , ab ] b ≤ 0, 0≤b [ab , ab ] [min(ab , ab ), max(ab , ab )] 0 [ab , ab ] 0 ≤ b, b≤0 [ab , ab ] 0 [max(ab , ab ), min(ab , ab )] [ab , ab ] 0 ≤ b, 0≤b [ab , ab ] [ab , ab ] [ab , ab ] [ab , ab ] Michal Konečný, Jan Duracz Numerical proofs 13/19 Functional interval arithmetic Mixed consistency intervals function intervals after inwards rounding: consistent in some areas and anti-consistent in other areas problem for Kaucher multiplication — all 16 cases can arise at once Michal Konečný, Jan Duracz Numerical proofs 14/19 Functional interval arithmetic 1-case Kaucher multiplication solution: approximate all 16 cases with 1 case: [a , a ] ×[b , b ] ⊆ h min ab , ab , ab , ab , max ab , ab , ab , ab i [a , a ] ×[b , b ] ⊇ h max ab , ab , ab , ab , min ab , ab , ab , ab i which facilitates outwards and inwards rounded multiplication: [a , a ] h×i[b , b ] ⊆ h i [a , a ] i×h[b , b ] ⊇ h i Michal Konečný, Jan Duracz Numerical proofs min↓ ab , ab , ab , ab , max↑ ab , ab , ab , ab max↑ ab , ab , ab , ab , min↓ ab , ab , ab , ab 15/19 Functional interval arithmetic 1-case Kaucher multiplication solution: approximate all 16 cases with 1 case: [a , a ] ×[b , b ] ⊆ h min ab , ab , ab , ab , max ab , ab , ab , ab i [a , a ] ×[b , b ] ⊇ h max ab , ab , ab , ab , min ab , ab , ab , ab i which facilitates outwards and inwards rounded multiplication: [a , a ] h×i[b , b ] ⊆ h i [a , a ] i×h[b , b ] ⊇ h i Michal Konečný, Jan Duracz Numerical proofs min↓ ab , ab , ab , ab , max↑ ab , ab , ab , ab max↑ ab , ab , ab , ab , min↓ ab , ab , ab , ab 15/19 Functional interval arithmetic Integration and polynomial approximation proving ∀x ∈ [0, 4] : 1− 0.3480242 1+0.47047x − 0.0958798 (1+0.47047x )2 + 0.7478556 (1+0.47047x )3 2 e −x ∈ Rx √2 π 0 2 e −t dt ± 1 20000 took least time with degree 9 polynomials: correct erf proved true solving time (seconds) 1000 depth 0 depth 1 100 depth 2 depth 3 6 8 10 Michal Konečný, Jan Duracz 12 enclosure degree Numerical proofs 14 16 16/19 Conclusion AERN (Approximating Exact Real Numbers) library arbirary precision interval arithmetic like iRRAM + explicit and enforced real number abstractions QuickCheck properties tested over carefully tailored distributions thin, consistent and anti-consistent intervals interval tuples with different order alignments special numbers (e. g. 0, 1, ∞) arbirary precision function interval arithmetic correctly rounded polynomial arithmetic in Chebyshev basis multi-variate with adjustable maximum term size flexible distributed dataflow model for exact computation Michal Konečný, Jan Duracz Numerical proofs 17/19 Conclusion AERN (Approximating Exact Real Numbers) library arbirary precision interval arithmetic like iRRAM + explicit and enforced real number abstractions QuickCheck properties tested over carefully tailored distributions thin, consistent and anti-consistent intervals interval tuples with different order alignments special numbers (e. g. 0, 1, ∞) arbirary precision function interval arithmetic correctly rounded polynomial arithmetic in Chebyshev basis multi-variate with adjustable maximum term size flexible distributed dataflow model for exact computation Michal Konečný, Jan Duracz Numerical proofs 17/19 Conclusion AERN (Approximating Exact Real Numbers) library arbirary precision interval arithmetic like iRRAM + explicit and enforced real number abstractions QuickCheck properties tested over carefully tailored distributions thin, consistent and anti-consistent intervals interval tuples with different order alignments special numbers (e. g. 0, 1, ∞) arbirary precision function interval arithmetic correctly rounded polynomial arithmetic in Chebyshev basis multi-variate with adjustable maximum term size flexible distributed dataflow model for exact computation Michal Konečný, Jan Duracz Numerical proofs 17/19 Conclusion Other (potential) applications of AERN arbitrary precision ODE IVP/BVP solving arbitrary precision geometrical computation ? Michal Konečný, Jan Duracz Numerical proofs 18/19 Conclusion Summary — main points of this talk 1 function intervals (FIs) can reduce information loss in practice 2 limited degree (term size) polynomials are useful in approximating FIs 3 anti-consistent intervals are useful when proving inclusions > g ih v f hi =⇒ g v f 00000000000000000000000000000000 11111111111111111111111111111111 111111111111111111111111111111111 000000000000000000000000000000000 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 f ih 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 f 00000000000000000000000000000000 11111111111111111111111111111111 f 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 f hi f hi 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 g ih 000000000000000000000000000000000 111111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111111111111111111111 00000000000000000000000000000000 IL(D → R) 11111111111111111111111111111111 g g ih g g hi ⊥ Michal Konečný, Jan Duracz Numerical proofs 19/19