[STATEMENT]
lemma Gamma_times_zeta_has_integral_real:
  fixes z :: real
  assumes "z > 1"
  shows   "((\<lambda>x. x powr (z - 1) / (exp x - 1)) has_integral (Gamma z * Re (zeta z))) {0<..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x powr (z - 1) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. x powr (z - 1) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
1 < z
[PROOF STEP]
have *: "Re (of_real z) > 1"
[PROOF STATE]
proof (prove)
using this:
1 < z

goal (1 subgoal):
 1. 1 < Re (complex_of_real z)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < Re (complex_of_real z)

goal (1 subgoal):
 1. ((\<lambda>x. x powr (z - 1) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}
[PROOF STEP]
have "((\<lambda>x. Re (complex_of_real x powr (complex_of_real z - 1)) / (exp x - 1)) has_integral
           Gamma z * Re (zeta (complex_of_real z))) {0<..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. Re (complex_of_real x powr (complex_of_real z - 1)) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}
[PROOF STEP]
using has_integral_linear[OF Gamma_times_zeta_has_integral[OF *] bounded_linear_Re]
[PROOF STATE]
proof (prove)
using this:
(Re \<circ> (\<lambda>x. complex_of_real x powr (complex_of_real z - 1) / (complex_of_real (exp x) - 1)) has_integral Re (Gamma (complex_of_real z) * zeta (complex_of_real z))) {0<..}

goal (1 subgoal):
 1. ((\<lambda>x. Re (complex_of_real x powr (complex_of_real z - 1)) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}
[PROOF STEP]
by (simp add: o_def Gamma_complex_of_real)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. Re (complex_of_real x powr (complex_of_real z - 1)) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}

goal (1 subgoal):
 1. ((\<lambda>x. x powr (z - 1) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. Re (complex_of_real x powr (complex_of_real z - 1)) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}

goal (1 subgoal):
 1. ((\<lambda>x. x powr (z - 1) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}
[PROOF STEP]
have "?this \<longleftrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. Re (complex_of_real x powr (complex_of_real z - 1)) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..} = ((\<lambda>x. x powr (z - 1) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < z

goal (1 subgoal):
 1. ((\<lambda>x. Re (complex_of_real x powr (complex_of_real z - 1)) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..} = ((\<lambda>x. x powr (z - 1) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}
[PROOF STEP]
by (intro has_integral_cong) (auto simp: powr_Reals_eq)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. Re (complex_of_real x powr (complex_of_real z - 1)) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..} = ((\<lambda>x. x powr (z - 1) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}

goal (1 subgoal):
 1. ((\<lambda>x. x powr (z - 1) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. x powr (z - 1) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. x powr (z - 1) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}

goal (1 subgoal):
 1. ((\<lambda>x. x powr (z - 1) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x powr (z - 1) / (exp x - 1)) has_integral Gamma z * Re (zeta (complex_of_real z))) {0<..}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat_trace_similarity [simp]:
  assumes "mat_det A \<noteq> 0"
  shows "mat_trace (similarity A M) = mat_trace M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_trace (similarity A M) = mat_trace M
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat_trace (similarity A M) = mat_trace M
[PROOF STEP]
obtain a b c d where AA: "A = (a, b, c, d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b c d. A = (a, b, c, d) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases A) auto
[PROOF STATE]
proof (state)
this:
A = (a, b, c, d)

goal (1 subgoal):
 1. mat_trace (similarity A M) = mat_trace M
[PROOF STEP]
obtain mA mB mC mD where MM: "M = (mA, mB, mC, mD)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>mA mB mC mD. M = (mA, mB, mC, mD) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases M) auto
[PROOF STATE]
proof (state)
this:
M = (mA, mB, mC, mD)

goal (1 subgoal):
 1. mat_trace (similarity A M) = mat_trace M
[PROOF STEP]
have "mA * (a * d) / (a * d - b * c) + mD * (a * d) / (a * d - b * c) =
        mA + mD + mA * (b * c) / (a * d - b * c) + mD * (b * c) / (a * d - b * c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mA * (a * d) / (a * d - b * c) + mD * (a * d) / (a * d - b * c) = mA + mD + mA * (b * c) / (a * d - b * c) + mD * (b * c) / (a * d - b * c)
[PROOF STEP]
using assms AA
[PROOF STATE]
proof (prove)
using this:
mat_det A \<noteq> 0
A = (a, b, c, d)

goal (1 subgoal):
 1. mA * (a * d) / (a * d - b * c) + mD * (a * d) / (a * d - b * c) = mA + mD + mA * (b * c) / (a * d - b * c) + mD * (b * c) / (a * d - b * c)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
mA * (a * d) / (a * d - b * c) + mD * (a * d) / (a * d - b * c) = mA + mD + mA * (b * c) / (a * d - b * c) + mD * (b * c) / (a * d - b * c)

goal (1 subgoal):
 1. mat_trace (similarity A M) = mat_trace M
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
mA * (a * d) / (a * d - b * c) + mD * (a * d) / (a * d - b * c) = mA + mD + mA * (b * c) / (a * d - b * c) + mD * (b * c) / (a * d - b * c)

goal (1 subgoal):
 1. mat_trace (similarity A M) = mat_trace M
[PROOF STEP]
using AA MM
[PROOF STATE]
proof (prove)
using this:
mA * (a * d) / (a * d - b * c) + mD * (a * d) / (a * d - b * c) = mA + mD + mA * (b * c) / (a * d - b * c) + mD * (b * c) / (a * d - b * c)
A = (a, b, c, d)
M = (mA, mB, mC, mD)

goal (1 subgoal):
 1. mat_trace (similarity A M) = mat_trace M
[PROOF STEP]
by (simp add: field_simps similarity_def)
[PROOF STATE]
proof (state)
this:
mat_trace (similarity A M) = mat_trace M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma retraction_map_product_projection:
  assumes "i \<in> I"
  shows "(retraction_map (product_topology X I) (X i) (\<lambda>x. x i) \<longleftrightarrow>
         (topspace (product_topology X I) = {}) \<longrightarrow> topspace (X i) = {})"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. retraction_map (product_topology X I) (X i) (\<lambda>x. x i) = (topspace (product_topology X I) = {} \<longrightarrow> topspace (X i) = {})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. retraction_map (product_topology X I) (X i) (\<lambda>x. x i) \<Longrightarrow> topspace (product_topology X I) = {} \<longrightarrow> topspace (X i) = {}
 2. topspace (product_topology X I) = {} \<longrightarrow> topspace (X i) = {} \<Longrightarrow> retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
retraction_map (product_topology X I) (X i) (\<lambda>x. x i)

goal (2 subgoals):
 1. retraction_map (product_topology X I) (X i) (\<lambda>x. x i) \<Longrightarrow> topspace (product_topology X I) = {} \<longrightarrow> topspace (X i) = {}
 2. topspace (product_topology X I) = {} \<longrightarrow> topspace (X i) = {} \<Longrightarrow> retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
retraction_map (product_topology X I) (X i) (\<lambda>x. x i)

goal (1 subgoal):
 1. topspace (product_topology X I) = {} \<longrightarrow> topspace (X i) = {}
[PROOF STEP]
using retraction_imp_surjective_map
[PROOF STATE]
proof (prove)
using this:
retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
retraction_map ?X ?Y ?f \<Longrightarrow> ?f ` topspace ?X = topspace ?Y

goal (1 subgoal):
 1. topspace (product_topology X I) = {} \<longrightarrow> topspace (X i) = {}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
topspace (product_topology X I) = {} \<longrightarrow> topspace (X i) = {}

goal (1 subgoal):
 1. topspace (product_topology X I) = {} \<longrightarrow> topspace (X i) = {} \<Longrightarrow> retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. topspace (product_topology X I) = {} \<longrightarrow> topspace (X i) = {} \<Longrightarrow> retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
assume R: ?rhs
[PROOF STATE]
proof (state)
this:
topspace (product_topology X I) = {} \<longrightarrow> topspace (X i) = {}

goal (1 subgoal):
 1. topspace (product_topology X I) = {} \<longrightarrow> topspace (X i) = {} \<Longrightarrow> retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
proof (cases "topspace (product_topology X I) = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. topspace (product_topology X I) = {} \<Longrightarrow> retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
 2. topspace (product_topology X I) \<noteq> {} \<Longrightarrow> retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
topspace (product_topology X I) = {}

goal (2 subgoals):
 1. topspace (product_topology X I) = {} \<Longrightarrow> retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
 2. topspace (product_topology X I) \<noteq> {} \<Longrightarrow> retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
topspace (product_topology X I) = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
topspace (product_topology X I) = {}

goal (1 subgoal):
 1. retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
using R
[PROOF STATE]
proof (prove)
using this:
topspace (product_topology X I) = {}
topspace (product_topology X I) = {} \<longrightarrow> topspace (X i) = {}

goal (1 subgoal):
 1. retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
by (auto simp: retraction_map_def retraction_maps_def continuous_map_on_empty)
[PROOF STATE]
proof (state)
this:
retraction_map (product_topology X I) (X i) (\<lambda>x. x i)

goal (1 subgoal):
 1. topspace (product_topology X I) \<noteq> {} \<Longrightarrow> retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. topspace (product_topology X I) \<noteq> {} \<Longrightarrow> retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
topspace (product_topology X I) \<noteq> {}

goal (1 subgoal):
 1. topspace (product_topology X I) \<noteq> {} \<Longrightarrow> retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
have *: "\<exists>g. continuous_map (X i) (product_topology X I) g \<and> (\<forall>x\<in>topspace (X i). g x i = x)"
      if z: "z \<in> (\<Pi>\<^sub>E i\<in>I. topspace (X i))" for z
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. continuous_map (X i) (product_topology X I) g \<and> (\<forall>x\<in>topspace (X i). g x i = x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>g. continuous_map (X i) (product_topology X I) g \<and> (\<forall>x\<in>topspace (X i). g x i = x)
[PROOF STEP]
have cm: "continuous_map (X i) (X j) (\<lambda>x. if j = i then x else z j)" if "j \<in> I" for j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map (X i) (X j) (\<lambda>x. if j = i then x else z j)
[PROOF STEP]
using \<open>j \<in> I\<close> z
[PROOF STATE]
proof (prove)
using this:
j \<in> I
z \<in> (\<Pi>\<^sub>E i\<in>I. topspace (X i))

goal (1 subgoal):
 1. continuous_map (X i) (X j) (\<lambda>x. if j = i then x else z j)
[PROOF STEP]
by (case_tac "j = i") auto
[PROOF STATE]
proof (state)
this:
?j \<in> I \<Longrightarrow> continuous_map (X i) (X ?j) (\<lambda>x. if ?j = i then x else z ?j)

goal (1 subgoal):
 1. \<exists>g. continuous_map (X i) (product_topology X I) g \<and> (\<forall>x\<in>topspace (X i). g x i = x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. continuous_map (X i) (product_topology X I) g \<and> (\<forall>x\<in>topspace (X i). g x i = x)
[PROOF STEP]
using \<open>i \<in> I\<close> that
[PROOF STATE]
proof (prove)
using this:
i \<in> I
z \<in> (\<Pi>\<^sub>E i\<in>I. topspace (X i))

goal (1 subgoal):
 1. \<exists>g. continuous_map (X i) (product_topology X I) g \<and> (\<forall>x\<in>topspace (X i). g x i = x)
[PROOF STEP]
by (rule_tac x="\<lambda>x j. if j = i then x else z j" in exI) (auto simp: continuous_map_componentwise PiE_iff extensional_def cm)
[PROOF STATE]
proof (state)
this:
\<exists>g. continuous_map (X i) (product_topology X I) g \<and> (\<forall>x\<in>topspace (X i). g x i = x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?z \<in> (\<Pi>\<^sub>E i\<in>I. topspace (X i)) \<Longrightarrow> \<exists>g. continuous_map (X i) (product_topology X I) g \<and> (\<forall>x\<in>topspace (X i). g x i = x)

goal (1 subgoal):
 1. topspace (product_topology X I) \<noteq> {} \<Longrightarrow> retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
using \<open>i \<in> I\<close> False
[PROOF STATE]
proof (prove)
using this:
i \<in> I
topspace (product_topology X I) \<noteq> {}

goal (1 subgoal):
 1. retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
by (auto simp: retraction_map_def retraction_maps_def assms continuous_map_product_projection *)
[PROOF STATE]
proof (state)
this:
retraction_map (product_topology X I) (X i) (\<lambda>x. x i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
retraction_map (product_topology X I) (X i) (\<lambda>x. x i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma primitive_part_0 [simp]: "primitive_part 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primitive_part 0 = 0
[PROOF STEP]
by (simp add: primitive_part_def)


[STATEMENT]
lemma ennreal_minus_top[simp]: "ennreal a - top = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal a - top = 0
[PROOF STEP]
by (simp add: minus_top_ennreal)


[STATEMENT]
lemma prefixes_butlast :
  "set (butlast (prefixes xs)) = {ys . \<exists> zs . ys@zs = xs \<and> zs \<noteq> []}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}
[PROOF STEP]
proof (induction "length xs" arbitrary: xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. 0 = length xs \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}
 2. \<And>x xs. \<lbrakk>\<And>xs. x = length xs \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}; Suc x = length xs\<rbrakk> \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 = length xs

goal (2 subgoals):
 1. \<And>xs. 0 = length xs \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}
 2. \<And>x xs. \<lbrakk>\<And>xs. x = length xs \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}; Suc x = length xs\<rbrakk> \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 = length xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 = length xs

goal (1 subgoal):
 1. set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. x = length xs \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}; Suc x = length xs\<rbrakk> \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. x = length xs \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}; Suc x = length xs\<rbrakk> \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
k = length ?xs \<Longrightarrow> set (butlast (prefixes ?xs)) = {ys. \<exists>zs. ys @ zs = ?xs \<and> zs \<noteq> []}
Suc k = length xs

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. x = length xs \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}; Suc x = length xs\<rbrakk> \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k = length ?xs \<Longrightarrow> set (butlast (prefixes ?xs)) = {ys. \<exists>zs. ys @ zs = ?xs \<and> zs \<noteq> []}
Suc k = length xs
[PROOF STEP]
obtain x xs' where "xs = x#xs'" and "k = length xs' "
[PROOF STATE]
proof (prove)
using this:
k = length ?xs \<Longrightarrow> set (butlast (prefixes ?xs)) = {ys. \<exists>zs. ys @ zs = ?xs \<and> zs \<noteq> []}
Suc k = length xs

goal (1 subgoal):
 1. (\<And>x xs'. \<lbrakk>xs = x # xs'; k = length xs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis length_Suc_conv)
[PROOF STATE]
proof (state)
this:
xs = x # xs'
k = length xs'

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. x = length xs \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}; Suc x = length xs\<rbrakk> \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xs = x # xs'
k = length xs'
[PROOF STEP]
have "prefixes xs = [] # map ((#) x) (prefixes xs')"
[PROOF STATE]
proof (prove)
using this:
xs = x # xs'
k = length xs'

goal (1 subgoal):
 1. prefixes xs = [] # map ((#) x) (prefixes xs')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prefixes xs = [] # map ((#) x) (prefixes xs')

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. x = length xs \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}; Suc x = length xs\<rbrakk> \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prefixes xs = [] # map ((#) x) (prefixes xs')
[PROOF STEP]
have "butlast (prefixes xs) = [] # map ((#) x) (butlast (prefixes xs'))"
[PROOF STATE]
proof (prove)
using this:
prefixes xs = [] # map ((#) x) (prefixes xs')

goal (1 subgoal):
 1. butlast (prefixes xs) = [] # map ((#) x) (butlast (prefixes xs'))
[PROOF STEP]
by (simp add: map_butlast)
[PROOF STATE]
proof (state)
this:
butlast (prefixes xs) = [] # map ((#) x) (butlast (prefixes xs'))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. x = length xs \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}; Suc x = length xs\<rbrakk> \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
butlast (prefixes xs) = [] # map ((#) x) (butlast (prefixes xs'))
[PROOF STEP]
have "set (butlast (prefixes xs)) = insert [] (((#) x) ` {ys . \<exists> zs . ys@zs = xs' \<and> zs \<noteq> []})"
[PROOF STATE]
proof (prove)
using this:
butlast (prefixes xs) = [] # map ((#) x) (butlast (prefixes xs'))

goal (1 subgoal):
 1. set (butlast (prefixes xs)) = insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []})
[PROOF STEP]
using Suc.hyps(1)[OF \<open>k = length xs'\<close>]
[PROOF STATE]
proof (prove)
using this:
butlast (prefixes xs) = [] # map ((#) x) (butlast (prefixes xs'))
set (butlast (prefixes xs')) = {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []}

goal (1 subgoal):
 1. set (butlast (prefixes xs)) = insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (butlast (prefixes xs)) = insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []})

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. x = length xs \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}; Suc x = length xs\<rbrakk> \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set (butlast (prefixes xs)) = insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []})

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. x = length xs \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}; Suc x = length xs\<rbrakk> \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}
[PROOF STEP]
have "\<dots> = {ys . \<exists> zs . ys@zs = (x#xs') \<and> zs \<noteq> []}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []}) = {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []}) \<subseteq> {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []}
 2. {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []} \<subseteq> insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []})
