[STATEMENT]
lemma cauchy_schwarz_ineq_var_uniform:
  fixes X :: "'a \<Rightarrow> real"
  assumes "M = uniform_count_measure S"
  assumes "finite S"
  shows "expectation (\<lambda> x. (X x)^2) \<ge> (expectation (\<lambda> x . (X x)))^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (expectation X)\<^sup>2 \<le> expectation (\<lambda>x. (X x)\<^sup>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (expectation X)\<^sup>2 \<le> expectation (\<lambda>x. (X x)\<^sup>2)
[PROOF STEP]
have borel: "X \<in> borel_measurable M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. random_variable borel X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
M = uniform_count_measure S
finite S

goal (1 subgoal):
 1. random_variable borel X
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
random_variable borel X

goal (1 subgoal):
 1. (expectation X)\<^sup>2 \<le> expectation (\<lambda>x. (X x)\<^sup>2)
[PROOF STEP]
have "integrable M X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
M = uniform_count_measure S
finite S

goal (1 subgoal):
 1. integrable M X
[PROOF STEP]
by (simp add: integrable_uniform_count_measure_finite)
[PROOF STATE]
proof (state)
this:
integrable M X

goal (1 subgoal):
 1. (expectation X)\<^sup>2 \<le> expectation (\<lambda>x. (X x)\<^sup>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integrable M X
[PROOF STEP]
have "integrable M (\<lambda> x. (X x)^2)"
[PROOF STATE]
proof (prove)
using this:
integrable M X

goal (1 subgoal):
 1. integrable M (\<lambda>x. (X x)\<^sup>2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
integrable M X
M = uniform_count_measure S
finite S

goal (1 subgoal):
 1. integrable M (\<lambda>x. (X x)\<^sup>2)
[PROOF STEP]
by (simp add: integrable_uniform_count_measure_finite)
[PROOF STATE]
proof (state)
this:
integrable M (\<lambda>x. (X x)\<^sup>2)

goal (1 subgoal):
 1. (expectation X)\<^sup>2 \<le> expectation (\<lambda>x. (X x)\<^sup>2)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
integrable M (\<lambda>x. (X x)\<^sup>2)

goal (1 subgoal):
 1. (expectation X)\<^sup>2 \<le> expectation (\<lambda>x. (X x)\<^sup>2)
[PROOF STEP]
using cauchy_schwarz_ineq_var borel
[PROOF STATE]
proof (prove)
using this:
integrable M (\<lambda>x. (X x)\<^sup>2)
\<lbrakk>integrable M (\<lambda>x. (?X x)\<^sup>2); random_variable borel ?X\<rbrakk> \<Longrightarrow> (expectation ?X)\<^sup>2 \<le> expectation (\<lambda>x. (?X x)\<^sup>2)
random_variable borel X

goal (1 subgoal):
 1. (expectation X)\<^sup>2 \<le> expectation (\<lambda>x. (X x)\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(expectation X)\<^sup>2 \<le> expectation (\<lambda>x. (X x)\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma doubleton_eq_iff: "\<lbrace>a,b\<rbrace> = \<lbrace>c,d\<rbrace> \<longleftrightarrow> (a=c \<and> b=d) \<or> (a=d \<and> b=c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrace>a, b\<rbrace> = \<lbrace>c, d\<rbrace>) = (a = c \<and> b = d \<or> a = d \<and> b = c)
[PROOF STEP]
by auto (metis hmem_hempty hmem_hinsert)+


[STATEMENT]
lemma rel_interior_closure_convex_segment:
  fixes S :: "_::euclidean_space set"
  assumes "convex S" "a \<in> rel_interior S" "b \<in> closure S"
    shows "open_segment a b \<subseteq> rel_interior S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment a b \<subseteq> rel_interior S
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> open_segment a b \<Longrightarrow> x \<in> rel_interior S
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> open_segment a b \<Longrightarrow> x \<in> rel_interior S
[PROOF STEP]
have [simp]: "(1 - u) *\<^sub>R a + u *\<^sub>R b = b - (1 - u) *\<^sub>R (b - a)" for u
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - u) *\<^sub>R a + u *\<^sub>R b = b - (1 - u) *\<^sub>R (b - a)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(1 - ?u) *\<^sub>R a + ?u *\<^sub>R b = b - (1 - ?u) *\<^sub>R (b - a)

goal (1 subgoal):
 1. \<And>x. x \<in> open_segment a b \<Longrightarrow> x \<in> rel_interior S
[PROOF STEP]
assume "x \<in> open_segment a b"
[PROOF STATE]
proof (state)
this:
x \<in> open_segment a b

goal (1 subgoal):
 1. \<And>x. x \<in> open_segment a b \<Longrightarrow> x \<in> rel_interior S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> open_segment a b
[PROOF STEP]
show "x \<in> rel_interior S"
[PROOF STATE]
proof (prove)
using this:
x \<in> open_segment a b

goal (1 subgoal):
 1. x \<in> rel_interior S
[PROOF STEP]
unfolding closed_segment_def open_segment_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {(1 - u) *\<^sub>R a + u *\<^sub>R b |u. 0 \<le> u \<and> u \<le> 1} - {a, b}

goal (1 subgoal):
 1. x \<in> rel_interior S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> {(1 - u) *\<^sub>R a + u *\<^sub>R b |u. 0 \<le> u \<and> u \<le> 1} - {a, b}
convex S
a \<in> rel_interior S
b \<in> closure S

goal (1 subgoal):
 1. x \<in> rel_interior S
[PROOF STEP]
by (auto intro: rel_interior_closure_convex_shrink)
[PROOF STATE]
proof (state)
this:
x \<in> rel_interior S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ennexp_add_mult:
  assumes "\<not>((a = \<infinity> \<and> b = -\<infinity>) \<or> (a = -\<infinity> \<and> b = \<infinity>))"
  shows "ennexp(a+b) = ennexp a * ennexp b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennexp (a + b) = ennexp a * ennexp b
[PROOF STEP]
apply (cases a, cases b)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>r ra. \<lbrakk>a = ereal r; b = ereal ra\<rbrakk> \<Longrightarrow> ennexp (a + b) = ennexp a * ennexp b
 2. \<And>r. \<lbrakk>a = ereal r; b = \<infinity>\<rbrakk> \<Longrightarrow> ennexp (a + b) = ennexp a * ennexp b
 3. \<And>r. \<lbrakk>a = ereal r; b = - \<infinity>\<rbrakk> \<Longrightarrow> ennexp (a + b) = ennexp a * ennexp b
 4. a = \<infinity> \<Longrightarrow> ennexp (a + b) = ennexp a * ennexp b
 5. a = - \<infinity> \<Longrightarrow> ennexp (a + b) = ennexp a * ennexp b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<not> (a = \<infinity> \<and> b = - \<infinity> \<or> a = - \<infinity> \<and> b = \<infinity>)

goal (5 subgoals):
 1. \<And>r ra. \<lbrakk>a = ereal r; b = ereal ra\<rbrakk> \<Longrightarrow> ennexp (a + b) = ennexp a * ennexp b
 2. \<And>r. \<lbrakk>a = ereal r; b = \<infinity>\<rbrakk> \<Longrightarrow> ennexp (a + b) = ennexp a * ennexp b
 3. \<And>r. \<lbrakk>a = ereal r; b = - \<infinity>\<rbrakk> \<Longrightarrow> ennexp (a + b) = ennexp a * ennexp b
 4. a = \<infinity> \<Longrightarrow> ennexp (a + b) = ennexp a * ennexp b
 5. a = - \<infinity> \<Longrightarrow> ennexp (a + b) = ennexp a * ennexp b
[PROOF STEP]
by (auto simp add: ennreal_mult'' exp_add ennreal_top_eq_mult_iff)


[STATEMENT]
lemma multiplicity_cong:
  "(\<And>r. p ^ r dvd a \<longleftrightarrow> p ^ r dvd b) \<Longrightarrow> multiplicity p a = multiplicity p b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r. (p ^ r dvd a) = (p ^ r dvd b)) \<Longrightarrow> multiplicity p a = multiplicity p b
[PROOF STEP]
by (simp add: multiplicity_def)


[STATEMENT]
lemma matrix_mult_mono:
  assumes "0 \<le> E" "0 \<le> C" "(E :: real^'c^'c) \<le> B" "C \<le> D"
  shows "E ** C \<le> B ** D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. E ** C \<le> B ** D
[PROOF STEP]
using order.trans[OF assms(1) assms(3)] assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> B
0 \<le> E
0 \<le> C
E \<le> B
C \<le> D

goal (1 subgoal):
 1. E ** C \<le> B ** D
[PROOF STEP]
unfolding Finite_Cartesian_Product.less_eq_vec_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i ia. 0 $ i $ ia \<le> B $ i $ ia
\<forall>i ia. 0 $ i $ ia \<le> E $ i $ ia
\<forall>i ia. 0 $ i $ ia \<le> C $ i $ ia
\<forall>i ia. E $ i $ ia \<le> B $ i $ ia
\<forall>i ia. C $ i $ ia \<le> D $ i $ ia

goal (1 subgoal):
 1. \<forall>i ia. (E ** C) $ i $ ia \<le> (B ** D) $ i $ ia
[PROOF STEP]
by (auto intro!: sum_mono mult_mono simp: matrix_matrix_mult_def)


[STATEMENT]
lemma tensor_vec_add2:
  fixes v1 v2 v3 :: "'a::comm_ring vec"
  assumes "v1 \<in> carrier_vec d1"
    and "v2 \<in> carrier_vec d2"
    and "v3 \<in> carrier_vec d2"
  shows "tensor_vec v1 (v2 + v3) = tensor_vec v1 v2 + tensor_vec v1 v3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tensor_vec v1 (v2 + v3) = tensor_vec v1 v2 + tensor_vec v1 v3
[PROOF STEP]
apply (rule eq_vecI, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < d \<Longrightarrow> tensor_vec v1 (v2 + v3) $ i = tensor_vec v1 v2 $ i + tensor_vec v1 v3 $ i
[PROOF STEP]
unfolding tensor_vec_eval
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < d \<Longrightarrow> v1 $ encode1 i * (v2 + v3) $ encode2 i = v1 $ encode1 i * v2 $ encode2 i + v1 $ encode1 i * v3 $ encode2 i
[PROOF STEP]
using assms(3) semiring_class.distrib_left
[PROOF STATE]
proof (prove)
using this:
v3 \<in> carrier_vec d2
?a * (?b + ?c) = ?a * ?b + ?a * ?c

goal (1 subgoal):
 1. \<And>i. i < d \<Longrightarrow> v1 $ encode1 i * (v2 + v3) $ encode2 i = v1 $ encode1 i * v2 $ encode2 i + v1 $ encode1 i * v3 $ encode2 i
[PROOF STEP]
by force


[STATEMENT]
lemma part_equiv_trans_sym:
  "\<lbrakk> part_equiv R; (a,b)\<in>R; (c,b)\<in>R \<rbrakk> \<Longrightarrow> (a,c)\<in>R"
  "\<lbrakk> part_equiv R; (a,b)\<in>R; (a,c)\<in>R \<rbrakk> \<Longrightarrow> (b,c)\<in>R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>part_equiv R; (a, b) \<in> R; (c, b) \<in> R\<rbrakk> \<Longrightarrow> (a, c) \<in> R) &&& (\<lbrakk>part_equiv R; (a, b) \<in> R; (a, c) \<in> R\<rbrakk> \<Longrightarrow> (b, c) \<in> R)
[PROOF STEP]
apply (metis part_equiv_sym part_equiv_trans)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma L2_set_strict_mono:
  assumes "finite K" and "K \<noteq> {}"
  assumes "\<And>i. i \<in> K \<Longrightarrow> f i < g i"
  assumes "\<And>i. i \<in> K \<Longrightarrow> 0 \<le> f i"
  shows "L2_set f K < L2_set g K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L2_set f K < L2_set g K
[PROOF STEP]
unfolding L2_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (\<Sum>i\<in>K. (f i)\<^sup>2) < sqrt (\<Sum>i\<in>K. (g i)\<^sup>2)
[PROOF STEP]
by (simp add: sum_strict_mono power_strict_mono assms)


[STATEMENT]
lemma unitarily_equiv_eq:
  assumes "unitarily_equiv A B U"
  shows "A = U * B * (Complex_Matrix.adjoint U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = U * B * Complex_Matrix.adjoint U
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
unitarily_equiv A B U

goal (1 subgoal):
 1. A = U * B * Complex_Matrix.adjoint U
[PROOF STEP]
unfolding unitarily_equiv_def similar_mat_wit_def
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.unitary U \<and> (let n = dim_row A in {A, B, U, Complex_Matrix.adjoint U} \<subseteq> carrier_mat n n \<and> U * Complex_Matrix.adjoint U = 1\<^sub>m n \<and> Complex_Matrix.adjoint U * U = 1\<^sub>m n \<and> A = U * B * Complex_Matrix.adjoint U)

goal (1 subgoal):
 1. A = U * B * Complex_Matrix.adjoint U
[PROOF STEP]
by meson


[STATEMENT]
lemma CDERIV_inverse_fun:
  "DERIV f x :> d \<Longrightarrow> f x \<noteq> 0 \<Longrightarrow> DERIV (\<lambda>x. inverse (f x)) x :> - (d * inverse ((f x)\<^sup>2))"
  for x :: complex
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative d) (at x); f x \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. inverse (f x)) has_field_derivative - (d * inverse ((f x)\<^sup>2))) (at x)
[PROOF STEP]
unfolding numeral_2_eq_2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative d) (at x); f x \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. inverse (f x)) has_field_derivative - (d * inverse (f x ^ Suc (Suc 0)))) (at x)
[PROOF STEP]
by (rule DERIV_inverse_fun)


