240 likes | 391 Views
TPHOLs’2001. A generic library for floating-point numbers and its application to exact computing. Marc Daumas, Laurence Rideau, Laurent Théry. Motivations. Applying theorem proving (AOC) Scientific computing Standard (IEEE 754) New results Checking proofs. Related Works.
E N D
TPHOLs’2001 A generic library for floating-point numbers and its application to exact computing Marc Daumas, Laurence Rideau, Laurent Théry
Motivations • Applying theorem proving (AOC) • Scientific computing • Standard (IEEE 754) • New results • Checking proofs
Related Works • PVS: Miner (IEEE 784) • ACL2: Russinoff (IEEE 754) • HOL: Harrison (IEEE 754)
Outline • Floating-point numbers • Formalization • Simple program verification • Expansion
Mantissa Precision Exponent Floating-point numbers 8.676600 E+ 20 Normal: 8.676600 E+ 20 Canonic Subnormal: -0.002300 E- 99
Rounding 0
Formalization: float • Arbitrary base: b: nat • New type: float • Abstract representation: n,p n*b FtoR p
86766,16 Formalization: float • Bias: • Non-Unicity:867660,15 • Projectors:n[p], e[p] • Equality: p = q • Order: p < q 8.676600 E+20
Formalization: float • Zero: 0,0 • One: 1,0 • Addition: n[p]*b +n[q]*b ,u whereu=min(e[p],e[q]) • Multiplication: n[p]* n[q],e[p]+e[q] e[p]-u e[q]-u
float bounded Bounded • Arbitrary bound: b (N[b],E[b]) • Bounded float: • Restricted quantification
Rounding • Predicate: R(r,p) • Total: • Compatible: • Monotone: • Min or Max:
Proof Sterbenz:
Theorem 1.00 E+9 and 1.11 E+10 Dekker
Y=2 Y=10 Example X := 1.0; Y := 1.0 while (X+1.0)-X=1.0 do X:=X*2.0 while (X+Y)-X<>Y do Y:=Y+1.0
102,1 First Loop while (X+1.0)-X=1.0 do X:=X*2.0 512 128 256 16 32 64 1 2 4 8 0 ,0
Second Loop while (X+Y)-X<>Y do Y:=Y+1.0 b
Formal Proof • Direct • General Statement • Arbitrary base • Arbitrary format • Arbitrary rounding
D Exact computing • Rounding errors • Basic operations • Applications a ab b
Expansion • List: • Non-overlapping: • Sorted 10011010000 11001111101
101111 111000 111100 Building an expansion 10111100011100000000000000001111
Adding a float to an expansion ... f ...
Adding two expansions ... ...
Library • 20000 Lines • 90 Definitions • 780 Theorems
Conclusions • Generic Library • Precise Statements • Checking Proofs