[PROOF STEP]
show "insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []}) \<subseteq> {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []}) \<subseteq> {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []}) \<subseteq> {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []}

goal (1 subgoal):
 1. {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []} \<subseteq> insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []})
[PROOF STEP]
show "{ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []} \<subseteq> insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []} \<subseteq> insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []} \<Longrightarrow> xa \<in> insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []})
[PROOF STEP]
fix ys
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []} \<Longrightarrow> xa \<in> insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []})
[PROOF STEP]
assume "ys \<in> {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []}"
[PROOF STATE]
proof (state)
this:
ys \<in> {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []}

goal (1 subgoal):
 1. \<And>xa. xa \<in> {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []} \<Longrightarrow> xa \<in> insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ys \<in> {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []}
[PROOF STEP]
show "ys \<in> insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []})"
[PROOF STATE]
proof (prove)
using this:
ys \<in> {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []}

goal (1 subgoal):
 1. ys \<in> insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []})
[PROOF STEP]
by (cases ys; auto)
[PROOF STATE]
proof (state)
this:
ys \<in> insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []} \<subseteq> insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
insert [] ((#) x ` {ys. \<exists>zs. ys @ zs = xs' \<and> zs \<noteq> []}) = {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []}

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. x = length xs \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}; Suc x = length xs\<rbrakk> \<Longrightarrow> set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []}

goal (1 subgoal):
 1. set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}