[STATEMENT]
lemma deriv_deriv_real_sqrt [simp]:
  assumes "x > 0"
  shows "deriv(deriv sqrt) x = - inverse ((sqrt x)^3)/4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (deriv sqrt) x = - inverse (sqrt x ^ 3) / 4
[PROOF STEP]
using DERIV_imp_deriv assms has_real_derivative_deriv_sqrt
[PROOF STATE]
proof (prove)
using this:
(?f has_field_derivative ?f') (at ?x) \<Longrightarrow> deriv ?f ?x = ?f'
0 < x
0 < ?x \<Longrightarrow> (deriv sqrt has_real_derivative - inverse (sqrt ?x ^ 3) / 4) (at ?x)

goal (1 subgoal):
 1. deriv (deriv sqrt) x = - inverse (sqrt x ^ 3) / 4
[PROOF STEP]
by blast


[STATEMENT]
lemma continuous_injective_image_open_segment_1:
  fixes f :: "'a::euclidean_space \<Rightarrow> real"
  assumes contf: "continuous_on (closed_segment a b) f"
      and injf: "inj_on f (closed_segment a b)"
    shows "f ` (open_segment a b) = open_segment (f a) (f b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` open_segment a b = open_segment (f a) (f b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f ` open_segment a b = open_segment (f a) (f b)
[PROOF STEP]
have "f ` (open_segment a b) = f ` (closed_segment a b) - {f a, f b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` open_segment a b = f ` closed_segment a b - {f a, f b}
[PROOF STEP]
by (metis (no_types, opaque_lifting) empty_subsetI ends_in_segment image_insert image_is_empty inj_on_image_set_diff injf insert_subset open_segment_def segment_open_subset_closed)
[PROOF STATE]
proof (state)
this:
f ` open_segment a b = f ` closed_segment a b - {f a, f b}

goal (1 subgoal):
 1. f ` open_segment a b = open_segment (f a) (f b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f ` open_segment a b = f ` closed_segment a b - {f a, f b}

goal (1 subgoal):
 1. f ` open_segment a b = open_segment (f a) (f b)
[PROOF STEP]
have "... = open_segment (f a) (f b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` closed_segment a b - {f a, f b} = open_segment (f a) (f b)
[PROOF STEP]
using continuous_injective_image_segment_1 [OF assms]
[PROOF STATE]
proof (prove)
using this:
f ` closed_segment a b = closed_segment (f a) (f b)

goal (1 subgoal):
 1. f ` closed_segment a b - {f a, f b} = open_segment (f a) (f b)
[PROOF STEP]
by (simp add: open_segment_def inj_on_image_set_diff [OF injf])
[PROOF STATE]
proof (state)
this:
f ` closed_segment a b - {f a, f b} = open_segment (f a) (f b)

goal (1 subgoal):
 1. f ` open_segment a b = open_segment (f a) (f b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f ` open_segment a b = open_segment (f a) (f b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f ` open_segment a b = open_segment (f a) (f b)

goal (1 subgoal):
 1. f ` open_segment a b = open_segment (f a) (f b)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f ` open_segment a b = open_segment (f a) (f b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma swap_triple:
  assumes "a \<noteq> c" and "b \<noteq> c"
  shows "Fun.swap a b (Fun.swap b c (Fun.swap a b f)) = Fun.swap a c f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<circ> Transposition.transpose a b \<circ> Transposition.transpose b c \<circ> Transposition.transpose a b = f \<circ> Transposition.transpose a c
[PROOF STEP]
using assms transpose_comp_triple [of a c b]
[PROOF STATE]
proof (prove)
using this:
a \<noteq> c
b \<noteq> c
\<lbrakk>a \<noteq> c; b \<noteq> c\<rbrakk> \<Longrightarrow> Transposition.transpose a b \<circ> Transposition.transpose b c \<circ> Transposition.transpose a b = Transposition.transpose a c

goal (1 subgoal):
 1. f \<circ> Transposition.transpose a b \<circ> Transposition.transpose b c \<circ> Transposition.transpose a b = f \<circ> Transposition.transpose a c
[PROOF STEP]
by (simp add: comp_assoc)


[STATEMENT]
lemma gbinomial_altdef_of_nat: "a gchoose k = (\<Prod>i = 0..<k. (a - of_nat i) / of_nat (k - i) :: 'a)"
  for k :: nat and a :: "'a::field_char_0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a gchoose k = (\<Prod>i = 0..<k. (a - of_nat i) / of_nat (k - i))
[PROOF STEP]
by (simp add: prod_dividef gbinomial_prod_rev fact_prod_rev)


[STATEMENT]
lemma tensor_mat_add2:
  assumes "m1 \<in> carrier_mat d1 d1"
    and "m2 \<in> carrier_mat d2 d2"
    and "m3 \<in> carrier_mat d2 d2"
  shows "tensor_mat m1 (m2 + m3) = tensor_mat m1 m2 + tensor_mat m1 m3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tensor_mat m1 (m2 + m3) = tensor_mat m1 m2 + tensor_mat m1 m3
[PROOF STEP]
apply (rule eq_matI, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> tensor_mat m1 (m2 + m3) $$ (i, j) = tensor_mat m1 m2 $$ (i, j) + tensor_mat m1 m3 $$ (i, j)
[PROOF STEP]
unfolding tensor_mat_eval
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> m1 $$ (encode1 i, encode1 j) * (m2 + m3) $$ (encode2 i, encode2 j) = m1 $$ (encode1 i, encode1 j) * m2 $$ (encode2 i, encode2 j) + m1 $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j)
[PROOF STEP]
using assms(3) semiring_class.distrib_left
[PROOF STATE]
proof (prove)
using this:
m3 \<in> carrier_mat d2 d2
?a * (?b + ?c) = ?a * ?b + ?a * ?c

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> m1 $$ (encode1 i, encode1 j) * (m2 + m3) $$ (encode2 i, encode2 j) = m1 $$ (encode1 i, encode1 j) * m2 $$ (encode2 i, encode2 j) + m1 $$ (encode1 i, encode1 j) * m3 $$ (encode2 i, encode2 j)
[PROOF STEP]
by force


[STATEMENT]
lemma hermitian_decomp_diag_mat:
  assumes "hermitian_decomp A B U"
  shows "diagonal_mat B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diagonal_mat B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
hermitian_decomp A B U

goal (1 subgoal):
 1. diagonal_mat B
[PROOF STEP]
unfolding hermitian_decomp_def
[PROOF STATE]
proof (prove)
using this:
similar_mat_wit A B U (Complex_Matrix.adjoint U) \<and> diagonal_mat B \<and> diag_mat B = eigvals A \<and> Complex_Matrix.unitary U \<and> (\<forall>i<dim_row B. B $$ (i, i) \<in> \<real>)

goal (1 subgoal):
 1. diagonal_mat B
[PROOF STEP]
by simp


[STATEMENT]
lemma bounded_differences:
  fixes S :: "'a::real_normed_vector set"
  assumes "bounded S" and "bounded T"
  shows "bounded (\<Union>x\<in> S. \<Union>y \<in> T. {x - y})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded (\<Union>x\<in>S. \<Union>y\<in>T. {x - y})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bounded S
bounded T

goal (1 subgoal):
 1. bounded (\<Union>x\<in>S. \<Union>y\<in>T. {x - y})
[PROOF STEP]
by (simp add: bounded_iff) (meson add_mono norm_triangle_le_diff)


[STATEMENT]
theorem gs1: "\<lbrakk> Pref P\<^sub>a P\<^sub>b; n = length P\<^sub>a \<rbrakk> \<Longrightarrow>
 \<exists>A. Gale_Shapley1 P\<^sub>a P\<^sub>b = Some A
   \<and> Pref.matching P\<^sub>a (list A) {<n} \<and> Pref.stable P\<^sub>a P\<^sub>b (list A) {<n} \<and> Pref.opti\<^sub>a P\<^sub>a P\<^sub>b (list A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Pref P\<^sub>a P\<^sub>b; n = length P\<^sub>a\<rbrakk> \<Longrightarrow> \<exists>A. Gale_Shapley2.Gale_Shapley1 P\<^sub>a P\<^sub>b = Some A \<and> Pref.matching P\<^sub>a (list A) {<n} \<and> Pref.stable P\<^sub>a P\<^sub>b (list A) {<n} \<and> Pref.opti\<^sub>a P\<^sub>a P\<^sub>b (list A)
[PROOF STEP]
unfolding Gale_Shapley1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Pref P\<^sub>a P\<^sub>b; n = length P\<^sub>a\<rbrakk> \<Longrightarrow> \<exists>A. (if Pref P\<^sub>a P\<^sub>b then Some (fst (Gale_Shapley2.gs1 (length P\<^sub>a) (pref_array P\<^sub>a) (rank_array P\<^sub>b))) else None) = Some A \<and> Pref.matching P\<^sub>a (list A) {<n} \<and> Pref.stable P\<^sub>a P\<^sub>b (list A) {<n} \<and> Pref.opti\<^sub>a P\<^sub>a P\<^sub>b (list A)
[PROOF STEP]
using Pref.gs1
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Pref ?P\<^sub>a ?P\<^sub>b; ?R\<^sub>b = rank_array ?P\<^sub>b\<rbrakk> \<Longrightarrow> Gale_Shapley2.gs1 (length ?P\<^sub>a) (pref_array ?P\<^sub>a) ?R\<^sub>b = (?A, ?B, ?M, ?ai, ?a) \<longrightarrow> Pref.matching ?P\<^sub>a (list ?A) {<length ?P\<^sub>a} \<and> Pref.stable ?P\<^sub>a ?P\<^sub>b (list ?A) {<length ?P\<^sub>a} \<and> Pref.opti\<^sub>a ?P\<^sub>a ?P\<^sub>b (list ?A)

goal (1 subgoal):
 1. \<lbrakk>Pref P\<^sub>a P\<^sub>b; n = length P\<^sub>a\<rbrakk> \<Longrightarrow> \<exists>A. (if Pref P\<^sub>a P\<^sub>b then Some (fst (Gale_Shapley2.gs1 (length P\<^sub>a) (pref_array P\<^sub>a) (rank_array P\<^sub>b))) else None) = Some A \<and> Pref.matching P\<^sub>a (list A) {<n} \<and> Pref.stable P\<^sub>a P\<^sub>b (list A) {<n} \<and> Pref.opti\<^sub>a P\<^sub>a P\<^sub>b (list A)
[PROOF STEP]
by (metis fst_conv surj_pair)


[STATEMENT]
lemma LPDs_Star: "LPDs (MStar r) \<subseteq> {MStar r} \<union> MTimesR (LPDs r) (MStar r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LPDs (MStar r) \<subseteq> {MStar r} \<union> MTimesR (LPDs r) (MStar r)
[PROOF STEP]
unfolding LPDs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>i. LPDi i (MStar r)) \<subseteq> {MStar r} \<union> MTimesR (\<Union>i. LPDi i r) (MStar r)
[PROOF STEP]
using LPDi_Star[OF order_refl, of _ r]
[PROOF STATE]
proof (prove)
using this:
LPDi ?i (MStar r) \<subseteq> {MStar r} \<union> MTimesR (\<Union>j\<le>?i. LPDi j r) (MStar r)

goal (1 subgoal):
 1. (\<Union>i. LPDi i (MStar r)) \<subseteq> {MStar r} \<union> MTimesR (\<Union>i. LPDi i r) (MStar r)
[PROOF STEP]
by (force simp: MTimesR_def)


[STATEMENT]
lemma incseq_of_rat_interlaced_seq:
   "\<lbrakk> (\<lambda>n. of_rat (r n)) \<longlonglongrightarrow> (x::real);
      (\<lambda>n. of_rat (s n)) \<longlonglongrightarrow> (x::real);
      \<forall>n. of_rat (r n) < x; \<forall>n. of_rat (s n) < x \<rbrakk>
    \<Longrightarrow> incseq (\<lambda>n. real_of_rat (interlaced_seq r s n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>n. real_of_rat (r n)) \<longlonglongrightarrow> x; (\<lambda>n. real_of_rat (s n)) \<longlonglongrightarrow> x; \<forall>n. real_of_rat (r n) < x; \<forall>n. real_of_rat (s n) < x\<rbrakk> \<Longrightarrow> incseq (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
using incseq_interlaced_seq incseq_of_rat
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(\<lambda>n. real_of_rat (?r n)) \<longlonglongrightarrow> ?x; (\<lambda>n. real_of_rat (?s n)) \<longlonglongrightarrow> ?x; \<forall>n. real_of_rat (?r n) < ?x; \<forall>n. real_of_rat (?s n) < ?x\<rbrakk> \<Longrightarrow> incseq (interlaced_seq ?r ?s)
incseq ?s \<Longrightarrow> incseq (\<lambda>n. of_rat (?s n))

goal (1 subgoal):
 1. \<lbrakk>(\<lambda>n. real_of_rat (r n)) \<longlonglongrightarrow> x; (\<lambda>n. real_of_rat (s n)) \<longlonglongrightarrow> x; \<forall>n. real_of_rat (r n) < x; \<forall>n. real_of_rat (s n) < x\<rbrakk> \<Longrightarrow> incseq (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
by blast


[STATEMENT]
lemma Polygamma_approx_1_real:
  "x > (0 :: real) \<Longrightarrow>
     Polygamma_approx (Suc 0) m x = ln x - 1 / (2*x) + stirling_sum (Suc 0) m x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> Polygamma_approx (Suc 0) m x = ln x - 1 / (2 * x) + stirling_sum (Suc 0) m x
[PROOF STEP]
unfolding Polygamma_approx_Suc Polygamma_approx_0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> deriv (\<lambda>x. (x - 1 / 2) * ln x - x + of_real (ln (2 * pi)) / 2 + stirling_sum 0 m x) x = ln x - 1 / (2 * x) + stirling_sum (Suc 0) m x
[PROOF STEP]
by (intro DERIV_imp_deriv)
     (auto intro!: derivative_eq_intros elim!: nonpos_Reals_cases simp: field_simps)


[STATEMENT]
lemma all_onbs_same_card:
  fixes E F :: \<open>'a::chilbert_space set\<close>
  assumes \<open>is_onb E\<close> \<open>is_onb F\<close>
  shows \<open>\<exists>f. bij_betw f E F\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. bij_betw f E F
[PROOF STEP]
apply (rule all_ortho_bases_same_card)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. is_ortho_set E
 2. is_ortho_set F
 3. ccspan E = \<top>
 4. ccspan F = \<top>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_onb E
is_onb F

goal (4 subgoals):
 1. is_ortho_set E
 2. is_ortho_set F
 3. ccspan E = \<top>
 4. ccspan F = \<top>
[PROOF STEP]
by (auto simp: is_onb_def)


[STATEMENT]
lemma Ln'_of_real_neg:
  assumes "x < 0"
  shows   "Ln' (of_real x) = of_real (ln (-x)) + \<i> * pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln' (complex_of_real x) = complex_of_real (ln (- x)) + \<i> * complex_of_real pi
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Ln' (complex_of_real x) = complex_of_real (ln (- x)) + \<i> * complex_of_real pi
[PROOF STEP]
have "Ln' (of_real x) = Ln (of_real (-x) * \<i>) + \<i> * pi / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln' (complex_of_real x) = Ln (complex_of_real (- x) * \<i>) + \<i> * complex_of_real pi / 2
[PROOF STEP]
by (simp add: Ln'_def mult_ac)
[PROOF STATE]
proof (state)
this:
Ln' (complex_of_real x) = Ln (complex_of_real (- x) * \<i>) + \<i> * complex_of_real pi / 2

goal (1 subgoal):
 1. Ln' (complex_of_real x) = complex_of_real (ln (- x)) + \<i> * complex_of_real pi
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Ln' (complex_of_real x) = Ln (complex_of_real (- x) * \<i>) + \<i> * complex_of_real pi / 2

goal (1 subgoal):
 1. Ln' (complex_of_real x) = complex_of_real (ln (- x)) + \<i> * complex_of_real pi
[PROOF STEP]
have "\<dots> = of_real (ln (-x)) + \<i> * pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ln (complex_of_real (- x) * \<i>) + \<i> * complex_of_real pi / 2 = complex_of_real (ln (- x)) + \<i> * complex_of_real pi
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x < 0

goal (1 subgoal):
 1. Ln (complex_of_real (- x) * \<i>) + \<i> * complex_of_real pi / 2 = complex_of_real (ln (- x)) + \<i> * complex_of_real pi
[PROOF STEP]
by (subst Ln_times_of_real) (auto simp: Ln_Reals_eq)
[PROOF STATE]
proof (state)
this:
Ln (complex_of_real (- x) * \<i>) + \<i> * complex_of_real pi / 2 = complex_of_real (ln (- x)) + \<i> * complex_of_real pi

goal (1 subgoal):
 1. Ln' (complex_of_real x) = complex_of_real (ln (- x)) + \<i> * complex_of_real pi
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Ln' (complex_of_real x) = complex_of_real (ln (- x)) + \<i> * complex_of_real pi
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Ln' (complex_of_real x) = complex_of_real (ln (- x)) + \<i> * complex_of_real pi

goal (1 subgoal):
 1. Ln' (complex_of_real x) = complex_of_real (ln (- x)) + \<i> * complex_of_real pi
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Ln' (complex_of_real x) = complex_of_real (ln (- x)) + \<i> * complex_of_real pi

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dist_metric_completion_limit':
  fixes x y::"nat \<Rightarrow> 'a"
  assumes "Cauchy x" "Cauchy y"
  shows "(\<lambda>n. dist (x n) (y n)) \<longlonglongrightarrow> dist (abs_metric_completion x) (abs_metric_completion y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. dist (x n) (y n)) \<longlonglongrightarrow> dist (abs_metric_completion x) (abs_metric_completion y)
[PROOF STEP]
apply (subst dist_metric_completion.abs_eq)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. Cauchy x \<and> Cauchy x \<and> (\<lambda>n. dist (x n) (x n)) \<longlonglongrightarrow> 0
 2. Cauchy y \<and> Cauchy y \<and> (\<lambda>n. dist (y n) (y n)) \<longlonglongrightarrow> 0
 3. (\<lambda>n. dist (x n) (y n)) \<longlonglongrightarrow> lim (\<lambda>n. dist (x n) (y n))
[PROOF STEP]
using assms convergent_Cauchy_dist[OF assms]
[PROOF STATE]
proof (prove)
using this:
Cauchy x
Cauchy y
convergent (\<lambda>n. dist (x n) (y n))

goal (3 subgoals):
 1. Cauchy x \<and> Cauchy x \<and> (\<lambda>n. dist (x n) (x n)) \<longlonglongrightarrow> 0
 2. Cauchy y \<and> Cauchy y \<and> (\<lambda>n. dist (y n) (y n)) \<longlonglongrightarrow> 0
 3. (\<lambda>n. dist (x n) (y n)) \<longlonglongrightarrow> lim (\<lambda>n. dist (x n) (y n))
[PROOF STEP]
by (auto simp add: convergent_LIMSEQ_iff)


[STATEMENT]
lemma real_inverse_bet_one_one_lemma:
      "1 < (a::real) \<Longrightarrow> 0 < inverse a \<and> inverse a < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < a \<Longrightarrow> 0 < inverse a \<and> inverse a < 1
[PROOF STEP]
by (metis inverse_less_1_iff inverse_positive_iff_positive
        le_less_trans zero_le_one)


[STATEMENT]
lemma card_subgrp_dvd:
  assumes "subgroup H G"
  shows "card H dvd order G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card H dvd order G
[PROOF STEP]
proof(cases "finite (carrier G)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (carrier G) \<Longrightarrow> card H dvd order G
 2. infinite (carrier G) \<Longrightarrow> card H dvd order G
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite (carrier G)

goal (2 subgoals):
 1. finite (carrier G) \<Longrightarrow> card H dvd order G
 2. infinite (carrier G) \<Longrightarrow> card H dvd order G
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
subgroup H G
finite (carrier G)
[PROOF STEP]
have "card (rcosets H) * card H = order G"
[PROOF STATE]
proof (prove)
using this:
subgroup H G
finite (carrier G)

goal (1 subgoal):
 1. card (rcosets H) * card H = order G
[PROOF STEP]
by (metis lagrange)
[PROOF STATE]
proof (state)
this:
card (rcosets H) * card H = order G

goal (2 subgoals):
 1. finite (carrier G) \<Longrightarrow> card H dvd order G
 2. infinite (carrier G) \<Longrightarrow> card H dvd order G
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
card (rcosets H) * card H = order G

goal (1 subgoal):
 1. card H dvd order G
[PROOF STEP]
by (metis dvd_triv_left mult.commute)
[PROOF STATE]
proof (state)
this:
card H dvd order G

goal (1 subgoal):
 1. infinite (carrier G) \<Longrightarrow> card H dvd order G
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite (carrier G) \<Longrightarrow> card H dvd order G
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
infinite (carrier G)

goal (1 subgoal):
 1. infinite (carrier G) \<Longrightarrow> card H dvd order G
[PROOF STEP]
hence "order G = 0"
[PROOF STATE]
proof (prove)
using this:
infinite (carrier G)

goal (1 subgoal):
 1. order G = 0
[PROOF STEP]
unfolding order_def
[PROOF STATE]
proof (prove)
using this:
infinite (carrier G)

goal (1 subgoal):
 1. card (carrier G) = 0
[PROOF STEP]
by (metis card.infinite)
[PROOF STATE]
proof (state)
this:
order G = 0

goal (1 subgoal):
 1. infinite (carrier G) \<Longrightarrow> card H dvd order G
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
order G = 0

goal (1 subgoal):
 1. card H dvd order G
[PROOF STEP]
by (metis dvd_0_right)
[PROOF STATE]
proof (state)
this:
card H dvd order G

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mtx_hOsc_solution_eq:
  fixes a b :: real
  defines "\<iota>\<^sub>1 \<equiv> (b - sqrt (b\<^sup>2+4*a))/2" and "\<iota>\<^sub>2 \<equiv> (b + sqrt (b\<^sup>2+4*a))/2"
  defines "\<Phi> t \<equiv> mtx (
   [\<iota>\<^sub>2*exp(t*\<iota>\<^sub>1) - \<iota>\<^sub>1*exp(t*\<iota>\<^sub>2),     exp(t*\<iota>\<^sub>2)-exp(t*\<iota>\<^sub>1)]#
   [a*exp(t*\<iota>\<^sub>2) - a*exp(t*\<iota>\<^sub>1), \<iota>\<^sub>2*exp(t*\<iota>\<^sub>2)-\<iota>\<^sub>1*exp(t*\<iota>\<^sub>1)]#[])"
  assumes "b\<^sup>2 + a * 4 > 0" and "a \<noteq> 0"
  shows "P (-\<iota>\<^sub>2/a) (-\<iota>\<^sub>1/a) * (\<d>\<i>\<a>\<g> i. exp (t * (if i=1 then \<iota>\<^sub>1 else \<iota>\<^sub>2))) * (P (-\<iota>\<^sub>2/a) (-\<iota>\<^sub>1/a))\<^sup>-\<^sup>1
  = (1/sqrt (b\<^sup>2 + a * 4)) *\<^sub>R (\<Phi> t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (- \<iota>\<^sub>2 / a) (- \<iota>\<^sub>1 / a) * (\<d>\<i>\<a>\<g> i. exp (t * (if i = 1 then \<iota>\<^sub>1 else \<iota>\<^sub>2))) * P (- \<iota>\<^sub>2 / a) (- \<iota>\<^sub>1 / a)\<^sup>-\<^sup>1 = (1 / sqrt (b\<^sup>2 + a * 4)) *\<^sub>R \<Phi> t
[PROOF STEP]
unfolding assms
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a) * (\<d>\<i>\<a>\<g> i. exp (t * (if i = 1 then (b - sqrt (b\<^sup>2 + 4 * a)) / 2 else (b + sqrt (b\<^sup>2 + 4 * a)) / 2))) * P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a)\<^sup>-\<^sup>1 = (1 / sqrt (b\<^sup>2 + a * 4)) *\<^sub>R mtx [[(b + sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2)) - (b - sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)), exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2))], [a * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - a * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2)), (b + sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - (b - sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2))]]
[PROOF STEP]
apply(subst inv_mtx_chB_hOsc)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. - ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a \<noteq> - ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a
 2. P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a) * (\<d>\<i>\<a>\<g> i. exp (t * (if i = 1 then (b - sqrt (b\<^sup>2 + 4 * a)) / 2 else (b + sqrt (b\<^sup>2 + 4 * a)) / 2))) * (1 / (- ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a - - ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a)) *\<^sub>R mtx [[1, - (- ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a)], [- 1, - ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a]] = (1 / sqrt (b\<^sup>2 + a * 4)) *\<^sub>R mtx [[(b + sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2)) - (b - sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)), exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2))], [a * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - a * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2)), (b + sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - (b - sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2))]]
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<iota>\<^sub>1 \<equiv> (b - sqrt (b\<^sup>2 + 4 * a)) / 2
\<iota>\<^sub>2 \<equiv> (b + sqrt (b\<^sup>2 + 4 * a)) / 2
\<Phi> ?t \<equiv> mtx [[\<iota>\<^sub>2 * exp (?t * \<iota>\<^sub>1) - \<iota>\<^sub>1 * exp (?t * \<iota>\<^sub>2), exp (?t * \<iota>\<^sub>2) - exp (?t * \<iota>\<^sub>1)], [a * exp (?t * \<iota>\<^sub>2) - a * exp (?t * \<iota>\<^sub>1), \<iota>\<^sub>2 * exp (?t * \<iota>\<^sub>2) - \<iota>\<^sub>1 * exp (?t * \<iota>\<^sub>1)]]
0 < b\<^sup>2 + a * 4
a \<noteq> 0

