[STATEMENT]
lemma affine_independent_card_dim_diffs:
  fixes S :: "'a :: euclidean_space set"
  assumes "\<not> affine_dependent S" "a \<in> S"
    shows "card S = dim ((\<lambda>x. x - a) ` S) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card S = dim ((\<lambda>x. x - a) ` S) + 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card S = dim ((\<lambda>x. x - a) ` S) + 1
[PROOF STEP]
have non: "\<not> affine_dependent (insert a S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> affine_dependent (insert a S)
[PROOF STEP]
by (simp add: assms insert_absorb)
[PROOF STATE]
proof (state)
this:
\<not> affine_dependent (insert a S)

goal (1 subgoal):
 1. card S = dim ((\<lambda>x. x - a) ` S) + 1
[PROOF STEP]
have "finite S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S
[PROOF STEP]
by (meson assms aff_independent_finite)
[PROOF STATE]
proof (state)
this:
finite S

goal (1 subgoal):
 1. card S = dim ((\<lambda>x. x - a) ` S) + 1
[PROOF STEP]
with \<open>a \<in> S\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<in> S
finite S
[PROOF STEP]
have "card S \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
a \<in> S
finite S

goal (1 subgoal):
 1. card S \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card S \<noteq> 0

goal (1 subgoal):
 1. card S = dim ((\<lambda>x. x - a) ` S) + 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card S \<noteq> 0

goal (1 subgoal):
 1. card S = dim ((\<lambda>x. x - a) ` S) + 1
[PROOF STEP]
have "dim ((\<lambda>x. x - a) ` S) = card S - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim ((\<lambda>x. x - a) ` S) = card S - 1
[PROOF STEP]
using aff_dim_eq_dim_subtract aff_dim_unique \<open>a \<in> S\<close> hull_inc insert_absorb non
[PROOF STATE]
proof (prove)
using this:
?a \<in> affine hull ?S \<Longrightarrow> aff_dim ?S = int (dim ((\<lambda>x. x - ?a) ` ?S))
affine hull ?B = affine hull ?V \<and> \<not> affine_dependent ?B \<Longrightarrow> int (card ?B) = aff_dim ?V + 1
a \<in> S
?x \<in> ?S \<Longrightarrow> ?x \<in> ?P hull ?S
?a \<in> ?A \<Longrightarrow> insert ?a ?A = ?A
\<not> affine_dependent (insert a S)

goal (1 subgoal):
 1. dim ((\<lambda>x. x - a) ` S) = card S - 1
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
dim ((\<lambda>x. x - a) ` S) = card S - 1

goal (1 subgoal):
 1. card S = dim ((\<lambda>x. x - a) ` S) + 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card S \<noteq> 0
dim ((\<lambda>x. x - a) ` S) = card S - 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card S \<noteq> 0
dim ((\<lambda>x. x - a) ` S) = card S - 1

goal (1 subgoal):
 1. card S = dim ((\<lambda>x. x - a) ` S) + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card S = dim ((\<lambda>x. x - a) ` S) + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gcd_mult_distrib_int: "\<bar>k\<bar> * gcd m n = gcd (k * m) (k * n)"
  for k m n :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>k\<bar> * gcd m n = gcd (k * m) (k * n)
[PROOF STEP]
by (simp add: gcd_mult_left abs_mult)


[STATEMENT]
lemma sum_2: "sum f (UNIV::2 set) = f 1 + f 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f UNIV = f 1 + f 2
[PROOF STEP]
unfolding UNIV_2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {1, 2} = f 1 + f 2
[PROOF STEP]
by simp


[STATEMENT]
lemma to_fun_minus:
  assumes "f \<in> carrier P"
  assumes "x \<in> carrier R"
  shows "to_fun (\<ominus>\<^bsub>P\<^esub>f) x = \<ominus> (to_fun f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun (\<ominus>\<^bsub>P\<^esub> f) x = \<ominus> to_fun f x
[PROOF STEP]
unfolding to_function_def to_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>s\<in>carrier R. eval R R (\<lambda>x. x) s (\<ominus>\<^bsub>P\<^esub> f)) x = \<ominus> (\<lambda>s\<in>carrier R. eval R R (\<lambda>x. x) s f) x
[PROOF STEP]
using  eval_ring_hom[of x] assms
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R \<Longrightarrow> eval R R (\<lambda>x. x) x \<in> ring_hom P R
f \<in> carrier P
x \<in> carrier R

goal (1 subgoal):
 1. (\<lambda>s\<in>carrier R. eval R R (\<lambda>x. x) s (\<ominus>\<^bsub>P\<^esub> f)) x = \<ominus> (\<lambda>s\<in>carrier R. eval R R (\<lambda>x. x) s f) x
[PROOF STEP]
by (simp add: UP_ring ring_hom_uminus)


[STATEMENT]
lemma tensor_mat_eval:
  assumes "i < d" "j < d"
  shows "tensor_mat m1 m2 $$ (i, j) = m1 $$ (encode1 i, encode1 j) * m2 $$ (encode2 i, encode2 j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tensor_mat m1 m2 $$ (i, j) = m1 $$ (encode1 i, encode1 j) * m2 $$ (encode2 i, encode2 j)
[PROOF STEP]
unfolding tensor_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat d d (\<lambda>(i, j). m1 $$ (encode1 i, encode1 j) * m2 $$ (encode2 i, encode2 j)) $$ (i, j) = m1 $$ (encode1 i, encode1 j) * m2 $$ (encode2 i, encode2 j)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < d
j < d

goal (1 subgoal):
 1. mat d d (\<lambda>(i, j). m1 $$ (encode1 i, encode1 j) * m2 $$ (encode2 i, encode2 j)) $$ (i, j) = m1 $$ (encode1 i, encode1 j) * m2 $$ (encode2 i, encode2 j)
[PROOF STEP]
by simp


[STATEMENT]
lemma ffact_add_nat:
  shows "ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)
[PROOF STEP]
have "ffact k (n + m) = fact k * ((n + m) choose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffact k (n + m) = fact k * (n + m choose k)
[PROOF STEP]
by (simp only: ffact_eq_fact_mult_binomial)
[PROOF STATE]
proof (state)
this:
ffact k (n + m) = fact k * (n + m choose k)

goal (1 subgoal):
 1. ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ffact k (n + m) = fact k * (n + m choose k)

goal (1 subgoal):
 1. ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)
[PROOF STEP]
have "\<dots> = fact k * (\<Sum>i\<le>k. (n choose i) * (m choose (k - i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact k * (n + m choose k) = fact k * (\<Sum>i\<le>k. (n choose i) * (m choose (k - i)))
[PROOF STEP]
by (simp only: vandermonde)
[PROOF STATE]
proof (state)
this:
fact k * (n + m choose k) = fact k * (\<Sum>i\<le>k. (n choose i) * (m choose (k - i)))

goal (1 subgoal):
 1. ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fact k * (n + m choose k) = fact k * (\<Sum>i\<le>k. (n choose i) * (m choose (k - i)))

goal (1 subgoal):
 1. ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)
[PROOF STEP]
have "\<dots> = (\<Sum>i\<le>k. fact k * (n choose i) * (m choose (k - i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact k * (\<Sum>i\<le>k. (n choose i) * (m choose (k - i))) = (\<Sum>i\<le>k. fact k * (n choose i) * (m choose (k - i)))
[PROOF STEP]
by (simp add: sum_distrib_left field_simps)
[PROOF STATE]
proof (state)
this:
fact k * (\<Sum>i\<le>k. (n choose i) * (m choose (k - i))) = (\<Sum>i\<le>k. fact k * (n choose i) * (m choose (k - i)))

goal (1 subgoal):
 1. ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fact k * (\<Sum>i\<le>k. (n choose i) * (m choose (k - i))) = (\<Sum>i\<le>k. fact k * (n choose i) * (m choose (k - i)))

goal (1 subgoal):
 1. ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)
[PROOF STEP]
have "\<dots> = (\<Sum>i\<le>k. (fact i * fact (k - i) * (k choose i)) * (n choose i) * (m choose (k - i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>k. fact k * (n choose i) * (m choose (k - i))) = (\<Sum>i\<le>k. fact i * fact (k - i) * (k choose i) * (n choose i) * (m choose (k - i)))
[PROOF STEP]
by (simp add: binomial_fact_lemma)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>k. fact k * (n choose i) * (m choose (k - i))) = (\<Sum>i\<le>k. fact i * fact (k - i) * (k choose i) * (n choose i) * (m choose (k - i)))

goal (1 subgoal):
 1. ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>k. fact k * (n choose i) * (m choose (k - i))) = (\<Sum>i\<le>k. fact i * fact (k - i) * (k choose i) * (n choose i) * (m choose (k - i)))

goal (1 subgoal):
 1. ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)
[PROOF STEP]
have "\<dots> = (\<Sum>i\<le>k. (k choose i) * (fact i * (n choose i)) * (fact (k - i) * (m choose (k - i))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>k. fact i * fact (k - i) * (k choose i) * (n choose i) * (m choose (k - i))) = (\<Sum>i\<le>k. (k choose i) * (fact i * (n choose i)) * (fact (k - i) * (m choose (k - i))))
[PROOF STEP]
by (auto intro: sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>k. fact i * fact (k - i) * (k choose i) * (n choose i) * (m choose (k - i))) = (\<Sum>i\<le>k. (k choose i) * (fact i * (n choose i)) * (fact (k - i) * (m choose (k - i))))

goal (1 subgoal):
 1. ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>k. fact i * fact (k - i) * (k choose i) * (n choose i) * (m choose (k - i))) = (\<Sum>i\<le>k. (k choose i) * (fact i * (n choose i)) * (fact (k - i) * (m choose (k - i))))

goal (1 subgoal):
 1. ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)
[PROOF STEP]
have "\<dots> = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>k. (k choose i) * (fact i * (n choose i)) * (fact (k - i) * (m choose (k - i)))) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)
[PROOF STEP]
by (simp only: ffact_eq_fact_mult_binomial)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>k. (k choose i) * (fact i * (n choose i)) * (fact (k - i) * (m choose (k - i)))) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)

goal (1 subgoal):
 1. ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)

