Up to index of Isabelle/HOL/Decision_Procs
theory Approximation_Ex(* Author: Johannes Hoelzl <hoelzl@in.tum.de> 2009 *) theory Approximation_Ex imports Complex_Main "~~/src/HOL/Decision_Procs/Approximation" begin text {* Here are some examples how to use the approximation method. The parameter passed to the method specifies the precision used by the computations, it is specified as number of bits to calculate. When a variable is used it needs to be bounded by an interval. This interval is specified as a conjunction of the lower and upper bound. It must have the form @{text "[| l1 ≤ x1 ∧ x1 ≤ u1 ; … ; ln ≤ xn ∧ xn ≤ un |] ==> F"} where @{term F} is the formula, and @{text "x1, …, xn"} are the variables. The lower bounds @{text "l1, …, ln"} and the upper bounds @{text "u1, …, un"} must either be integer numerals, floating point numbers or of the form @{term "m * pow2 e"} to specify a exact floating point value. *} section "Compute some transcendental values" lemma "¦ ln 2 - 544531980202654583340825686620847 / 785593587443817081832229725798400 ¦ < inverse (2^51) " by (approximation 80) lemma "¦ exp 1.626 - 5.083499996273 ¦ < (inverse 10 ^ 10 :: real)" by (approximation 80) lemma "¦ sqrt 2 - 1.4142135623730951 ¦ < inverse 10 ^ 16" by (approximation 80) lemma "¦ pi - 3.1415926535897932385 ¦ < inverse 10 ^ 18" by (approximation 80) section "Use variable ranges" lemma "0.5 ≤ x ∧ x ≤ 4.5 ==> ¦ arctan x - 0.91 ¦ < 0.455" by (approximation 10) lemma "0.49 ≤ x ∧ x ≤ 4.49 ==> ¦ arctan x - 0.91 ¦ < 0.455" by (approximation 20) lemma "1 / 2^1 ≤ x ∧ x ≤ 9 / 2^1 ==> ¦ arctan x - 0.91 ¦ < 0.455" by (approximation 10) lemma "0 ≤ x ∧ x ≤ 1 ==> 0 ≤ sin x" by (approximation 10) end