[STATEMENT]
lemma chebyshev_inequality:
  fixes Y :: "'a \<Rightarrow> real"
  assumes Y_int: "integrable M (\<lambda>y. (Y y)^2)"
  assumes Y_borel: "Y \<in> borel_measurable M"
  fixes s :: "real"
  assumes s_pos: "0 < s"
  shows "prob {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>} \<le> variance Y / s^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>} \<le> expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) / s\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prob {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>} \<le> expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) / s\<^sup>2
[PROOF STEP]
let ?X = "\<lambda>a. (Y a - expectation Y)^2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prob {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>} \<le> expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) / s\<^sup>2
[PROOF STEP]
let ?t = "s^2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prob {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>} \<le> expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) / s\<^sup>2
[PROOF STEP]
have "0 < ?t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < s\<^sup>2
[PROOF STEP]
using s_pos
[PROOF STATE]
proof (prove)
using this:
0 < s

goal (1 subgoal):
 1. 0 < s\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < s\<^sup>2

goal (1 subgoal):
 1. prob {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>} \<le> expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) / s\<^sup>2
[PROOF STEP]
hence "prob {a \<in> space M. ?t \<le> ?X a} \<le> variance Y / s^2"
[PROOF STATE]
proof (prove)
using this:
0 < s\<^sup>2

goal (1 subgoal):
 1. prob {a \<in> space M. s\<^sup>2 \<le> (Y a - expectation Y)\<^sup>2} \<le> expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) / s\<^sup>2
[PROOF STEP]
using markov_inequality variance_expectation[OF Y_int Y_borel]
[PROOF STATE]
proof (prove)
using this:
0 < s\<^sup>2
\<lbrakk>\<And>a. 0 \<le> ?X a; integrable M ?X; 0 < ?t\<rbrakk> \<Longrightarrow> prob {a \<in> space M. ?t \<le> ?X a} \<le> expectation ?X / ?t
integrable M (\<lambda>x. (Y x - expectation Y)\<^sup>2)
expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) = expectation (\<lambda>x. (Y x)\<^sup>2) - (expectation Y)\<^sup>2

goal (1 subgoal):
 1. prob {a \<in> space M. s\<^sup>2 \<le> (Y a - expectation Y)\<^sup>2} \<le> expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) / s\<^sup>2
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
prob {a \<in> space M. s\<^sup>2 \<le> (Y a - expectation Y)\<^sup>2} \<le> expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) / s\<^sup>2

goal (1 subgoal):
 1. prob {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>} \<le> expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) / s\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
prob {a \<in> space M. s\<^sup>2 \<le> (Y a - expectation Y)\<^sup>2} \<le> expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) / s\<^sup>2

goal (1 subgoal):
 1. prob {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>} \<le> expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) / s\<^sup>2
[PROOF STEP]
have "{a \<in> space M. ?t \<le> ?X a} = {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a \<in> space M. s\<^sup>2 \<le> (Y a - expectation Y)\<^sup>2} = {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>}
[PROOF STEP]
using abs_le_square_iff s_pos
[PROOF STATE]
proof (prove)
using this:
(\<bar>?x\<bar> \<le> \<bar>?y\<bar>) = (?x\<^sup>2 \<le> ?y\<^sup>2)
0 < s

goal (1 subgoal):
 1. {a \<in> space M. s\<^sup>2 \<le> (Y a - expectation Y)\<^sup>2} = {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{a \<in> space M. s\<^sup>2 \<le> (Y a - expectation Y)\<^sup>2} = {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>}

goal (1 subgoal):
 1. prob {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>} \<le> expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) / s\<^sup>2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
prob {a \<in> space M. s\<^sup>2 \<le> (Y a - expectation Y)\<^sup>2} \<le> expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) / s\<^sup>2
{a \<in> space M. s\<^sup>2 \<le> (Y a - expectation Y)\<^sup>2} = {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prob {a \<in> space M. s\<^sup>2 \<le> (Y a - expectation Y)\<^sup>2} \<le> expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) / s\<^sup>2
{a \<in> space M. s\<^sup>2 \<le> (Y a - expectation Y)\<^sup>2} = {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>}

goal (1 subgoal):
 1. prob {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>} \<le> expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) / s\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prob {a \<in> space M. s \<le> \<bar>Y a - expectation Y\<bar>} \<le> expectation (\<lambda>x. (Y x - expectation Y)\<^sup>2) / s\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bnds_power:
  "\<forall>(x::real) l u. (l1, u1) = float_power_bnds prec n l u \<and> x \<in> {l .. u} \<longrightarrow>
    l1 \<le> x ^ n \<and> x ^ n \<le> u1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x l u. (l1, u1) = float_power_bnds prec n l u \<and> x \<in> {real_of_float l..real_of_float u} \<longrightarrow> real_of_float l1 \<le> x ^ n \<and> x ^ n \<le> real_of_float u1
[PROOF STEP]
using float_power_bnds
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?l1.0, ?u1.0) = float_power_bnds ?prec ?n ?l ?u; ?x \<in> {real_of_float ?l..real_of_float ?u}\<rbrakk> \<Longrightarrow> ?x ^ ?n \<in> {real_of_float ?l1.0..real_of_float ?u1.0}

goal (1 subgoal):
 1. \<forall>x l u. (l1, u1) = float_power_bnds prec n l u \<and> x \<in> {real_of_float l..real_of_float u} \<longrightarrow> real_of_float l1 \<le> x ^ n \<and> x ^ n \<le> real_of_float u1
[PROOF STEP]
by auto


[STATEMENT]
lemma AE_uniform_measureI:
  "A \<in> sets M \<Longrightarrow> (AE x in M. x \<in> A \<longrightarrow> P x) \<Longrightarrow> (AE x in uniform_measure M A. P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> sets M; set_almost_everywhere A M P\<rbrakk> \<Longrightarrow> almost_everywhere (uniform_measure M A) P
[PROOF STEP]
unfolding uniform_measure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> sets M; set_almost_everywhere A M P\<rbrakk> \<Longrightarrow> almost_everywhere (density M (\<lambda>x. indicator A x / emeasure M A)) P
[PROOF STEP]
by (auto simp: AE_density divide_ennreal_def)


[STATEMENT]
lemma pdevs_val_filter_pdevs:
  "pdevs_val e (filter_pdevs I x) =
    (\<Sum>i \<in> {..<degree x} \<inter> {i. I i (pdevs_apply x i)}. e i *\<^sub>R pdevs_apply x i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pdevs_val e (filter_pdevs I x) = (\<Sum>i\<in>{..<degree x} \<inter> {i. I i (pdevs_apply x i)}. e i *\<^sub>R pdevs_apply x i)
[PROOF STEP]
by (auto simp: pdevs_val_sum if_distrib sum.inter_restrict degree_filter_pdevs_le degree_gt
    intro!: sum.mono_neutral_cong_left split: if_split_asm)


[STATEMENT]
lemma create_unconnected_fsm_with_precomputations_code [code] : "FSM_Impl.create_unconnected_fsm_from_fsets q ns ins outs = FSMWP (create_unconnected_fsm_from_fsets q ns ins outs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FSM_Impl.create_unconnected_fsm_from_fsets q ns ins outs = FSMWP (FSM_Code_Datatype.create_unconnected_fsm_from_fsets q ns ins outs)
[PROOF STEP]
unfolding FSM_Impl.create_unconnected_fsm_from_fsets.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FSMI q (insert q (fset ns)) (fset ins) (fset outs) {} = FSMWP (FSM_Code_Datatype.create_unconnected_fsm_from_fsets q ns ins outs)
[PROOF STEP]
unfolding FSMWP_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FSMI q (insert q (fset ns)) (fset ins) (fset outs) {} = FSMI (initial_wp (FSM_Code_Datatype.create_unconnected_fsm_from_fsets q ns ins outs)) (states_wp (FSM_Code_Datatype.create_unconnected_fsm_from_fsets q ns ins outs)) (inputs_wp (FSM_Code_Datatype.create_unconnected_fsm_from_fsets q ns ins outs)) (outputs_wp (FSM_Code_Datatype.create_unconnected_fsm_from_fsets q ns ins outs)) (transitions_wp (FSM_Code_Datatype.create_unconnected_fsm_from_fsets q ns ins outs))
[PROOF STEP]
unfolding create_unconnected_fsm_from_fsets_simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FSMI q (insert q (fset ns)) (fset ins) (fset outs) {} = FSMI q (insert q (fset ns)) (fset ins) (fset outs) {}
[PROOF STEP]
by presburger


[STATEMENT]
lemma fps_lr_inverse_gp_ring1':
  fixes   ones :: "'a :: ring_1 fps"
  defines "ones \<equiv> Abs_fps (\<lambda>n. 1)"
  shows   "fps_left_inverse ones 1 = 1 - fps_X"
  and     "fps_right_inverse ones 1 = 1 - fps_X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_left_inverse ones (1::'a) = 1 - fps_X &&& fps_right_inverse ones (1::'a) = 1 - fps_X
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fps_left_inverse ones (1::'a) = 1 - fps_X
 2. fps_right_inverse ones (1::'a) = 1 - fps_X
[PROOF STEP]
define ones_inv :: "'a :: ring_1 fps"
    where "ones_inv \<equiv> Abs_fps (\<lambda>n. if n=0 then 1 else if n=1 then - 1 else 0)"
[PROOF STATE]
proof (state)
this:
ones_inv \<equiv> Abs_fps (\<lambda>n. if n = 0 then 1::'a else if n = 1 then - (1::'a) else (0::'a))

goal (2 subgoals):
 1. fps_left_inverse ones (1::'a) = 1 - fps_X
 2. fps_right_inverse ones (1::'a) = 1 - fps_X
[PROOF STEP]
hence "fps_left_inverse ones 1 = ones_inv"
  and   "fps_right_inverse ones 1 = ones_inv"
[PROOF STATE]
proof (prove)
using this:
ones_inv \<equiv> Abs_fps (\<lambda>n. if n = 0 then 1::'a else if n = 1 then - (1::'a) else (0::'a))

goal (1 subgoal):
 1. fps_left_inverse ones (1::'a) = ones_inv &&& fps_right_inverse ones (1::'a) = ones_inv
[PROOF STEP]
using ones_def fps_lr_inverse_gp_ring1
[PROOF STATE]
proof (prove)
using this:
ones_inv \<equiv> Abs_fps (\<lambda>n. if n = 0 then 1::'a else if n = 1 then - (1::'a) else (0::'a))
ones \<equiv> Abs_fps (\<lambda>n. 1::'a)
fps_left_inverse (Abs_fps (\<lambda>n. 1::?'a)) (1::?'a) = Abs_fps (\<lambda>n. if n = 0 then 1::?'a else if n = 1 then - (1::?'a) else (0::?'a))
fps_right_inverse (Abs_fps (\<lambda>n. 1::?'a)) (1::?'a) = Abs_fps (\<lambda>n. if n = 0 then 1::?'a else if n = 1 then - (1::?'a) else (0::?'a))

goal (1 subgoal):
 1. fps_left_inverse ones (1::'a) = ones_inv &&& fps_right_inverse ones (1::'a) = ones_inv
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fps_left_inverse ones (1::'a) = ones_inv
fps_right_inverse ones (1::'a) = ones_inv

goal (2 subgoals):
 1. fps_left_inverse ones (1::'a) = 1 - fps_X
 2. fps_right_inverse ones (1::'a) = 1 - fps_X
[PROOF STEP]
thus "fps_left_inverse ones 1 = 1 - fps_X"
  and   "fps_right_inverse ones 1 = 1 - fps_X"
[PROOF STATE]
proof (prove)
using this:
fps_left_inverse ones (1::'a) = ones_inv
fps_right_inverse ones (1::'a) = ones_inv

goal (1 subgoal):
 1. fps_left_inverse ones (1::'a) = 1 - fps_X &&& fps_right_inverse ones (1::'a) = 1 - fps_X
[PROOF STEP]
by (auto intro: fps_ext simp: ones_inv_def)
[PROOF STATE]
proof (state)
this:
fps_left_inverse ones (1::'a) = 1 - fps_X
fps_right_inverse ones (1::'a) = 1 - fps_X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma calc_ideal_point_2_unit:
  assumes "is_real A" "(cmod B)\<^sup>2 > (cmod A)\<^sup>2"
  assumes "(z1, z2) = calc_ideal_point2_cvec A B"
  shows "z1 * cnj z1 = z2 * cnj z2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
let ?discr = "Re ((cmod B)\<^sup>2 - (Re A)\<^sup>2)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
have "?discr > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_real A
(cmod A)\<^sup>2 < (cmod B)\<^sup>2
(z1, z2) = calc_ideal_point2_cvec A B

goal (1 subgoal):
 1. 0 < Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))
[PROOF STEP]
by (simp add: cmod_power2)
[PROOF STATE]
proof (state)
this:
0 < Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))

goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
have "(B*(-A + \<i>*sqrt(?discr))) * cnj (B*(-A + \<i>*sqrt(?discr))) = (B * cnj B) * (A\<^sup>2 + cor (abs ?discr))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * cnj (B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))) = B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>)
[PROOF STEP]
using \<open>is_real A\<close> eq_cnj_iff_real[of A]
[PROOF STATE]
proof (prove)
using this:
is_real A
(cnj A = A) = is_real A

goal (1 subgoal):
 1. B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * cnj (B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))) = B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>)
[PROOF STEP]
by (simp add: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * cnj (B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))) = B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>)

goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * cnj (B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))) = B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>)

goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
have "... = (B * cnj B) * (cmod B)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>) = B * cnj B * cor ((cmod B)\<^sup>2)
[PROOF STEP]
using \<open>?discr > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))

goal (1 subgoal):
 1. B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>) = B * cnj B * cor ((cmod B)\<^sup>2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))
is_real A
(cmod A)\<^sup>2 < (cmod B)\<^sup>2
(z1, z2) = calc_ideal_point2_cvec A B

goal (1 subgoal):
 1. B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>) = B * cnj B * cor ((cmod B)\<^sup>2)
[PROOF STEP]
using complex_of_real_Re[of "(cmod B)\<^sup>2 - (Re A)\<^sup>2"] complex_of_real_Re[of A] \<open>is_real A\<close>
[PROOF STATE]
proof (prove)
using this:
0 < Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))
is_real A
(cmod A)\<^sup>2 < (cmod B)\<^sup>2
(z1, z2) = calc_ideal_point2_cvec A B
is_real (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)) \<Longrightarrow> cor (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))) = cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)
is_real A \<Longrightarrow> cor (Re A) = A
is_real A