goal (2 subgoals):
 1. - ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a \<noteq> - ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a
 2. P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a) * (\<d>\<i>\<a>\<g> i. exp (t * (if i = 1 then (b - sqrt (b\<^sup>2 + 4 * a)) / 2 else (b + sqrt (b\<^sup>2 + 4 * a)) / 2))) * (1 / (- ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a - - ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a)) *\<^sub>R mtx [[1, - (- ((b - sqrt (b\<^sup>2 + 4 * a)) / 2) / a)], [- 1, - ((b + sqrt (b\<^sup>2 + 4 * a)) / 2) / a]] = (1 / sqrt (b\<^sup>2 + a * 4)) *\<^sub>R mtx [[(b + sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2)) - (b - sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)), exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2))], [a * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - a * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2)), (b + sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - (b - sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2))]]
[PROOF STEP]
apply(simp_all add: mtx_times_scaleR_commute, subst sq_mtx_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<iota>\<^sub>1 \<equiv> (b - sqrt (b\<^sup>2 + 4 * a)) / 2; \<iota>\<^sub>2 \<equiv> (b + sqrt (b\<^sup>2 + 4 * a)) / 2; \<And>t. \<Phi> t \<equiv> mtx [[(b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2, exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) - exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)], [a * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) - a * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2), (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2]]; 0 < b\<^sup>2 + a * 4; a \<noteq> 0; \<iota>\<^sub>1 \<equiv> (b - sqrt (b\<^sup>2 + 4 * a)) / 2; \<iota>\<^sub>2 \<equiv> (b + sqrt (b\<^sup>2 + 4 * a)) / 2; \<And>t. \<Phi> t \<equiv> mtx [[\<iota>\<^sub>2 * exp (t * \<iota>\<^sub>1) - \<iota>\<^sub>1 * exp (t * \<iota>\<^sub>2), exp (t * \<iota>\<^sub>2) - exp (t * \<iota>\<^sub>1)], [a * exp (t * \<iota>\<^sub>2) - a * exp (t * \<iota>\<^sub>1), \<iota>\<^sub>2 * exp (t * \<iota>\<^sub>2) - \<iota>\<^sub>1 * exp (t * \<iota>\<^sub>1)]]; 0 < b\<^sup>2 + a * 4; a \<noteq> 0\<rbrakk> \<Longrightarrow> \<forall>i j. ((1 / ((b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a) - (b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) *\<^sub>R (P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) * (\<d>\<i>\<a>\<g> i. exp (t * (if i = 1 then (b - sqrt (b\<^sup>2 + 4 * a)) / 2 else (b + sqrt (b\<^sup>2 + 4 * a)) / 2))) * mtx [[1, (b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a)], [- 1, - ((b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))]])) $$ i $ j = ((1 / sqrt (b\<^sup>2 + a * 4)) *\<^sub>R mtx [[(b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2, exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) - exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)], [a * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) - a * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2), (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2]]) $$ i $ j
[PROOF STEP]
unfolding UNIV_2 sq_mtx_times_eq sq_mtx_scaleR_eq sq_mtx_uminus_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(b - sqrt (b\<^sup>2 + 4 * a)) / 2 \<equiv> (b - sqrt (b\<^sup>2 + 4 * a)) / 2; (b + sqrt (b\<^sup>2 + 4 * a)) / 2 \<equiv> (b + sqrt (b\<^sup>2 + 4 * a)) / 2; \<And>t. \<Phi> t \<equiv> mtx [[(b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2, exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) - exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)], [a * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) - a * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2), (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2]]; 0 < b\<^sup>2 + a * 4; a \<noteq> 0; \<iota>\<^sub>1 \<equiv> (b - sqrt (b\<^sup>2 + 4 * a)) / 2; \<iota>\<^sub>2 \<equiv> (b + sqrt (b\<^sup>2 + 4 * a)) / 2; \<And>t. \<Phi> t \<equiv> mtx [[(b + sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2)) - (b - sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)), exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2))], [a * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - a * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2)), (b + sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b + sqrt (b\<^sup>2 + 4 * a)) / 2)) - (b - sqrt (b\<^sup>2 + 4 * a)) / 2 * exp (t * ((b - sqrt (b\<^sup>2 + 4 * a)) / 2))]]; 0 < b\<^sup>2 + a * 4; a \<noteq> 0\<rbrakk> \<Longrightarrow> \<forall>i j. to_mtx (\<chi>i j. (1 / ((b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a) - (b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) *\<^sub>R to_mtx (\<chi>i j. \<Sum>k\<in>insert 1 (skip 2). to_mtx (\<chi>i j. \<Sum>k\<in>insert 1 (skip 2). P (- ((b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) (- ((b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a))) $$ i $ k * (\<d>\<i>\<a>\<g> i. exp (t * (if i = 1 then (b - sqrt (b\<^sup>2 + 4 * a)) / 2 else (b + sqrt (b\<^sup>2 + 4 * a)) / 2))) $$ k $ j) $$ i $ k * mtx [[1, (b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a)], [- 1, - ((b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a))]] $$ k $ j) $$ i $ j) $$ i $ j = to_mtx (\<chi>i j. (1 / sqrt (b\<^sup>2 + a * 4)) *\<^sub>R mtx [[(b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2, exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) - exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)], [a * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) - a * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2), (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2]] $$ i $ j) $$ i $ j
[PROOF STEP]
apply(simp_all add: axis_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(b - sqrt (b\<^sup>2 + 4 * a)) / 2 \<equiv> (b - sqrt (b\<^sup>2 + 4 * a)) / 2; (b + sqrt (b\<^sup>2 + 4 * a)) / 2 \<equiv> (b + sqrt (b\<^sup>2 + 4 * a)) / 2; \<And>t. mtx [[(b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2, exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) - exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)], [a * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) - a * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2), (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2]] \<equiv> mtx [[(b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2, exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) - exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)], [a * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) - a * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2), (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2]]; \<iota>\<^sub>1 \<equiv> (b - sqrt (b\<^sup>2 + 4 * a)) / 2; \<iota>\<^sub>2 \<equiv> (b + sqrt (b\<^sup>2 + 4 * a)) / 2; \<And>t. \<Phi> t \<equiv> mtx [[(b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2, exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) - exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)], [a * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) - a * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2), (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2]]; 0 < b\<^sup>2 + a * 4; a \<noteq> 0\<rbrakk> \<Longrightarrow> \<forall>i. (i = 2 \<longrightarrow> (\<forall>j. (j = 2 \<longrightarrow> (exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) * (b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a) - exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) * (b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a)) / ((b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a) - (b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a)) = ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2) / sqrt (b\<^sup>2 + a * 4)) \<and> (j \<noteq> 2 \<longrightarrow> j = 1 \<longrightarrow> (exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) / ((b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a) - (b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a)) = (a * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) - a * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)) / sqrt (b\<^sup>2 + a * 4)))) \<and> (i \<noteq> 2 \<longrightarrow> i = 1 \<longrightarrow> (\<forall>j. (j = 2 \<longrightarrow> ((b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) * (b + sqrt (b\<^sup>2 + 4 * a)) / (4 * (a * a)) - (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) * (b - sqrt (b\<^sup>2 + 4 * a)) / (4 * (a * a))) / ((b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a) - (b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a)) = (exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) - exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)) / sqrt (b\<^sup>2 + a * 4)) \<and> (j \<noteq> 2 \<longrightarrow> j = 1 \<longrightarrow> ((b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / (2 * a) - (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / (2 * a)) / ((b - sqrt (b\<^sup>2 + 4 * a)) / (2 * a) - (b + sqrt (b\<^sup>2 + 4 * a)) / (2 * a)) = ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2) / sqrt (b\<^sup>2 + a * 4))))
[PROOF STEP]
by (auto simp: field_simps, auto simp: field_power_simps)+


