[STATEMENT]
lemma lb_cos:
  assumes "0 \<le> real_of_float x" and "x \<le> pi"
  shows "cos x \<in> {(lb_cos prec x) .. (ub_cos prec x)}" (is "?cos x \<in> {(?lb x) .. (?ub x) }")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
have x_half[symmetric]: "cos x = 2 * cos (x / 2) * cos (x / 2) - 1" for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x = 2 * cos (x / 2) * cos (x / 2) - 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos x = 2 * cos (x / 2) * cos (x / 2) - 1
[PROOF STEP]
have "cos x = cos (x / 2 + x / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x = cos (x / 2 + x / 2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cos x = cos (x / 2 + x / 2)

goal (1 subgoal):
 1. cos x = 2 * cos (x / 2) * cos (x / 2) - 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cos x = cos (x / 2 + x / 2)

goal (1 subgoal):
 1. cos x = 2 * cos (x / 2) * cos (x / 2) - 1
[PROOF STEP]
have "\<dots> = cos (x / 2) * cos (x / 2) + sin (x / 2) * sin (x / 2) - sin (x / 2) * sin (x / 2) + cos (x / 2) * cos (x / 2) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x / 2 + x / 2) = cos (x / 2) * cos (x / 2) + sin (x / 2) * sin (x / 2) - sin (x / 2) * sin (x / 2) + cos (x / 2) * cos (x / 2) - 1
[PROOF STEP]
unfolding cos_add
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x / 2) * cos (x / 2) - sin (x / 2) * sin (x / 2) = cos (x / 2) * cos (x / 2) + sin (x / 2) * sin (x / 2) - sin (x / 2) * sin (x / 2) + cos (x / 2) * cos (x / 2) - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cos (x / 2 + x / 2) = cos (x / 2) * cos (x / 2) + sin (x / 2) * sin (x / 2) - sin (x / 2) * sin (x / 2) + cos (x / 2) * cos (x / 2) - 1

goal (1 subgoal):
 1. cos x = 2 * cos (x / 2) * cos (x / 2) - 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cos (x / 2 + x / 2) = cos (x / 2) * cos (x / 2) + sin (x / 2) * sin (x / 2) - sin (x / 2) * sin (x / 2) + cos (x / 2) * cos (x / 2) - 1

goal (1 subgoal):
 1. cos x = 2 * cos (x / 2) * cos (x / 2) - 1
[PROOF STEP]
have "\<dots> = 2 * cos (x / 2) * cos (x / 2) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x / 2) * cos (x / 2) + sin (x / 2) * sin (x / 2) - sin (x / 2) * sin (x / 2) + cos (x / 2) * cos (x / 2) - 1 = 2 * cos (x / 2) * cos (x / 2) - 1
[PROOF STEP]
by algebra
[PROOF STATE]
proof (state)
this:
cos (x / 2) * cos (x / 2) + sin (x / 2) * sin (x / 2) - sin (x / 2) * sin (x / 2) + cos (x / 2) * cos (x / 2) - 1 = 2 * cos (x / 2) * cos (x / 2) - 1

goal (1 subgoal):
 1. cos x = 2 * cos (x / 2) * cos (x / 2) - 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cos x = 2 * cos (x / 2) * cos (x / 2) - 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cos x = 2 * cos (x / 2) * cos (x / 2) - 1

goal (1 subgoal):
 1. cos x = 2 * cos (x / 2) * cos (x / 2) - 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cos x = 2 * cos (x / 2) * cos (x / 2) - 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
2 * cos (?x / 2) * cos (?x / 2) - 1 = cos ?x

goal (1 subgoal):
 1. cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
have "\<not> x < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> x < 0
[PROOF STEP]
using \<open>0 \<le> real_of_float x\<close>
[PROOF STATE]
proof (prove)
using this:
0 \<le> real_of_float x

goal (1 subgoal):
 1. \<not> x < 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> x < 0

goal (1 subgoal):
 1. cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
let "?ub_horner x" = "ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * x)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
let "?lb_horner x" = "lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * x)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
let "?ub_half x" = "float_plus_up prec (Float 1 1 * x * x) (- 1)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
let "?lb_half x" = "if x < 0 then - 1 else float_plus_down prec (Float 1 1 * x * x) (- 1)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
proof (cases "x < Float 1 (- 1)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
 2. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x < Float 1 (- 1)

goal (2 subgoals):
 1. x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
 2. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
hence "x \<le> pi / 2"
[PROOF STATE]
proof (prove)
using this:
x < Float 1 (- 1)

goal (1 subgoal):
 1. real_of_float x \<le> pi / 2
[PROOF STEP]
using pi_ge_two
[PROOF STATE]
proof (prove)
using this:
x < Float 1 (- 1)
2 \<le> pi

goal (1 subgoal):
 1. real_of_float x \<le> pi / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of_float x \<le> pi / 2

goal (2 subgoals):
 1. x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
 2. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
unfolding lb_cos_def[where x=x] ub_cos_def[where x=x]
        if_not_P[OF \<open>\<not> x < 0\<close>] if_P[OF \<open>x < Float 1 (- 1)\<close>] Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (real_of_float x) \<in> {real_of_float (lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * x))..real_of_float (ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * x))}
[PROOF STEP]
using cos_boundaries[OF \<open>0 \<le> real_of_float x\<close> \<open>x \<le> pi / 2\<close>]
[PROOF STATE]
proof (prove)
using this:
cos (real_of_float x) \<in> {real_of_float (lb_sin_cos_aux ?prec (get_even ?n) 1 1 (x * x))..real_of_float (ub_sin_cos_aux ?prec (get_odd ?n) 1 1 (x * x))}

goal (1 subgoal):
 1. cos (real_of_float x) \<in> {real_of_float (lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * x))..real_of_float (ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * x))}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> x < Float 1 (- 1)

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<not> x < Float 1 (- 1)

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
fix y x :: float
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
let ?x2 = "(x * Float 1 (- 1))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
assume "y \<le> cos ?x2" and "-pi \<le> x" and "x \<le> pi"
[PROOF STATE]
proof (state)
this:
real_of_float y \<le> cos (real_of_float (x * Float 1 (- 1)))
- pi \<le> real_of_float x
real_of_float x \<le> pi

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
hence "- (pi / 2) \<le> ?x2" and "?x2 \<le> pi / 2"
[PROOF STATE]
proof (prove)
using this:
real_of_float y \<le> cos (real_of_float (x * Float 1 (- 1)))
- pi \<le> real_of_float x
real_of_float x \<le> pi

goal (1 subgoal):
 1. - (pi / 2) \<le> real_of_float (x * Float 1 (- 1)) &&& real_of_float (x * Float 1 (- 1)) \<le> pi / 2
[PROOF STEP]
using pi_ge_two
[PROOF STATE]
proof (prove)
using this:
real_of_float y \<le> cos (real_of_float (x * Float 1 (- 1)))
- pi \<le> real_of_float x
real_of_float x \<le> pi
2 \<le> pi

goal (1 subgoal):
 1. - (pi / 2) \<le> real_of_float (x * Float 1 (- 1)) &&& real_of_float (x * Float 1 (- 1)) \<le> pi / 2
[PROOF STEP]
unfolding Float_num
[PROOF STATE]
proof (prove)
using this:
real_of_float y \<le> cos (real_of_float (x * Float 1 (- 1)))
- pi \<le> real_of_float x
real_of_float x \<le> pi
2 \<le> pi