goal (1 subgoal):
 1. ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ffact k (n + m) = (\<Sum>i\<le>k. (k choose i) * ffact i n * ffact (k - i) m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma explicit_subset_rel_interior_convex_hull:
  fixes S :: "'a::euclidean_space set"
  shows "finite S
         \<Longrightarrow> {y. \<exists>u. (\<forall>x \<in> S. 0 < u x \<and> u x < 1) \<and> sum u S = 1 \<and> sum (\<lambda>x. u x *\<^sub>R x) S = y}
             \<subseteq> rel_interior (convex hull S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S \<Longrightarrow> {y. \<exists>u. (\<forall>x\<in>S. 0 < u x \<and> u x < 1) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y} \<subseteq> rel_interior (convex hull S)
[PROOF STEP]
by (force simp add:  rel_interior_convex_hull_union [where S="\<lambda>x. {x}" and I=S, simplified])


[STATEMENT]
lemma equivalent_implies_exist_matrix':
  assumes equivalent: "equivalent_matrices A B"
  shows "\<exists>X Y X' Y' f::'a::{field}^'n\<Rightarrow>'a^'m.
  linear ((*s)) ((*s)) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X)
  \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')
[PROOF STEP]
obtain X::"'a^'n^'n" where X: "is_basis (set_of_vector X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X. is_basis (set_of_vector X) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using exists_basis
[PROOF STATE]
proof (prove)
using this:
\<exists>X. is_basis (set_of_vector X)

goal (1 subgoal):
 1. (\<And>X. is_basis (set_of_vector X) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
is_basis (set_of_vector X)

goal (1 subgoal):
 1. \<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')
[PROOF STEP]
obtain Y::"'a^'m^'m" where Y: "is_basis (set_of_vector Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Y. is_basis (set_of_vector Y) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using exists_basis
[PROOF STATE]
proof (prove)
using this:
\<exists>X. is_basis (set_of_vector X)

goal (1 subgoal):
 1. (\<And>Y. is_basis (set_of_vector Y) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
is_basis (set_of_vector Y)

goal (1 subgoal):
 1. \<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')
[PROOF STEP]
obtain P Q where B_PAQ: "B=(matrix_inv P)**A**Q" and inv_P: "invertible P" and inv_Q: "invertible Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P Q. \<lbrakk>B = matrix_inv P ** A ** Q; invertible P; invertible Q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using equivalent
[PROOF STATE]
proof (prove)
using this:
equivalent_matrices A B

goal (1 subgoal):
 1. (\<And>P Q. \<lbrakk>B = matrix_inv P ** A ** Q; invertible P; invertible Q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding equivalent_matrices_def
[PROOF STATE]
proof (prove)
using this:
\<exists>P Q. invertible P \<and> invertible Q \<and> B = matrix_inv P ** A ** Q

goal (1 subgoal):
 1. (\<And>P Q. \<lbrakk>B = matrix_inv P ** A ** Q; invertible P; invertible Q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B = matrix_inv P ** A ** Q
invertible P
invertible Q

goal (1 subgoal):
 1. \<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')
[PROOF STEP]
obtain f where f_A: "matrix' X Y f = A" and linear_f: "linear ((*s)) ((*s)) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>matrix' X Y f = A; linear (*s) (*s) f\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using exists_linear_eq_matrix'[OF X Y]
[PROOF STATE]
proof (prove)
using this:
\<exists>f. matrix' X Y f = ?A \<and> linear (*s) (*s) f

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>matrix' X Y f = A; linear (*s) (*s) f\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix' X Y f = A
linear (*s) (*s) f

goal (1 subgoal):
 1. \<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')
[PROOF STEP]
obtain X'::"'a^'n^'n" where X': "is_basis (set_of_vector X')" and Q:"matrix_change_of_basis X' X = Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X'. \<lbrakk>is_basis (set_of_vector X'); matrix_change_of_basis X' X = Q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using invertible_matrix_is_change_of_basis[OF inv_Q X]
[PROOF STATE]
proof (prove)
using this:
\<exists>!Y. matrix_change_of_basis Y X = Q \<and> is_basis (set_of_vector Y)

goal (1 subgoal):
 1. (\<And>X'. \<lbrakk>is_basis (set_of_vector X'); matrix_change_of_basis X' X = Q\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
is_basis (set_of_vector X')
matrix_change_of_basis X' X = Q

goal (1 subgoal):
 1. \<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')
[PROOF STEP]
obtain Y'::"'a^'m^'m" where Y': "is_basis (set_of_vector Y')" and P: "matrix_change_of_basis Y' Y = P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Y'. \<lbrakk>is_basis (set_of_vector Y'); matrix_change_of_basis Y' Y = P\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using invertible_matrix_is_change_of_basis[OF inv_P Y]
[PROOF STATE]
proof (prove)
using this:
\<exists>!Ya. matrix_change_of_basis Ya Y = P \<and> is_basis (set_of_vector Ya)

goal (1 subgoal):
 1. (\<And>Y'. \<lbrakk>is_basis (set_of_vector Y'); matrix_change_of_basis Y' Y = P\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
is_basis (set_of_vector Y')
matrix_change_of_basis Y' Y = P

goal (1 subgoal):
 1. \<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')
[PROOF STEP]
have matrix_inv_P: "matrix_change_of_basis Y Y' = matrix_inv P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis Y Y' = matrix_inv P
[PROOF STEP]
using matrix_inv_matrix_change_of_basis[OF Y' Y] P
[PROOF STATE]
proof (prove)
using this:
matrix_change_of_basis Y Y' = matrix_inv (matrix_change_of_basis Y' Y)
matrix_change_of_basis Y' Y = P

goal (1 subgoal):
 1. matrix_change_of_basis Y Y' = matrix_inv P
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis Y Y' = matrix_inv P

goal (1 subgoal):
 1. \<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')
[PROOF STEP]
have "matrix' X' Y' f = matrix_change_of_basis Y Y' ** matrix' X Y f ** matrix_change_of_basis X' X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix' X' Y' f = matrix_change_of_basis Y Y' ** matrix' X Y f ** matrix_change_of_basis X' X
[PROOF STEP]
using matrix'_matrix_change_of_basis[OF X X' Y Y' linear_f]
[PROOF STATE]
proof (prove)
using this:
matrix' X' Y' f = matrix_change_of_basis Y Y' ** matrix' X Y f ** matrix_change_of_basis X' X

goal (1 subgoal):
 1. matrix' X' Y' f = matrix_change_of_basis Y Y' ** matrix' X Y f ** matrix_change_of_basis X' X
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
matrix' X' Y' f = matrix_change_of_basis Y Y' ** matrix' X Y f ** matrix_change_of_basis X' X

goal (1 subgoal):
 1. \<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix' X' Y' f = matrix_change_of_basis Y Y' ** matrix' X Y f ** matrix_change_of_basis X' X

goal (1 subgoal):
 1. \<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')
[PROOF STEP]
have "... = (matrix_inv P) ** A ** Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis Y Y' ** matrix' X Y f ** matrix_change_of_basis X' X = matrix_inv P ** A ** Q
[PROOF STEP]
unfolding matrix_inv_P f_A Q
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_inv P ** A ** Q = matrix_inv P ** A ** Q
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis Y Y' ** matrix' X Y f ** matrix_change_of_basis X' X = matrix_inv P ** A ** Q

goal (1 subgoal):
 1. \<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis Y Y' ** matrix' X Y f ** matrix_change_of_basis X' X = matrix_inv P ** A ** Q

goal (1 subgoal):
 1. \<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')
[PROOF STEP]
have "... = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_inv P ** A ** Q = B
[PROOF STEP]
using B_PAQ
[PROOF STATE]
proof (prove)
using this:
B = matrix_inv P ** A ** Q

goal (1 subgoal):
 1. matrix_inv P ** A ** Q = B
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
matrix_inv P ** A ** Q = B

goal (1 subgoal):
 1. \<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
matrix' X' Y' f = B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
matrix' X' Y' f = B

goal (1 subgoal):
 1. \<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')
[PROOF STEP]
using f_A X X' Y Y' linear_f
[PROOF STATE]
proof (prove)
using this:
matrix' X' Y' f = B
matrix' X Y f = A
is_basis (set_of_vector X)
is_basis (set_of_vector X')
is_basis (set_of_vector Y)
is_basis (set_of_vector Y')
linear (*s) (*s) f

goal (1 subgoal):
 1. \<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
\<exists>X Y X' Y' f. linear (*s) (*s) f \<and> matrix' X Y f = A \<and> matrix' X' Y' f = B \<and> is_basis (set_of_vector X) \<and> is_basis (set_of_vector Y) \<and> is_basis (set_of_vector X') \<and> is_basis (set_of_vector Y')

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rel_fun_conversep_grp_grp:
  "rel_fun (conversep (BNF_Def.Grp UNIV f)) (BNF_Def.Grp B g) = BNF_Def.Grp {x. (x \<circ> f) ` UNIV \<subseteq> B} (map_fun f g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (BNF_Def.Grp UNIV f)\<inverse>\<inverse> ===> BNF_Def.Grp B g = BNF_Def.Grp {x. range (x \<circ> f) \<subseteq> B} (f ---> g)
[PROOF STEP]
unfolding rel_fun_def Grp_def simp_thms fun_eq_iff conversep_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x xa. (\<forall>xb y. xb = f y \<and> y \<in> UNIV \<longrightarrow> xa y = g (x xb) \<and> x xb \<in> B) = ((\<forall>xb. xa xb = (f ---> g) x xb) \<and> x \<in> {x. range (x \<circ> f) \<subseteq> B})
[PROOF STEP]
by auto


[STATEMENT]
lemma lead_coeff_monic_mult:
  fixes p :: "'a :: {comm_semiring_1,semiring_no_zero_divisors} poly"
  assumes "monic p" shows "lead_coeff (p * q) = lead_coeff q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (p * q) = lead_coeff q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
monic p

goal (1 subgoal):
 1. lead_coeff (p * q) = lead_coeff q
[PROOF STEP]
by (simp add: lead_coeff_mult)


[STATEMENT]
lemma onorm_triangle_le:
  assumes "bounded_linear f"
  assumes "bounded_linear g"
  assumes "onorm f + onorm g \<le> e"
  shows "onorm (\<lambda>x. f x + g x) \<le> e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>x. f x + g x) \<le> e
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bounded_linear f
bounded_linear g
onorm f + onorm g \<le> e

goal (1 subgoal):
 1. onorm (\<lambda>x. f x + g x) \<le> e
[PROOF STEP]
by (rule onorm_triangle [THEN order_trans])


[STATEMENT]
lemma nat_lemma2: "\<lbrakk> b = m*(n::nat) + t; a = s*n + u; t=u; b-a < n \<rbrakk> \<Longrightarrow> m \<le> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b = m * n + t; a = s * n + u; t = u; b - a < n\<rbrakk> \<Longrightarrow> m \<le> s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>b = m * n + t; a = s * n + u; t = u; b - a < n\<rbrakk> \<Longrightarrow> m \<le> s
[PROOF STEP]
assume "b = m*(n::nat) + t" "a = s*n + u" "t=u"
[PROOF STATE]
proof (state)
this:
b = m * n + t
a = s * n + u
t = u

goal (1 subgoal):
 1. \<lbrakk>b = m * n + t; a = s * n + u; t = u; b - a < n\<rbrakk> \<Longrightarrow> m \<le> s
[PROOF STEP]
hence "(m - s) * n = b - a"
[PROOF STATE]
proof (prove)
using this:
b = m * n + t
a = s * n + u
t = u

goal (1 subgoal):
 1. (m - s) * n = b - a
[PROOF STEP]
by (simp add: diff_mult_distrib)
[PROOF STATE]
proof (state)
this:
(m - s) * n = b - a

goal (1 subgoal):
 1. \<lbrakk>b = m * n + t; a = s * n + u; t = u; b - a < n\<rbrakk> \<Longrightarrow> m \<le> s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(m - s) * n = b - a

goal (1 subgoal):
 1. \<lbrakk>b = m * n + t; a = s * n + u; t = u; b - a < n\<rbrakk> \<Longrightarrow> m \<le> s
[PROOF STEP]
assume "\<dots> < n"
[PROOF STATE]
proof (state)
this:
b - a < n

goal (1 subgoal):
 1. \<lbrakk>b = m * n + t; a = s * n + u; t = u; b - a < n\<rbrakk> \<Longrightarrow> m \<le> s
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(m - s) * n < n
[PROOF STEP]
have "m - s < 1"
[PROOF STATE]
proof (prove)
using this:
(m - s) * n < n

goal (1 subgoal):
 1. m - s < 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m - s < 1

goal (1 subgoal):
 1. \<lbrakk>b = m * n + t; a = s * n + u; t = u; b - a < n\<rbrakk> \<Longrightarrow> m \<le> s
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
m - s < 1

goal (1 subgoal):
 1. m \<le> s
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
m \<le> s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linorder_rank_union:
  assumes "finite A" "finite B" "A \<inter> B = {}"
  shows   "linorder_rank R (A \<union> B) x = linorder_rank R A x + linorder_rank R B x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linorder_rank R (A \<union> B) x = linorder_rank R A x + linorder_rank R B x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. linorder_rank R (A \<union> B) x = linorder_rank R A x + linorder_rank R B x
[PROOF STEP]
have "linorder_rank R (A \<union> B) x = card {y\<in>(A\<union>B)-{x}. (y,x) \<in> R}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linorder_rank R (A \<union> B) x = card {y \<in> A \<union> B - {x}. (y, x) \<in> R}
[PROOF STEP]
by (simp add: linorder_rank_def)
[PROOF STATE]
proof (state)
this:
linorder_rank R (A \<union> B) x = card {y \<in> A \<union> B - {x}. (y, x) \<in> R}

goal (1 subgoal):
 1. linorder_rank R (A \<union> B) x = linorder_rank R A x + linorder_rank R B x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
linorder_rank R (A \<union> B) x = card {y \<in> A \<union> B - {x}. (y, x) \<in> R}

goal (1 subgoal):
 1. linorder_rank R (A \<union> B) x = linorder_rank R A x + linorder_rank R B x
[PROOF STEP]
have "{y\<in>(A\<union>B)-{x}. (y,x) \<in> R} = {y\<in>A-{x}. (y,x) \<in> R} \<union> {y\<in>B-{x}. (y,x) \<in> R}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y \<in> A \<union> B - {x}. (y, x) \<in> R} = {y \<in> A - {x}. (y, x) \<in> R} \<union> {y \<in> B - {x}. (y, x) \<in> R}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{y \<in> A \<union> B - {x}. (y, x) \<in> R} = {y \<in> A - {x}. (y, x) \<in> R} \<union> {y \<in> B - {x}. (y, x) \<in> R}

goal (1 subgoal):
 1. linorder_rank R (A \<union> B) x = linorder_rank R A x + linorder_rank R B x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{y \<in> A \<union> B - {x}. (y, x) \<in> R} = {y \<in> A - {x}. (y, x) \<in> R} \<union> {y \<in> B - {x}. (y, x) \<in> R}

goal (1 subgoal):
 1. linorder_rank R (A \<union> B) x = linorder_rank R A x + linorder_rank R B x
[PROOF STEP]
have "card \<dots> = linorder_rank R A x + linorder_rank R B x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({y \<in> A - {x}. (y, x) \<in> R} \<union> {y \<in> B - {x}. (y, x) \<in> R}) = linorder_rank R A x + linorder_rank R B x
[PROOF STEP]
unfolding linorder_rank_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({y \<in> A - {x}. (y, x) \<in> R} \<union> {y \<in> B - {x}. (y, x) \<in> R}) = card {y \<in> A - {x}. (y, x) \<in> R} + card {y \<in> B - {x}. (y, x) \<in> R}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
A \<inter> B = {}

goal (1 subgoal):
 1. card ({y \<in> A - {x}. (y, x) \<in> R} \<union> {y \<in> B - {x}. (y, x) \<in> R}) = card {y \<in> A - {x}. (y, x) \<in> R} + card {y \<in> B - {x}. (y, x) \<in> R}
[PROOF STEP]
by (intro card_Un_disjoint) auto
[PROOF STATE]
proof (state)
this:
card ({y \<in> A - {x}. (y, x) \<in> R} \<union> {y \<in> B - {x}. (y, x) \<in> R}) = linorder_rank R A x + linorder_rank R B x

goal (1 subgoal):
 1. linorder_rank R (A \<union> B) x = linorder_rank R A x + linorder_rank R B x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
linorder_rank R (A \<union> B) x = linorder_rank R A x + linorder_rank R B x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
linorder_rank R (A \<union> B) x = linorder_rank R A x + linorder_rank R B x

goal (1 subgoal):
 1. linorder_rank R (A \<union> B) x = linorder_rank R A x + linorder_rank R B x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
linorder_rank R (A \<union> B) x = linorder_rank R A x + linorder_rank R B x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma MAX_SET_ELIM':
  fixes P Q
  assumes "finite P" "P \<noteq> {}" "(\<forall>x. (\<forall>y. y \<in> P \<longrightarrow> y \<le> x) \<and> x \<in> P \<longrightarrow> R x)"
  shows "R (Max P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R (Max P)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite P
P \<noteq> {}
\<forall>x. (\<forall>y. y \<in> P \<longrightarrow> y \<le> x) \<and> x \<in> P \<longrightarrow> R x

goal (1 subgoal):
 1. R (Max P)
[PROOF STEP]
by force

\<comment> \<open>NOTE added lemma.\<close>
\<comment> \<open>NOTE adapted from pred\_setScript.sml:4895 (premise `finite P` was added).\<close>


[STATEMENT]
lemma Gen_Shleg_altdef:
  assumes "k \<le> n"
  shows   "Gen_Shleg k x = (\<Sum>i\<le>k. (-1)^(k-i) * of_nat (k choose i) *
                            of_int (pochhammer (n-i+1) i * pochhammer (n-k+i+1) (k-i)) *
                            x ^ (n - i) * (1 - x) ^ (n-k+i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.Gen_Shleg k x = (\<Sum>i\<le>k. (- 1) ^ (k - i) * real (k choose i) * real_of_int (int (pochhammer (n - i + 1) i * pochhammer (n - k + i + 1) (k - i))) * x ^ (n - i) * (1 - x) ^ (n - k + i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k \<le> n

goal (1 subgoal):
 1. local.Gen_Shleg k x = (\<Sum>i\<le>k. (- 1) ^ (k - i) * real (k choose i) * real_of_int (int (pochhammer (n - i + 1) i * pochhammer (n - k + i + 1) (k - i))) * x ^ (n - i) * (1 - x) ^ (n - k + i))
[PROOF STEP]
by (simp add: Gen_Shleg_def gen_shleg_poly_altdef poly_sum mult_ac)


[STATEMENT]
theorem p29: "\<exists>x. F(x) \<Longrightarrow> \<exists>x. G(x) \<Longrightarrow>
  ((\<forall>x. F(x) \<longrightarrow> H(x)) \<and> (\<forall>x. G(x) \<longrightarrow> J(x))) \<longleftrightarrow>
  (\<forall>x y. F(x) \<and> G(y) \<longrightarrow> H(x) \<and> J(y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. F x; \<exists>x. G x\<rbrakk> \<Longrightarrow> ((\<forall>x. F x \<longrightarrow> H x) \<and> (\<forall>x. G x \<longrightarrow> J x)) = (\<forall>x y. F x \<and> G y \<longrightarrow> H x \<and> J y)
[PROOF STEP]
@proof
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. F x; \<exists>x. G x\<rbrakk> \<Longrightarrow> ((\<forall>x. F x \<longrightarrow> H x) \<and> (\<forall>x. G x \<longrightarrow> J x)) = (\<forall>x y. F x \<and> G y \<longrightarrow> H x \<and> J y)
[PROOF STEP]
@obtain a b where "F(a)" "G(b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. F x; \<exists>x. G x\<rbrakk> \<Longrightarrow> ((\<forall>x. F x \<longrightarrow> H x) \<and> (\<forall>x. G x \<longrightarrow> J x)) = (\<forall>x y. F x \<and> G y \<longrightarrow> H x \<and> J y)
[PROOF STEP]
@case "\<forall>x y. F(x) \<and> G(y) \<longrightarrow> H(x) \<and> J(y)" @with
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. F x; \<exists>x. G x\<rbrakk> \<Longrightarrow> ((\<forall>x. F x \<longrightarrow> H x) \<and> (\<forall>x. G x \<longrightarrow> J x)) = (\<forall>x y. F x \<and> G y \<longrightarrow> H x \<and> J y)
[PROOF STEP]
@have "\<forall>x. F(x) \<longrightarrow> H(x)" @with
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. F x; \<exists>x. G x\<rbrakk> \<Longrightarrow> ((\<forall>x. F x \<longrightarrow> H x) \<and> (\<forall>x. G x \<longrightarrow> J x)) = (\<forall>x y. F x \<and> G y \<longrightarrow> H x \<and> J y)
[PROOF STEP]
@have "F(x) \<and> G(b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. F x; \<exists>x. G x\<rbrakk> \<Longrightarrow> ((\<forall>x. F x \<longrightarrow> H x) \<and> (\<forall>x. G x \<longrightarrow> J x)) = (\<forall>x y. F x \<and> G y \<longrightarrow> H x \<and> J y)
[PROOF STEP]
@end
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. F x; \<exists>x. G x\<rbrakk> \<Longrightarrow> ((\<forall>x. F x \<longrightarrow> H x) \<and> (\<forall>x. G x \<longrightarrow> J x)) = (\<forall>x y. F x \<and> G y \<longrightarrow> H x \<and> J y)
[PROOF STEP]
@have "\<forall>y. G(y) \<longrightarrow> J(y)" @with
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. F x; \<exists>x. G x\<rbrakk> \<Longrightarrow> ((\<forall>x. F x \<longrightarrow> H x) \<and> (\<forall>x. G x \<longrightarrow> J x)) = (\<forall>x y. F x \<and> G y \<longrightarrow> H x \<and> J y)
[PROOF STEP]
@have "F(a) \<and> G(y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. F x; \<exists>x. G x\<rbrakk> \<Longrightarrow> ((\<forall>x. F x \<longrightarrow> H x) \<and> (\<forall>x. G x \<longrightarrow> J x)) = (\<forall>x y. F x \<and> G y \<longrightarrow> H x \<and> J y)
[PROOF STEP]
@end
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. F x; \<exists>x. G x\<rbrakk> \<Longrightarrow> ((\<forall>x. F x \<longrightarrow> H x) \<and> (\<forall>x. G x \<longrightarrow> J x)) = (\<forall>x y. F x \<and> G y \<longrightarrow> H x \<and> J y)
[PROOF STEP]
@end
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. F x; \<exists>x. G x\<rbrakk> \<Longrightarrow> ((\<forall>x. F x \<longrightarrow> H x) \<and> (\<forall>x. G x \<longrightarrow> J x)) = (\<forall>x y. F x \<and> G y \<longrightarrow> H x \<and> J y)
[PROOF STEP]
@qed


[STATEMENT]
lemma birkhoff_sum_of_invariants:
  fixes f::" _ \<Rightarrow> real"
  assumes "f \<in> borel_measurable Invariants" "x \<in> space M"
  shows "birkhoff_sum f n x = n * f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. birkhoff_sum f n x = real n * f x
[PROOF STEP]
unfolding birkhoff_sum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. f ((T ^^ i) x)) = real n * f x
[PROOF STEP]
using Invariants_func_is_invariant_n[OF assms]
[PROOF STATE]
proof (prove)
using this:
f ((T ^^ ?n) x) = f x

goal (1 subgoal):
 1. (\<Sum>i<n. f ((T ^^ i) x)) = real n * f x
[PROOF STEP]
by auto


[STATEMENT]
lemma M1_mult_ket_k:
  assumes "k < R"
  shows "M1 *\<^sub>v ket_k k = ket_k k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M1 *\<^sub>v ket_k k = ket_k k
[PROOF STEP]
apply (rule eq_vecI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (ket_k k) \<Longrightarrow> (M1 *\<^sub>v ket_k k) $ i = ket_k k $ i
 2. dim_vec (M1 *\<^sub>v ket_k k) = dim_vec (ket_k k)
[PROOF STEP]
unfolding M1_def ket_k_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (Matrix.vec K (\<lambda>ka. if ka = k then 1 else 0)) \<Longrightarrow> (mat K K (\<lambda>(i, j). if i = j \<and> i < R then 1 else 0) *\<^sub>v Matrix.vec K (\<lambda>ka. if ka = k then 1 else 0)) $ i = Matrix.vec K (\<lambda>ka. if ka = k then 1 else 0) $ i
 2. dim_vec (mat K K (\<lambda>(i, j). if i = j \<and> i < R then 1 else 0) *\<^sub>v Matrix.vec K (\<lambda>ka. if ka = k then 1 else 0)) = dim_vec (Matrix.vec K (\<lambda>ka. if ka = k then 1 else 0))
[PROOF STEP]
by (auto simp add: scalar_prod_def assms R sum_only_one_neq_0)


[STATEMENT]
lemma set_integral_mono:
  fixes f g :: "_ \<Rightarrow> real"
  assumes "set_integrable M A f" "set_integrable M A g"
    "\<And>x. x \<in> A \<Longrightarrow> f x \<le> g x"
  shows "(LINT x:A|M. f x) \<le> (LINT x:A|M. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_lebesgue_integral M A f \<le> set_lebesgue_integral M A g
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set_integrable M A f
set_integrable M A g
?x \<in> A \<Longrightarrow> f ?x \<le> g ?x

goal (1 subgoal):
 1. set_lebesgue_integral M A f \<le> set_lebesgue_integral M A g
[PROOF STEP]
unfolding set_integrable_def set_lebesgue_integral_def
[PROOF STATE]
proof (prove)
using this:
integrable M (\<lambda>x. indicat_real A x *\<^sub>R f x)
integrable M (\<lambda>x. indicat_real A x *\<^sub>R g x)
?x \<in> A \<Longrightarrow> f ?x \<le> g ?x

goal (1 subgoal):
 1. LINT x|M. indicat_real A x *\<^sub>R f x \<le> LINT x|M. indicat_real A x *\<^sub>R g x
[PROOF STEP]
by (auto intro: integral_mono split: split_indicator)


[STATEMENT]
lemma cos_pi_half [simp]: "cos (pi/2) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (pi / 2) = 0
[PROOF STEP]
by (simp add: pi_half cos_is_zero [THEN theI'])


[STATEMENT]
lemma eq_diff_left_iff: "\<lbrakk> (m::nat) \<le> k; n \<le> k\<rbrakk> \<Longrightarrow> (k - m = k - n) = (m = n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<le> k; n \<le> k\<rbrakk> \<Longrightarrow> (k - m = k - n) = (m = n)
[PROOF STEP]
by (safe, simp_all)


[STATEMENT]
lemma card_arcs: "card (arcs H) = card (arcs G) + 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (arcs H) = card (arcs G) + 2
[PROOF STEP]
unfolding arcs_H
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({uw, rev_H uw, vw, rev_H vw} \<union> arcs G - {uv, rev_G uv}) = card (arcs G) + 2
[PROOF STEP]
using not_in_arcs_G subdiv_distinct_arcs in_arcs_G
[PROOF STATE]
proof (prove)
using this:
{uw, rev_H uw, vw, rev_H vw} \<inter> arcs G = {}
distinct [uv, rev_G uv, uw, rev_H uw, vw, rev_H vw]
{uv, rev_G uv} \<subseteq> arcs G

goal (1 subgoal):
 1. card ({uw, rev_H uw, vw, rev_H vw} \<union> arcs G - {uv, rev_G uv}) = card (arcs G) + 2
[PROOF STEP]
by (auto simp: card_insert_if)


[STATEMENT]
lemma prodinf_exp_real:
  fixes f :: "nat \<Rightarrow> real"
  assumes f: "convergent_prod f" and 0: "\<And>x. f x > 0"
  shows "prodinf f = exp (suminf (\<lambda>i. ln (f i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prodinf f = exp (\<Sum>i. ln (f i))
[PROOF STEP]
by (simp add: "0" f less_0_prodinf suminf_ln_real)


[STATEMENT]
lemma (in monoid) nat_pow_comm:
  "x \<in> carrier G \<Longrightarrow> (x [^] (n::nat)) \<otimes> (x [^] (m :: nat)) = (x [^] m) \<otimes> (x [^] n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier G \<Longrightarrow> x [^] n \<otimes> x [^] m = x [^] m \<otimes> x [^] n
[PROOF STEP]
using nat_pow_mult[of x n m] nat_pow_mult[of x m n]
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier G \<Longrightarrow> x [^] n \<otimes> x [^] m = x [^] (n + m)
x \<in> carrier G \<Longrightarrow> x [^] m \<otimes> x [^] n = x [^] (m + n)

goal (1 subgoal):
 1. x \<in> carrier G \<Longrightarrow> x [^] n \<otimes> x [^] m = x [^] m \<otimes> x [^] n
[PROOF STEP]
by (simp add: add.commute)


[STATEMENT]
lemma n_choose_2_nat:
  fixes n :: nat shows "(n choose 2) = (n * (n - 1)) div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose 2 = n * (n - 1) div 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n choose 2 = n * (n - 1) div 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose 2 = n * (n - 1) div 2
[PROOF STEP]
proof (cases "2 \<le> n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
 2. \<not> 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
2 \<le> n

goal (2 subgoals):
 1. 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
 2. \<not> 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 \<le> n
[PROOF STEP]
obtain m where "n = Suc (Suc m)"
[PROOF STATE]
proof (prove)
using this:
2 \<le> n

goal (1 subgoal):
 1. (\<And>m. n = Suc (Suc m) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis add_Suc le_Suc_ex numeral_2_eq_2)
[PROOF STATE]
proof (state)
this:
n = Suc (Suc m)

goal (2 subgoals):
 1. 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
 2. \<not> 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
n = Suc (Suc m)

goal (2 subgoals):
 1. 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
 2. \<not> 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
[PROOF STEP]
have "(n choose 2) = (fact n div fact (n - 2)) div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose 2 = fact n div fact (n - 2) div 2
[PROOF STEP]
using \<open>2 \<le> n\<close>
[PROOF STATE]
proof (prove)
using this:
2 \<le> n

goal (1 subgoal):
 1. n choose 2 = fact n div fact (n - 2) div 2
[PROOF STEP]
by (simp add: binomial_altdef_nat
        div_mult2_eq[symmetric] mult.commute numeral_2_eq_2)
[PROOF STATE]
proof (state)
this:
n choose 2 = fact n div fact (n - 2) div 2

goal (2 subgoals):
 1. 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
 2. \<not> 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
n = Suc (Suc m)
n choose 2 = fact n div fact (n - 2) div 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n = Suc (Suc m)
n choose 2 = fact n div fact (n - 2) div 2

goal (1 subgoal):
 1. n choose 2 = n * (n - 1) div 2
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
n choose 2 = n * (n - 1) div 2

goal (1 subgoal):
 1. \<not> 2 \<le> n \<Longrightarrow> n choose 2 = n * (n - 1) div 2
[PROOF STEP]
qed (auto simp: binomial_eq_0)
[PROOF STATE]
proof (state)
this:
n choose 2 = n * (n - 1) div 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exp_suminf_prodinf_real:
  fixes f :: "nat \<Rightarrow> real"
  assumes ge0:"\<And>n. f n \<ge> 0" and ac: "abs_convergent_prod (\<lambda>n. exp (f n))"
  shows "prodinf (\<lambda>i. exp (f i)) = exp (suminf f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i. exp (f i)) = exp (suminf f)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Prod>i. exp (f i)) = exp (suminf f)
[PROOF STEP]
have "summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f
[PROOF STEP]
using ac
[PROOF STATE]
proof (prove)
using this:
abs_convergent_prod (\<lambda>n. exp (f n))

goal (1 subgoal):
 1. summable f
[PROOF STEP]
unfolding abs_convergent_prod_conv_summable
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>i. norm (exp (f i) - 1))

goal (1 subgoal):
 1. summable f
[PROOF STEP]
proof (elim summable_comparison_test')
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. ?N1 \<le> n \<Longrightarrow> norm (f n) \<le> norm (exp (f n) - 1)
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. ?N1 \<le> n \<Longrightarrow> norm (f n) \<le> norm (exp (f n) - 1)
[PROOF STEP]
have "\<bar>f n\<bar> = f n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>f n\<bar> = f n
[PROOF STEP]
by (simp add: ge0)
[PROOF STATE]
proof (state)
this:
\<bar>f n\<bar> = f n

goal (1 subgoal):
 1. \<And>n. ?N1 \<le> n \<Longrightarrow> norm (f n) \<le> norm (exp (f n) - 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>f n\<bar> = f n

goal (1 subgoal):
 1. \<And>n. ?N1 \<le> n \<Longrightarrow> norm (f n) \<le> norm (exp (f n) - 1)
[PROOF STEP]
have "\<dots> \<le> exp (f n) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f n \<le> exp (f n) - 1
[PROOF STEP]
by (metis diff_diff_add exp_ge_add_one_self ge_iff_diff_ge_0)
[PROOF STATE]
proof (state)
this:
f n \<le> exp (f n) - 1

goal (1 subgoal):
 1. \<And>n. ?N1 \<le> n \<Longrightarrow> norm (f n) \<le> norm (exp (f n) - 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>f n\<bar> \<le> exp (f n) - 1
[PROOF STEP]
show "norm (f n) \<le> norm (exp (f n) - 1)"
[PROOF STATE]
proof (prove)
using this:
\<bar>f n\<bar> \<le> exp (f n) - 1

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
summable f

goal (1 subgoal):
 1. (\<Prod>i. exp (f i)) = exp (suminf f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
summable f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
summable f

goal (1 subgoal):
 1. (\<Prod>i. exp (f i)) = exp (suminf f)
[PROOF STEP]
by (simp add: prodinf_exp)
[PROOF STATE]
proof (state)
this:
(\<Prod>i. exp (f i)) = exp (suminf f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_closed_Union:
  assumes "finite I"
    "\<And>i. i \<in> I \<Longrightarrow> closed (U i)"
    "\<And>i. i \<in> I \<Longrightarrow> continuous_on (U i) f"
  shows "continuous_on (\<Union> i \<in> I. U i) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (\<Union> (U ` I)) f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite I
?i \<in> I \<Longrightarrow> closed (U ?i)
?i \<in> I \<Longrightarrow> continuous_on (U ?i) f

goal (1 subgoal):
 1. continuous_on (\<Union> (U ` I)) f
[PROOF STEP]
by (induction I) (auto intro!: continuous_on_closed_Un)


[STATEMENT]
lemma card_sumset_iterated_minusset:
  "card (sumset_iterated (minusset A) k) = card (sumset_iterated A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (sumset_iterated (minusset A) k) = card (sumset_iterated A k)
[PROOF STEP]
by (metis card_minusset' minusset_iterated_minusset sumset_iterated_subset_carrier)


[STATEMENT]
lemma pm_of_poly_plus: "pm_of_poly x (p + q) = pm_of_poly x p + pm_of_poly x q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pm_of_poly x (p + q) = pm_of_poly x p + pm_of_poly x q
[PROOF STEP]
by (rule poly_mapping_eqI) (simp add: pm_of_poly.rep_eq lookup_add when_add_distrib)


[STATEMENT]
lemma complex_roots_complex_prod [simp]:
  assumes "f \<noteq> 0" "g \<noteq> 0"
  shows  "mset (complex_roots_complex (f * g))
        = mset (complex_roots_complex f) + mset (complex_roots_complex g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (complex_roots_complex (f * g)) = mset (complex_roots_complex f) + mset (complex_roots_complex g)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mset (complex_roots_complex (f * g)) = mset (complex_roots_complex f) + mset (complex_roots_complex g)
[PROOF STEP]
let ?p = "f * g"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mset (complex_roots_complex (f * g)) = mset (complex_roots_complex f) + mset (complex_roots_complex g)
[PROOF STEP]
let "?lc v" = "(lead_coeff (v:: complex poly))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mset (complex_roots_complex (f * g)) = mset (complex_roots_complex f) + mset (complex_roots_complex g)
[PROOF STEP]
have nonzero_prod:"?lc ?p \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (f * g) \<noteq> 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<noteq> 0
g \<noteq> 0

goal (1 subgoal):
 1. lead_coeff (f * g) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lead_coeff (f * g) \<noteq> 0

goal (1 subgoal):
 1. mset (complex_roots_complex (f * g)) = mset (complex_roots_complex f) + mset (complex_roots_complex g)
[PROOF STEP]
from reconstruct_prod[of "?lc f" "complex_roots_complex f" "?lc g" "complex_roots_complex g"]
[PROOF STATE]
proof (chain)
picking this:
reconstruct_poly (lead_coeff f) (complex_roots_complex f) * reconstruct_poly (lead_coeff g) (complex_roots_complex g) = reconstruct_poly (lead_coeff f * lead_coeff g) (complex_roots_complex f @ complex_roots_complex g)
[PROOF STEP]
have "reconstruct_poly (?lc ?p) (complex_roots_complex ?p)
       = reconstruct_poly (?lc ?p) (complex_roots_complex f @ complex_roots_complex g)"
[PROOF STATE]
proof (prove)
using this:
reconstruct_poly (lead_coeff f) (complex_roots_complex f) * reconstruct_poly (lead_coeff g) (complex_roots_complex g) = reconstruct_poly (lead_coeff f * lead_coeff g) (complex_roots_complex f @ complex_roots_complex g)

goal (1 subgoal):
 1. reconstruct_poly (lead_coeff (f * g)) (complex_roots_complex (f * g)) = reconstruct_poly (lead_coeff (f * g)) (complex_roots_complex f @ complex_roots_complex g)
[PROOF STEP]
unfolding lead_coeff_mult[symmetric] reconstruct_is_original_poly
[PROOF STATE]
proof (prove)
using this:
f * g = reconstruct_poly (lead_coeff (f * g)) (complex_roots_complex f @ complex_roots_complex g)

goal (1 subgoal):
 1. f * g = reconstruct_poly (lead_coeff (f * g)) (complex_roots_complex f @ complex_roots_complex g)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
reconstruct_poly (lead_coeff (f * g)) (complex_roots_complex (f * g)) = reconstruct_poly (lead_coeff (f * g)) (complex_roots_complex f @ complex_roots_complex g)

goal (1 subgoal):
 1. mset (complex_roots_complex (f * g)) = mset (complex_roots_complex f) + mset (complex_roots_complex g)
[PROOF STEP]
from reconstruct_poly_defines_mset_of_argument[OF nonzero_prod this]
[PROOF STATE]
proof (chain)
picking this:
mset (complex_roots_complex (f * g)) = mset (complex_roots_complex f @ complex_roots_complex g)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mset (complex_roots_complex (f * g)) = mset (complex_roots_complex f @ complex_roots_complex g)

goal (1 subgoal):
 1. mset (complex_roots_complex (f * g)) = mset (complex_roots_complex f) + mset (complex_roots_complex g)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mset (complex_roots_complex (f * g)) = mset (complex_roots_complex f) + mset (complex_roots_complex g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma of_nat_powr_neq_1_complex [simp]:
  assumes "n > 1" "Re s \<noteq> 0"
  shows   "of_nat n powr s \<noteq> (1::complex)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat n powr s \<noteq> 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_nat n powr s \<noteq> 1
[PROOF STEP]
have "norm (of_nat n powr s) = real n powr Re s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (of_nat n powr s) = real n powr Re s
[PROOF STEP]
by (simp add: norm_powr_real_powr)
[PROOF STATE]
proof (state)
this:
cmod (of_nat n powr s) = real n powr Re s

goal (1 subgoal):
 1. of_nat n powr s \<noteq> 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (of_nat n powr s) = real n powr Re s

goal (1 subgoal):
 1. of_nat n powr s \<noteq> 1
[PROOF STEP]
have "\<dots> \<noteq> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n powr Re s \<noteq> 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < n
Re s \<noteq> 0

goal (1 subgoal):
 1. real n powr Re s \<noteq> 1
[PROOF STEP]
by (auto simp: powr_def)
[PROOF STATE]
proof (state)
this:
real n powr Re s \<noteq> 1

goal (1 subgoal):
 1. of_nat n powr s \<noteq> 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (of_nat n powr s) \<noteq> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cmod (of_nat n powr s) \<noteq> 1

goal (1 subgoal):
 1. of_nat n powr s \<noteq> 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_nat n powr s \<noteq> 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_mset_Abs_multiset:
  assumes "finite {x. f x > 0}"
  shows "set_mset (Abs_multiset f) = {x. f x > 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_mset (Abs_multiset f) = {x. 0 < f x}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite {x. 0 < f x}

goal (1 subgoal):
 1. set_mset (Abs_multiset f) = {x. 0 < f x}
[PROOF STEP]
unfolding set_mset_def
[PROOF STATE]
proof (prove)
using this:
finite {x. 0 < f x}

goal (1 subgoal):
 1. {x. 0 < count (Abs_multiset f) x} = {x. 0 < f x}
[PROOF STEP]
by simp


[STATEMENT]
lemma finite_insert_card :
  assumes "finite (\<Union>SS)"
  and     "finite S"
  and     "S \<inter> (\<Union>SS) = {}"
shows "card (\<Union> (insert S SS)) = card (\<Union>SS) + card S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (\<Union> (insert S SS)) = card (\<Union> SS) + card S
[PROOF STEP]
by (simp add: assms(1) assms(2) assms(3) card_Un_disjoint)


[STATEMENT]
lemma "((x::int) + y) ^ 3 = x ^ 3 + y ^ 3 + 3 * x ^ 2 * y + 3 * y ^ 2 * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y) ^ 3 = x ^ 3 + y ^ 3 + 3 * x\<^sup>2 * y + 3 * y\<^sup>2 * x
[PROOF STEP]
by ring


[STATEMENT]
lemma arccos_lt_bounded:
  assumes "- 1 < y" "y < 1"
  shows  "0 < arccos y \<and> arccos y < pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < arccos y \<and> arccos y < pi
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < arccos y \<and> arccos y < pi
[PROOF STEP]
have "arccos y \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arccos y \<noteq> 0
[PROOF STEP]
by (metis (no_types) arccos assms(1) assms(2) cos_zero less_eq_real_def less_irrefl)
[PROOF STATE]
proof (state)
this:
arccos y \<noteq> 0

goal (1 subgoal):
 1. 0 < arccos y \<and> arccos y < pi
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
arccos y \<noteq> 0

goal (1 subgoal):
 1. 0 < arccos y \<and> arccos y < pi
[PROOF STEP]
have "arccos y \<noteq> -pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arccos y \<noteq> - pi
[PROOF STEP]
by (metis arccos assms(1) assms(2) cos_minus cos_pi not_less not_less_iff_gr_or_eq)
[PROOF STATE]
proof (state)
this:
arccos y \<noteq> - pi

goal (1 subgoal):
 1. 0 < arccos y \<and> arccos y < pi
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
arccos y \<noteq> 0
arccos y \<noteq> - pi
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
arccos y \<noteq> 0
arccos y \<noteq> - pi

goal (1 subgoal):
 1. 0 < arccos y \<and> arccos y < pi
[PROOF STEP]
using arccos_bounded [of y] assms
[PROOF STATE]
proof (prove)
using this:
arccos y \<noteq> 0
arccos y \<noteq> - pi
\<lbrakk>- 1 \<le> y; y \<le> 1\<rbrakk> \<Longrightarrow> 0 \<le> arccos y \<and> arccos y \<le> pi
- 1 < y
y < 1

goal (1 subgoal):
 1. 0 < arccos y \<and> arccos y < pi
[PROOF STEP]
by (metis arccos cos_pi not_less not_less_iff_gr_or_eq)
[PROOF STATE]
proof (state)
this:
0 < arccos y \<and> arccos y < pi

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma onorm_cinner_left:
  assumes "bounded_linear r"
  shows "onorm (\<lambda>x. r x \<bullet>\<^sub>C f) \<le> onorm r * norm f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>x. r x \<bullet>\<^sub>C f) \<le> onorm r * norm f
[PROOF STEP]
proof (rule onorm_bound)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> onorm r * norm f
 2. \<And>x. cmod (r x \<bullet>\<^sub>C f) \<le> onorm r * norm f * norm x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> onorm r * norm f
 2. \<And>x. cmod (r x \<bullet>\<^sub>C f) \<le> onorm r * norm f * norm x
[PROOF STEP]
have "norm (r x \<bullet>\<^sub>C f) \<le> norm (r x) * norm f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (r x \<bullet>\<^sub>C f) \<le> norm (r x) * norm f
[PROOF STEP]
by (simp add: Cauchy_Schwarz_ineq2)
[PROOF STATE]
proof (state)
this:
cmod (r x \<bullet>\<^sub>C f) \<le> norm (r x) * norm f

goal (2 subgoals):
 1. 0 \<le> onorm r * norm f
 2. \<And>x. cmod (r x \<bullet>\<^sub>C f) \<le> onorm r * norm f * norm x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (r x \<bullet>\<^sub>C f) \<le> norm (r x) * norm f

goal (2 subgoals):
 1. 0 \<le> onorm r * norm f
 2. \<And>x. cmod (r x \<bullet>\<^sub>C f) \<le> onorm r * norm f * norm x
[PROOF STEP]
have "\<dots> \<le> onorm r * norm x * norm f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (r x) * norm f \<le> onorm r * norm x * norm f
[PROOF STEP]
by (simp add: assms mult.commute mult_left_mono onorm)
[PROOF STATE]
proof (state)
this:
norm (r x) * norm f \<le> onorm r * norm x * norm f

goal (2 subgoals):
 1. 0 \<le> onorm r * norm f
 2. \<And>x. cmod (r x \<bullet>\<^sub>C f) \<le> onorm r * norm f * norm x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (r x \<bullet>\<^sub>C f) \<le> onorm r * norm x * norm f
[PROOF STEP]
show "norm (r x \<bullet>\<^sub>C f) \<le> onorm r * norm f * norm x"
[PROOF STATE]
proof (prove)
using this:
cmod (r x \<bullet>\<^sub>C f) \<le> onorm r * norm x * norm f

goal (1 subgoal):
 1. cmod (r x \<bullet>\<^sub>C f) \<le> onorm r * norm f * norm x
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
cmod (r x \<bullet>\<^sub>C f) \<le> onorm r * norm f * norm x

goal (1 subgoal):
 1. 0 \<le> onorm r * norm f
[PROOF STEP]
qed (intro mult_nonneg_nonneg norm_ge_zero onorm_pos_le assms)


[STATEMENT]
lemma aprimedivisor_prime_power:
  assumes "prime p" "k > 0"
  shows   "aprimedivisor (p ^ k) = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aprimedivisor (p ^ k) = p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aprimedivisor (p ^ k) = p
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prime p
0 < k
[PROOF STEP]
have *: "prime (aprimedivisor (p ^ k))" "aprimedivisor (p ^ k) dvd p ^ k"
[PROOF STATE]
proof (prove)
using this:
prime p
0 < k

goal (1 subgoal):
 1. prime (aprimedivisor (p ^ k)) &&& aprimedivisor (p ^ k) dvd p ^ k
[PROOF STEP]
by (intro prime_aprimedivisor[of p] aprimedivisor_dvd[of p]; simp add: prime_nat_iff)+
[PROOF STATE]
proof (state)
this:
prime (aprimedivisor (p ^ k))
aprimedivisor (p ^ k) dvd p ^ k

goal (1 subgoal):
 1. aprimedivisor (p ^ k) = p
[PROOF STEP]
from assms *
[PROOF STATE]
proof (chain)
picking this:
prime p
0 < k
prime (aprimedivisor (p ^ k))
aprimedivisor (p ^ k) dvd p ^ k
[PROOF STEP]
have "aprimedivisor (p ^ k) dvd p"
[PROOF STATE]
proof (prove)
using this:
prime p
0 < k
prime (aprimedivisor (p ^ k))
aprimedivisor (p ^ k) dvd p ^ k

goal (1 subgoal):
 1. aprimedivisor (p ^ k) dvd p
[PROOF STEP]
by (subst (asm) prime_dvd_power_iff) simp_all
[PROOF STATE]
proof (state)
this:
aprimedivisor (p ^ k) dvd p

goal (1 subgoal):
 1. aprimedivisor (p ^ k) = p
[PROOF STEP]
with assms *
[PROOF STATE]
proof (chain)
picking this:
prime p
0 < k
prime (aprimedivisor (p ^ k))
aprimedivisor (p ^ k) dvd p ^ k
aprimedivisor (p ^ k) dvd p
[PROOF STEP]
show "aprimedivisor (p ^ k) = p"
[PROOF STATE]
proof (prove)
using this:
prime p
0 < k
prime (aprimedivisor (p ^ k))
aprimedivisor (p ^ k) dvd p ^ k
aprimedivisor (p ^ k) dvd p

goal (1 subgoal):
 1. aprimedivisor (p ^ k) = p
[PROOF STEP]
by (intro primes_dvd_imp_eq)
[PROOF STATE]
proof (state)
this:
aprimedivisor (p ^ k) = p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in comm_group) finprod_minus:
  assumes "a \<in> A" "f \<in> A \<rightarrow> carrier G" "finite A"
  shows "finprod G f A = f a \<otimes> finprod G f (A - {a})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finprod G f A = f a \<otimes> finprod G f (A - {a})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finprod G f A = f a \<otimes> finprod G f (A - {a})
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
a \<in> A
f \<in> A \<rightarrow> carrier G
finite A
[PROOF STEP]
have "A = insert a (A - {a})"
[PROOF STATE]
proof (prove)
using this:
a \<in> A
f \<in> A \<rightarrow> carrier G
finite A

goal (1 subgoal):
 1. A = insert a (A - {a})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A = insert a (A - {a})

goal (1 subgoal):
 1. finprod G f A = f a \<otimes> finprod G f (A - {a})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A = insert a (A - {a})
[PROOF STEP]
have "finprod G f A = finprod G f (insert a (A - {a}))"
[PROOF STATE]
proof (prove)
using this:
A = insert a (A - {a})

goal (1 subgoal):
 1. finprod G f A = finprod G f (insert a (A - {a}))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finprod G f A = finprod G f (insert a (A - {a}))

goal (1 subgoal):
 1. finprod G f A = f a \<otimes> finprod G f (A - {a})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
finprod G f A = finprod G f (insert a (A - {a}))

goal (1 subgoal):
 1. finprod G f A = f a \<otimes> finprod G f (A - {a})
[PROOF STEP]
have "\<dots> = f a \<otimes> finprod G f (A - {a})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finprod G f (insert a (A - {a})) = f a \<otimes> finprod G f (A - {a})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> A
f \<in> A \<rightarrow> carrier G
finite A

goal (1 subgoal):
 1. finprod G f (insert a (A - {a})) = f a \<otimes> finprod G f (A - {a})
[PROOF STEP]
by (intro finprod_insert, auto)
[PROOF STATE]
proof (state)
this:
finprod G f (insert a (A - {a})) = f a \<otimes> finprod G f (A - {a})

goal (1 subgoal):
 1. finprod G f A = f a \<otimes> finprod G f (A - {a})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
finprod G f A = f a \<otimes> finprod G f (A - {a})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finprod G f A = f a \<otimes> finprod G f (A - {a})

goal (1 subgoal):
 1. finprod G f A = f a \<otimes> finprod G f (A - {a})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finprod G f A = f a \<otimes> finprod G f (A - {a})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infsum_scaleR_left:
  fixes c :: \<open>'a :: real_normed_vector\<close>
  assumes "c \<noteq> 0 \<Longrightarrow> f summable_on A"
  shows   "infsum (\<lambda>x. f x *\<^sub>R c) A = infsum f A *\<^sub>R c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. f x *\<^sub>R c) = infsum f A *\<^sub>R c
[PROOF STEP]
apply (cases \<open>c \<noteq> 0\<close>)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. c \<noteq> (0::'a) \<Longrightarrow> (\<Sum>\<^sub>\<infinity>x\<in>A. f x *\<^sub>R c) = infsum f A *\<^sub>R c
 2. \<not> c \<noteq> (0::'a) \<Longrightarrow> (\<Sum>\<^sub>\<infinity>x\<in>A. f x *\<^sub>R c) = infsum f A *\<^sub>R c
[PROOF STEP]
apply (subst asm_rl[of \<open>(\<lambda>x. f x *\<^sub>R c) = (\<lambda>y. y *\<^sub>R c) o f\<close>], simp add: o_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. c \<noteq> (0::'a) \<Longrightarrow> infsum ((\<lambda>y. y *\<^sub>R c) \<circ> f) A = infsum f A *\<^sub>R c
 2. \<not> c \<noteq> (0::'a) \<Longrightarrow> (\<Sum>\<^sub>\<infinity>x\<in>A. f x *\<^sub>R c) = infsum f A *\<^sub>R c
[PROOF STEP]
apply (rule infsum_comm_additive)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. c \<noteq> (0::'a) \<Longrightarrow> additive (\<lambda>y. y *\<^sub>R c)
 2. c \<noteq> (0::'a) \<Longrightarrow> isCont (\<lambda>y. y *\<^sub>R c) (infsum f A)
 3. c \<noteq> (0::'a) \<Longrightarrow> f summable_on A
 4. \<not> c \<noteq> (0::'a) \<Longrightarrow> (\<Sum>\<^sub>\<infinity>x\<in>A. f x *\<^sub>R c) = infsum f A *\<^sub>R c
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a) \<Longrightarrow> f summable_on A

goal (4 subgoals):
 1. c \<noteq> (0::'a) \<Longrightarrow> additive (\<lambda>y. y *\<^sub>R c)
 2. c \<noteq> (0::'a) \<Longrightarrow> isCont (\<lambda>y. y *\<^sub>R c) (infsum f A)
 3. c \<noteq> (0::'a) \<Longrightarrow> f summable_on A
 4. \<not> c \<noteq> (0::'a) \<Longrightarrow> (\<Sum>\<^sub>\<infinity>x\<in>A. f x *\<^sub>R c) = infsum f A *\<^sub>R c
[PROOF STEP]
by (auto simp add: scaleR_left.additive_axioms)


[STATEMENT]
lemma coeff_monom_mult: "coeff (monom c n * p) k = (if k < n then 0 else c * coeff p (k - n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (monom c n * p) k = (if k < n then 0::'a else c * coeff p (k - n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coeff (monom c n * p) k = (if k < n then 0::'a else c * coeff p (k - n))
[PROOF STEP]
have "coeff (monom c n * p) k = (\<Sum>i\<le>k. (if n = i then c else 0) * coeff p (k - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (monom c n * p) k = (\<Sum>i\<le>k. (if n = i then c else (0::'a)) * coeff p (k - i))
[PROOF STEP]
by (simp add: coeff_mult)
[PROOF STATE]
proof (state)
this:
coeff (monom c n * p) k = (\<Sum>i\<le>k. (if n = i then c else (0::'a)) * coeff p (k - i))

goal (1 subgoal):
 1. coeff (monom c n * p) k = (if k < n then 0::'a else c * coeff p (k - n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
coeff (monom c n * p) k = (\<Sum>i\<le>k. (if n = i then c else (0::'a)) * coeff p (k - i))

goal (1 subgoal):
 1. coeff (monom c n * p) k = (if k < n then 0::'a else c * coeff p (k - n))
[PROOF STEP]
have "\<dots> = (\<Sum>i\<le>k. (if n = i then c * coeff p (k - i) else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>k. (if n = i then c else (0::'a)) * coeff p (k - i)) = (\<Sum>i\<le>k. if n = i then c * coeff p (k - i) else (0::'a))
[PROOF STEP]
by (intro sum.cong) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>k. (if n = i then c else (0::'a)) * coeff p (k - i)) = (\<Sum>i\<le>k. if n = i then c * coeff p (k - i) else (0::'a))

goal (1 subgoal):
 1. coeff (monom c n * p) k = (if k < n then 0::'a else c * coeff p (k - n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>k. (if n = i then c else (0::'a)) * coeff p (k - i)) = (\<Sum>i\<le>k. if n = i then c * coeff p (k - i) else (0::'a))

goal (1 subgoal):
 1. coeff (monom c n * p) k = (if k < n then 0::'a else c * coeff p (k - n))
[PROOF STEP]
have "\<dots> = (if k < n then 0 else c * coeff p (k - n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>k. if n = i then c * coeff p (k - i) else (0::'a)) = (if k < n then 0::'a else c * coeff p (k - n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>k. if n = i then c * coeff p (k - i) else (0::'a)) = (if k < n then 0::'a else c * coeff p (k - n))

goal (1 subgoal):
 1. coeff (monom c n * p) k = (if k < n then 0::'a else c * coeff p (k - n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
coeff (monom c n * p) k = (if k < n then 0::'a else c * coeff p (k - n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
coeff (monom c n * p) k = (if k < n then 0::'a else c * coeff p (k - n))

goal (1 subgoal):
 1. coeff (monom c n * p) k = (if k < n then 0::'a else c * coeff p (k - n))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
coeff (monom c n * p) k = (if k < n then 0::'a else c * coeff p (k - n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma deadlock_state_alt_def_h : "deadlock_state M q = (\<forall> x \<in> inputs M . h M (q,x) = {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deadlock_state M q = (\<forall>x\<in>FSM.inputs M. FSM.h M (q, x) = {})
[PROOF STEP]
unfolding deadlock_state.simps h.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> (\<exists>t\<in>FSM.transitions M. t_source t = q)) = (\<forall>x\<in>FSM.inputs M. FSM.h M (q, x) = {})
[PROOF STEP]
using fsm_transition_input
[PROOF STATE]
proof (prove)
using this:
?t \<in> FSM.transitions ?M \<Longrightarrow> t_input ?t \<in> FSM.inputs ?M

goal (1 subgoal):
 1. (\<not> (\<exists>t\<in>FSM.transitions M. t_source t = q)) = (\<forall>x\<in>FSM.inputs M. FSM.h M (q, x) = {})
[PROOF STEP]
by force


[STATEMENT]
lemma vec_nth_real_1_iff_cbox [simp]:
  fixes a b :: real
  shows "(\<lambda>x::real^1. x $ 1) ` S = {a..b} \<longleftrightarrow> S = cbox (vec a) (vec b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x $ 1) ` S = {a..b}) = (S = cbox (vec a) (vec b))
[PROOF STEP]
using vec_nth_1_iff_cbox[of S a b]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. x $ 1) ` S = cbox a b) = (S = cbox (vec a) (vec b))

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


[STATEMENT]
lemma subtopology_nsphere_equator:
  "subtopology (nsphere (Suc n)) {x. x(Suc n) = 0} = nsphere n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subtopology (nsphere (Suc n)) {x. x (Suc n) = 0} = nsphere n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subtopology (nsphere (Suc n)) {x. x (Suc n) = 0} = nsphere n
[PROOF STEP]
have "({x. (\<Sum>i\<le>n. (x i)\<^sup>2) + (x (Suc n))\<^sup>2 = 1 \<and> (\<forall>i>Suc n. x i = 0)} \<inter> {x. x (Suc n) = 0})
      = {x. (\<Sum>i\<le>n. (x i)\<^sup>2) = 1 \<and> (\<forall>i>n. x i = (0::real))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. (\<Sum>i\<le>n. (x i)\<^sup>2) + (x (Suc n))\<^sup>2 = 1 \<and> (\<forall>i>Suc n. x i = 0)} \<inter> {x. x (Suc n) = 0} = {x. (\<Sum>i\<le>n. (x i)\<^sup>2) = 1 \<and> (\<forall>i>n. x i = 0)}
[PROOF STEP]
using Suc_lessI [of n]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n < ?n; Suc n \<noteq> ?n\<rbrakk> \<Longrightarrow> Suc n < ?n

goal (1 subgoal):
 1. {x. (\<Sum>i\<le>n. (x i)\<^sup>2) + (x (Suc n))\<^sup>2 = 1 \<and> (\<forall>i>Suc n. x i = 0)} \<inter> {x. x (Suc n) = 0} = {x. (\<Sum>i\<le>n. (x i)\<^sup>2) = 1 \<and> (\<forall>i>n. x i = 0)}
[PROOF STEP]
by (fastforce simp: set_eq_iff)
[PROOF STATE]
proof (state)
this:
{x. (\<Sum>i\<le>n. (x i)\<^sup>2) + (x (Suc n))\<^sup>2 = 1 \<and> (\<forall>i>Suc n. x i = 0)} \<inter> {x. x (Suc n) = 0} = {x. (\<Sum>i\<le>n. (x i)\<^sup>2) = 1 \<and> (\<forall>i>n. x i = 0)}

goal (1 subgoal):
 1. subtopology (nsphere (Suc n)) {x. x (Suc n) = 0} = nsphere n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{x. (\<Sum>i\<le>n. (x i)\<^sup>2) + (x (Suc n))\<^sup>2 = 1 \<and> (\<forall>i>Suc n. x i = 0)} \<inter> {x. x (Suc n) = 0} = {x. (\<Sum>i\<le>n. (x i)\<^sup>2) = 1 \<and> (\<forall>i>n. x i = 0)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{x. (\<Sum>i\<le>n. (x i)\<^sup>2) + (x (Suc n))\<^sup>2 = 1 \<and> (\<forall>i>Suc n. x i = 0)} \<inter> {x. x (Suc n) = 0} = {x. (\<Sum>i\<le>n. (x i)\<^sup>2) = 1 \<and> (\<forall>i>n. x i = 0)}

goal (1 subgoal):
 1. subtopology (nsphere (Suc n)) {x. x (Suc n) = 0} = nsphere n
[PROOF STEP]
by (simp add: nsphere subtopology_subtopology)
[PROOF STATE]
proof (state)
this:
subtopology (nsphere (Suc n)) {x. x (Suc n) = 0} = nsphere n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ln_2_40_decimals:
  "\<bar>ln 2 - 0.6931471805599453094172321214581765680755\<bar>
      \<le> inverse (10^40 :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>ln 2 - 6931471805599453094172321214581765680755 / 10 ^ 40\<bar> \<le> inverse (10 ^ 40)
[PROOF STEP]
apply (rule ln_approx_abs''[where n = 40], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln_approx_aux1 (6931471805599453094172321214581765680755 / 10 ^ 40) (inverse (10 ^ 40)) 40 2
[PROOF STEP]
apply (simp, simp add: ln_approx_aux1_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln_approx_aux2 (1386294361119890618834464242916353136151 / 2000000000000000000000000000000000000000) (1 / 10000000000000000000000000000000000000000) 40 (1 / 3)
[PROOF STEP]
apply (simp add: ln_approx_aux2_def power2_eq_square power_divide)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln_approx_aux3 (1386294361119890618834464242916353136151 / 2000000000000000000000000000000000000000) (1 / 10000000000000000000000000000000000000000) 40 (1 / 3) (1 / 31926707153498719436273973404578792281816)
[PROOF STEP]
apply (simp add: ln_approx_aux3_def power2_eq_square)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>2 * (\<Sum>k<40. inverse (1 + 2 * real k) * (1 / 9) ^ k) / 3 - 5532476762002668606650923253863934299838063163113583244044097734262260626191277 / 7981676788374679859068493351144698070454000000000000000000000000000000000000000\<bar> * 39908383941873399295342466755723490352270000000000000000000000000000000000000000 \<le> 2740838394187339929534246675572349035227
[PROOF STEP]
apply (simp add: sum_poly_horner_expand)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma vangle_le_pi2: "0 \<le> u \<bullet> v \<Longrightarrow> vangle u v \<le> pi/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> u \<bullet> v \<Longrightarrow> vangle u v \<le> pi / 2
[PROOF STEP]
unfolding vangle_def atLeastAtMost_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> u \<bullet> v \<Longrightarrow> (if u = (0::'a) \<or> v = (0::'a) then pi / 2 else arccos (u \<bullet> v / (norm u * norm v))) \<le> pi / 2
[PROOF STEP]
apply (simp del: le_divide_eq_numeral1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> u \<bullet> v \<Longrightarrow> u \<noteq> (0::'a) \<and> v \<noteq> (0::'a) \<longrightarrow> arccos (u \<bullet> v / (norm u * norm v)) \<le> pi / 2
[PROOF STEP]
apply (intro impI arccos_le_pi2 arccos_lbound)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 \<le> u \<bullet> v; u \<noteq> (0::'a) \<and> v \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> 0 \<le> u \<bullet> v / (norm u * norm v)
 2. \<lbrakk>0 \<le> u \<bullet> v; u \<noteq> (0::'a) \<and> v \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> u \<bullet> v / (norm u * norm v) \<le> 1
[PROOF STEP]
using Cauchy_Schwarz_ineq2[of u v]
[PROOF STATE]
proof (prove)
using this:
\<bar>u \<bullet> v\<bar> \<le> norm u * norm v

goal (2 subgoals):
 1. \<lbrakk>0 \<le> u \<bullet> v; u \<noteq> (0::'a) \<and> v \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> 0 \<le> u \<bullet> v / (norm u * norm v)
 2. \<lbrakk>0 \<le> u \<bullet> v; u \<noteq> (0::'a) \<and> v \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> u \<bullet> v / (norm u * norm v) \<le> 1
[PROOF STEP]
by (auto simp: algebra_simps)


[STATEMENT]
theorem complete_with_middles_imp_geodesic:
  assumes "\<And>x y::('a::complete_space). \<exists>m. dist x m = dist x y /2 \<and> dist m y = dist x y /2"
  shows "OFCLASS('a, geodesic_space_class)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. OFCLASS('a, geodesic_space_class)
[PROOF STEP]
proof (standard, rule geodesic_subsetI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV\<rbrakk> \<Longrightarrow> \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> UNIV
[PROOF STEP]
fix x0 y0::'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV\<rbrakk> \<Longrightarrow> \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> UNIV
[PROOF STEP]
interpret complete_space_with_middle x0 y0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complete_space_with_middle TYPE('a)
[PROOF STEP]
apply standard
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<exists>z. dist x z = dist x y / 2 \<and> dist z y = dist x y / 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<exists>m. dist ?x m = dist ?x ?y / 2 \<and> dist m ?y = dist ?x ?y / 2

goal (1 subgoal):
 1. \<And>x y. \<exists>z. dist x z = dist x y / 2 \<and> dist z y = dist x y / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV\<rbrakk> \<Longrightarrow> \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> UNIV
[PROOF STEP]
have "\<exists>g. g 0 = x0 \<and> g (dist x0 y0) = y0 \<and> isometry_on {0..dist x0 y0} g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. g 0 = x0 \<and> g (dist x0 y0) = y0 \<and> isometry_on {0..dist x0 y0} g
[PROOF STEP]
using geod
[PROOF STATE]
proof (prove)
using this:
\<exists>g. isometry_on {0..dist x0 y0} g \<and> g 0 = x0 \<and> g (dist x0 y0) = y0

goal (1 subgoal):
 1. \<exists>g. g 0 = x0 \<and> g (dist x0 y0) = y0 \<and> isometry_on {0..dist x0 y0} g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>g. g 0 = x0 \<and> g (dist x0 y0) = y0 \<and> isometry_on {0..dist x0 y0} g

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV\<rbrakk> \<Longrightarrow> \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> UNIV
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>g. g 0 = x0 \<and> g (dist x0 y0) = y0 \<and> isometry_on {0..dist x0 y0} g
[PROOF STEP]
show "\<exists>G. geodesic_segment_between G x0 y0 \<and> G \<subseteq> UNIV"
[PROOF STATE]
proof (prove)
using this:
\<exists>g. g 0 = x0 \<and> g (dist x0 y0) = y0 \<and> isometry_on {0..dist x0 y0} g

goal (1 subgoal):
 1. \<exists>G. geodesic_segment_between G x0 y0 \<and> G \<subseteq> UNIV
[PROOF STEP]
unfolding geodesic_segment_between_def
[PROOF STATE]
proof (prove)
using this:
\<exists>g. g 0 = x0 \<and> g (dist x0 y0) = y0 \<and> isometry_on {0..dist x0 y0} g

goal (1 subgoal):
 1. \<exists>G. (\<exists>g. g 0 = x0 \<and> g (dist x0 y0) = y0 \<and> isometry_on {0..dist x0 y0} g \<and> G = g ` {0..dist x0 y0}) \<and> G \<subseteq> UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>G. geodesic_segment_between G x0 y0 \<and> G \<subseteq> UNIV

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma assoc_scalar_prod_mult_mat_vec:
  fixes A :: "'a::comm_semiring_1 mat"
  assumes "y \<in> carrier_vec n"
  assumes "x \<in> carrier_vec m"
  assumes "A \<in> carrier_mat n m"
  shows "(A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
have "(A *\<^sub>v x) \<bullet> y = (\<Sum> i \<in> {0 ..< n}. (A *\<^sub>v x) $ i * y $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (\<Sum>i = 0..<n. (A *\<^sub>v x) $ i * y $ i)
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec y. (A *\<^sub>v x) $ i * y $ i) = (\<Sum>i = 0..<n. (A *\<^sub>v x) $ i * y $ i)
[PROOF STEP]
using assms(1) carrier_vecD
[PROOF STATE]
proof (prove)
using this:
y \<in> carrier_vec n
?v \<in> carrier_vec ?n \<Longrightarrow> dim_vec ?v = ?n

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec y. (A *\<^sub>v x) $ i * y $ i) = (\<Sum>i = 0..<n. (A *\<^sub>v x) $ i * y $ i)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(A *\<^sub>v x) \<bullet> y = (\<Sum>i = 0..<n. (A *\<^sub>v x) $ i * y $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(A *\<^sub>v x) \<bullet> y = (\<Sum>i = 0..<n. (A *\<^sub>v x) $ i * y $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
have "... = (\<Sum> i \<in> {0 ..< n}. (vec (dim_row A) (\<lambda> i. row A i \<bullet> x)) $ i * y $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. (A *\<^sub>v x) $ i * y $ i) = (\<Sum>i = 0..<n. vec (dim_row A) (\<lambda>i. row A i \<bullet> x) $ i * y $ i)
[PROOF STEP]
unfolding mult_mat_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. vec (dim_row A) (\<lambda>i. row A i \<bullet> x) $ i * y $ i) = (\<Sum>i = 0..<n. vec (dim_row A) (\<lambda>i. row A i \<bullet> x) $ i * y $ i)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. (A *\<^sub>v x) $ i * y $ i) = (\<Sum>i = 0..<n. vec (dim_row A) (\<lambda>i. row A i \<bullet> x) $ i * y $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. (A *\<^sub>v x) $ i * y $ i) = (\<Sum>i = 0..<n. vec (dim_row A) (\<lambda>i. row A i \<bullet> x) $ i * y $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
have "... = (\<Sum> i \<in> {0 ..< n}. (\<lambda> i. row A i \<bullet> x)  i * y $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. vec (dim_row A) (\<lambda>i. row A i \<bullet> x) $ i * y $ i) = (\<Sum>i = 0..<n. row A i \<bullet> x * y $ i)
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n m

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. vec (dim_row A) (\<lambda>i. row A i \<bullet> x) $ i * y $ i) = (\<Sum>i = 0..<n. row A i \<bullet> x * y $ i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. vec (dim_row A) (\<lambda>i. row A i \<bullet> x) $ i * y $ i) = (\<Sum>i = 0..<n. row A i \<bullet> x * y $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. vec (dim_row A) (\<lambda>i. row A i \<bullet> x) $ i * y $ i) = (\<Sum>i = 0..<n. row A i \<bullet> x * y $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
have "... = (\<Sum> i \<in> {0 ..< n}. (\<Sum> j \<in> {0 ..< m}. (row A i) $ j * x $ j) * y $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. row A i \<bullet> x * y $ i) = (\<Sum>i = 0..<n. (\<Sum>j = 0..<m. row A i $ j * x $ j) * y $ i)
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. (\<Sum>ia = 0..<dim_vec x. row A i $ ia * x $ ia) * y $ i) = (\<Sum>i = 0..<n. (\<Sum>j = 0..<m. row A i $ j * x $ j) * y $ i)
[PROOF STEP]
using assms(2) carrier_vecD
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier_vec m
?v \<in> carrier_vec ?n \<Longrightarrow> dim_vec ?v = ?n

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. (\<Sum>ia = 0..<dim_vec x. row A i $ ia * x $ ia) * y $ i) = (\<Sum>i = 0..<n. (\<Sum>j = 0..<m. row A i $ j * x $ j) * y $ i)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. row A i \<bullet> x * y $ i) = (\<Sum>i = 0..<n. (\<Sum>j = 0..<m. row A i $ j * x $ j) * y $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. row A i \<bullet> x * y $ i) = (\<Sum>i = 0..<n. (\<Sum>j = 0..<m. row A i $ j * x $ j) * y $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
have "... = (\<Sum> j \<in> {0 ..< n}. (\<Sum> i \<in> {0 ..< m}. (row A j) $ i * x $ i * y $ j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. (\<Sum>j = 0..<m. row A i $ j * x $ j) * y $ i) = (\<Sum>j = 0..<n. \<Sum>i = 0..<m. row A j $ i * x $ i * y $ j)
[PROOF STEP]
by (simp add: sum_distrib_right)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. (\<Sum>j = 0..<m. row A i $ j * x $ j) * y $ i) = (\<Sum>j = 0..<n. \<Sum>i = 0..<m. row A j $ i * x $ i * y $ j)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. (\<Sum>j = 0..<m. row A i $ j * x $ j) * y $ i) = (\<Sum>j = 0..<n. \<Sum>i = 0..<m. row A j $ i * x $ i * y $ j)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
have "... = (\<Sum> j \<in> {0 ..< n}. (\<Sum> i \<in> {0 ..< m}.  A $$ (j,i) * x $ i * y $ j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<n. \<Sum>i = 0..<m. row A j $ i * x $ i * y $ j) = (\<Sum>j = 0..<n. \<Sum>i = 0..<m. A $$ (j, i) * x $ i * y $ j)
[PROOF STEP]
unfolding row_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<n. \<Sum>i = 0..<m. vec (dim_col A) (\<lambda>ja. A $$ (j, ja)) $ i * x $ i * y $ j) = (\<Sum>j = 0..<n. \<Sum>i = 0..<m. A $$ (j, i) * x $ i * y $ j)
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n m

goal (1 subgoal):
 1. (\<Sum>j = 0..<n. \<Sum>i = 0..<m. vec (dim_col A) (\<lambda>ja. A $$ (j, ja)) $ i * x $ i * y $ j) = (\<Sum>j = 0..<n. \<Sum>i = 0..<m. A $$ (j, i) * x $ i * y $ j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<n. \<Sum>i = 0..<m. row A j $ i * x $ i * y $ j) = (\<Sum>j = 0..<n. \<Sum>i = 0..<m. A $$ (j, i) * x $ i * y $ j)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<n. \<Sum>i = 0..<m. row A j $ i * x $ i * y $ j) = (\<Sum>j = 0..<n. \<Sum>i = 0..<m. A $$ (j, i) * x $ i * y $ j)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
have "... = (\<Sum> j \<in> {0 ..< n}. (\<Sum> i \<in> {0 ..< m}.  A $$ (j,i) * y $ j * x $ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<n. \<Sum>i = 0..<m. A $$ (j, i) * x $ i * y $ j) = (\<Sum>j = 0..<n. \<Sum>i = 0..<m. A $$ (j, i) * y $ j * x $ i)
[PROOF STEP]
by (meson semiring_normalization_rules(16) sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<n. \<Sum>i = 0..<m. A $$ (j, i) * x $ i * y $ j) = (\<Sum>j = 0..<n. \<Sum>i = 0..<m. A $$ (j, i) * y $ j * x $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<n. \<Sum>i = 0..<m. A $$ (j, i) * x $ i * y $ j) = (\<Sum>j = 0..<n. \<Sum>i = 0..<m. A $$ (j, i) * y $ j * x $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
have "... = (\<Sum> j \<in> {0 ..< n}. (\<Sum> i \<in> {0 ..< m}. (col A i) $ j * y $ j * x $ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<n. \<Sum>i = 0..<m. A $$ (j, i) * y $ j * x $ i) = (\<Sum>j = 0..<n. \<Sum>i = 0..<m. col A i $ j * y $ j * x $ i)
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n m

goal (1 subgoal):
 1. (\<Sum>j = 0..<n. \<Sum>i = 0..<m. A $$ (j, i) * y $ j * x $ i) = (\<Sum>j = 0..<n. \<Sum>i = 0..<m. col A i $ j * y $ j * x $ i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<n. \<Sum>i = 0..<m. A $$ (j, i) * y $ j * x $ i) = (\<Sum>j = 0..<n. \<Sum>i = 0..<m. col A i $ j * y $ j * x $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<n. \<Sum>i = 0..<m. A $$ (j, i) * y $ j * x $ i) = (\<Sum>j = 0..<n. \<Sum>i = 0..<m. col A i $ j * y $ j * x $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
have "... = (\<Sum> i \<in> {0 ..< m}. (\<Sum> j \<in> {0 ..< n}. (col A i) $ j * y $ j * x $ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<n. \<Sum>i = 0..<m. col A i $ j * y $ j * x $ i) = (\<Sum>i = 0..<m. \<Sum>j = 0..<n. col A i $ j * y $ j * x $ i)
[PROOF STEP]
using Groups_Big.comm_monoid_add_class.sum.swap[of
        "(\<lambda>i j. (col A i) $ j * y $ j * x $ i)" "{0..<n}" "{0 ..< m}", symmetric]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>j = 0..<n. \<Sum>i = 0..<m. col A i $ j * y $ j * x $ i) = (\<Sum>i = 0..<m. \<Sum>j = 0..<n. col A i $ j * y $ j * x $ i)

goal (1 subgoal):
 1. (\<Sum>j = 0..<n. \<Sum>i = 0..<m. col A i $ j * y $ j * x $ i) = (\<Sum>i = 0..<m. \<Sum>j = 0..<n. col A i $ j * y $ j * x $ i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<n. \<Sum>i = 0..<m. col A i $ j * y $ j * x $ i) = (\<Sum>i = 0..<m. \<Sum>j = 0..<n. col A i $ j * y $ j * x $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<n. \<Sum>i = 0..<m. col A i $ j * y $ j * x $ i) = (\<Sum>i = 0..<m. \<Sum>j = 0..<n. col A i $ j * y $ j * x $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
have "... = (\<Sum> i \<in> {0 ..< m}. (\<Sum> j \<in> {0 ..< n}. (col A i) $ j * y $ j) * x $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<m. \<Sum>j = 0..<n. col A i $ j * y $ j * x $ i) = (\<Sum>i = 0..<m. (\<Sum>j = 0..<n. col A i $ j * y $ j) * x $ i)
[PROOF STEP]
by (simp add: sum_distrib_right)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<m. \<Sum>j = 0..<n. col A i $ j * y $ j * x $ i) = (\<Sum>i = 0..<m. (\<Sum>j = 0..<n. col A i $ j * y $ j) * x $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<m. \<Sum>j = 0..<n. col A i $ j * y $ j * x $ i) = (\<Sum>i = 0..<m. (\<Sum>j = 0..<n. col A i $ j * y $ j) * x $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
have "... = (\<Sum> i \<in> {0 ..< m}. (\<lambda> i. col A i \<bullet> y) i * x $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<m. (\<Sum>j = 0..<n. col A i $ j * y $ j) * x $ i) = (\<Sum>i = 0..<m. col A i \<bullet> y * x $ i)
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<m. (\<Sum>j = 0..<n. col A i $ j * y $ j) * x $ i) = (\<Sum>i = 0..<m. (\<Sum>ia = 0..<dim_vec y. col A i $ ia * y $ ia) * x $ i)
[PROOF STEP]
using assms(1) carrier_vecD
[PROOF STATE]
proof (prove)
using this:
y \<in> carrier_vec n
?v \<in> carrier_vec ?n \<Longrightarrow> dim_vec ?v = ?n

goal (1 subgoal):
 1. (\<Sum>i = 0..<m. (\<Sum>j = 0..<n. col A i $ j * y $ j) * x $ i) = (\<Sum>i = 0..<m. (\<Sum>ia = 0..<dim_vec y. col A i $ ia * y $ ia) * x $ i)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<m. (\<Sum>j = 0..<n. col A i $ j * y $ j) * x $ i) = (\<Sum>i = 0..<m. col A i \<bullet> y * x $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<m. (\<Sum>j = 0..<n. col A i $ j * y $ j) * x $ i) = (\<Sum>i = 0..<m. col A i \<bullet> y * x $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
have "... = (\<Sum> i \<in> {0 ..< m}. (\<lambda> i. row A\<^sup>T i \<bullet> y) i * x $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<m. col A i \<bullet> y * x $ i) = (\<Sum>i = 0..<m. row A\<^sup>T i \<bullet> y * x $ i)
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n m

goal (1 subgoal):
 1. (\<Sum>i = 0..<m. col A i \<bullet> y * x $ i) = (\<Sum>i = 0..<m. row A\<^sup>T i \<bullet> y * x $ i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<m. col A i \<bullet> y * x $ i) = (\<Sum>i = 0..<m. row A\<^sup>T i \<bullet> y * x $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<m. col A i \<bullet> y * x $ i) = (\<Sum>i = 0..<m. row A\<^sup>T i \<bullet> y * x $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
have "... = (\<Sum> i \<in> {0 ..< m}. (vec (dim_row A\<^sup>T) (\<lambda> i. row A\<^sup>T i \<bullet> y)) $ i * x $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<m. row A\<^sup>T i \<bullet> y * x $ i) = (\<Sum>i = 0..<m. vec (dim_row A\<^sup>T) (\<lambda>i. row A\<^sup>T i \<bullet> y) $ i * x $ i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
y \<in> carrier_vec n
x \<in> carrier_vec m
A \<in> carrier_mat n m

goal (1 subgoal):
 1. (\<Sum>i = 0..<m. row A\<^sup>T i \<bullet> y * x $ i) = (\<Sum>i = 0..<m. vec (dim_row A\<^sup>T) (\<lambda>i. row A\<^sup>T i \<bullet> y) $ i * x $ i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<m. row A\<^sup>T i \<bullet> y * x $ i) = (\<Sum>i = 0..<m. vec (dim_row A\<^sup>T) (\<lambda>i. row A\<^sup>T i \<bullet> y) $ i * x $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<m. row A\<^sup>T i \<bullet> y * x $ i) = (\<Sum>i = 0..<m. vec (dim_row A\<^sup>T) (\<lambda>i. row A\<^sup>T i \<bullet> y) $ i * x $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
have "... = (\<Sum> i \<in> {0 ..< m}. (A\<^sup>T *\<^sub>v y) $ i * x $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<m. vec (dim_row A\<^sup>T) (\<lambda>i. row A\<^sup>T i \<bullet> y) $ i * x $ i) = (\<Sum>i = 0..<m. (A\<^sup>T *\<^sub>v y) $ i * x $ i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
y \<in> carrier_vec n
x \<in> carrier_vec m
A \<in> carrier_mat n m

goal (1 subgoal):
 1. (\<Sum>i = 0..<m. vec (dim_row A\<^sup>T) (\<lambda>i. row A\<^sup>T i \<bullet> y) $ i * x $ i) = (\<Sum>i = 0..<m. (A\<^sup>T *\<^sub>v y) $ i * x $ i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<m. vec (dim_row A\<^sup>T) (\<lambda>i. row A\<^sup>T i \<bullet> y) $ i * x $ i) = (\<Sum>i = 0..<m. (A\<^sup>T *\<^sub>v y) $ i * x $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<m. vec (dim_row A\<^sup>T) (\<lambda>i. row A\<^sup>T i \<bullet> y) $ i * x $ i) = (\<Sum>i = 0..<m. (A\<^sup>T *\<^sub>v y) $ i * x $ i)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
have "... = (A\<^sup>T *\<^sub>v y) \<bullet> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<m. (A\<^sup>T *\<^sub>v y) $ i * x $ i) = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
using scalar_prod_def[of "(A\<^sup>T *\<^sub>v y)" x,symmetric]
[PROOF STATE]
proof (prove)
using this:
\<Sum>i = 0..<dim_vec x. (A\<^sup>T *\<^sub>v y) $ i * x $ i \<equiv> (A\<^sup>T *\<^sub>v y) \<bullet> x

goal (1 subgoal):
 1. (\<Sum>i = 0..<m. (A\<^sup>T *\<^sub>v y) $ i * x $ i) = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
using assms(2) carrier_vecD
[PROOF STATE]
proof (prove)
using this:
\<Sum>i = 0..<dim_vec x. (A\<^sup>T *\<^sub>v y) $ i * x $ i \<equiv> (A\<^sup>T *\<^sub>v y) \<bullet> x
x \<in> carrier_vec m
?v \<in> carrier_vec ?n \<Longrightarrow> dim_vec ?v = ?n

goal (1 subgoal):
 1. (\<Sum>i = 0..<m. (A\<^sup>T *\<^sub>v y) $ i * x $ i) = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<m. (A\<^sup>T *\<^sub>v y) $ i * x $ i) = (A\<^sup>T *\<^sub>v y) \<bullet> x

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(A *\<^sub>v x) \<bullet> y = (A\<^sup>T *\<^sub>v y) \<bullet> x

goal:
No subgoals!
[PROOF STEP]
qed