[STATEMENT]
lemma bernoulli'_upto_20 [simp]:
  "bernoulli' 2 = 1 / 6"
  "bernoulli' 4 = -(1 / 30)"
  "bernoulli' 6 = 1 / 42"
  "bernoulli' 8 = - (1 / 30)"
  "bernoulli' 10 = 5 / 66"
  "bernoulli' 12 = - (691 / 2730)"
  "bernoulli' 14 = 7 / 6"
  "bernoulli' 16 = -(3617 / 510)"
  "bernoulli' 18 = 43867 / 798"
  "bernoulli' 20 = -(174611 / 330)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((bernoulli' 2 = 1 / 6 &&& bernoulli' 4 = - (1 / 30)) &&& bernoulli' 6 = 1 / 42 &&& bernoulli' 8 = - (1 / 30) &&& bernoulli' 10 = 5 / 66) &&& (bernoulli' 12 = - (691 / 2730) &&& bernoulli' 14 = 7 / 6) &&& bernoulli' 16 = - (3617 / 510) &&& bernoulli' 18 = 43867 / 798 &&& bernoulli' 20 = - (174611 / 330)
[PROOF STEP]
by (simp_all add: bernoulli'_def)


[STATEMENT]
lemma
  "((\<lambda>x. ((a powr x - x * ln a) / (b powr x - x * ln b)) powr (1 / x ^ 2)) \<longlongrightarrow>
     exp ((ln a ^ 2 - ln b ^ 2) / 2)) (at 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ((a powr x - x * ln a) / (b powr x - x * ln b)) powr (1 / x\<^sup>2)) \<midarrow>0\<rightarrow> exp (((ln a)\<^sup>2 - (ln b)\<^sup>2) / 2)
[PROOF STEP]
using ab
[PROOF STATE]
proof (prove)
using this:
0 < a
0 < b

goal (1 subgoal):
 1. (\<lambda>x. ((a powr x - x * ln a) / (b powr x - x * ln b)) powr (1 / x\<^sup>2)) \<midarrow>0\<rightarrow> exp (((ln a)\<^sup>2 - (ln b)\<^sup>2) / 2)
[PROOF STEP]
by (real_asymp simp: power2_eq_square)


[STATEMENT]
lemma arcs_graph_G_ge_2vertsG:
  "\<lbrakk>graph G; connected G; Suc n = card (verts G)\<rbrakk> \<Longrightarrow> card (arcs G) \<ge> 2 * (card (verts G) - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>graph G; Digraph_Component.connected G; Suc n = card (verts G)\<rbrakk> \<Longrightarrow> 2 * (card (verts G) - 1) \<le> card (arcs G)
[PROOF STEP]
using arcs_graph_G_ge_2vertsT connected_verts_G_eq_T
[PROOF STATE]
proof (prove)
using this:
graph G \<Longrightarrow> 2 * (card (verts T) - 1) \<le> card (arcs G)
\<lbrakk>graph G; Digraph_Component.connected G; Suc n = card (verts G)\<rbrakk> \<Longrightarrow> verts T = verts G

goal (1 subgoal):
 1. \<lbrakk>graph G; Digraph_Component.connected G; Suc n = card (verts G)\<rbrakk> \<Longrightarrow> 2 * (card (verts G) - 1) \<le> card (arcs G)
[PROOF STEP]
by simp


[STATEMENT]
lemma exp_mult_2: "exp (y * 2 :: real) = exp y * exp y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (y * 2) = exp y * exp y
[PROOF STEP]
by (subst exp_add [symmetric]) simp


[STATEMENT]
lemma DERIV_fun_powr:
  fixes r :: real
  assumes g: "DERIV g x :> m"
    and pos: "g x > 0"
  shows "DERIV (\<lambda>x. (g x) powr r) x :> r * (g x) powr (r - of_nat 1) * m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. g x powr r) has_real_derivative r * g x powr (r - real 1) * m) (at x)
[PROOF STEP]
using DERIV_powr[OF g pos DERIV_const, of r] pos
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. g x powr r) has_real_derivative g x powr r * (0 * ln (g x) + m * r / g x)) (at x)
0 < g x

goal (1 subgoal):
 1. ((\<lambda>x. g x powr r) has_real_derivative r * g x powr (r - real 1) * m) (at x)
[PROOF STEP]
by (simp add: powr_diff field_simps)


[STATEMENT]
lemma ring_iso_set_trans:
  "\<lbrakk> f \<in> ring_iso R S; g \<in> ring_iso S Q \<rbrakk> \<Longrightarrow> (g \<circ> f) \<in> ring_iso R Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> ring_iso R S; g \<in> ring_iso S Q\<rbrakk> \<Longrightarrow> g \<circ> f \<in> ring_iso R Q