goal (1 subgoal):
 1. - (pi / 2) \<le> real_of_float (x * Float 1 (- 1)) &&& real_of_float (x * Float 1 (- 1)) \<le> pi / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- (pi / 2) \<le> real_of_float (x * Float 1 (- 1))
real_of_float (x * Float 1 (- 1)) \<le> pi / 2

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
hence "0 \<le> cos ?x2"
[PROOF STATE]
proof (prove)
using this:
- (pi / 2) \<le> real_of_float (x * Float 1 (- 1))
real_of_float (x * Float 1 (- 1)) \<le> pi / 2

goal (1 subgoal):
 1. 0 \<le> cos (real_of_float (x * Float 1 (- 1)))
[PROOF STEP]
by (rule cos_ge_zero)
[PROOF STATE]
proof (state)
this:
0 \<le> cos (real_of_float (x * Float 1 (- 1)))

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
have "(?lb_half y) \<le> cos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
proof (cases "y < 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. y < 0 \<Longrightarrow> real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)
 2. \<not> y < 0 \<Longrightarrow> real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
y < 0

goal (2 subgoals):
 1. y < 0 \<Longrightarrow> real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)
 2. \<not> y < 0 \<Longrightarrow> real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
using cos_ge_minus_one
[PROOF STATE]
proof (prove)
using this:
- 1 \<le> cos ?x

goal (1 subgoal):
 1. real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
unfolding if_P[OF True]
[PROOF STATE]
proof (prove)
using this:
- 1 \<le> cos ?x

goal (1 subgoal):
 1. real_of_float (- 1) \<le> cos (real_of_float x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)

goal (1 subgoal):
 1. \<not> y < 0 \<Longrightarrow> real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> y < 0 \<Longrightarrow> real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> y < 0

goal (1 subgoal):
 1. \<not> y < 0 \<Longrightarrow> real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
hence "0 \<le> real_of_float y"
[PROOF STATE]
proof (prove)
using this:
\<not> y < 0

goal (1 subgoal):
 1. 0 \<le> real_of_float y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> real_of_float y

goal (1 subgoal):
 1. \<not> y < 0 \<Longrightarrow> real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
from mult_mono[OF \<open>y \<le> cos ?x2\<close> \<open>y \<le> cos ?x2\<close> \<open>0 \<le> cos ?x2\<close> this]
[PROOF STATE]
proof (chain)
picking this:
real_of_float y * real_of_float y \<le> cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1)))
[PROOF STEP]
have "real_of_float y * real_of_float y \<le> cos ?x2 * cos ?x2"
[PROOF STATE]
proof (prove)
using this:
real_of_float y * real_of_float y \<le> cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1)))

goal (1 subgoal):
 1. real_of_float y * real_of_float y \<le> cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real_of_float y * real_of_float y \<le> cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1)))

goal (1 subgoal):
 1. \<not> y < 0 \<Longrightarrow> real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
hence "2 * real_of_float y * real_of_float y \<le> 2 * cos ?x2 * cos ?x2"
[PROOF STATE]
proof (prove)
using this:
real_of_float y * real_of_float y \<le> cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1)))

goal (1 subgoal):
 1. 2 * real_of_float y * real_of_float y \<le> 2 * cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * real_of_float y * real_of_float y \<le> 2 * cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1)))

goal (1 subgoal):
 1. \<not> y < 0 \<Longrightarrow> real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
hence "2 * real_of_float y * real_of_float y - 1 \<le> 2 * cos (x / 2) * cos (x / 2) - 1"
[PROOF STATE]
proof (prove)
using this:
2 * real_of_float y * real_of_float y \<le> 2 * cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1)))

goal (1 subgoal):
 1. 2 * real_of_float y * real_of_float y - 1 \<le> 2 * cos (real_of_float x / 2) * cos (real_of_float x / 2) - 1
[PROOF STEP]
unfolding Float_num
[PROOF STATE]
proof (prove)
using this:
2 * real_of_float y * real_of_float y \<le> 2 * cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1)))

goal (1 subgoal):
 1. 2 * real_of_float y * real_of_float y - 1 \<le> 2 * cos (real_of_float x / 2) * cos (real_of_float x / 2) - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * real_of_float y * real_of_float y - 1 \<le> 2 * cos (real_of_float x / 2) * cos (real_of_float x / 2) - 1

goal (1 subgoal):
 1. \<not> y < 0 \<Longrightarrow> real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
2 * real_of_float y * real_of_float y - 1 \<le> 2 * cos (real_of_float x / 2) * cos (real_of_float x / 2) - 1

goal (1 subgoal):
 1. real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
unfolding if_not_P[OF False] x_half Float_num
[PROOF STATE]
proof (prove)
using this:
2 * real_of_float y * real_of_float y - 1 \<le> cos (real_of_float x)

goal (1 subgoal):
 1. real_of_float (float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
by (auto intro!: float_plus_down_le)
[PROOF STATE]
proof (state)
this:
real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real_of_float (if y < 0 then - 1 else float_plus_down prec (Float 1 1 * y * y) (- 1)) \<le> cos (real_of_float x)

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>real_of_float ?y2 \<le> cos (real_of_float (?xa2 * Float 1 (- 1))); - pi \<le> real_of_float ?xa2; real_of_float ?xa2 \<le> pi\<rbrakk> \<Longrightarrow> real_of_float (if ?y2 < 0 then - 1 else float_plus_down prec (Float 1 1 * ?y2 * ?y2) (- 1)) \<le> cos (real_of_float ?xa2)

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
note lb_half = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>real_of_float ?y2 \<le> cos (real_of_float (?xa2 * Float 1 (- 1))); - pi \<le> real_of_float ?xa2; real_of_float ?xa2 \<le> pi\<rbrakk> \<Longrightarrow> real_of_float (if ?y2 < 0 then - 1 else float_plus_down prec (Float 1 1 * ?y2 * ?y2) (- 1)) \<le> cos (real_of_float ?xa2)

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>real_of_float ?y2 \<le> cos (real_of_float (?xa2 * Float 1 (- 1))); - pi \<le> real_of_float ?xa2; real_of_float ?xa2 \<le> pi\<rbrakk> \<Longrightarrow> real_of_float (if ?y2 < 0 then - 1 else float_plus_down prec (Float 1 1 * ?y2 * ?y2) (- 1)) \<le> cos (real_of_float ?xa2)

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
fix y x :: float
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
let ?x2 = "(x * Float 1 (- 1))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
assume ub: "cos ?x2 \<le> y" and "- pi \<le> x" and "x \<le> pi"
[PROOF STATE]
proof (state)
this:
cos (real_of_float (x * Float 1 (- 1))) \<le> real_of_float y
- pi \<le> real_of_float x
real_of_float x \<le> pi

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
hence "- (pi / 2) \<le> ?x2" and "?x2 \<le> pi / 2"
[PROOF STATE]
proof (prove)
using this:
cos (real_of_float (x * Float 1 (- 1))) \<le> real_of_float y
- pi \<le> real_of_float x
real_of_float x \<le> pi

goal (1 subgoal):
 1. - (pi / 2) \<le> real_of_float (x * Float 1 (- 1)) &&& real_of_float (x * Float 1 (- 1)) \<le> pi / 2
[PROOF STEP]
using pi_ge_two
[PROOF STATE]
proof (prove)
using this:
cos (real_of_float (x * Float 1 (- 1))) \<le> real_of_float y
- pi \<le> real_of_float x
real_of_float x \<le> pi
2 \<le> pi

goal (1 subgoal):
 1. - (pi / 2) \<le> real_of_float (x * Float 1 (- 1)) &&& real_of_float (x * Float 1 (- 1)) \<le> pi / 2
[PROOF STEP]
unfolding Float_num
[PROOF STATE]
proof (prove)
using this:
cos (real_of_float (x * Float 1 (- 1))) \<le> real_of_float y
- pi \<le> real_of_float x
real_of_float x \<le> pi
2 \<le> pi

goal (1 subgoal):
 1. - (pi / 2) \<le> real_of_float (x * Float 1 (- 1)) &&& real_of_float (x * Float 1 (- 1)) \<le> pi / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- (pi / 2) \<le> real_of_float (x * Float 1 (- 1))
real_of_float (x * Float 1 (- 1)) \<le> pi / 2

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
hence "0 \<le> cos ?x2"
[PROOF STATE]
proof (prove)
using this:
- (pi / 2) \<le> real_of_float (x * Float 1 (- 1))
real_of_float (x * Float 1 (- 1)) \<le> pi / 2

goal (1 subgoal):
 1. 0 \<le> cos (real_of_float (x * Float 1 (- 1)))
[PROOF STEP]
by (rule cos_ge_zero)
[PROOF STATE]
proof (state)
this:
0 \<le> cos (real_of_float (x * Float 1 (- 1)))

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
have "cos x \<le> (?ub_half y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * y * y) (- 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * y * y) (- 1))
[PROOF STEP]
have "0 \<le> real_of_float y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> real_of_float y
[PROOF STEP]
using \<open>0 \<le> cos ?x2\<close> ub
[PROOF STATE]
proof (prove)
using this:
0 \<le> cos (real_of_float (x * Float 1 (- 1)))
cos (real_of_float (x * Float 1 (- 1))) \<le> real_of_float y

goal (1 subgoal):
 1. 0 \<le> real_of_float y
[PROOF STEP]
by (rule order_trans)
[PROOF STATE]
proof (state)
this:
0 \<le> real_of_float y

goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * y * y) (- 1))
[PROOF STEP]
from mult_mono[OF ub ub this \<open>0 \<le> cos ?x2\<close>]
[PROOF STATE]
proof (chain)
picking this:
cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1))) \<le> real_of_float y * real_of_float y
[PROOF STEP]
have "cos ?x2 * cos ?x2 \<le> real_of_float y * real_of_float y"
[PROOF STATE]
proof (prove)
using this:
cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1))) \<le> real_of_float y * real_of_float y