[PROOF STEP]
unfolding \<open>xs = x#xs'\<close>
[PROOF STATE]
proof (prove)
using this:
set (butlast (prefixes (x # xs'))) = {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []}

goal (1 subgoal):
 1. set (butlast (prefixes (x # xs'))) = {ys. \<exists>zs. ys @ zs = x # xs' \<and> zs \<noteq> []}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
set (butlast (prefixes xs)) = {ys. \<exists>zs. ys @ zs = xs \<and> zs \<noteq> []}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma toSet_image[simp]:
  "toSet (image R xs) = toSet R `` toSet xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. toSet (ODList.image R xs) = toSet R `` toSet xs
[PROOF STEP]
unfolding image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. toSet (ODList (List_local.image (toList R) (toList xs))) = toSet R `` toSet xs
[PROOF STEP]
by (simp add: toSet_def toList_ODList)


[STATEMENT]
lemma fps_of_poly_quot_normalize_quot [simp]:
  "fps_of_poly (fst (normalize_quot x)) / fps_of_poly (snd (normalize_quot x)) =
     fps_of_poly (fst x) / fps_of_poly (snd x)"
  if "(snd x :: 'a :: field_gcd poly) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_of_poly (fst (normalize_quot x)) / fps_of_poly (snd (normalize_quot x)) = fps_of_poly (fst x) / fps_of_poly (snd x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_of_poly (fst (normalize_quot x)) / fps_of_poly (snd (normalize_quot x)) = fps_of_poly (fst x) / fps_of_poly (snd x)
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
snd x \<noteq> 0
[PROOF STEP]
obtain d where "fst x = fst (normalize_quot x) * d"
    and "snd x = snd (normalize_quot x) * d" and "d \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
snd x \<noteq> 0

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>fst x = fst (normalize_quot x) * d; snd x = snd (normalize_quot x) * d; d \<noteq> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule normalize_quotE')
[PROOF STATE]
proof (state)
this:
fst x = fst (normalize_quot x) * d
snd x = snd (normalize_quot x) * d
d \<noteq> 0

goal (1 subgoal):
 1. fps_of_poly (fst (normalize_quot x)) / fps_of_poly (snd (normalize_quot x)) = fps_of_poly (fst x) / fps_of_poly (snd x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fst x = fst (normalize_quot x) * d
snd x = snd (normalize_quot x) * d
d \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fst x = fst (normalize_quot x) * d
snd x = snd (normalize_quot x) * d
d \<noteq> 0

goal (1 subgoal):
 1. fps_of_poly (fst (normalize_quot x)) / fps_of_poly (snd (normalize_quot x)) = fps_of_poly (fst x) / fps_of_poly (snd x)
[PROOF STEP]
by (simp add: fps_of_poly_mult)
[PROOF STATE]
proof (state)
this:
fps_of_poly (fst (normalize_quot x)) / fps_of_poly (snd (normalize_quot x)) = fps_of_poly (fst x) / fps_of_poly (snd x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sequentially_offset:
  assumes "eventually (\<lambda>i. P i) sequentially"
  shows "eventually (\<lambda>i. P (i + k)) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F i in sequentially. P (i + k)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
eventually P sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F i in sequentially. P (i + k)
[PROOF STEP]
by (rule eventually_sequentially_seg [THEN iffD2])


[STATEMENT]
lemma nfoldli_prod_divmod_conv:
    "nfoldli (List.product [0..<N] [0..<M]) ctd (\<lambda>(i,j). f i j) = nfoldli [0..<N*M] ctd (\<lambda>i. f (i div M) (i mod M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nfoldli (List.product [0..<N] [0..<M]) ctd (\<lambda>(i, j). f i j) = nfoldli [0..<N * M] ctd (\<lambda>i. f (i div M) (i mod M))
[PROOF STEP]
apply (intro ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. nfoldli (List.product [0..<N] [0..<M]) ctd (\<lambda>(i, j). f i j) x = nfoldli [0..<N * M] ctd (\<lambda>i. f (i div M) (i mod M)) x
[PROOF STEP]
apply (subst list_prod_divmod_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. nfoldli (map (\<lambda>i. (i div M, i mod M)) [0..<M * N]) ctd (\<lambda>(x, y). f x y) x = nfoldli [0..<N * M] ctd (\<lambda>i. f (i div M) (i mod M)) x
[PROOF STEP]
apply (simp add: nfoldli_map)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. nfoldli [0..<M * N] ctd ((\<lambda>(x, y). f x y) \<circ> (\<lambda>i. (i div M, i mod M))) x = nfoldli [0..<N * M] ctd (\<lambda>i. f (i div M) (i mod M)) x
[PROOF STEP]
apply (fo_rule cong)+
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>x. nfoldli = nfoldli
 2. \<And>x. [0..<M * N] = [0..<N * M]
 3. \<And>x. ctd = ctd
 4. \<And>x. (\<lambda>(x, y). f x y) \<circ> (\<lambda>i. (i div M, i mod M)) = (\<lambda>i. f (i div M) (i mod M))
 5. \<And>x. x = x
[PROOF STEP]
apply (auto simp: algebra_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma vector_diff_chain_within:
  assumes "(f has_vector_derivative f') (at x within s)"
    and "(g has_vector_derivative g') (at (f x) within f ` s)"
  shows "((g \<circ> f) has_vector_derivative (f' *\<^sub>R g')) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g \<circ> f has_vector_derivative f' *\<^sub>R g') (at x within s)
[PROOF STEP]
using assms has_vector_derivative_def vector_derivative_diff_chain_within
[PROOF STATE]
proof (prove)
using this:
(f has_vector_derivative f') (at x within s)
(g has_vector_derivative g') (at (f x) within f ` s)
(?f has_vector_derivative ?f') ?net = (?f has_derivative (\<lambda>x. x *\<^sub>R ?f')) ?net
\<lbrakk>(?f has_vector_derivative ?f') (at ?x within ?S); (?g has_derivative ?g') (at (?f ?x) within ?f ` ?S)\<rbrakk> \<Longrightarrow> (?g \<circ> ?f has_vector_derivative ?g' ?f') (at ?x within ?S)

goal (1 subgoal):
 1. (g \<circ> f has_vector_derivative f' *\<^sub>R g') (at x within s)
[PROOF STEP]
by blast


[STATEMENT]
lemma Gamma_integral_real':
  assumes x: "x > (0 :: real)"
  shows   "((\<lambda>t. t powr (x - 1) / exp t) has_integral Gamma x) {0<..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. t powr (x - 1) / exp t) has_integral Gamma x) {0<..}
[PROOF STEP]
using Gamma_integral_real[OF assms]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>t. t powr (x - 1) / exp t) has_integral Gamma x) {0..}

goal (1 subgoal):
 1. ((\<lambda>t. t powr (x - 1) / exp t) has_integral Gamma x) {0<..}
[PROOF STEP]
by (subst has_integral_closure [symmetric]) auto


[STATEMENT]
lemma vebt_pred_code[code]:
    "vebt_pred (Leaf a b) x = (if x = 0 then None else if x = 1 then
                                      (if a then Some 0 else None) else
                               (if b then Some 1 else if a then Some 0 else None))" and
    "vebt_pred (Node info deg treeList summary) x =(if deg \<le> 1 then None else (
    case info of None \<Rightarrow> None |
    (Some mima) \<Rightarrow> (case mima of (mi, ma) \<Rightarrow> (
                           if x > ma then Some ma
                           else (let l = low x (deg div 2); h = high x (deg div 2) in
                           if h < length treeList then
                                let minlow = vebt_mint (treeList ! h) in
                                (if minlow \<noteq> None \<and> (Some l >\<^sub>o  minlow) then
                                                        Some (2^(deg div 2)) *\<^sub>o Some h +\<^sub>o vebt_pred (treeList ! h) l
                                 else let pr = vebt_pred summary h in
                                 if pr = None then (if x > mi then Some mi else None)
                                 else Some (2^(deg div 2)) *\<^sub>o pr +\<^sub>o vebt_maxt (treeList ! the pr) )
                         else None)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vebt_pred (Leaf a b) x = (if x = 0 then None else if x = 1 then if a then Some 0 else None else if b then Some 1 else if a then Some 0 else None) &&& vebt_pred (Node info deg treeList summary) x = (if deg \<le> 1 then None else case info of None \<Rightarrow> None | Some (mi, ma) \<Rightarrow> if ma < x then Some ma else let l = low x (deg div 2); h = high x (deg div 2) in if h < length treeList then let minlow = vebt_mint (treeList ! h) in if minlow \<noteq> None \<and> Some l >\<^sub>o minlow then Some (2 ^ (deg div 2)) *\<^sub>o Some h +\<^sub>o vebt_pred (treeList ! h) l else let pr = vebt_pred summary h in if pr = None then if mi < x then Some mi else None else Some (2 ^ (deg div 2)) *\<^sub>o pr +\<^sub>o vebt_maxt (treeList ! the pr) else None)
[PROOF STEP]
apply (cases "(Leaf a b,x)" rule: vebt_pred.cases; simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vebt_pred (Node info deg treeList summary) x = (if deg \<le> 1 then None else case info of None \<Rightarrow> None | Some (mi, ma) \<Rightarrow> if ma < x then Some ma else let l = low x (deg div 2); h = high x (deg div 2) in if h < length treeList then let minlow = vebt_mint (treeList ! h) in if minlow \<noteq> None \<and> Some l >\<^sub>o minlow then Some (2 ^ (deg div 2)) *\<^sub>o Some h +\<^sub>o vebt_pred (treeList ! h) l else let pr = vebt_pred summary h in if pr = None then if mi < x then Some mi else None else Some (2 ^ (deg div 2)) *\<^sub>o pr +\<^sub>o vebt_maxt (treeList ! the pr) else None)
[PROOF STEP]
apply (cases "(Node info  deg treeList summary,x)" rule: vebt_pred.cases; simp add: Let_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem F'map_comp:
  "F'map (f1 o g1) (f2 o g2) (f3 o g3) (f4 o g4) = F'map f1 f2 f3 f4 o F'map g1 g2 g3 g4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fmap (f3 \<circ> g3) (f4 \<circ> g4) = Fmap f3 f4 \<circ> Fmap g3 g4
[PROOF STEP]
by (rule F.map_comp0)


[STATEMENT]
lemma composePermInduct[consumes 1, case_names cBase cStep]:
  fixes xvec :: "name list"
  and   yvec :: "name list"
  and   P    :: "name list \<Rightarrow> name list \<Rightarrow> bool"

  assumes L: "length xvec = length yvec"
  and     rBase: "P [] []"
  and     rStep: "\<And>x xvec y yvec. \<lbrakk>length xvec = length yvec; P xvec yvec\<rbrakk> \<Longrightarrow> P (x # xvec) (y # yvec)"

  shows "P xvec yvec"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P xvec yvec
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xvec = length yvec
P [] []
\<lbrakk>length ?xvec = length ?yvec; P ?xvec ?yvec\<rbrakk> \<Longrightarrow> P (?x # ?xvec) (?y # ?yvec)

goal (1 subgoal):
 1. P xvec yvec
[PROOF STEP]
by(induct rule: composePerm.induct) auto


[STATEMENT]
lemma move_matrix_zero_le[simp]: "0 <= j \<Longrightarrow> 0 <= i \<Longrightarrow> (0 <= move_matrix A j i) = ((0::('a::{order,zero}) matrix) <= A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> j; 0 \<le> i\<rbrakk> \<Longrightarrow> (0 \<le> move_matrix A j i) = (0 \<le> A)
[PROOF STEP]
apply (auto simp add: le_matrix_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ja ia. \<lbrakk>0 \<le> j; 0 \<le> i; \<forall>ja ia. \<not> int ja < j \<and> \<not> int ia < i \<longrightarrow> (0::'a) \<le> Rep_matrix A (nat (int ja - j)) (nat (int ia - i))\<rbrakk> \<Longrightarrow> (0::'a) \<le> Rep_matrix A ja ia
[PROOF STEP]
apply (drule_tac j="ja+(nat j)" and i="ia+(nat i)" in spec2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ja ia. \<lbrakk>0 \<le> j; 0 \<le> i; \<not> int (ja + nat j) < j \<and> \<not> int (ia + nat i) < i \<longrightarrow> (0::'a) \<le> Rep_matrix A (nat (int (ja + nat j) - j)) (nat (int (ia + nat i) - i))\<rbrakk> \<Longrightarrow> (0::'a) \<le> Rep_matrix A ja ia
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma pfixGe_antisym: "[| x pfixGe y; y pfixGe x |] ==> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x pfixGe y; y pfixGe x\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
by (blast intro: genPrefix_antisym)


[STATEMENT]
lemma reduce_column_preserves:
  assumes H: "H \<in> carrier_mat m n"
  and PK_H: "(P,K) = reduce_column div_op H"
  and m: "0 < m"
  and "i\<in>{0,1}"
  and "i<m"
shows "Matrix.row K i = Matrix.row H i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.row K i = Matrix.row H i
[PROOF STEP]
by (rule reduce_column_aux_preserves[OF _ _ _ _ PK_H[unfolded reduce_column_def]],
      insert assms, auto)


[STATEMENT]
lemma scale_shift_ms_aux_MSLCons:
  "scale_shift_ms_aux x (MSLCons y F) = MSLCons (fst x * fst y, snd x + snd y) (scale_shift_ms_aux x F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. scale_shift_ms_aux x (MSLCons y F) = MSLCons (fst x * fst y, snd x + snd y) (scale_shift_ms_aux x F)
[PROOF STEP]
by (auto simp: scale_shift_ms_aux_def map_prod_def split: prod.split)


[STATEMENT]
lemma cardinal_le_lepoll: "vcard A \<le> \<alpha> \<Longrightarrow> elts A \<lesssim> elts \<alpha>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vcard A \<le> \<alpha> \<Longrightarrow> elts A \<lesssim> elts \<alpha>
[PROOF STEP]
by (meson cardinal_eqpoll eqpoll_sym lepoll_trans1 less_eq_V_def subset_imp_lepoll)


[STATEMENT]
lemma ipv6addr_of_nat_nat_of_ipv6addr: "ipv6addr_of_nat (nat_of_ipv6addr addr) = addr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ipv6addr_of_nat (nat_of_ipv6addr addr) = addr
[PROOF STEP]
by(simp add: ipv6addr_of_nat_def nat_of_ipv6addr_def)


[STATEMENT]
lemma Rats_abs_iff[simp]:
  "\<bar>(x::real)\<bar> \<in> \<rat> \<longleftrightarrow> x \<in> \<rat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<bar>x\<bar> \<in> \<rat>) = (x \<in> \<rat>)
[PROOF STEP]
by(simp add: abs_real_def split: if_splits)


[STATEMENT]
lemma prob_binomial_pmf_conv_coins:
  "measure_pmf.prob (binomial_pmf n p) {x. P (real x)} =
   measure_pmf.prob coins {x. P (\<Sum>i<n. if x i then 1 else 0)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (binomial_pmf n p) {x. P (real x)} = measure_pmf.prob coins {x. P (\<Sum>i<n. if x i then 1 else 0)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. measure_pmf.prob (binomial_pmf n p) {x. P (real x)} = measure_pmf.prob coins {x. P (\<Sum>i<n. if x i then 1 else 0)}
[PROOF STEP]
have eq1: "(\<Sum>i<n. if x i then 1 else 0) = real (card {i\<in>{..<n}. x i})" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. if x i then 1 else 0) = real (card {i \<in> {..<n}. x i})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i<n. if x i then 1 else 0) = real (card {i \<in> {..<n}. x i})
[PROOF STEP]
have "(\<Sum>i<n. if x i then 1 else (0::real)) = (\<Sum>i\<in>{i\<in>{..<n}. x i}. 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. if x i then 1 else 0) = (\<Sum>i | i \<in> {..<n} \<and> x i. 1)
[PROOF STEP]
by (intro sum.mono_neutral_cong_right) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. if x i then 1 else 0) = (\<Sum>i | i \<in> {..<n} \<and> x i. 1)

goal (1 subgoal):
 1. (\<Sum>i<n. if x i then 1 else 0) = real (card {i \<in> {..<n}. x i})
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i<n. if x i then 1 else 0) = (\<Sum>i | i \<in> {..<n} \<and> x i. 1)

goal (1 subgoal):
 1. (\<Sum>i<n. if x i then 1 else 0) = real (card {i \<in> {..<n}. x i})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. if x i then 1 else 0) = real (card {i \<in> {..<n}. x i})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. if ?x i then 1 else 0) = real (card {i \<in> {..<n}. ?x i})

goal (1 subgoal):
 1. measure_pmf.prob (binomial_pmf n p) {x. P (real x)} = measure_pmf.prob coins {x. P (\<Sum>i<n. if x i then 1 else 0)}
[PROOF STEP]
have eq2: "binomial_pmf n p = map_pmf (\<lambda>v. card {i\<in>{..<n}. v i}) coins"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. binomial_pmf n p = map_pmf (\<lambda>v. card {i \<in> {..<n}. v i}) coins
[PROOF STEP]
unfolding coins_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. binomial_pmf n p = map_pmf (\<lambda>v. card {i \<in> {..<n}. v i}) (Pi_pmf {..<n} False (\<lambda>_. bernoulli_pmf p))
[PROOF STEP]
by (rule binomial_pmf_altdef') (use p in auto)
[PROOF STATE]
proof (state)
this:
binomial_pmf n p = map_pmf (\<lambda>v. card {i \<in> {..<n}. v i}) coins

goal (1 subgoal):
 1. measure_pmf.prob (binomial_pmf n p) {x. P (real x)} = measure_pmf.prob coins {x. P (\<Sum>i<n. if x i then 1 else 0)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (binomial_pmf n p) {x. P (real x)} = measure_pmf.prob coins {x. P (\<Sum>i<n. if x i then 1 else 0)}
[PROOF STEP]
by (subst eq2) (simp_all add: eq1)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (binomial_pmf n p) {x. P (real x)} = measure_pmf.prob coins {x. P (\<Sum>i<n. if x i then 1 else 0)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma less_eq_prod_simp [simp, code]:
  "(x1, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 \<le> x2 \<and> y1 \<le> y2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x1, y1) \<le> (x2, y2)) = (x1 < x2 \<or> x1 \<le> x2 \<and> y1 \<le> y2)
[PROOF STEP]
by (simp add: less_eq_prod_def)


[STATEMENT]
lemma degree_unit_factor[simp]: "degree (unit_factor f) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (unit_factor f) = 0
[PROOF STEP]
by (simp add: monom_0 unit_factor_poly_def)


[STATEMENT]
lemma has_absolute_integral_change_of_variables_1:
  fixes f :: "real \<Rightarrow> real^'n::{finite,wellorder}" and g :: "real \<Rightarrow> real"
  assumes S: "S \<in> sets lebesgue"
    and der_g: "\<And>x. x \<in> S \<Longrightarrow> (g has_vector_derivative g' x) (at x within S)"
    and inj: "inj_on g S"
  shows "(\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f(g x)) absolutely_integrable_on S \<and>
           integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f(g x)) = b
     \<longleftrightarrow> f absolutely_integrable_on (g ` S) \<and> integral (g ` S) f = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
let ?lift = "vec :: real \<Rightarrow> real^1"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
let ?drop = "(\<lambda>x::real^1. x $ 1)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
have S': "?lift ` S \<in> sets lebesgue"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec ` S \<in> sets lebesgue
[PROOF STEP]
by (auto intro: differentiable_image_in_sets_lebesgue [OF S] differentiable_vec)
[PROOF STATE]
proof (state)
this:
vec ` S \<in> sets lebesgue

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
have "((\<lambda>x. vec (g (x $ 1))) has_derivative (*\<^sub>R) (g' z)) (at (vec z) within ?lift ` S)"
    if "z \<in> S" for z
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. vec (g (x $ 1))) has_derivative (*\<^sub>R) (g' z)) (at (vec z) within vec ` S)
[PROOF STEP]
using der_g [OF that]
[PROOF STATE]
proof (prove)
using this:
(g has_vector_derivative g' z) (at z within S)

goal (1 subgoal):
 1. ((\<lambda>x. vec (g (x $ 1))) has_derivative (*\<^sub>R) (g' z)) (at (vec z) within vec ` S)
[PROOF STEP]
by (simp add: has_vector_derivative_def has_derivative_vector_1)
[PROOF STATE]
proof (state)
this:
?z \<in> S \<Longrightarrow> ((\<lambda>x. vec (g (x $ 1))) has_derivative (*\<^sub>R) (g' ?z)) (at (vec ?z) within vec ` S)

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?z \<in> S \<Longrightarrow> ((\<lambda>x. vec (g (x $ 1))) has_derivative (*\<^sub>R) (g' ?z)) (at (vec ?z) within vec ` S)
[PROOF STEP]
have der': "\<And>x. x \<in> ?lift ` S \<Longrightarrow>
        (?lift \<circ> g \<circ> ?drop has_derivative (*\<^sub>R) (g' (?drop x))) (at x within ?lift ` S)"
[PROOF STATE]
proof (prove)
using this:
?z \<in> S \<Longrightarrow> ((\<lambda>x. vec (g (x $ 1))) has_derivative (*\<^sub>R) (g' ?z)) (at (vec ?z) within vec ` S)

goal (1 subgoal):
 1. \<And>x. x \<in> vec ` S \<Longrightarrow> (vec \<circ> g \<circ> (\<lambda>x. x $ 1) has_derivative (*\<^sub>R) (g' (x $ 1))) (at x within vec ` S)
[PROOF STEP]
by (auto simp: o_def)
[PROOF STATE]
proof (state)
this:
?x \<in> vec ` S \<Longrightarrow> (vec \<circ> g \<circ> (\<lambda>x. x $ 1) has_derivative (*\<^sub>R) (g' (?x $ 1))) (at ?x within vec ` S)

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
have inj': "inj_on (vec \<circ> g \<circ> ?drop) (vec ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (vec \<circ> g \<circ> (\<lambda>x. x $ 1)) (vec ` S)
[PROOF STEP]
using inj
[PROOF STATE]
proof (prove)
using this:
inj_on g S

goal (1 subgoal):
 1. inj_on (vec \<circ> g \<circ> (\<lambda>x. x $ 1)) (vec ` S)
[PROOF STEP]
by (simp add: inj_on_def)
[PROOF STATE]
proof (state)
this:
inj_on (vec \<circ> g \<circ> (\<lambda>x. x $ 1)) (vec ` S)

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
let ?fg = "\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f(g x)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
have "((\<lambda>x. ?fg x $ i) absolutely_integrable_on S \<and> ((\<lambda>x. ?fg x $ i) has_integral b $ i) S
    \<longleftrightarrow> (\<lambda>x. f x $ i) absolutely_integrable_on g ` S \<and> ((\<lambda>x. f x $ i) has_integral b $ i) (g ` S))" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (\<bar>g' x\<bar> *\<^sub>R f (g x)) $ i) absolutely_integrable_on S \<and> ((\<lambda>x. (\<bar>g' x\<bar> *\<^sub>R f (g x)) $ i) has_integral b $ i) S) = ((\<lambda>x. f x $ i) absolutely_integrable_on g ` S \<and> ((\<lambda>x. f x $ i) has_integral b $ i) (g ` S))
[PROOF STEP]
using has_absolute_integral_change_of_variables [OF S' der' inj', of "\<lambda>x. ?lift(f (?drop x) $ i)" "?lift (b$i)"]
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> vec ` S \<Longrightarrow> x \<in> vec ` S) \<Longrightarrow> ((\<lambda>x. \<bar>det (matrix ((*\<^sub>R) (g' (x $ 1))))\<bar> *\<^sub>R vec (f ((vec \<circ> g \<circ> (\<lambda>x. x $ 1)) x $ 1) $ i)) absolutely_integrable_on vec ` S \<and> integral (vec ` S) (\<lambda>x. \<bar>det (matrix ((*\<^sub>R) (g' (x $ 1))))\<bar> *\<^sub>R vec (f ((vec \<circ> g \<circ> (\<lambda>x. x $ 1)) x $ 1) $ i)) = vec (b $ i)) = ((\<lambda>x. vec (f (x $ 1) $ i)) absolutely_integrable_on (vec \<circ> g \<circ> (\<lambda>x. x $ 1)) ` vec ` S \<and> integral ((vec \<circ> g \<circ> (\<lambda>x. x $ 1)) ` vec ` S) (\<lambda>x. vec (f (x $ 1) $ i)) = vec (b $ i))

goal (1 subgoal):
 1. ((\<lambda>x. (\<bar>g' x\<bar> *\<^sub>R f (g x)) $ i) absolutely_integrable_on S \<and> ((\<lambda>x. (\<bar>g' x\<bar> *\<^sub>R f (g x)) $ i) has_integral b $ i) S) = ((\<lambda>x. f x $ i) absolutely_integrable_on g ` S \<and> ((\<lambda>x. f x $ i) has_integral b $ i) (g ` S))
[PROOF STEP]
unfolding integrable_on_1_iff integral_on_1_eq absolutely_integrable_on_1_iff absolutely_integrable_drop absolutely_integrable_on_def
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> vec ` S \<Longrightarrow> x \<in> vec ` S) \<Longrightarrow> (((\<lambda>x. (\<bar>det (matrix ((*\<^sub>R) (g' (x $ 1))))\<bar> *\<^sub>R vec (f ((vec \<circ> g \<circ> (\<lambda>x. x $ 1)) x $ 1) $ i)) $ 1) \<circ> vec integrable_on (\<lambda>x. x $ 1) ` vec ` S \<and> (\<lambda>x. norm (((\<lambda>x. (\<bar>det (matrix ((*\<^sub>R) (g' (x $ 1))))\<bar> *\<^sub>R vec (f ((vec \<circ> g \<circ> (\<lambda>x. x $ 1)) x $ 1) $ i)) $ 1) \<circ> vec) x)) integrable_on (\<lambda>x. x $ 1) ` vec ` S) \<and> vec (integral (vec ` S) (\<lambda>x. (\<bar>det (matrix ((*\<^sub>R) (g' (x $ 1))))\<bar> *\<^sub>R vec (f ((vec \<circ> g \<circ> (\<lambda>x. x $ 1)) x $ 1) $ i)) $ 1)) = vec (b $ i)) = (((\<lambda>x. vec (f (x $ 1) $ i) $ 1) \<circ> vec integrable_on (\<lambda>x. x $ 1) ` (vec \<circ> g \<circ> (\<lambda>x. x $ 1)) ` vec ` S \<and> (\<lambda>x. norm (((\<lambda>x. vec (f (x $ 1) $ i) $ 1) \<circ> vec) x)) integrable_on (\<lambda>x. x $ 1) ` (vec \<circ> g \<circ> (\<lambda>x. x $ 1)) ` vec ` S) \<and> vec (integral ((vec \<circ> g \<circ> (\<lambda>x. x $ 1)) ` vec ` S) (\<lambda>x. vec (f (x $ 1) $ i) $ 1)) = vec (b $ i))

goal (1 subgoal):
 1. (((\<lambda>x. (\<bar>g' x\<bar> *\<^sub>R f (g x)) $ i) integrable_on S \<and> (\<lambda>x. norm ((\<bar>g' x\<bar> *\<^sub>R f (g x)) $ i)) integrable_on S) \<and> ((\<lambda>x. (\<bar>g' x\<bar> *\<^sub>R f (g x)) $ i) has_integral b $ i) S) = (((\<lambda>x. f x $ i) integrable_on g ` S \<and> (\<lambda>x. norm (f x $ i)) integrable_on g ` S) \<and> ((\<lambda>x. f x $ i) has_integral b $ i) (g ` S))
[PROOF STEP]
by (auto simp: image_comp o_def integral_vec1_eq has_integral_iff)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. (\<bar>g' x\<bar> *\<^sub>R f (g x)) $ ?i1) absolutely_integrable_on S \<and> ((\<lambda>x. (\<bar>g' x\<bar> *\<^sub>R f (g x)) $ ?i1) has_integral b $ ?i1) S) = ((\<lambda>x. f x $ ?i1) absolutely_integrable_on g ` S \<and> ((\<lambda>x. f x $ ?i1) has_integral b $ ?i1) (g ` S))

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. (\<bar>g' x\<bar> *\<^sub>R f (g x)) $ ?i1) absolutely_integrable_on S \<and> ((\<lambda>x. (\<bar>g' x\<bar> *\<^sub>R f (g x)) $ ?i1) has_integral b $ ?i1) S) = ((\<lambda>x. f x $ ?i1) absolutely_integrable_on g ` S \<and> ((\<lambda>x. f x $ ?i1) has_integral b $ ?i1) (g ` S))
[PROOF STEP]
have "?fg absolutely_integrable_on S \<and> (?fg has_integral b) S
         \<longleftrightarrow> f absolutely_integrable_on (g ` S) \<and> (f has_integral b) (g ` S)"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. (\<bar>g' x\<bar> *\<^sub>R f (g x)) $ ?i1) absolutely_integrable_on S \<and> ((\<lambda>x. (\<bar>g' x\<bar> *\<^sub>R f (g x)) $ ?i1) has_integral b $ ?i1) S) = ((\<lambda>x. f x $ ?i1) absolutely_integrable_on g ` S \<and> ((\<lambda>x. f x $ ?i1) has_integral b $ ?i1) (g ` S))

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) has_integral b) S) = (f absolutely_integrable_on g ` S \<and> (f has_integral b) (g ` S))
[PROOF STEP]
unfolding has_integral_componentwise_iff [where y=b]
           absolutely_integrable_componentwise_iff [where f=f]
           absolutely_integrable_componentwise_iff [where f = ?fg]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. (\<bar>g' x\<bar> *\<^sub>R f (g x)) $ ?i1) absolutely_integrable_on S \<and> ((\<lambda>x. (\<bar>g' x\<bar> *\<^sub>R f (g x)) $ ?i1) has_integral b $ ?i1) S) = ((\<lambda>x. f x $ ?i1) absolutely_integrable_on g ` S \<and> ((\<lambda>x. f x $ ?i1) has_integral b $ ?i1) (g ` S))

goal (1 subgoal):
 1. ((\<forall>b\<in>Basis. (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x) \<bullet> b) absolutely_integrable_on S) \<and> (\<forall>ba\<in>Basis. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x) \<bullet> ba) has_integral b \<bullet> ba) S)) = ((\<forall>b\<in>Basis. (\<lambda>x. f x \<bullet> b) absolutely_integrable_on g ` S) \<and> (\<forall>ba\<in>Basis. ((\<lambda>x. f x \<bullet> ba) has_integral b \<bullet> ba) (g ` S)))
[PROOF STEP]
by (force simp: Basis_vec_def cart_eq_inner_axis)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) has_integral b) S) = (f absolutely_integrable_on g ` S \<and> (f has_integral b) (g ` S))

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) has_integral b) S) = (f absolutely_integrable_on g ` S \<and> (f has_integral b) (g ` S))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) has_integral b) S) = (f absolutely_integrable_on g ` S \<and> (f has_integral b) (g ` S))

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
using absolutely_integrable_on_def
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) has_integral b) S) = (f absolutely_integrable_on g ` S \<and> (f has_integral b) (g ` S))
(?f absolutely_integrable_on ?S) = (?f integrable_on ?S \<and> (\<lambda>x. norm (?f x)) integrable_on ?S)

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>g' x\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma filterlim_at_right_to_0:
  "filterlim f F (at_right a) \<longleftrightarrow> filterlim (\<lambda>x. f (x + a)) F (at_right 0)"
  for a :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim f F (at_right a) = (LIM x at_right 0. f (x + a) :> F)
[PROOF STEP]
unfolding filterlim_def filtermap_filtermap at_right_to_0[of a]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (filtermap (\<lambda>x. f (x + a)) (at_right 0) \<le> F) = (filtermap (\<lambda>x. f (x + a)) (at_right 0) \<le> F)
[PROOF STEP]
..


[STATEMENT]
lemma sorted_nth_strict_mono:
  "sorted xs \<Longrightarrow> distinct xs \<Longrightarrow>i < j \<Longrightarrow> j < length xs \<Longrightarrow> xs!i < xs!j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sorted xs; distinct xs; i < j; j < length xs\<rbrakk> \<Longrightarrow> xs ! i < xs ! j
[PROOF STEP]
by (simp add: less_le nth_eq_iff_index_eq sorted_iff_nth_mono_less)


[STATEMENT]
lemma Max_le_imp_subset_atMost: "
  \<lbrakk> finite A;  Max A \<le> n \<rbrakk> \<Longrightarrow> A \<subseteq> {..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; Max A \<le> n\<rbrakk> \<Longrightarrow> A \<subseteq> {..n}
[PROOF STEP]
by (rule subset_trans[OF finite_subset_atLeastAtMost atLeastAtMost_subset_atMost])


[STATEMENT]
lemma ereal_zero_less_0_iff:
  fixes a b :: ereal
  shows "0 < a * b \<longleftrightarrow> (0 < a \<and> 0 < b) \<or> (a < 0 \<and> b < 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < a * b) = (0 < a \<and> 0 < b \<or> a < 0 \<and> b < 0)
[PROOF STEP]
by (cases rule: ereal2_cases[of a b]) (simp_all add: zero_less_mult_iff)


[STATEMENT]
lemma closed_sequential_limits:
  fixes S :: "'a::first_countable_topology set"
  shows "closed S \<longleftrightarrow> (\<forall>x l. (\<forall>n. x n \<in> S) \<and> (x \<longlongrightarrow> l) sequentially \<longrightarrow> l \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed S = (\<forall>x l. (\<forall>n. x n \<in> S) \<and> x \<longlonglongrightarrow> l \<longrightarrow> l \<in> S)
[PROOF STEP]
by (metis closure_sequential closure_subset_eq subset_iff)


[STATEMENT]
lemma v_futr_m_pos: "1 + $i^{m}/m > 0" if "m \<noteq> 0" for m::nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 + $i^{m} / real m
[PROOF STEP]
using v_futr_pos i_nom_def
[PROOF STATE]
proof (prove)
using this:
0 < 1 + i
$i[?i]^{?m} \<equiv> real ?m * ((1 + ?i) .^ (1 / real ?m) - 1)

goal (1 subgoal):
 1. 0 < 1 + $i^{m} / real m
[PROOF STEP]
by force


[STATEMENT]
lemma takeWhile_filter'':
  "sorted xs \<Longrightarrow> \<forall>t \<in> set xs. t \<le> nt \<Longrightarrow>
  takeWhile (\<lambda>t. enat (nt - t) > c) xs = filter (\<lambda>t. enat (nt - t) > c) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sorted xs; \<forall>t\<in>set xs. t \<le> nt\<rbrakk> \<Longrightarrow> takeWhile (\<lambda>t. c < enat (nt - t)) xs = filter (\<lambda>t. c < enat (nt - t)) xs
[PROOF STEP]
by (induction xs) (auto 0 3 simp: less_enat_iff intro!: filter_empty_conv[THEN iffD2, symmetric])


[STATEMENT]
lemma poly_identity_mod_p:
  "v^(CARD('a)) - v = prod (\<lambda>x. v - [:x:]) (UNIV::'a mod_ring set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v ^ CARD('a) - v = (\<Prod>x\<in>UNIV. v - [:x:])
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v ^ CARD('a) - v = (\<Prod>x\<in>UNIV. v - [:x:])
[PROOF STEP]
have id: "monom 1 1 \<circ>\<^sub>p v = v" "[:0, 1:] \<circ>\<^sub>p v = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom 1 1 \<circ>\<^sub>p v = v &&& [:0, 1:] \<circ>\<^sub>p v = v
[PROOF STEP]
unfolding pcompose_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold_coeffs (\<lambda>a c. [:a:] + v * c) (monom 1 1) 0 = v &&& fold_coeffs (\<lambda>a c. [:a:] + v * c) [:0, 1:] 0 = v
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold_coeffs (\<lambda>a c. [:a:] + v * c) 1 0 \<noteq> 1 \<Longrightarrow> v = 0
[PROOF STEP]
by (simp add: fold_coeffs_def)
[PROOF STATE]
proof (state)
this:
monom 1 1 \<circ>\<^sub>p v = v
[:0, 1:] \<circ>\<^sub>p v = v

goal (1 subgoal):
 1. v ^ CARD('a) - v = (\<Prod>x\<in>UNIV. v - [:x:])
[PROOF STEP]
have id2: "monom 1 (CARD('a)) \<circ>\<^sub>p v = v ^ (CARD('a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom 1 CARD('a) \<circ>\<^sub>p v = v ^ CARD('a)
[PROOF STEP]
by (metis id(1) pcompose_hom.hom_power x_pow_n)
[PROOF STATE]
proof (state)
this:
monom 1 CARD('a) \<circ>\<^sub>p v = v ^ CARD('a)

goal (1 subgoal):
 1. v ^ CARD('a) - v = (\<Prod>x\<in>UNIV. v - [:x:])
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v ^ CARD('a) - v = (\<Prod>x\<in>UNIV. v - [:x:])
[PROOF STEP]
using arg_cong[OF poly_monom_identity_mod_p, of "\<lambda> f. f \<circ>\<^sub>p v"]
[PROOF STATE]
proof (prove)
using this:
(monom 1 CARD('a) - monom 1 1) \<circ>\<^sub>p v = (\<Prod>x\<in>UNIV. [:0, 1:] - [:x:]) \<circ>\<^sub>p v

goal (1 subgoal):
 1. v ^ CARD('a) - v = (\<Prod>x\<in>UNIV. v - [:x:])
[PROOF STEP]
unfolding pcompose_hom.hom_minus pcompose_hom.hom_prod id pcompose_const id2
[PROOF STATE]
proof (prove)
using this:
v ^ CARD('a) - v = (\<Prod>x\<in>UNIV. v - [:x:])

goal (1 subgoal):
 1. v ^ CARD('a) - v = (\<Prod>x\<in>UNIV. v - [:x:])
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
v ^ CARD('a) - v = (\<Prod>x\<in>UNIV. v - [:x:])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_subset_contains_Inf:
  fixes A C :: "real set"
  shows "closed C \<Longrightarrow> A \<subseteq> C \<Longrightarrow> A \<noteq> {} \<Longrightarrow> bdd_below A \<Longrightarrow> Inf A \<in> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>closed C; A \<subseteq> C; A \<noteq> {}; bdd_below A\<rbrakk> \<Longrightarrow> Inf A \<in> C
[PROOF STEP]
by (metis closure_contains_Inf closure_minimal subset_eq)


[STATEMENT]
lemma cols_conjugate: "cols (conjugate m) = map conjugate (cols m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cols (conjugate m) = map conjugate (cols m)
[PROOF STEP]
by (simp add: list_eq_iff_nth_eq)


[STATEMENT]
lemma iter_mono: "c \<sqsubseteq> d \<Longrightarrow> c\<^sup>\<omega> \<sqsubseteq> d\<^sup>\<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<sqsubseteq> d \<Longrightarrow> c\<^sup>\<omega> \<sqsubseteq> d\<^sup>\<omega>
variables:
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d, nil :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c \<sqsubseteq> d \<Longrightarrow> c\<^sup>\<omega> \<sqsubseteq> d\<^sup>\<omega>
variables:
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d, nil :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
assume "c \<sqsubseteq> d"
[PROOF STATE]
proof (state)
this:
(c::'a::refinement_lattice) \<sqsubseteq> (d::'a::refinement_lattice)

goal (1 subgoal):
 1. c \<sqsubseteq> d \<Longrightarrow> c\<^sup>\<omega> \<sqsubseteq> d\<^sup>\<omega>
variables:
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d, nil :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(c::'a::refinement_lattice) \<sqsubseteq> (d::'a::refinement_lattice)
[PROOF STEP]
have "nil \<sqinter> c;d\<^sup>\<omega> \<sqsubseteq> d;d\<^sup>\<omega>"
[PROOF STATE]
proof (prove)
using this:
(c::'a::refinement_lattice) \<sqsubseteq> (d::'a::refinement_lattice)

goal (1 subgoal):
 1. nil \<sqinter> c ; d\<^sup>\<omega> \<sqsubseteq> d ; d\<^sup>\<omega>
variables:
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d, nil :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by (metis inf.absorb_iff2 inf_left_commute inf_seq_distrib)
[PROOF STATE]
proof (state)
this:
nil \<sqinter> (c::'a::refinement_lattice) ; (d::'a::refinement_lattice)\<^sup>\<omega> \<sqsubseteq> d ; d\<^sup>\<omega>

goal (1 subgoal):
 1. c \<sqsubseteq> d \<Longrightarrow> c\<^sup>\<omega> \<sqsubseteq> d\<^sup>\<omega>
variables:
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d, nil :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nil \<sqinter> (c::'a::refinement_lattice) ; (d::'a::refinement_lattice)\<^sup>\<omega> \<sqsubseteq> d ; d\<^sup>\<omega>
[PROOF STEP]
have "nil \<sqinter> c;d\<^sup>\<omega> \<sqsubseteq> d\<^sup>\<omega>"
[PROOF STATE]
proof (prove)
using this:
nil \<sqinter> (c::'a::refinement_lattice) ; (d::'a::refinement_lattice)\<^sup>\<omega> \<sqsubseteq> d ; d\<^sup>\<omega>

goal (1 subgoal):
 1. nil \<sqinter> c ; d\<^sup>\<omega> \<sqsubseteq> d\<^sup>\<omega>
variables:
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d, nil :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by (metis inf.bounded_iff inf_sup_ord(1) iter_unfold)
[PROOF STATE]
proof (state)
this:
nil \<sqinter> (c::'a::refinement_lattice) ; (d::'a::refinement_lattice)\<^sup>\<omega> \<sqsubseteq> d\<^sup>\<omega>

goal (1 subgoal):
 1. c \<sqsubseteq> d \<Longrightarrow> c\<^sup>\<omega> \<sqsubseteq> d\<^sup>\<omega>
variables:
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d, nil :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
nil \<sqinter> (c::'a::refinement_lattice) ; (d::'a::refinement_lattice)\<^sup>\<omega> \<sqsubseteq> d\<^sup>\<omega>

goal (1 subgoal):
 1. c\<^sup>\<omega> \<sqsubseteq> d\<^sup>\<omega>
variables:
c, d, nil :: 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by (simp add: iter_induct_nil)
[PROOF STATE]
proof (state)
this:
(c::'a::refinement_lattice)\<^sup>\<omega> \<sqsubseteq> (d::'a::refinement_lattice)\<^sup>\<omega>

goal:
No subgoals!
variables:
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
c, d, nil :: 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
qed


[STATEMENT]
lemma A_simp[simp]: "blinfun_apply (A x y) (dx, dy) =
  (dx * A11 x y + dy * A12 x y,
   dx * A21 x y + dy * A22 x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. blinfun_apply (A x y) (dx, dy) = (dx * A11 x y + dy * A12 x y, dx * A21 x y + dy * A22 x y)
[PROOF STEP]
by (auto simp: A_def blinfun_of_matrix_apply Basis_prod_def)


[STATEMENT]
lemma has_integral_Fejer_kernel:
  "has_bochner_integral (lebesgue_on {-pi..pi}) (Fejer_kernel n) (if n = 0 then 0 else pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_bochner_integral (lebesgue_on {- pi..pi}) (Fejer_kernel n) (if n = 0 then 0 else pi)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. has_bochner_integral (lebesgue_on {- pi..pi}) (Fejer_kernel n) (if n = 0 then 0 else pi)
[PROOF STEP]
have "has_bochner_integral (lebesgue_on {-pi..pi}) (\<lambda>x. (\<Sum>r<n. Dirichlet_kernel r x) / real n) ((\<Sum>r<n. pi) / n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_bochner_integral (lebesgue_on {- pi..pi}) (\<lambda>x. (\<Sum>r<n. Dirichlet_kernel r x) / real n) ((\<Sum>r<n. pi) / real n)
[PROOF STEP]
by (simp add: has_bochner_integral_iff integrable_Dirichlet_kernel has_bochner_integral_divide has_bochner_integral_sum)
[PROOF STATE]
proof (state)
this:
has_bochner_integral (lebesgue_on {- pi..pi}) (\<lambda>x. (\<Sum>r<n. Dirichlet_kernel r x) / real n) ((\<Sum>r<n. pi) / real n)

goal (1 subgoal):
 1. has_bochner_integral (lebesgue_on {- pi..pi}) (Fejer_kernel n) (if n = 0 then 0 else pi)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
has_bochner_integral (lebesgue_on {- pi..pi}) (\<lambda>x. (\<Sum>r<n. Dirichlet_kernel r x) / real n) ((\<Sum>r<n. pi) / real n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
has_bochner_integral (lebesgue_on {- pi..pi}) (\<lambda>x. (\<Sum>r<n. Dirichlet_kernel r x) / real n) ((\<Sum>r<n. pi) / real n)

goal (1 subgoal):
 1. has_bochner_integral (lebesgue_on {- pi..pi}) (Fejer_kernel n) (if n = 0 then 0 else pi)
[PROOF STEP]
by (auto simp: Fejer_kernel_def)
[PROOF STATE]
proof (state)
this:
has_bochner_integral (lebesgue_on {- pi..pi}) (Fejer_kernel n) (if n = 0 then 0 else pi)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_frontier_convex_hull:
  fixes S :: "'a::euclidean_space set"
  assumes "finite S" "card S \<le> Suc (DIM ('a))" "x \<in> S"
  shows   "x \<in> frontier(convex hull S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> frontier (convex hull S)
[PROOF STEP]
proof (cases "affine_dependent S")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
 2. \<not> affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
affine_dependent S

goal (2 subgoals):
 1. affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
 2. \<not> affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite S
card S \<le> Suc DIM('a)
x \<in> S
affine_dependent S
[PROOF STEP]
obtain y where "y \<in> S" and y: "y \<in> affine hull (S - {y})"
[PROOF STATE]
proof (prove)
using this:
finite S
card S \<le> Suc DIM('a)
x \<in> S
affine_dependent S

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> S; y \<in> affine hull (S - {y})\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: affine_dependent_def)
[PROOF STATE]
proof (state)
this:
y \<in> S
y \<in> affine hull (S - {y})

goal (2 subgoals):
 1. affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
 2. \<not> affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
y \<in> S
y \<in> affine hull (S - {y})

goal (2 subgoals):
 1. affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
 2. \<not> affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
[PROOF STEP]
have "x \<in> closure (convex hull S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> closure (convex hull S)
[PROOF STEP]
by (meson closure_subset hull_inc subset_eq \<open>x \<in> S\<close>)
[PROOF STATE]
proof (state)
this:
x \<in> closure (convex hull S)

goal (2 subgoals):
 1. affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
 2. \<not> affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> closure (convex hull S)

goal (2 subgoals):
 1. affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
 2. \<not> affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
[PROOF STEP]
have "x \<notin> interior (convex hull S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<notin> interior (convex hull S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
card S \<le> Suc DIM('a)
x \<in> S

goal (1 subgoal):
 1. x \<notin> interior (convex hull S)
[PROOF STEP]
by (metis Suc_mono affine_hull_convex_hull affine_hull_nonempty_interior \<open>y \<in> S\<close> y card.remove empty_iff empty_interior_affine_hull finite_Diff hull_redundant insert_Diff interior_UNIV not_less)
[PROOF STATE]
proof (state)
this:
x \<notin> interior (convex hull S)

goal (2 subgoals):
 1. affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
 2. \<not> affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
y \<in> S
y \<in> affine hull (S - {y})
x \<in> closure (convex hull S)
x \<notin> interior (convex hull S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y \<in> S
y \<in> affine hull (S - {y})
x \<in> closure (convex hull S)
x \<notin> interior (convex hull S)

goal (1 subgoal):
 1. x \<in> frontier (convex hull S)
[PROOF STEP]
unfolding frontier_def
[PROOF STATE]
proof (prove)
using this:
y \<in> S
y \<in> affine hull (S - {y})
x \<in> closure (convex hull S)
x \<notin> interior (convex hull S)

goal (1 subgoal):
 1. x \<in> closure (convex hull S) - interior (convex hull S)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> frontier (convex hull S)

goal (1 subgoal):
 1. \<not> affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> affine_dependent S

goal (1 subgoal):
 1. \<not> affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<not> affine_dependent S

goal (1 subgoal):
 1. \<not> affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
[PROOF STEP]
assume "card S = Suc (card Basis)"
[PROOF STATE]
proof (state)
this:
card S = Suc DIM('b)

goal (1 subgoal):
 1. \<not> affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card S = Suc DIM('b)
[PROOF STEP]
have cs: "Suc 0 < card S"
[PROOF STATE]
proof (prove)
using this:
card S = Suc DIM('b)

goal (1 subgoal):
 1. Suc 0 < card S
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
Suc 0 < card S

goal (1 subgoal):
 1. \<not> affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
[PROOF STEP]
with subset_singletonD
[PROOF STATE]
proof (chain)
picking this:
?A \<subseteq> {?x} \<Longrightarrow> ?A = {} \<or> ?A = {?x}
Suc 0 < card S
[PROOF STEP]
have "\<exists>y \<in> S. y \<noteq> x"
[PROOF STATE]
proof (prove)
using this:
?A \<subseteq> {?x} \<Longrightarrow> ?A = {} \<or> ?A = {?x}
Suc 0 < card S

goal (1 subgoal):
 1. \<exists>y\<in>S. y \<noteq> x
[PROOF STEP]
by (cases "S \<le> {x}") fastforce+
[PROOF STATE]
proof (state)
this:
\<exists>y\<in>S. y \<noteq> x

goal (1 subgoal):
 1. \<not> affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
card S = Suc DIM(?'b) \<Longrightarrow> \<exists>y\<in>S. y \<noteq> x

goal (1 subgoal):
 1. \<not> affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
[PROOF STEP]
note [dest!] = this
[PROOF STATE]
proof (state)
this:
card S = Suc DIM(?'b) \<Longrightarrow> \<exists>y\<in>S. y \<noteq> x

goal (1 subgoal):
 1. \<not> affine_dependent S \<Longrightarrow> x \<in> frontier (convex hull S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> frontier (convex hull S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
card S \<le> Suc DIM('a)
x \<in> S

goal (1 subgoal):
 1. x \<in> frontier (convex hull S)
[PROOF STEP]
unfolding frontier_convex_hull_cases [OF False] Union_SetCompr_eq
[PROOF STATE]
proof (prove)
using this:
finite S
card S \<le> Suc DIM('a)
x \<in> S

goal (1 subgoal):
 1. x \<in> (if card S \<le> DIM('a) then convex hull S else {a. \<exists>x. x \<in> S \<and> a \<in> convex hull (S - {x})})
[PROOF STEP]
by (auto simp: le_Suc_eq hull_inc)
[PROOF STATE]
proof (state)
this:
x \<in> frontier (convex hull S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ccSup_insert [simp]: "countable A \<Longrightarrow> Sup (insert a A) = sup a (Sup A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable A \<Longrightarrow> Sup (insert a A) = sup a (Sup A)
[PROOF STEP]
by (force intro: le_supI le_supI1 le_supI2 order.antisym ccSup_least ccSup_upper)


[STATEMENT]
lemma fps_binomial_minus_one: "fps_binomial (- 1) = inverse (1 + fps_X)"
  (is "?l = inverse ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_binomial (- (1::'a)) = inverse (1 + fps_X)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_binomial (- (1::'a)) = inverse (1 + fps_X)
[PROOF STEP]
have th: "?r$0 \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + fps_X) $ 0 \<noteq> (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1 + fps_X) $ 0 \<noteq> (0::'a)

goal (1 subgoal):
 1. fps_binomial (- (1::'a)) = inverse (1 + fps_X)
[PROOF STEP]
have th': "fps_deriv (inverse ?r) = fps_const (- 1) * inverse ?r / (1 + fps_X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_deriv (inverse (1 + fps_X)) = fps_const (- (1::'a)) * inverse (1 + fps_X) / (1 + fps_X)
[PROOF STEP]
by (simp add: fps_inverse_deriv[OF th] fps_divide_def
      power2_eq_square mult.commute fps_const_neg[symmetric] del: fps_const_neg)
[PROOF STATE]
proof (state)
this:
fps_deriv (inverse (1 + fps_X)) = fps_const (- (1::'a)) * inverse (1 + fps_X) / (1 + fps_X)

goal (1 subgoal):
 1. fps_binomial (- (1::'a)) = inverse (1 + fps_X)
[PROOF STEP]
have eq: "inverse ?r $ 0 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (1 + fps_X) $ 0 = (1::'a)
[PROOF STEP]
by (simp add: fps_inverse_def)
[PROOF STATE]
proof (state)
this:
inverse (1 + fps_X) $ 0 = (1::'a)

goal (1 subgoal):
 1. fps_binomial (- (1::'a)) = inverse (1 + fps_X)
[PROOF STEP]
from iffD1[OF fps_binomial_ODE_unique[of "inverse (1 + fps_X)" "- 1"] th'] eq
[PROOF STATE]
proof (chain)
picking this:
inverse (1 + fps_X) = fps_const (inverse (1 + fps_X) $ 0) * fps_binomial (- (1::'a))
inverse (1 + fps_X) $ 0 = (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inverse (1 + fps_X) = fps_const (inverse (1 + fps_X) $ 0) * fps_binomial (- (1::'a))
inverse (1 + fps_X) $ 0 = (1::'a)

goal (1 subgoal):
 1. fps_binomial (- (1::'a)) = inverse (1 + fps_X)
[PROOF STEP]
by (simp add: fps_inverse_def)
[PROOF STATE]
proof (state)
this:
fps_binomial (- (1::'a)) = inverse (1 + fps_X)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_interval:
  "\<lbrakk>set xs = {x. (a::'a::len word) \<le> x \<and> x \<le> b}; distinct xs\<rbrakk>
  \<Longrightarrow> length xs = Suc (unat b) - unat a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set xs = {x. a \<le> x \<and> x \<le> b}; distinct xs\<rbrakk> \<Longrightarrow> length xs = Suc (unat b) - unat a
[PROOF STEP]
apply (frule distinct_card)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set xs = {x. a \<le> x \<and> x \<le> b}; distinct xs; card (set xs) = length xs\<rbrakk> \<Longrightarrow> length xs = Suc (unat b) - unat a
[PROOF STEP]
apply (subgoal_tac "set xs = set [a .e. b]")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>set xs = {x. a \<le> x \<and> x \<le> b}; distinct xs; card (set xs) = length xs; set xs = set [a .e. b]\<rbrakk> \<Longrightarrow> length xs = Suc (unat b) - unat a
 2. \<lbrakk>set xs = {x. a \<le> x \<and> x \<le> b}; distinct xs; card (set xs) = length xs\<rbrakk> \<Longrightarrow> set xs = set [a .e. b]
[PROOF STEP]
apply (cut_tac distinct_card [where xs="[a .e. b]"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>set xs = {x. a \<le> x \<and> x \<le> b}; distinct xs; card (set xs) = length xs; set xs = set [a .e. b]; card (set [a .e. b]) = length [a .e. b]\<rbrakk> \<Longrightarrow> length xs = Suc (unat b) - unat a
 2. \<lbrakk>set xs = {x. a \<le> x \<and> x \<le> b}; distinct xs; card (set xs) = length xs; set xs = set [a .e. b]\<rbrakk> \<Longrightarrow> distinct [a .e. b]
 3. \<lbrakk>set xs = {x. a \<le> x \<and> x \<le> b}; distinct xs; card (set xs) = length xs\<rbrakk> \<Longrightarrow> set xs = set [a .e. b]
[PROOF STEP]
apply (subst (asm) length_upto_enum)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>set xs = {x. a \<le> x \<and> x \<le> b}; distinct xs; card (set xs) = length xs; set xs = set [a .e. b]; card (set [a .e. b]) = Suc (unat b) - unat a\<rbrakk> \<Longrightarrow> length xs = Suc (unat b) - unat a
 2. \<lbrakk>set xs = {x. a \<le> x \<and> x \<le> b}; distinct xs; card (set xs) = length xs; set xs = set [a .e. b]\<rbrakk> \<Longrightarrow> distinct [a .e. b]
 3. \<lbrakk>set xs = {x. a \<le> x \<and> x \<le> b}; distinct xs; card (set xs) = length xs\<rbrakk> \<Longrightarrow> set xs = set [a .e. b]
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>set xs = {x. a \<le> x \<and> x \<le> b}; distinct xs; card (set xs) = length xs; set xs = set [a .e. b]\<rbrakk> \<Longrightarrow> distinct [a .e. b]
 2. \<lbrakk>set xs = {x. a \<le> x \<and> x \<le> b}; distinct xs; card (set xs) = length xs\<rbrakk> \<Longrightarrow> set xs = set [a .e. b]
[PROOF STEP]
apply (rule distinct_enum_upto')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set xs = {x. a \<le> x \<and> x \<le> b}; distinct xs; card (set xs) = length xs\<rbrakk> \<Longrightarrow> set xs = set [a .e. b]
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma finite_range_updI:
  assumes "finite (range f)" shows "finite (range (f(a\<mapsto>b)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (range (f(a \<mapsto> b)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (range (f(a \<mapsto> b)))
[PROOF STEP]
have "range (f(a\<mapsto>b)) \<subseteq> insert (Some b) (range f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range (f(a \<mapsto> b)) \<subseteq> insert (Some b) (range f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
range (f(a \<mapsto> b)) \<subseteq> insert (Some b) (range f)

goal (1 subgoal):
 1. finite (range (f(a \<mapsto> b)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
range (f(a \<mapsto> b)) \<subseteq> insert (Some b) (range f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
range (f(a \<mapsto> b)) \<subseteq> insert (Some b) (range f)

goal (1 subgoal):
 1. finite (range (f(a \<mapsto> b)))
[PROOF STEP]
by (rule finite_subset) (use assms in auto)
[PROOF STATE]
proof (state)
this:
finite (range (f(a \<mapsto> b)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_bubblesort: "sorted(bubblesort xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (bubblesort xs)
[PROOF STEP]
apply(induction xs rule: bubblesort.induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. sorted (bubblesort [])
 2. \<And>x. sorted (bubblesort [x])
 3. \<And>v vb vc. (\<And>x21 x22. bubble_min (v # vb # vc) = x21 # x22 \<Longrightarrow> sorted (bubblesort x22)) \<Longrightarrow> sorted (bubblesort (v # vb # vc))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. sorted (bubblesort [x])
 2. \<And>v vb vc. (\<And>x21 x22. bubble_min (v # vb # vc) = x21 # x22 \<Longrightarrow> sorted (bubblesort x22)) \<Longrightarrow> sorted (bubblesort (v # vb # vc))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v vb vc. (\<And>x21 x22. bubble_min (v # vb # vc) = x21 # x22 \<Longrightarrow> sorted (bubblesort x22)) \<Longrightarrow> sorted (bubblesort (v # vb # vc))
[PROOF STEP]
apply (fastforce simp: set_bubblesort split: list.split if_splits dest: bubble_min_min)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma stationary_distribution_iterate':
  assumes "stationary_distribution N"
  shows "measure N {y} = (\<integral>x. p x y n \<partial>N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob N {y} = measure_pmf.expectation N (\<lambda>x. p x y n)
[PROOF STEP]
using stationary_distribution_iterate[OF assms]
[PROOF STATE]
proof (prove)
using this:
ennreal (pmf N ?y) = \<integral>\<^sup>+ x. ennreal (p x ?y ?n) \<partial>measure_pmf N

goal (1 subgoal):
 1. measure_pmf.prob N {y} = measure_pmf.expectation N (\<lambda>x. p x y n)
[PROOF STEP]
by (subst (asm) nn_integral_eq_integral)
     (auto intro!: measure_pmf.integrable_const_bound[where B=1] simp: p_le_1 pmf.rep_eq)


[STATEMENT]
lemma eval_fmla_cnj [simp]: "eval_fmla e (cnj A B) \<longleftrightarrow> (eval_fmla e A \<and> eval_fmla e B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fmla e (A AND B) = (eval_fmla e A \<and> eval_fmla e B)
[PROOF STEP]
by (auto simp: cnj_def)


[STATEMENT]
lemma card_set_berlekamp_basis: "card (set (berlekamp_basis u)) = length (berlekamp_basis u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set (berlekamp_basis u)) = length (berlekamp_basis u)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (set (berlekamp_basis u)) = length (berlekamp_basis u)
[PROOF STEP]
have b: "berlekamp_resulting_mat u \<in> carrier_mat (degree u) (degree u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. berlekamp_resulting_mat u \<in> carrier_mat (degree u) (degree u)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
berlekamp_resulting_mat u \<in> carrier_mat (degree u) (degree u)

goal (1 subgoal):
 1. card (set (berlekamp_basis u)) = length (berlekamp_basis u)
[PROOF STEP]
have "(set (berlekamp_basis u)) = (Poly \<circ> list_of_vec) ` set (find_base_vectors (berlekamp_resulting_mat u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (berlekamp_basis u) = (Poly \<circ> list_of_vec) ` set (find_base_vectors (berlekamp_resulting_mat u))
[PROOF STEP]
unfolding set_berlekamp_basis_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Poly \<circ> list_of_vec) ` set (find_base_vectors (berlekamp_resulting_mat u)) = (Poly \<circ> list_of_vec) ` set (find_base_vectors (berlekamp_resulting_mat u))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
set (berlekamp_basis u) = (Poly \<circ> list_of_vec) ` set (find_base_vectors (berlekamp_resulting_mat u))

goal (1 subgoal):
 1. card (set (berlekamp_basis u)) = length (berlekamp_basis u)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set (berlekamp_basis u) = (Poly \<circ> list_of_vec) ` set (find_base_vectors (berlekamp_resulting_mat u))

goal (1 subgoal):
 1. card (set (berlekamp_basis u)) = length (berlekamp_basis u)
[PROOF STEP]
have " card ... = card (set (find_base_vectors (berlekamp_resulting_mat u)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((Poly \<circ> list_of_vec) ` set (find_base_vectors (berlekamp_resulting_mat u))) = card (set (find_base_vectors (berlekamp_resulting_mat u)))
[PROOF STEP]
proof (rule card_image, rule subset_inj_on[OF inj_Poly_list_of_vec])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> carrier_vec ?n3
[PROOF STEP]
show "set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> carrier_vec (degree u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> carrier_vec (degree u)
[PROOF STEP]
using find_base_vectors(1)[OF row_echelon_form_berlekamp_resulting_mat b]
[PROOF STATE]
proof (prove)
using this:
set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> mat_kernel (berlekamp_resulting_mat u)

goal (1 subgoal):
 1. set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> carrier_vec (degree u)
[PROOF STEP]
unfolding carrier_vec_def mat_kernel_def
[PROOF STATE]
proof (prove)
using this:
set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> {v \<in> {v. dim_vec v = dim_col (berlekamp_resulting_mat u)}. berlekamp_resulting_mat u *\<^sub>v v = 0\<^sub>v (dim_row (berlekamp_resulting_mat u))}

goal (1 subgoal):
 1. set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> {v. dim_vec v = degree u}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (find_base_vectors (berlekamp_resulting_mat u)) \<subseteq> carrier_vec (degree u)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card ((Poly \<circ> list_of_vec) ` set (find_base_vectors (berlekamp_resulting_mat u))) = card (set (find_base_vectors (berlekamp_resulting_mat u)))

goal (1 subgoal):
 1. card (set (berlekamp_basis u)) = length (berlekamp_basis u)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((Poly \<circ> list_of_vec) ` set (find_base_vectors (berlekamp_resulting_mat u))) = card (set (find_base_vectors (berlekamp_resulting_mat u)))

goal (1 subgoal):
 1. card (set (berlekamp_basis u)) = length (berlekamp_basis u)
[PROOF STEP]
have "... =  length (find_base_vectors (berlekamp_resulting_mat u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set (find_base_vectors (berlekamp_resulting_mat u))) = length (find_base_vectors (berlekamp_resulting_mat u))
[PROOF STEP]
by (rule length_find_base_vectors[symmetric, OF row_echelon_form_berlekamp_resulting_mat b])
[PROOF STATE]
proof (state)
this:
card (set (find_base_vectors (berlekamp_resulting_mat u))) = length (find_base_vectors (berlekamp_resulting_mat u))

goal (1 subgoal):
 1. card (set (berlekamp_basis u)) = length (berlekamp_basis u)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (set (berlekamp_basis u)) = length (find_base_vectors (berlekamp_resulting_mat u))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (set (berlekamp_basis u)) = length (find_base_vectors (berlekamp_resulting_mat u))

goal (1 subgoal):
 1. card (set (berlekamp_basis u)) = length (berlekamp_basis u)
[PROOF STEP]
unfolding berlekamp_basis_def
[PROOF STATE]
proof (prove)
using this:
card (set (map (Poly \<circ> list_of_vec) (find_base_vectors (berlekamp_resulting_mat u)))) = length (find_base_vectors (berlekamp_resulting_mat u))

goal (1 subgoal):
 1. card (set (map (Poly \<circ> list_of_vec) (find_base_vectors (berlekamp_resulting_mat u)))) = length (map (Poly \<circ> list_of_vec) (find_base_vectors (berlekamp_resulting_mat u)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (set (berlekamp_basis u)) = length (berlekamp_basis u)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LIM_offset_zero_cancel: "(\<lambda>h. f (a + h)) \<midarrow>0\<rightarrow> L \<Longrightarrow> f \<midarrow>a\<rightarrow> L"
  for a :: "'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>h. f (a + h)) \<midarrow>0::'a\<rightarrow> L \<Longrightarrow> f \<midarrow>a\<rightarrow> L
[PROOF STEP]
by (drule LIM_offset [where k = "- a"]) simp


[STATEMENT]
lemma (in cring) units_power_order_eq_one:
  "finite (Units R) \<Longrightarrow> a \<in> Units R \<Longrightarrow> a [^] card(Units R) = \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite (Units R); a \<in> Units R\<rbrakk> \<Longrightarrow> a [^] card (Units R) = \<one>
[PROOF STEP]
by (metis comm_group.power_order_eq_one units_comm_group units_of_carrier units_of_one units_of_pow)


[STATEMENT]
lemma log_mult_ext3:
  "0 \<le> x \<Longrightarrow> 0 < y \<Longrightarrow> 0 < z \<Longrightarrow> x * log b (x*y*z) = x * log b (x*y) + x * log b z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; 0 < y; 0 < z\<rbrakk> \<Longrightarrow> x * log b (x * y * z) = x * log b (x * y) + x * log b z
[PROOF STEP]
by(cases "x=0")(simp add: log_mult_eq abs_of_pos distrib_left less_eq_real_def)+


[STATEMENT]
lemma poly_cutoff_0 [simp]: "poly_cutoff n 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_cutoff n 0 = 0
[PROOF STEP]
by (simp add: poly_eq_iff coeff_poly_cutoff)


[STATEMENT]
lemma not_less_funI:
  assumes "\<And>c n. c > 0 \<Longrightarrow> \<exists>m>n. c * g m < f m"
    and "\<exists>c>0. \<exists>n. \<forall>m>n. g m \<le> c * f m"
  shows "\<not> f \<prec> g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> f \<prec> g
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < ?c \<Longrightarrow> \<exists>m>?n. ?c * g m < f m
\<exists>c>0. \<exists>n. \<forall>m>n. g m \<le> c * f m

goal (1 subgoal):
 1. \<not> f \<prec> g
[PROOF STEP]
unfolding less_fun_def less_eq_fun_def linorder_not_less [symmetric]
[PROOF STATE]
proof (prove)
using this:
0 < ?c \<Longrightarrow> \<exists>m>?n. ?c * g m < f m
\<exists>c>0. \<exists>n. \<forall>m>n. \<not> c * f m < g m

goal (1 subgoal):
 1. \<not> ((\<exists>c>0. \<exists>n. \<forall>m>n. \<not> c * g m < f m) \<and> \<not> (\<exists>c>0. \<exists>n. \<forall>m>n. \<not> c * f m < g m))
[PROOF STEP]
by blast


[STATEMENT]
lemma gcd_proj1_iff: "gcd m n = normalize m \<longleftrightarrow> m dvd n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (gcd m n = normalize m) = (m dvd n)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. gcd m n = normalize m \<Longrightarrow> m dvd n
 2. m dvd n \<Longrightarrow> gcd m n = normalize m
[PROOF STEP]
assume *: "gcd m n = normalize m"
[PROOF STATE]
proof (state)
this:
gcd m n = normalize m

goal (2 subgoals):
 1. gcd m n = normalize m \<Longrightarrow> m dvd n
 2. m dvd n \<Longrightarrow> gcd m n = normalize m
[PROOF STEP]
show "m dvd n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m dvd n
[PROOF STEP]
proof (cases "m = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m = (0::'a) \<Longrightarrow> m dvd n
 2. m \<noteq> (0::'a) \<Longrightarrow> m dvd n
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
m = (0::'a)

goal (2 subgoals):
 1. m = (0::'a) \<Longrightarrow> m dvd n
 2. m \<noteq> (0::'a) \<Longrightarrow> m dvd n
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
gcd m n = normalize m
m = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
gcd m n = normalize m
m = (0::'a)

goal (1 subgoal):
 1. m dvd n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m dvd n

goal (1 subgoal):
 1. m \<noteq> (0::'a) \<Longrightarrow> m dvd n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m \<noteq> (0::'a) \<Longrightarrow> m dvd n
[PROOF STEP]
case [simp]: False
[PROOF STATE]
proof (state)
this:
m \<noteq> (0::'a)

goal (1 subgoal):
 1. m \<noteq> (0::'a) \<Longrightarrow> m dvd n
[PROOF STEP]
from *
[PROOF STATE]
proof (chain)
picking this:
gcd m n = normalize m
[PROOF STEP]
have **: "m = gcd m n * unit_factor m"
[PROOF STATE]
proof (prove)
using this:
gcd m n = normalize m

goal (1 subgoal):
 1. m = gcd m n * unit_factor m
[PROOF STEP]
by (simp add: unit_eq_div2)
[PROOF STATE]
proof (state)
this:
m = gcd m n * unit_factor m

goal (1 subgoal):
 1. m \<noteq> (0::'a) \<Longrightarrow> m dvd n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m dvd n
[PROOF STEP]
by (subst **) (simp add: mult_unit_dvd_iff)
[PROOF STATE]
proof (state)
this:
m dvd n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
m dvd n

goal (1 subgoal):
 1. m dvd n \<Longrightarrow> gcd m n = normalize m
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m dvd n \<Longrightarrow> gcd m n = normalize m
[PROOF STEP]
assume "m dvd n"
[PROOF STATE]
proof (state)
this:
m dvd n

goal (1 subgoal):
 1. m dvd n \<Longrightarrow> gcd m n = normalize m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m dvd n
[PROOF STEP]
show "gcd m n = normalize m"
[PROOF STATE]
proof (prove)
using this:
m dvd n

goal (1 subgoal):
 1. gcd m n = normalize m
[PROOF STEP]
by (rule gcd_proj1_if_dvd)
[PROOF STATE]
proof (state)
this:
gcd m n = normalize m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma neg_minus_divideC_less_eq [field_simps]:
  "- (b /\<^sub>C c) < a \<longleftrightarrow> c *\<^sub>C a < - b" if "c < 0"
for a b :: "'a :: ordered_complex_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (b /\<^sub>C c) < a) = (c *\<^sub>C a < - b)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
c < 0

goal (1 subgoal):
 1. (- (b /\<^sub>C c) < a) = (c *\<^sub>C a < - b)
[PROOF STEP]
by (simp add: less_le_not_le neg_le_minus_divideC_eq neg_minus_divideC_le_eq)


[STATEMENT]
lemma list_all2_swap:
  "list_all2 P xs ys \<longleftrightarrow> list_all2 (\<lambda> x y. P y x) ys xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 P xs ys = list_all2 (\<lambda>x y. P y x) ys xs
[PROOF STEP]
unfolding list_all2_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (length xs = length ys \<and> (\<forall>(x, y)\<in>set (zip xs ys). P x y)) = (length ys = length xs \<and> (\<forall>(x, y)\<in>set (zip ys xs). P y x))
[PROOF STEP]
by (fastforce simp: in_set_zip)+