goal (1 subgoal):
 1. B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>) = B * cnj B * cor ((cmod B)\<^sup>2)
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>) = B * cnj B * cor ((cmod B)\<^sup>2)

goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
B * cnj B * (A\<^sup>2 + cor \<bar>Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))\<bar>) = B * cnj B * cor ((cmod B)\<^sup>2)

goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
have "... = (cmod B)\<^sup>2 * cnj ((cmod B)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B * cnj B * cor ((cmod B)\<^sup>2) = cor ((cmod B)\<^sup>2) * cnj (cor ((cmod B)\<^sup>2))
[PROOF STEP]
using complex_cnj_complex_of_real complex_mult_cnj_cmod
[PROOF STATE]
proof (prove)
using this:
cnj (cor ?x) = cor ?x
?z * cnj ?z = cor ((cmod ?z)\<^sup>2)

goal (1 subgoal):
 1. B * cnj B * cor ((cmod B)\<^sup>2) = cor ((cmod B)\<^sup>2) * cnj (cor ((cmod B)\<^sup>2))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
B * cnj B * cor ((cmod B)\<^sup>2) = cor ((cmod B)\<^sup>2) * cnj (cor ((cmod B)\<^sup>2))

goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * cnj (B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))) = cor ((cmod B)\<^sup>2) * cnj (cor ((cmod B)\<^sup>2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * cnj (B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))) = cor ((cmod B)\<^sup>2) * cnj (cor ((cmod B)\<^sup>2))

goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * cnj (B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))) = cor ((cmod B)\<^sup>2) * cnj (cor ((cmod B)\<^sup>2))
is_real A
(cmod A)\<^sup>2 < (cmod B)\<^sup>2
(z1, z2) = calc_ideal_point2_cvec A B

goal (1 subgoal):
 1. z1 * cnj z1 = z2 * cnj z2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
z1 * cnj z1 = z2 * cnj z2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_of_int_div4: "real_of_int (n div x) \<le> real_of_int n / real_of_int x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (n div x) \<le> real_of_int n / real_of_int x
[PROOF STEP]
using real_of_int_div2 [of n x]
[PROOF STATE]
proof (prove)
using this:
0 \<le> real_of_int n / real_of_int x - real_of_int (n div x)

goal (1 subgoal):
 1. real_of_int (n div x) \<le> real_of_int n / real_of_int x
[PROOF STEP]
by simp


[STATEMENT]
lemma closed_real_abs_le: "closed {w \<in> \<real>. \<bar>Re w\<bar> \<le> r}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {w \<in> \<real>. \<bar>Re w\<bar> \<le> r}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed {w \<in> \<real>. \<bar>Re w\<bar> \<le> r}
[PROOF STEP]
have "{w \<in> \<real>. \<bar>Re w\<bar> \<le> r} = (\<real> \<inter> {w. Re w \<le> r}) \<inter> (\<real> \<inter> {w. Re w \<ge> -r})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {w \<in> \<real>. \<bar>Re w\<bar> \<le> r} = \<real> \<inter> {w. Re w \<le> r} \<inter> (\<real> \<inter> {w. - r \<le> Re w})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{w \<in> \<real>. \<bar>Re w\<bar> \<le> r} = \<real> \<inter> {w. Re w \<le> r} \<inter> (\<real> \<inter> {w. - r \<le> Re w})

goal (1 subgoal):
 1. closed {w \<in> \<real>. \<bar>Re w\<bar> \<le> r}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{w \<in> \<real>. \<bar>Re w\<bar> \<le> r} = \<real> \<inter> {w. Re w \<le> r} \<inter> (\<real> \<inter> {w. - r \<le> Re w})
[PROOF STEP]
show "closed {w \<in> \<real>. \<bar>Re w\<bar> \<le> r}"
[PROOF STATE]
proof (prove)
using this:
{w \<in> \<real>. \<bar>Re w\<bar> \<le> r} = \<real> \<inter> {w. Re w \<le> r} \<inter> (\<real> \<inter> {w. - r \<le> Re w})

goal (1 subgoal):
 1. closed {w \<in> \<real>. \<bar>Re w\<bar> \<le> r}
[PROOF STEP]
by (simp add: closed_Int closed_Real_halfspace_Re_ge closed_Real_halfspace_Re_le)
[PROOF STATE]
proof (state)
this:
closed {w \<in> \<real>. \<bar>Re w\<bar> \<le> r}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linear_inj_bounded_below_pos:
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::euclidean_space"
  assumes "linear f" "inj f"
  obtains B where "B > 0" "\<And>x. B * norm x \<le> norm(f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<And>x. B * norm x \<le> norm (f x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using linear_injective_left_inverse [OF assms]
    linear_invertible_bounded_below_pos assms
[PROOF STATE]
proof (prove)
using this:
\<exists>g. linear g \<and> g \<circ> f = id
\<lbrakk>linear ?f; linear ?g; ?g \<circ> ?f = id; \<And>B. \<lbrakk>0 < B; \<And>x. B * norm x \<le> norm (?f x)\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
linear f
inj f

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<And>x. B * norm x \<le> norm (f x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast


[STATEMENT]
lemma X_plus_sub_deg:
  assumes "a \<in> carrier R"
  assumes "f \<in> carrier P"
  shows "degree (f of (X_plus a)) = degree f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deg R (Cring_Poly.compose R f (X_poly_plus R a)) = deg R f
[PROOF STEP]
apply(cases "\<one> = \<zero>")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<one> = \<zero> \<Longrightarrow> deg R (Cring_Poly.compose R f (X_poly_plus R a)) = deg R f
 2. \<one> \<noteq> \<zero> \<Longrightarrow> deg R (Cring_Poly.compose R f (X_poly_plus R a)) = deg R f
[PROOF STEP]
apply (metis P_def UP_one_closed X_plus_closed X_poly_def sub_X assms(1) assms(2) deg_one monom_one monom_zero sub_const)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<one> \<noteq> \<zero> \<Longrightarrow> deg R (Cring_Poly.compose R f (X_poly_plus R a)) = deg R f
[PROOF STEP]
using cring_sub_deg[of "X_plus a" f] assms X_plus_closed[of a] lcf_of_X_plus[of a]
        ltrm_of_X_plus degree_of_X_plus[of a] P_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>X_poly_plus R a \<in> carrier P; f \<in> carrier P; f (deg R f) \<otimes> X_poly_plus R a (deg R (X_poly_plus R a)) [^] deg R f \<noteq> \<zero>\<rbrakk> \<Longrightarrow> deg R (Cring_Poly.compose R f (X_poly_plus R a)) = deg R f * deg R (X_poly_plus R a)
a \<in> carrier R
f \<in> carrier P
a \<in> carrier R \<Longrightarrow> X_poly_plus R a \<in> carrier P
\<lbrakk>a \<in> carrier R; \<one> \<noteq> \<zero>\<rbrakk> \<Longrightarrow> X_poly_plus R a (deg R (X_poly_plus R a)) = \<one>
\<lbrakk>?a \<in> carrier R; \<one> \<noteq> \<zero>\<rbrakk> \<Longrightarrow> monom P (X_poly_plus R ?a (deg R (X_poly_plus R ?a))) (deg R (X_poly_plus R ?a)) = X_poly R
\<lbrakk>a \<in> carrier R; \<one> \<noteq> \<zero>\<rbrakk> \<Longrightarrow> deg R (X_poly_plus R a) = 1
P \<equiv> UP R

goal (1 subgoal):
 1. \<one> \<noteq> \<zero> \<Longrightarrow> deg R (Cring_Poly.compose R f (X_poly_plus R a)) = deg R f
[PROOF STEP]
by (metis lcf_eq R.nat_pow_one R.r_one UP_cring.cring_sub_deg UP_cring_axioms X_closed X_sub
      cfs_closed coeff_simp deg_nzero_nzero degree_X lcoeff_nonzero2 sub_const)


[STATEMENT]
lemma Gamma_real_strict_mono:
  assumes "x \<ge> 3/2" "x < y"
  shows   "Gamma (x :: real) < Gamma y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gamma x < Gamma y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Gamma x < Gamma y
[PROOF STEP]
from Gamma_real_pos_exp[of x] assms
[PROOF STATE]
proof (chain)
picking this:
0 < x \<Longrightarrow> Gamma x = exp (ln_Gamma x)
3 / 2 \<le> x
x < y
[PROOF STEP]
have "Gamma x = exp (ln_Gamma x)"
[PROOF STATE]
proof (prove)
using this:
0 < x \<Longrightarrow> Gamma x = exp (ln_Gamma x)
3 / 2 \<le> x
x < y

goal (1 subgoal):
 1. Gamma x = exp (ln_Gamma x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Gamma x = exp (ln_Gamma x)

goal (1 subgoal):
 1. Gamma x < Gamma y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Gamma x = exp (ln_Gamma x)

goal (1 subgoal):
 1. Gamma x < Gamma y
[PROOF STEP]
have "\<dots> < exp (ln_Gamma y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (ln_Gamma x) < exp (ln_Gamma y)
[PROOF STEP]
by (intro exp_less_mono ln_Gamma_real_strict_mono assms)
[PROOF STATE]
proof (state)
this:
exp (ln_Gamma x) < exp (ln_Gamma y)

goal (1 subgoal):
 1. Gamma x < Gamma y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
exp (ln_Gamma x) < exp (ln_Gamma y)

goal (1 subgoal):
 1. Gamma x < Gamma y
[PROOF STEP]
from Gamma_real_pos_exp[of y] assms
[PROOF STATE]
proof (chain)
picking this:
0 < y \<Longrightarrow> Gamma y = exp (ln_Gamma y)
3 / 2 \<le> x
x < y
[PROOF STEP]
have "\<dots> = Gamma y"
[PROOF STATE]
proof (prove)
using this:
0 < y \<Longrightarrow> Gamma y = exp (ln_Gamma y)
3 / 2 \<le> x
x < y

goal (1 subgoal):
 1. exp (ln_Gamma y) = Gamma y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
exp (ln_Gamma y) = Gamma y

goal (1 subgoal):
 1. Gamma x < Gamma y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Gamma x < Gamma y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Gamma x < Gamma y

goal (1 subgoal):
 1. Gamma x < Gamma y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Gamma x < Gamma y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) derived_set_in_carrier:
  assumes "H \<subseteq> carrier G" shows "derived_set G H \<subseteq> carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. derived_set G H \<subseteq> carrier G
[PROOF STEP]
using derived_set_incl[OF assms subgroup_self]
[PROOF STATE]
proof (prove)
using this:
derived_set G H \<subseteq> carrier G

goal (1 subgoal):
 1. derived_set G H \<subseteq> carrier G
[PROOF STEP]
.


[STATEMENT]
lemma ind_in_set_bound:
  fixes A :: "nat set" and M N :: "nat"
  assumes "N \<ge> M"
  shows "ind_in_set A N \<notin> (ind_in_set A ` ({0..<M} \<inter> A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ind_in_set A N \<notin> ind_in_set A ` ({0..<M} \<inter> A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ind_in_set A N \<notin> ind_in_set A ` ({0..<M} \<inter> A)
[PROOF STEP]
have "{0..<M}\<inter>A \<subseteq> {i. i \<in> A \<and> i < N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<M} \<inter> A \<subseteq> {i \<in> A. i < N}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
M \<le> N

goal (1 subgoal):
 1. {0..<M} \<inter> A \<subseteq> {i \<in> A. i < N}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<M} \<inter> A \<subseteq> {i \<in> A. i < N}