goal (1 subgoal):
 1. cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1))) \<le> real_of_float y * real_of_float y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1))) \<le> real_of_float y * real_of_float y

goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * y * y) (- 1))
[PROOF STEP]
hence "2 * cos ?x2 * cos ?x2 \<le> 2 * real_of_float y * real_of_float y"
[PROOF STATE]
proof (prove)
using this:
cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1))) \<le> real_of_float y * real_of_float y

goal (1 subgoal):
 1. 2 * cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1))) \<le> 2 * real_of_float y * real_of_float y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1))) \<le> 2 * real_of_float y * real_of_float y

goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * y * y) (- 1))
[PROOF STEP]
hence "2 * cos (x / 2) * cos (x / 2) - 1 \<le> 2 * real_of_float y * real_of_float y - 1"
[PROOF STATE]
proof (prove)
using this:
2 * cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1))) \<le> 2 * real_of_float y * real_of_float y

goal (1 subgoal):
 1. 2 * cos (real_of_float x / 2) * cos (real_of_float x / 2) - 1 \<le> 2 * real_of_float y * real_of_float y - 1
[PROOF STEP]
unfolding Float_num
[PROOF STATE]
proof (prove)
using this:
2 * cos (real_of_float (x * Float 1 (- 1))) * cos (real_of_float (x * Float 1 (- 1))) \<le> 2 * real_of_float y * real_of_float y

goal (1 subgoal):
 1. 2 * cos (real_of_float x / 2) * cos (real_of_float x / 2) - 1 \<le> 2 * real_of_float y * real_of_float y - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * cos (real_of_float x / 2) * cos (real_of_float x / 2) - 1 \<le> 2 * real_of_float y * real_of_float y - 1

goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * y * y) (- 1))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
2 * cos (real_of_float x / 2) * cos (real_of_float x / 2) - 1 \<le> 2 * real_of_float y * real_of_float y - 1

goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * y * y) (- 1))
[PROOF STEP]
unfolding x_half Float_num
[PROOF STATE]
proof (prove)
using this:
cos (real_of_float x) \<le> 2 * real_of_float y * real_of_float y - 1

goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * y * y) (- 1))
[PROOF STEP]
by (auto intro!: float_plus_up_le)
[PROOF STATE]
proof (state)
this:
cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * y * y) (- 1))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * y * y) (- 1))

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>cos (real_of_float (?xa2 * Float 1 (- 1))) \<le> real_of_float ?y2; - pi \<le> real_of_float ?xa2; real_of_float ?xa2 \<le> pi\<rbrakk> \<Longrightarrow> cos (real_of_float ?xa2) \<le> real_of_float (float_plus_up prec (Float 1 1 * ?y2 * ?y2) (- 1))

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
note ub_half = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>cos (real_of_float (?xa2 * Float 1 (- 1))) \<le> real_of_float ?y2; - pi \<le> real_of_float ?xa2; real_of_float ?xa2 \<le> pi\<rbrakk> \<Longrightarrow> cos (real_of_float ?xa2) \<le> real_of_float (float_plus_up prec (Float 1 1 * ?y2 * ?y2) (- 1))

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
let ?x2 = "x * Float 1 (- 1)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
let ?x4 = "x * Float 1 (- 1) * Float 1 (- 1)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
have "-pi \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - pi \<le> real_of_float x
[PROOF STEP]
using pi_ge_zero[THEN le_imp_neg_le, unfolded minus_zero] \<open>0 \<le> real_of_float x\<close>
[PROOF STATE]
proof (prove)
using this:
- pi \<le> 0
0 \<le> real_of_float x

goal (1 subgoal):
 1. - pi \<le> real_of_float x
[PROOF STEP]
by (rule order_trans)
[PROOF STATE]
proof (state)
this:
- pi \<le> real_of_float x

goal (1 subgoal):
 1. \<not> x < Float 1 (- 1) \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
proof (cases "x < 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
 2. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x < 1

goal (2 subgoals):
 1. x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
 2. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
hence "real_of_float x \<le> 1"
[PROOF STATE]
proof (prove)
using this:
x < 1

goal (1 subgoal):
 1. real_of_float x \<le> 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of_float x \<le> 1

goal (2 subgoals):
 1. x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
 2. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
have "0 \<le> real_of_float ?x2" and "?x2 \<le> pi / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> real_of_float (x * Float 1 (- 1)) &&& real_of_float (x * Float 1 (- 1)) \<le> pi / 2
[PROOF STEP]
using pi_ge_two \<open>0 \<le> real_of_float x\<close>
[PROOF STATE]
proof (prove)
using this:
2 \<le> pi
0 \<le> real_of_float x

goal (1 subgoal):
 1. 0 \<le> real_of_float (x * Float 1 (- 1)) &&& real_of_float (x * Float 1 (- 1)) \<le> pi / 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 \<le> pi
0 \<le> real_of_float x
0 \<le> real_of_float x
real_of_float x \<le> pi

goal (1 subgoal):
 1. 0 \<le> real_of_float (x * Float 1 (- 1)) &&& real_of_float (x * Float 1 (- 1)) \<le> pi / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> real_of_float (x * Float 1 (- 1))
real_of_float (x * Float 1 (- 1)) \<le> pi / 2

goal (2 subgoals):
 1. x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
 2. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
from cos_boundaries[OF this]
[PROOF STATE]
proof (chain)
picking this:
cos (real_of_float (x * Float 1 (- 1))) \<in> {real_of_float (lb_sin_cos_aux ?prec (get_even ?n) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))))..real_of_float (ub_sin_cos_aux ?prec (get_odd ?n) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))))}
[PROOF STEP]
have lb: "(?lb_horner ?x2) \<le> ?cos ?x2" and ub: "?cos ?x2 \<le> (?ub_horner ?x2)"
[PROOF STATE]
proof (prove)
using this:
cos (real_of_float (x * Float 1 (- 1))) \<in> {real_of_float (lb_sin_cos_aux ?prec (get_even ?n) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))))..real_of_float (ub_sin_cos_aux ?prec (get_odd ?n) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))))}

