a monadic approach to certified exact real arithmetic
play

A Monadic Approach to Certified Exact Real Arithmetic Russell - PowerPoint PPT Presentation

A Monadic Approach to Certified Exact Real Arithmetic Russell OConnor Radboud University Nijmegen TYPES / TFP 2006 April 19, 2006 Certified Real Arithmetic Arbitrary precision real number computation We have fast complex libraries


  1. A Monadic Approach to Certified Exact Real Arithmetic Russell O’Connor Radboud University Nijmegen TYPES / TFP 2006 April 19, 2006

  2. Certified Real Arithmetic ● Arbitrary precision real number computation ● We have fast complex libraries – MPFR ● We have slow certified implementations – C-CoRN ● We want to find the sweet spot of easy to certify fast enough real arithemetic.

  3. Certified Reals Arithmetic ● Why certified? – Toward certified computer algebra ● Certified calculator – Disproof of Merten’s conjecture ● Requires approximating roots of zeta function – Kepler conjecture ● 99% certain it is correct ● We are going to make that 100%.

  4. Completion ● Let X be a “metric space”. ● Define C ( X ) the metric space of regular ≝ functions . + ⇒ X ∣ ∀ 1  2 , B  1  2  f  1  , f  2 } C  X ≝{ f : ℚ

  5. Completion ● Let X be a “metric space”. ● Define C ( X ) the metric space of regular functions . + ⇒ X ∣ ∀ 1  2 , B  1  2  f  1  , f  2 } C  X ≝{ f : ℚ ● C is a monad. – X  C ( X ) – C ( C ( X )) → C ( X ) – ( X → Y ) ⇒ ( C ( X ) → C ( Y ))

  6. Uniform Continuity ● Suppose – X is a nice metric space. – f : X → Y is uniformly continuous with modulus μ . – x : ℚ + ⇒ X is a regular function.

  7. Uniform Continuity ● Suppose – X is a nice metric space. – f : X → Y is uniformly continuous with modulus μ . – x : ℚ + ⇒ X is a regular function. ● Then – f ∘ x ∘ μ : ℚ + ⇒ Y is a regular function.

  8. Uniform Continuity ● Suppose – X is a nice metric space. – f : X → Y is uniformly continuous with modulus μ . – x : ℚ + ⇒ X is a regular function. ● Then – f ∘ x ∘ μ : ℚ + ⇒ Y is a regular function. ● This yields the map operation of type ( X → Y ) ⇒ ( C ( X ) → C ( Y )) .

  9. Uniformly Continuous Functions ● ℚ is nice. ● Uniformly continuous functions, ℚ → ℚ : – λx . -x – λx. | x | – λx . c + x – λx . cx ● λε . c -1 ε is a modulus of continuity ● All these lift to C (ℚ) → C (ℚ) .

  10. Uniformly Continuous, Curried Functions ● X → ℚ is a metric space. – Using the ∞ -norm. ● More uniformly continuous functions, ℚ → ( [ a , b ] → ℚ) : – λx . λy . x + y – λx . λy . xy ● All these lift to C (ℚ) → C ([ a , b ] → ℚ) . – Isomorphic to C (ℚ) → C ([ a , b ]) → C (ℚ).

  11. Reciprocal ● Let x : C (ℚ) and x # 0 . ● Consider 0 < a < x where a : ℚ . ● Consider the domain [ a , ∞) ∩ ℚ .

  12. Reciprocal ● Let x : C (ℚ) and x # 0 . ● Consider 0 < a < x where a : ℚ . ● Consider the domain [ a , ∞) ∩ ℚ . ● λy . (max( a, y )) -1 is uniformly continuous with modulus λε . εa 2 . ● Map x over this uniformly continuous function.

  13. Calculus ● Taylor series! ∞ − 1  i a 2 i cos  a = ∑  2 i ! i = 0 ● Alternating sums easily make regular functions. – cos ℚ : ℚ → C (ℚ) – bind cos ℚ : C (ℚ) → C (ℚ)

  14. Range Reduction - exp 1 exp  x = exp − x 

  15. Range Reduction - ln ln  x =− ln  1  x

  16. Range Reduction - exp 2  x exp  x = exp  2

  17. Range Reduction - cos 2  x cos  x = 1 − 2sin  2

  18. Range Reduction - sin sin  x = 3sin  x 3  x − 4sin  3 3

  19. Range Reduction - ln x ln  x = ln  n  n ln  2  2

  20. Range Reduction - ln ln  x = ln  3 x  ln  4  4 3

  21. Range Reduction - arctan arctan  x =− arctan − x 

  22. Range Reduction - arctan 0 ≤ x ⇒ arctan  x = − arctan  1  x 2

  23. Range Reduction - arctan  arctan  x − 1 0 ≤ x ⇒ arctan  x =  x  1 4

  24. π 1 1 1 1 = 48arctan   80 arctan   28arctan   96arctan   38 57 239 268

  25. Compression ● [ a − ε , a + ε ] contains a unique smallest rational. ● Let approx ε ( a ) be that rational. ● Let x : C (ℚ) . ● λε . approx ε /2 ( x ( ε /2)) : C (ℚ) is equivalent to x but “smaller”.

  26. Correctness ● What does it mean to be correct? – Could prove properties of these functions. – Could prove equivalence to a reference standard. ● C-CoRN – Provides a reference implementation of real numbers in Coq. ● Formalize this theory in your favourite system!

  27. Speed ● Is this fast enough? ● What is fast enough? ● Hales’s proof of the Kepler conjecture provides a “test suite”. ● Haskell prototype: Few Digits – Entered in the “Many Digits” competition ● Did not finish last!

  28. Other Representations + ⇒ X ∣ ∀ 1  2 , B  1  2  f  1  , f  2 } C  X  ≝ { f : ℚ Gauge Base b ∣ a ,b: ℤ } n ∣ n: ℤ } { a 2 { 2 n ∣ n: ℤ } { φ ℤ [ φ ]

  29. Other Work ● Use the type ℚ + C (ℚ) – Run rational operations when it is known to be rational ● Sometimes rational operations are slower ● Have functions return an interval – Return a point the the result is known to be precise

  30. More Information ● Google “Few Digits” – http://r6.ca/FewDigits/ ● Upcoming paper in Mathematical Structures in Computer Science.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend