[STATEMENT]
lemma take_bit_int_eq_self_iff:
  \<open>take_bit n k = k \<longleftrightarrow> 0 \<le> k \<and> k < 2 ^ n\<close> (is \<open>?P \<longleftrightarrow> ?Q\<close>)
  for k :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (take_bit n k = k) = (0 \<le> k \<and> k < 2 ^ n)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. take_bit n k = k \<Longrightarrow> 0 \<le> k \<and> k < 2 ^ n
 2. 0 \<le> k \<and> k < 2 ^ n \<Longrightarrow> take_bit n k = k
[PROOF STEP]
assume ?P
[PROOF STATE]
proof (state)
this:
take_bit n k = k

goal (2 subgoals):
 1. take_bit n k = k \<Longrightarrow> 0 \<le> k \<and> k < 2 ^ n
 2. 0 \<le> k \<and> k < 2 ^ n \<Longrightarrow> take_bit n k = k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
take_bit n k = k

goal (2 subgoals):
 1. take_bit n k = k \<Longrightarrow> 0 \<le> k \<and> k < 2 ^ n
 2. 0 \<le> k \<and> k < 2 ^ n \<Longrightarrow> take_bit n k = k
[PROOF STEP]
note take_bit_int_less_exp [of n k] take_bit_nonnegative [of n k]
[PROOF STATE]
proof (state)
this:
take_bit n k < 2 ^ n
0 \<le> take_bit n k

goal (2 subgoals):
 1. take_bit n k = k \<Longrightarrow> 0 \<le> k \<and> k < 2 ^ n
 2. 0 \<le> k \<and> k < 2 ^ n \<Longrightarrow> take_bit n k = k
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
take_bit n k = k
take_bit n k < 2 ^ n
0 \<le> take_bit n k
[PROOF STEP]
show ?Q
[PROOF STATE]
proof (prove)
using this:
take_bit n k = k
take_bit n k < 2 ^ n
0 \<le> take_bit n k

goal (1 subgoal):
 1. 0 \<le> k \<and> k < 2 ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> k \<and> k < 2 ^ n

goal (1 subgoal):
 1. 0 \<le> k \<and> k < 2 ^ n \<Longrightarrow> take_bit n k = k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> k \<and> k < 2 ^ n \<Longrightarrow> take_bit n k = k
[PROOF STEP]
assume ?Q
[PROOF STATE]
proof (state)
this:
0 \<le> k \<and> k < 2 ^ n

goal (1 subgoal):
 1. 0 \<le> k \<and> k < 2 ^ n \<Longrightarrow> take_bit n k = k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> k \<and> k < 2 ^ n
[PROOF STEP]
show ?P
[PROOF STATE]
proof (prove)
using this:
0 \<le> k \<and> k < 2 ^ n

goal (1 subgoal):
 1. take_bit n k = k
[PROOF STEP]
by (simp add: take_bit_eq_mod)
[PROOF STATE]
proof (state)
this:
take_bit n k = k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eval_fds_power:
  fixes s :: "'a :: {nat_power, real_normed_field, banach, second_countable_topology}"
  assumes "fds_abs_converges f s"
  shows "eval_fds (f ^ n) s = eval_fds f s ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fds (f ^ n) s = eval_fds f s ^ n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
fds_abs_converges f s

goal (1 subgoal):
 1. eval_fds (f ^ n) s = eval_fds f s ^ n
[PROOF STEP]
by (induction n) (simp_all add: eval_fds_mult fds_abs_converges_power)


[STATEMENT]
lemma log_less_cancel_iff [simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 0 < y \<Longrightarrow> log a x < log a y \<longleftrightarrow> x < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 < a; 0 < x; 0 < y\<rbrakk> \<Longrightarrow> (log a x < log a y) = (x < y)
[PROOF STEP]
using powr_less_cancel_iff [of a] powr_log_cancel [of a x] powr_log_cancel [of a y]
[PROOF STATE]
proof (prove)
using this:
1 < a \<Longrightarrow> (a powr ?a < a powr ?b) = (?a < ?b)
\<lbrakk>0 < a; a \<noteq> 1; 0 < x\<rbrakk> \<Longrightarrow> a powr log a x = x
\<lbrakk>0 < a; a \<noteq> 1; 0 < y\<rbrakk> \<Longrightarrow> a powr log a y = y

goal (1 subgoal):
 1. \<lbrakk>1 < a; 0 < x; 0 < y\<rbrakk> \<Longrightarrow> (log a x < log a y) = (x < y)
[PROOF STEP]
by (metis less_eq_real_def less_trans not_le zero_less_one)


[STATEMENT]
lemma mat_mod_index [simp]:  "i < dim_row M \<Longrightarrow> j < dim_col M \<Longrightarrow> (mat_mod M) $$ (i, j) = (M $$ (i, j)) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < dim_row M; j < dim_col M\<rbrakk> \<Longrightarrow> local.mat_mod M $$ (i, j) = M $$ (i, j) mod m
[PROOF STEP]
by(simp add: mat_mod_def)


[STATEMENT]
lemma extreme_points_of_translation_subtract:
   "{x. x extreme_point_of (image (\<lambda>x. x - a) S)} =
    (\<lambda>x. x - a) ` {x. x extreme_point_of S}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. x extreme_point_of (\<lambda>x. x - a) ` S} = (\<lambda>x. x - a) ` {x. x extreme_point_of S}
[PROOF STEP]
using extreme_points_of_translation [of "- a" S]
[PROOF STATE]
proof (prove)
using this:
{x. x extreme_point_of (+) (- a) ` S} = (+) (- a) ` {x. x extreme_point_of S}

goal (1 subgoal):
 1. {x. x extreme_point_of (\<lambda>x. x - a) ` S} = (\<lambda>x. x - a) ` {x. x extreme_point_of S}
[PROOF STEP]
by simp


[STATEMENT]
lemma cmod_diff_ge:
  shows "cmod (b - c) \<ge> sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
have "(cmod (b - c))\<^sup>2 + (1/2*Im(b*cnj c - c*cnj b))\<^sup>2 \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (cmod (b - c))\<^sup>2 + (1 / 2 * Im (b * cnj c - c * cnj b))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> (cmod (b - c))\<^sup>2 + (1 / 2 * Im (b * cnj c - c * cnj b))\<^sup>2

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
hence "(cmod (b - c))\<^sup>2 \<ge> - (1/2*Im(b*cnj c - c*cnj b))\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
0 \<le> (cmod (b - c))\<^sup>2 + (1 / 2 * Im (b * cnj c - c * cnj b))\<^sup>2

goal (1 subgoal):
 1. - (1 / 2 * Im (b * cnj c - c * cnj b))\<^sup>2 \<le> (cmod (b - c))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- (1 / 2 * Im (b * cnj c - c * cnj b))\<^sup>2 \<le> (cmod (b - c))\<^sup>2

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
hence "(cmod (b - c))\<^sup>2 \<ge> (1/2*Re(b*cnj c + c*cnj b))\<^sup>2 - Re(b*cnj b*c*cnj c) "
[PROOF STATE]
proof (prove)
using this:
- (1 / 2 * Im (b * cnj c - c * cnj b))\<^sup>2 \<le> (cmod (b - c))\<^sup>2

goal (1 subgoal):
 1. (1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2 - Re (b * cnj b * c * cnj c) \<le> (cmod (b - c))\<^sup>2
[PROOF STEP]
by (auto simp add: power2_eq_square field_simps)
[PROOF STATE]
proof (state)
this:
(1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2 - Re (b * cnj b * c * cnj c) \<le> (cmod (b - c))\<^sup>2

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
hence "Re ((b - c)*(cnj b - cnj c)) \<ge> (1/2*Re(b*cnj c + c*cnj b))\<^sup>2 - Re(b*cnj b*c*cnj c)"
[PROOF STATE]
proof (prove)
using this:
(1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2 - Re (b * cnj b * c * cnj c) \<le> (cmod (b - c))\<^sup>2

goal (1 subgoal):
 1. (1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2 - Re (b * cnj b * c * cnj c) \<le> Re ((b - c) * (cnj b - cnj c))
[PROOF STEP]
by (subst (asm) cmod_square) simp
[PROOF STATE]
proof (state)
this:
(1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2 - Re (b * cnj b * c * cnj c) \<le> Re ((b - c) * (cnj b - cnj c))

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2 - Re (b * cnj b * c * cnj c) \<le> Re ((b - c) * (cnj b - cnj c))

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
have "(1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2) = 1 + Re(b*cnj b) + Re(c*cnj c) + Re(b*cnj b*c*cnj c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2) = 1 + Re (b * cnj b) + Re (c * cnj c) + Re (b * cnj b * c * cnj c)
[PROOF STEP]
by (subst cmod_square)+ (simp add: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
(1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2) = 1 + Re (b * cnj b) + Re (c * cnj c) + Re (b * cnj b * c * cnj c)

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2) = 1 + Re (b * cnj b) + Re (c * cnj c) + Re (b * cnj b * c * cnj c)

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
have "(1 + Re (scalprod b c))\<^sup>2 = 1 + 2*Re(scalprod b c) + ((Re (scalprod b c))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + Re (scalprod b c))\<^sup>2 = 1 + 2 * Re (scalprod b c) + (Re (scalprod b c))\<^sup>2
[PROOF STEP]
by (subst power2_sum) simp
[PROOF STATE]
proof (state)
this:
(1 + Re (scalprod b c))\<^sup>2 = 1 + 2 * Re (scalprod b c) + (Re (scalprod b c))\<^sup>2

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
hence "(1 + Re (scalprod b c))\<^sup>2 = 1 + Re(b*cnj c + c*cnj b) + (1/2 * Re (b*cnj c + c*cnj b))\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
(1 + Re (scalprod b c))\<^sup>2 = 1 + 2 * Re (scalprod b c) + (Re (scalprod b c))\<^sup>2

goal (1 subgoal):
 1. (1 + Re (scalprod b c))\<^sup>2 = 1 + Re (b * cnj c + c * cnj b) + (1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1 + Re (scalprod b c))\<^sup>2 = 1 + Re (b * cnj c + c * cnj b) + (1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2 - Re (b * cnj b * c * cnj c) \<le> Re ((b - c) * (cnj b - cnj c))
(1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2) = 1 + Re (b * cnj b) + Re (c * cnj c) + Re (b * cnj b * c * cnj c)
(1 + Re (scalprod b c))\<^sup>2 = 1 + Re (b * cnj c + c * cnj b) + (1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2
[PROOF STEP]
have "(1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2) \<ge> (1 + Re (scalprod b c))\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
(1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2 - Re (b * cnj b * c * cnj c) \<le> Re ((b - c) * (cnj b - cnj c))
(1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2) = 1 + Re (b * cnj b) + Re (c * cnj c) + Re (b * cnj b * c * cnj c)
(1 + Re (scalprod b c))\<^sup>2 = 1 + Re (b * cnj c + c * cnj b) + (1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2

goal (1 subgoal):
 1. (1 + Re (scalprod b c))\<^sup>2 \<le> (1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(1 + Re (scalprod b c))\<^sup>2 \<le> (1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(1 + Re (scalprod b c))\<^sup>2 \<le> (1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
have "sqrt((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))
[PROOF STEP]
by (metis one_power2 real_sqrt_sum_squares_mult_ge_zero)
[PROOF STATE]
proof (state)
this:
0 \<le> sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(1 + Re (scalprod b c))\<^sup>2 \<le> (1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)
0 \<le> sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))
[PROOF STEP]
have "sqrt((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)) \<ge> 1 + Re (scalprod b c)"
[PROOF STATE]
proof (prove)
using this:
(1 + Re (scalprod b c))\<^sup>2 \<le> (1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)
0 \<le> sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))

goal (1 subgoal):
 1. 1 + Re (scalprod b c) \<le> sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))
[PROOF STEP]
by (metis power2_le_imp_le real_sqrt_ge_0_iff real_sqrt_pow2_iff)
[PROOF STATE]
proof (state)
this:
1 + Re (scalprod b c) \<le> sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
hence "Re ((b - c) * (cnj b - cnj c)) \<ge> 1 + Re (c*cnj c) + 1 + Re (b*cnj b) - 2*sqrt((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))"
[PROOF STATE]
proof (prove)
using this:
1 + Re (scalprod b c) \<le> sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))

goal (1 subgoal):
 1. 1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)) \<le> Re ((b - c) * (cnj b - cnj c))
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)) \<le> Re ((b - c) * (cnj b - cnj c))

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
hence *: "(cmod (b - c))\<^sup>2 \<ge> (sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2))\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)) \<le> Re ((b - c) * (cnj b - cnj c))

goal (1 subgoal):
 1. (sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2))\<^sup>2 \<le> (cmod (b - c))\<^sup>2
[PROOF STEP]
apply (subst cmod_square)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)) \<le> Re ((b - c) * (cnj b - cnj c)); 1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)) \<le> Re ((b - c) * (cnj b - cnj c)); 1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)) \<le> Re ((b - c) * (cnj b - cnj c))\<rbrakk> \<Longrightarrow> (sqrt (1 + Re (b * cnj b)) - sqrt (1 + Re (c * cnj c)))\<^sup>2 \<le> Re ((b - c) * cnj (b - c))
[PROOF STEP]
apply (subst (asm) cmod_square)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))) \<le> Re ((b - c) * (cnj b - cnj c)); 1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))) \<le> Re ((b - c) * (cnj b - cnj c)); 1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))) \<le> Re ((b - c) * (cnj b - cnj c))\<rbrakk> \<Longrightarrow> (sqrt (1 + Re (b * cnj b)) - sqrt (1 + Re (c * cnj c)))\<^sup>2 \<le> Re ((b - c) * cnj (b - c))
[PROOF STEP]
apply (subst power2_diff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))) \<le> Re ((b - c) * (cnj b - cnj c)); 1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))) \<le> Re ((b - c) * (cnj b - cnj c)); 1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))) \<le> Re ((b - c) * (cnj b - cnj c))\<rbrakk> \<Longrightarrow> (sqrt (1 + Re (b * cnj b)))\<^sup>2 + (sqrt (1 + Re (c * cnj c)))\<^sup>2 - 2 * sqrt (1 + Re (b * cnj b)) * sqrt (1 + Re (c * cnj c)) \<le> Re ((b - c) * cnj (b - c))
[PROOF STEP]
apply (subst real_sqrt_pow2, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))) \<le> Re ((b - c) * (cnj b - cnj c)); 1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))) \<le> Re ((b - c) * (cnj b - cnj c)); 1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))) \<le> Re ((b - c) * (cnj b - cnj c))\<rbrakk> \<Longrightarrow> 1 + Re (b * cnj b) + (sqrt (1 + Re (c * cnj c)))\<^sup>2 - 2 * sqrt (1 + Re (b * cnj b)) * sqrt (1 + Re (c * cnj c)) \<le> Re ((b - c) * cnj (b - c))
[PROOF STEP]
apply (subst real_sqrt_pow2, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))) \<le> Re ((b - c) * (cnj b - cnj c)); 1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))) \<le> Re ((b - c) * (cnj b - cnj c)); 1 + Re (c * cnj c) + 1 + Re (b * cnj b) - 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))) \<le> Re ((b - c) * (cnj b - cnj c))\<rbrakk> \<Longrightarrow> 1 + Re (b * cnj b) + (1 + Re (c * cnj c)) - 2 * sqrt (1 + Re (b * cnj b)) * sqrt (1 + Re (c * cnj c)) \<le> Re ((b - c) * cnj (b - c))
[PROOF STEP]
apply (simp add: real_sqrt_mult)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2))\<^sup>2 \<le> (cmod (b - c))\<^sup>2

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2))\<^sup>2 \<le> (cmod (b - c))\<^sup>2

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
proof (cases "sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) > 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>(sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2))\<^sup>2 \<le> (cmod (b - c))\<^sup>2; 0 < sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)\<rbrakk> \<Longrightarrow> sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
 2. \<lbrakk>(sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2))\<^sup>2 \<le> (cmod (b - c))\<^sup>2; \<not> 0 < sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)\<rbrakk> \<Longrightarrow> sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
0 < sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)

goal (2 subgoals):
 1. \<lbrakk>(sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2))\<^sup>2 \<le> (cmod (b - c))\<^sup>2; 0 < sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)\<rbrakk> \<Longrightarrow> sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
 2. \<lbrakk>(sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2))\<^sup>2 \<le> (cmod (b - c))\<^sup>2; \<not> 0 < sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)\<rbrakk> \<Longrightarrow> sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
using power2_le_imp_le[OF *]
[PROOF STATE]
proof (prove)
using this:
0 < sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)
0 \<le> cmod (b - c) \<Longrightarrow> sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)

goal (1 subgoal):
 1. \<lbrakk>(sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2))\<^sup>2 \<le> (cmod (b - c))\<^sup>2; \<not> 0 < sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)\<rbrakk> \<Longrightarrow> sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>(sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2))\<^sup>2 \<le> (cmod (b - c))\<^sup>2; \<not> 0 < sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)\<rbrakk> \<Longrightarrow> sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 0 < sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)

goal (1 subgoal):
 1. \<lbrakk>(sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2))\<^sup>2 \<le> (cmod (b - c))\<^sup>2; \<not> 0 < sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)\<rbrakk> \<Longrightarrow> sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
hence "0 \<ge> sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
\<not> 0 < sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> 0
[PROOF STEP]
by (metis less_eq_real_def linorder_neqE_linordered_idom)
[PROOF STATE]
proof (state)
this:
sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> 0

goal (1 subgoal):
 1. \<lbrakk>(sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2))\<^sup>2 \<le> (cmod (b - c))\<^sup>2; \<not> 0 < sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)\<rbrakk> \<Longrightarrow> sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> 0

goal (1 subgoal):
 1. \<lbrakk>(sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2))\<^sup>2 \<le> (cmod (b - c))\<^sup>2; \<not> 0 < sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)\<rbrakk> \<Longrightarrow> sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
have "cmod (b - c) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> cmod (b - c)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> cmod (b - c)

goal (1 subgoal):
 1. \<lbrakk>(sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2))\<^sup>2 \<le> (cmod (b - c))\<^sup>2; \<not> 0 < sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2)\<rbrakk> \<Longrightarrow> sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> 0
0 \<le> cmod (b - c)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> 0
0 \<le> cmod (b - c)

goal (1 subgoal):
 1. sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)
[PROOF STEP]
by (metis add_increasing monoid_add_class.add.right_neutral)
[PROOF STATE]
proof (state)
this:
sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sqrt (1 + (cmod b)\<^sup>2) - sqrt (1 + (cmod c)\<^sup>2) \<le> cmod (b - c)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_sqrt_sum_squares_eq_cancel: "sqrt (x\<^sup>2 + y\<^sup>2) = x \<Longrightarrow> y = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (x\<^sup>2 + y\<^sup>2) = x \<Longrightarrow> y = 0
[PROOF STEP]
by (drule arg_cong [where f = "\<lambda>x. x\<^sup>2"]) simp


[STATEMENT]
lemma locally_connected_open_component:
  "locally connected S \<longleftrightarrow>
   (\<forall>t c. openin (top_of_set S) t \<and> c \<in> components t
          \<longrightarrow> openin (top_of_set S) c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally connected S = (\<forall>t c. openin (top_of_set S) t \<and> c \<in> components t \<longrightarrow> openin (top_of_set S) c)
[PROOF STEP]
by (metis components_iff locally_connected_open_connected_component)


[STATEMENT]
lemma norm_le_in_cubeI: "norm x \<le> norm y"
  if "\<And>i. i \<in> Basis \<Longrightarrow> abs (x \<bullet> i) \<le> abs (y \<bullet> i)" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm x \<le> norm y
[PROOF STEP]
unfolding norm_eq_sqrt_inner
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (x \<bullet> x) \<le> sqrt (y \<bullet> y)
[PROOF STEP]
apply (subst euclidean_inner)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (\<Sum>b\<in>Basis. x \<bullet> b * (x \<bullet> b)) \<le> sqrt (y \<bullet> y)
[PROOF STEP]
apply (subst (3) euclidean_inner)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (\<Sum>b\<in>Basis. x \<bullet> b * (x \<bullet> b)) \<le> sqrt (\<Sum>b\<in>Basis. y \<bullet> b * (y \<bullet> b))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
?i \<in> Basis \<Longrightarrow> \<bar>x \<bullet> ?i\<bar> \<le> \<bar>y \<bullet> ?i\<bar>

goal (1 subgoal):
 1. sqrt (\<Sum>b\<in>Basis. x \<bullet> b * (x \<bullet> b)) \<le> sqrt (\<Sum>b\<in>Basis. y \<bullet> b * (y \<bullet> b))
[PROOF STEP]
by (auto intro!: sum_mono simp: abs_le_square_iff power2_eq_square[symmetric])


[STATEMENT]
theorem maxt_sound:assumes "invar_vebt t n" and  "max_in_set (set_vebt' t) x" shows "vebt_maxt t = Some x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vebt_maxt t = Some x
[PROOF STEP]
by (metis (no_types, opaque_lifting) assms(1) assms(2) empty_Collect_eq le_less max_in_set_def
 maxt_corr_help maxt_corr_help_empty maxt_member mem_Collect_eq not_le option.exhaust set_vebt'_def)


[STATEMENT]
lemma card_farey_fractions: "card (farey_fractions N) = sum totient {0<..N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (farey_fractions N) = sum totient {0<..N}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (farey_fractions N) = sum totient {0<..N}
[PROOF STEP]
have "card (farey_fractions N) = card {(a,b)|a b. 0 < a \<and> a \<le> b \<and> b \<le> N \<and> coprime a b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (farey_fractions N) = card {(a, b) |a b. 0 < a \<and> a \<le> b \<and> b \<le> N \<and> coprime a b}
[PROOF STEP]
using farey_fractions_bij
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>(a, b). Rat.Fract (int a) (int b)) {(a, b) |a b. 0 < a \<and> a \<le> b \<and> b \<le> ?N \<and> coprime a b} (farey_fractions ?N)

goal (1 subgoal):
 1. card (farey_fractions N) = card {(a, b) |a b. 0 < a \<and> a \<le> b \<and> b \<le> N \<and> coprime a b}
[PROOF STEP]
by (rule bij_betw_same_card [symmetric])
[PROOF STATE]
proof (state)
this:
card (farey_fractions N) = card {(a, b) |a b. 0 < a \<and> a \<le> b \<and> b \<le> N \<and> coprime a b}

goal (1 subgoal):
 1. card (farey_fractions N) = sum totient {0<..N}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (farey_fractions N) = card {(a, b) |a b. 0 < a \<and> a \<le> b \<and> b \<le> N \<and> coprime a b}

goal (1 subgoal):
 1. card (farey_fractions N) = sum totient {0<..N}
[PROOF STEP]
have "{(a,b)|a b. 0 < a \<and> a \<le> b \<and> b \<le> N \<and> coprime a b} =
               (\<Union>b\<in>{0<..N}. (\<lambda>a. (a, b)) ` totatives b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(a, b) |a b. 0 < a \<and> a \<le> b \<and> b \<le> N \<and> coprime a b} = (\<Union>b\<in>{0<..N}. (\<lambda>a. (a, b)) ` totatives b)
[PROOF STEP]
by (auto simp: totatives_def image_iff)
[PROOF STATE]
proof (state)
this:
{(a, b) |a b. 0 < a \<and> a \<le> b \<and> b \<le> N \<and> coprime a b} = (\<Union>b\<in>{0<..N}. (\<lambda>a. (a, b)) ` totatives b)

goal (1 subgoal):
 1. card (farey_fractions N) = sum totient {0<..N}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{(a, b) |a b. 0 < a \<and> a \<le> b \<and> b \<le> N \<and> coprime a b} = (\<Union>b\<in>{0<..N}. (\<lambda>a. (a, b)) ` totatives b)

goal (1 subgoal):
 1. card (farey_fractions N) = sum totient {0<..N}
[PROOF STEP]
have "card \<dots> = (\<Sum>b\<in>{0<..N}. card ((\<lambda>a. (a, b)) ` totatives b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (\<Union>b\<in>{0<..N}. (\<lambda>a. (a, b)) ` totatives b) = (\<Sum>b\<in>{0<..N}. card ((\<lambda>a. (a, b)) ` totatives b))
[PROOF STEP]
by (intro card_UN_disjoint) auto
[PROOF STATE]
proof (state)
this:
card (\<Union>b\<in>{0<..N}. (\<lambda>a. (a, b)) ` totatives b) = (\<Sum>b\<in>{0<..N}. card ((\<lambda>a. (a, b)) ` totatives b))

goal (1 subgoal):
 1. card (farey_fractions N) = sum totient {0<..N}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (\<Union>b\<in>{0<..N}. (\<lambda>a. (a, b)) ` totatives b) = (\<Sum>b\<in>{0<..N}. card ((\<lambda>a. (a, b)) ` totatives b))

goal (1 subgoal):
 1. card (farey_fractions N) = sum totient {0<..N}
[PROOF STEP]
have "\<dots> = (\<Sum>b\<in>{0<..N}. totient b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>b\<in>{0<..N}. card ((\<lambda>a. (a, b)) ` totatives b)) = sum totient {0<..N}
[PROOF STEP]
unfolding totient_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>b\<in>{0<..N}. card ((\<lambda>a. (a, b)) ` totatives b)) = (\<Sum>b\<in>{0<..N}. card (totatives b))
[PROOF STEP]
by (intro sum.cong refl card_image) (auto simp: inj_on_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>b\<in>{0<..N}. card ((\<lambda>a. (a, b)) ` totatives b)) = sum totient {0<..N}

goal (1 subgoal):
 1. card (farey_fractions N) = sum totient {0<..N}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (farey_fractions N) = sum totient {0<..N}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (farey_fractions N) = sum totient {0<..N}