goal (1 subgoal):
 1. real_of_float (lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1)))) \<le> cos (real_of_float (x * Float 1 (- 1))) &&& cos (real_of_float (x * Float 1 (- 1))) \<le> real_of_float (ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of_float (lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1)))) \<le> cos (real_of_float (x * Float 1 (- 1)))
cos (real_of_float (x * Float 1 (- 1))) \<le> real_of_float (ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))))

goal (2 subgoals):
 1. x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
 2. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
have "(?lb x) \<le> ?cos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_float (lb_cos prec x) \<le> cos (real_of_float x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real_of_float (lb_cos prec x) \<le> cos (real_of_float x)
[PROOF STEP]
from lb_half[OF lb \<open>-pi \<le> x\<close> \<open>x \<le> pi\<close>]
[PROOF STATE]
proof (chain)
picking this:
real_of_float (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1)))) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_float (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1)))) (- 1)) \<le> cos (real_of_float x)

goal (1 subgoal):
 1. real_of_float (lb_cos prec x) \<le> cos (real_of_float x)
[PROOF STEP]
unfolding lb_cos_def[where x=x] Let_def
[PROOF STATE]
proof (prove)
using this:
real_of_float (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1)))) (- 1)) \<le> cos (real_of_float x)

goal (1 subgoal):
 1. real_of_float (if x < Float 1 (- 1) then lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * x) else if x < 1 then if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1)))) (- 1) else if (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) < 0 then - 1 else float_plus_down prec (Float 1 1 * (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) * (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1))) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
using \<open>\<not> x < 0\<close> \<open>\<not> x < Float 1 (- 1)\<close> \<open>x < 1\<close>
[PROOF STATE]
proof (prove)
using this:
real_of_float (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1)))) (- 1)) \<le> cos (real_of_float x)
\<not> x < 0
\<not> x < Float 1 (- 1)
x < 1

goal (1 subgoal):
 1. real_of_float (if x < Float 1 (- 1) then lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * x) else if x < 1 then if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1)))) (- 1) else if (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) < 0 then - 1 else float_plus_down prec (Float 1 1 * (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) * (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1))) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of_float (lb_cos prec x) \<le> cos (real_of_float x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real_of_float (lb_cos prec x) \<le> cos (real_of_float x)

goal (2 subgoals):
 1. x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
 2. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real_of_float (lb_cos prec x) \<le> cos (real_of_float x)

goal (2 subgoals):
 1. x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
 2. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
have "?cos x \<le> (?ub x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (ub_cos prec x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (ub_cos prec x)
[PROOF STEP]
from ub_half[OF ub \<open>-pi \<le> x\<close> \<open>x \<le> pi\<close>]
[PROOF STATE]
proof (chain)
picking this:
cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1)))) (- 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1)))) (- 1))

goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (ub_cos prec x)
[PROOF STEP]
unfolding ub_cos_def[where x=x] Let_def
[PROOF STATE]
proof (prove)
using this:
cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1)))) (- 1))

goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (if x < Float 1 (- 1) then ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * x) else if x < 1 then float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1)))) (- 1) else float_plus_up prec (Float 1 1 * float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1) * float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) (- 1))
[PROOF STEP]
using \<open>\<not> x < 0\<close> \<open>\<not> x < Float 1 (- 1)\<close> \<open>x < 1\<close>
[PROOF STATE]
proof (prove)
using this:
cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1)))) (- 1))
\<not> x < 0
\<not> x < Float 1 (- 1)
x < 1

goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (if x < Float 1 (- 1) then ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * x) else if x < 1 then float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * (x * Float 1 (- 1)))) (- 1) else float_plus_up prec (Float 1 1 * float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1) * float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) (- 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cos (real_of_float x) \<le> real_of_float (ub_cos prec x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cos (real_of_float x) \<le> real_of_float (ub_cos prec x)

goal (2 subgoals):
 1. x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
 2. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real_of_float (lb_cos prec x) \<le> cos (real_of_float x)
cos (real_of_float x) \<le> real_of_float (ub_cos prec x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_float (lb_cos prec x) \<le> cos (real_of_float x)
cos (real_of_float x) \<le> real_of_float (ub_cos prec x)

goal (1 subgoal):
 1. cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}

goal (1 subgoal):
 1. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> x < 1

goal (1 subgoal):
 1. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
have "0 \<le> real_of_float ?x4" and "?x4 \<le> pi / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> real_of_float (x * Float 1 (- 1) * Float 1 (- 1)) &&& real_of_float (x * Float 1 (- 1) * Float 1 (- 1)) \<le> pi / 2
[PROOF STEP]
using pi_ge_two \<open>0 \<le> real_of_float x\<close> \<open>x \<le> pi\<close>
[PROOF STATE]
proof (prove)
using this:
2 \<le> pi
0 \<le> real_of_float x
real_of_float x \<le> pi

goal (1 subgoal):
 1. 0 \<le> real_of_float (x * Float 1 (- 1) * Float 1 (- 1)) &&& real_of_float (x * Float 1 (- 1) * Float 1 (- 1)) \<le> pi / 2
[PROOF STEP]
unfolding Float_num
[PROOF STATE]
proof (prove)
using this:
2 \<le> pi
0 \<le> real_of_float x
real_of_float x \<le> pi

goal (1 subgoal):
 1. 0 \<le> real_of_float (x * Float 1 (- 1) * Float 1 (- 1)) &&& real_of_float (x * Float 1 (- 1) * Float 1 (- 1)) \<le> pi / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> real_of_float (x * Float 1 (- 1) * Float 1 (- 1))
real_of_float (x * Float 1 (- 1) * Float 1 (- 1)) \<le> pi / 2

goal (1 subgoal):
 1. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
from cos_boundaries[OF this]
[PROOF STATE]
proof (chain)
picking this:
cos (real_of_float (x * Float 1 (- 1) * Float 1 (- 1))) \<in> {real_of_float (lb_sin_cos_aux ?prec (get_even ?n) 1 1 (x * Float 1 (- 1) * Float 1 (- 1) * (x * Float 1 (- 1) * Float 1 (- 1))))..real_of_float (ub_sin_cos_aux ?prec (get_odd ?n) 1 1 (x * Float 1 (- 1) * Float 1 (- 1) * (x * Float 1 (- 1) * Float 1 (- 1))))}
[PROOF STEP]
have lb: "(?lb_horner ?x4) \<le> ?cos ?x4" and ub: "?cos ?x4 \<le> (?ub_horner ?x4)"
[PROOF STATE]
proof (prove)
using this:
cos (real_of_float (x * Float 1 (- 1) * Float 1 (- 1))) \<in> {real_of_float (lb_sin_cos_aux ?prec (get_even ?n) 1 1 (x * Float 1 (- 1) * Float 1 (- 1) * (x * Float 1 (- 1) * Float 1 (- 1))))..real_of_float (ub_sin_cos_aux ?prec (get_odd ?n) 1 1 (x * Float 1 (- 1) * Float 1 (- 1) * (x * Float 1 (- 1) * Float 1 (- 1))))}

goal (1 subgoal):
 1. real_of_float (lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * Float 1 (- 1) * (x * Float 1 (- 1) * Float 1 (- 1)))) \<le> cos (real_of_float (x * Float 1 (- 1) * Float 1 (- 1))) &&& cos (real_of_float (x * Float 1 (- 1) * Float 1 (- 1))) \<le> real_of_float (ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * Float 1 (- 1) * (x * Float 1 (- 1) * Float 1 (- 1))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of_float (lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * Float 1 (- 1) * (x * Float 1 (- 1) * Float 1 (- 1)))) \<le> cos (real_of_float (x * Float 1 (- 1) * Float 1 (- 1)))
cos (real_of_float (x * Float 1 (- 1) * Float 1 (- 1))) \<le> real_of_float (ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 1) * Float 1 (- 1) * (x * Float 1 (- 1) * Float 1 (- 1))))