[PROOF STEP]
unfolding ring_iso_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {h \<in> ring_hom R S. bij_betw h (carrier R) (carrier S)}; g \<in> {h \<in> ring_hom S Q. bij_betw h (carrier S) (carrier Q)}\<rbrakk> \<Longrightarrow> g \<circ> f \<in> {h \<in> ring_hom R Q. bij_betw h (carrier R) (carrier Q)}
[PROOF STEP]
using bij_betw_trans ring_hom_trans
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>bij_betw ?f ?A ?B; bij_betw ?g ?B ?C\<rbrakk> \<Longrightarrow> bij_betw (?g \<circ> ?f) ?A ?C
\<lbrakk>?f \<in> ring_hom ?R ?S; ?g \<in> ring_hom ?S ?T\<rbrakk> \<Longrightarrow> ?g \<circ> ?f \<in> ring_hom ?R ?T

goal (1 subgoal):
 1. \<lbrakk>f \<in> {h \<in> ring_hom R S. bij_betw h (carrier R) (carrier S)}; g \<in> {h \<in> ring_hom S Q. bij_betw h (carrier S) (carrier Q)}\<rbrakk> \<Longrightarrow> g \<circ> f \<in> {h \<in> ring_hom R Q. bij_betw h (carrier R) (carrier Q)}
[PROOF STEP]
by fastforce


[STATEMENT]
lemma matpow_mono: "0 \<le> C \<Longrightarrow> C \<le> D \<Longrightarrow> matpow (C :: real^_^_) n \<le> matpow D n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> C; C \<le> D\<rbrakk> \<Longrightarrow> matpow C n \<le> matpow D n
[PROOF STEP]
by (induction n) (auto intro!: matrix_mult_mono nonneg_matpow)


[STATEMENT]
lemma infsetsum_cmult_right:
  fixes f :: "'a \<Rightarrow> 'b :: {banach, real_normed_algebra, second_countable_topology}"
  assumes "c \<noteq> 0 \<Longrightarrow> f abs_summable_on A"
  shows   "infsetsum (\<lambda>x. c * f x) A = c * infsetsum f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>ax\<in>A. c * f x) = c * infsetsum f A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'b) \<Longrightarrow> f abs_summable_on A

goal (1 subgoal):
 1. (\<Sum>\<^sub>ax\<in>A. c * f x) = c * infsetsum f A
[PROOF STEP]
unfolding infsetsum_def abs_summable_on_def
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'b) \<Longrightarrow> integrable (count_space A) f

goal (1 subgoal):
 1. LINT x|count_space A. c * f x = c * integral\<^sup>L (count_space A) f
[PROOF STEP]
by (rule Bochner_Integration.integral_mult_right)


[STATEMENT]
theorem inorder_ins:
  "\<lbrakk> avl t;  sorted(inorder t) \<rbrakk> \<Longrightarrow> inorder(tree(ins x t)) = ins_list x (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>avl t; Sorted_Less.sorted (Tree2.inorder t)\<rbrakk> \<Longrightarrow> Tree2.inorder (tree (ins x t)) = ins_list x (Tree2.inorder t)
[PROOF STEP]
apply(induction t)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>avl \<langle>\<rangle>; Sorted_Less.sorted (Tree2.inorder \<langle>\<rangle>)\<rbrakk> \<Longrightarrow> Tree2.inorder (tree (ins x \<langle>\<rangle>)) = ins_list x (Tree2.inorder \<langle>\<rangle>)
 2. \<And>t1 x2 t2. \<lbrakk>\<lbrakk>avl t1; Sorted_Less.sorted (Tree2.inorder t1)\<rbrakk> \<Longrightarrow> Tree2.inorder (tree (ins x t1)) = ins_list x (Tree2.inorder t1); \<lbrakk>avl t2; Sorted_Less.sorted (Tree2.inorder t2)\<rbrakk> \<Longrightarrow> Tree2.inorder (tree (ins x t2)) = ins_list x (Tree2.inorder t2); avl \<langle>t1, x2, t2\<rangle>; Sorted_Less.sorted (Tree2.inorder \<langle>t1, x2, t2\<rangle>)\<rbrakk> \<Longrightarrow> Tree2.inorder (tree (ins x \<langle>t1, x2, t2\<rangle>)) = ins_list x (Tree2.inorder \<langle>t1, x2, t2\<rangle>)
[PROOF STEP]
apply (auto simp: ins_list_simps  split!: splits)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma has_derivative_at_within:
  "(f has_derivative f') (at x within s) \<longleftrightarrow>
    (bounded_linear f' \<and> ((\<lambda>y. ((f y - f x) - f' (y - x)) /\<^sub>R norm (y - x)) \<longlongrightarrow> 0) (at x within s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_derivative f') (at x within s) = (bounded_linear f' \<and> ((\<lambda>y. (f y - f x - f' (y - x)) /\<^sub>R norm (y - x)) \<longlongrightarrow> (0::'b)) (at x within s))
[PROOF STEP]
proof (cases "at x within s = bot")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. at x within s = bot \<Longrightarrow> (f has_derivative f') (at x within s) = (bounded_linear f' \<and> ((\<lambda>y. (f y - f x - f' (y - x)) /\<^sub>R norm (y - x)) \<longlongrightarrow> (0::'b)) (at x within s))
 2. at x within s \<noteq> bot \<Longrightarrow> (f has_derivative f') (at x within s) = (bounded_linear f' \<and> ((\<lambda>y. (f y - f x - f' (y - x)) /\<^sub>R norm (y - x)) \<longlongrightarrow> (0::'b)) (at x within s))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
at x within s = bot

goal (2 subgoals):
 1. at x within s = bot \<Longrightarrow> (f has_derivative f') (at x within s) = (bounded_linear f' \<and> ((\<lambda>y. (f y - f x - f' (y - x)) /\<^sub>R norm (y - x)) \<longlongrightarrow> (0::'b)) (at x within s))
 2. at x within s \<noteq> bot \<Longrightarrow> (f has_derivative f') (at x within s) = (bounded_linear f' \<and> ((\<lambda>y. (f y - f x - f' (y - x)) /\<^sub>R norm (y - x)) \<longlongrightarrow> (0::'b)) (at x within s))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
at x within s = bot
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
at x within s = bot

goal (1 subgoal):
 1. (f has_derivative f') (at x within s) = (bounded_linear f' \<and> ((\<lambda>y. (f y - f x - f' (y - x)) /\<^sub>R norm (y - x)) \<longlongrightarrow> (0::'b)) (at x within s))
[PROOF STEP]
by (metis (no_types, lifting) has_derivative_within tendsto_bot)
[PROOF STATE]
proof (state)
this:
(f has_derivative f') (at x within s) = (bounded_linear f' \<and> ((\<lambda>y. (f y - f x - f' (y - x)) /\<^sub>R norm (y - x)) \<longlongrightarrow> (0::'b)) (at x within s))

goal (1 subgoal):
 1. at x within s \<noteq> bot \<Longrightarrow> (f has_derivative f') (at x within s) = (bounded_linear f' \<and> ((\<lambda>y. (f y - f x - f' (y - x)) /\<^sub>R norm (y - x)) \<longlongrightarrow> (0::'b)) (at x within s))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. at x within s \<noteq> bot \<Longrightarrow> (f has_derivative f') (at x within s) = (bounded_linear f' \<and> ((\<lambda>y. (f y - f x - f' (y - x)) /\<^sub>R norm (y - x)) \<longlongrightarrow> (0::'b)) (at x within s))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
at x within s \<noteq> bot

goal (1 subgoal):
 1. at x within s \<noteq> bot \<Longrightarrow> (f has_derivative f') (at x within s) = (bounded_linear f' \<and> ((\<lambda>y. (f y - f x - f' (y - x)) /\<^sub>R norm (y - x)) \<longlongrightarrow> (0::'b)) (at x within s))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
at x within s \<noteq> bot
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
at x within s \<noteq> bot

goal (1 subgoal):
 1. (f has_derivative f') (at x within s) = (bounded_linear f' \<and> ((\<lambda>y. (f y - f x - f' (y - x)) /\<^sub>R norm (y - x)) \<longlongrightarrow> (0::'b)) (at x within s))
[PROOF STEP]
by (simp add: Lim_ident_at has_derivative_def)
[PROOF STATE]
proof (state)
this:
(f has_derivative f') (at x within s) = (bounded_linear f' \<and> ((\<lambda>y. (f y - f x - f' (y - x)) /\<^sub>R norm (y - x)) \<longlongrightarrow> (0::'b)) (at x within s))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma enumerate_Suc'':
  fixes S :: "'a::wellorder set"
  assumes "infinite S"
  shows "enumerate S (Suc n) = (LEAST s. s \<in> S \<and> enumerate S n < s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wellorder_class.enumerate S (Suc n) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S n < s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
infinite S

goal (1 subgoal):
 1. wellorder_class.enumerate S (Suc n) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S n < s)
[PROOF STEP]
proof (induct n arbitrary: S)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>S. infinite S \<Longrightarrow> wellorder_class.enumerate S (Suc 0) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S 0 < s)
 2. \<And>n S. \<lbrakk>\<And>S. infinite S \<Longrightarrow> wellorder_class.enumerate S (Suc n) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S n < s); infinite S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S (Suc (Suc n)) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S (Suc n) < s)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
infinite S

goal (2 subgoals):
 1. \<And>S. infinite S \<Longrightarrow> wellorder_class.enumerate S (Suc 0) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S 0 < s)
 2. \<And>n S. \<lbrakk>\<And>S. infinite S \<Longrightarrow> wellorder_class.enumerate S (Suc n) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S n < s); infinite S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S (Suc (Suc n)) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S (Suc n) < s)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite S
[PROOF STEP]
have "\<forall>s \<in> S. enumerate S 0 \<le> s"
[PROOF STATE]
proof (prove)
using this:
infinite S

goal (1 subgoal):
 1. \<forall>s\<in>S. wellorder_class.enumerate S 0 \<le> s
[PROOF STEP]
by (auto simp: enumerate.simps intro: Least_le)
[PROOF STATE]
proof (state)
this:
\<forall>s\<in>S. wellorder_class.enumerate S 0 \<le> s

goal (2 subgoals):
 1. \<And>S. infinite S \<Longrightarrow> wellorder_class.enumerate S (Suc 0) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S 0 < s)
 2. \<And>n S. \<lbrakk>\<And>S. infinite S \<Longrightarrow> wellorder_class.enumerate S (Suc n) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S n < s); infinite S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S (Suc (Suc n)) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S (Suc n) < s)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>s\<in>S. wellorder_class.enumerate S 0 \<le> s
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>s\<in>S. wellorder_class.enumerate S 0 \<le> s

goal (1 subgoal):
 1. wellorder_class.enumerate S (Suc 0) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S 0 < s)
[PROOF STEP]
unfolding enumerate_Suc' enumerate_0[of "S - {enumerate S 0}"]
[PROOF STATE]
proof (prove)
using this:
\<forall>s\<in>S. wellorder_class.enumerate S 0 \<le> s

goal (1 subgoal):
 1. (LEAST n. n \<in> S - {wellorder_class.enumerate S 0}) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S 0 < s)
[PROOF STEP]
by (intro arg_cong[where f = Least] ext) auto
[PROOF STATE]
proof (state)
this:
wellorder_class.enumerate S (Suc 0) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S 0 < s)

goal (1 subgoal):
 1. \<And>n S. \<lbrakk>\<And>S. infinite S \<Longrightarrow> wellorder_class.enumerate S (Suc n) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S n < s); infinite S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S (Suc (Suc n)) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S (Suc n) < s)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n S. \<lbrakk>\<And>S. infinite S \<Longrightarrow> wellorder_class.enumerate S (Suc n) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S n < s); infinite S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S (Suc (Suc n)) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S (Suc n) < s)
[PROOF STEP]
case (Suc n S)
[PROOF STATE]
proof (state)
this:
infinite ?S \<Longrightarrow> wellorder_class.enumerate ?S (Suc n) = (LEAST s. s \<in> ?S \<and> wellorder_class.enumerate ?S n < s)
infinite S

goal (1 subgoal):
 1. \<And>n S. \<lbrakk>\<And>S. infinite S \<Longrightarrow> wellorder_class.enumerate S (Suc n) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S n < s); infinite S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate S (Suc (Suc n)) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S (Suc n) < s)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wellorder_class.enumerate S (Suc (Suc n)) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S (Suc n) < s)
[PROOF STEP]
using enumerate_mono[OF zero_less_Suc \<open>infinite S\<close>, of n] \<open>infinite S\<close>
[PROOF STATE]
proof (prove)
using this:
wellorder_class.enumerate S 0 < wellorder_class.enumerate S (Suc n)
infinite S

goal (1 subgoal):
 1. wellorder_class.enumerate S (Suc (Suc n)) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S (Suc n) < s)