goal (1 subgoal):
 1. ind_in_set A N \<notin> ind_in_set A ` ({0..<M} \<inter> A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{0..<M} \<inter> A \<subseteq> {i \<in> A. i < N}
[PROOF STEP]
have "card ({0..<M}\<inter>A) \<le> card {i. i \<in> A \<and> i < N}"
[PROOF STATE]
proof (prove)
using this:
{0..<M} \<inter> A \<subseteq> {i \<in> A. i < N}

goal (1 subgoal):
 1. card ({0..<M} \<inter> A) \<le> card {i \<in> A. i < N}
[PROOF STEP]
using card_mono[of "{i. i \<in> A \<and> i < N}"]
[PROOF STATE]
proof (prove)
using this:
{0..<M} \<inter> A \<subseteq> {i \<in> A. i < N}
\<lbrakk>finite {i \<in> A. i < N}; ?A \<subseteq> {i \<in> A. i < N}\<rbrakk> \<Longrightarrow> card ?A \<le> card {i \<in> A. i < N}

goal (1 subgoal):
 1. card ({0..<M} \<inter> A) \<le> card {i \<in> A. i < N}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card ({0..<M} \<inter> A) \<le> card {i \<in> A. i < N}

goal (1 subgoal):
 1. ind_in_set A N \<notin> ind_in_set A ` ({0..<M} \<inter> A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card ({0..<M} \<inter> A) \<le> card {i \<in> A. i < N}

goal (1 subgoal):
 1. ind_in_set A N \<notin> ind_in_set A ` ({0..<M} \<inter> A)
[PROOF STEP]
have "ind_in_set A N = card {i. i \<in> A \<and> i < N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ind_in_set A N = card {i \<in> A. i < N}
[PROOF STEP]
unfolding ind_in_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i \<in> A. i < N} = card {i \<in> A. i < N}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ind_in_set A N = card {i \<in> A. i < N}

goal (1 subgoal):
 1. ind_in_set A N \<notin> ind_in_set A ` ({0..<M} \<inter> A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card ({0..<M} \<inter> A) \<le> card {i \<in> A. i < N}
ind_in_set A N = card {i \<in> A. i < N}
[PROOF STEP]
have "ind_in_set A N \<ge> card ({0..<M}\<inter>A)"
[PROOF STATE]
proof (prove)
using this:
card ({0..<M} \<inter> A) \<le> card {i \<in> A. i < N}
ind_in_set A N = card {i \<in> A. i < N}

goal (1 subgoal):
 1. card ({0..<M} \<inter> A) \<le> ind_in_set A N
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card ({0..<M} \<inter> A) \<le> ind_in_set A N

goal (1 subgoal):
 1. ind_in_set A N \<notin> ind_in_set A ` ({0..<M} \<inter> A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card ({0..<M} \<inter> A) \<le> ind_in_set A N

goal (1 subgoal):
 1. ind_in_set A N \<notin> ind_in_set A ` ({0..<M} \<inter> A)
[PROOF STEP]
have "y \<in> ind_in_set A ` (A \<inter> {0..<M}) \<Longrightarrow> y < card ({0..<M}\<inter>A)" for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> ind_in_set A ` (A \<inter> {0..<M}) \<Longrightarrow> y < card ({0..<M} \<inter> A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<in> ind_in_set A ` (A \<inter> {0..<M}) \<Longrightarrow> y < card ({0..<M} \<inter> A)
[PROOF STEP]
let ?dom = "{0..<M} \<inter> A"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<in> ind_in_set A ` (A \<inter> {0..<M}) \<Longrightarrow> y < card ({0..<M} \<inter> A)
[PROOF STEP]
assume "y \<in> ind_in_set A ` (A \<inter> {0..<M})"
[PROOF STATE]
proof (state)
this:
y \<in> ind_in_set A ` (A \<inter> {0..<M})

goal (1 subgoal):
 1. y \<in> ind_in_set A ` (A \<inter> {0..<M}) \<Longrightarrow> y < card ({0..<M} \<inter> A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> ind_in_set A ` (A \<inter> {0..<M})
[PROOF STEP]
obtain x where x: "x \<in> ?dom" and y: "ind_in_set A x = y"
[PROOF STATE]
proof (prove)
using this:
y \<in> ind_in_set A ` (A \<inter> {0..<M})

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> {0..<M} \<inter> A; ind_in_set A x = y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> {0..<M} \<inter> A
ind_in_set A x = y

goal (1 subgoal):
 1. y \<in> ind_in_set A ` (A \<inter> {0..<M}) \<Longrightarrow> y < card ({0..<M} \<inter> A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> {0..<M} \<inter> A
ind_in_set A x = y
[PROOF STEP]
have "(y \<in> A \<and> y < x) = (y \<in> ?dom \<and> y < x)" for y
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..<M} \<inter> A
ind_in_set A x = y__

goal (1 subgoal):
 1. (y \<in> A \<and> y < x) = (y \<in> {0..<M} \<inter> A \<and> y < x)
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..<M} \<inter> A
ind_in_set A x = y__
x \<in> {0..<M} \<inter> A

goal (1 subgoal):
 1. (y \<in> A \<and> y < x) = (y \<in> {0..<M} \<inter> A \<and> y < x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(?y \<in> A \<and> ?y < x) = (?y \<in> {0..<M} \<inter> A \<and> ?y < x)

goal (1 subgoal):
 1. y \<in> ind_in_set A ` (A \<inter> {0..<M}) \<Longrightarrow> y < card ({0..<M} \<inter> A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(?y \<in> A \<and> ?y < x) = (?y \<in> {0..<M} \<inter> A \<and> ?y < x)
[PROOF STEP]
have "card {y. y \<in> A \<and> y < x} = card {y. y \<in> ?dom \<and> y < x}"
[PROOF STATE]
proof (prove)
using this:
(?y \<in> A \<and> ?y < x) = (?y \<in> {0..<M} \<inter> A \<and> ?y < x)

goal (1 subgoal):
 1. card {y \<in> A. y < x} = card {y \<in> {0..<M} \<inter> A. y < x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {y \<in> A. y < x} = card {y \<in> {0..<M} \<inter> A. y < x}

goal (1 subgoal):
 1. y \<in> ind_in_set A ` (A \<inter> {0..<M}) \<Longrightarrow> y < card ({0..<M} \<inter> A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card {y \<in> A. y < x} = card {y \<in> {0..<M} \<inter> A. y < x}

goal (1 subgoal):
 1. y \<in> ind_in_set A ` (A \<inter> {0..<M}) \<Longrightarrow> y < card ({0..<M} \<inter> A)
[PROOF STEP]
have "card {y. y \<in> ?dom \<and> y < x} < card ?dom"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {y \<in> {0..<M} \<inter> A. y < x} < card ({0..<M} \<inter> A)
[PROOF STEP]
using x lt_set_card_lt[of ?dom]
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..<M} \<inter> A
\<lbrakk>finite ({0..<M} \<inter> A); ?x \<in> {0..<M} \<inter> A\<rbrakk> \<Longrightarrow> card {y \<in> {0..<M} \<inter> A. y < ?x} < card ({0..<M} \<inter> A)

goal (1 subgoal):
 1. card {y \<in> {0..<M} \<inter> A. y < x} < card ({0..<M} \<inter> A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {y \<in> {0..<M} \<inter> A. y < x} < card ({0..<M} \<inter> A)

goal (1 subgoal):
 1. y \<in> ind_in_set A ` (A \<inter> {0..<M}) \<Longrightarrow> y < card ({0..<M} \<inter> A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card {y \<in> A. y < x} = card {y \<in> {0..<M} \<inter> A. y < x}
card {y \<in> {0..<M} \<inter> A. y < x} < card ({0..<M} \<inter> A)
[PROOF STEP]
show "y < card ({0..<M}\<inter>A)"
[PROOF STATE]
proof (prove)
using this:
card {y \<in> A. y < x} = card {y \<in> {0..<M} \<inter> A. y < x}
card {y \<in> {0..<M} \<inter> A. y < x} < card ({0..<M} \<inter> A)

goal (1 subgoal):
 1. y < card ({0..<M} \<inter> A)
[PROOF STEP]
using y
[PROOF STATE]
proof (prove)
using this:
card {y \<in> A. y < x} = card {y \<in> {0..<M} \<inter> A. y < x}
card {y \<in> {0..<M} \<inter> A. y < x} < card ({0..<M} \<inter> A)
ind_in_set A x = y

goal (1 subgoal):
 1. y < card ({0..<M} \<inter> A)
[PROOF STEP]
unfolding ind_in_set_def
[PROOF STATE]
proof (prove)
using this:
card {y \<in> A. y < x} = card {y \<in> {0..<M} \<inter> A. y < x}
card {y \<in> {0..<M} \<inter> A. y < x} < card ({0..<M} \<inter> A)
card {i \<in> A. i < x} = y

goal (1 subgoal):
 1. y < card ({0..<M} \<inter> A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y < card ({0..<M} \<inter> A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?y \<in> ind_in_set A ` (A \<inter> {0..<M}) \<Longrightarrow> ?y < card ({0..<M} \<inter> A)

goal (1 subgoal):
 1. ind_in_set A N \<notin> ind_in_set A ` ({0..<M} \<inter> A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card ({0..<M} \<inter> A) \<le> ind_in_set A N
?y \<in> ind_in_set A ` (A \<inter> {0..<M}) \<Longrightarrow> ?y < card ({0..<M} \<inter> A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card ({0..<M} \<inter> A) \<le> ind_in_set A N
?y \<in> ind_in_set A ` (A \<inter> {0..<M}) \<Longrightarrow> ?y < card ({0..<M} \<inter> A)

goal (1 subgoal):
 1. ind_in_set A N \<notin> ind_in_set A ` ({0..<M} \<inter> A)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
ind_in_set A N \<notin> ind_in_set A ` ({0..<M} \<inter> A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma winding_number_pos_le:
  assumes \<gamma>: "valid_path \<gamma>" "z \<notin> path_image \<gamma>"
      and ge: "\<And>x. \<lbrakk>0 < x; x < 1\<rbrakk> \<Longrightarrow> 0 \<le> Im (vector_derivative \<gamma> (at x) * cnj(\<gamma> x - z))"
    shows "0 \<le> Re(winding_number \<gamma> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> Re (winding_number \<gamma> z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> Re (winding_number \<gamma> z)
[PROOF STEP]
have ge0: "0 \<le> Im (vector_derivative \<gamma> (at x) / (\<gamma> x - z))" if x: "0 < x" "x < 1" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> Im (vector_derivative \<gamma> (at x) / (\<gamma> x - z))
[PROOF STEP]
using ge
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?x; ?x < 1\<rbrakk> \<Longrightarrow> 0 \<le> Im (vector_derivative \<gamma> (at ?x) * cnj (\<gamma> ?x - z))

goal (1 subgoal):
 1. 0 \<le> Im (vector_derivative \<gamma> (at x) / (\<gamma> x - z))
[PROOF STEP]
by (simp add: Complex.Im_divide algebra_simps x)
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < ?x; ?x < 1\<rbrakk> \<Longrightarrow> 0 \<le> Im (vector_derivative \<gamma> (at ?x) / (\<gamma> ?x - z))

goal (1 subgoal):
 1. 0 \<le> Re (winding_number \<gamma> z)
[PROOF STEP]
let ?vd = "\<lambda>x. 1 / (\<gamma> x - z) * vector_derivative \<gamma> (at x)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> Re (winding_number \<gamma> z)
[PROOF STEP]
let ?int = "\<lambda>z. contour_integral \<gamma> (\<lambda>w. 1 / (w - z))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> Re (winding_number \<gamma> z)
[PROOF STEP]
have "0 \<le> Im (?int z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> Im (contour_integral \<gamma> (\<lambda>w. 1 / (w - z)))
[PROOF STEP]
proof (rule has_integral_component_nonneg [of \<i>, simplified])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (?f has_integral contour_integral \<gamma> (\<lambda>w. 1 / (w - z))) ?S
 2. \<And>x. x \<in> ?S \<Longrightarrow> 0 \<le> Im (?f x)
[PROOF STEP]
show "\<And>x. x \<in> cbox 0 1 \<Longrightarrow> 0 \<le> Im (if 0 < x \<and> x < 1 then ?vd x else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> cbox 0 1 \<Longrightarrow> 0 \<le> Im (if 0 < x \<and> x < 1 then 1 / (\<gamma> x - z) * vector_derivative \<gamma> (at x) else 0)
[PROOF STEP]
by (force simp: ge0)
[PROOF STATE]
proof (state)
this:
?x \<in> cbox 0 1 \<Longrightarrow> 0 \<le> Im (if 0 < ?x \<and> ?x < 1 then 1 / (\<gamma> ?x - z) * vector_derivative \<gamma> (at ?x) else 0)

goal (1 subgoal):
 1. ((\<lambda>x. if 0 < x \<and> x < 1 then 1 / (\<gamma> x - z) * vector_derivative \<gamma> (at x) else 0) has_integral contour_integral \<gamma> (\<lambda>w. 1 / (w - z))) (cbox 0 1)
[PROOF STEP]
have "((\<lambda>a. 1 / (a - z)) has_contour_integral contour_integral \<gamma> (\<lambda>w. 1 / (w - z))) \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>a. 1 / (a - z)) has_contour_integral contour_integral \<gamma> (\<lambda>w. 1 / (w - z))) \<gamma>
[PROOF STEP]
using \<gamma>
[PROOF STATE]
proof (prove)
using this:
valid_path \<gamma>
z \<notin> path_image \<gamma>

goal (1 subgoal):
 1. ((\<lambda>a. 1 / (a - z)) has_contour_integral contour_integral \<gamma> (\<lambda>w. 1 / (w - z))) \<gamma>
[PROOF STEP]
by (simp flip: add: contour_integrable_inversediff has_contour_integral_integral)
[PROOF STATE]
proof (state)
this:
((\<lambda>a. 1 / (a - z)) has_contour_integral contour_integral \<gamma> (\<lambda>w. 1 / (w - z))) \<gamma>

goal (1 subgoal):
 1. ((\<lambda>x. if 0 < x \<and> x < 1 then 1 / (\<gamma> x - z) * vector_derivative \<gamma> (at x) else 0) has_integral contour_integral \<gamma> (\<lambda>w. 1 / (w - z))) (cbox 0 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>a. 1 / (a - z)) has_contour_integral contour_integral \<gamma> (\<lambda>w. 1 / (w - z))) \<gamma>
[PROOF STEP]
have hi: "(?vd has_integral ?int z) (cbox 0 1)"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>a. 1 / (a - z)) has_contour_integral contour_integral \<gamma> (\<lambda>w. 1 / (w - z))) \<gamma>

goal (1 subgoal):
 1. ((\<lambda>x. 1 / (\<gamma> x - z) * vector_derivative \<gamma> (at x)) has_integral contour_integral \<gamma> (\<lambda>w. 1 / (w - z))) (cbox 0 1)
[PROOF STEP]
using has_contour_integral
[PROOF STATE]
proof (prove)
using this:
((\<lambda>a. 1 / (a - z)) has_contour_integral contour_integral \<gamma> (\<lambda>w. 1 / (w - z))) \<gamma>
(?f has_contour_integral ?i) ?g = ((\<lambda>x. ?f (?g x) * vector_derivative ?g (at x)) has_integral ?i) {0..1}

goal (1 subgoal):
 1. ((\<lambda>x. 1 / (\<gamma> x - z) * vector_derivative \<gamma> (at x)) has_integral contour_integral \<gamma> (\<lambda>w. 1 / (w - z))) (cbox 0 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. 1 / (\<gamma> x - z) * vector_derivative \<gamma> (at x)) has_integral contour_integral \<gamma> (\<lambda>w. 1 / (w - z))) (cbox 0 1)

goal (1 subgoal):
 1. ((\<lambda>x. if 0 < x \<and> x < 1 then 1 / (\<gamma> x - z) * vector_derivative \<gamma> (at x) else 0) has_integral contour_integral \<gamma> (\<lambda>w. 1 / (w - z))) (cbox 0 1)
[PROOF STEP]
show "((\<lambda>x. if 0 < x \<and> x < 1 then ?vd x else 0) has_integral ?int z) (cbox 0 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. if 0 < x \<and> x < 1 then 1 / (\<gamma> x - z) * vector_derivative \<gamma> (at x) else 0) has_integral contour_integral \<gamma> (\<lambda>w. 1 / (w - z))) (cbox 0 1)
[PROOF STEP]
by (rule has_integral_spike_interior [OF hi]) simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. if 0 < x \<and> x < 1 then 1 / (\<gamma> x - z) * vector_derivative \<gamma> (at x) else 0) has_integral contour_integral \<gamma> (\<lambda>w. 1 / (w - z))) (cbox 0 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 \<le> Im (contour_integral \<gamma> (\<lambda>w. 1 / (w - z)))

goal (1 subgoal):
 1. 0 \<le> Re (winding_number \<gamma> z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> Im (contour_integral \<gamma> (\<lambda>w. 1 / (w - z)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> Im (contour_integral \<gamma> (\<lambda>w. 1 / (w - z)))

goal (1 subgoal):
 1. 0 \<le> Re (winding_number \<gamma> z)
[PROOF STEP]
by (simp add: Re_winding_number [OF \<gamma>] field_simps)
[PROOF STATE]
proof (state)
this:
0 \<le> Re (winding_number \<gamma> z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma filterlim_at_top_choose_lower:
  assumes "filterlim s at_top sequentially"
  assumes "(f \<circ> s) \<longlonglongrightarrow> l"
  obtains t where
    "filterlim t at_top sequentially"
    "(f \<circ> t) \<longlonglongrightarrow> l"
    "\<forall>n. t n \<ge> (b::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>t. \<lbrakk>filterlim t at_top sequentially; (f \<circ> t) \<longlonglongrightarrow> l; \<forall>n. b \<le> t n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>t. \<lbrakk>filterlim t at_top sequentially; (f \<circ> t) \<longlonglongrightarrow> l; \<forall>n. b \<le> t n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain k where k: "\<forall>n \<ge> k. s n \<ge> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. \<forall>n\<ge>k. b \<le> s n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
filterlim s at_top sequentially

goal (1 subgoal):
 1. (\<And>k. \<forall>n\<ge>k. b \<le> s n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding filterlim_at_top eventually_sequentially
[PROOF STATE]
proof (prove)
using this:
\<forall>Z. \<exists>N. \<forall>n\<ge>N. Z \<le> s n

goal (1 subgoal):
 1. (\<And>k. \<forall>n\<ge>k. b \<le> s n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>n\<ge>k. b \<le> s n

goal (1 subgoal):
 1. (\<And>t. \<lbrakk>filterlim t at_top sequentially; (f \<circ> t) \<longlonglongrightarrow> l; \<forall>n. b \<le> t n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define t where "t = (\<lambda>n. s (n+k))"
[PROOF STATE]
proof (state)
this:
t = (\<lambda>n. s (n + k))

goal (1 subgoal):
 1. (\<And>t. \<lbrakk>filterlim t at_top sequentially; (f \<circ> t) \<longlonglongrightarrow> l; \<forall>n. b \<le> t n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t = (\<lambda>n. s (n + k))
[PROOF STEP]
have "\<forall>n. t n \<ge> b"
[PROOF STATE]
proof (prove)
using this:
t = (\<lambda>n. s (n + k))

goal (1 subgoal):
 1. \<forall>n. b \<le> t n
[PROOF STEP]
using k
[PROOF STATE]
proof (prove)
using this:
t = (\<lambda>n. s (n + k))
\<forall>n\<ge>k. b \<le> s n

goal (1 subgoal):
 1. \<forall>n. b \<le> t n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>n. b \<le> t n

goal (1 subgoal):
 1. (\<And>t. \<lbrakk>filterlim t at_top sequentially; (f \<circ> t) \<longlonglongrightarrow> l; \<forall>n. b \<le> t n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "filterlim t at_top sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim t at_top sequentially
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
filterlim s at_top sequentially

goal (1 subgoal):
 1. filterlim t at_top sequentially
[PROOF STEP]
unfolding filterlim_at_top eventually_sequentially t_def
[PROOF STATE]
proof (prove)
using this:
\<forall>Z. \<exists>N. \<forall>n\<ge>N. Z \<le> s n

goal (1 subgoal):
 1. \<forall>Z. \<exists>N. \<forall>n\<ge>N. Z \<le> s (n + k)
[PROOF STEP]
by (metis (full_types) add.commute trans_le_add2)
[PROOF STATE]
proof (state)
this:
filterlim t at_top sequentially

goal (1 subgoal):
 1. (\<And>t. \<lbrakk>filterlim t at_top sequentially; (f \<circ> t) \<longlonglongrightarrow> l; \<forall>n. b \<le> t n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from LIMSEQ_ignore_initial_segment[OF assms(2), of "k"]
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. (f \<circ> s) (n + k)) \<longlonglongrightarrow> l
[PROOF STEP]
have "(\<lambda>n. (f \<circ> s) (n + k)) \<longlonglongrightarrow> l"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (f \<circ> s) (n + k)) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<lambda>n. (f \<circ> s) (n + k)) \<longlonglongrightarrow> l
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (f \<circ> s) (n + k)) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<And>t. \<lbrakk>filterlim t at_top sequentially; (f \<circ> t) \<longlonglongrightarrow> l; \<forall>n. b \<le> t n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. (f \<circ> s) (n + k)) \<longlonglongrightarrow> l
[PROOF STEP]
have "(f \<circ> t) \<longlonglongrightarrow> l"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (f \<circ> s) (n + k)) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (f \<circ> t) \<longlonglongrightarrow> l
[PROOF STEP]
unfolding t_def o_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. f (s (n + k))) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<lambda>x. f (s (x + k))) \<longlonglongrightarrow> l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(f \<circ> t) \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<And>t. \<lbrakk>filterlim t at_top sequentially; (f \<circ> t) \<longlonglongrightarrow> l; \<forall>n. b \<le> t n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
using \<open>(f \<circ> t) \<longlonglongrightarrow> l\<close> \<open>\<forall>n. b \<le> t n\<close> \<open>filterlim t at_top sequentially\<close> that
[PROOF STATE]
proof (prove)
using this:
(f \<circ> t) \<longlonglongrightarrow> l
\<forall>n. b \<le> t n
filterlim t at_top sequentially
\<lbrakk>filterlim ?t at_top sequentially; (f \<circ> ?t) \<longlonglongrightarrow> l; \<forall>n. b \<le> ?t n\<rbrakk> \<Longrightarrow> thesis

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_gen_shleg_poly [simp]: "degree (gen_shleg_poly k) = 2 * n - k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (local.gen_shleg_poly k) = 2 * n - k
[PROOF STEP]
by (simp add: gen_shleg_poly_def degree_higher_pderiv degree_power_eq)


[STATEMENT]
lemma gcd_proj2_iff: "gcd m n = normalize n \<longleftrightarrow> n dvd m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (gcd m n = normalize n) = (n dvd m)
[PROOF STEP]
using gcd_proj1_iff [of n m]
[PROOF STATE]
proof (prove)
using this:
(gcd n m = normalize n) = (n dvd m)

goal (1 subgoal):
 1. (gcd m n = normalize n) = (n dvd m)
[PROOF STEP]
by (simp add: ac_simps)


[STATEMENT]
lemma gauss_int_norm_dvd_mono:
  assumes "a dvd b"
  shows "gauss_int_norm a dvd gauss_int_norm b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gauss_int_norm a dvd gauss_int_norm b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gauss_int_norm a dvd gauss_int_norm b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
a dvd b
[PROOF STEP]
obtain c where "b = a * c"
[PROOF STATE]
proof (prove)
using this:
a dvd b

goal (1 subgoal):
 1. (\<And>c. b = a * c \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b = a * c

goal (1 subgoal):
 1. gauss_int_norm a dvd gauss_int_norm b
[PROOF STEP]
hence "gauss_int_norm b = gauss_int_norm (a * c)"
[PROOF STATE]
proof (prove)
using this:
b = a * c

goal (1 subgoal):
 1. gauss_int_norm b = gauss_int_norm (a * c)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
gauss_int_norm b = gauss_int_norm (a * c)

goal (1 subgoal):
 1. gauss_int_norm a dvd gauss_int_norm b
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
gauss_int_norm b = gauss_int_norm (a * c)

goal (1 subgoal):
 1. gauss_int_norm a dvd gauss_int_norm b
[PROOF STEP]
by (simp add: gauss_int_norm_mult)
[PROOF STATE]
proof (state)
this:
gauss_int_norm a dvd gauss_int_norm b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma chamber_distance_map:
  assumes "domain.chamber C" "domain.chamber D"
  shows   "codomain.chamber_distance (f`C) (f`D) =
            domain.chamber_distance C D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
proof (cases "f`C=f`D")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f ` C = f ` D \<Longrightarrow> codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
 2. f ` C \<noteq> f ` D \<Longrightarrow> codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f ` C = f ` D

goal (2 subgoals):
 1. f ` C = f ` D \<Longrightarrow> codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
 2. f ` C \<noteq> f ` D \<Longrightarrow> codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f ` C = f ` D

goal (2 subgoals):
 1. f ` C = f ` D \<Longrightarrow> codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
 2. f ` C \<noteq> f ` D \<Longrightarrow> codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
domain.chamber C
domain.chamber D
f ` C = f ` D
[PROOF STEP]
have "C=D"
[PROOF STATE]
proof (prove)
using this:
domain.chamber C
domain.chamber D
f ` C = f ` D

goal (1 subgoal):
 1. C = D
[PROOF STEP]
using inj_onD[OF inj_on_chamber_system] domain.chamber_system_def
[PROOF STATE]
proof (prove)
using this:
domain.chamber C
domain.chamber D
f ` C = f ` D
\<lbrakk>f ` ?x = f ` ?y; ?x \<in> domain.\<C>; ?y \<in> domain.\<C>\<rbrakk> \<Longrightarrow> ?x = ?y
domain.\<C> \<equiv> Collect domain.chamber

goal (1 subgoal):
 1. C = D
[PROOF STEP]
by    simp
[PROOF STATE]
proof (state)
this:
C = D

goal (2 subgoals):
 1. f ` C = f ` D \<Longrightarrow> codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
 2. f ` C \<noteq> f ` D \<Longrightarrow> codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f ` C = f ` D
C = D
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f ` C = f ` D
C = D

goal (1 subgoal):
 1. codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
using domain.chamber_distance_def codomain.chamber_distance_def
[PROOF STATE]
proof (prove)
using this:
f ` C = f ` D
C = D
domain.chamber_distance ?C ?D = (if ?C = ?D then 0 else Suc (length (ARG_MIN length Cs. domain.gallery (?C # Cs @ [?D]))))
codomain.chamber_distance ?C ?D = (if ?C = ?D then 0 else Suc (length (ARG_MIN length Cs. codomain.gallery (?C # Cs @ [?D]))))

goal (1 subgoal):
 1. codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D

goal (1 subgoal):
 1. f ` C \<noteq> f ` D \<Longrightarrow> codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f ` C \<noteq> f ` D \<Longrightarrow> codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f ` C \<noteq> f ` D

goal (1 subgoal):
 1. f ` C \<noteq> f ` D \<Longrightarrow> codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
define Cs Ds where "Cs = (ARG_MIN length Cs. domain.gallery (C#Cs@[D]))"
    and "Ds = (ARG_MIN length Ds. codomain.gallery (f`C # Ds @ [f`D]))"
[PROOF STATE]
proof (state)
this:
Cs = (ARG_MIN length Cs. domain.gallery (C # Cs @ [D]))
Ds = (ARG_MIN length Ds. codomain.gallery (f ` C # Ds @ [f ` D]))

goal (1 subgoal):
 1. f ` C \<noteq> f ` D \<Longrightarrow> codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
from assms False Cs_def
[PROOF STATE]
proof (chain)
picking this:
domain.chamber C
domain.chamber D
f ` C \<noteq> f ` D
Cs = (ARG_MIN length Cs. domain.gallery (C # Cs @ [D]))
[PROOF STEP]
have "codomain.gallery (f`C # f\<Turnstile>Cs @ [f`D])"
[PROOF STATE]
proof (prove)
using this:
domain.chamber C
domain.chamber D
f ` C \<noteq> f ` D
Cs = (ARG_MIN length Cs. domain.gallery (C # Cs @ [D]))

goal (1 subgoal):
 1. codomain.gallery (f ` C # f \<Turnstile> Cs @ [f ` D])
[PROOF STEP]
using gallery_map domain.maxsimp_connect[of C D]
          arg_min_natI[of "\<lambda>Cs. domain.gallery (C#Cs@[D])"]
[PROOF STATE]
proof (prove)
using this:
domain.chamber C
domain.chamber D
f ` C \<noteq> f ` D
Cs = (ARG_MIN length Cs. domain.gallery (C # Cs @ [D]))
domain.gallery ?Cs \<Longrightarrow> codomain.gallery (f \<Turnstile> ?Cs)
\<lbrakk>C \<noteq> D; domain.chamber C; domain.chamber D\<rbrakk> \<Longrightarrow> \<exists>xs. domain.gallery (C # xs @ [D])
domain.gallery (C # ?k @ [D]) \<Longrightarrow> domain.gallery (C # (ARG_MIN ?m Cs. domain.gallery (C # Cs @ [D])) @ [D])

goal (1 subgoal):
 1. codomain.gallery (f ` C # f \<Turnstile> Cs @ [f ` D])
[PROOF STEP]
by    fastforce
[PROOF STATE]
proof (state)
this:
codomain.gallery (f ` C # f \<Turnstile> Cs @ [f ` D])

goal (1 subgoal):
 1. f ` C \<noteq> f ` D \<Longrightarrow> codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
codomain.gallery (f ` C # f \<Turnstile> Cs @ [f ` D])

goal (1 subgoal):
 1. f ` C \<noteq> f ` D \<Longrightarrow> codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
from assms Cs_def
[PROOF STATE]
proof (chain)
picking this:
domain.chamber C
domain.chamber D
Cs = (ARG_MIN length Cs. domain.gallery (C # Cs @ [D]))
[PROOF STEP]
have  "\<And>Es. codomain.gallery (f`C # Es @ [f`D]) \<Longrightarrow>
            length (f\<Turnstile>Cs) \<le> length Es"
[PROOF STATE]
proof (prove)
using this:
domain.chamber C
domain.chamber D
Cs = (ARG_MIN length Cs. domain.gallery (C # Cs @ [D]))

goal (1 subgoal):
 1. \<And>Es. codomain.gallery (f ` C # Es @ [f ` D]) \<Longrightarrow> length (f \<Turnstile> Cs) \<le> length Es
[PROOF STEP]
using ChamberComplexIsomorphism.gallery_map[OF inv]
          the_inv_into_f_im_f_im[OF inj, of C] the_inv_into_f_im_f_im[OF inj, of D]
          domain.chamberD_simplex[of C] domain.chamberD_simplex[of D]
          domain.maxsimp_connect[of C D]
          arg_min_nat_le[of "\<lambda>Cs. domain.gallery (C#Cs@[D])" _ length]
[PROOF STATE]
proof (prove)
using this:
domain.chamber C
domain.chamber D
Cs = (ARG_MIN length Cs. domain.gallery (C # Cs @ [D]))
codomain.gallery ?Cs \<Longrightarrow> domain.gallery (the_inv_into (\<Union> X) f \<Turnstile> ?Cs)
C \<subseteq> \<Union> X \<Longrightarrow> the_inv_into (\<Union> X) f ` f ` C = C
D \<subseteq> \<Union> X \<Longrightarrow> the_inv_into (\<Union> X) f ` f ` D = D
domain.chamber C \<Longrightarrow> C \<in> X
domain.chamber D \<Longrightarrow> D \<in> X
\<lbrakk>C \<noteq> D; domain.chamber C; domain.chamber D\<rbrakk> \<Longrightarrow> \<exists>xs. domain.gallery (C # xs @ [D])
domain.gallery (C # ?x @ [D]) \<Longrightarrow> length (ARG_MIN length Cs. domain.gallery (C # Cs @ [D])) \<le> length ?x

goal (1 subgoal):
 1. \<And>Es. codomain.gallery (f ` C # Es @ [f ` D]) \<Longrightarrow> length (f \<Turnstile> Cs) \<le> length Es
[PROOF STEP]
by    force
[PROOF STATE]
proof (state)
this:
codomain.gallery (f ` C # ?Es1 @ [f ` D]) \<Longrightarrow> length (f \<Turnstile> Cs) \<le> length ?Es1

goal (1 subgoal):
 1. f ` C \<noteq> f ` D \<Longrightarrow> codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
codomain.gallery (f ` C # f \<Turnstile> Cs @ [f ` D])
codomain.gallery (f ` C # ?Es1 @ [f ` D]) \<Longrightarrow> length (f \<Turnstile> Cs) \<le> length ?Es1
[PROOF STEP]
have "length Ds = length (f\<Turnstile>Cs)"
[PROOF STATE]
proof (prove)
using this:
codomain.gallery (f ` C # f \<Turnstile> Cs @ [f ` D])
codomain.gallery (f ` C # ?Es1 @ [f ` D]) \<Longrightarrow> length (f \<Turnstile> Cs) \<le> length ?Es1

goal (1 subgoal):
 1. length Ds = length (f \<Turnstile> Cs)
[PROOF STEP]
unfolding Ds_def
[PROOF STATE]
proof (prove)
using this:
codomain.gallery (f ` C # f \<Turnstile> Cs @ [f ` D])
codomain.gallery (f ` C # ?Es1 @ [f ` D]) \<Longrightarrow> length (f \<Turnstile> Cs) \<le> length ?Es1

goal (1 subgoal):
 1. length (ARG_MIN length Ds. codomain.gallery (f ` C # Ds @ [f ` D])) = length (f \<Turnstile> Cs)
[PROOF STEP]
by (fast intro: arg_min_equality)
[PROOF STATE]
proof (state)
this:
length Ds = length (f \<Turnstile> Cs)

goal (1 subgoal):
 1. f ` C \<noteq> f ` D \<Longrightarrow> codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
with False Cs_def Ds_def
[PROOF STATE]
proof (chain)
picking this:
f ` C \<noteq> f ` D
Cs = (ARG_MIN length Cs. domain.gallery (C # Cs @ [D]))
Ds = (ARG_MIN length Ds. codomain.gallery (f ` C # Ds @ [f ` D]))
length Ds = length (f \<Turnstile> Cs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f ` C \<noteq> f ` D
Cs = (ARG_MIN length Cs. domain.gallery (C # Cs @ [D]))
Ds = (ARG_MIN length Ds. codomain.gallery (f ` C # Ds @ [f ` D]))
length Ds = length (f \<Turnstile> Cs)

goal (1 subgoal):
 1. codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
using domain.chamber_distance_def codomain.chamber_distance_def
[PROOF STATE]
proof (prove)
using this:
f ` C \<noteq> f ` D
Cs = (ARG_MIN length Cs. domain.gallery (C # Cs @ [D]))
Ds = (ARG_MIN length Ds. codomain.gallery (f ` C # Ds @ [f ` D]))
length Ds = length (f \<Turnstile> Cs)
domain.chamber_distance ?C ?D = (if ?C = ?D then 0 else Suc (length (ARG_MIN length Cs. domain.gallery (?C # Cs @ [?D]))))
codomain.chamber_distance ?C ?D = (if ?C = ?D then 0 else Suc (length (ARG_MIN length Cs. codomain.gallery (?C # Cs @ [?D]))))

goal (1 subgoal):
 1. codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
codomain.chamber_distance (f ` C) (f ` D) = domain.chamber_distance C D

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ldropn_llist_of [simp]: "ldropn n (llist_of xs) = llist_of (drop n xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ldropn n (llist_of xs) = llist_of (drop n xs)
[PROOF STEP]
proof(induct n arbitrary: xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. ldropn 0 (llist_of xs) = llist_of (drop 0 xs)
 2. \<And>n xs. (\<And>xs. ldropn n (llist_of xs) = llist_of (drop n xs)) \<Longrightarrow> ldropn (Suc n) (llist_of xs) = llist_of (drop (Suc n) xs)
[PROOF STEP]
case Suc
[PROOF STATE]
proof (state)
this:
ldropn n_ (llist_of ?xs) = llist_of (drop n_ ?xs)

goal (2 subgoals):
 1. \<And>xs. ldropn 0 (llist_of xs) = llist_of (drop 0 xs)
 2. \<And>n xs. (\<And>xs. ldropn n (llist_of xs) = llist_of (drop n xs)) \<Longrightarrow> ldropn (Suc n) (llist_of xs) = llist_of (drop (Suc n) xs)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
ldropn n_ (llist_of ?xs) = llist_of (drop n_ ?xs)

goal (1 subgoal):
 1. ldropn (Suc n_) (llist_of xs) = llist_of (drop (Suc n_) xs)
[PROOF STEP]
by(cases xs) simp_all
[PROOF STATE]
proof (state)
this:
ldropn (Suc n_) (llist_of xs) = llist_of (drop (Suc n_) xs)

goal (1 subgoal):
 1. \<And>xs. ldropn 0 (llist_of xs) = llist_of (drop 0 xs)
[PROOF STEP]
qed simp


[STATEMENT]
lemma coplanar_perm_9:
  assumes "Coplanar A B C D"
  shows "Coplanar B C D A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Coplanar B C D A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Coplanar B C D A
[PROOF STEP]
obtain X where P1: "(Col A B X \<and> Col C D X) \<or> (Col A C X \<and> Col B D X) \<or> (Col A D X \<and> Col B C X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Coplanar_def assms
[PROOF STATE]
proof (prove)
using this:
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Coplanar A B C D

goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar B C D A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar B C D A
[PROOF STEP]
using Coplanar_def col_permutation_4
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Col ?A ?B ?C \<Longrightarrow> Col ?B ?A ?C

goal (1 subgoal):
 1. Coplanar B C D A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Coplanar B C D A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pt_list_nil:
  fixes xs :: "'a list"
  assumes pt: "pt TYPE('a) TYPE ('x)"
  shows "([]::'x prm)\<bullet>xs = xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [] \<bullet> xs = xs
[PROOF STEP]
apply(induct_tac xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. [] \<bullet> [] = []
 2. \<And>a list. [] \<bullet> list = list \<Longrightarrow> [] \<bullet> (a # list) = a # list
[PROOF STEP]
apply(simp_all add: pt1[OF pt])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma list_head_unaffected:
  assumes "hd (x @ [y, z]) = v"
    shows "hd (x @ [y   ]) = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd (x @ [y]) = v
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
hd (x @ [y, z]) = v

goal (1 subgoal):
 1. hd (x @ [y]) = v
[PROOF STEP]
by (metis hd_append list.sel(1))


[STATEMENT]
lemma rho_psim_carrier:
  shows "rho_psim \<in> carrier_mat 4 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rho_psim \<in> carrier_mat 4 4
[PROOF STEP]
using rank_1_proj_carrier[of ket_psim] ket_psim_dim
    rho_psim_def
[PROOF STATE]
proof (prove)
using this:
rank_1_proj ket_psim \<in> carrier_mat (dim_vec ket_psim) (dim_vec ket_psim)
dim_vec ket_psim = 4
rho_psim = rank_1_proj ket_psim

goal (1 subgoal):
 1. rho_psim \<in> carrier_mat 4 4
[PROOF STEP]
by simp


[STATEMENT]
lemma (in type_definition) univ:
  "UNIV = Abs ` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV = Abs ` A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. UNIV \<subseteq> Abs ` A
 2. Abs ` A \<subseteq> UNIV
[PROOF STEP]
show "Abs ` A \<subseteq> UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs ` A \<subseteq> UNIV
[PROOF STEP]
by (rule subset_UNIV)
[PROOF STATE]
proof (state)
this:
Abs ` A \<subseteq> UNIV

goal (1 subgoal):
 1. UNIV \<subseteq> Abs ` A
[PROOF STEP]
show "UNIV \<subseteq> Abs ` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV \<subseteq> Abs ` A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> x \<in> Abs ` A
[PROOF STEP]
fix x :: 'b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> x \<in> Abs ` A
[PROOF STEP]
have "x = Abs (Rep x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = Abs (Rep x)
[PROOF STEP]
by (rule Rep_inverse [symmetric])
[PROOF STATE]
proof (state)
this:
x = Abs (Rep x)

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> x \<in> Abs ` A
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x = Abs (Rep x)

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> x \<in> Abs ` A
[PROOF STEP]
have "Rep x \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep x \<in> A
[PROOF STEP]
by (rule Rep)
[PROOF STATE]
proof (state)
this:
Rep x \<in> A

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV \<Longrightarrow> x \<in> Abs ` A
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x = Abs (Rep x)
Rep x \<in> A
[PROOF STEP]
show "x \<in> Abs ` A"
[PROOF STATE]
proof (prove)
using this:
x = Abs (Rep x)
Rep x \<in> A

goal (1 subgoal):
 1. x \<in> Abs ` A
[PROOF STEP]
by (rule image_eqI)
[PROOF STATE]
proof (state)
this:
x \<in> Abs ` A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
UNIV \<subseteq> Abs ` A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cd_le: "[| cd x m n; 0<m; 0<n |] ==> x<=m & x<=n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cd x m n; 0 < m; 0 < n\<rbrakk> \<Longrightarrow> x \<le> m \<and> x \<le> n
[PROOF STEP]
apply (unfold cd_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x dvd m \<and> x dvd n; 0 < m; 0 < n\<rbrakk> \<Longrightarrow> x \<le> m \<and> x \<le> n
[PROOF STEP]
apply (blast intro: dvd_imp_le)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma has_derivativeI_sandwich:
  assumes e: "0 < e"
    and bounded: "bounded_linear f'"
    and sandwich: "(\<And>y. y \<in> s \<Longrightarrow> y \<noteq> x \<Longrightarrow> dist y x < e \<Longrightarrow>
      norm ((f y - f x) - f' (y - x)) / norm (y - x) \<le> H y)"
    and "(H \<longlongrightarrow> 0) (at x within s)"
  shows "(f has_derivative f') (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_derivative f') (at x within s)
[PROOF STEP]
unfolding has_derivative_iff_norm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear f' \<and> ((\<lambda>y. norm (f y - f x - f' (y - x)) / norm (y - x)) \<longlongrightarrow> 0) (at x within s)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. bounded_linear f'
 2. ((\<lambda>y. norm (f y - f x - f' (y - x)) / norm (y - x)) \<longlongrightarrow> 0) (at x within s)
[PROOF STEP]
show "((\<lambda>y. norm (f y - f x - f' (y - x)) / norm (y - x)) \<longlongrightarrow> 0) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>y. norm (f y - f x - f' (y - x)) / norm (y - x)) \<longlongrightarrow> 0) (at x within s)
[PROOF STEP]
proof (rule tendsto_sandwich[where f="\<lambda>x. 0"])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<forall>\<^sub>F n in at x within s. 0 \<le> norm (f n - f x - f' (n - x)) / norm (n - x)
 2. \<forall>\<^sub>F n in at x within s. norm (f n - f x - f' (n - x)) / norm (n - x) \<le> ?h n
 3. ((\<lambda>x. 0) \<longlongrightarrow> 0) (at x within s)
 4. (?h \<longlongrightarrow> 0) (at x within s)
[PROOF STEP]
show "(H \<longlongrightarrow> 0) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (H \<longlongrightarrow> 0) (at x within s)
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
(H \<longlongrightarrow> 0) (at x within s)

goal (3 subgoals):
 1. \<forall>\<^sub>F n in at x within s. 0 \<le> norm (f n - f x - f' (n - x)) / norm (n - x)
 2. \<forall>\<^sub>F n in at x within s. norm (f n - f x - f' (n - x)) / norm (n - x) \<le> H n
 3. ((\<lambda>x. 0) \<longlongrightarrow> 0) (at x within s)
[PROOF STEP]
show "eventually (\<lambda>n. norm (f n - f x - f' (n - x)) / norm (n - x) \<le> H n) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in at x within s. norm (f n - f x - f' (n - x)) / norm (n - x) \<le> H n
[PROOF STEP]
unfolding eventually_at
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>d>0. \<forall>xa\<in>s. xa \<noteq> x \<and> dist xa x < d \<longrightarrow> norm (f xa - f x - f' (xa - x)) / norm (xa - x) \<le> H xa
[PROOF STEP]
using e sandwich
[PROOF STATE]
proof (prove)
using this:
0 < e
\<lbrakk>?y \<in> s; ?y \<noteq> x; dist ?y x < e\<rbrakk> \<Longrightarrow> norm (f ?y - f x - f' (?y - x)) / norm (?y - x) \<le> H ?y

goal (1 subgoal):
 1. \<exists>d>0. \<forall>xa\<in>s. xa \<noteq> x \<and> dist xa x < d \<longrightarrow> norm (f xa - f x - f' (xa - x)) / norm (xa - x) \<le> H xa
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in at x within s. norm (f n - f x - f' (n - x)) / norm (n - x) \<le> H n

goal (2 subgoals):
 1. \<forall>\<^sub>F n in at x within s. 0 \<le> norm (f n - f x - f' (n - x)) / norm (n - x)
 2. ((\<lambda>x. 0) \<longlongrightarrow> 0) (at x within s)
[PROOF STEP]
qed (auto simp: le_divide_eq)
[PROOF STATE]
proof (state)
this:
((\<lambda>y. norm (f y - f x - f' (y - x)) / norm (y - x)) \<longlongrightarrow> 0) (at x within s)

goal (1 subgoal):
 1. bounded_linear f'
[PROOF STEP]
qed fact


[STATEMENT]
lemma mult_vec_rec_right: "p ** q = p ** monomial (lookup q v) v + p ** except q {v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ** q = p ** monomial (lookup q v) v + p ** except q {v}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p ** q = p ** monomial (lookup q v) v + p ** except q {v}
[PROOF STEP]
have "p ** monomial (lookup q v) v + p ** except q {v} = p ** (monomial (lookup q v) v + except q {v})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ** monomial (lookup q v) v + p ** except q {v} = p ** (monomial (lookup q v) v + except q {v})
[PROOF STEP]
by (simp only: mult_vec_distrib_left)
[PROOF STATE]
proof (state)
this:
p ** monomial (lookup q v) v + p ** except q {v} = p ** (monomial (lookup q v) v + except q {v})

goal (1 subgoal):
 1. p ** q = p ** monomial (lookup q v) v + p ** except q {v}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p ** monomial (lookup q v) v + p ** except q {v} = p ** (monomial (lookup q v) v + except q {v})

goal (1 subgoal):
 1. p ** q = p ** monomial (lookup q v) v + p ** except q {v}
[PROOF STEP]
have "... = p ** q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ** (monomial (lookup q v) v + except q {v}) = p ** q
[PROOF STEP]
by (simp only: plus_except[of q v, symmetric])
[PROOF STATE]
proof (state)
this:
p ** (monomial (lookup q v) v + except q {v}) = p ** q

goal (1 subgoal):
 1. p ** q = p ** monomial (lookup q v) v + p ** except q {v}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
p ** monomial (lookup q v) v + p ** except q {v} = p ** q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p ** monomial (lookup q v) v + p ** except q {v} = p ** q

goal (1 subgoal):
 1. p ** q = p ** monomial (lookup q v) v + p ** except q {v}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p ** q = p ** monomial (lookup q v) v + p ** except q {v}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem optimum_huffman:
"\<lbrakk>consistent\<^sub>F ts; height\<^sub>F ts = 0; sortedByWeight ts; ts \<noteq> []\<rbrakk> \<Longrightarrow>
 optimum (huffman ts)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>consistent\<^sub>F ts; height\<^sub>F ts = 0; sortedByWeight ts; ts \<noteq> []\<rbrakk> \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
txt \<open>
The input @{term ts} is assumed to be a nonempty consistent list of leaf nodes
sorted by weight. The proof is by induction on the length of the forest
@{term ts}. Let @{term ts} be
$$\vcenter{\hbox{\includegraphics[scale=1.25]{forest-flat.pdf}}}$$
with $w_a \le w_b \le w_c \le w_d \le \cdots \le w_z$. If @{term ts} consists
of a single leaf node, the node has cost 0 and is therefore optimum. If
@{term ts} has length 2 or more, the first step of the algorithm leaves us with
the term
$${\it huffman\/}\enskip\; \vcenter{\hbox{\includegraphics[scale=1.25]%
    {forest-uniteTrees.pdf}}}$$
In the diagram, we put the newly created tree at position 2 in the forest; in
general, it could be anywhere. By @{thm [source] splitLeaf_huffman_commute},
the above tree equals\strut
$${\it splitLeaf\/}\;\left({\it huffman\/}\enskip\;
  \vcenter{\hbox{\includegraphics[scale=1.25]{forest-uniteTrees-flat.pdf}}}
  \;\right)\,\<open>w\<^sub>a a w\<^sub>b b\<close>.$$
To prove that this tree is optimum, it suffices by
@{thm [source] optimum_splitLeaf} to show that\strut
$${\it huffman\/}\enskip\;
  \vcenter{\hbox{\includegraphics[scale=1.25]{forest-uniteTrees-flat.pdf}}}$$
is optimum, which follows from the induction hypothesis.\strut
\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>consistent\<^sub>F ts; height\<^sub>F ts = 0; sortedByWeight ts; ts \<noteq> []\<rbrakk> \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
proof (induct ts rule: length_induct)
  \<comment> \<open>\sc Complete induction step\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>\<forall>ys. length ys < length xs \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys); consistent\<^sub>F xs; height\<^sub>F xs = 0; sortedByWeight xs; xs \<noteq> []\<rbrakk> \<Longrightarrow> optimum (huffman xs)
[PROOF STEP]
case (1 ts)
[PROOF STATE]
proof (state)
this:
\<forall>ys. length ys < length ts \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys)
consistent\<^sub>F ts
height\<^sub>F ts = 0
sortedByWeight ts
ts \<noteq> []

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>\<forall>ys. length ys < length xs \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys); consistent\<^sub>F xs; height\<^sub>F xs = 0; sortedByWeight xs; xs \<noteq> []\<rbrakk> \<Longrightarrow> optimum (huffman xs)
[PROOF STEP]
note hyps = 1
[PROOF STATE]
proof (state)
this:
\<forall>ys. length ys < length ts \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys)
consistent\<^sub>F ts
height\<^sub>F ts = 0
sortedByWeight ts
ts \<noteq> []

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>\<forall>ys. length ys < length xs \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys); consistent\<^sub>F xs; height\<^sub>F xs = 0; sortedByWeight xs; xs \<noteq> []\<rbrakk> \<Longrightarrow> optimum (huffman xs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
proof (cases ts)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ts = [] \<Longrightarrow> optimum (huffman ts)
 2. \<And>a list. ts = a # list \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
ts = []

goal (2 subgoals):
 1. ts = [] \<Longrightarrow> optimum (huffman ts)
 2. \<And>a list. ts = a # list \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ts = []

goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
using \<open>ts \<noteq> []\<close>
[PROOF STATE]
proof (prove)
using this:
ts = []
ts \<noteq> []

goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
optimum (huffman ts)

goal (1 subgoal):
 1. \<And>a list. ts = a # list \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a list. ts = a # list \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
case (Cons t\<^sub>a ts')
[PROOF STATE]
proof (state)
this:
ts = t\<^sub>a # ts'

goal (1 subgoal):
 1. \<And>a list. ts = a # list \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
note ts = Cons
[PROOF STATE]
proof (state)
this:
ts = t\<^sub>a # ts'

goal (1 subgoal):
 1. \<And>a list. ts = a # list \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
proof (cases ts')
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ts' = [] \<Longrightarrow> optimum (huffman ts)
 2. \<And>a list. ts' = a # list \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
ts' = []

goal (2 subgoals):
 1. ts' = [] \<Longrightarrow> optimum (huffman ts)
 2. \<And>a list. ts' = a # list \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ts' = []

goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
using ts hyps
[PROOF STATE]
proof (prove)
using this:
ts' = []
ts = t\<^sub>a # ts'
\<forall>ys. length ys < length ts \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys)
consistent\<^sub>F ts
height\<^sub>F ts = 0
sortedByWeight ts
ts \<noteq> []

goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
by (simp add: optimum_def)
[PROOF STATE]
proof (state)
this:
optimum (huffman ts)

goal (1 subgoal):
 1. \<And>a list. ts' = a # list \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a list. ts' = a # list \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
case (Cons t\<^sub>b ts'')
[PROOF STATE]
proof (state)
this:
ts' = t\<^sub>b # ts''

goal (1 subgoal):
 1. \<And>a list. ts' = a # list \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
note ts' = Cons
[PROOF STATE]
proof (state)
this:
ts' = t\<^sub>b # ts''

goal (1 subgoal):
 1. \<And>a list. ts' = a # list \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
proof (cases t\<^sub>a)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x11 x12. t\<^sub>a = Leaf x11 x12 \<Longrightarrow> optimum (huffman ts)
 2. \<And>x21 x22 x23. t\<^sub>a = Node x21 x22 x23 \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
case (Leaf w\<^sub>a a)
[PROOF STATE]
proof (state)
this:
t\<^sub>a = Leaf w\<^sub>a a

goal (2 subgoals):
 1. \<And>x11 x12. t\<^sub>a = Leaf x11 x12 \<Longrightarrow> optimum (huffman ts)
 2. \<And>x21 x22 x23. t\<^sub>a = Node x21 x22 x23 \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
note l\<^sub>a = Leaf
[PROOF STATE]
proof (state)
this:
t\<^sub>a = Leaf w\<^sub>a a

goal (2 subgoals):
 1. \<And>x11 x12. t\<^sub>a = Leaf x11 x12 \<Longrightarrow> optimum (huffman ts)
 2. \<And>x21 x22 x23. t\<^sub>a = Node x21 x22 x23 \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
proof (cases t\<^sub>b)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x11 x12. t\<^sub>b = Leaf x11 x12 \<Longrightarrow> optimum (huffman ts)
 2. \<And>x21 x22 x23. t\<^sub>b = Node x21 x22 x23 \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
case (Leaf w\<^sub>b b)
[PROOF STATE]
proof (state)
this:
t\<^sub>b = Leaf w\<^sub>b b

goal (2 subgoals):
 1. \<And>x11 x12. t\<^sub>b = Leaf x11 x12 \<Longrightarrow> optimum (huffman ts)
 2. \<And>x21 x22 x23. t\<^sub>b = Node x21 x22 x23 \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
note l\<^sub>b = Leaf
[PROOF STATE]
proof (state)
this:
t\<^sub>b = Leaf w\<^sub>b b

goal (2 subgoals):
 1. \<And>x11 x12. t\<^sub>b = Leaf x11 x12 \<Longrightarrow> optimum (huffman ts)
 2. \<And>x21 x22 x23. t\<^sub>b = Node x21 x22 x23 \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
let ?us = "insortTree (uniteTrees t\<^sub>a t\<^sub>b) ts''"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
let ?us' = "insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts''"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
let ?t\<^sub>s = "splitLeaf (huffman ?us') w\<^sub>a a w\<^sub>b b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
have e\<^sub>1: "huffman ts = huffman ?us"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. huffman ts = huffman (insortTree (uniteTrees t\<^sub>a t\<^sub>b) ts'')
[PROOF STEP]
using ts' ts
[PROOF STATE]
proof (prove)
using this:
ts' = t\<^sub>b # ts''
ts = t\<^sub>a # ts'

goal (1 subgoal):
 1. huffman ts = huffman (insortTree (uniteTrees t\<^sub>a t\<^sub>b) ts'')
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
huffman ts = huffman (insortTree (uniteTrees t\<^sub>a t\<^sub>b) ts'')

goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
have e\<^sub>2: "huffman ?us = ?t\<^sub>s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. huffman (insortTree (uniteTrees t\<^sub>a t\<^sub>b) ts'') = splitLeaf (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')) w\<^sub>a a w\<^sub>b b
[PROOF STEP]
using l\<^sub>a l\<^sub>b ts' ts hyps
[PROOF STATE]
proof (prove)
using this:
t\<^sub>a = Leaf w\<^sub>a a
t\<^sub>b = Leaf w\<^sub>b b
ts' = t\<^sub>b # ts''
ts = t\<^sub>a # ts'
\<forall>ys. length ys < length ts \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys)
consistent\<^sub>F ts
height\<^sub>F ts = 0
sortedByWeight ts
ts \<noteq> []

goal (1 subgoal):
 1. huffman (insortTree (uniteTrees t\<^sub>a t\<^sub>b) ts'') = splitLeaf (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')) w\<^sub>a a w\<^sub>b b
[PROOF STEP]
by (auto simp: splitLeaf_huffman_commute uniteTrees_def)
[PROOF STATE]
proof (state)
this:
huffman (insortTree (uniteTrees t\<^sub>a t\<^sub>b) ts'') = splitLeaf (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')) w\<^sub>a a w\<^sub>b b

goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
have "optimum (huffman ?us')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. optimum (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts''))
[PROOF STEP]
using l\<^sub>a ts' ts hyps
[PROOF STATE]
proof (prove)
using this:
t\<^sub>a = Leaf w\<^sub>a a
ts' = t\<^sub>b # ts''
ts = t\<^sub>a # ts'
\<forall>ys. length ys < length ts \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys)
consistent\<^sub>F ts
height\<^sub>F ts = 0
sortedByWeight ts
ts \<noteq> []

goal (1 subgoal):
 1. optimum (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts''))
[PROOF STEP]
by (drule_tac x = ?us' in spec)
                 (auto dest: sortedByWeight_Cons_imp_sortedByWeight
                  simp: sortedByWeight_insortTree)
[PROOF STATE]
proof (state)
this:
optimum (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts''))

goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
hence "optimum ?t\<^sub>s"
[PROOF STATE]
proof (prove)
using this:
optimum (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts''))

goal (1 subgoal):
 1. optimum (splitLeaf (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')) w\<^sub>a a w\<^sub>b b)
[PROOF STEP]
using l\<^sub>a l\<^sub>b ts' ts hyps
[PROOF STATE]
proof (prove)
using this:
optimum (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts''))
t\<^sub>a = Leaf w\<^sub>a a
t\<^sub>b = Leaf w\<^sub>b b
ts' = t\<^sub>b # ts''
ts = t\<^sub>a # ts'
\<forall>ys. length ys < length ts \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys)
consistent\<^sub>F ts
height\<^sub>F ts = 0
sortedByWeight ts
ts \<noteq> []

goal (1 subgoal):
 1. optimum (splitLeaf (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')) w\<^sub>a a w\<^sub>b b)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>optimum (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')); t\<^sub>a = Leaf w\<^sub>a a; t\<^sub>b = Leaf w\<^sub>b b; ts' = Leaf w\<^sub>b b # ts''; ts = Leaf w\<^sub>a a # Leaf w\<^sub>b b # ts''; \<forall>ys. length ys < Suc (Suc (length ts'')) \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys); b \<noteq> a \<and> a \<notin> alphabet\<^sub>F ts'' \<and> b \<notin> alphabet\<^sub>F ts'' \<and> consistent\<^sub>F ts''; height\<^sub>F ts'' = 0; w\<^sub>a \<le> w\<^sub>b \<and> sortedByWeight (Leaf w\<^sub>b b # ts'')\<rbrakk> \<Longrightarrow> optimum (splitLeaf (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')) w\<^sub>a a w\<^sub>b b)
[PROOF STEP]
apply (rule optimum_splitLeaf)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. \<lbrakk>optimum (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')); t\<^sub>a = Leaf w\<^sub>a a; t\<^sub>b = Leaf w\<^sub>b b; ts' = Leaf w\<^sub>b b # ts''; ts = Leaf w\<^sub>a a # Leaf w\<^sub>b b # ts''; \<forall>ys. length ys < Suc (Suc (length ts'')) \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys); b \<noteq> a \<and> a \<notin> alphabet\<^sub>F ts'' \<and> b \<notin> alphabet\<^sub>F ts'' \<and> consistent\<^sub>F ts''; height\<^sub>F ts'' = 0; w\<^sub>a \<le> w\<^sub>b \<and> sortedByWeight (Leaf w\<^sub>b b # ts'')\<rbrakk> \<Longrightarrow> consistent (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts''))
 2. \<lbrakk>optimum (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')); t\<^sub>a = Leaf w\<^sub>a a; t\<^sub>b = Leaf w\<^sub>b b; ts' = Leaf w\<^sub>b b # ts''; ts = Leaf w\<^sub>a a # Leaf w\<^sub>b b # ts''; \<forall>ys. length ys < Suc (Suc (length ts'')) \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys); b \<noteq> a \<and> a \<notin> alphabet\<^sub>F ts'' \<and> b \<notin> alphabet\<^sub>F ts'' \<and> consistent\<^sub>F ts''; height\<^sub>F ts'' = 0; w\<^sub>a \<le> w\<^sub>b \<and> sortedByWeight (Leaf w\<^sub>b b # ts'')\<rbrakk> \<Longrightarrow> optimum (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts''))
 3. \<lbrakk>optimum (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')); t\<^sub>a = Leaf w\<^sub>a a; t\<^sub>b = Leaf w\<^sub>b b; ts' = Leaf w\<^sub>b b # ts''; ts = Leaf w\<^sub>a a # Leaf w\<^sub>b b # ts''; \<forall>ys. length ys < Suc (Suc (length ts'')) \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys); b \<noteq> a \<and> a \<notin> alphabet\<^sub>F ts'' \<and> b \<notin> alphabet\<^sub>F ts'' \<and> consistent\<^sub>F ts''; height\<^sub>F ts'' = 0; w\<^sub>a \<le> w\<^sub>b \<and> sortedByWeight (Leaf w\<^sub>b b # ts'')\<rbrakk> \<Longrightarrow> a \<in> alphabet (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts''))
 4. \<lbrakk>optimum (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')); t\<^sub>a = Leaf w\<^sub>a a; t\<^sub>b = Leaf w\<^sub>b b; ts' = Leaf w\<^sub>b b # ts''; ts = Leaf w\<^sub>a a # Leaf w\<^sub>b b # ts''; \<forall>ys. length ys < Suc (Suc (length ts'')) \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys); b \<noteq> a \<and> a \<notin> alphabet\<^sub>F ts'' \<and> b \<notin> alphabet\<^sub>F ts'' \<and> consistent\<^sub>F ts''; height\<^sub>F ts'' = 0; w\<^sub>a \<le> w\<^sub>b \<and> sortedByWeight (Leaf w\<^sub>b b # ts'')\<rbrakk> \<Longrightarrow> b \<notin> alphabet (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts''))
 5. \<lbrakk>optimum (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')); t\<^sub>a = Leaf w\<^sub>a a; t\<^sub>b = Leaf w\<^sub>b b; ts' = Leaf w\<^sub>b b # ts''; ts = Leaf w\<^sub>a a # Leaf w\<^sub>b b # ts''; \<forall>ys. length ys < Suc (Suc (length ts'')) \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys); b \<noteq> a \<and> a \<notin> alphabet\<^sub>F ts'' \<and> b \<notin> alphabet\<^sub>F ts'' \<and> consistent\<^sub>F ts''; height\<^sub>F ts'' = 0; w\<^sub>a \<le> w\<^sub>b \<and> sortedByWeight (Leaf w\<^sub>b b # ts'')\<rbrakk> \<Longrightarrow> freq (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')) a = w\<^sub>a + w\<^sub>b
 6. \<lbrakk>optimum (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')); t\<^sub>a = Leaf w\<^sub>a a; t\<^sub>b = Leaf w\<^sub>b b; ts' = Leaf w\<^sub>b b # ts''; ts = Leaf w\<^sub>a a # Leaf w\<^sub>b b # ts''; \<forall>ys. length ys < Suc (Suc (length ts'')) \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys); b \<noteq> a \<and> a \<notin> alphabet\<^sub>F ts'' \<and> b \<notin> alphabet\<^sub>F ts'' \<and> consistent\<^sub>F ts''; height\<^sub>F ts'' = 0; w\<^sub>a \<le> w\<^sub>b \<and> sortedByWeight (Leaf w\<^sub>b b # ts'')\<rbrakk> \<Longrightarrow> \<forall>c\<in>alphabet (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')). w\<^sub>a \<le> freq (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')) c \<and> w\<^sub>b \<le> freq (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')) c
[PROOF STEP]
by (auto dest!: height\<^sub>F_0_imp_Leaf_freq\<^sub>F_in_set
                  sortedByWeight_Cons_imp_forall_weight_ge)
[PROOF STATE]
proof (state)
this:
optimum (splitLeaf (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')) w\<^sub>a a w\<^sub>b b)

goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
thus "optimum (huffman ts)"
[PROOF STATE]
proof (prove)
using this:
optimum (splitLeaf (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')) w\<^sub>a a w\<^sub>b b)

goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
using e\<^sub>1 e\<^sub>2
[PROOF STATE]
proof (prove)
using this:
optimum (splitLeaf (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')) w\<^sub>a a w\<^sub>b b)
huffman ts = huffman (insortTree (uniteTrees t\<^sub>a t\<^sub>b) ts'')
huffman (insortTree (uniteTrees t\<^sub>a t\<^sub>b) ts'') = splitLeaf (huffman (insortTree (Leaf (w\<^sub>a + w\<^sub>b) a) ts'')) w\<^sub>a a w\<^sub>b b

goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
optimum (huffman ts)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
optimum (huffman ts)

goal (1 subgoal):
 1. \<And>x21 x22 x23. t\<^sub>b = Node x21 x22 x23 \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x21 x22 x23. t\<^sub>b = Node x21 x22 x23 \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
case Node
[PROOF STATE]
proof (state)
this:
t\<^sub>b = Node x21_ x22_ x23_

goal (1 subgoal):
 1. \<And>x21 x22 x23. t\<^sub>b = Node x21 x22 x23 \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
t\<^sub>b = Node x21_ x22_ x23_

goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
using ts' ts hyps
[PROOF STATE]
proof (prove)
using this:
t\<^sub>b = Node x21_ x22_ x23_
ts' = t\<^sub>b # ts''
ts = t\<^sub>a # ts'
\<forall>ys. length ys < length ts \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys)
consistent\<^sub>F ts
height\<^sub>F ts = 0
sortedByWeight ts
ts \<noteq> []

goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
optimum (huffman ts)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
optimum (huffman ts)

goal (1 subgoal):
 1. \<And>x21 x22 x23. t\<^sub>a = Node x21 x22 x23 \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x21 x22 x23. t\<^sub>a = Node x21 x22 x23 \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
case Node
[PROOF STATE]
proof (state)
this:
t\<^sub>a = Node x21_ x22_ x23_

goal (1 subgoal):
 1. \<And>x21 x22 x23. t\<^sub>a = Node x21 x22 x23 \<Longrightarrow> optimum (huffman ts)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
t\<^sub>a = Node x21_ x22_ x23_

goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
using ts' ts hyps
[PROOF STATE]
proof (prove)
using this:
t\<^sub>a = Node x21_ x22_ x23_
ts' = t\<^sub>b # ts''
ts = t\<^sub>a # ts'
\<forall>ys. length ys < length ts \<longrightarrow> consistent\<^sub>F ys \<longrightarrow> height\<^sub>F ys = 0 \<longrightarrow> sortedByWeight ys \<longrightarrow> ys \<noteq> [] \<longrightarrow> optimum (huffman ys)
consistent\<^sub>F ts
height\<^sub>F ts = 0
sortedByWeight ts
ts \<noteq> []

goal (1 subgoal):
 1. optimum (huffman ts)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
optimum (huffman ts)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
optimum (huffman ts)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
optimum (huffman ts)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
optimum (huffman ts)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inner_zero_right [simp]: "inner x 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner x (0::'b) = (0::'a)
[PROOF STEP]
using inner_zero_left [of x]
[PROOF STATE]
proof (prove)
using this:
inner (0::'b) x = (0::'a)

goal (1 subgoal):
 1. inner x (0::'b) = (0::'a)
[PROOF STEP]
by (metis local.inner_commute local.inner_eq_zero_iff)


[STATEMENT]
lemma rtrancl_imp_seq:
  assumes "(x, y) \<in> r\<^sup>*"
  shows "\<exists>f n. f 0 = x \<and> f n = y \<and> (\<forall>i<n. (f i, f (Suc i)) \<in> r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f n. f 0 = x \<and> f n = y \<and> (\<forall>i<n. (f i, f (Suc i)) \<in> r)
[PROOF STEP]
using assms [unfolded rtrancl_power] and relpow_seq [of x y _ r]
[PROOF STATE]
proof (prove)
using this:
\<exists>n. (x, y) \<in> r ^^ n
(x, y) \<in> r ^^ ?n \<Longrightarrow> \<exists>f. f 0 = x \<and> f ?n = y \<and> (\<forall>i<?n. (f i, f (Suc i)) \<in> r)

goal (1 subgoal):
 1. \<exists>f n. f 0 = x \<and> f n = y \<and> (\<forall>i<n. (f i, f (Suc i)) \<in> r)
[PROOF STEP]
by blast