goal (1 subgoal):
 1. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
have eq_4: "?x2 * Float 1 (- 1) = x * Float 1 (- 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * Float 1 (- 1) * Float 1 (- 1) = x * Float 1 (- 2)
[PROOF STEP]
by (auto simp: real_of_float_eq)
[PROOF STATE]
proof (state)
this:
x * Float 1 (- 1) * Float 1 (- 1) = x * Float 1 (- 2)

goal (1 subgoal):
 1. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
have "(?lb x) \<le> ?cos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_float (lb_cos prec x) \<le> cos (real_of_float x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real_of_float (lb_cos prec x) \<le> cos (real_of_float x)
[PROOF STEP]
have "-pi \<le> ?x2" and "?x2 \<le> pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - pi \<le> real_of_float (x * Float 1 (- 1)) &&& real_of_float (x * Float 1 (- 1)) \<le> pi
[PROOF STEP]
using pi_ge_two \<open>0 \<le> real_of_float x\<close> \<open>x \<le> pi\<close>
[PROOF STATE]
proof (prove)
using this:
2 \<le> pi
0 \<le> real_of_float x
real_of_float x \<le> pi

goal (1 subgoal):
 1. - pi \<le> real_of_float (x * Float 1 (- 1)) &&& real_of_float (x * Float 1 (- 1)) \<le> pi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- pi \<le> real_of_float (x * Float 1 (- 1))
real_of_float (x * Float 1 (- 1)) \<le> pi

goal (1 subgoal):
 1. real_of_float (lb_cos prec x) \<le> cos (real_of_float x)
[PROOF STEP]
from lb_half[OF lb_half[OF lb this] \<open>-pi \<le> x\<close> \<open>x \<le> pi\<close>, unfolded eq_4]
[PROOF STATE]
proof (chain)
picking this:
real_of_float (if (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) < 0 then - 1 else float_plus_down prec (Float 1 1 * (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) * (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1))) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_float (if (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) < 0 then - 1 else float_plus_down prec (Float 1 1 * (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) * (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1))) (- 1)) \<le> cos (real_of_float x)

goal (1 subgoal):
 1. real_of_float (lb_cos prec x) \<le> cos (real_of_float x)
[PROOF STEP]
unfolding lb_cos_def[where x=x] if_not_P[OF \<open>\<not> x < 0\<close>]
            if_not_P[OF \<open>\<not> x < Float 1 (- 1)\<close>] if_not_P[OF \<open>\<not> x < 1\<close>] Let_def
[PROOF STATE]
proof (prove)
using this:
real_of_float (if (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) < 0 then - 1 else float_plus_down prec (Float 1 1 * (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) * (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1))) (- 1)) \<le> cos (real_of_float x)

goal (1 subgoal):
 1. real_of_float (if (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) < 0 then - 1 else float_plus_down prec (Float 1 1 * (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) * (if lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) < 0 then - 1 else float_plus_down prec (Float 1 1 * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * lb_sin_cos_aux prec (get_even (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1))) (- 1)) \<le> cos (real_of_float x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real_of_float (lb_cos prec x) \<le> cos (real_of_float x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real_of_float (lb_cos prec x) \<le> cos (real_of_float x)

goal (1 subgoal):
 1. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real_of_float (lb_cos prec x) \<le> cos (real_of_float x)

goal (1 subgoal):
 1. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
have "?cos x \<le> (?ub x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (ub_cos prec x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (ub_cos prec x)
[PROOF STEP]
have "-pi \<le> ?x2" and "?x2 \<le> pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - pi \<le> real_of_float (x * Float 1 (- 1)) &&& real_of_float (x * Float 1 (- 1)) \<le> pi
[PROOF STEP]
using pi_ge_two \<open>0 \<le> real_of_float x\<close> \<open> x \<le> pi\<close>
[PROOF STATE]
proof (prove)
using this:
2 \<le> pi
0 \<le> real_of_float x
real_of_float x \<le> pi

goal (1 subgoal):
 1. - pi \<le> real_of_float (x * Float 1 (- 1)) &&& real_of_float (x * Float 1 (- 1)) \<le> pi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- pi \<le> real_of_float (x * Float 1 (- 1))
real_of_float (x * Float 1 (- 1)) \<le> pi

goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (ub_cos prec x)
[PROOF STEP]
from ub_half[OF ub_half[OF ub this] \<open>-pi \<le> x\<close> \<open>x \<le> pi\<close>, unfolded eq_4]
[PROOF STATE]
proof (chain)
picking this:
cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1) * float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) (- 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1) * float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) (- 1))

goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (ub_cos prec x)
[PROOF STEP]
unfolding ub_cos_def[where x=x] if_not_P[OF \<open>\<not> x < 0\<close>]
            if_not_P[OF \<open>\<not> x < Float 1 (- 1)\<close>] if_not_P[OF \<open>\<not> x < 1\<close>] Let_def
[PROOF STATE]
proof (prove)
using this:
cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1) * float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) (- 1))

