[STATEMENT]
lemma sum_coprime_dvd_cong:
  "(\<Sum>r | r dvd a. \<Sum>s | s dvd b. f r s) = (\<Sum>r | r dvd a. \<Sum>s | s dvd b. g r s)"
  if "coprime a b" "\<And>r s. coprime r s \<Longrightarrow> r dvd a \<Longrightarrow> s dvd b \<Longrightarrow> f r s = g r s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>r | r dvd a. \<Sum>s | s dvd b. f r s) = (\<Sum>r | r dvd a. \<Sum>s | s dvd b. g r s)
[PROOF STEP]
using refl
[PROOF STATE]
proof (prove)
using this:
?t = ?t

goal (1 subgoal):
 1. (\<Sum>r | r dvd a. \<Sum>s | s dvd b. f r s) = (\<Sum>r | r dvd a. \<Sum>s | s dvd b. g r s)
[PROOF STEP]
proof (rule sum.cong, rule sum.cong)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>x \<in> {r. r dvd a}; xa \<in> {s. s dvd b}\<rbrakk> \<Longrightarrow> f x xa = g x xa
[PROOF STEP]
fix r s
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>x \<in> {r. r dvd a}; xa \<in> {s. s dvd b}\<rbrakk> \<Longrightarrow> f x xa = g x xa
[PROOF STEP]
assume "r \<in> {r. r dvd a}" and "s \<in> {s. s dvd b}"
[PROOF STATE]
proof (state)
this:
r \<in> {r. r dvd a}
s \<in> {s. s dvd b}

goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>x \<in> {r. r dvd a}; xa \<in> {s. s dvd b}\<rbrakk> \<Longrightarrow> f x xa = g x xa
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r \<in> {r. r dvd a}
s \<in> {s. s dvd b}
[PROOF STEP]
have "r dvd a" and "s dvd b"
[PROOF STATE]
proof (prove)
using this:
r \<in> {r. r dvd a}
s \<in> {s. s dvd b}

goal (1 subgoal):
 1. r dvd a &&& s dvd b
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
r dvd a
s dvd b

goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>x \<in> {r. r dvd a}; xa \<in> {s. s dvd b}\<rbrakk> \<Longrightarrow> f x xa = g x xa
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
r dvd a
s dvd b

goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>x \<in> {r. r dvd a}; xa \<in> {s. s dvd b}\<rbrakk> \<Longrightarrow> f x xa = g x xa
[PROOF STEP]
from \<open>coprime a b\<close>
[PROOF STATE]
proof (chain)
picking this:
coprime a b
[PROOF STEP]
have "coprime r s"
[PROOF STATE]
proof (prove)
using this:
coprime a b

goal (1 subgoal):
 1. coprime r s
[PROOF STEP]
using \<open>r dvd a\<close> \<open>s dvd b\<close>
[PROOF STATE]
proof (prove)
using this:
coprime a b
r dvd a
s dvd b

goal (1 subgoal):
 1. coprime r s
[PROOF STEP]
by (auto intro: coprime_imp_coprime dvd_trans)
[PROOF STATE]
proof (state)
this:
coprime r s

goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>x \<in> {r. r dvd a}; xa \<in> {s. s dvd b}\<rbrakk> \<Longrightarrow> f x xa = g x xa
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
r dvd a
s dvd b
coprime r s
[PROOF STEP]
show "f r s = g r s"
[PROOF STATE]
proof (prove)
using this:
r dvd a
s dvd b
coprime r s

goal (1 subgoal):
 1. f r s = g r s
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
r dvd a
s dvd b
coprime r s
coprime a b
\<lbrakk>coprime ?r ?s; ?r dvd a; ?s dvd b\<rbrakk> \<Longrightarrow> f ?r ?s = g ?r ?s

goal (1 subgoal):
 1. f r s = g r s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f r s = g r s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_Arccos:
    "0 < Re z | Re z = 0 & 0 \<le> Im z \<Longrightarrow> sin(Arccos z) = csqrt(1 - z\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Re z \<or> Re z = 0 \<and> 0 \<le> Im z \<Longrightarrow> sin (Arccos z) = csqrt (1 - z\<^sup>2)
[PROOF STEP]
by (simp add: Arccos_Arcsin_csqrt_pos)


[STATEMENT]
lemma (in comm_group) relations_zero_imp_ord_zero:
  assumes "a \<in> A" "\<forall>f\<in>(relations A). f a = 0"
  and "a \<in> carrier G"
  shows "ord a = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord a = 0
[PROOF STEP]
using assms relations_zero_imp_pow_not_one[OF assms(1, 2)]
[PROOF STATE]
proof (prove)
using this:
a \<in> A
\<forall>f\<in>relations A. f a = 0
a \<in> carrier G
\<forall>z. z \<noteq> 0 \<longrightarrow> a [^] z \<noteq> \<one>

goal (1 subgoal):
 1. ord a = 0
[PROOF STEP]
by (meson finite_cyclic_subgroup_int infinite_cyclic_subgroup_order)


[STATEMENT]
lemma n_st_mono: assumes "set(dom S1) \<subseteq> X" "set(dom S2) \<subseteq> X" "S1 \<sqsubseteq> S2"
shows "n_st n_ivl X S1 \<le> n_st n_ivl X S2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n_st n_ivl X S1 \<le> n_st n_ivl X S2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n_st n_ivl X S1 \<le> n_st n_ivl X S2
[PROOF STEP]
have "(\<Sum>x\<in>X. n_ivl(lookup S1 x)) \<le> (\<Sum>x\<in>X. n_ivl(lookup S2 x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>X. n_ivl (lookup S1 x)) \<le> (\<Sum>x\<in>X. n_ivl (lookup S2 x))
[PROOF STEP]
apply(rule sum_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> n_ivl (lookup S1 x) \<le> n_ivl (lookup S2 x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set (Abs_State.dom S1) \<subseteq> X
set (Abs_State.dom S2) \<subseteq> X
S1 \<sqsubseteq> S2

goal (1 subgoal):
 1. \<And>x. x \<in> X \<Longrightarrow> n_ivl (lookup S1 x) \<le> n_ivl (lookup S2 x)
[PROOF STEP]
by(auto simp: le_st_def lookup_def n_ivl_mono split: if_splits)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>X. n_ivl (lookup S1 x)) \<le> (\<Sum>x\<in>X. n_ivl (lookup S2 x))

goal (1 subgoal):
 1. n_st n_ivl X S1 \<le> n_st n_ivl X S2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>X. n_ivl (lookup S1 x)) \<le> (\<Sum>x\<in>X. n_ivl (lookup S2 x))

goal (1 subgoal):
 1. n_st n_ivl X S1 \<le> n_st n_ivl X S2
[PROOF STEP]
by(simp add: n_st_def)
[PROOF STATE]
proof (state)
this:
n_st n_ivl X S1 \<le> n_st n_ivl X S2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma plus_stream_shd: "shd (x + y) = shd x + shd y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. shd (x + y) = shd x + shd y
[PROOF STEP]
unfolding plus_stream_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. shd (Applicative.ap (Applicative.ap (pure (+)) x) y) = shd x + shd y
[PROOF STEP]
by simp


[STATEMENT]
lemma size_remove1_mset_If: \<open>size (remove1_mset x M) = size M - (if x \<in># M then 1 else 0)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (remove1_mset x M) = size M - (if x \<in># M then 1 else 0)
[PROOF STEP]
by (auto simp: size_Diff_subset_Int)


[STATEMENT]
lemma (in domain) inv_eq_self: "x \<in> Units R \<Longrightarrow> x = inv x \<Longrightarrow> x = \<one> \<or> x = \<ominus>\<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> Units R; x = inv x\<rbrakk> \<Longrightarrow> x = \<one> \<or> x = \<ominus> \<one>
[PROOF STEP]
by (metis Units_closed Units_l_inv square_eq_one)


[STATEMENT]
lemma d_delta_arctan_upper_41_pos: "x \<noteq> 0 \<Longrightarrow> diff_delta_arctan_upper_41 x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> 0 < diff_delta_arctan_upper_41 x
[PROOF STEP]
unfolding diff_delta_arctan_upper_41_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> 0 < 256 / (x\<^sup>2 * (35 + 315 * x\<^sup>2 + 693 * x ^ 4 + 429 * x ^ 6)\<^sup>2 * (1 + x\<^sup>2))
[PROOF STEP]
by (auto simp: zero_less_mult_iff add_pos_pos add_nonneg_eq_0_iff)


[STATEMENT]
lemma powrat_ge_one: "x \<ge> 1 \<Longrightarrow> r \<ge> 0 \<Longrightarrow> x pow\<^sub>\<rat> r \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 \<le> x; 0 \<le> r\<rbrakk> \<Longrightarrow> 1 \<le> x pow\<^sub>\<rat> r
[PROOF STEP]
by (metis powrat_le_mono powrat_zero_eq_one)


[STATEMENT]
lemma iIN_union: "
  \<lbrakk> n \<le> n'; n' \<le> Suc (n + d); n + d \<le> n' + d' \<rbrakk> \<Longrightarrow>
  [n\<dots>,d] \<union> [n'\<dots>,d'] = [n\<dots>,n' - n + d'] "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<le> n'; n' \<le> Suc (n + d); n + d \<le> n' + d'\<rbrakk> \<Longrightarrow> [n\<dots>,d] \<union> [n'\<dots>,d'] = [n\<dots>,n' - n + d']
[PROOF STEP]
by (fastforce simp add: iIN_iff)


[STATEMENT]
lemma hom_sum_mset[hom_distribs,simp]: "hom (sum_mset X) = sum_mset (image_mset hom X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom (\<Sum>\<^sub># X) = \<Sum>\<^sub># (image_mset hom X)
[PROOF STEP]
by (induct X, auto simp: hom_distribs)


[STATEMENT]
lemma enc_length:
  assumes "w \<noteq> []" "enc (w, I) = enc (w', I')"
  shows "length I = length I'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length I = length I'
[PROOF STEP]
using assms
  length_map[of "(\<lambda>x. case x of Inl p \<Rightarrow> 0 = p | Inr P \<Rightarrow> 0 \<in> P)" I]
  length_map[of "(\<lambda>x. case x of Inl p \<Rightarrow> 0 = p | Inr P \<Rightarrow> 0 \<in> P)" I']
[PROOF STATE]
proof (prove)
using this:
w \<noteq> []
enc (w, I) = enc (w', I')
length (enc_atom_bool I 0) = length I
length (enc_atom_bool I' 0) = length I'

goal (1 subgoal):
 1. length I = length I'
[PROOF STEP]
by (induct rule: list_induct2[OF enc_word_length[OF assms(2)]]) auto


[STATEMENT]
lemma simple_path_inj_on: "simple_path g \<Longrightarrow> inj_on g {0<..<1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simple_path g \<Longrightarrow> inj_on g {0<..<1}
[PROOF STEP]
by (auto simp: simple_path_def path_image_def inj_on_def less_eq_real_def Ball_def)


[STATEMENT]
lemma all_imp_eqI: "
  \<lbrakk> P = P'; \<And>x. P x \<Longrightarrow> Q x = Q' x \<rbrakk> \<Longrightarrow>
  (\<forall>x. P x \<longrightarrow> Q x) = (\<forall>x. P' x \<longrightarrow> Q' x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P = P'; \<And>x. P x \<Longrightarrow> Q x = Q' x\<rbrakk> \<Longrightarrow> (\<forall>x. P x \<longrightarrow> Q x) = (\<forall>x. P' x \<longrightarrow> Q' x)
[PROOF STEP]
by blast


[STATEMENT]
lemma nonzero_of_rat_inverse: "a \<noteq> 0 \<Longrightarrow> of_rat (inverse a) = inverse (of_rat a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> of_rat (inverse a) = inverse (of_rat a)
[PROOF STEP]
by (rule inverse_unique [symmetric]) (simp add: of_rat_mult [symmetric])


[STATEMENT]
lemma std_dual_bij_betw:
  "bij_betw (std_dual) S (dual_space S)"
  if "finite B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw local.std_dual S (dual_space S)
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on local.std_dual S \<and> local.std_dual ` S = dual_space S
[PROOF STEP]
using subspace_S inj_std_dual image_std_dual surj_std_dual that
[PROOF STATE]
proof (prove)
using this:
subspace S
\<lbrakk>subspace S; finite B\<rbrakk> \<Longrightarrow> inj_on local.std_dual S
subspace S \<Longrightarrow> local.std_dual ` S \<subseteq> dual_space S
\<lbrakk>subspace S; finite B\<rbrakk> \<Longrightarrow> dual_space S \<subseteq> local.std_dual ` S
finite B

goal (1 subgoal):
 1. inj_on local.std_dual S \<and> local.std_dual ` S = dual_space S
[PROOF STEP]
by blast


[STATEMENT]
lemma infinite_set_has_order_preserving_inj:
  "E \<noteq> {} \<Longrightarrow> \<forall>x. \<exists>y \<in> E. x < y \<Longrightarrow> \<exists>f. range f \<subseteq> E \<and> inj f \<and> (\<forall>m. f m < f (Suc m))"
  for E :: "'a::order set" and f :: "nat \<Rightarrow> 'a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>E \<noteq> {}; \<forall>x. \<exists>y\<in>E. x < y\<rbrakk> \<Longrightarrow> \<exists>f. range f \<subseteq> E \<and> inj f \<and> (\<forall>m. f m < f (Suc m))
[PROOF STEP]
by (metis image_subsetI inj_injf_max injf_max_mem_set injf_max_order_preserving)


[STATEMENT]
theorem resultant_impl: "resultant_impl = resultant"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. resultant_impl = resultant
[PROOF STEP]
proof (intro ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. resultant_impl x xa = resultant x xa
[PROOF STEP]
fix f g :: "'a poly"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. resultant_impl x xa = resultant x xa
[PROOF STEP]
show "resultant_impl f g = resultant f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. resultant_impl f g = resultant f g
[PROOF STEP]
proof (cases "length (coeffs f) \<ge> length (coeffs g)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length (coeffs g) \<le> length (coeffs f) \<Longrightarrow> resultant_impl f g = resultant f g
 2. \<not> length (coeffs g) \<le> length (coeffs f) \<Longrightarrow> resultant_impl f g = resultant f g
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
length (coeffs g) \<le> length (coeffs f)

goal (2 subgoals):
 1. length (coeffs g) \<le> length (coeffs f) \<Longrightarrow> resultant_impl f g = resultant f g
 2. \<not> length (coeffs g) \<le> length (coeffs f) \<Longrightarrow> resultant_impl f g = resultant f g
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
length (coeffs g) \<le> length (coeffs f)

goal (1 subgoal):
 1. resultant_impl f g = resultant f g
[PROOF STEP]
unfolding resultant_impl_def resultant_impl_main[OF True]
[PROOF STATE]
proof (prove)
using this:
length (coeffs g) \<le> length (coeffs f)

goal (1 subgoal):
 1. (if length (coeffs g) \<le> length (coeffs f) then resultant f g else let res = resultant_impl_main g f in if even (degree f) \<or> even (degree g) then res else - res) = resultant f g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
resultant_impl f g = resultant f g

goal (1 subgoal):
 1. \<not> length (coeffs g) \<le> length (coeffs f) \<Longrightarrow> resultant_impl f g = resultant f g
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> length (coeffs g) \<le> length (coeffs f) \<Longrightarrow> resultant_impl f g = resultant f g
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> length (coeffs g) \<le> length (coeffs f)

goal (1 subgoal):
 1. \<not> length (coeffs g) \<le> length (coeffs f) \<Longrightarrow> resultant_impl f g = resultant f g
[PROOF STEP]
hence "length (coeffs g) \<ge> length (coeffs f)"
[PROOF STATE]
proof (prove)
using this:
\<not> length (coeffs g) \<le> length (coeffs f)

goal (1 subgoal):
 1. length (coeffs f) \<le> length (coeffs g)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (coeffs f) \<le> length (coeffs g)

goal (1 subgoal):
 1. \<not> length (coeffs g) \<le> length (coeffs f) \<Longrightarrow> resultant_impl f g = resultant f g
[PROOF STEP]
from resultant_impl_main[OF this]
[PROOF STATE]
proof (chain)
picking this:
resultant_impl_main g f = resultant g f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
resultant_impl_main g f = resultant g f

goal (1 subgoal):
 1. resultant_impl f g = resultant f g
[PROOF STEP]
unfolding resultant_impl_def resultant_swap[of f g]
[PROOF STATE]
proof (prove)
using this:
resultant_impl_main g f = resultant g f

goal (1 subgoal):
 1. (if length (coeffs g) \<le> length (coeffs f) then resultant_impl_main f g else let res = resultant_impl_main g f in if even (degree f) \<or> even (degree g) then res else - res) = (- (1::'a)) ^ (degree f * degree g) * resultant g f
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
resultant_impl_main g f = resultant g f
\<not> length (coeffs g) \<le> length (coeffs f)

goal (1 subgoal):
 1. (if length (coeffs g) \<le> length (coeffs f) then resultant_impl_main f g else let res = resultant_impl_main g f in if even (degree f) \<or> even (degree g) then res else - res) = (- (1::'a)) ^ (degree f * degree g) * resultant g f
[PROOF STEP]
by (auto simp: Let_def)
[PROOF STATE]
proof (state)
this:
resultant_impl f g = resultant f g

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
resultant_impl f g = resultant f g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma drop_bit_numeral_bit0 [simp]:
  \<open>drop_bit (numeral l) (numeral (Num.Bit0 k)) = drop_bit (pred_numeral l) (numeral k)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop_bit (numeral l) (numeral (num.Bit0 k)) = drop_bit (pred_numeral l) (numeral k)
[PROOF STEP]
by (simp add: drop_bit_rec numeral_Bit0_div_2)


[STATEMENT]
lemma sum_to_tup_app:
 "sum_to_tup\<cdot>f = (\<Lambda> x. f\<cdot>(Discr (Inl (undiscr x))), \<Lambda> x. f\<cdot>(Discr (Inr (undiscr x))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_to_tup\<cdot>f = (\<Lambda> x. f\<cdot>(Discr (Inl (undiscr x))), \<Lambda> x. f\<cdot>(Discr (Inr (undiscr x))))
[PROOF STEP]
unfolding sum_to_tup_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Lambda> f. (\<Lambda> x. f\<cdot>(Discr (Inl (undiscr x))), \<Lambda> x. f\<cdot>(Discr (Inr (undiscr x)))))\<cdot>f = (\<Lambda> x. f\<cdot>(Discr (Inl (undiscr x))), \<Lambda> x. f\<cdot>(Discr (Inr (undiscr x))))
[PROOF STEP]
by simp


[STATEMENT]
lemma inj_on_01_hom_index:
  assumes "inj_on_01_hom f"
  assumes "i < dim_row M" "j < dim_col M"
  shows "M $$ (i, j) = 1  \<longleftrightarrow> (map_mat f M) $$ (i, j) = 1"
    and "M $$ (i, j) = 0  \<longleftrightarrow> (map_mat f M) $$ (i, j) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M $$ (i, j) = (1::'b)) = (map_mat f M $$ (i, j) = (1::'a)) &&& (M $$ (i, j) = (0::'b)) = (map_mat f M $$ (i, j) = (0::'a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (M $$ (i, j) = (1::'b)) = (map_mat f M $$ (i, j) = (1::'a))
 2. (M $$ (i, j) = (0::'b)) = (map_mat f M $$ (i, j) = (0::'a))
[PROOF STEP]
interpret hom: inj_on_01_hom f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on_01_hom f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
inj_on_01_hom f
i < dim_row M
j < dim_col M

goal (1 subgoal):
 1. inj_on_01_hom f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (M $$ (i, j) = (1::'b)) = (map_mat f M $$ (i, j) = (1::'a))
 2. (M $$ (i, j) = (0::'b)) = (map_mat f M $$ (i, j) = (0::'a))
[PROOF STEP]
show "M $$ (i, j) = 1  \<longleftrightarrow> (map_mat f M) $$ (i, j) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M $$ (i, j) = (1::'b)) = (map_mat f M $$ (i, j) = (1::'a))
[PROOF STEP]
using assms col_nth_0_or_1_iff
[PROOF STATE]
proof (prove)
using this:
inj_on_01_hom f
i < dim_row M
j < dim_col M
\<lbrakk>?j < dim_col M; ?i < dim_row M\<rbrakk> \<Longrightarrow> (col M ?j $ ?i = (0::'b)) = (col M ?j $ ?i \<noteq> (1::'b))

goal (1 subgoal):
 1. (M $$ (i, j) = (1::'b)) = (map_mat f M $$ (i, j) = (1::'a))
[PROOF STEP]
by (simp add: hom.inj_1_iff)
[PROOF STATE]
proof (state)
this:
(M $$ (i, j) = (1::'b)) = (map_mat f M $$ (i, j) = (1::'a))

goal (1 subgoal):
 1. (M $$ (i, j) = (0::'b)) = (map_mat f M $$ (i, j) = (0::'a))
[PROOF STEP]
show "M $$ (i, j) = 0  \<longleftrightarrow> (map_mat f M) $$ (i, j) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M $$ (i, j) = (0::'b)) = (map_mat f M $$ (i, j) = (0::'a))
[PROOF STEP]
using assms col_nth_0_or_1_iff
[PROOF STATE]
proof (prove)
using this:
inj_on_01_hom f
i < dim_row M
j < dim_col M
\<lbrakk>?j < dim_col M; ?i < dim_row M\<rbrakk> \<Longrightarrow> (col M ?j $ ?i = (0::'b)) = (col M ?j $ ?i \<noteq> (1::'b))

goal (1 subgoal):
 1. (M $$ (i, j) = (0::'b)) = (map_mat f M $$ (i, j) = (0::'a))
[PROOF STEP]
by (simp add: hom.inj_0_iff)
[PROOF STATE]
proof (state)
this:
(M $$ (i, j) = (0::'b)) = (map_mat f M $$ (i, j) = (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nn_transfer_operator_intg:
  assumes [measurable]: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
  shows "(\<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M) = (\<integral>\<^sup>+ x. f (T x) * g x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = \<integral>\<^sup>+ x. f (T x) * g x \<partial>M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = \<integral>\<^sup>+ x. f (T x) * g x \<partial>M
[PROOF STEP]
have *: "density M (RN_deriv M (distr (density M g) M T)) = distr (density M g) M T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. density M (RN_deriv M (distr (density M g) M T)) = distr (density M g) M T
[PROOF STEP]
by (rule density_RN_deriv) (auto intro!: quasi_measure_preserving_absolutely_continuous simp add: Tqm)
[PROOF STATE]
proof (state)
this:
density M (RN_deriv M (distr (density M g) M T)) = distr (density M g) M T

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = \<integral>\<^sup>+ x. f (T x) * g x \<partial>M
[PROOF STEP]
have "(\<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M) = (\<integral>\<^sup>+ x. f x \<partial>(density M (RN_deriv M (distr (density M g) M T))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = integral\<^sup>N (density M (RN_deriv M (distr (density M g) M T))) f
[PROOF STEP]
unfolding nn_transfer_operator_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * (if g \<in> borel_measurable M then RN_deriv M (distr (density M g) M T) else (\<lambda>_. 0)) x \<partial>M = integral\<^sup>N (density M (RN_deriv M (distr (density M g) M T))) f
[PROOF STEP]
by (simp add: nn_integral_densityR)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = integral\<^sup>N (density M (RN_deriv M (distr (density M g) M T))) f

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = \<integral>\<^sup>+ x. f (T x) * g x \<partial>M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = integral\<^sup>N (density M (RN_deriv M (distr (density M g) M T))) f

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = \<integral>\<^sup>+ x. f (T x) * g x \<partial>M
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. f x \<partial>(distr (density M g) M T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (density M (RN_deriv M (distr (density M g) M T))) f = integral\<^sup>N (distr (density M g) M T) f
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (distr (density M g) M T) f = integral\<^sup>N (distr (density M g) M T) f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (density M (RN_deriv M (distr (density M g) M T))) f = integral\<^sup>N (distr (density M g) M T) f

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = \<integral>\<^sup>+ x. f (T x) * g x \<partial>M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (density M (RN_deriv M (distr (density M g) M T))) f = integral\<^sup>N (distr (density M g) M T) f

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = \<integral>\<^sup>+ x. f (T x) * g x \<partial>M
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. f (T x) \<partial>(density M g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (distr (density M g) M T) f = \<integral>\<^sup>+ x. f (T x) \<partial>density M g
[PROOF STEP]
by (rule nn_integral_distr, auto)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (distr (density M g) M T) f = \<integral>\<^sup>+ x. f (T x) \<partial>density M g

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = \<integral>\<^sup>+ x. f (T x) * g x \<partial>M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (distr (density M g) M T) f = \<integral>\<^sup>+ x. f (T x) \<partial>density M g

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = \<integral>\<^sup>+ x. f (T x) * g x \<partial>M
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. f (T x) * g x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f (T x) \<partial>density M g = \<integral>\<^sup>+ x. f (T x) * g x \<partial>M
[PROOF STEP]
by (simp add: nn_integral_densityR)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f (T x) \<partial>density M g = \<integral>\<^sup>+ x. f (T x) * g x \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = \<integral>\<^sup>+ x. f (T x) * g x \<partial>M
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = \<integral>\<^sup>+ x. f (T x) * g x \<partial>M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = \<integral>\<^sup>+ x. f (T x) * g x \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = \<integral>\<^sup>+ x. f (T x) * g x \<partial>M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * nn_transfer_operator g x \<partial>M = \<integral>\<^sup>+ x. f (T x) * g x \<partial>M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma edge_pred_cyclic:
    assumes "v \<in> verts G" "out_arcs G v \<noteq> {}"
    shows "cyclic_on (edge_pred M) (out_arcs G v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cyclic_on (edge_pred M) (out_arcs G v)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cyclic_on (edge_pred M) (out_arcs G v)
[PROOF STEP]
obtain a where orb_a_eq: "orbit (edge_succ M) a = out_arcs G v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. orbit (edge_succ M) a = out_arcs G v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using edge_succ_cyclic[OF assms]
[PROOF STATE]
proof (prove)
using this:
cyclic_on (edge_succ M) (out_arcs G v)

goal (1 subgoal):
 1. (\<And>a. orbit (edge_succ M) a = out_arcs G v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: cyclic_on_def)
[PROOF STATE]
proof (state)
this:
orbit (edge_succ M) a = out_arcs G v

goal (1 subgoal):
 1. cyclic_on (edge_pred M) (out_arcs G v)
[PROOF STEP]
have "cyclic_on (edge_pred M) (orbit (edge_pred M) a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cyclic_on (edge_pred M) (orbit (edge_pred M) a)
[PROOF STEP]
using permutation_edge_pred
[PROOF STATE]
proof (prove)
using this:
permutation (edge_pred M)

goal (1 subgoal):
 1. cyclic_on (edge_pred M) (orbit (edge_pred M) a)
[PROOF STEP]
by (rule cyclic_on_orbit')
[PROOF STATE]
proof (state)
this:
cyclic_on (edge_pred M) (orbit (edge_pred M) a)

goal (1 subgoal):
 1. cyclic_on (edge_pred M) (out_arcs G v)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cyclic_on (edge_pred M) (orbit (edge_pred M) a)

goal (1 subgoal):
 1. cyclic_on (edge_pred M) (out_arcs G v)
[PROOF STEP]
have "orbit (edge_pred M) a = orbit (edge_succ M) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orbit (edge_pred M) a = orbit (edge_succ M) a
[PROOF STEP]
unfolding edge_pred_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orbit (inv (edge_succ M)) a = orbit (edge_succ M) a
[PROOF STEP]
using permutation_edge_succ
[PROOF STATE]
proof (prove)
using this:
permutation (edge_succ M)

goal (1 subgoal):
 1. orbit (inv (edge_succ M)) a = orbit (edge_succ M) a
[PROOF STEP]
by (rule orbit_inv_eq)
[PROOF STATE]
proof (state)
this:
orbit (edge_pred M) a = orbit (edge_succ M) a

goal (1 subgoal):
 1. cyclic_on (edge_pred M) (out_arcs G v)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cyclic_on (edge_pred M) (orbit (edge_succ M) a)
[PROOF STEP]
show "cyclic_on (edge_pred M) (out_arcs G v)"
[PROOF STATE]
proof (prove)
using this:
cyclic_on (edge_pred M) (orbit (edge_succ M) a)

goal (1 subgoal):
 1. cyclic_on (edge_pred M) (out_arcs G v)
[PROOF STEP]
by (simp add: orb_a_eq)
[PROOF STATE]
proof (state)
this:
cyclic_on (edge_pred M) (out_arcs G v)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma comp1:
  assumes "bounded_clinear g"
  shows "bounded_cbilinear (\<lambda>x. (**) (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_cbilinear (\<lambda>x. (**) (g x))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>a a' b. g (a + a') ** b = g a ** b + g a' ** b
 2. \<And>a b b'. g a ** (b + b') = g a ** b + g a ** b'
 3. \<And>r a b. g (r *\<^sub>C a) ** b = r *\<^sub>C (g a ** b)
 4. \<And>a r b. g a ** r *\<^sub>C b = r *\<^sub>C (g a ** b)
 5. \<exists>K. \<forall>a b. norm (g a ** b) \<le> norm a * norm b * K
[PROOF STEP]
interpret g: bounded_clinear g
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_clinear g
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>a a' b. g (a + a') ** b = g a ** b + g a' ** b
 2. \<And>a b b'. g a ** (b + b') = g a ** b + g a ** b'
 3. \<And>r a b. g (r *\<^sub>C a) ** b = r *\<^sub>C (g a ** b)
 4. \<And>a r b. g a ** r *\<^sub>C b = r *\<^sub>C (g a ** b)
 5. \<exists>K. \<forall>a b. norm (g a ** b) \<le> norm a * norm b * K
[PROOF STEP]
show "\<And>a a' b. g (a + a') ** b = g a ** b + g a' ** b"
    "\<And>a b b'. g a ** (b + b') = g a ** b + g a ** b'"
    "\<And>r a b. g (r *\<^sub>C a) ** b = r *\<^sub>C (g a ** b)"
    "\<And>a r b. g a ** (r *\<^sub>C b) = r *\<^sub>C (g a ** b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<And>a a' b. g (a + a') ** b = g a ** b + g a' ** b) &&& (\<And>a b b'. g a ** (b + b') = g a ** b + g a ** b')) &&& (\<And>r a b. g (r *\<^sub>C a) ** b = r *\<^sub>C (g a ** b)) &&& (\<And>a r b. g a ** r *\<^sub>C b = r *\<^sub>C (g a ** b))
[PROOF STEP]
by (auto simp: g.add add_left add_right g.scaleC scaleC_left scaleC_right)
[PROOF STATE]
proof (state)
this:
g (?a + ?a') ** ?b = g ?a ** ?b + g ?a' ** ?b
g ?a ** (?b + ?b') = g ?a ** ?b + g ?a ** ?b'
g (?r *\<^sub>C ?a) ** ?b = ?r *\<^sub>C (g ?a ** ?b)
g ?a ** ?r *\<^sub>C ?b = ?r *\<^sub>C (g ?a ** ?b)

goal (1 subgoal):
 1. \<exists>K. \<forall>a b. norm (g a ** b) \<le> norm a * norm b * K
[PROOF STEP]
have "bounded_bilinear (\<lambda>a b. g a ** b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_bilinear (\<lambda>a. (**) (g a))
[PROOF STEP]
using g.real.bounded_linear
[PROOF STATE]
proof (prove)
using this:
bounded_linear g

goal (1 subgoal):
 1. bounded_bilinear (\<lambda>a. (**) (g a))
[PROOF STEP]
by (rule real.comp1)
[PROOF STATE]
proof (state)
this:
bounded_bilinear (\<lambda>a. (**) (g a))

goal (1 subgoal):
 1. \<exists>K. \<forall>a b. norm (g a ** b) \<le> norm a * norm b * K
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bounded_bilinear (\<lambda>a. (**) (g a))
[PROOF STEP]
show "\<exists>K. \<forall>a b. norm (g a ** b) \<le> norm a * norm b * K"
[PROOF STATE]
proof (prove)
using this:
bounded_bilinear (\<lambda>a. (**) (g a))

goal (1 subgoal):
 1. \<exists>K. \<forall>a b. norm (g a ** b) \<le> norm a * norm b * K
[PROOF STEP]
by (rule bounded_bilinear.bounded)
[PROOF STATE]
proof (state)
this:
\<exists>K. \<forall>a b. norm (g a ** b) \<le> norm a * norm b * K

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scalar_prod_ntt:
  "scalar_product v w = scalar_prod_ntt v w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. scalar_product v w = v \<bullet>\<^bsub>ntt\<^esub> w
[PROOF STEP]
unfolding scalar_product_def scalar_prod_ntt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. v $ i * w $ i) = (\<Sum>i\<in>UNIV. v $ i *\<^bsub>ntt\<^esub> w $ i)
[PROOF STEP]
using mult_ntt
[PROOF STATE]
proof (prove)
using this:
?f * ?g = ?f *\<^bsub>ntt\<^esub> ?g

goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. v $ i * w $ i) = (\<Sum>i\<in>UNIV. v $ i *\<^bsub>ntt\<^esub> w $ i)
[PROOF STEP]
by auto


[STATEMENT]
lemma length_singl[simp]: "length (singl a) = Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (singl a) = Suc 0
[PROOF STEP]
unfolding singl_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length [a] = Suc 0
[PROOF STEP]
by simp


[STATEMENT]
lemma gbinomial_minus: "((-a) gchoose k) = (-1) ^ k * ((a + of_nat k - 1) gchoose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - a gchoose k = (- (1::'a)) ^ k * (a + of_nat k - (1::'a) gchoose k)
[PROOF STEP]
by (subst gbinomial_negated_upper) (simp add: add_ac)


[STATEMENT]
lemma measure\<^sub>s\<^sub>t_alt_def:
  "((s,x),(t,y)) \<in> measure\<^sub>s\<^sub>t =
      (card (fv\<^sub>s\<^sub>t s) < card (fv\<^sub>s\<^sub>t t) \<or> (card (fv\<^sub>s\<^sub>t s) = card (fv\<^sub>s\<^sub>t t) \<and> size\<^sub>s\<^sub>t s < size\<^sub>s\<^sub>t t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((s, x), t, y) \<in> measure\<^sub>s\<^sub>t) = (card (fv\<^sub>s\<^sub>t s) < card (fv\<^sub>s\<^sub>t t) \<or> card (fv\<^sub>s\<^sub>t s) = card (fv\<^sub>s\<^sub>t t) \<and> size\<^sub>s\<^sub>t s < size\<^sub>s\<^sub>t t)
[PROOF STEP]
by (simp add: measure\<^sub>s\<^sub>t_def size\<^sub>s\<^sub>t_def)


[STATEMENT]
lemma get_even_double: "\<exists>i. get_even n = 2 * i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i. get_even n = 2 * i
[PROOF STEP]
using get_even
[PROOF STATE]
proof (prove)
using this:
even (get_even ?n)

goal (1 subgoal):
 1. \<exists>i. get_even n = 2 * i
[PROOF STEP]
by (blast elim: evenE)


[STATEMENT]
lemma open_path_connected_component:
  fixes S :: "'a :: real_normed_vector set"
  shows "open S \<Longrightarrow> path_component S x = connected_component S x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open S \<Longrightarrow> path_component S x = connected_component S x
[PROOF STEP]
by (simp add: path_component_eq_connected_component open_imp_locally_path_connected)


[STATEMENT]
theorem Minkowski_inequality_le_1:
  assumes "p > (0::real)" "p \<le> 1"
      and [measurable, simp]: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
          "integrable M (\<lambda>x. \<bar>f x\<bar> powr p)"
          "integrable M (\<lambda>x. \<bar>g x\<bar> powr p)"
  shows "integrable M (\<lambda>x. \<bar>f x + g x\<bar> powr p)"
        "(\<integral>x. \<bar>f x + g x\<bar> powr p \<partial>M) powr (1/p)
          \<le> 2 powr (1/p-1) * (\<integral>x. \<bar>f x\<bar> powr p \<partial>M) powr (1/p) + 2 powr (1/p-1) * (\<integral>x. \<bar>g x\<bar> powr p \<partial>M) powr (1/p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>x. \<bar>f x + g x\<bar> powr p) &&& (LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> 2 powr (1 / p - 1) * (LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + 2 powr (1 / p - 1) * (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. integrable M (\<lambda>x. \<bar>f x + g x\<bar> powr p)
 2. (LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> 2 powr (1 / p - 1) * (LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + 2 powr (1 / p - 1) * (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)
[PROOF STEP]
have *: "\<bar>a + b\<bar> powr p \<le> \<bar>a\<bar> powr p + \<bar>b\<bar> powr p" for a b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>a + b\<bar> powr p \<le> \<bar>a\<bar> powr p + \<bar>b\<bar> powr p
[PROOF STEP]
using x_plus_y_p_le_xp_plus_yp[OF \<open>p > 0\<close> \<open>p \<le> 1\<close>, of "\<bar>a\<bar>" "\<bar>b\<bar>"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> \<bar>a\<bar>; 0 \<le> \<bar>b\<bar>\<rbrakk> \<Longrightarrow> (\<bar>a\<bar> + \<bar>b\<bar>) powr p \<le> \<bar>a\<bar> powr p + \<bar>b\<bar> powr p

goal (1 subgoal):
 1. \<bar>a + b\<bar> powr p \<le> \<bar>a\<bar> powr p + \<bar>b\<bar> powr p
[PROOF STEP]
by (auto, meson abs_ge_zero abs_triangle_ineq assms(1) le_less order.trans powr_mono2)
[PROOF STATE]
proof (state)
this:
\<bar>?a + ?b\<bar> powr p \<le> \<bar>?a\<bar> powr p + \<bar>?b\<bar> powr p

goal (2 subgoals):
 1. integrable M (\<lambda>x. \<bar>f x + g x\<bar> powr p)
 2. (LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> 2 powr (1 / p - 1) * (LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + 2 powr (1 / p - 1) * (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)
[PROOF STEP]
show "integrable M (\<lambda>x. \<bar>f x + g x\<bar> powr p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>x. \<bar>f x + g x\<bar> powr p)
[PROOF STEP]
by (rule Bochner_Integration.integrable_bound[of _ "\<lambda>x. \<bar>f x\<bar> powr p + \<bar>g x\<bar> powr p"], auto simp add: *)
[PROOF STATE]
proof (state)
this:
integrable M (\<lambda>x. \<bar>f x + g x\<bar> powr p)

goal (1 subgoal):
 1. (LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> 2 powr (1 / p - 1) * (LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + 2 powr (1 / p - 1) * (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)
[PROOF STEP]
have "(\<integral>x. \<bar>f x + g x\<bar> powr p \<partial>M) powr (1/p) \<le> (\<integral>x. \<bar>f x\<bar> powr p + \<bar>g x\<bar> powr p \<partial>M) powr (1/p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> (LINT x|M. \<bar>f x\<bar> powr p + \<bar>g x\<bar> powr p) powr (1 / p)
[PROOF STEP]
by (rule powr_mono2, simp add: \<open>p > 0\<close> less_imp_le, simp, rule integral_mono', auto simp add: *)
[PROOF STATE]
proof (state)
this:
(LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> (LINT x|M. \<bar>f x\<bar> powr p + \<bar>g x\<bar> powr p) powr (1 / p)

goal (1 subgoal):
 1. (LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> 2 powr (1 / p - 1) * (LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + 2 powr (1 / p - 1) * (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> (LINT x|M. \<bar>f x\<bar> powr p + \<bar>g x\<bar> powr p) powr (1 / p)

goal (1 subgoal):
 1. (LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> 2 powr (1 / p - 1) * (LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + 2 powr (1 / p - 1) * (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)
[PROOF STEP]
have "... = 2 powr (1/p) * (((\<integral>x. \<bar>f x\<bar> powr p \<partial>M) + (\<integral>x. \<bar>g x\<bar> powr p \<partial>M)) / 2) powr (1/p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LINT x|M. \<bar>f x\<bar> powr p + \<bar>g x\<bar> powr p) powr (1 / p) = 2 powr (1 / p) * (((LINT x|M. \<bar>f x\<bar> powr p) + (LINT x|M. \<bar>g x\<bar> powr p)) / 2) powr (1 / p)
[PROOF STEP]
by (auto simp add: powr_mult[symmetric] add_divide_distrib)
[PROOF STATE]
proof (state)
this:
(LINT x|M. \<bar>f x\<bar> powr p + \<bar>g x\<bar> powr p) powr (1 / p) = 2 powr (1 / p) * (((LINT x|M. \<bar>f x\<bar> powr p) + (LINT x|M. \<bar>g x\<bar> powr p)) / 2) powr (1 / p)

goal (1 subgoal):
 1. (LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> 2 powr (1 / p - 1) * (LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + 2 powr (1 / p - 1) * (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(LINT x|M. \<bar>f x\<bar> powr p + \<bar>g x\<bar> powr p) powr (1 / p) = 2 powr (1 / p) * (((LINT x|M. \<bar>f x\<bar> powr p) + (LINT x|M. \<bar>g x\<bar> powr p)) / 2) powr (1 / p)

goal (1 subgoal):
 1. (LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> 2 powr (1 / p - 1) * (LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + 2 powr (1 / p - 1) * (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)
[PROOF STEP]
have "... \<le> 2 powr (1/p) * (((\<integral>x. \<bar>f x\<bar> powr p \<partial>M) powr (1/p) + (\<integral>x. \<bar>g x\<bar> powr p \<partial>M) powr (1/p)) / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr (1 / p) * (((LINT x|M. \<bar>f x\<bar> powr p) + (LINT x|M. \<bar>g x\<bar> powr p)) / 2) powr (1 / p) \<le> 2 powr (1 / p) * (((LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)) / 2)
[PROOF STEP]
apply (rule mult_mono, simp, rule convex_on_mean_ineq[OF convex_powr[of "1/p"]])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. 1 \<le> 1 / p
 2. LINT x|M. \<bar>f x\<bar> powr p \<in> {0..}
 3. LINT x|M. \<bar>g x\<bar> powr p \<in> {0..}
 4. 0 \<le> 2 powr (1 / p)
 5. 0 \<le> (((LINT x|M. \<bar>f x\<bar> powr p) + (LINT x|M. \<bar>g x\<bar> powr p)) / 2) powr (1 / p)
[PROOF STEP]
using \<open>p \<le> 1\<close> \<open>p > 0\<close>
[PROOF STATE]
proof (prove)
using this:
p \<le> 1
0 < p

goal (5 subgoals):
 1. 1 \<le> 1 / p
 2. LINT x|M. \<bar>f x\<bar> powr p \<in> {0..}
 3. LINT x|M. \<bar>g x\<bar> powr p \<in> {0..}
 4. 0 \<le> 2 powr (1 / p)
 5. 0 \<le> (((LINT x|M. \<bar>f x\<bar> powr p) + (LINT x|M. \<bar>g x\<bar> powr p)) / 2) powr (1 / p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 powr (1 / p) * (((LINT x|M. \<bar>f x\<bar> powr p) + (LINT x|M. \<bar>g x\<bar> powr p)) / 2) powr (1 / p) \<le> 2 powr (1 / p) * (((LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)) / 2)

goal (1 subgoal):
 1. (LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> 2 powr (1 / p - 1) * (LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + 2 powr (1 / p - 1) * (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 powr (1 / p) * (((LINT x|M. \<bar>f x\<bar> powr p) + (LINT x|M. \<bar>g x\<bar> powr p)) / 2) powr (1 / p) \<le> 2 powr (1 / p) * (((LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)) / 2)

goal (1 subgoal):
 1. (LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> 2 powr (1 / p - 1) * (LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + 2 powr (1 / p - 1) * (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)
[PROOF STEP]
have "... = 2 powr (1/p - 1) * ((\<integral>x. \<bar>f x\<bar> powr p \<partial>M) powr (1/p) + (\<integral>x. \<bar>g x\<bar> powr p \<partial>M) powr (1/p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr (1 / p) * (((LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)) / 2) = 2 powr (1 / p - 1) * ((LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p))
[PROOF STEP]
by (simp add: powr_diff)
[PROOF STATE]
proof (state)
this:
2 powr (1 / p) * (((LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)) / 2) = 2 powr (1 / p - 1) * ((LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p))

goal (1 subgoal):
 1. (LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> 2 powr (1 / p - 1) * (LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + 2 powr (1 / p - 1) * (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> 2 powr (1 / p - 1) * ((LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p))
[PROOF STEP]
show "(\<integral>x. \<bar>f x + g x\<bar> powr p \<partial>M) powr (1/p)
      \<le> 2 powr (1/p-1) * (\<integral>x. \<bar>f x\<bar> powr p \<partial>M) powr (1/p) + 2 powr (1/p-1) * (\<integral>x. \<bar>g x\<bar> powr p \<partial>M) powr (1/p)"
[PROOF STATE]
proof (prove)
using this:
(LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> 2 powr (1 / p - 1) * ((LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p))

goal (1 subgoal):
 1. (LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> 2 powr (1 / p - 1) * (LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + 2 powr (1 / p - 1) * (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)
[PROOF STEP]
by (auto simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(LINT x|M. \<bar>f x + g x\<bar> powr p) powr (1 / p) \<le> 2 powr (1 / p - 1) * (LINT x|M. \<bar>f x\<bar> powr p) powr (1 / p) + 2 powr (1 / p - 1) * (LINT x|M. \<bar>g x\<bar> powr p) powr (1 / p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sums_vec_nth :
  assumes "f sums a"
  shows "(\<lambda>x. f x $ i) sums a $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f x $ i) sums a $ i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f sums a

goal (1 subgoal):
 1. (\<lambda>x. f x $ i) sums a $ i
[PROOF STEP]
unfolding sums_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> a

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>x<n. f x $ i) \<longlonglongrightarrow> a $ i
[PROOF STEP]
by (auto dest: tendsto_vec_nth [where i=i])


[STATEMENT]
lemma  count_mset_replicate_aux2:
  assumes "\<not> length xs < count_list xs True"
  shows "mset xs = mset (replicate (count_list xs True) True) + mset (replicate (length xs - count_list xs True) False)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset xs = mset (replicate (count_list xs True) True) + mset (replicate (length xs - count_list xs True) False)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mset xs = mset (replicate (count_list xs True) True) + mset (replicate (length xs - count_list xs True) False)
[PROOF STEP]
have "count_list xs B =
         count_list (replicate (count_list xs True) True) B + count_list (replicate (length xs - count_list xs True) False) B"
    for B
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_list xs B = count_list (replicate (count_list xs True) True) B + count_list (replicate (length xs - count_list xs True) False) B
[PROOF STEP]
proof(cases B)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. B \<Longrightarrow> count_list xs B = count_list (replicate (count_list xs True) True) B + count_list (replicate (length xs - count_list xs True) False) B
 2. \<not> B \<Longrightarrow> count_list xs B = count_list (replicate (count_list xs True) True) B + count_list (replicate (length xs - count_list xs True) False) B
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
B

goal (2 subgoals):
 1. B \<Longrightarrow> count_list xs B = count_list (replicate (count_list xs True) True) B + count_list (replicate (length xs - count_list xs True) False) B
 2. \<not> B \<Longrightarrow> count_list xs B = count_list (replicate (count_list xs True) True) B + count_list (replicate (length xs - count_list xs True) False) B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
B

goal (1 subgoal):
 1. count_list xs B = count_list (replicate (count_list xs True) True) B + count_list (replicate (length xs - count_list xs True) False) B
[PROOF STEP]
by (simp add: count_list_replicate)
[PROOF STATE]
proof (state)
this:
count_list xs B = count_list (replicate (count_list xs True) True) B + count_list (replicate (length xs - count_list xs True) False) B

goal (1 subgoal):
 1. \<not> B \<Longrightarrow> count_list xs B = count_list (replicate (count_list xs True) True) B + count_list (replicate (length xs - count_list xs True) False) B
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> B \<Longrightarrow> count_list xs B = count_list (replicate (count_list xs True) True) B + count_list (replicate (length xs - count_list xs True) False) B
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> B

goal (1 subgoal):
 1. \<not> B \<Longrightarrow> count_list xs B = count_list (replicate (count_list xs True) True) B + count_list (replicate (length xs - count_list xs True) False) B
[PROOF STEP]
have "count_list xs False = count_list (replicate (length xs - count_list xs True) False) False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_list xs False = count_list (replicate (length xs - count_list xs True) False) False
[PROOF STEP]
by (metis count_list_True_False count_list_replicate diff_add_inverse)
[PROOF STATE]
proof (state)
this:
count_list xs False = count_list (replicate (length xs - count_list xs True) False) False

goal (1 subgoal):
 1. \<not> B \<Longrightarrow> count_list xs B = count_list (replicate (count_list xs True) True) B + count_list (replicate (length xs - count_list xs True) False) B
[PROOF STEP]
from this False
[PROOF STATE]
proof (chain)
picking this:
count_list xs False = count_list (replicate (length xs - count_list xs True) False) False
\<not> B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
count_list xs False = count_list (replicate (length xs - count_list xs True) False) False
\<not> B

goal (1 subgoal):
 1. count_list xs B = count_list (replicate (count_list xs True) True) B + count_list (replicate (length xs - count_list xs True) False) B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
count_list xs False = count_list (replicate (length xs - count_list xs True) False) False
\<not> B
\<not> length xs < count_list xs True

goal (1 subgoal):
 1. count_list xs B = count_list (replicate (count_list xs True) True) B + count_list (replicate (length xs - count_list xs True) False) B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
count_list xs B = count_list (replicate (count_list xs True) True) B + count_list (replicate (length xs - count_list xs True) False) B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
count_list xs ?B = count_list (replicate (count_list xs True) True) ?B + count_list (replicate (length xs - count_list xs True) False) ?B

goal (1 subgoal):
 1. mset xs = mset (replicate (count_list xs True) True) + mset (replicate (length xs - count_list xs True) False)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
count_list xs ?B = count_list (replicate (count_list xs True) True) ?B + count_list (replicate (length xs - count_list xs True) False) ?B
[PROOF STEP]
have "count (mset xs) B =
         count (mset (replicate (count_list xs True) True) + mset (replicate (length xs - count_list xs True) False)) B"
    for B
[PROOF STATE]
proof (prove)
using this:
count_list xs ?B = count_list (replicate (count_list xs True) True) ?B + count_list (replicate (length xs - count_list xs True) False) ?B

goal (1 subgoal):
 1. count (mset xs) B = count (mset (replicate (count_list xs True) True) + mset (replicate (length xs - count_list xs True) False)) B
[PROOF STEP]
by (metis count_mset_count_list count_union)
[PROOF STATE]
proof (state)
this:
count (mset xs) ?B = count (mset (replicate (count_list xs True) True) + mset (replicate (length xs - count_list xs True) False)) ?B

goal (1 subgoal):
 1. mset xs = mset (replicate (count_list xs True) True) + mset (replicate (length xs - count_list xs True) False)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
count (mset xs) ?B = count (mset (replicate (count_list xs True) True) + mset (replicate (length xs - count_list xs True) False)) ?B
[PROOF STEP]
show "mset xs = mset (replicate (count_list xs True) True) + mset (replicate (length xs - count_list xs True) False)"
[PROOF STATE]
proof (prove)
using this:
count (mset xs) ?B = count (mset (replicate (count_list xs True) True) + mset (replicate (length xs - count_list xs True) False)) ?B

goal (1 subgoal):
 1. mset xs = mset (replicate (count_list xs True) True) + mset (replicate (length xs - count_list xs True) False)
[PROOF STEP]
using multiset_eqI
[PROOF STATE]
proof (prove)
using this:
count (mset xs) ?B = count (mset (replicate (count_list xs True) True) + mset (replicate (length xs - count_list xs True) False)) ?B
(\<And>x. count ?A x = count ?B x) \<Longrightarrow> ?A = ?B

goal (1 subgoal):
 1. mset xs = mset (replicate (count_list xs True) True) + mset (replicate (length xs - count_list xs True) False)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
mset xs = mset (replicate (count_list xs True) True) + mset (replicate (length xs - count_list xs True) False)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Conj_mono: "insert A H \<turnstile> B \<Longrightarrow> insert C H \<turnstile> D \<Longrightarrow> insert (A AND C) H \<turnstile> B AND D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>insert A H \<turnstile> B; insert C H \<turnstile> D\<rbrakk> \<Longrightarrow> insert (A AND C) H \<turnstile> B AND D
[PROOF STEP]
by (metis Conj_E1 Conj_E2 Conj_I Hyp Un_absorb2 cut insertI1 subset_insertI)


[STATEMENT]
lemma length_cols_mat_to_cols_list [simp]:
  assumes "j < dim_col A"
  shows "length [A $$ (i,j) . i <- [0..< dim_row A]] = dim_row A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (map (\<lambda>i. A $$ (i, j)) [0..<dim_row A]) = dim_row A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
j < dim_col A

goal (1 subgoal):
 1. length (map (\<lambda>i. A $$ (i, j)) [0..<dim_row A]) = dim_row A
[PROOF STEP]
by simp


[STATEMENT]
lemma distinct_binop:
  fixes xs::"('a::linorder * 'b) list" and ys::"('a::linorder * 'c) list"
  assumes "distinct (map fst xs)"
  assumes "distinct (map fst ys)"
  assumes "rsorted ((map fst xs))"
  assumes "rsorted ((map fst ys))"
  shows "distinct (map fst (binop f z1 z2 xs ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (map fst (binop f z1 z2 xs ys))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct (map fst xs)
distinct (map fst ys)
rsorted (map fst xs)
rsorted (map fst ys)

goal (1 subgoal):
 1. distinct (map fst (binop f z1 z2 xs ys))
[PROOF STEP]
by (induct f z1 z2 xs ys rule: binop.induct)
    (force dest!: set_binop_elemD1 simp: sorted_append)+


[STATEMENT]
lemma Arg_times_of_real [simp]:
  assumes "0 < r" shows "Arg (of_real r * z) = Arg z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg (complex_of_real r * z) = Arg z
[PROOF STEP]
proof (cases "z=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z = 0 \<Longrightarrow> Arg (complex_of_real r * z) = Arg z
 2. z \<noteq> 0 \<Longrightarrow> Arg (complex_of_real r * z) = Arg z
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
z = 0

goal (2 subgoals):
 1. z = 0 \<Longrightarrow> Arg (complex_of_real r * z) = Arg z
 2. z \<noteq> 0 \<Longrightarrow> Arg (complex_of_real r * z) = Arg z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z = 0

goal (1 subgoal):
 1. Arg (complex_of_real r * z) = Arg z
[PROOF STEP]
by (simp add: Arg_def)
[PROOF STATE]
proof (state)
this:
Arg (complex_of_real r * z) = Arg z

goal (1 subgoal):
 1. z \<noteq> 0 \<Longrightarrow> Arg (complex_of_real r * z) = Arg z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z \<noteq> 0 \<Longrightarrow> Arg (complex_of_real r * z) = Arg z
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
z \<noteq> 0

goal (1 subgoal):
 1. z \<noteq> 0 \<Longrightarrow> Arg (complex_of_real r * z) = Arg z
[PROOF STEP]
with Arg_eq assms
[PROOF STATE]
proof (chain)
picking this:
?z \<noteq> 0 \<Longrightarrow> ?z = complex_of_real (cmod ?z) * exp (\<i> * complex_of_real (Arg ?z))
0 < r
z \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?z \<noteq> 0 \<Longrightarrow> ?z = complex_of_real (cmod ?z) * exp (\<i> * complex_of_real (Arg ?z))
0 < r
z \<noteq> 0

goal (1 subgoal):
 1. Arg (complex_of_real r * z) = Arg z
[PROOF STEP]
by (auto simp: mpi_less_Arg Arg_le_pi intro!:  Arg_unique [of "r * norm z"])
[PROOF STATE]
proof (state)
this:
Arg (complex_of_real r * z) = Arg z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma affine_dependent_translation_eq:
  "affine_dependent S \<longleftrightarrow> affine_dependent ((\<lambda>x. a + x) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine_dependent S = affine_dependent ((+) a ` S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. affine_dependent S = affine_dependent ((+) a ` S)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. affine_dependent S = affine_dependent ((+) a ` S)
[PROOF STEP]
assume "affine_dependent ((\<lambda>x. a + x) ` S)"
[PROOF STATE]
proof (state)
this:
affine_dependent ((+) a ` S)

goal (1 subgoal):
 1. affine_dependent S = affine_dependent ((+) a ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
affine_dependent ((+) a ` S)
[PROOF STEP]
have "affine_dependent S"
[PROOF STATE]
proof (prove)
using this:
affine_dependent ((+) a ` S)

goal (1 subgoal):
 1. affine_dependent S
[PROOF STEP]
using affine_dependent_translation[of "((\<lambda>x. a + x) ` S)" "-a"] translation_assoc[of "-a" a]
[PROOF STATE]
proof (prove)
using this:
affine_dependent ((+) a ` S)
affine_dependent ((+) a ` S) \<Longrightarrow> affine_dependent ((+) (- a) ` (+) a ` S)
(+) (- a) ` (+) a ` ?S = (+) (a + - a) ` ?S

goal (1 subgoal):
 1. affine_dependent S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
affine_dependent S

goal (1 subgoal):
 1. affine_dependent S = affine_dependent ((+) a ` S)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
affine_dependent ((+) a ` S) \<Longrightarrow> affine_dependent S

goal (1 subgoal):
 1. affine_dependent S = affine_dependent ((+) a ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
affine_dependent ((+) a ` S) \<Longrightarrow> affine_dependent S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
affine_dependent ((+) a ` S) \<Longrightarrow> affine_dependent S

goal (1 subgoal):
 1. affine_dependent S = affine_dependent ((+) a ` S)
[PROOF STEP]
using affine_dependent_translation
[PROOF STATE]
proof (prove)
using this:
affine_dependent ((+) a ` S) \<Longrightarrow> affine_dependent S
affine_dependent ?S \<Longrightarrow> affine_dependent ((+) ?a ` ?S)

goal (1 subgoal):
 1. affine_dependent S = affine_dependent ((+) a ` S)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
affine_dependent S = affine_dependent ((+) a ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma echelon_form_upt_k_condition1:
  assumes "echelon_form_upt_k A k" "is_zero_row_upt_k i k A"
  shows "\<not> (\<exists>j. j>i \<and> \<not> is_zero_row_upt_k j k A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<exists>j>i. \<not> is_zero_row_upt_k j k A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
echelon_form_upt_k A k
is_zero_row_upt_k i k A

goal (1 subgoal):
 1. \<not> (\<exists>j>i. \<not> is_zero_row_upt_k j k A)
[PROOF STEP]
unfolding echelon_form_upt_k_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>i. is_zero_row_upt_k i k A \<longrightarrow> \<not> (\<exists>j>i. \<not> is_zero_row_upt_k j k A)) \<and> (\<forall>i j. i < j \<and> \<not> is_zero_row_upt_k i k A \<and> \<not> is_zero_row_upt_k j k A \<longrightarrow> (LEAST n. A $ i $ n \<noteq> (0::'a)) < (LEAST n. A $ j $ n \<noteq> (0::'a)))
is_zero_row_upt_k i k A

goal (1 subgoal):
 1. \<not> (\<exists>j>i. \<not> is_zero_row_upt_k j k A)
[PROOF STEP]
by auto


[STATEMENT]
lemma weighted_arithmetic_geometric_mean_pos:
  fixes a w :: "'a \<Rightarrow> real"
  assumes "finite X"
  assumes pos1: "\<And>x. x \<in> X \<Longrightarrow> a x > 0"
  assumes pos2: "\<And>x. x \<in> X \<Longrightarrow> w x > 0"
  assumes sum_weights: "(\<Sum>x\<in>X. w x) = 1"
  shows   "(\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
note nonneg1 = less_imp_le[OF pos1]
[PROOF STATE]
proof (state)
this:
?x1 \<in> X \<Longrightarrow> 0 \<le> a ?x1

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
note nonneg2 = less_imp_le[OF pos2]
[PROOF STATE]
proof (state)
this:
?x1 \<in> X \<Longrightarrow> 0 \<le> w ?x1

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
define A where "A = (\<Sum>x\<in>X. w x * a x)"
[PROOF STATE]
proof (state)
this:
A = (\<Sum>x\<in>X. w x * a x)

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
define r where "r = (\<lambda>x. a x / A - 1)"
[PROOF STATE]
proof (state)
this:
r = (\<lambda>x. a x / A - 1)

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
from sum_weights
[PROOF STATE]
proof (chain)
picking this:
sum w X = 1
[PROOF STEP]
have "X \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
sum w X = 1

goal (1 subgoal):
 1. X \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X \<noteq> {}

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
hence "A \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
X \<noteq> {}

goal (1 subgoal):
 1. A \<noteq> 0
[PROOF STEP]
unfolding A_def
[PROOF STATE]
proof (prove)
using this:
X \<noteq> {}

goal (1 subgoal):
 1. (\<Sum>x\<in>X. w x * a x) \<noteq> 0
[PROOF STEP]
using nonneg1 nonneg2 pos1 pos2 \<open>finite X\<close>
[PROOF STATE]
proof (prove)
using this:
X \<noteq> {}
?x1 \<in> X \<Longrightarrow> 0 \<le> a ?x1
?x1 \<in> X \<Longrightarrow> 0 \<le> w ?x1
?x \<in> X \<Longrightarrow> 0 < a ?x
?x \<in> X \<Longrightarrow> 0 < w ?x
finite X

goal (1 subgoal):
 1. (\<Sum>x\<in>X. w x * a x) \<noteq> 0
[PROOF STEP]
by (subst sum_nonneg_eq_0_iff) force+
[PROOF STATE]
proof (state)
this:
A \<noteq> 0

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
A \<noteq> 0

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
from nonneg1 nonneg2
[PROOF STATE]
proof (chain)
picking this:
?x1 \<in> X \<Longrightarrow> 0 \<le> a ?x1
?x1 \<in> X \<Longrightarrow> 0 \<le> w ?x1
[PROOF STEP]
have "A \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
?x1 \<in> X \<Longrightarrow> 0 \<le> a ?x1
?x1 \<in> X \<Longrightarrow> 0 \<le> w ?x1

goal (1 subgoal):
 1. 0 \<le> A
[PROOF STEP]
by (auto simp: A_def intro!: sum_nonneg)
[PROOF STATE]
proof (state)
this:
0 \<le> A

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
A \<noteq> 0
0 \<le> A
[PROOF STEP]
have "A > 0"
[PROOF STATE]
proof (prove)
using this:
A \<noteq> 0
0 \<le> A

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

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
have "(\<Prod>x\<in>X. (1 + r x) powr w x) = (\<Prod>x\<in>X. (a x / A) powr w x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>X. (1 + r x) powr w x) = (\<Prod>x\<in>X. (a x / A) powr w x)
[PROOF STEP]
by (simp add: r_def)
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. (1 + r x) powr w x) = (\<Prod>x\<in>X. (a x / A) powr w x)

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. (1 + r x) powr w x) = (\<Prod>x\<in>X. (a x / A) powr w x)

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
have "\<dots> = (\<Prod>x\<in>X. a x powr w x) / (\<Prod>x\<in>X. A powr w x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>X. (a x / A) powr w x) = (\<Prod>x\<in>X. a x powr w x) / (\<Prod>x\<in>X. A powr w x)
[PROOF STEP]
unfolding prod_dividef [symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>X. (a x / A) powr w x) = (\<Prod>x\<in>X. a x powr w x / A powr w x)
[PROOF STEP]
using assms pos2 \<open>A > 0\<close>
[PROOF STATE]
proof (prove)
using this:
finite X
?x \<in> X \<Longrightarrow> 0 < a ?x
?x \<in> X \<Longrightarrow> 0 < w ?x
sum w X = 1
?x \<in> X \<Longrightarrow> 0 < w ?x
0 < A

goal (1 subgoal):
 1. (\<Prod>x\<in>X. (a x / A) powr w x) = (\<Prod>x\<in>X. a x powr w x / A powr w x)
[PROOF STEP]
by (intro prod.cong powr_divide) (auto intro: less_imp_le)
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. (a x / A) powr w x) = (\<Prod>x\<in>X. a x powr w x) / (\<Prod>x\<in>X. A powr w x)

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. (a x / A) powr w x) = (\<Prod>x\<in>X. a x powr w x) / (\<Prod>x\<in>X. A powr w x)

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
have "(\<Prod>x\<in>X. A powr w x) = exp ((\<Sum>x\<in>X. w x) * ln A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>X. A powr w x) = exp (sum w X * ln A)
[PROOF STEP]
using \<open>A > 0\<close> and \<open>finite X\<close>
[PROOF STATE]
proof (prove)
using this:
0 < A
finite X

goal (1 subgoal):
 1. (\<Prod>x\<in>X. A powr w x) = exp (sum w X * ln A)
[PROOF STEP]
by (simp add: powr_def exp_sum sum_distrib_right)
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. A powr w x) = exp (sum w X * ln A)

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. A powr w x) = exp (sum w X * ln A)

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
have "(\<Sum>x\<in>X. w x) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum w X = 1
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
sum w X = 1

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum w X = 1

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
have "exp (1 * ln A) = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (1 * ln A) = A
[PROOF STEP]
using \<open>A > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < A

goal (1 subgoal):
 1. exp (1 * ln A) = A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
exp (1 * ln A) = A

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>x\<in>X. (1 + r x) powr w x) = (\<Prod>x\<in>X. a x powr w x) / A
[PROOF STEP]
have lhs: "(\<Prod>x\<in>X. (1 + r x) powr w x) = (\<Prod>x\<in>X. a x powr w x) / A"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>x\<in>X. (1 + r x) powr w x) = (\<Prod>x\<in>X. a x powr w x) / A

goal (1 subgoal):
 1. (\<Prod>x\<in>X. (1 + r x) powr w x) = (\<Prod>x\<in>X. a x powr w x) / A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. (1 + r x) powr w x) = (\<Prod>x\<in>X. a x powr w x) / A

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
have "(\<Prod>x\<in>X. exp (w x * r x)) = exp (\<Sum>x\<in>X. w x * r x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>X. exp (w x * r x)) = exp (\<Sum>x\<in>X. w x * r x)
[PROOF STEP]
using \<open>finite X\<close>
[PROOF STATE]
proof (prove)
using this:
finite X

goal (1 subgoal):
 1. (\<Prod>x\<in>X. exp (w x * r x)) = exp (\<Sum>x\<in>X. w x * r x)
[PROOF STEP]
by (simp add: exp_sum)
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. exp (w x * r x)) = exp (\<Sum>x\<in>X. w x * r x)

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. exp (w x * r x)) = exp (\<Sum>x\<in>X. w x * r x)

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
have "(\<Sum>x\<in>X. w x * r x) = (\<Sum>x\<in>X. a x * w x) / A - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>X. w x * r x) = (\<Sum>x\<in>X. a x * w x) / A - 1
[PROOF STEP]
using \<open>A > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < A

goal (1 subgoal):
 1. (\<Sum>x\<in>X. w x * r x) = (\<Sum>x\<in>X. a x * w x) / A - 1
[PROOF STEP]
by (simp add: r_def algebra_simps sum_subtractf sum_divide_distrib sum_weights)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>X. w x * r x) = (\<Sum>x\<in>X. a x * w x) / A - 1

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>X. w x * r x) = (\<Sum>x\<in>X. a x * w x) / A - 1

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
have "(\<Sum>x\<in>X. a x * w x) / A = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>X. a x * w x) / A = 1
[PROOF STEP]
using \<open>A > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < A

goal (1 subgoal):
 1. (\<Sum>x\<in>X. a x * w x) / A = 1
[PROOF STEP]
by (simp add: A_def mult.commute)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>X. a x * w x) / A = 1

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>x\<in>X. exp (w x * r x)) = exp (1 - 1)
[PROOF STEP]
have rhs: "(\<Prod>x\<in>X. exp (w x * r x)) = 1"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>x\<in>X. exp (w x * r x)) = exp (1 - 1)

goal (1 subgoal):
 1. (\<Prod>x\<in>X. exp (w x * r x)) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. exp (w x * r x)) = 1

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
have "(\<Prod>x\<in>X. a x powr w x) / A = (\<Prod>x\<in>X. (1 + r x) powr w x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) / A = (\<Prod>x\<in>X. (1 + r x) powr w x)
[PROOF STEP]
by (fact lhs [symmetric])
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. a x powr w x) / A = (\<Prod>x\<in>X. (1 + r x) powr w x)

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. a x powr w x) / A = (\<Prod>x\<in>X. (1 + r x) powr w x)

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
have "(\<Prod>x\<in>X. (1 + r x) powr w x) \<le> (\<Prod>x\<in>X. exp (w x * r x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>X. (1 + r x) powr w x) \<le> (\<Prod>x\<in>X. exp (w x * r x))
[PROOF STEP]
proof (intro prod_mono conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> 0 \<le> (1 + r i) powr w i
 2. \<And>i. i \<in> X \<Longrightarrow> (1 + r i) powr w i \<le> exp (w i * r i)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> 0 \<le> (1 + r i) powr w i
 2. \<And>i. i \<in> X \<Longrightarrow> (1 + r i) powr w i \<le> exp (w i * r i)
[PROOF STEP]
assume x: "x \<in> X"
[PROOF STATE]
proof (state)
this:
x \<in> X

goal (2 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> 0 \<le> (1 + r i) powr w i
 2. \<And>i. i \<in> X \<Longrightarrow> (1 + r i) powr w i \<le> exp (w i * r i)
[PROOF STEP]
have "1 + r x \<le> exp (r x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + r x \<le> exp (r x)
[PROOF STEP]
by (rule exp_ge_add_one_self)
[PROOF STATE]
proof (state)
this:
1 + r x \<le> exp (r x)

goal (2 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> 0 \<le> (1 + r i) powr w i
 2. \<And>i. i \<in> X \<Longrightarrow> (1 + r i) powr w i \<le> exp (w i * r i)
[PROOF STEP]
hence "(1 + r x) powr w x \<le> exp (r x) powr w x"
[PROOF STATE]
proof (prove)
using this:
1 + r x \<le> exp (r x)

goal (1 subgoal):
 1. (1 + r x) powr w x \<le> exp (r x) powr w x
[PROOF STEP]
using nonneg1[of x] nonneg2[of x] x \<open>A > 0\<close>
[PROOF STATE]
proof (prove)
using this:
1 + r x \<le> exp (r x)
x \<in> X \<Longrightarrow> 0 \<le> a x
x \<in> X \<Longrightarrow> 0 \<le> w x
x \<in> X
0 < A

goal (1 subgoal):
 1. (1 + r x) powr w x \<le> exp (r x) powr w x
[PROOF STEP]
by (intro powr_mono2) (auto simp: r_def field_simps)
[PROOF STATE]
proof (state)
this:
(1 + r x) powr w x \<le> exp (r x) powr w x

goal (2 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> 0 \<le> (1 + r i) powr w i
 2. \<And>i. i \<in> X \<Longrightarrow> (1 + r i) powr w i \<le> exp (w i * r i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 + r x) powr w x \<le> exp (r x) powr w x

goal (2 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> 0 \<le> (1 + r i) powr w i
 2. \<And>i. i \<in> X \<Longrightarrow> (1 + r i) powr w i \<le> exp (w i * r i)
[PROOF STEP]
have "\<dots> = exp (w x * r x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (r x) powr w x = exp (w x * r x)
[PROOF STEP]
by (simp add: powr_def)
[PROOF STATE]
proof (state)
this:
exp (r x) powr w x = exp (w x * r x)

goal (2 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> 0 \<le> (1 + r i) powr w i
 2. \<And>i. i \<in> X \<Longrightarrow> (1 + r i) powr w i \<le> exp (w i * r i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(1 + r x) powr w x \<le> exp (w x * r x)
[PROOF STEP]
show "(1 + r x) powr w x \<le> exp (w x * r x)"
[PROOF STATE]
proof (prove)
using this:
(1 + r x) powr w x \<le> exp (w x * r x)

goal (1 subgoal):
 1. (1 + r x) powr w x \<le> exp (w x * r x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(1 + r x) powr w x \<le> exp (w x * r x)

goal (1 subgoal):
 1. \<And>i. i \<in> X \<Longrightarrow> 0 \<le> (1 + r i) powr w i
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. (1 + r x) powr w x) \<le> (\<Prod>x\<in>X. exp (w x * r x))

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. (1 + r x) powr w x) \<le> (\<Prod>x\<in>X. exp (w x * r x))

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
have "(\<Prod>x\<in>X. exp (w x * r x)) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>X. exp (w x * r x)) = 1
[PROOF STEP]
by (fact rhs)
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. exp (w x * r x)) = 1

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> (\<Sum>x\<in>X. w x * a x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>x\<in>X. a x powr w x) / A \<le> 1
[PROOF STEP]
show "(\<Prod>x\<in>X. a x powr w x) \<le> A"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>x\<in>X. a x powr w x) / A \<le> 1

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> A
[PROOF STEP]
using \<open>A > 0\<close>
[PROOF STATE]
proof (prove)
using this:
(\<Prod>x\<in>X. a x powr w x) / A \<le> 1
0 < A

goal (1 subgoal):
 1. (\<Prod>x\<in>X. a x powr w x) \<le> A
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. a x powr w x) \<le> A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size1_imbal:
  assumes "\<not> bal_log t" and "bal_log (hchild t)" and "t \<noteq> Leaf"
  shows "imbal t > (2 powr (1 - 1/c) - 1) * size1 (t) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)
[PROOF STEP]
obtain l x r where t: "t = Node l x r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>l x r. t = \<langle>l, x, r\<rangle> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>t \<noteq> Leaf\<close>
[PROOF STATE]
proof (prove)
using this:
t \<noteq> \<langle>\<rangle>

goal (1 subgoal):
 1. (\<And>l x r. t = \<langle>l, x, r\<rangle> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by(auto simp: neq_Leaf_iff)
[PROOF STATE]
proof (state)
this:
t = \<langle>l, x, r\<rangle>

goal (1 subgoal):
 1. (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)
[PROOF STEP]
let ?sh = "hchild t"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)
[PROOF STEP]
have *: "c * log 2 (size1 ?sh) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> c * log 2 (real (size1 (hchild t)))
[PROOF STEP]
using c1
[PROOF STATE]
proof (prove)
using this:
1 < c

goal (1 subgoal):
 1. 0 \<le> c * log 2 (real (size1 (hchild t)))
[PROOF STEP]
apply(simp add: zero_le_mult_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < c \<Longrightarrow> 1 \<le> real (size1 (hchild t))
[PROOF STEP]
using size1_ge0[of ?sh]
[PROOF STATE]
proof (prove)
using this:
0 < size1 (hchild t)

goal (1 subgoal):
 1. 1 < c \<Longrightarrow> 1 \<le> real (size1 (hchild t))
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
0 \<le> c * log 2 (real (size1 (hchild t)))

goal (1 subgoal):
 1. (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)
[PROOF STEP]
have "(2 powr (1 - 1/c) - 1) * size1 t - 1
    = 2 powr (1 - 1/c) * size1 t - size1 t - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 = 2 powr (1 - 1 / c) * real (size1 t) - real (size1 t) - 1
[PROOF STEP]
by (simp add: ring_distribs)
[PROOF STATE]
proof (state)
this:
(2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 = 2 powr (1 - 1 / c) * real (size1 t) - real (size1 t) - 1

goal (1 subgoal):
 1. (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 = 2 powr (1 - 1 / c) * real (size1 t) - real (size1 t) - 1

goal (1 subgoal):
 1. (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)
[PROOF STEP]
have "\<dots> = 2 * (2 powr (- 1/c) * size1 t) - size1 t - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr (1 - 1 / c) * real (size1 t) - real (size1 t) - 1 = 2 * (2 powr (- 1 / c) * real (size1 t)) - real (size1 t) - 1
[PROOF STEP]
using c1
[PROOF STATE]
proof (prove)
using this:
1 < c

goal (1 subgoal):
 1. 2 powr (1 - 1 / c) * real (size1 t) - real (size1 t) - 1 = 2 * (2 powr (- 1 / c) * real (size1 t)) - real (size1 t) - 1
[PROOF STEP]
by(simp add: powr_minus powr_add[symmetric] field_simps)
[PROOF STATE]
proof (state)
this:
2 powr (1 - 1 / c) * real (size1 t) - real (size1 t) - 1 = 2 * (2 powr (- 1 / c) * real (size1 t)) - real (size1 t) - 1

goal (1 subgoal):
 1. (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 powr (1 - 1 / c) * real (size1 t) - real (size1 t) - 1 = 2 * (2 powr (- 1 / c) * real (size1 t)) - real (size1 t) - 1

goal (1 subgoal):
 1. (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)
[PROOF STEP]
have "2 powr (- 1/c) * size1 t < size1 ?sh"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr (- 1 / c) * real (size1 t) < real (size1 (hchild t))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 powr (- 1 / c) * real (size1 t) < real (size1 (hchild t))
[PROOF STEP]
have "ceiling(c * log 2 (size1 t)) < ceiling (c * log 2 (size1 ?sh)) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>c * log 2 (real (size1 t))\<rceil> < \<lceil>c * log 2 (real (size1 (hchild t)))\<rceil> + 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lceil>c * log 2 (real (size1 t))\<rceil> < \<lceil>c * log 2 (real (size1 (hchild t)))\<rceil> + 1
[PROOF STEP]
have "ceiling(c * log 2 (size1 t)) < height t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>c * log 2 (real (size1 t))\<rceil> < int (height t)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
\<not> bal_log t

goal (1 subgoal):
 1. \<lceil>c * log 2 (real (size1 t))\<rceil> < int (height t)
[PROOF STEP]
by (simp add: bal_log_def)
[PROOF STATE]
proof (state)
this:
\<lceil>c * log 2 (real (size1 t))\<rceil> < int (height t)

goal (1 subgoal):
 1. \<lceil>c * log 2 (real (size1 t))\<rceil> < \<lceil>c * log 2 (real (size1 (hchild t)))\<rceil> + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<lceil>c * log 2 (real (size1 t))\<rceil> < int (height t)

goal (1 subgoal):
 1. \<lceil>c * log 2 (real (size1 t))\<rceil> < \<lceil>c * log 2 (real (size1 (hchild t)))\<rceil> + 1
[PROOF STEP]
have "\<dots> = height(?sh) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (height t) = int (height (hchild t) + 1)
[PROOF STEP]
by(simp add: t max_def)
[PROOF STATE]
proof (state)
this:
int (height t) = int (height (hchild t) + 1)

goal (1 subgoal):
 1. \<lceil>c * log 2 (real (size1 t))\<rceil> < \<lceil>c * log 2 (real (size1 (hchild t)))\<rceil> + 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<lceil>c * log 2 (real (size1 t))\<rceil> < int (height (hchild t) + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lceil>c * log 2 (real (size1 t))\<rceil> < int (height (hchild t) + 1)

goal (1 subgoal):
 1. \<lceil>c * log 2 (real (size1 t))\<rceil> < \<lceil>c * log 2 (real (size1 (hchild t)))\<rceil> + 1
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
\<lceil>c * log 2 (real (size1 t))\<rceil> < int (height (hchild t) + 1)
bal_log (hchild t)

goal (1 subgoal):
 1. \<lceil>c * log 2 (real (size1 t))\<rceil> < \<lceil>c * log 2 (real (size1 (hchild t)))\<rceil> + 1
[PROOF STEP]
unfolding bal_log_def
[PROOF STATE]
proof (prove)
using this:
\<lceil>c * log 2 (real (size1 t))\<rceil> < int (height (hchild t) + 1)
int (height (hchild t)) \<le> \<lceil>c * log 2 (real (size1 (hchild t)))\<rceil>

goal (1 subgoal):
 1. \<lceil>c * log 2 (real (size1 t))\<rceil> < \<lceil>c * log 2 (real (size1 (hchild t)))\<rceil> + 1
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<lceil>c * log 2 (real (size1 t))\<rceil> < \<lceil>c * log 2 (real (size1 (hchild t)))\<rceil> + 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lceil>c * log 2 (real (size1 t))\<rceil> < \<lceil>c * log 2 (real (size1 (hchild t)))\<rceil> + 1

goal (1 subgoal):
 1. 2 powr (- 1 / c) * real (size1 t) < real (size1 (hchild t))
[PROOF STEP]
hence "c * log 2 (size1 t) < c * log 2 (size1 ?sh) + 1"
[PROOF STATE]
proof (prove)
using this:
\<lceil>c * log 2 (real (size1 t))\<rceil> < \<lceil>c * log 2 (real (size1 (hchild t)))\<rceil> + 1

goal (1 subgoal):
 1. c * log 2 (real (size1 t)) < c * log 2 (real (size1 (hchild t))) + 1
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
\<lceil>c * log 2 (real (size1 t))\<rceil> < \<lceil>c * log 2 (real (size1 (hchild t)))\<rceil> + 1
0 \<le> c * log 2 (real (size1 (hchild t)))

goal (1 subgoal):
 1. c * log 2 (real (size1 t)) < c * log 2 (real (size1 (hchild t))) + 1
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
c * log 2 (real (size1 t)) < c * log 2 (real (size1 (hchild t))) + 1

goal (1 subgoal):
 1. 2 powr (- 1 / c) * real (size1 t) < real (size1 (hchild t))
[PROOF STEP]
hence "log 2 (size1 t) - 1/c < log 2 (size1 ?sh)"
[PROOF STATE]
proof (prove)
using this:
c * log 2 (real (size1 t)) < c * log 2 (real (size1 (hchild t))) + 1

goal (1 subgoal):
 1. log 2 (real (size1 t)) - 1 / c < log 2 (real (size1 (hchild t)))
[PROOF STEP]
using c1
[PROOF STATE]
proof (prove)
using this:
c * log 2 (real (size1 t)) < c * log 2 (real (size1 (hchild t))) + 1
1 < c

goal (1 subgoal):
 1. log 2 (real (size1 t)) - 1 / c < log 2 (real (size1 (hchild t)))
[PROOF STEP]
by(simp add: field_simps)
[PROOF STATE]
proof (state)
this:
log 2 (real (size1 t)) - 1 / c < log 2 (real (size1 (hchild t)))

goal (1 subgoal):
 1. 2 powr (- 1 / c) * real (size1 t) < real (size1 (hchild t))
[PROOF STEP]
from powr_less_mono[OF this, of 2]
[PROOF STATE]
proof (chain)
picking this:
1 < 2 \<Longrightarrow> 2 powr (log 2 (real (size1 t)) - 1 / c) < 2 powr log 2 (real (size1 (hchild t)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 < 2 \<Longrightarrow> 2 powr (log 2 (real (size1 t)) - 1 / c) < 2 powr log 2 (real (size1 (hchild t)))

goal (1 subgoal):
 1. 2 powr (- 1 / c) * real (size1 t) < real (size1 (hchild t))
[PROOF STEP]
by (simp add: powr_diff powr_minus field_simps)
[PROOF STATE]
proof (state)
this:
2 powr (- 1 / c) * real (size1 t) < real (size1 (hchild t))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
2 powr (- 1 / c) * real (size1 t) < real (size1 (hchild t))

goal (1 subgoal):
 1. (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 powr (- 1 / c) * real (size1 t) < real (size1 (hchild t))

goal (1 subgoal):
 1. (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)
[PROOF STEP]
have "2 * real(size1 ?sh) - size1 t - 1
           = real(size1 ?sh) - (real(size1 t) - size1 ?sh) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * real (size1 (hchild t)) - real (size1 t) - 1 = real (size1 (hchild t)) - (real (size1 t) - real (size1 (hchild t))) - 1
[PROOF STEP]
by (simp add: assms(1))
[PROOF STATE]
proof (state)
this:
2 * real (size1 (hchild t)) - real (size1 t) - 1 = real (size1 (hchild t)) - (real (size1 t) - real (size1 (hchild t))) - 1

goal (1 subgoal):
 1. (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * real (size1 (hchild t)) - real (size1 t) - 1 = real (size1 (hchild t)) - (real (size1 t) - real (size1 (hchild t))) - 1

goal (1 subgoal):
 1. (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)
[PROOF STEP]
have "\<dots> \<le> imbal t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (size1 (hchild t)) - (real (size1 t) - real (size1 (hchild t))) - 1 \<le> real (imbal t)
[PROOF STEP]
by (auto simp add: t assms(1) imbal.simps size1_size)
[PROOF STATE]
proof (state)
this:
real (size1 (hchild t)) - (real (size1 t) - real (size1 (hchild t))) - 1 \<le> real (imbal t)

goal (1 subgoal):
 1. (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x < y \<Longrightarrow> 2 * x - real (size1 t) - 1 < 2 * y - real (size1 t) - 1) \<Longrightarrow> (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x < y \<Longrightarrow> 2 * x - real (size1 t) - 1 < 2 * y - real (size1 t) - 1) \<Longrightarrow> (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)

goal (1 subgoal):
 1. (2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(2 powr (1 - 1 / c) - 1) * real (size1 t) - 1 < real (imbal t)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma alt_group_inv_closed:
  assumes "p \<in> carrier (alt_group n)" shows "inv' p \<in> carrier (alt_group n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv' p \<in> carrier (alt_group n)
[PROOF STEP]
using evenperm_inv[OF alt_group_carrier'] permutes_inv assms alt_group_carrier
[PROOF STATE]
proof (prove)
using this:
?p \<in> carrier (alt_group ?n1) \<Longrightarrow> evenperm (inv' ?p) = evenperm ?p
?p permutes ?S \<Longrightarrow> inv' ?p permutes ?S
p \<in> carrier (alt_group n)
(?p \<in> carrier (alt_group ?n)) = (?p permutes {1..?n} \<and> evenperm ?p)

goal (1 subgoal):
 1. inv' p \<in> carrier (alt_group n)
[PROOF STEP]
by auto


[STATEMENT]
lemma relcompp_in_rel: "in_rel R OO in_rel S = in_rel (R O S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. in_rel R OO in_rel S = in_rel (R O S)
[PROOF STEP]
unfolding fun_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x xa. (in_rel R OO in_rel S) x xa = in_rel (R O S) x xa
[PROOF STEP]
by auto


[STATEMENT]
lemma mem_not_sym: "\<not> (x \<in> elts y \<and> y \<in> elts x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (x \<in> elts y \<and> y \<in> elts x)
[PROOF STEP]
using wf_not_sym [OF foundation]
[PROOF STATE]
proof (prove)
using this:
(?a, ?x) \<in> {(x, y). x \<in> elts y} \<Longrightarrow> (?x, ?a) \<notin> {(x, y). x \<in> elts y}

goal (1 subgoal):
 1. \<not> (x \<in> elts y \<and> y \<in> elts x)
[PROOF STEP]
by force


[STATEMENT]
lemma aux0_5: " \<not> (\<exists> a b. (a\<oplus>b) \<in> set x) \<Longrightarrow> singleCombinators x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nexists>a b. a \<oplus> b \<in> set x \<Longrightarrow> singleCombinators x
[PROOF STEP]
apply (induct "x")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<nexists>a b. a \<oplus> b \<in> set [] \<Longrightarrow> singleCombinators []
 2. \<And>a x. \<lbrakk>\<nexists>a b. a \<oplus> b \<in> set x \<Longrightarrow> singleCombinators x; \<nexists>aa b. aa \<oplus> b \<in> set (a # x)\<rbrakk> \<Longrightarrow> singleCombinators (a # x)
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a x. \<lbrakk>singleCombinators x; \<forall>aa b. aa \<oplus> b \<noteq> a \<and> aa \<oplus> b \<notin> set x\<rbrakk> \<Longrightarrow> singleCombinators (a # x)
[PROOF STEP]
by (metis aux0_6)


[STATEMENT]
lemma is_ortho_set_empty[simp]: "is_ortho_set {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_ortho_set {}
[PROOF STEP]
unfolding is_ortho_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>{}. \<forall>y\<in>{}. x \<noteq> y \<longrightarrow> is_orthogonal x y) \<and> (0::'a) \<notin> {}
[PROOF STEP]
by auto


[STATEMENT]
lemma valid_subgraph:
    assumes "subgraph H G"
    shows "valid_graph H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_graph H
[PROOF STEP]
using assms E_valid
[PROOF STATE]
proof (prove)
using this:
subgraph H G
fst ` E \<subseteq> V
snd ` snd ` E \<subseteq> V

goal (1 subgoal):
 1. valid_graph H
[PROOF STEP]
unfolding subgraph_def valid_graph_def
[PROOF STATE]
proof (prove)
using this:
nodes H = V \<and> edges H \<subseteq> E
fst ` E \<subseteq> V
snd ` snd ` E \<subseteq> V

goal (1 subgoal):
 1. fst ` edges H \<subseteq> nodes H \<and> snd ` snd ` edges H \<subseteq> nodes H
[PROOF STEP]
by blast


[STATEMENT]
lemma concat_map_map_index:
  shows "concat (map (\<lambda>n. map (f n) xs) ys) =
    map (\<lambda>i. f (ys ! (i div length xs)) (xs ! (i mod length xs))) [0..<length xs * length ys]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat (map (\<lambda>n. map (f n) xs) ys) = map (\<lambda>i. f (ys ! (i div length xs)) (xs ! (i mod length xs))) [0..<length xs * length ys]
[PROOF STEP]
apply (auto intro!: nth_equalityI simp: length_concat o_def sum_list_sum_nth)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < length ys * length xs \<Longrightarrow> concat (map (\<lambda>n. map (f n) xs) ys) ! i = map (\<lambda>i. f (ys ! (i div length xs)) (xs ! (i mod length xs))) [0..<length xs * length ys] ! i
[PROOF STEP]
apply (subst concat_same_lengths_nth)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>i xsa. \<lbrakk>i < length ys * length xs; xsa \<in> set (map (\<lambda>n. map (f n) xs) ys)\<rbrakk> \<Longrightarrow> length xsa = ?N7 i
 2. \<And>i. i < length ys * length xs \<Longrightarrow> i < length (map (\<lambda>n. map (f n) xs) ys) * ?N7 i
 3. \<And>i. i < length ys * length xs \<Longrightarrow> 0 < ?N7 i
 4. \<And>i. i < length ys * length xs \<Longrightarrow> map (\<lambda>n. map (f n) xs) ys ! (i div ?N7 i) ! (i mod ?N7 i) = map (\<lambda>i. f (ys ! (i div length xs)) (xs ! (i mod length xs))) [0..<length xs * length ys] ! i
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < length ys * length xs \<Longrightarrow> map (\<lambda>n. map (f n) xs) ys ! (i div length xs) ! (i mod length xs) = map (\<lambda>i. f (ys ! (i div length xs)) (xs ! (i mod length xs))) [0..<length xs * length ys] ! i
[PROOF STEP]
apply (subst nth_map_upt)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < length ys * length xs \<Longrightarrow> i < length xs * length ys - 0
 2. \<And>i. i < length ys * length xs \<Longrightarrow> map (\<lambda>n. map (f n) xs) ys ! (i div length xs) ! (i mod length xs) = f (ys ! ((0 + i) div length xs)) (xs ! ((0 + i) mod length xs))
[PROOF STEP]
apply (auto simp: ac_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < length ys * length xs \<Longrightarrow> map (\<lambda>n. map (f n) xs) ys ! (i div length xs) ! (i mod length xs) = f (ys ! (i div length xs)) (xs ! (i mod length xs))
[PROOF STEP]
apply (subst nth_map)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < length ys * length xs \<Longrightarrow> i div length xs < length ys
 2. \<And>i. i < length ys * length xs \<Longrightarrow> map (f (ys ! (i div length xs))) xs ! (i mod length xs) = f (ys ! (i div length xs)) (xs ! (i mod length xs))
[PROOF STEP]
apply (metis div_eq_0_iff div_mult2_eq mult.commute mult_0 not_less0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < length ys * length xs \<Longrightarrow> map (f (ys ! (i div length xs))) xs ! (i mod length xs) = f (ys ! (i div length xs)) (xs ! (i mod length xs))
[PROOF STEP]
apply (subst nth_map)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < length ys * length xs \<Longrightarrow> i mod length xs < length xs
 2. \<And>i. i < length ys * length xs \<Longrightarrow> f (ys ! (i div length xs)) (xs ! (i mod length xs)) = f (ys ! (i div length xs)) (xs ! (i mod length xs))
[PROOF STEP]
subgoal for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length ys * length xs \<Longrightarrow> i mod length xs < length xs
[PROOF STEP]
using gr_implies_not_zero
[PROOF STATE]
proof (prove)
using this:
?m < ?n \<Longrightarrow> ?n \<noteq> (0::?'a)

goal (1 subgoal):
 1. i < length ys * length xs \<Longrightarrow> i mod length xs < length xs
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < length ys * length xs \<Longrightarrow> f (ys ! (i div length xs)) (xs ! (i mod length xs)) = f (ys ! (i div length xs)) (xs ! (i mod length xs))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i_ < length ys * length xs \<Longrightarrow> f (ys ! (i_ div length xs)) (xs ! (i_ mod length xs)) = f (ys ! (i_ div length xs)) (xs ! (i_ mod length xs))
[PROOF STEP]
by simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma coprime_minus_right_iff [simp]:
  "coprime a (- b) \<longleftrightarrow> coprime a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime a (- b) = coprime a b
[PROOF STEP]
using coprime_minus_left_iff [of b a]
[PROOF STATE]
proof (prove)
using this:
coprime (- b) a = coprime b a

goal (1 subgoal):
 1. coprime a (- b) = coprime a b
[PROOF STEP]
by (simp add: ac_simps)


[STATEMENT]
lemma det30_plus_scaled2[simp]:
  shows "det3 0 (a + x *\<^sub>R a) b = 0 \<longleftrightarrow> (if x = -1 then True else det3 0 a b = 0)"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (det3 0 (a + x *\<^sub>R a) b = 0) = (if x = - 1 then True else det3 0 a b = 0)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. det3 0 (a + x *\<^sub>R a) b = 0 \<Longrightarrow> if x = - 1 then True else det3 0 a b = 0
 2. if x = - 1 then True else det3 0 a b = 0 \<Longrightarrow> det3 0 (a + x *\<^sub>R a) b = 0
[PROOF STEP]
assume "det3 0 (a + x *\<^sub>R a) b = 0"
[PROOF STATE]
proof (state)
this:
det3 0 (a + x *\<^sub>R a) b = 0

goal (2 subgoals):
 1. det3 0 (a + x *\<^sub>R a) b = 0 \<Longrightarrow> if x = - 1 then True else det3 0 a b = 0
 2. if x = - 1 then True else det3 0 a b = 0 \<Longrightarrow> det3 0 (a + x *\<^sub>R a) b = 0
[PROOF STEP]
hence "fst a * snd b * (1 + x) = fst b * snd a * (1 + x)"
[PROOF STATE]
proof (prove)
using this:
det3 0 (a + x *\<^sub>R a) b = 0

goal (1 subgoal):
 1. fst a * snd b * (1 + x) = fst b * snd a * (1 + x)
[PROOF STEP]
by (simp add: algebra_simps det3_def')
[PROOF STATE]
proof (state)
this:
fst a * snd b * (1 + x) = fst b * snd a * (1 + x)

goal (2 subgoals):
 1. det3 0 (a + x *\<^sub>R a) b = 0 \<Longrightarrow> if x = - 1 then True else det3 0 a b = 0
 2. if x = - 1 then True else det3 0 a b = 0 \<Longrightarrow> det3 0 (a + x *\<^sub>R a) b = 0
[PROOF STEP]
thus ?rhs
[PROOF STATE]
proof (prove)
using this:
fst a * snd b * (1 + x) = fst b * snd a * (1 + x)

goal (1 subgoal):
 1. if x = - 1 then True else det3 0 a b = 0
[PROOF STEP]
by (auto simp add: det3_def')
[PROOF STATE]
proof (state)
this:
if x = - 1 then True else det3 0 a b = 0

goal (1 subgoal):
 1. if x = - 1 then True else det3 0 a b = 0 \<Longrightarrow> det3 0 (a + x *\<^sub>R a) b = 0
[PROOF STEP]
qed (auto simp: det3_def' algebra_simps split: if_split_asm)


[STATEMENT]
lemma card2:"\<lbrakk> finite A; a \<in> A; b \<in> A; a \<noteq> b \<rbrakk> \<Longrightarrow> Suc (Suc 0) \<le> card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; a \<in> A; b \<in> A; a \<noteq> b\<rbrakk> \<Longrightarrow> Suc (Suc 0) \<le> card A
[PROOF STEP]
apply (cut_tac card1[of "a"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; a \<in> A; b \<in> A; a \<noteq> b; card {a} = 1\<rbrakk> \<Longrightarrow> Suc (Suc 0) \<le> card A
[PROOF STEP]
apply (frule singleton_sub[of "b" "A"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; a \<in> A; b \<in> A; a \<noteq> b; card {a} = 1; {b} \<subseteq> A\<rbrakk> \<Longrightarrow> Suc (Suc 0) \<le> card A
[PROOF STEP]
apply (frule finite_subset[of "{b}" "A"], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; a \<in> A; b \<in> A; a \<noteq> b; card {a} = 1; {b} \<subseteq> A; finite {b}\<rbrakk> \<Longrightarrow> Suc (Suc 0) \<le> card A
[PROOF STEP]
apply (frule card_insert_disjoint[of "{b}" "a"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite A; a \<in> A; b \<in> A; a \<noteq> b; card {a} = 1; {b} \<subseteq> A; finite {b}\<rbrakk> \<Longrightarrow> a \<notin> {b}
 2. \<lbrakk>finite A; a \<in> A; b \<in> A; a \<noteq> b; card {a} = 1; {b} \<subseteq> A; finite {b}; card {a, b} = Suc (card {b})\<rbrakk> \<Longrightarrow> Suc (Suc 0) \<le> card A
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; a \<in> A; b \<in> A; a \<noteq> b; card {a} = 1; {b} \<subseteq> A; finite {b}; card {a, b} = Suc (card {b})\<rbrakk> \<Longrightarrow> Suc (Suc 0) \<le> card A
[PROOF STEP]
apply (simp only:card1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; a \<in> A; b \<in> A; a \<noteq> b; 1 = 1; {b} \<subseteq> A; finite {b}; card {a, b} = Suc 1\<rbrakk> \<Longrightarrow> Suc (Suc 0) \<le> card A
[PROOF STEP]
apply (frule insert_sub[of "{b}" "A" "a"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; a \<in> A; b \<in> A; a \<noteq> b; 1 = 1; {b} \<subseteq> A; finite {b}; card {a, b} = Suc 1; {a, b} \<subseteq> A\<rbrakk> \<Longrightarrow> Suc (Suc 0) \<le> card A
[PROOF STEP]
apply (frule card_mono [of "A" "{a, b}"], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; a \<in> A; b \<in> A; a \<noteq> b; 1 = 1; {b} \<subseteq> A; finite {b}; card {a, b} = Suc 1; {a, b} \<subseteq> A; card {a, b} \<le> card A\<rbrakk> \<Longrightarrow> Suc (Suc 0) \<le> card A
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cis_inj_on: "inj_on cis {0 ..< 2 * pi}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on cis {0..<2 * pi}
[PROOF STEP]
using rcis_inj_on[of 1]
[PROOF STATE]
proof (prove)
using this:
1 \<noteq> 0 \<Longrightarrow> inj_on (rcis 1) {0..<2 * pi}

goal (1 subgoal):
 1. inj_on cis {0..<2 * pi}
[PROOF STEP]
unfolding rcis_def
[PROOF STATE]
proof (prove)
using this:
1 \<noteq> 0 \<Longrightarrow> inj_on (\<lambda>a. complex_of_real 1 * cis a) {0..<2 * pi}

goal (1 subgoal):
 1. inj_on cis {0..<2 * pi}
[PROOF STEP]
by auto


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

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


[STATEMENT]
lemma JN_cong [cong]:
    "[| I=J;  !!i. i \<in> J ==> F i = G i |] ==> (\<Squnion>i \<in> I. F i) = (\<Squnion>i \<in> J. G i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I = J; \<And>i. i \<in> J \<Longrightarrow> F i = G i\<rbrakk> \<Longrightarrow> JOIN I F = JOIN J G
[PROOF STEP]
by (simp add: JOIN_def)