goal (1 subgoal):
 1. card (farey_fractions N) = sum totient {0<..N}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card (farey_fractions N) = sum totient {0<..N}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iMODb_cut_greater_aux: "
  \<lbrakk> 0 < m; t < r + m * c; r \<le> t\<rbrakk> \<Longrightarrow>
  (r + m * c - (t + m - (t - r) mod m)) div m =
  c - Suc ((t - r) div m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; t < r + m * c; r \<le> t\<rbrakk> \<Longrightarrow> (r + m * c - (t + m - (t - r) mod m)) div m = c - Suc ((t - r) div m)
[PROOF STEP]
apply (subgoal_tac "r \<le> t + m - (t - r) mod m")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < m; t < r + m * c; r \<le> t; r \<le> t + m - (t - r) mod m\<rbrakk> \<Longrightarrow> (r + m * c - (t + m - (t - r) mod m)) div m = c - Suc ((t - r) div m)
 2. \<lbrakk>0 < m; t < r + m * c; r \<le> t\<rbrakk> \<Longrightarrow> r \<le> t + m - (t - r) mod m
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < m; t < r + m * c; r \<le> t\<rbrakk> \<Longrightarrow> r \<le> t + m - (t - r) mod m
 2. \<lbrakk>0 < m; t < r + m * c; r \<le> t; r \<le> t + m - (t - r) mod m\<rbrakk> \<Longrightarrow> (r + m * c - (t + m - (t - r) mod m)) div m = c - Suc ((t - r) div m)
[PROOF STEP]
apply (rule order_trans[of _ t], simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < m; t < r + m * c; r \<le> t\<rbrakk> \<Longrightarrow> t \<le> t + m - (t - r) mod m
 2. \<lbrakk>0 < m; t < r + m * c; r \<le> t; r \<le> t + m - (t - r) mod m\<rbrakk> \<Longrightarrow> (r + m * c - (t + m - (t - r) mod m)) div m = c - Suc ((t - r) div m)
[PROOF STEP]
apply (simp add: mod_cut_greater_aux_t_less less_imp_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; t < r + m * c; r \<le> t; r \<le> t + m - (t - r) mod m\<rbrakk> \<Longrightarrow> (r + m * c - (t + m - (t - r) mod m)) div m = c - Suc ((t - r) div m)
[PROOF STEP]
apply (rule_tac t="(r + m * c - (t + m - (t - r) mod m))" and s="m * (c - Suc ((t - r) div m))" in subst)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < m; t < r + m * c; r \<le> t; r \<le> t + m - (t - r) mod m\<rbrakk> \<Longrightarrow> m * (c - Suc ((t - r) div m)) = r + m * c - (t + m - (t - r) mod m)
 2. \<lbrakk>0 < m; t < r + m * c; r \<le> t; r \<le> t + m - (t - r) mod m\<rbrakk> \<Longrightarrow> m * (c - Suc ((t - r) div m)) div m = c - Suc ((t - r) div m)
[PROOF STEP]
apply (simp add: diff_mult_distrib2 minus_mod_eq_mult_div [symmetric] del: diff_diff_left)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; t < r + m * c; r \<le> t; r \<le> t + m - (t - r) mod m\<rbrakk> \<Longrightarrow> m * (c - Suc ((t - r) div m)) div m = c - Suc ((t - r) div m)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma smallomega_real_nat_transfer:
  "(f :: real \<Rightarrow> real) \<in> \<omega>(g) \<Longrightarrow> (\<lambda>x::nat. f (real x)) \<in> \<omega>(\<lambda>x. g (real x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> \<omega>(g) \<Longrightarrow> (\<lambda>x. f (real x)) \<in> \<omega>(\<lambda>x. g (real x))
[PROOF STEP]
by (rule landau_omega.small.compose[OF _ filterlim_real_sequentially])


[STATEMENT]
lemma derived_set_of_Un:
   "X derived_set_of (S \<union> T) = X derived_set_of S \<union> X derived_set_of T" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X derived_set_of (S \<union> T) = X derived_set_of S \<union> X derived_set_of T
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. X derived_set_of (S \<union> T) \<subseteq> X derived_set_of S \<union> X derived_set_of T
 2. X derived_set_of S \<union> X derived_set_of T \<subseteq> X derived_set_of (S \<union> T)
[PROOF STEP]
show "?lhs \<subseteq> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X derived_set_of (S \<union> T) \<subseteq> X derived_set_of S \<union> X derived_set_of T
[PROOF STEP]
by (clarsimp simp: in_derived_set_of) (metis IntE IntI openin_Int)
[PROOF STATE]
proof (state)
this:
X derived_set_of (S \<union> T) \<subseteq> X derived_set_of S \<union> X derived_set_of T

goal (1 subgoal):
 1. X derived_set_of S \<union> X derived_set_of T \<subseteq> X derived_set_of (S \<union> T)
[PROOF STEP]
show "?rhs \<subseteq> ?lhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X derived_set_of S \<union> X derived_set_of T \<subseteq> X derived_set_of (S \<union> T)
[PROOF STEP]
by (simp add: derived_set_of_mono)
[PROOF STATE]
proof (state)
this:
X derived_set_of S \<union> X derived_set_of T \<subseteq> X derived_set_of (S \<union> T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_reduct:
 assumes "m \<noteq> []"
 shows "length (reduct m) +1  = (length m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (reduct m) + 1 = length m
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (length (reduct m)) = length m
[PROOF STEP]
by (metis One_nat_def Suc_eq_plus1 assms list.size(4) neq_Nil_conv reduct.simps(2))


[STATEMENT]
lemma Legendre_in_cong_eq:
  fixes p :: int
  assumes "p > 2" and "b \<in> {-1,0,1}"
  shows   "[Legendre a m = b] (mod p) \<longleftrightarrow> Legendre a m = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [Legendre a m = b] (mod p) = (Legendre a m = b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 < p
b \<in> {- 1, 0, 1}

goal (1 subgoal):
 1. [Legendre a m = b] (mod p) = (Legendre a m = b)
[PROOF STEP]
unfolding Legendre_def
[PROOF STATE]
proof (prove)
using this:
2 < p
b \<in> {- 1, 0, 1}

goal (1 subgoal):
 1. [if [a = 0] (mod m) then 0 else if QuadRes m a then 1 else - 1 = b] (mod p) = ((if [a = 0] (mod m) then 0 else if QuadRes m a then 1 else - 1) = b)
[PROOF STEP]
by auto


[STATEMENT]
lemma ccINF_superset_mono:
  "countable A \<Longrightarrow> B \<subseteq> A \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> f x \<le> g x) \<Longrightarrow> (INF x\<in>A. f x) \<le> (INF x\<in>B. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>countable A; B \<subseteq> A; \<And>x. x \<in> B \<Longrightarrow> f x \<le> g x\<rbrakk> \<Longrightarrow> Inf (f ` A) \<le> Inf (g ` B)
[PROOF STEP]
by (blast intro: ccINF_mono countable_subset dest: subsetD)


[STATEMENT]
lemma poly_distrib: "poly_mult p (poly_add q1 q2) =p poly_add (poly_mult p q1) (poly_mult p q2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult p (poly_add q1 q2) =p poly_add (poly_mult p q1) (poly_mult p q2)
[PROOF STEP]
unfolding eq_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<alpha>. eval_poly \<alpha> (poly_mult p (poly_add q1 q2)) = eval_poly \<alpha> (poly_add (poly_mult p q1) (poly_mult p q2))
[PROOF STEP]
by (auto simp: field_simps)


[STATEMENT]
lemma trans_mat_rep_block_size_sym: "j < dim_col M \<Longrightarrow> mat_block_size M j = mat_rep_num M\<^sup>T j"
  "i < dim_row M \<Longrightarrow> mat_rep_num M i = mat_block_size M\<^sup>T i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (j < dim_col M \<Longrightarrow> mat_block_size M j = mat_rep_num M\<^sup>T j) &&& (i < dim_row M \<Longrightarrow> mat_rep_num M i = mat_block_size M\<^sup>T i)
[PROOF STEP]
unfolding mat_block_size_def mat_rep_num_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (j < dim_col M \<Longrightarrow> count_vec (col M j) (1::'a) = count_vec (row M\<^sup>T j) (1::'a)) &&& (i < dim_row M \<Longrightarrow> count_vec (row M i) (1::'a) = count_vec (col M\<^sup>T i) (1::'a))
[PROOF STEP]
by simp_all


[STATEMENT]
lemma  proj_action_dom_eq_inter:
  shows "
    action_dom (fst (action_proj a vs)) (snd (action_proj a vs))
    = (action_dom (fst a) (snd a) \<inter> vs)
  "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. action_dom (fst (action_proj a vs)) (snd (action_proj a vs)) = action_dom (fst a) (snd a) \<inter> vs
[PROOF STEP]
unfolding action_dom_def action_proj_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fmdom' (fst (fmrestrict_set vs (fst a), fmrestrict_set vs (snd a))) \<union> fmdom' (snd (fmrestrict_set vs (fst a), fmrestrict_set vs (snd a))) = (fmdom' (fst a) \<union> fmdom' (snd a)) \<inter> vs
[PROOF STEP]
by (auto simp: fmdom'_restrict_set_precise)


[STATEMENT]
lemma Max_divisors_self_int [simp]:
  assumes "n \<noteq> 0" shows "Max {d::int. d dvd n} = \<bar>n\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max {d. d dvd n} = \<bar>n\<bar>
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Max {d. d dvd n} \<le> \<bar>n\<bar>
 2. \<bar>n\<bar> \<le> Max {d. d dvd n}
[PROOF STEP]
show "Max {d. d dvd n} \<le> \<bar>n\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max {d. d dvd n} \<le> \<bar>n\<bar>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. Max {d. d dvd n} \<le> \<bar>n\<bar>
[PROOF STEP]
by (auto intro: abs_le_D1 dvd_imp_le_int intro!: Max_le_iff [THEN iffD2])
[PROOF STATE]
proof (state)
this:
Max {d. d dvd n} \<le> \<bar>n\<bar>

goal (1 subgoal):
 1. \<bar>n\<bar> \<le> Max {d. d dvd n}
[PROOF STEP]
qed (simp add: assms)


[STATEMENT]
lemma VUnion_vempty_conv_right: "\<Union>\<^sub>\<circ>A = 0 \<longleftrightarrow> (\<forall>x\<in>\<^sub>\<circ>A. x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>\<^sub>\<circ> A = 0) = (\<forall>x\<in>elts A. x = 0)
[PROOF STEP]
by auto


[STATEMENT]
lemma dist_circle_segment:
  assumes "0 \<le> radius" "0 \<le> \<alpha>" "\<alpha> \<le> \<beta>" "\<beta> \<le> 2 * pi"
  shows "dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)
[PROOF STEP]
have trigonometry: "(cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2 = (2 *  sin ((\<beta> - \<alpha>) / 2))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2 = (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2 = (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2
[PROOF STEP]
have sin_diff_minus: "sin ((\<alpha> - \<beta>) / 2) = - sin ((\<beta> - \<alpha>) / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin ((\<alpha> - \<beta>) / 2) = - sin ((\<beta> - \<alpha>) / 2)
[PROOF STEP]
by (simp only: sin_minus[symmetric] minus_divide_left minus_diff_eq)
[PROOF STATE]
proof (state)
this:
sin ((\<alpha> - \<beta>) / 2) = - sin ((\<beta> - \<alpha>) / 2)

goal (1 subgoal):
 1. (cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2 = (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2
[PROOF STEP]
have "(cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2 =
      (2 * sin ((\<alpha> + \<beta>) / 2) * sin ((\<beta> - \<alpha>) / 2))\<^sup>2 + (2 * sin ((\<alpha> - \<beta>) / 2) * cos ((\<alpha> + \<beta>) / 2))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2 = (2 * sin ((\<alpha> + \<beta>) / 2) * sin ((\<beta> - \<alpha>) / 2))\<^sup>2 + (2 * sin ((\<alpha> - \<beta>) / 2) * cos ((\<alpha> + \<beta>) / 2))\<^sup>2
[PROOF STEP]
by (simp only: cos_diff_cos sin_diff_sin)
[PROOF STATE]
proof (state)
this:
(cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2 = (2 * sin ((\<alpha> + \<beta>) / 2) * sin ((\<beta> - \<alpha>) / 2))\<^sup>2 + (2 * sin ((\<alpha> - \<beta>) / 2) * cos ((\<alpha> + \<beta>) / 2))\<^sup>2

goal (1 subgoal):
 1. (cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2 = (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2 = (2 * sin ((\<alpha> + \<beta>) / 2) * sin ((\<beta> - \<alpha>) / 2))\<^sup>2 + (2 * sin ((\<alpha> - \<beta>) / 2) * cos ((\<alpha> + \<beta>) / 2))\<^sup>2

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

goal (1 subgoal):
 1. (cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2 = (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(2 * sin ((\<alpha> + \<beta>) / 2) * sin ((\<beta> - \<alpha>) / 2))\<^sup>2 + (2 * sin ((\<alpha> - \<beta>) / 2) * cos ((\<alpha> + \<beta>) / 2))\<^sup>2 = (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2 * ((sin ((\<alpha> + \<beta>) / 2))\<^sup>2 + (cos ((\<alpha> + \<beta>) / 2))\<^sup>2)

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

goal (1 subgoal):
 1. (cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2 = (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2 = (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2 = (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2

goal (1 subgoal):
 1. (cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2 = (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2 = (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2 = (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2

goal (1 subgoal):
 1. dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 \<le> radius
0 \<le> \<alpha>
\<alpha> \<le> \<beta>
\<beta> \<le> 2 * pi
[PROOF STEP]
have "0 \<le> sin ((\<beta> - \<alpha>) / 2)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> radius
0 \<le> \<alpha>
\<alpha> \<le> \<beta>
\<beta> \<le> 2 * pi

goal (1 subgoal):
 1. 0 \<le> sin ((\<beta> - \<alpha>) / 2)
[PROOF STEP]
by (simp add: sin_ge_zero)
[PROOF STATE]
proof (state)
this:
0 \<le> sin ((\<beta> - \<alpha>) / 2)

goal (1 subgoal):
 1. dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)
[PROOF STEP]
have "?lhs = sqrt (radius\<^sup>2 * ((cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = sqrt (radius\<^sup>2 * ((cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2))
[PROOF STEP]
unfolding dist_eq_on_real_2_vec
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (((center + radius *\<^sub>R of_radiant \<alpha>) $ 1 - (center + radius *\<^sub>R of_radiant \<beta>) $ 1)\<^sup>2 + ((center + radius *\<^sub>R of_radiant \<alpha>) $ 2 - (center + radius *\<^sub>R of_radiant \<beta>) $ 2)\<^sup>2) = sqrt (radius\<^sup>2 * ((cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2))
[PROOF STEP]
by simp algebra
[PROOF STATE]
proof (state)
this:
dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = sqrt (radius\<^sup>2 * ((cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2))

goal (1 subgoal):
 1. dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = sqrt (radius\<^sup>2 * ((cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2))

goal (1 subgoal):
 1. dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)
[PROOF STEP]
have "\<dots> = sqrt (radius\<^sup>2 *  (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (radius\<^sup>2 * ((cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2)) = sqrt (radius\<^sup>2 * (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2)
[PROOF STEP]
by (simp add: trigonometry)
[PROOF STATE]
proof (state)
this:
sqrt (radius\<^sup>2 * ((cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2)) = sqrt (radius\<^sup>2 * (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2)

goal (1 subgoal):
 1. dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt (radius\<^sup>2 * ((cos \<alpha> - cos \<beta>)\<^sup>2 + (sin \<alpha> - sin \<beta>)\<^sup>2)) = sqrt (radius\<^sup>2 * (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2)

goal (1 subgoal):
 1. dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (radius\<^sup>2 * (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)
[PROOF STEP]
using \<open>0 \<le> radius\<close> \<open>0 \<le> sin ((\<beta> - \<alpha>) / 2)\<close>
[PROOF STATE]
proof (prove)
using this:
0 \<le> radius
0 \<le> sin ((\<beta> - \<alpha>) / 2)

goal (1 subgoal):
 1. sqrt (radius\<^sup>2 * (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)
[PROOF STEP]
by (simp add: real_sqrt_mult)
[PROOF STATE]
proof (state)
this:
sqrt (radius\<^sup>2 * (2 * sin ((\<beta> - \<alpha>) / 2))\<^sup>2) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)

goal (1 subgoal):
 1. dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)

goal (1 subgoal):
 1. dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dist (center + radius *\<^sub>R of_radiant \<alpha>) (center + radius *\<^sub>R of_radiant \<beta>) = 2 * radius * sin ((\<beta> - \<alpha>) / 2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma divisor_count_Suc_0 [simp]: "divisor_count (Suc 0) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_count (Suc 0) = 1
[PROOF STEP]
by (simp add: divisor_count_def)


[STATEMENT]
lemma integral_restrict_Int:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes "S \<in> sets lebesgue" "T \<in> sets lebesgue"
  shows "integral\<^sup>L (lebesgue_on T) (\<lambda>x. if x \<in> S then f x else 0) = integral\<^sup>L (lebesgue_on (S \<inter> T)) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|lebesgue_on T. (if x \<in> S then f x else (0::'b)) = integral\<^sup>L (lebesgue_on (S \<inter> T)) f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. LINT x|lebesgue_on T. (if x \<in> S then f x else (0::'b)) = integral\<^sup>L (lebesgue_on (S \<inter> T)) f
[PROOF STEP]
have "(\<lambda>x. indicat_real T x *\<^sub>R (if x \<in> S then f x else 0)) = (\<lambda>x. indicat_real (S \<inter> T) x *\<^sub>R f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. indicat_real T x *\<^sub>R (if x \<in> S then f x else (0::'b))) = (\<lambda>x. indicat_real (S \<inter> T) x *\<^sub>R f x)
[PROOF STEP]
by (force simp: indicator_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. indicat_real T x *\<^sub>R (if x \<in> S then f x else (0::'b))) = (\<lambda>x. indicat_real (S \<inter> T) x *\<^sub>R f x)

goal (1 subgoal):
 1. LINT x|lebesgue_on T. (if x \<in> S then f x else (0::'b)) = integral\<^sup>L (lebesgue_on (S \<inter> T)) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. indicat_real T x *\<^sub>R (if x \<in> S then f x else (0::'b))) = (\<lambda>x. indicat_real (S \<inter> T) x *\<^sub>R f x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. indicat_real T x *\<^sub>R (if x \<in> S then f x else (0::'b))) = (\<lambda>x. indicat_real (S \<inter> T) x *\<^sub>R f x)

goal (1 subgoal):
 1. LINT x|lebesgue_on T. (if x \<in> S then f x else (0::'b)) = integral\<^sup>L (lebesgue_on (S \<inter> T)) f
[PROOF STEP]
by (simp add: assms sets.Int Bochner_Integration.integral_restrict_space)
[PROOF STATE]
proof (state)
this:
LINT x|lebesgue_on T. (if x \<in> S then f x else (0::'b)) = integral\<^sup>L (lebesgue_on (S \<inter> T)) f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eq_123: "((1::int) \<le> i & i \<le> 3) = (i = 1 | i = 2 | i = 3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 \<le> i \<and> i \<le> 3) = (i = 1 \<or> i = 2 \<or> i = 3)
[PROOF STEP]
by arith


[STATEMENT]
lemma keys_rbt_baliL: "RBT_Impl.keys (rbt_baliL l a b r) = RBT_Impl.keys l @ a # RBT_Impl.keys r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. keys (rbt_baliL l a b r) = keys l @ a # keys r
[PROOF STEP]
by (cases "(l,a,b,r)" rule: rbt_baliL.cases) auto


[STATEMENT]
lemma keys_rbt_baliR: "RBT_Impl.keys (rbt_baliR l a b r) = RBT_Impl.keys l @ a # RBT_Impl.keys r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. keys (rbt_baliR l a b r) = keys l @ a # keys r
[PROOF STEP]
by (cases "(l,a,b,r)" rule: rbt_baliR.cases) auto


[STATEMENT]
lemma (in comm_group) triv_finprod_iff_compl_fam_Pi:
  assumes "finite I" "\<And>i. i \<in> I \<Longrightarrow> subgroup (S i) G"
  shows "compl_fam S I \<longleftrightarrow> (\<forall>f \<in> Pi I S. finprod G f I = \<one> \<longrightarrow> (\<forall>i\<in>I. f i = \<one>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compl_fam S I = (\<forall>f\<in>Pi I S. finprod G f I = \<one> \<longrightarrow> (\<forall>i\<in>I. f i = \<one>))
[PROOF STEP]
using compl_fam_imp_triv_finprod triv_finprod_imp_compl_fam assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>compl_fam ?S ?I; finite ?I; \<And>i. i \<in> ?I \<Longrightarrow> subgroup (?S i) G; finprod G ?f ?I = \<one>; ?f \<in> Pi ?I ?S\<rbrakk> \<Longrightarrow> \<forall>i\<in>?I. ?f i = \<one>
\<lbrakk>finite ?I; \<And>i. i \<in> ?I \<Longrightarrow> subgroup (?S i) G; \<forall>f\<in>Pi ?I ?S. finprod G f ?I = \<one> \<longrightarrow> (\<forall>i\<in>?I. f i = \<one>)\<rbrakk> \<Longrightarrow> compl_fam ?S ?I
finite I
?i2 \<in> I \<Longrightarrow> subgroup (S ?i2) G

goal (1 subgoal):
 1. compl_fam S I = (\<forall>f\<in>Pi I S. finprod G f I = \<one> \<longrightarrow> (\<forall>i\<in>I. f i = \<one>))
[PROOF STEP]
by blast


[STATEMENT]
lemma fset_finite_supp:
  fixes S::"('a::fs) fset"
  shows "finite (supp S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (supp S)
[PROOF STEP]
by (induct S) (simp_all add: finite_supp)


[STATEMENT]
lemma set_integral_cong_set:
  fixes f :: "_ \<Rightarrow> _ :: {banach, second_countable_topology}"
  assumes "set_borel_measurable M A f" "set_borel_measurable M B f"
    and ae: "AE x in M. x \<in> A \<longleftrightarrow> x \<in> B"
  shows "LINT x:B|M. f x = LINT x:A|M. f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_lebesgue_integral M B f = set_lebesgue_integral M A f
[PROOF STEP]
unfolding set_lebesgue_integral_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. indicat_real B x *\<^sub>R f x = LINT x|M. indicat_real A x *\<^sub>R f x
[PROOF STEP]
proof (rule integral_cong_AE)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (\<lambda>x. indicat_real B x *\<^sub>R f x) \<in> borel_measurable M
 2. (\<lambda>x. indicat_real A x *\<^sub>R f x) \<in> borel_measurable M
 3. AE x in M. indicat_real B x *\<^sub>R f x = indicat_real A x *\<^sub>R f x
[PROOF STEP]
show "AE x in M. indicator B x *\<^sub>R f x = indicator A x *\<^sub>R f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. indicat_real B x *\<^sub>R f x = indicat_real A x *\<^sub>R f x
[PROOF STEP]
using ae
[PROOF STATE]
proof (prove)
using this:
AE x in M. (x \<in> A) = (x \<in> B)

goal (1 subgoal):
 1. AE x in M. indicat_real B x *\<^sub>R f x = indicat_real A x *\<^sub>R f x
[PROOF STEP]
by (auto simp: subset_eq split: split_indicator)
[PROOF STATE]
proof (state)
this:
AE x in M. indicat_real B x *\<^sub>R f x = indicat_real A x *\<^sub>R f x

goal (2 subgoals):
 1. (\<lambda>x. indicat_real B x *\<^sub>R f x) \<in> borel_measurable M
 2. (\<lambda>x. indicat_real A x *\<^sub>R f x) \<in> borel_measurable M
[PROOF STEP]
qed (use assms in \<open>auto simp: set_borel_measurable_def\<close>)


[STATEMENT]
lemma scalar_mult_mat:
  fixes x :: "'a::comm_semiring_0"
  shows "x *k mat y = mat (x * y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x *k mat y = mat (x * y)
[PROOF STEP]
by (simp add: matrix_scalar_mult_def mat_def vec_eq_iff)


[STATEMENT]
lemma ofsm_table_partition_fixpoint :
  assumes "equivalence_relation_on_states M f"
  and     "size M \<le> m"
  and     "q \<in> states M"
shows "ofsm_table M f (m - card (f ` states M)) q = ofsm_table M f (Suc (m - card (f ` states M))) q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ofsm_table M f (m - card (f ` FSM.states M)) q = ofsm_table M f (Suc (m - card (f ` FSM.states M))) q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ofsm_table M f (m - card (f ` FSM.states M)) q = ofsm_table M f (Suc (m - card (f ` FSM.states M))) q
[PROOF STEP]
have *: "size M - card (f ` states M) \<le> m - card (f ` states M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FSM.size M - card (f ` FSM.states M) \<le> m - card (f ` FSM.states M)
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
FSM.size M \<le> m

goal (1 subgoal):
 1. FSM.size M - card (f ` FSM.states M) \<le> m - card (f ` FSM.states M)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
FSM.size M - card (f ` FSM.states M) \<le> m - card (f ` FSM.states M)

goal (1 subgoal):
 1. ofsm_table M f (m - card (f ` FSM.states M)) q = ofsm_table M f (Suc (m - card (f ` FSM.states M))) q
[PROOF STEP]
have **: "(size M - card (f ` states M)) \<le> Suc (m - card (f ` states M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FSM.size M - card (f ` FSM.states M) \<le> Suc (m - card (f ` FSM.states M))
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
FSM.size M \<le> m

goal (1 subgoal):
 1. FSM.size M - card (f ` FSM.states M) \<le> Suc (m - card (f ` FSM.states M))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
FSM.size M - card (f ` FSM.states M) \<le> Suc (m - card (f ` FSM.states M))

goal (1 subgoal):
 1. ofsm_table M f (m - card (f ` FSM.states M)) q = ofsm_table M f (Suc (m - card (f ` FSM.states M))) q
[PROOF STEP]
have ***: "\<And> q . q \<in> FSM.states M \<Longrightarrow> ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q = ofsm_table M f (Suc (FSM.size M - card (f ` FSM.states M))) q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>q. q \<in> FSM.states M \<Longrightarrow> ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q = ofsm_table M f (Suc (FSM.size M - card (f ` FSM.states M))) q
[PROOF STEP]
using ofsm_table_partition_fixpoint_Suc[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
?q \<in> FSM.states M \<Longrightarrow> ofsm_table M f (FSM.size M - card (f ` FSM.states M)) ?q = ofsm_table M f (Suc (FSM.size M - card (f ` FSM.states M))) ?q

goal (1 subgoal):
 1. \<And>q. q \<in> FSM.states M \<Longrightarrow> ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q = ofsm_table M f (Suc (FSM.size M - card (f ` FSM.states M))) q
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
?q \<in> FSM.states M \<Longrightarrow> ofsm_table M f (FSM.size M - card (f ` FSM.states M)) ?q = ofsm_table M f (Suc (FSM.size M - card (f ` FSM.states M))) ?q

goal (1 subgoal):
 1. ofsm_table M f (m - card (f ` FSM.states M)) q = ofsm_table M f (Suc (m - card (f ` FSM.states M))) q
[PROOF STEP]
have "ofsm_table M f (m - card (f ` states M)) q = ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ofsm_table M f (m - card (f ` FSM.states M)) q = ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q
[PROOF STEP]
using ofsm_table_fixpoint[OF * _ assms(3)] ***
[PROOF STATE]
proof (prove)
using this:
(\<And>q. q \<in> FSM.states M \<Longrightarrow> ofsm_table M ?f (Suc (FSM.size M - card (f ` FSM.states M))) q = ofsm_table M ?f (FSM.size M - card (f ` FSM.states M)) q) \<Longrightarrow> ofsm_table M ?f (m - card (f ` FSM.states M)) q = ofsm_table M ?f (FSM.size M - card (f ` FSM.states M)) q
?q \<in> FSM.states M \<Longrightarrow> ofsm_table M f (FSM.size M - card (f ` FSM.states M)) ?q = ofsm_table M f (Suc (FSM.size M - card (f ` FSM.states M))) ?q

goal (1 subgoal):
 1. ofsm_table M f (m - card (f ` FSM.states M)) q = ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
ofsm_table M f (m - card (f ` FSM.states M)) q = ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q

goal (1 subgoal):
 1. ofsm_table M f (m - card (f ` FSM.states M)) q = ofsm_table M f (Suc (m - card (f ` FSM.states M))) q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ofsm_table M f (m - card (f ` FSM.states M)) q = ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q

goal (1 subgoal):
 1. ofsm_table M f (m - card (f ` FSM.states M)) q = ofsm_table M f (Suc (m - card (f ` FSM.states M))) q
[PROOF STEP]
have "ofsm_table M f (Suc (m - card (f ` states M))) q = ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ofsm_table M f (Suc (m - card (f ` FSM.states M))) q = ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q
[PROOF STEP]
using ofsm_table_fixpoint[OF ** _ assms(3), of f] ***
[PROOF STATE]
proof (prove)
using this:
(\<And>q. q \<in> FSM.states M \<Longrightarrow> ofsm_table M f (Suc (FSM.size M - card (f ` FSM.states M))) q = ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q) \<Longrightarrow> ofsm_table M f (Suc (m - card (f ` FSM.states M))) q = ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q
?q \<in> FSM.states M \<Longrightarrow> ofsm_table M f (FSM.size M - card (f ` FSM.states M)) ?q = ofsm_table M f (Suc (FSM.size M - card (f ` FSM.states M))) ?q

goal (1 subgoal):
 1. ofsm_table M f (Suc (m - card (f ` FSM.states M))) q = ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
ofsm_table M f (Suc (m - card (f ` FSM.states M))) q = ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q

goal (1 subgoal):
 1. ofsm_table M f (m - card (f ` FSM.states M)) q = ofsm_table M f (Suc (m - card (f ` FSM.states M))) q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ofsm_table M f (m - card (f ` FSM.states M)) q = ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q
ofsm_table M f (Suc (m - card (f ` FSM.states M))) q = ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ofsm_table M f (m - card (f ` FSM.states M)) q = ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q
ofsm_table M f (Suc (m - card (f ` FSM.states M))) q = ofsm_table M f (FSM.size M - card (f ` FSM.states M)) q

goal (1 subgoal):
 1. ofsm_table M f (m - card (f ` FSM.states M)) q = ofsm_table M f (Suc (m - card (f ` FSM.states M))) q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ofsm_table M f (m - card (f ` FSM.states M)) q = ofsm_table M f (Suc (m - card (f ` FSM.states M))) q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eexp_mono2 [mono_intros]:
  assumes "x \<le> y"
  shows "eexp x \<le> eexp y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eexp x \<le> eexp y
[PROOF STEP]
using eexp_mono assms
[PROOF STATE]
proof (prove)
using this:
mono eexp
x \<le> y

goal (1 subgoal):
 1. eexp x \<le> eexp y
[PROOF STEP]
unfolding mono_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. x \<le> y \<longrightarrow> eexp x \<le> eexp y
x \<le> y

goal (1 subgoal):
 1. eexp x \<le> eexp y
[PROOF STEP]
by auto


[STATEMENT]
lemma floor_le_one [simp]: "\<lfloor>x\<rfloor> \<le> 1 \<longleftrightarrow> x < 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lfloor>x\<rfloor> \<le> 1) = (x < (2::'a))
[PROOF STEP]
by (simp add: floor_le_iff)


[STATEMENT]
lemma hcard_hinsert_if: "hcard (hinsert x y) = (if x \<^bold>\<in> y then hcard y else Suc (hcard y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hcard (y \<triangleleft> x) = (if x \<^bold>\<in> y then hcard y else Suc (hcard y))
[PROOF STEP]
by (simp add: hcard_def hfset_hinsert card_insert_if hmem_def)


[STATEMENT]
lemma Ri_Inf: " Ri (\<Sqinter> X) y z \<le> \<Sqinter>{Ri x y z |x. x \<in> X}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ri (\<Sqinter> X) y z \<le> \<Sqinter> {Ri x y z |x. x \<in> X}
[PROOF STEP]
by (safe intro!: Inf_greatest, simp add: Ri_weaken Inf_lower)


[STATEMENT]
lemma cmod_Im_le_iff: "Re x = Re y \<Longrightarrow> cmod x \<le> cmod y \<longleftrightarrow> \<bar>Im x\<bar> \<le> \<bar>Im y\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re x = Re y \<Longrightarrow> (cmod x \<le> cmod y) = (\<bar>Im x\<bar> \<le> \<bar>Im y\<bar>)
[PROOF STEP]
by (metis add_le_cancel_left norm_complex_def real_sqrt_abs real_sqrt_le_iff)


[STATEMENT]
lemma filter_inter_mset [simp]: "filter_mset P (M \<inter># N) = filter_mset P M \<inter># filter_mset P N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter_mset P (M \<inter># N) = filter_mset P M \<inter># filter_mset P N
[PROOF STEP]
by (rule multiset_eqI) simp


[STATEMENT]
lemma path_image_rectpath_inter_box:
  assumes "Re a \<le> Re b" "Im a \<le> Im b"
  shows   "path_image (rectpath a b) \<inter> box a b = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (rectpath a b) \<inter> box a b = {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Re a \<le> Re b
Im a \<le> Im b

goal (1 subgoal):
 1. path_image (rectpath a b) \<inter> box a b = {}
[PROOF STEP]
by (auto simp: path_image_rectpath in_box_complex_iff)


[STATEMENT]
theorem uniform_limit_theorem:
  assumes c: "\<forall>\<^sub>F n in F. continuous_on A (f n)"
  assumes ul: "uniform_limit A f l F"
  assumes "\<not> trivial_limit F"
  shows "continuous_on A l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on A l
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>A. (l \<longlongrightarrow> l x) (at x within A)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> (l \<longlongrightarrow> l x) (at x within A)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> (l \<longlongrightarrow> l x) (at x within A)
[PROOF STEP]
assume "x \<in> A"
[PROOF STATE]
proof (state)
this:
x \<in> A

goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> (l \<longlongrightarrow> l x) (at x within A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> A
[PROOF STEP]
have "\<forall>\<^sub>F n in F. (f n \<longlongrightarrow> f n x) (at x within A)" "((\<lambda>n. f n x) \<longlongrightarrow> l x) F"
[PROOF STATE]
proof (prove)
using this:
x \<in> A

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. (f n \<longlongrightarrow> f n x) (at x within A) &&& ((\<lambda>n. f n x) \<longlongrightarrow> l x) F
[PROOF STEP]
using c ul
[PROOF STATE]
proof (prove)
using this:
x \<in> A
\<forall>\<^sub>F n in F. continuous_on A (f n)
uniform_limit A f l F

goal (1 subgoal):
 1. \<forall>\<^sub>F n in F. (f n \<longlongrightarrow> f n x) (at x within A) &&& ((\<lambda>n. f n x) \<longlongrightarrow> l x) F
[PROOF STEP]
by (auto simp: continuous_on_def eventually_mono tendsto_uniform_limitI)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in F. (f n \<longlongrightarrow> f n x) (at x within A)
((\<lambda>n. f n x) \<longlongrightarrow> l x) F

goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> (l \<longlongrightarrow> l x) (at x within A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in F. (f n \<longlongrightarrow> f n x) (at x within A)
((\<lambda>n. f n x) \<longlongrightarrow> l x) F
[PROOF STEP]
show "(l \<longlongrightarrow> l x) (at x within A)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in F. (f n \<longlongrightarrow> f n x) (at x within A)
((\<lambda>n. f n x) \<longlongrightarrow> l x) F

goal (1 subgoal):
 1. (l \<longlongrightarrow> l x) (at x within A)
[PROOF STEP]
by (rule swap_uniform_limit) fact+
[PROOF STATE]
proof (state)
this:
(l \<longlongrightarrow> l x) (at x within A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) rcosets_closed:
  assumes HG:"subgroup H G"
  assumes g:"g \<in> carrier G"
  assumes M:"M \<in> rcosets H"
  shows "M #> g \<in> rcosets H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M #> g \<in> rcosets H
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. M #> g \<in> rcosets H
[PROOF STEP]
from M
[PROOF STATE]
proof (chain)
picking this:
M \<in> rcosets H
[PROOF STEP]
obtain h where h:"h \<in> carrier G" "M = H #> h"
[PROOF STATE]
proof (prove)
using this:
M \<in> rcosets H

goal (1 subgoal):
 1. (\<And>h. \<lbrakk>h \<in> carrier G; M = H #> h\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding RCOSETS_def
[PROOF STATE]
proof (prove)
using this:
M \<in> (\<Union>a\<in>carrier G. {H #> a})

goal (1 subgoal):
 1. (\<And>h. \<lbrakk>h \<in> carrier G; M = H #> h\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
h \<in> carrier G
M = H #> h

goal (1 subgoal):
 1. M #> g \<in> rcosets H
[PROOF STEP]
with g HG
[PROOF STATE]
proof (chain)
picking this:
g \<in> carrier G
subgroup H G
h \<in> carrier G
M = H #> h
[PROOF STEP]
have "M #> g = H #> (h \<otimes> g)"
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier G
subgroup H G
h \<in> carrier G
M = H #> h

goal (1 subgoal):
 1. M #> g = H #> h \<otimes> g
[PROOF STEP]
by (metis coset_mult_assoc subgroup.subset)
[PROOF STATE]
proof (state)
this:
M #> g = H #> h \<otimes> g

goal (1 subgoal):
 1. M #> g \<in> rcosets H
[PROOF STEP]
with HG g h
[PROOF STATE]
proof (chain)
picking this:
subgroup H G
g \<in> carrier G
h \<in> carrier G
M = H #> h
M #> g = H #> h \<otimes> g
[PROOF STEP]
show "M #> g \<in> rcosets H"
[PROOF STATE]
proof (prove)
using this:
subgroup H G
g \<in> carrier G
h \<in> carrier G
M = H #> h
M #> g = H #> h \<otimes> g

goal (1 subgoal):
 1. M #> g \<in> rcosets H
[PROOF STEP]
by (metis rcosetsI subgroup.m_closed subgroup.subset subgroup_self)
[PROOF STATE]
proof (state)
this:
M #> g \<in> rcosets H

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fmdom'_fmsubset_restrict_set:
  fixes X1 X2 and s :: "('a, bool) fmap"
  assumes "X1 \<subseteq> X2" "fmdom' s = X2"
  shows "fmdom' (fmrestrict_set X1 s) = X1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fmdom' (fmrestrict_set X1 s) = X1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
X1 \<subseteq> X2
fmdom' s = X2

goal (1 subgoal):
 1. fmdom' (fmrestrict_set X1 s) = X1
[PROOF STEP]
by (metis (no_types, lifting)
      antisym_conv fmdom'_notD fmdom'_notI fmlookup_restrict_set rev_subsetD subsetI)

\<comment> \<open>NOTE added lemma.\<close>


[STATEMENT]
theorem th2_4: "a b \<congruent> c d \<Longrightarrow> b a \<congruent> c d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a b \<equiv> c d \<Longrightarrow> b a \<equiv> c d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a b \<equiv> c d \<Longrightarrow> b a \<equiv> c d
[PROOF STEP]
assume "a b \<congruent> c d"
[PROOF STATE]
proof (state)
this:
a b \<equiv> c d

goal (1 subgoal):
 1. a b \<equiv> c d \<Longrightarrow> b a \<equiv> c d
[PROOF STEP]
with th2_3 [of b a a b c d] and A1' [of b a]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>b a \<equiv> a b; a b \<equiv> c d\<rbrakk> \<Longrightarrow> b a \<equiv> c d
b a \<equiv> a b
a b \<equiv> c d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b a \<equiv> a b; a b \<equiv> c d\<rbrakk> \<Longrightarrow> b a \<equiv> c d
b a \<equiv> a b
a b \<equiv> c d

goal (1 subgoal):
 1. b a \<equiv> c d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b a \<equiv> c d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma natset_finite_max: assumes a: "finite A"
  shows "Suc (Max A) \<notin> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (Max A) \<notin> A
[PROOF STEP]
proof (cases "A = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A = {} \<Longrightarrow> Suc (Max A) \<notin> A
 2. A \<noteq> {} \<Longrightarrow> Suc (Max A) \<notin> A
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
A = {}

goal (2 subgoals):
 1. A = {} \<Longrightarrow> Suc (Max A) \<notin> A
 2. A \<noteq> {} \<Longrightarrow> Suc (Max A) \<notin> A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
A = {}

goal (1 subgoal):
 1. Suc (Max A) \<notin> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Suc (Max A) \<notin> A

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> Suc (Max A) \<notin> A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> Suc (Max A) \<notin> A
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
A \<noteq> {}

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> Suc (Max A) \<notin> A
[PROOF STEP]
with a
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<noteq> {}
[PROOF STEP]
have "Max A \<in> A \<and> (\<forall>s \<in> A. s \<le> Max A)"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}

goal (1 subgoal):
 1. Max A \<in> A \<and> (\<forall>s\<in>A. s \<le> Max A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Max A \<in> A \<and> (\<forall>s\<in>A. s \<le> Max A)

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> Suc (Max A) \<notin> A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Max A \<in> A \<and> (\<forall>s\<in>A. s \<le> Max A)

goal (1 subgoal):
 1. Suc (Max A) \<notin> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Suc (Max A) \<notin> A

goal:
No subgoals!
[PROOF STEP]
qed

    \<comment> \<open>not used\<close>


[STATEMENT]
lemma sum_image:
  fixes f :: "'a \<Rightarrow> 'b::join_semilattice_zero"
  assumes "finite X"
  shows "sum f X = \<Sum>(f ` X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f X = \<Sum> (f ` X)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite X

goal (1 subgoal):
 1. sum f X = \<Sum> (f ` X)
[PROOF STEP]
proof (induct rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sum f {} = \<Sum> (f ` {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; sum f F = \<Sum> (f ` F)\<rbrakk> \<Longrightarrow> sum f (insert x F) = \<Sum> (f ` insert x F)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. sum f {} = \<Sum> (f ` {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; sum f F = \<Sum> (f ` F)\<rbrakk> \<Longrightarrow> sum f (insert x F) = \<Sum> (f ` insert x F)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {} = \<Sum> (f ` {})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f {} = \<Sum> (f ` {})

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; sum f F = \<Sum> (f ` F)\<rbrakk> \<Longrightarrow> sum f (insert x F) = \<Sum> (f ` insert x F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; sum f F = \<Sum> (f ` F)\<rbrakk> \<Longrightarrow> sum f (insert x F) = \<Sum> (f ` insert x F)
[PROOF STEP]
case insert
[PROOF STATE]
proof (state)
this:
finite F_
x_ \<notin> F_
sum f F_ = \<Sum> (f ` F_)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; sum f F = \<Sum> (f ` F)\<rbrakk> \<Longrightarrow> sum f (insert x F) = \<Sum> (f ` insert x F)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
finite F_
x_ \<notin> F_
sum f F_ = \<Sum> (f ` F_)

goal (1 subgoal):
 1. sum f (insert x_ F_) = \<Sum> (f ` insert x_ F_)
[PROOF STEP]
by (metis sum.insert sum_fun_insert)
[PROOF STATE]
proof (state)
this:
sum f (insert x_ F_) = \<Sum> (f ` insert x_ F_)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gen_sqrt_upper_scaled:
  assumes "0 \<le> x" "0 < u"
    shows "sqrt x \<le> sqrtu (x*u^2) n / u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt x \<le> sqrtu (x * u\<^sup>2) n / u
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sqrt x \<le> sqrtu (x * u\<^sup>2) n / u
[PROOF STEP]
have "sqrt x = sqrt x * sqrt (u^2) / u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt x = sqrt x * sqrt (u\<^sup>2) / u
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
0 < u

goal (1 subgoal):
 1. sqrt x = sqrt x * sqrt (u\<^sup>2) / u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sqrt x = sqrt x * sqrt (u\<^sup>2) / u

goal (1 subgoal):
 1. sqrt x \<le> sqrtu (x * u\<^sup>2) n / u
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt x = sqrt x * sqrt (u\<^sup>2) / u

goal (1 subgoal):
 1. sqrt x \<le> sqrtu (x * u\<^sup>2) n / u
[PROOF STEP]
have "... = sqrt (x*u^2) / u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt x * sqrt (u\<^sup>2) / u = sqrt (x * u\<^sup>2) / u
[PROOF STEP]
by (metis real_sqrt_mult)
[PROOF STATE]
proof (state)
this:
sqrt x * sqrt (u\<^sup>2) / u = sqrt (x * u\<^sup>2) / u

goal (1 subgoal):
 1. sqrt x \<le> sqrtu (x * u\<^sup>2) n / u
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt x * sqrt (u\<^sup>2) / u = sqrt (x * u\<^sup>2) / u

goal (1 subgoal):
 1. sqrt x \<le> sqrtu (x * u\<^sup>2) n / u
[PROOF STEP]
have "... \<le> sqrtu (x*u^2) n / u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (x * u\<^sup>2) / u \<le> sqrtu (x * u\<^sup>2) n / u
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
0 < u

goal (1 subgoal):
 1. sqrt (x * u\<^sup>2) / u \<le> sqrtu (x * u\<^sup>2) n / u
[PROOF STEP]
by (simp add: divide_simps) (metis gen_sqrt_upper zero_le_mult_iff zero_le_power2)
[PROOF STATE]
proof (state)
this:
sqrt (x * u\<^sup>2) / u \<le> sqrtu (x * u\<^sup>2) n / u

goal (1 subgoal):
 1. sqrt x \<le> sqrtu (x * u\<^sup>2) n / u
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sqrt x \<le> sqrtu (x * u\<^sup>2) n / u
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sqrt x \<le> sqrtu (x * u\<^sup>2) n / u

goal (1 subgoal):
 1. sqrt x \<le> sqrtu (x * u\<^sup>2) n / u
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sqrt x \<le> sqrtu (x * u\<^sup>2) n / u

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma one_reducible_to_trans: "\<lbrakk> one_reducible_to A B; one_reducible_to B C \<rbrakk> \<Longrightarrow> one_reducible_to A C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>one_reducible_to A B; one_reducible_to B C\<rbrakk> \<Longrightarrow> one_reducible_to A C
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>one_reducible_to A B; one_reducible_to B C\<rbrakk> \<Longrightarrow> one_reducible_to A C
[PROOF STEP]
assume "one_reducible_to A B"
[PROOF STATE]
proof (state)
this:
one_reducible_to A B

goal (1 subgoal):
 1. \<lbrakk>one_reducible_to A B; one_reducible_to B C\<rbrakk> \<Longrightarrow> one_reducible_to A C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
one_reducible_to A B
[PROOF STEP]
obtain f where A1: "one_reducible_to_via A B f"
[PROOF STATE]
proof (prove)
using this:
one_reducible_to A B

goal (1 subgoal):
 1. (\<And>f. one_reducible_to_via A B f \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding one_reducible_to_def
[PROOF STATE]
proof (prove)
using this:
Ex (one_reducible_to_via A B)

goal (1 subgoal):
 1. (\<And>f. one_reducible_to_via A B f \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
one_reducible_to_via A B f

goal (1 subgoal):
 1. \<lbrakk>one_reducible_to A B; one_reducible_to B C\<rbrakk> \<Longrightarrow> one_reducible_to A C
[PROOF STEP]
assume "one_reducible_to B C"
[PROOF STATE]
proof (state)
this:
one_reducible_to B C

goal (1 subgoal):
 1. \<lbrakk>one_reducible_to A B; one_reducible_to B C\<rbrakk> \<Longrightarrow> one_reducible_to A C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
one_reducible_to B C
[PROOF STEP]
obtain g where A2: "one_reducible_to_via B C g"
[PROOF STATE]
proof (prove)
using this:
one_reducible_to B C

goal (1 subgoal):
 1. (\<And>g. one_reducible_to_via B C g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding one_reducible_to_def
[PROOF STATE]
proof (prove)
using this:
Ex (one_reducible_to_via B C)

goal (1 subgoal):
 1. (\<And>g. one_reducible_to_via B C g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
one_reducible_to_via B C g

goal (1 subgoal):
 1. \<lbrakk>one_reducible_to A B; one_reducible_to B C\<rbrakk> \<Longrightarrow> one_reducible_to A C
[PROOF STEP]
from A1 A2
[PROOF STATE]
proof (chain)
picking this:
one_reducible_to_via A B f
one_reducible_to_via B C g
[PROOF STEP]
have "one_reducible_to_via A C (g o f)"
[PROOF STATE]
proof (prove)
using this:
one_reducible_to_via A B f
one_reducible_to_via B C g

goal (1 subgoal):
 1. one_reducible_to_via A C (g \<circ> f)
[PROOF STEP]
by (rule one_reducible_to_via_trans)
[PROOF STATE]
proof (state)
this:
one_reducible_to_via A C (g \<circ> f)

goal (1 subgoal):
 1. \<lbrakk>one_reducible_to A B; one_reducible_to B C\<rbrakk> \<Longrightarrow> one_reducible_to A C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
one_reducible_to_via A C (g \<circ> f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
one_reducible_to_via A C (g \<circ> f)

goal (1 subgoal):
 1. one_reducible_to A C
[PROOF STEP]
unfolding one_reducible_to_def
[PROOF STATE]
proof (prove)
using this:
one_reducible_to_via A C (g \<circ> f)

goal (1 subgoal):
 1. Ex (one_reducible_to_via A C)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
one_reducible_to A C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma check_quadroot_nonlinear:
  assumes "a \<noteq> 0"
  shows "quadroot_in m M a b c =
    (let D = b^2 - 4 * a * c in D \<ge> 0 \<and>
      ((let x = (-b + sqrt D)/(2*a) in m \<le> x \<and> x \<le> M) \<or>
      (let x = (-b - sqrt D)/(2*a) in m \<le> x \<and> x \<le> M)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quadroot_in m M a b c = (let D = b\<^sup>2 - 4 * a * c in 0 \<le> D \<and> ((let x = (- b + sqrt D) / (2 * a) in m \<le> x \<and> x \<le> M) \<or> (let x = (- b - sqrt D) / (2 * a) in m \<le> x \<and> x \<le> M)))
[PROOF STEP]
by (auto simp: quadroot_in_def Let_def root_in_def quadratic_eq_zeroes_iff[OF refl refl refl assms])


[STATEMENT]
lemma real_root_divide: "root n (x / y) = root n x / root n y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root n (x / y) = root n x / root n y
[PROOF STEP]
by (simp add: divide_inverse real_root_mult real_root_inverse)


[STATEMENT]
lemma pure_rel_eq_false_iff: "pure R x y = false \<longleftrightarrow> (y,x)\<notin>R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pure R x y = false) = ((y, x) \<notin> R)
[PROOF STEP]
by (auto simp: pure_def)


[STATEMENT]
lemma powreal_mult3:
      "\<lbrakk> 0 < a; 0 \<le> x \<rbrakk> \<Longrightarrow> (a pow\<^sub>\<real> x) pow\<^sub>\<real> y = a pow\<^sub>\<real> (x * y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < a; 0 \<le> x\<rbrakk> \<Longrightarrow> (a pow\<^sub>\<real> x) pow\<^sub>\<real> y = a pow\<^sub>\<real> (x * y)
[PROOF STEP]
by (metis linorder_not_less powreal_mult1 powreal_mult2)


[STATEMENT]
lemma pair_map_pmf2: "pair_pmf A (map_pmf f B) = map_pmf (apsnd f) (pair_pmf A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pair_pmf A (map_pmf f B) = map_pmf (apsnd f) (pair_pmf A B)
[PROOF STEP]
proof (safe intro!: pmf_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. pmf (pair_pmf A (map_pmf f B)) (a, b) = pmf (map_pmf (apsnd f) (pair_pmf A B)) (a, b)
[PROOF STEP]
fix a :: "'a" and b :: "'b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. pmf (pair_pmf A (map_pmf f B)) (a, b) = pmf (map_pmf (apsnd f) (pair_pmf A B)) (a, b)
[PROOF STEP]
have [simp]: "\<And>c d. indicator (apsnd f -` {(a, b)}) (c, d) = indicator {a} c * (indicator (f -` {b}) d::ennreal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c d. indicator (apsnd f -` {(a, b)}) (c, d) = indicator {a} c * indicator (f -` {b}) d
[PROOF STEP]
by (auto split: split_indicator)
[PROOF STATE]
proof (state)
this:
indicator (apsnd f -` {(a, b)}) (?c, ?d) = indicator {a} ?c * indicator (f -` {b}) ?d

goal (1 subgoal):
 1. \<And>a b. pmf (pair_pmf A (map_pmf f B)) (a, b) = pmf (map_pmf (apsnd f) (pair_pmf A B)) (a, b)
[PROOF STEP]
have "ennreal (pmf (pair_pmf A (map_pmf f B)) (a, b)) =
         ennreal (pmf (map_pmf (apsnd f) (pair_pmf A B)) (a, b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (pmf (pair_pmf A (map_pmf f B)) (a, b)) = ennreal (pmf (map_pmf (apsnd f) (pair_pmf A B)) (a, b))
[PROOF STEP]
unfolding pmf_pair ennreal_pmf_map
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (pmf A a * pmf (map_pmf f B) b) = integral\<^sup>N (measure_pmf (pair_pmf A B)) (indicator (apsnd f -` {(a, b)}))
[PROOF STEP]
by (simp add: nn_integral_pair_pmf' max_def emeasure_pmf_single nn_integral_cmult nn_integral_multc pmf_nonneg
                  emeasure_map_pmf[symmetric] ennreal_mult del: emeasure_map_pmf)
[PROOF STATE]
proof (state)
this:
ennreal (pmf (pair_pmf A (map_pmf f B)) (a, b)) = ennreal (pmf (map_pmf (apsnd f) (pair_pmf A B)) (a, b))

goal (1 subgoal):
 1. \<And>a b. pmf (pair_pmf A (map_pmf f B)) (a, b) = pmf (map_pmf (apsnd f) (pair_pmf A B)) (a, b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ennreal (pmf (pair_pmf A (map_pmf f B)) (a, b)) = ennreal (pmf (map_pmf (apsnd f) (pair_pmf A B)) (a, b))
[PROOF STEP]
show "pmf (pair_pmf A (map_pmf f B)) (a, b) = pmf (map_pmf (apsnd f) (pair_pmf A B)) (a, b)"
[PROOF STATE]
proof (prove)
using this:
ennreal (pmf (pair_pmf A (map_pmf f B)) (a, b)) = ennreal (pmf (map_pmf (apsnd f) (pair_pmf A B)) (a, b))

goal (1 subgoal):
 1. pmf (pair_pmf A (map_pmf f B)) (a, b) = pmf (map_pmf (apsnd f) (pair_pmf A B)) (a, b)
[PROOF STEP]
by (simp add: pmf_nonneg)
[PROOF STATE]
proof (state)
this:
pmf (pair_pmf A (map_pmf f B)) (a, b) = pmf (map_pmf (apsnd f) (pair_pmf A B)) (a, b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_to_iarray_cofactor[code_unfold]:
  "(cofactor A i j) = cofactor_iarrays (matrix_to_iarray A) (to_nat i) (to_nat j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cofactor A i j = cofactor_iarrays (matrix_to_iarray A) (mod_type_class.to_nat i) (mod_type_class.to_nat j)
[PROOF STEP]
unfolding o_def cofactor_iarrays_def cofactor_def cofactorM_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (minorM A i j) = det_iarrays_rings (minorM_iarrays (matrix_to_iarray A) (mod_type_class.to_nat i) (mod_type_class.to_nat j))
[PROOF STEP]
unfolding matrix_to_iarray_minorM[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (minorM A i j) = det_iarrays_rings (matrix_to_iarray (minorM A i j))
[PROOF STEP]
unfolding matrix_to_iarray_det_euclidean_ring[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (minorM A i j) = det (minorM A i j)
[PROOF STEP]
by simp


[STATEMENT]
lemma p_recurrence:
  assumes k: "k > 0"
  shows   "p k = -of_nat k * (-1) ^ k * e k - (\<Sum>i=1..<k. (-1) ^ i * e i * p (k - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p k = - of_nat k * (- 1) ^ k * e k - (\<Sum>i = 1..<k. (- 1) ^ i * e i * p (k - i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. p k = - of_nat k * (- 1) ^ k * e k - (\<Sum>i = 1..<k. (- 1) ^ i * e i * p (k - i))
[PROOF STEP]
unfolding e_altdef p_altdef
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. insertion x (powsum_mpoly {..<n} k) = - of_nat k * (- 1) ^ k * insertion x (sym_mpoly {..<n} k) - (\<Sum>i = 1..<k. (- 1) ^ i * insertion x (sym_mpoly {..<n} i) * insertion x (powsum_mpoly {..<n} (k - i)))
[PROOF STEP]
by (subst powsum_mpoly_recurrence)
     (auto simp: insertion_sum insertion_add insertion_mult insertion_diff
                 insertion_power insertion_sym_mpoly)


[STATEMENT]
lemma frechet_derivative_times_fun:
  "f differentiable at a \<Longrightarrow> g differentiable at a \<Longrightarrow>
  frechet_derivative (f * g) (at a) =
  (\<lambda>x. f a * frechet_derivative g (at a) x + frechet_derivative f (at a) x * g a)"
  for f g::"_\<Rightarrow>'a::real_normed_algebra"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f differentiable at a; g differentiable at a\<rbrakk> \<Longrightarrow> frechet_derivative (f * g) (at a) = (\<lambda>x. f a * frechet_derivative g (at a) x + frechet_derivative f (at a) x * g a)
[PROOF STEP]
by (rule frechet_derivative_at') (auto intro!: derivative_eq_intros frechet_derivative_worksI)


[STATEMENT]
lemma in_degree_eq_card_arc_ends: "in_degree G v = card ((arc_to_ends G) ` (in_arcs G v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. in_degree G v = card (arc_to_ends G ` in_arcs G v)
[PROOF STEP]
apply (simp add: in_degree_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (in_arcs G v) = card (arc_to_ends G ` in_arcs G v)
[PROOF STEP]
using  no_multi_arcs
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?e1.0 \<in> arcs G; ?e2.0 \<in> arcs G; arc_to_ends G ?e1.0 = arc_to_ends G ?e2.0\<rbrakk> \<Longrightarrow> ?e1.0 = ?e2.0

goal (1 subgoal):
 1. card (in_arcs G v) = card (arc_to_ends G ` in_arcs G v)
[PROOF STEP]
by (metis card_image in_arcs_in_arcs inj_onI)


[STATEMENT]
lemma integrable_altD:
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  assumes "f integrable_on s"
  shows "\<And>a b. (\<lambda>x. if x \<in> s then f x else 0) integrable_on cbox a b"
    and "\<And>e. e > 0 \<Longrightarrow> \<exists>B>0. \<forall>a b c d. ball 0 B \<subseteq> cbox a b \<and> ball 0 B \<subseteq> cbox c d \<longrightarrow>
      norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0) - integral (cbox c d)  (\<lambda>x. if x \<in> s then f x else 0)) < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) &&& (\<And>e. 0 < e \<Longrightarrow> \<exists>B>0. \<forall>a b c d. ball (0::'n) B \<subseteq> cbox a b \<and> ball (0::'n) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - integral (cbox c d) (\<lambda>x. if x \<in> s then f x else (0::'a))) < e)
[PROOF STEP]
using assms[unfolded integrable_alt[of f]]
[PROOF STATE]
proof (prove)
using this:
(\<forall>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'n) B \<subseteq> cbox a b \<and> ball (0::'n) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - integral (cbox c d) (\<lambda>x. if x \<in> s then f x else (0::'a))) < e)

goal (1 subgoal):
 1. (\<And>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) &&& (\<And>e. 0 < e \<Longrightarrow> \<exists>B>0. \<forall>a b c d. ball (0::'n) B \<subseteq> cbox a b \<and> ball (0::'n) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - integral (cbox c d) (\<lambda>x. if x \<in> s then f x else (0::'a))) < e)
[PROOF STEP]
by auto


[STATEMENT]
lemma thd_tSup:
  "\<exists>xs \<in> Y. \<not> is_TNil xs
  \<Longrightarrow> thd (tSup Y) = (THE x. x \<in> thd ` (Y \<inter> {xs. \<not> is_TNil xs}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>xs\<in>Y. \<not> is_TNil xs \<Longrightarrow> thd (local.tSup Y) = (THE x. x \<in> thd ` (Y \<inter> {xs. \<not> is_TNil xs}))
[PROOF STEP]
apply(simp add: tSup_def image_image)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>xs\<in>Y. \<not> is_TNil xs \<Longrightarrow> (THE x. x \<in> lhd ` (llist_of_tllist ` Y \<inter> {xs. \<not> lnull xs})) = (THE x. x \<in> thd ` (Y \<inter> {xs. \<not> is_TNil xs}))
[PROOF STEP]
apply(rule arg_cong[where f=The])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>xs\<in>Y. \<not> is_TNil xs \<Longrightarrow> (\<lambda>x. x \<in> lhd ` (llist_of_tllist ` Y \<inter> {xs. \<not> lnull xs})) = (\<lambda>x. x \<in> thd ` (Y \<inter> {xs. \<not> is_TNil xs}))
[PROOF STEP]
apply(auto intro: rev_image_eqI intro!: ext)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma quad_form_scale_m:
  shows "quad_form v (k *\<^sub>s\<^sub>m H) = k * quad_form v H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quad_form v (k *\<^sub>s\<^sub>m H) = k * quad_form v H
[PROOF STEP]
using bilinear_form_scale_m
[PROOF STATE]
proof (prove)
using this:
bilinear_form ?v1.0 ?v2.0 (?k *\<^sub>s\<^sub>m ?H) = ?k * bilinear_form ?v1.0 ?v2.0 ?H

goal (1 subgoal):
 1. quad_form v (k *\<^sub>s\<^sub>m H) = k * quad_form v H
[PROOF STEP]
by simp


[STATEMENT]
theorem suffix_Cons: "suffix xs (y # ys) \<longleftrightarrow> xs = y # ys \<or> suffix xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. suffix xs (y # ys) = (xs = y # ys \<or> suffix xs ys)
[PROOF STEP]
unfolding suffix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>zs. y # ys = zs @ xs) = (xs = y # ys \<or> (\<exists>zs. ys = zs @ xs))
[PROOF STEP]
by (auto simp: Cons_eq_append_conv)


[STATEMENT]
lemma sum_lt:
  fixes x :: "'a::ordered_ab_group_add"
  shows "x + t < 0 \<equiv> x < - t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + t < (0::'a) \<equiv> x < - t
[PROOF STEP]
using less_diff_eq[where a= x and b=t and c=0]
[PROOF STATE]
proof (prove)
using this:
(x < (0::'a) - t) = (x + t < (0::'a))

goal (1 subgoal):
 1. x + t < (0::'a) \<equiv> x < - t
[PROOF STEP]
by simp


[STATEMENT]
lemma exp_1_approx:
  "n > 0 \<Longrightarrow> \<bar>exp (1::real) - euler_approx n\<bar> \<le> 1 / fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<bar>exp 1 - euler_approx n\<bar> \<le> 1 / fact n
[PROOF STEP]
using exp_approx''[of n 1]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < n; 0 \<le> 1; 1 \<le> 1\<rbrakk> \<Longrightarrow> \<bar>exp 1 - (\<Sum>k\<le>n. 1 ^ k / fact k)\<bar> \<le> 1 / fact n

goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<bar>exp 1 - euler_approx n\<bar> \<le> 1 / fact n
[PROOF STEP]
by (simp add: euler_approx_def field_split_simps)


[STATEMENT]
lemma pochhammer_Suc_prod_rev: "pochhammer a (Suc n) = prod (\<lambda>i. a + of_nat (n - i)) {0..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pochhammer a (Suc n) = (\<Prod>i = 0..n. a + of_nat (n - i))
[PROOF STEP]
using prod.atLeast_Suc_atMost_Suc_shift
[PROOF STATE]
proof (prove)
using this:
prod ?g {Suc ?m..Suc ?n} = prod (?g \<circ> Suc) {?m..?n}

goal (1 subgoal):
 1. pochhammer a (Suc n) = (\<Prod>i = 0..n. a + of_nat (n - i))
[PROOF STEP]
by (simp add: pochhammer_prod_rev prod.atLeast_Suc_atMost_Suc_shift del: prod.cl_ivl_Suc)


[STATEMENT]
lemma d_geom_series:
  assumes "b = 2^(Suc c)"
  shows "(D q c b = d) \<longleftrightarrow> ((b-1) * d = (2^c - 1) * (b^(Suc q) - 1))" (is "?P \<longleftrightarrow> ?Q")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (D q c b = d) = ((b - 1) * d = (2 ^ c - 1) * (b ^ Suc q - 1))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (D q c b = d) = ((b - 1) * d = (2 ^ c - 1) * (b ^ Suc q - 1))
[PROOF STEP]
have "D q c b = (2^c - 1) *  E q b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. D q c b = (2 ^ c - 1) * E q b
[PROOF STEP]
by (auto simp: E_def D_def sum_distrib_left sum_distrib_right)
[PROOF STATE]
proof (state)
this:
D q c b = (2 ^ c - 1) * E q b

goal (1 subgoal):
 1. (D q c b = d) = ((b - 1) * d = (2 ^ c - 1) * (b ^ Suc q - 1))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
D q c b = (2 ^ c - 1) * E q b

goal (1 subgoal):
 1. (D q c b = d) = ((b - 1) * d = (2 ^ c - 1) * (b ^ Suc q - 1))
[PROOF STEP]
have "b \<ge> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
b = 2 ^ Suc c

goal (1 subgoal):
 1. 2 \<le> b
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
2 \<le> b

goal (1 subgoal):
 1. (D q c b = d) = ((b - 1) * d = (2 ^ c - 1) * (b ^ Suc q - 1))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
D q c b = (2 ^ c - 1) * E q b
2 \<le> b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
D q c b = (2 ^ c - 1) * E q b
2 \<le> b

goal (1 subgoal):
 1. (D q c b = d) = ((b - 1) * d = (2 ^ c - 1) * (b ^ Suc q - 1))
[PROOF STEP]
by (smt e_geom_series mult.left_commute mult_cancel_left)
[PROOF STATE]
proof (state)
this:
(D q c b = d) = ((b - 1) * d = (2 ^ c - 1) * (b ^ Suc q - 1))

goal:
No subgoals!
[PROOF STEP]
qed