[PROOF STEP]
apply (subst (1 2) enumerate_Suc')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wellorder_class.enumerate S 0 < wellorder_class.enumerate S (Suc n); infinite S\<rbrakk> \<Longrightarrow> wellorder_class.enumerate (S - {wellorder_class.enumerate S 0}) (Suc n) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate (S - {wellorder_class.enumerate S 0}) n < s)
[PROOF STEP]
apply (subst Suc)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>wellorder_class.enumerate S 0 < wellorder_class.enumerate S (Suc n); infinite S\<rbrakk> \<Longrightarrow> infinite (S - {wellorder_class.enumerate S 0})
 2. \<lbrakk>wellorder_class.enumerate S 0 < wellorder_class.enumerate S (Suc n); infinite S\<rbrakk> \<Longrightarrow> (LEAST s. s \<in> S - {wellorder_class.enumerate S 0} \<and> wellorder_class.enumerate (S - {wellorder_class.enumerate S 0}) n < s) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate (S - {wellorder_class.enumerate S 0}) n < s)
[PROOF STEP]
apply (use \<open>infinite S\<close> in simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wellorder_class.enumerate S 0 < wellorder_class.enumerate S (Suc n); infinite S\<rbrakk> \<Longrightarrow> (LEAST s. s \<in> S - {wellorder_class.enumerate S 0} \<and> wellorder_class.enumerate (S - {wellorder_class.enumerate S 0}) n < s) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate (S - {wellorder_class.enumerate S 0}) n < s)
[PROOF STEP]
apply (intro arg_cong[where f = Least] ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s. \<lbrakk>wellorder_class.enumerate S 0 < wellorder_class.enumerate S (Suc n); infinite S\<rbrakk> \<Longrightarrow> (s \<in> S - {wellorder_class.enumerate S 0} \<and> wellorder_class.enumerate (S - {wellorder_class.enumerate S 0}) n < s) = (s \<in> S \<and> wellorder_class.enumerate (S - {wellorder_class.enumerate S 0}) n < s)
[PROOF STEP]
apply (auto simp flip: enumerate_Suc')
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
wellorder_class.enumerate S (Suc (Suc n)) = (LEAST s. s \<in> S \<and> wellorder_class.enumerate S (Suc n) < s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_power_le [simp]: "\<bar>a\<bar>^n \<le> \<bar>b\<bar>^n \<longleftrightarrow> n = 0 \<or> \<bar>a\<bar> \<le> \<bar>b\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<bar>a\<bar> ^ n \<le> \<bar>b\<bar> ^ n) = (n = 0 \<or> \<bar>a\<bar> \<le> \<bar>b\<bar>)
[PROOF STEP]
by (subst nonneg_power_le, auto)


[STATEMENT]
lemma cos_0_iff_canon:
  assumes "cos \<phi> = 0" and "-pi < \<phi>" and "\<phi> \<le> pi"
  shows "\<phi> = pi/2 \<or> \<phi> = -pi/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> = pi / 2 \<or> \<phi> = - pi / 2
[PROOF STEP]
by (smt (verit, best) arccos_0 arccos_cos assms cos_minus divide_minus_left)


[STATEMENT]
lemma degree_monic_charpoly: fixes A :: "'a :: comm_ring_1 ^ 'n ^ 'n"
  shows "degree (charpoly A) = CARD('n) \<and> monic (charpoly A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (charpoly A) = CARD('n) \<and> monic (charpoly A)
[PROOF STEP]
proof (transfer, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. A \<in> carrier_mat CARD('n) CARD('n) \<Longrightarrow> degree (char_poly A) = CARD('n) \<and> monic (char_poly A)
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
A_ \<in> carrier_mat CARD('n) CARD('n)

goal (1 subgoal):
 1. \<And>A. A \<in> carrier_mat CARD('n) CARD('n) \<Longrightarrow> degree (char_poly A) = CARD('n) \<and> monic (char_poly A)
[PROOF STEP]
from degree_monic_char_poly[OF 1]
[PROOF STATE]
proof (chain)
picking this:
degree (char_poly A_) = CARD('n) \<and> coeff (char_poly A_) CARD('n) = (1::'a)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
degree (char_poly A_) = CARD('n) \<and> coeff (char_poly A_) CARD('n) = (1::'a)

goal (1 subgoal):
 1. degree (char_poly A_) = CARD('n) \<and> monic (char_poly A_)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree (char_poly A_) = CARD('n) \<and> monic (char_poly A_)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cofinite_closure_infinite:
  fixes X :: "'a cofinite set"
  assumes "infinite X"
  shows "closure X = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure X = UNIV
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
infinite X

goal (1 subgoal):
 1. closure X = UNIV
[PROOF STEP]
by (metis Compl_empty_eq closure_subset double_compl finite_subset interior_complement open_cofinite_def open_interior)


[STATEMENT]
lemma nat_exists_least_iff: "(\<exists>(n::nat). P n) \<longleftrightarrow> (\<exists>n. P n \<and> (\<forall>m < n. \<not> P m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>n. P n) = (\<exists>n. P n \<and> (\<forall>m<n. \<not> P m))
[PROOF STEP]
by (metis ex_least_nat_le not_less0)


[STATEMENT]
lemma list_sel_aux_eq_foldl: "list_sel_aux f x y = foldl (\<lambda>a b. a * f x b) 1 y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_sel_aux f x y = foldl (\<lambda>a b. a * f x b) 1 y
[PROOF STEP]
apply(induction y)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. list_sel_aux f x [] = foldl (\<lambda>a b. a * f x b) 1 []
 2. \<And>a y. list_sel_aux f x y = foldl (\<lambda>a b. a * f x b) 1 y \<Longrightarrow> list_sel_aux f x (a # y) = foldl (\<lambda>a b. a * f x b) 1 (a # y)
[PROOF STEP]
apply(auto)[2]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a y. list_sel_aux f x y = foldl (\<lambda>a b. a * f x b) 1 y \<Longrightarrow> f x a * foldl (\<lambda>a b. a * f x b) 1 y = foldl (\<lambda>a b. a * f x b) (f x a) y
[PROOF STEP]
using foldl_acc_extr
[PROOF STATE]
proof (prove)
using this:
foldl (\<lambda>a b. a * ?f ?x b) ?z ?y = ?z * foldl (\<lambda>a b. a * ?f ?x b) 1 ?y

goal (1 subgoal):
 1. \<And>a y. list_sel_aux f x y = foldl (\<lambda>a b. a * f x b) 1 y \<Longrightarrow> f x a * foldl (\<lambda>a b. a * f x b) 1 y = foldl (\<lambda>a b. a * f x b) (f x a) y
[PROOF STEP]
by metis


[STATEMENT]
lemma sum_of_squares_nat_bound:
  fixes x y n :: nat
  assumes "x ^ 2 + y ^ 2 = n"
  shows   "x \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> n
[PROOF STEP]
proof (cases "x = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = 0 \<Longrightarrow> x \<le> n
 2. x \<noteq> 0 \<Longrightarrow> x \<le> n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> 0

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> x \<le> n
 2. x \<noteq> 0 \<Longrightarrow> x \<le> n
[PROOF STEP]
hence "x * 1 \<le> x ^ 2"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0

goal (1 subgoal):
 1. x * 1 \<le> x\<^sup>2
[PROOF STEP]
unfolding power2_eq_square
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0

goal (1 subgoal):
 1. x * 1 \<le> x * x
[PROOF STEP]
by (intro mult_mono) auto
[PROOF STATE]
proof (state)
this:
x * 1 \<le> x\<^sup>2

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> x \<le> n
 2. x \<noteq> 0 \<Longrightarrow> x \<le> n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * 1 \<le> x\<^sup>2

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> x \<le> n
 2. x \<noteq> 0 \<Longrightarrow> x \<le> n
[PROOF STEP]
have "\<dots> \<le> x ^ 2 + y ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>2 \<le> x\<^sup>2 + y\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x\<^sup>2 \<le> x\<^sup>2 + y\<^sup>2

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> x \<le> n
 2. x \<noteq> 0 \<Longrightarrow> x \<le> n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x\<^sup>2 \<le> x\<^sup>2 + y\<^sup>2

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> x \<le> n
 2. x \<noteq> 0 \<Longrightarrow> x \<le> n
[PROOF STEP]
have "\<dots> = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>2 + y\<^sup>2 = n
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
x\<^sup>2 + y\<^sup>2 = n

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> x \<le> n
 2. x \<noteq> 0 \<Longrightarrow> x \<le> n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x * 1 \<le> n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x * 1 \<le> n

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

goal (1 subgoal):
 1. x = 0 \<Longrightarrow> x \<le> n
[PROOF STEP]
qed auto


[STATEMENT]
lemma productdivides: "\<lbrakk>x mod a = (0::nat); x mod b = 0; prime a; prime b; a \<noteq> b\<rbrakk> \<Longrightarrow> x mod (a*b) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x mod a = 0; x mod b = 0; prime a; prime b; a \<noteq> b\<rbrakk> \<Longrightarrow> x mod (a * b) = 0
[PROOF STEP]
by (simp add: mod_eq_0_iff_dvd primes_coprime divides_mult)


[STATEMENT]
lemma self_cscalar_prod_geq_0:
  fixes v ::  "'a::conjugatable_ordered_field vec"
  shows "v \<bullet>c v \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> inner_prod v v
[PROOF STEP]
by (auto simp add: scalar_prod_def, rule sum_nonneg, rule conjugate_square_positive)


[STATEMENT]
lemma asymp_equiv_divide [asymp_equiv_intros]:
  assumes "f1 \<sim>[F] g1" "f2 \<sim>[F] g2"
  shows   "(\<lambda>x. f1 x / f2 x) \<sim>[F] (\<lambda>x. g1 x / g2 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f1 x / f2 x) \<sim>[F] (\<lambda>x. g1 x / g2 x)
[PROOF STEP]
using asymp_equiv_mult[OF assms(1) asymp_equiv_inverse[OF assms(2)]]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. f1 x * inverse (f2 x)) \<sim>[F] (\<lambda>x. g1 x * inverse (g2 x))

goal (1 subgoal):
 1. (\<lambda>x. f1 x / f2 x) \<sim>[F] (\<lambda>x. g1 x / g2 x)
[PROOF STEP]
by (simp add: field_simps)


[STATEMENT]
theorem subgroup_Inter:
  assumes subgr: "(\<And>H. H \<in> A \<Longrightarrow> subgroup H G)"
    and not_empty: "A \<noteq> {}"
  shows "subgroup (\<Inter>A) G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup (\<Inter> A) G
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<Inter> A \<subseteq> carrier G
 2. \<And>x y. \<lbrakk>x \<in> \<Inter> A; y \<in> \<Inter> A\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>G\<^esub> y \<in> \<Inter> A
 3. \<one>\<^bsub>G\<^esub> \<in> \<Inter> A
 4. \<And>x. x \<in> \<Inter> A \<Longrightarrow> inv\<^bsub>G\<^esub> x \<in> \<Inter> A
[PROOF STEP]
show "\<Inter> A \<subseteq> carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> A \<subseteq> carrier G
[PROOF STEP]
by (simp add: Inf_less_eq not_empty subgr subgroup.subset)
[PROOF STATE]
proof (state)
this:
\<Inter> A \<subseteq> carrier G

goal (3 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> \<Inter> A; y \<in> \<Inter> A\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>G\<^esub> y \<in> \<Inter> A
 2. \<one>\<^bsub>G\<^esub> \<in> \<Inter> A
 3. \<And>x. x \<in> \<Inter> A \<Longrightarrow> inv\<^bsub>G\<^esub> x \<in> \<Inter> A
[PROOF STEP]
qed (auto simp: subgr subgroup.m_closed subgroup.one_closed subgroup.m_inv_closed)


[STATEMENT]
lemma le_list_antisym:
  "\<lbrakk> order r; xs <=[r] ys; ys <=[r] xs \<rbrakk> \<Longrightarrow> xs = ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>order r; xs <=[r] ys; ys <=[r] xs\<rbrakk> \<Longrightarrow> xs = ys
[PROOF STEP]
apply (unfold unfold_lesub_list)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>order r; Listn.le r xs ys; Listn.le r ys xs\<rbrakk> \<Longrightarrow> xs = ys
[PROOF STEP]
apply (simp add: Listn.le_def list_all2_conv_all_nth)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>order r; length xs = length ys \<and> (\<forall>i<length xs. xs ! i \<sqsubseteq>\<^bsub>r\<^esub> ys ! i); \<forall>i<length ys. ys ! i \<sqsubseteq>\<^bsub>r\<^esub> xs ! i\<rbrakk> \<Longrightarrow> xs = ys
[PROOF STEP]
apply (rule nth_equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>order r; length xs = length ys \<and> (\<forall>i<length xs. xs ! i \<sqsubseteq>\<^bsub>r\<^esub> ys ! i); \<forall>i<length ys. ys ! i \<sqsubseteq>\<^bsub>r\<^esub> xs ! i\<rbrakk> \<Longrightarrow> length xs = length ys
 2. \<And>i. \<lbrakk>order r; length xs = length ys \<and> (\<forall>i<length xs. xs ! i \<sqsubseteq>\<^bsub>r\<^esub> ys ! i); \<forall>i<length ys. ys ! i \<sqsubseteq>\<^bsub>r\<^esub> xs ! i; i < length xs\<rbrakk> \<Longrightarrow> xs ! i = ys ! i
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>order r; length xs = length ys \<and> (\<forall>i<length xs. xs ! i \<sqsubseteq>\<^bsub>r\<^esub> ys ! i); \<forall>i<length ys. ys ! i \<sqsubseteq>\<^bsub>r\<^esub> xs ! i; i < length xs\<rbrakk> \<Longrightarrow> xs ! i = ys ! i
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>order r; \<forall>i<length ys. ys ! i \<sqsubseteq>\<^bsub>r\<^esub> xs ! i; i < length xs; length xs = length ys; \<forall>i<length xs. xs ! i \<sqsubseteq>\<^bsub>r\<^esub> ys ! i\<rbrakk> \<Longrightarrow> xs ! i = ys ! i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>order r; \<forall>i<length ys. ys ! i \<sqsubseteq>\<^bsub>r\<^esub> xs ! i; i < length ys; length xs = length ys; \<forall>i<length ys. xs ! i \<sqsubseteq>\<^bsub>r\<^esub> ys ! i\<rbrakk> \<Longrightarrow> xs ! i = ys ! i
[PROOF STEP]
apply (blast intro: order_antisym)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma exp_to_cos:
  fixes x:: real
  shows "exp (\<i> * x) + exp (-(\<i> * x)) = 2 * (cos x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (\<i> * complex_of_real x) + exp (- (\<i> * complex_of_real x)) = complex_of_real (2 * cos x)
[PROOF STEP]
using exp_of_real exp_of_real_inv
[PROOF STATE]
proof (prove)
using this:
exp (\<i> * complex_of_real ?x) = complex_of_real (cos ?x) + \<i> * complex_of_real (sin ?x)
exp (- (\<i> * complex_of_real ?x)) = complex_of_real (cos ?x) - \<i> * complex_of_real (sin ?x)

goal (1 subgoal):
 1. exp (\<i> * complex_of_real x) + exp (- (\<i> * complex_of_real x)) = complex_of_real (2 * cos x)
[PROOF STEP]
by simp


[STATEMENT]
lemma gauss_int_norm_mult: "gauss_int_norm (z * u) = gauss_int_norm z * gauss_int_norm u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gauss_int_norm (z * u) = gauss_int_norm z * gauss_int_norm u
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gauss_int_norm (z * u) = gauss_int_norm z * gauss_int_norm u
[PROOF STEP]
have "real (gauss_int_norm (z * u)) = real (gauss_int_norm z * gauss_int_norm u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (gauss_int_norm (z * u)) = real (gauss_int_norm z * gauss_int_norm u)
[PROOF STEP]
unfolding of_nat_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (gauss_int_norm (z * u)) = real (gauss_int_norm z) * real (gauss_int_norm u)
[PROOF STEP]
by (simp add: real_gauss_int_norm norm_power norm_mult power_mult_distrib)
[PROOF STATE]
proof (state)
this:
real (gauss_int_norm (z * u)) = real (gauss_int_norm z * gauss_int_norm u)

goal (1 subgoal):
 1. gauss_int_norm (z * u) = gauss_int_norm z * gauss_int_norm u
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
real (gauss_int_norm (z * u)) = real (gauss_int_norm z * gauss_int_norm u)

goal (1 subgoal):
 1. gauss_int_norm (z * u) = gauss_int_norm z * gauss_int_norm u
[PROOF STEP]
by (subst (asm) of_nat_eq_iff)
[PROOF STATE]
proof (state)
this:
gauss_int_norm (z * u) = gauss_int_norm z * gauss_int_norm u

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uint64_range : "range nat_of_uint64 = {..<2 ^ 64}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range nat_of_uint64 = {..<2 ^ 64}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. range nat_of_uint64 \<subseteq> {..<2 ^ 64}
 2. {..<2 ^ 64} \<subseteq> range nat_of_uint64
[PROOF STEP]
show "{..<2 ^ 64} \<subseteq> range nat_of_uint64"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..<2 ^ 64} \<subseteq> range nat_of_uint64
[PROOF STEP]
using uint64_nat_bij
[PROOF STATE]
proof (prove)
using this:
?x < 2 ^ 64 \<Longrightarrow> nat_of_uint64 (uint64_of_nat ?x) = ?x

goal (1 subgoal):
 1. {..<2 ^ 64} \<subseteq> range nat_of_uint64
[PROOF STEP]
by (metis lessThan_iff range_eqI subsetI)
[PROOF STATE]
proof (state)
this:
{..<2 ^ 64} \<subseteq> range nat_of_uint64

goal (1 subgoal):
 1. range nat_of_uint64 \<subseteq> {..<2 ^ 64}
[PROOF STEP]
have "\<And> x . nat_of_uint64 x < 2^64"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. nat_of_uint64 x < 2 ^ 64
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. unat x < 2 ^ 64
[PROOF STEP]
using take_bit_nat_eq_self
[PROOF STATE]
proof (prove)
using this:
?m < 2 ^ ?n \<Longrightarrow> take_bit ?n ?m = ?m

goal (1 subgoal):
 1. \<And>x. unat x < 2 ^ 64
[PROOF STEP]
by (metis uint64.size_eq_length unsigned_less)
[PROOF STATE]
proof (state)
this:
nat_of_uint64 ?x < 2 ^ 64

goal (1 subgoal):
 1. range nat_of_uint64 \<subseteq> {..<2 ^ 64}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nat_of_uint64 ?x < 2 ^ 64
[PROOF STEP]
show "range nat_of_uint64 \<subseteq> {..<2 ^ 64}"
[PROOF STATE]
proof (prove)
using this:
nat_of_uint64 ?x < 2 ^ 64

goal (1 subgoal):
 1. range nat_of_uint64 \<subseteq> {..<2 ^ 64}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
range nat_of_uint64 \<subseteq> {..<2 ^ 64}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_inv_matrix_mul:
  assumes "invertible A" and "invertible B"
  shows "(A ** B)\<^sup>-\<^sup>1 = B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A ** B)\<^sup>-\<^sup>1 = B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1
[PROOF STEP]
proof(rule matrix_inv_unique)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A ** B ** (B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1) = mat (1::'a)
 2. B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = mat (1::'a)
[PROOF STEP]
have "A ** B ** (B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1) = A ** (B ** B\<^sup>-\<^sup>1) ** A\<^sup>-\<^sup>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A ** B ** (B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1) = A ** (B ** B\<^sup>-\<^sup>1) ** A\<^sup>-\<^sup>1
[PROOF STEP]
by (simp add: matrix_mul_assoc)
[PROOF STATE]
proof (state)
this:
A ** B ** (B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1) = A ** (B ** B\<^sup>-\<^sup>1) ** A\<^sup>-\<^sup>1

goal (2 subgoals):
 1. A ** B ** (B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1) = mat (1::'a)
 2. B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = mat (1::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A ** B ** (B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1) = A ** (B ** B\<^sup>-\<^sup>1) ** A\<^sup>-\<^sup>1

goal (2 subgoals):
 1. A ** B ** (B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1) = mat (1::'a)
 2. B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = mat (1::'a)
[PROOF STEP]
have "... = mat 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A ** (B ** B\<^sup>-\<^sup>1) ** A\<^sup>-\<^sup>1 = mat (1::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
invertible A
invertible B

goal (1 subgoal):
 1. A ** (B ** B\<^sup>-\<^sup>1) ** A\<^sup>-\<^sup>1 = mat (1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A ** (B ** B\<^sup>-\<^sup>1) ** A\<^sup>-\<^sup>1 = mat (1::'a)

goal (2 subgoals):
 1. A ** B ** (B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1) = mat (1::'a)
 2. B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = mat (1::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A ** B ** (B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1) = mat (1::'a)
[PROOF STEP]
show "A ** B ** (B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1) = mat 1"
[PROOF STATE]
proof (prove)
using this:
A ** B ** (B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1) = mat (1::'a)

goal (1 subgoal):
 1. A ** B ** (B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1) = mat (1::'a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
A ** B ** (B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1) = mat (1::'a)

goal (1 subgoal):
 1. B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = mat (1::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = mat (1::'a)
[PROOF STEP]
have "B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = B\<^sup>-\<^sup>1 ** (A\<^sup>-\<^sup>1 ** A) ** B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = B\<^sup>-\<^sup>1 ** (A\<^sup>-\<^sup>1 ** A) ** B
[PROOF STEP]
by (simp add: matrix_mul_assoc)
[PROOF STATE]
proof (state)
this:
B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = B\<^sup>-\<^sup>1 ** (A\<^sup>-\<^sup>1 ** A) ** B

goal (1 subgoal):
 1. B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = mat (1::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = B\<^sup>-\<^sup>1 ** (A\<^sup>-\<^sup>1 ** A) ** B

goal (1 subgoal):
 1. B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = mat (1::'a)
[PROOF STEP]
have "... = mat 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B\<^sup>-\<^sup>1 ** (A\<^sup>-\<^sup>1 ** A) ** B = mat (1::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
invertible A
invertible B

goal (1 subgoal):
 1. B\<^sup>-\<^sup>1 ** (A\<^sup>-\<^sup>1 ** A) ** B = mat (1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
B\<^sup>-\<^sup>1 ** (A\<^sup>-\<^sup>1 ** A) ** B = mat (1::'a)

goal (1 subgoal):
 1. B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = mat (1::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = mat (1::'a)
[PROOF STEP]
show "B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = mat 1"
[PROOF STATE]
proof (prove)
using this:
B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = mat (1::'a)

goal (1 subgoal):
 1. B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = mat (1::'a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
B\<^sup>-\<^sup>1 ** A\<^sup>-\<^sup>1 ** (A ** B) = mat (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_vector_affinity_eq:
  fixes x :: "'a :: real_vector"
  assumes m0: "m \<noteq> 0"
  shows "m *\<^sub>R x + c = y \<longleftrightarrow> x = inverse m *\<^sub>R y - (inverse m *\<^sub>R c)"
    (is "?lhs \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (m *\<^sub>R x + c = y) = (x = y /\<^sub>R m - c /\<^sub>R m)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m *\<^sub>R x + c = y \<Longrightarrow> x = y /\<^sub>R m - c /\<^sub>R m
 2. x = y /\<^sub>R m - c /\<^sub>R m \<Longrightarrow> m *\<^sub>R x + c = y
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
m *\<^sub>R x + c = y

goal (2 subgoals):
 1. m *\<^sub>R x + c = y \<Longrightarrow> x = y /\<^sub>R m - c /\<^sub>R m
 2. x = y /\<^sub>R m - c /\<^sub>R m \<Longrightarrow> m *\<^sub>R x + c = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m *\<^sub>R x + c = y
[PROOF STEP]
have "m *\<^sub>R x = y - c"
[PROOF STATE]
proof (prove)
using this:
m *\<^sub>R x + c = y

goal (1 subgoal):
 1. m *\<^sub>R x = y - c
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
m *\<^sub>R x = y - c

goal (2 subgoals):
 1. m *\<^sub>R x + c = y \<Longrightarrow> x = y /\<^sub>R m - c /\<^sub>R m
 2. x = y /\<^sub>R m - c /\<^sub>R m \<Longrightarrow> m *\<^sub>R x + c = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m *\<^sub>R x = y - c
[PROOF STEP]
have "inverse m *\<^sub>R (m *\<^sub>R x) = inverse m *\<^sub>R (y - c)"
[PROOF STATE]
proof (prove)
using this:
m *\<^sub>R x = y - c

goal (1 subgoal):
 1. m *\<^sub>R x /\<^sub>R m = (y - c) /\<^sub>R m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m *\<^sub>R x /\<^sub>R m = (y - c) /\<^sub>R m

goal (2 subgoals):
 1. m *\<^sub>R x + c = y \<Longrightarrow> x = y /\<^sub>R m - c /\<^sub>R m
 2. x = y /\<^sub>R m - c /\<^sub>R m \<Longrightarrow> m *\<^sub>R x + c = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m *\<^sub>R x /\<^sub>R m = (y - c) /\<^sub>R m
[PROOF STEP]
show "x = inverse m *\<^sub>R y - (inverse m *\<^sub>R c)"
[PROOF STATE]
proof (prove)
using this:
m *\<^sub>R x /\<^sub>R m = (y - c) /\<^sub>R m

goal (1 subgoal):
 1. x = y /\<^sub>R m - c /\<^sub>R m
[PROOF STEP]
using m0
[PROOF STATE]
proof (prove)
using this:
m *\<^sub>R x /\<^sub>R m = (y - c) /\<^sub>R m
m \<noteq> 0

goal (1 subgoal):
 1. x = y /\<^sub>R m - c /\<^sub>R m
[PROOF STEP]
by (simp add: scaleR_diff_right)
[PROOF STATE]
proof (state)
this:
x = y /\<^sub>R m - c /\<^sub>R m

goal (1 subgoal):
 1. x = y /\<^sub>R m - c /\<^sub>R m \<Longrightarrow> m *\<^sub>R x + c = y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = y /\<^sub>R m - c /\<^sub>R m \<Longrightarrow> m *\<^sub>R x + c = y
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
x = y /\<^sub>R m - c /\<^sub>R m

goal (1 subgoal):
 1. x = y /\<^sub>R m - c /\<^sub>R m \<Longrightarrow> m *\<^sub>R x + c = y
[PROOF STEP]
with m0
[PROOF STATE]
proof (chain)
picking this:
m \<noteq> 0
x = y /\<^sub>R m - c /\<^sub>R m
[PROOF STEP]
show "m *\<^sub>R x + c = y"
[PROOF STATE]
proof (prove)
using this:
m \<noteq> 0
x = y /\<^sub>R m - c /\<^sub>R m

goal (1 subgoal):
 1. m *\<^sub>R x + c = y
[PROOF STEP]
by (simp add: scaleR_diff_right)
[PROOF STATE]
proof (state)
this:
m *\<^sub>R x + c = y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LIMSEQ_const_iff: "(\<lambda>n. k) \<longlonglongrightarrow> l \<longleftrightarrow> k = l"
  for k l :: "'a::t2_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. k) \<longlonglongrightarrow> l = (k = l)
[PROOF STEP]
using trivial_limit_sequentially
[PROOF STATE]
proof (prove)
using this:
sequentially \<noteq> bot

goal (1 subgoal):
 1. (\<lambda>n. k) \<longlonglongrightarrow> l = (k = l)
[PROOF STEP]
by (rule tendsto_const_iff)


[STATEMENT]
lemma connected_openin:
      "connected S \<longleftrightarrow>
       \<not>(\<exists>E1 E2. openin (top_of_set S) E1 \<and>
                 openin (top_of_set S) E2 \<and>
                 S \<subseteq> E1 \<union> E2 \<and> E1 \<inter> E2 = {} \<and> E1 \<noteq> {} \<and> E2 \<noteq> {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected S = (\<nexists>E1 E2. openin (top_of_set S) E1 \<and> openin (top_of_set S) E2 \<and> S \<subseteq> E1 \<union> E2 \<and> E1 \<inter> E2 = {} \<and> E1 \<noteq> {} \<and> E2 \<noteq> {})
[PROOF STEP]
unfolding connected_def openin_open disjoint_iff_not_equal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>A B. open A \<and> open B \<and> S \<subseteq> A \<union> B \<and> (\<forall>x\<in>A \<inter> B. \<forall>y\<in>S. x \<noteq> y) \<and> \<not> (\<forall>x\<in>A. \<forall>y\<in>S. x \<noteq> y) \<and> \<not> (\<forall>x\<in>B. \<forall>y\<in>S. x \<noteq> y)) = (\<nexists>E1 E2. (\<exists>T. open T \<and> E1 = S \<inter> T) \<and> (\<exists>T. open T \<and> E2 = S \<inter> T) \<and> S \<subseteq> E1 \<union> E2 \<and> (\<forall>x\<in>E1. \<forall>y\<in>E2. x \<noteq> y) \<and> E1 \<noteq> {} \<and> E2 \<noteq> {})
[PROOF STEP]
by blast


[STATEMENT]
lemma set_check_generate:
  "set (check_generate a b) = {(x, y).
    (x, y) \<noteq> (zeroes (length a), zeroes (length b)) \<and>
    length x = length a \<and> length y = length b \<and> a \<bullet> x = b \<bullet> y \<and>
    (\<forall>i<length a. x ! i \<le> Max (set b)) \<and> (\<forall>j<length b. y ! j \<le> Max (set a))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (check_generate a b) = {(x, y). (x, y) \<noteq> (zeroes (length a), zeroes (length b)) \<and> length x = length a \<and> length y = length b \<and> a \<bullet> x = b \<bullet> y \<and> (\<forall>i<length a. x ! i \<le> Max (set b)) \<and> (\<forall>j<length b. y ! j \<le> Max (set a))}
[PROOF STEP]
unfolding check_def and set_filter and set_generate and set_gen2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> {(x, y). (x, y) \<noteq> (zeroes (length a), zeroes (length b)) \<and> (x, y) \<in> {(x, y). length x = length a \<and> length y = length b \<and> (\<forall>i<length a. x ! i \<le> Max (set b)) \<and> (\<forall>j<length b. y ! j \<le> Max (set a))}}. case x of (x, y) \<Rightarrow> a \<bullet> x = b \<bullet> y} = {(x, y). (x, y) \<noteq> (zeroes (length a), zeroes (length b)) \<and> length x = length a \<and> length y = length b \<and> a \<bullet> x = b \<bullet> y \<and> (\<forall>i<length a. x ! i \<le> Max (set b)) \<and> (\<forall>j<length b. y ! j \<le> Max (set a))}
[PROOF STEP]
by auto


[STATEMENT]
lemma lipschitz_on_normD:
  "norm (f x - f y) \<le> L * norm (x - y)"
  if "lipschitz_on L X f" "x \<in> X" "y \<in> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (f x - f y) \<le> L * norm (x - y)
[PROOF STEP]
using lipschitz_onD[OF that]
[PROOF STATE]
proof (prove)
using this:
dist (f x) (f y) \<le> L * dist x y

goal (1 subgoal):
 1. norm (f x - f y) \<le> L * norm (x - y)
[PROOF STEP]
by (simp add: dist_norm)


[STATEMENT]
lemma DERIV_pos_inc_right:
  fixes f :: "real \<Rightarrow> real"
  assumes der: "DERIV f x :> l"
    and l: "0 < l"
  shows "\<exists>d > 0. \<forall>h > 0. h < d \<longrightarrow> f x < f (x + h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>d>0. \<forall>h>0. h < d \<longrightarrow> f x < f (x + h)
[PROOF STEP]
using has_real_derivative_pos_inc_right[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>d>0. \<forall>h>0. x + h \<in> UNIV \<longrightarrow> h < d \<longrightarrow> f x < f (x + h)

goal (1 subgoal):
 1. \<exists>d>0. \<forall>h>0. h < d \<longrightarrow> f x < f (x + h)
[PROOF STEP]
by auto


[STATEMENT]
lemma d_IN_plus_flow:
  assumes wf: "wf_residual_network"
  and f: "flow \<Delta> f"
  and g: "flow (residual_network f) g"
  shows "d_IN (f \<oplus> g) x \<le> d_IN f x + d_IN g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d_IN (f \<oplus> g) x \<le> d_IN f x + d_IN g x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. d_IN (f \<oplus> g) x \<le> d_IN f x + d_IN g x
[PROOF STEP]
have "d_IN (f \<oplus> g) x \<le> (\<Sum>\<^sup>+ y. f (y, x) + g (y, x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d_IN (f \<oplus> g) x \<le> (\<Sum>\<^sup>+ y. f (y, x) + g (y, x))
[PROOF STEP]
unfolding d_IN_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sup>+ xa. (f \<oplus> g) (xa, x)) \<le> (\<Sum>\<^sup>+ y. f (y, x) + g (y, x))
[PROOF STEP]
by(rule nn_integral_mono)(auto intro: diff_le_self_ennreal)
[PROOF STATE]
proof (state)
this:
d_IN (f \<oplus> g) x \<le> (\<Sum>\<^sup>+ y. f (y, x) + g (y, x))

goal (1 subgoal):
 1. d_IN (f \<oplus> g) x \<le> d_IN f x + d_IN g x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
d_IN (f \<oplus> g) x \<le> (\<Sum>\<^sup>+ y. f (y, x) + g (y, x))

goal (1 subgoal):
 1. d_IN (f \<oplus> g) x \<le> d_IN f x + d_IN g x
[PROOF STEP]
have "\<dots> = d_IN f x + d_IN g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sup>+ y. f (y, x) + g (y, x)) = d_IN f x + d_IN g x
[PROOF STEP]
by(subst nn_integral_add)(simp_all add: d_IN_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sup>+ y. f (y, x) + g (y, x)) = d_IN f x + d_IN g x

goal (1 subgoal):
 1. d_IN (f \<oplus> g) x \<le> d_IN f x + d_IN g x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
d_IN (f \<oplus> g) x \<le> d_IN f x + d_IN g x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
d_IN (f \<oplus> g) x \<le> d_IN f x + d_IN g x

goal (1 subgoal):
 1. d_IN (f \<oplus> g) x \<le> d_IN f x + d_IN g x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
d_IN (f \<oplus> g) x \<le> d_IN f x + d_IN g x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma polytope_imp_convex: "polytope S \<Longrightarrow> convex S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polytope S \<Longrightarrow> convex S
[PROOF STEP]
by (metis convex_convex_hull polytope_def)


[STATEMENT]
lemma argmaxEquivalence:
  assumes "\<forall>x\<in>X. f x = g x"
  shows "argmax f X = argmax g X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. argmax f X = argmax g X
[PROOF STEP]
using assms argmaxLemma Collect_cong image_cong
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>X. f x = g x
argmax ?f ?A = {x \<in> ?A. ?f x = Max (?f ` ?A)}
(\<And>x. ?P x = ?Q x) \<Longrightarrow> {x. ?P x} = {x. ?Q x}
\<lbrakk>?M = ?N; \<And>x. x \<in> ?N \<Longrightarrow> ?f x = ?g x\<rbrakk> \<Longrightarrow> ?f ` ?M = ?g ` ?N

goal (1 subgoal):
 1. argmax f X = argmax g X
[PROOF STEP]
by (metis(no_types,lifting))


[STATEMENT]
lemma sum_index_shift: "(\<Sum>l = (a::nat)..< b. f(l+c)) = (\<Sum>l = (a+c)..< (b+c). f l )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>l = a..<b. f (l + c)) = sum f {a + c..<b + c}
[PROOF STEP]
by(induction a arbitrary: b c) (metis sum.shift_bounds_nat_ivl)+


[STATEMENT]
lemma cpx_length_of_vec_of_list [simp]:
  "\<parallel>vec_of_list l\<parallel> = sqrt(\<Sum>i<length l. (cmod (l ! i))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>vec_of_list l\<parallel> = sqrt (\<Sum>i<length l. (cmod (l ! i))\<^sup>2)
[PROOF STEP]
by (auto simp: cpx_vec_length_def vec_of_list_def vec_of_list_index)
    (metis (no_types, lifting) dim_vec_of_list sum.cong vec_of_list.abs_eq vec_of_list_index)


[STATEMENT]
lemma aff_dim_subset:
  fixes S T :: "'n::euclidean_space set"
  assumes "S \<subseteq> T"
  shows "aff_dim S \<le> aff_dim T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim S \<le> aff_dim T
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aff_dim S \<le> aff_dim T
[PROOF STEP]
obtain B where B: "\<not> affine_dependent B" "B \<subseteq> S" "affine hull B = affine hull S"
    "of_nat (card B) = aff_dim S + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>\<not> affine_dependent B; B \<subseteq> S; affine hull B = affine hull S; int (card B) = aff_dim S + 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using aff_dim_inner_basis_exists[of S]
[PROOF STATE]
proof (prove)
using this:
\<exists>B\<subseteq>S. affine hull B = affine hull S \<and> \<not> affine_dependent B \<and> int (card B) = aff_dim S + 1

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>\<not> affine_dependent B; B \<subseteq> S; affine hull B = affine hull S; int (card B) = aff_dim S + 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> affine_dependent B
B \<subseteq> S
affine hull B = affine hull S
int (card B) = aff_dim S + 1

goal (1 subgoal):
 1. aff_dim S \<le> aff_dim T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> affine_dependent B
B \<subseteq> S
affine hull B = affine hull S
int (card B) = aff_dim S + 1
[PROOF STEP]
have "int (card B) \<le> aff_dim T + 1"
[PROOF STATE]
proof (prove)
using this:
\<not> affine_dependent B
B \<subseteq> S
affine hull B = affine hull S
int (card B) = aff_dim S + 1

goal (1 subgoal):
 1. int (card B) \<le> aff_dim T + 1
[PROOF STEP]
using assms independent_card_le_aff_dim[of B T]
[PROOF STATE]
proof (prove)
using this:
\<not> affine_dependent B
B \<subseteq> S
affine hull B = affine hull S
int (card B) = aff_dim S + 1
S \<subseteq> T
\<lbrakk>B \<subseteq> T; \<not> affine_dependent B\<rbrakk> \<Longrightarrow> int (card B) \<le> aff_dim T + 1

goal (1 subgoal):
 1. int (card B) \<le> aff_dim T + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
int (card B) \<le> aff_dim T + 1

goal (1 subgoal):
 1. aff_dim S \<le> aff_dim T
[PROOF STEP]
with B
[PROOF STATE]
proof (chain)
picking this:
\<not> affine_dependent B
B \<subseteq> S
affine hull B = affine hull S
int (card B) = aff_dim S + 1
int (card B) \<le> aff_dim T + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> affine_dependent B
B \<subseteq> S
affine hull B = affine hull S
int (card B) = aff_dim S + 1
int (card B) \<le> aff_dim T + 1

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

goal:
No subgoals!
[PROOF STEP]
qed