goal (1 subgoal):
 1. cos (real_of_float x) \<le> real_of_float (float_plus_up prec (Float 1 1 * float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1) * float_plus_up prec (Float 1 1 * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2))) * ub_sin_cos_aux prec (get_odd (prec div 4 + 1)) 1 1 (x * Float 1 (- 2) * (x * Float 1 (- 2)))) (- 1)) (- 1))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cos (real_of_float x) \<le> real_of_float (ub_cos prec x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cos (real_of_float x) \<le> real_of_float (ub_cos prec x)

goal (1 subgoal):
 1. \<not> x < 1 \<Longrightarrow> cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real_of_float (lb_cos prec x) \<le> cos (real_of_float x)
cos (real_of_float x) \<le> real_of_float (ub_cos prec x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_float (lb_cos prec x) \<le> cos (real_of_float x)
cos (real_of_float x) \<le> real_of_float (ub_cos prec x)

goal (1 subgoal):
 1. cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cos (real_of_float x) \<in> {real_of_float (lb_cos prec x)..real_of_float (ub_cos prec x)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma two_block_non_interfering_mult_decomposition:
  assumes "dim_col A + dim_col B = dim_vec v"
  shows "two_block_non_interfering A B *\<^sub>v v =
         A *\<^sub>v vec_first v (dim_col A) @\<^sub>v B *\<^sub>v vec_last v (dim_col B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. two_block_non_interfering A B *\<^sub>v v = A *\<^sub>v vec_first v (dim_col A) @\<^sub>v B *\<^sub>v vec_last v (dim_col B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. two_block_non_interfering A B *\<^sub>v v = A *\<^sub>v vec_first v (dim_col A) @\<^sub>v B *\<^sub>v vec_last v (dim_col B)
[PROOF STEP]
let ?tb = "two_block_non_interfering A B"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. two_block_non_interfering A B *\<^sub>v v = A *\<^sub>v vec_first v (dim_col A) @\<^sub>v B *\<^sub>v vec_last v (dim_col B)
[PROOF STEP]
from first_vec_two_block_non_inter_is_first_vec[of A B v "dim_row A", OF assms]
[PROOF STATE]
proof (chain)
picking this:
dim_row A = dim_row A \<Longrightarrow> vec_first (two_block_non_interfering A B *\<^sub>v v) (dim_row A) = A *\<^sub>v vec_first v (dim_col A)
[PROOF STEP]
have "vec_first (?tb *\<^sub>v v) (dim_row A) = A *\<^sub>v vec_first v (dim_col A)"
[PROOF STATE]
proof (prove)
using this:
dim_row A = dim_row A \<Longrightarrow> vec_first (two_block_non_interfering A B *\<^sub>v v) (dim_row A) = A *\<^sub>v vec_first v (dim_col A)

goal (1 subgoal):
 1. vec_first (two_block_non_interfering A B *\<^sub>v v) (dim_row A) = A *\<^sub>v vec_first v (dim_col A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
vec_first (two_block_non_interfering A B *\<^sub>v v) (dim_row A) = A *\<^sub>v vec_first v (dim_col A)

goal (1 subgoal):
 1. two_block_non_interfering A B *\<^sub>v v = A *\<^sub>v vec_first v (dim_col A) @\<^sub>v B *\<^sub>v vec_last v (dim_col B)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
vec_first (two_block_non_interfering A B *\<^sub>v v) (dim_row A) = A *\<^sub>v vec_first v (dim_col A)

goal (1 subgoal):
 1. two_block_non_interfering A B *\<^sub>v v = A *\<^sub>v vec_first v (dim_col A) @\<^sub>v B *\<^sub>v vec_last v (dim_col B)
[PROOF STEP]
from last_vec_two_block_non_inter_is_last_vec[of A B v "dim_row B", OF assms]
[PROOF STATE]
proof (chain)
picking this:
dim_row B = dim_row B \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) (dim_row B) = B *\<^sub>v vec_last v (dim_col B)
[PROOF STEP]
have "vec_last (?tb *\<^sub>v v) (dim_row B) = B *\<^sub>v vec_last v (dim_col B)"
[PROOF STATE]
proof (prove)
using this:
dim_row B = dim_row B \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) (dim_row B) = B *\<^sub>v vec_last v (dim_col B)

goal (1 subgoal):
 1. vec_last (two_block_non_interfering A B *\<^sub>v v) (dim_row B) = B *\<^sub>v vec_last v (dim_col B)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
vec_last (two_block_non_interfering A B *\<^sub>v v) (dim_row B) = B *\<^sub>v vec_last v (dim_col B)

goal (1 subgoal):
 1. two_block_non_interfering A B *\<^sub>v v = A *\<^sub>v vec_first v (dim_col A) @\<^sub>v B *\<^sub>v vec_last v (dim_col B)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
vec_first (two_block_non_interfering A B *\<^sub>v v) (dim_row A) = A *\<^sub>v vec_first v (dim_col A)
vec_last (two_block_non_interfering A B *\<^sub>v v) (dim_row B) = B *\<^sub>v vec_last v (dim_col B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
vec_first (two_block_non_interfering A B *\<^sub>v v) (dim_row A) = A *\<^sub>v vec_first v (dim_col A)
vec_last (two_block_non_interfering A B *\<^sub>v v) (dim_row B) = B *\<^sub>v vec_last v (dim_col B)

goal (1 subgoal):
 1. two_block_non_interfering A B *\<^sub>v v = A *\<^sub>v vec_first v (dim_col A) @\<^sub>v B *\<^sub>v vec_last v (dim_col B)
[PROOF STEP]
using vec_first_last_append[of "?tb *\<^sub>v v" "(dim_row A)" "(dim_row B)"]
      dim_mult_mat_vec[of "?tb" v] two_block_non_interfering_dims(1)[of A B]
[PROOF STATE]
proof (prove)
using this:
vec_first (two_block_non_interfering A B *\<^sub>v v) (dim_row A) = A *\<^sub>v vec_first v (dim_col A)
vec_last (two_block_non_interfering A B *\<^sub>v v) (dim_row B) = B *\<^sub>v vec_last v (dim_col B)
two_block_non_interfering A B *\<^sub>v v \<in> carrier_vec (dim_row A + dim_row B) \<Longrightarrow> vec_first (two_block_non_interfering A B *\<^sub>v v) (dim_row A) @\<^sub>v vec_last (two_block_non_interfering A B *\<^sub>v v) (dim_row B) = two_block_non_interfering A B *\<^sub>v v
dim_vec (two_block_non_interfering A B *\<^sub>v v) = dim_row (two_block_non_interfering A B)
dim_row (two_block_non_interfering A B) = dim_row A + dim_row B

goal (1 subgoal):
 1. two_block_non_interfering A B *\<^sub>v v = A *\<^sub>v vec_first v (dim_col A) @\<^sub>v B *\<^sub>v vec_last v (dim_col B)
[PROOF STEP]
by (metis carrier_vec_dim_vec)
[PROOF STATE]
proof (state)
this:
two_block_non_interfering A B *\<^sub>v v = A *\<^sub>v vec_first v (dim_col A) @\<^sub>v B *\<^sub>v vec_last v (dim_col B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma s_calc: "$s^{m}_n = ((1+i)^n - 1) / $i^{m}" if "m \<noteq> 0" "i \<noteq> 0" for n m :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $s^{m}_n = ((1 + i) ^ n - 1) / $i^{m}
[PROOF STEP]
using that v_futr_pos
[PROOF STATE]
proof (prove)
using this:
m \<noteq> 0
i \<noteq> 0
0 < 1 + i

goal (1 subgoal):
 1. $s^{m}_n = ((1 + i) ^ n - 1) / $i^{m}
[PROOF STEP]
apply (subst s_a, simp, subst a_calc; simp?)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; i \<noteq> 0; 0 < 1 + i\<rbrakk> \<Longrightarrow> $i^{m} = 0 \<or> (1 + i) ^ n * (1 - $v ^ n) = (1 + i) ^ n - 1
[PROOF STEP]
apply (rule disjI2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; i \<noteq> 0; 0 < 1 + i\<rbrakk> \<Longrightarrow> (1 + i) ^ n * (1 - $v ^ n) = (1 + i) ^ n - 1
[PROOF STEP]
apply (subst right_diff_distrib, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; i \<noteq> 0; 0 < 1 + i\<rbrakk> \<Longrightarrow> (1 + i) ^ n * $v ^ n = 1
[PROOF STEP]
apply (rule left_right_inverse_power)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; i \<noteq> 0; 0 < 1 + i\<rbrakk> \<Longrightarrow> (1 + i) * $v = 1
[PROOF STEP]
unfolding v_pres_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; i \<noteq> 0; 0 < 1 + i\<rbrakk> \<Longrightarrow> (1 + i) * (1 / (1 + i)) = 1
[PROOF STEP]
by auto


[STATEMENT]
lemma brouwer_compactness_lemma:
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
  assumes "compact s"
    and "continuous_on s f"
    and "\<not> (\<exists>x\<in>s. f x = 0)"
  obtains d where "0 < d" and "\<forall>x\<in>s. d \<le> norm (f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; \<forall>x\<in>s. d \<le> norm (f x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (cases "s = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>d. \<lbrakk>0 < d; \<forall>x\<in>s. d \<le> norm (f x)\<rbrakk> \<Longrightarrow> thesis; s = {}\<rbrakk> \<Longrightarrow> thesis
 2. \<lbrakk>\<And>d. \<lbrakk>0 < d; \<forall>x\<in>s. d \<le> norm (f x)\<rbrakk> \<Longrightarrow> thesis; s \<noteq> {}\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
s = {}

goal (2 subgoals):
 1. \<lbrakk>\<And>d. \<lbrakk>0 < d; \<forall>x\<in>s. d \<le> norm (f x)\<rbrakk> \<Longrightarrow> thesis; s = {}\<rbrakk> \<Longrightarrow> thesis
 2. \<lbrakk>\<And>d. \<lbrakk>0 < d; \<forall>x\<in>s. d \<le> norm (f x)\<rbrakk> \<Longrightarrow> thesis; s \<noteq> {}\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (rule that [of 1]) (auto simp: True)
[PROOF STATE]
proof (state)
this:
thesis

goal (1 subgoal):
 1. \<lbrakk>\<And>d. \<lbrakk>0 < d; \<forall>x\<in>s. d \<le> norm (f x)\<rbrakk> \<Longrightarrow> thesis; s \<noteq> {}\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>d. \<lbrakk>0 < d; \<forall>x\<in>s. d \<le> norm (f x)\<rbrakk> \<Longrightarrow> thesis; s \<noteq> {}\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
s \<noteq> {}

goal (1 subgoal):
 1. \<lbrakk>\<And>d. \<lbrakk>0 < d; \<forall>x\<in>s. d \<le> norm (f x)\<rbrakk> \<Longrightarrow> thesis; s \<noteq> {}\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "continuous_on s (norm \<circ> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on s (norm \<circ> f)
[PROOF STEP]
by (rule continuous_intros continuous_on_norm assms(2))+
[PROOF STATE]
proof (state)
this:
continuous_on s (norm \<circ> f)

goal (1 subgoal):
 1. \<lbrakk>\<And>d. \<lbrakk>0 < d; \<forall>x\<in>s. d \<le> norm (f x)\<rbrakk> \<Longrightarrow> thesis; s \<noteq> {}\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
s \<noteq> {}
continuous_on s (norm \<circ> f)
[PROOF STEP]
obtain x where x: "x \<in> s" "\<forall>y\<in>s. (norm \<circ> f) x \<le> (norm \<circ> f) y"
[PROOF STATE]
proof (prove)
using this:
s \<noteq> {}
continuous_on s (norm \<circ> f)

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> s; \<forall>y\<in>s. (norm \<circ> f) x \<le> (norm \<circ> f) y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using continuous_attains_inf[OF assms(1), of "norm \<circ> f"]
[PROOF STATE]
proof (prove)
using this:
s \<noteq> {}
continuous_on s (norm \<circ> f)
\<lbrakk>s \<noteq> {}; continuous_on s (norm \<circ> f)\<rbrakk> \<Longrightarrow> \<exists>x\<in>s. \<forall>y\<in>s. (norm \<circ> f) x \<le> (norm \<circ> f) y

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> s; \<forall>y\<in>s. (norm \<circ> f) x \<le> (norm \<circ> f) y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding o_def
[PROOF STATE]
proof (prove)
using this:
s \<noteq> {}
continuous_on s (\<lambda>x. norm (f x))
\<lbrakk>s \<noteq> {}; continuous_on s (\<lambda>x. norm (f x))\<rbrakk> \<Longrightarrow> \<exists>x\<in>s. \<forall>y\<in>s. norm (f x) \<le> norm (f y)

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> s; \<forall>y\<in>s. norm (f x) \<le> norm (f y)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> s
\<forall>y\<in>s. (norm \<circ> f) x \<le> (norm \<circ> f) y

goal (1 subgoal):
 1. \<lbrakk>\<And>d. \<lbrakk>0 < d; \<forall>x\<in>s. d \<le> norm (f x)\<rbrakk> \<Longrightarrow> thesis; s \<noteq> {}\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have "(norm \<circ> f) x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < (norm \<circ> f) x
[PROOF STEP]
using assms(3) and x(1)
[PROOF STATE]
proof (prove)
using this:
\<not> (\<exists>x\<in>s. f x = (0::'b))
x \<in> s

goal (1 subgoal):
 1. 0 < (norm \<circ> f) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < (norm \<circ> f) x

goal (1 subgoal):
 1. \<lbrakk>\<And>d. \<lbrakk>0 < d; \<forall>x\<in>s. d \<le> norm (f x)\<rbrakk> \<Longrightarrow> thesis; s \<noteq> {}\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < (norm \<circ> f) x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < (norm \<circ> f) x

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (rule that) (insert x(2), auto simp: o_def)
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma one_le_of_rat_iff [simp]: "1 \<le> (of_rat r :: 'a::linordered_field) \<longleftrightarrow> 1 \<le> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((1::'a) \<le> of_rat r) = (1 \<le> r)
[PROOF STEP]
using of_rat_less_eq [of 1 r]
[PROOF STATE]
proof (prove)
using this:
(of_rat 1 \<le> of_rat r) = (1 \<le> r)

goal (1 subgoal):
 1. ((1::'a) \<le> of_rat r) = (1 \<le> r)
[PROOF STEP]
by simp


[STATEMENT]
lemma convex_on_dist [intro]:
  fixes S :: "'a::real_normed_vector set"
  shows "convex_on S (\<lambda>x. dist a x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_on S (dist a)
[PROOF STEP]
proof (auto simp: convex_on_def dist_norm)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> norm (a - (u *\<^sub>R x + v *\<^sub>R y)) \<le> u * norm (a - x) + v * norm (a - y)
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> norm (a - (u *\<^sub>R x + v *\<^sub>R y)) \<le> u * norm (a - x) + v * norm (a - y)
[PROOF STEP]
assume "x \<in> S" "y \<in> S"
[PROOF STATE]
proof (state)
this:
x \<in> S
y \<in> S

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> norm (a - (u *\<^sub>R x + v *\<^sub>R y)) \<le> u * norm (a - x) + v * norm (a - y)
[PROOF STEP]
fix u v :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> norm (a - (u *\<^sub>R x + v *\<^sub>R y)) \<le> u * norm (a - x) + v * norm (a - y)
[PROOF STEP]
assume "0 \<le> u"
[PROOF STATE]
proof (state)
this:
0 \<le> u

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> norm (a - (u *\<^sub>R x + v *\<^sub>R y)) \<le> u * norm (a - x) + v * norm (a - y)
[PROOF STEP]
assume "0 \<le> v"
[PROOF STATE]
proof (state)
this:
0 \<le> v

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> norm (a - (u *\<^sub>R x + v *\<^sub>R y)) \<le> u * norm (a - x) + v * norm (a - y)
[PROOF STEP]
assume "u + v = 1"
[PROOF STATE]
proof (state)
this:
u + v = 1

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> norm (a - (u *\<^sub>R x + v *\<^sub>R y)) \<le> u * norm (a - x) + v * norm (a - y)
[PROOF STEP]
have "a = u *\<^sub>R a + v *\<^sub>R a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = u *\<^sub>R a + v *\<^sub>R a
[PROOF STEP]
unfolding scaleR_left_distrib[symmetric] and \<open>u + v = 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = 1 *\<^sub>R a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a = u *\<^sub>R a + v *\<^sub>R a

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> norm (a - (u *\<^sub>R x + v *\<^sub>R y)) \<le> u * norm (a - x) + v * norm (a - y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = u *\<^sub>R a + v *\<^sub>R a
[PROOF STEP]
have *: "a - (u *\<^sub>R x + v *\<^sub>R y) = (u *\<^sub>R (a - x)) + (v *\<^sub>R (a - y))"
[PROOF STATE]
proof (prove)
using this:
a = u *\<^sub>R a + v *\<^sub>R a

goal (1 subgoal):
 1. a - (u *\<^sub>R x + v *\<^sub>R y) = u *\<^sub>R (a - x) + v *\<^sub>R (a - y)
[PROOF STEP]
by (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
a - (u *\<^sub>R x + v *\<^sub>R y) = u *\<^sub>R (a - x) + v *\<^sub>R (a - y)

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> S; y \<in> S; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> norm (a - (u *\<^sub>R x + v *\<^sub>R y)) \<le> u * norm (a - x) + v * norm (a - y)
[PROOF STEP]
show "norm (a - (u *\<^sub>R x + v *\<^sub>R y)) \<le> u * norm (a - x) + v * norm (a - y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (a - (u *\<^sub>R x + v *\<^sub>R y)) \<le> u * norm (a - x) + v * norm (a - y)
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (u *\<^sub>R (a - x) + v *\<^sub>R (a - y)) \<le> u * norm (a - x) + v * norm (a - y)
[PROOF STEP]
using norm_triangle_ineq[of "u *\<^sub>R (a - x)" "v *\<^sub>R (a - y)"]
[PROOF STATE]
proof (prove)
using this:
norm (u *\<^sub>R (a - x) + v *\<^sub>R (a - y)) \<le> norm (u *\<^sub>R (a - x)) + norm (v *\<^sub>R (a - y))

goal (1 subgoal):
 1. norm (u *\<^sub>R (a - x) + v *\<^sub>R (a - y)) \<le> u * norm (a - x) + v * norm (a - y)
[PROOF STEP]
using \<open>0 \<le> u\<close> \<open>0 \<le> v\<close>
[PROOF STATE]
proof (prove)
using this:
norm (u *\<^sub>R (a - x) + v *\<^sub>R (a - y)) \<le> norm (u *\<^sub>R (a - x)) + norm (v *\<^sub>R (a - y))
0 \<le> u
0 \<le> v

goal (1 subgoal):
 1. norm (u *\<^sub>R (a - x) + v *\<^sub>R (a - y)) \<le> u * norm (a - x) + v * norm (a - y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
norm (a - (u *\<^sub>R x + v *\<^sub>R y)) \<le> u * norm (a - x) + v * norm (a - y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma first_ind_nth:
  "\<lbrakk> distinct xs; i < length xs \<rbrakk> \<Longrightarrow> first_ind xs (xs ! i) j = i + j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xs; i < length xs\<rbrakk> \<Longrightarrow> first_ind xs (xs ! i) j = i + j
[PROOF STEP]
apply (induct xs arbitrary: i j)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i j. \<lbrakk>distinct []; i < length []\<rbrakk> \<Longrightarrow> first_ind [] ([] ! i) j = i + j
 2. \<And>a xs i j. \<lbrakk>\<And>i j. \<lbrakk>distinct xs; i < length xs\<rbrakk> \<Longrightarrow> first_ind xs (xs ! i) j = i + j; distinct (a # xs); i < length (a # xs)\<rbrakk> \<Longrightarrow> first_ind (a # xs) ((a # xs) ! i) j = i + j
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs i. \<lbrakk>\<And>i j. i < length xs \<Longrightarrow> first_ind xs (xs ! i) j = i + j; i < Suc (length xs); a \<notin> set xs; distinct xs; a = (a # xs) ! i\<rbrakk> \<Longrightarrow> i = 0
 2. \<And>a xs i j. \<lbrakk>\<And>i j. i < length xs \<Longrightarrow> first_ind xs (xs ! i) j = i + j; i < Suc (length xs); a \<notin> set xs; distinct xs; a \<noteq> (a # xs) ! i\<rbrakk> \<Longrightarrow> first_ind xs ((a # xs) ! i) (Suc j) = i + j
[PROOF STEP]
apply (metis less_Suc_eq_le nth_equal_first_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs i j. \<lbrakk>\<And>i j. i < length xs \<Longrightarrow> first_ind xs (xs ! i) j = i + j; i < Suc (length xs); a \<notin> set xs; distinct xs; a \<noteq> (a # xs) ! i\<rbrakk> \<Longrightarrow> first_ind xs ((a # xs) ! i) (Suc j) = i + j
[PROOF STEP]
using less_Suc_eq_0_disj
[PROOF STATE]
proof (prove)
using this:
(?m < Suc ?n) = (?m = 0 \<or> (\<exists>j. ?m = Suc j \<and> j < ?n))

goal (1 subgoal):
 1. \<And>a xs i j. \<lbrakk>\<And>i j. i < length xs \<Longrightarrow> first_ind xs (xs ! i) j = i + j; i < Suc (length xs); a \<notin> set xs; distinct xs; a \<noteq> (a # xs) ! i\<rbrakk> \<Longrightarrow> first_ind xs ((a # xs) ! i) (Suc j) = i + j
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma abs_convergent_prod_imp_ev_nonzero:
  fixes f :: "nat \<Rightarrow> 'a :: {comm_ring_1,real_normed_div_algebra}"
  assumes "abs_convergent_prod f"
  shows   "eventually (\<lambda>n. f n \<noteq> 0) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. f n \<noteq> (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. f n \<noteq> (0::'a)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
abs_convergent_prod f
[PROOF STEP]
have "f \<longlonglongrightarrow> 1"
[PROOF STATE]
proof (prove)
using this:
abs_convergent_prod f

goal (1 subgoal):
 1. f \<longlonglongrightarrow> (1::'a)
[PROOF STEP]
by (rule abs_convergent_prod_imp_LIMSEQ)
[PROOF STATE]
proof (state)
this:
f \<longlonglongrightarrow> (1::'a)

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. f n \<noteq> (0::'a)
[PROOF STEP]
hence "eventually (\<lambda>n. dist (f n) 1 < 1) at_top"
[PROOF STATE]
proof (prove)
using this:
f \<longlonglongrightarrow> (1::'a)

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. dist (f n) (1::'a) < 1
[PROOF STEP]
by (auto simp: tendsto_iff)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. dist (f n) (1::'a) < 1

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. f n \<noteq> (0::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. dist (f n) (1::'a) < 1

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. f n \<noteq> (0::'a)
[PROOF STEP]
by eventually_elim auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. f n \<noteq> (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed