[STATEMENT]
theorem three_divides_nat:
  shows "(3 dvd n) = (3 dvd sumdig n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (3 dvd n) = (3 dvd sumdig n)
[PROOF STEP]
proof (unfold sumdig_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (3 dvd n) = (3 dvd (\<Sum>x<nlen n. n div 10 ^ x mod 10))
[PROOF STEP]
have "n = (\<Sum>x<nlen n. (n div (10::nat)^x mod 10) * 10^x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = (\<Sum>x<nlen n. n div 10 ^ x mod 10 * 10 ^ x)
[PROOF STEP]
by (rule exp_exists)
[PROOF STATE]
proof (state)
this:
n = (\<Sum>x<nlen n. n div 10 ^ x mod 10 * 10 ^ x)

goal (1 subgoal):
 1. (3 dvd n) = (3 dvd (\<Sum>x<nlen n. n div 10 ^ x mod 10))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
n = (\<Sum>x<nlen n. n div 10 ^ x mod 10 * 10 ^ x)

goal (1 subgoal):
 1. (3 dvd n) = (3 dvd (\<Sum>x<nlen n. n div 10 ^ x mod 10))
[PROOF STEP]
have "3 dvd (\<Sum>x<nlen n. (n div (10::nat)^x mod 10) * 10^x) =
        (3 dvd (\<Sum>x<nlen n. n div 10^x mod 10))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (3 dvd (\<Sum>x<nlen n. n div 10 ^ x mod 10 * 10 ^ x)) = (3 dvd (\<Sum>x<nlen n. n div 10 ^ x mod 10))
[PROOF STEP]
by (rule three_div_general)
[PROOF STATE]
proof (state)
this:
(3 dvd (\<Sum>x<nlen n. n div 10 ^ x mod 10 * 10 ^ x)) = (3 dvd (\<Sum>x<nlen n. n div 10 ^ x mod 10))

goal (1 subgoal):
 1. (3 dvd n) = (3 dvd (\<Sum>x<nlen n. n div 10 ^ x mod 10))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
n = (\<Sum>x<nlen n. n div 10 ^ x mod 10 * 10 ^ x)
(3 dvd (\<Sum>x<nlen n. n div 10 ^ x mod 10 * 10 ^ x)) = (3 dvd (\<Sum>x<nlen n. n div 10 ^ x mod 10))
[PROOF STEP]
show "3 dvd n = (3 dvd (\<Sum>x<nlen n. n div 10^x mod 10))"
[PROOF STATE]
proof (prove)
using this:
n = (\<Sum>x<nlen n. n div 10 ^ x mod 10 * 10 ^ x)
(3 dvd (\<Sum>x<nlen n. n div 10 ^ x mod 10 * 10 ^ x)) = (3 dvd (\<Sum>x<nlen n. n div 10 ^ x mod 10))

goal (1 subgoal):
 1. (3 dvd n) = (3 dvd (\<Sum>x<nlen n. n div 10 ^ x mod 10))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(3 dvd n) = (3 dvd (\<Sum>x<nlen n. n div 10 ^ x mod 10))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linear_simps:
  assumes "bounded_linear f"
  shows
    "f (a + b) = f a + f b"
    "f (a - b) = f a - f b"
    "f 0 = 0"
    "f (- a) = - f a"
    "f (s *\<^sub>R v) = s *\<^sub>R (f v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f (a + b) = f a + f b &&& f (a - b) = f a - f b) &&& f (0::'a) = (0::'b) &&& f (- a) = - f a &&& f (s *\<^sub>R v) = s *\<^sub>R f v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. f (a + b) = f a + f b
 2. f (a - b) = f a - f b
 3. f (0::'a) = (0::'b)
 4. f (- a) = - f a
 5. f (s *\<^sub>R v) = s *\<^sub>R f v
[PROOF STEP]
interpret f: bounded_linear f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear f
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. f (a + b) = f a + f b
 2. f (a - b) = f a - f b
 3. f (0::'a) = (0::'b)
 4. f (- a) = - f a
 5. f (s *\<^sub>R v) = s *\<^sub>R f v
[PROOF STEP]
show "f (a + b) = f a + f b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (a + b) = f a + f b
[PROOF STEP]
by (rule f.add)
[PROOF STATE]
proof (state)
this:
f (a + b) = f a + f b

goal (4 subgoals):
 1. f (a - b) = f a - f b
 2. f (0::'a) = (0::'b)
 3. f (- a) = - f a
 4. f (s *\<^sub>R v) = s *\<^sub>R f v
[PROOF STEP]
show "f (a - b) = f a - f b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (a - b) = f a - f b
[PROOF STEP]
by (rule f.diff)
[PROOF STATE]
proof (state)
this:
f (a - b) = f a - f b

goal (3 subgoals):
 1. f (0::'a) = (0::'b)
 2. f (- a) = - f a
 3. f (s *\<^sub>R v) = s *\<^sub>R f v
[PROOF STEP]
show "f 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (0::'a) = (0::'b)
[PROOF STEP]
by (rule f.zero)
[PROOF STATE]
proof (state)
this:
f (0::'a) = (0::'b)

goal (2 subgoals):
 1. f (- a) = - f a
 2. f (s *\<^sub>R v) = s *\<^sub>R f v
[PROOF STEP]
show "f (- a) = - f a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (- a) = - f a
[PROOF STEP]
by (rule f.neg)
[PROOF STATE]
proof (state)
this:
f (- a) = - f a

goal (1 subgoal):
 1. f (s *\<^sub>R v) = s *\<^sub>R f v
[PROOF STEP]
show "f (s *\<^sub>R v) = s *\<^sub>R (f v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (s *\<^sub>R v) = s *\<^sub>R f v
[PROOF STEP]
by (rule f.scale)
[PROOF STATE]
proof (state)
this:
f (s *\<^sub>R v) = s *\<^sub>R f v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma order_statistics_measurable:
  fixes X :: "nat \<Rightarrow> 'a \<Rightarrow> ('b :: {linorder_topology, second_countable_topology})"
  assumes "n \<ge> 1"
  assumes "j < n"
  assumes "\<And>i. i < n \<Longrightarrow> X i \<in> measurable M borel"
  shows "(\<lambda>x. (sort (map (\<lambda>i. X i x) [0..<n])) ! j) \<in> measurable M borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. sort (map (\<lambda>i. X i x) [0..<n]) ! j) \<in> borel_measurable M
[PROOF STEP]
apply (subst sort_map_eq_sort[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. map (sort_map (\<lambda>i. X i x) n) [0..<n] ! j) \<in> borel_measurable M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> n
j < n
?i < n \<Longrightarrow> X ?i \<in> borel_measurable M

goal (1 subgoal):
 1. (\<lambda>x. map (sort_map (\<lambda>i. X i x) n) [0..<n] ! j) \<in> borel_measurable M
[PROOF STEP]
by (simp add:order_statistics_measurable_aux del:sort_map.simps)


[STATEMENT]
lemma has_derivative_inverse_basic_x:
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector"
  assumes "(f has_derivative f') (at x)"
    and "bounded_linear g'"
    and "g' \<circ> f' = id"
    and "continuous (at (f x)) g"
    and "g (f x) = x"
    and "open T"
    and "f x \<in> T"
    and "\<And>y. y \<in> T \<Longrightarrow> f (g y) = y"
  shows "(g has_derivative g') (at (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g has_derivative g') (at (f x))
[PROOF STEP]
by (rule has_derivative_inverse_basic) (use assms in auto)


[STATEMENT]
lemma convex_lower:
  assumes "convex_on S f"
    and "x \<in> S"
    and "y \<in> S"
    and "0 \<le> u"
    and "0 \<le> v"
    and "u + v = 1"
  shows "f (u *\<^sub>R x + v *\<^sub>R y) \<le> max (f x) (f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (u *\<^sub>R x + v *\<^sub>R y) \<le> max (f x) (f y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f (u *\<^sub>R x + v *\<^sub>R y) \<le> max (f x) (f y)
[PROOF STEP]
let ?m = "max (f x) (f y)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f (u *\<^sub>R x + v *\<^sub>R y) \<le> max (f x) (f y)
[PROOF STEP]
have "u * f x + v * f y \<le> u * max (f x) (f y) + v * max (f x) (f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u * f x + v * f y \<le> u * max (f x) (f y) + v * max (f x) (f y)
[PROOF STEP]
using assms(4,5)
[PROOF STATE]
proof (prove)
using this:
0 \<le> u
0 \<le> v

goal (1 subgoal):
 1. u * f x + v * f y \<le> u * max (f x) (f y) + v * max (f x) (f y)
[PROOF STEP]
by (auto simp: mult_left_mono add_mono)
[PROOF STATE]
proof (state)
this:
u * f x + v * f y \<le> u * max (f x) (f y) + v * max (f x) (f y)

goal (1 subgoal):
 1. f (u *\<^sub>R x + v *\<^sub>R y) \<le> max (f x) (f y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
u * f x + v * f y \<le> u * max (f x) (f y) + v * max (f x) (f y)

goal (1 subgoal):
 1. f (u *\<^sub>R x + v *\<^sub>R y) \<le> max (f x) (f y)
[PROOF STEP]
have "\<dots> = max (f x) (f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u * max (f x) (f y) + v * max (f x) (f y) = max (f x) (f y)
[PROOF STEP]
using assms(6)
[PROOF STATE]
proof (prove)
using this:
u + v = 1

goal (1 subgoal):
 1. u * max (f x) (f y) + v * max (f x) (f y) = max (f x) (f y)
[PROOF STEP]
by (simp add: distrib_right [symmetric])
[PROOF STATE]
proof (state)
this:
u * max (f x) (f y) + v * max (f x) (f y) = max (f x) (f y)

goal (1 subgoal):
 1. f (u *\<^sub>R x + v *\<^sub>R y) \<le> max (f x) (f y)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
u * f x + v * f y \<le> max (f x) (f y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
u * f x + v * f y \<le> max (f x) (f y)

goal (1 subgoal):
 1. f (u *\<^sub>R x + v *\<^sub>R y) \<le> max (f x) (f y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u * f x + v * f y \<le> max (f x) (f y)
convex_on S f
x \<in> S
y \<in> S
0 \<le> u
0 \<le> v
u + v = 1

goal (1 subgoal):
 1. f (u *\<^sub>R x + v *\<^sub>R y) \<le> max (f x) (f y)
[PROOF STEP]
unfolding convex_on_def
[PROOF STATE]
proof (prove)
using this:
u * f x + v * f y \<le> max (f x) (f y)
\<forall>x\<in>S. \<forall>y\<in>S. \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> f (u *\<^sub>R x + v *\<^sub>R y) \<le> u * f x + v * f y
x \<in> S
y \<in> S
0 \<le> u
0 \<le> v
u + v = 1

goal (1 subgoal):
 1. f (u *\<^sub>R x + v *\<^sub>R y) \<le> max (f x) (f y)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
f (u *\<^sub>R x + v *\<^sub>R y) \<le> max (f x) (f y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_ran_le_dom: "finite (dom m) \<Longrightarrow> card (ran m) \<le> card (dom m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (dom m) \<Longrightarrow> card (ran m) \<le> card (dom m)
[PROOF STEP]
by(simp add: ran_alt_def card_image_le)


[STATEMENT]
lemma fold_random_permutation_foldr:
  assumes "finite A"
  shows   "fold_random_permutation f x A =
             map_pmf (\<lambda>xs. foldr f xs x) (pmf_of_set (permutations_of_set A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold_random_permutation f x A = map_pmf (\<lambda>xs. foldr f xs x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fold_random_permutation f x A = map_pmf (\<lambda>xs. foldr f xs x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
have "fold_random_permutation f x A =
          map_pmf (foldl (\<lambda>x y. f y x) x \<circ> rev) (pmf_of_set (permutations_of_set A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x \<circ> rev) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x \<circ> rev) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
by (subst fold_random_permutation_foldl [OF assms])
                   (simp_all add: pmf.map_comp [symmetric] map_pmf_of_set_inj)
[PROOF STATE]
proof (state)
this:
fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x \<circ> rev) (pmf_of_set (permutations_of_set A))

goal (1 subgoal):
 1. fold_random_permutation f x A = map_pmf (\<lambda>xs. foldr f xs x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x \<circ> rev) (pmf_of_set (permutations_of_set A))

goal (1 subgoal):
 1. fold_random_permutation f x A = map_pmf (\<lambda>xs. foldr f xs x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
have "foldl (\<lambda>x y. f y x) x \<circ> rev = (\<lambda>xs. foldr f xs x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl (\<lambda>x y. f y x) x \<circ> rev = (\<lambda>xs. foldr f xs x)
[PROOF STEP]
by (intro ext) (simp add: foldl_conv_foldr)
[PROOF STATE]
proof (state)
this:
foldl (\<lambda>x y. f y x) x \<circ> rev = (\<lambda>xs. foldr f xs x)

goal (1 subgoal):
 1. fold_random_permutation f x A = map_pmf (\<lambda>xs. foldr f xs x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fold_random_permutation f x A = map_pmf (\<lambda>a. foldr f a x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fold_random_permutation f x A = map_pmf (\<lambda>a. foldr f a x) (pmf_of_set (permutations_of_set A))

goal (1 subgoal):
 1. fold_random_permutation f x A = map_pmf (\<lambda>xs. foldr f xs x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fold_random_permutation f x A = map_pmf (\<lambda>xs. foldr f xs x) (pmf_of_set (permutations_of_set A))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) normal_subgroup_intersect:
  assumes "M \<lhd> G" and "N \<lhd> G"
  shows "M \<inter> N \<lhd> G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M \<inter> N \<lhd> G
[PROOF STEP]
using assms subgroup_intersect is_group normal_inv_iff
[PROOF STATE]
proof (prove)
using this:
M \<lhd> G
N \<lhd> G
\<lbrakk>subgroup ?H G; subgroup ?H' G\<rbrakk> \<Longrightarrow> subgroup (?H \<inter> ?H') G
Group.group G
?N \<lhd> G = (subgroup ?N G \<and> (\<forall>x\<in>carrier G. \<forall>h\<in>?N. x \<otimes> h \<otimes> inv x \<in> ?N))

goal (1 subgoal):
 1. M \<inter> N \<lhd> G
[PROOF STEP]
by simp


[STATEMENT]
theorem ln_lower_7_eq: "0 < x \<Longrightarrow>
  ln_lower_7 x = (1/12)*(47*x^3 + 239*x^2 + 131*x + 3)*(x - 1) / (x*(x^3 + 12*x^2 + 18*x + 4))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> ln_lower_7 x = 1 / 12 * (47 * x ^ 3 + 239 * x\<^sup>2 + 131 * x + 3) * (x - 1) / (x * (x ^ 3 + 12 * x\<^sup>2 + 18 * x + 4))
[PROOF STEP]
unfolding ln_lower_7_def ln_upper_7_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> - ((3 * inverse x ^ 3 + 131 * (inverse x)\<^sup>2 + 239 * inverse x + 47) * (inverse x - 1) / (12 * (4 * inverse x ^ 3 + 18 * (inverse x)\<^sup>2 + 12 * inverse x + 1))) = 1 / 12 * (47 * x ^ 3 + 239 * x\<^sup>2 + 131 * x + 3) * (x - 1) / (x * (x ^ 3 + 12 * x\<^sup>2 + 18 * x + 4))
[PROOF STEP]
by (simp add: zero_less_mult_iff add_pos_pos dual_order.strict_implies_not_eq divide_simps)
     algebra


[STATEMENT]
lemma proots_card_ball_plane_eq:
  defines "q1\<equiv>[:\<i>,-1:]" and "q2\<equiv>[:\<i>,1:]"
  assumes "p\<noteq>0"
  shows "card (proots_within p (ball 0 1)) = card (proots_within (fcompose p q1 q2) {x. 0 < Im x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within p (ball 0 1)) = card (proots_within (fcompose p q1 q2) {x. 0 < Im x})
[PROOF STEP]
unfolding q1_def q2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within p (ball 0 1)) = card (proots_within (fcompose p [:\<i>, - 1:] [:\<i>, 1:]) {x. 0 < Im x})
[PROOF STEP]
proof (rule proots_card_fcompose_bij_eq[OF _ \<open>p\<noteq>0\<close>])
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. bij_betw (\<lambda>x. poly [:\<i>, - 1:] x / poly [:\<i>, 1:] x) {x. 0 < Im x} (ball 0 1)
 2. \<forall>x\<in>{x. 0 < Im x}. poly [:\<i>, 1:] x \<noteq> 0
 3. max (degree [:\<i>, - 1:]) (degree [:\<i>, 1:]) \<le> 1
 4. \<forall>c. [:\<i>, - 1:] \<noteq> smult c [:\<i>, 1:]
 5. infinite UNIV
[PROOF STEP]
show "\<forall>x\<in>{x. 0 < Im x}. poly [:\<i>, 1:] x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{x. 0 < Im x}. poly [:\<i>, 1:] x \<noteq> 0
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. 0 < Im x \<longrightarrow> \<i> + x \<noteq> 0
[PROOF STEP]
by (metis add_less_same_cancel2 imaginary_unit.simps(2) not_one_less_zero
          plus_complex.simps(2) zero_complex.simps(2))
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>{x. 0 < Im x}. poly [:\<i>, 1:] x \<noteq> 0

goal (4 subgoals):
 1. bij_betw (\<lambda>x. poly [:\<i>, - 1:] x / poly [:\<i>, 1:] x) {x. 0 < Im x} (ball 0 1)
 2. max (degree [:\<i>, - 1:]) (degree [:\<i>, 1:]) \<le> 1
 3. \<forall>c. [:\<i>, - 1:] \<noteq> smult c [:\<i>, 1:]
 4. infinite UNIV
[PROOF STEP]
qed (use bij_betw_plane_ball infinite_UNIV_char_0 in auto)


[STATEMENT]
theorem sigma_Inter:
  "(\<And>i::nat. a i \<in> sigma A) \<Longrightarrow> (\<Inter>i. a i) \<in> sigma A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. a i \<in> sigma A) \<Longrightarrow> \<Inter> (range a) \<in> sigma A
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. a i \<in> sigma A) \<Longrightarrow> \<Inter> (range a) \<in> sigma A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>i. a i \<in> sigma A) \<Longrightarrow> \<Inter> (range a) \<in> sigma A
[PROOF STEP]
assume "\<And>i::nat. a i \<in> sigma A"
[PROOF STATE]
proof (state)
this:
a ?i \<in> sigma A

goal (1 subgoal):
 1. (\<And>i. a i \<in> sigma A) \<Longrightarrow> \<Inter> (range a) \<in> sigma A
[PROOF STEP]
hence "\<And>i::nat. -(a i) \<in> sigma A"
[PROOF STATE]
proof (prove)
using this:
a ?i \<in> sigma A

goal (1 subgoal):
 1. \<And>i. - a i \<in> sigma A
[PROOF STEP]
by (rule sigma.complement)
[PROOF STATE]
proof (state)
this:
- a ?i \<in> sigma A

goal (1 subgoal):
 1. (\<And>i. a i \<in> sigma A) \<Longrightarrow> \<Inter> (range a) \<in> sigma A
[PROOF STEP]
hence "(\<Union>i. -(a i)) \<in> sigma A"
[PROOF STATE]
proof (prove)
using this:
- a ?i \<in> sigma A

goal (1 subgoal):
 1. (\<Union>i. - a i) \<in> sigma A
[PROOF STEP]
by (rule sigma.Union)
[PROOF STATE]
proof (state)
this:
(\<Union>i. - a i) \<in> sigma A

goal (1 subgoal):
 1. (\<And>i. a i \<in> sigma A) \<Longrightarrow> \<Inter> (range a) \<in> sigma A
[PROOF STEP]
hence "-(\<Union>i. -(a i)) \<in> sigma A"
[PROOF STATE]
proof (prove)
using this:
(\<Union>i. - a i) \<in> sigma A

goal (1 subgoal):
 1. - (\<Union>i. - a i) \<in> sigma A
[PROOF STEP]
by (rule sigma.complement)
[PROOF STATE]
proof (state)
this:
- (\<Union>i. - a i) \<in> sigma A

goal (1 subgoal):
 1. (\<And>i. a i \<in> sigma A) \<Longrightarrow> \<Inter> (range a) \<in> sigma A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- (\<Union>i. - a i) \<in> sigma A

goal (1 subgoal):
 1. (\<And>i. a i \<in> sigma A) \<Longrightarrow> \<Inter> (range a) \<in> sigma A
[PROOF STEP]
have "-(\<Union>i. -(a i)) = (\<Inter>i. a i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (\<Union>i. - a i) = \<Inter> (range a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- (\<Union>i. - a i) = \<Inter> (range a)

goal (1 subgoal):
 1. (\<And>i. a i \<in> sigma A) \<Longrightarrow> \<Inter> (range a) \<in> sigma A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Inter> (range a) \<in> sigma A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Inter> (range a) \<in> sigma A

goal (1 subgoal):
 1. \<Inter> (range a) \<in> sigma A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<Inter> (range a) \<in> sigma A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integer_winding_number_eq:
  assumes \<gamma>: "path \<gamma>" and z: "z \<notin> path_image \<gamma>"
  shows "winding_number \<gamma> z \<in> \<int> \<longleftrightarrow> pathfinish \<gamma> = pathstart \<gamma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (winding_number \<gamma> z \<in> \<int>) = (pathfinish \<gamma> = pathstart \<gamma>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (winding_number \<gamma> z \<in> \<int>) = (pathfinish \<gamma> = pathstart \<gamma>)
[PROOF STEP]
obtain p where p: "valid_path p" "z \<notin> path_image p"
                    "pathstart p = pathstart \<gamma>" "pathfinish p = pathfinish \<gamma>"
           and eq: "contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. \<lbrakk>valid_path p; z \<notin> path_image p; pathstart p = pathstart \<gamma>; pathfinish p = pathfinish \<gamma>; contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using winding_number [OF assms, of 1]
[PROOF STATE]
proof (prove)
using this:
0 < 1 \<Longrightarrow> \<exists>p. winding_number_prop \<gamma> z 1 p (winding_number \<gamma> z)

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>valid_path p; z \<notin> path_image p; pathstart p = pathstart \<gamma>; pathfinish p = pathfinish \<gamma>; contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding winding_number_prop_def
[PROOF STATE]
proof (prove)
using this:
0 < 1 \<Longrightarrow> \<exists>p. valid_path p \<and> z \<notin> path_image p \<and> pathstart p = pathstart \<gamma> \<and> pathfinish p = pathfinish \<gamma> \<and> (\<forall>t\<in>{0..1}. cmod (\<gamma> t - p t) < 1) \<and> contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>valid_path p; z \<notin> path_image p; pathstart p = pathstart \<gamma>; pathfinish p = pathfinish \<gamma>; contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
valid_path p
z \<notin> path_image p
pathstart p = pathstart \<gamma>
pathfinish p = pathfinish \<gamma>
contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z

goal (1 subgoal):
 1. (winding_number \<gamma> z \<in> \<int>) = (pathfinish \<gamma> = pathstart \<gamma>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
valid_path p
z \<notin> path_image p
pathstart p = pathstart \<gamma>
pathfinish p = pathfinish \<gamma>
contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z
[PROOF STEP]
have wneq: "winding_number \<gamma> z = winding_number p z"
[PROOF STATE]
proof (prove)
using this:
valid_path p
z \<notin> path_image p
pathstart p = pathstart \<gamma>
pathfinish p = pathfinish \<gamma>
contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z

goal (1 subgoal):
 1. winding_number \<gamma> z = winding_number p z
[PROOF STEP]
using eq winding_number_valid_path
[PROOF STATE]
proof (prove)
using this:
valid_path p
z \<notin> path_image p
pathstart p = pathstart \<gamma>
pathfinish p = pathfinish \<gamma>
contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z
contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z
\<lbrakk>valid_path ?\<gamma>; ?z \<notin> path_image ?\<gamma>\<rbrakk> \<Longrightarrow> winding_number ?\<gamma> ?z = 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral ?\<gamma> (\<lambda>w. 1 / (w - ?z))

goal (1 subgoal):
 1. winding_number \<gamma> z = winding_number p z
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
winding_number \<gamma> z = winding_number p z

goal (1 subgoal):
 1. (winding_number \<gamma> z \<in> \<int>) = (pathfinish \<gamma> = pathstart \<gamma>)
[PROOF STEP]
have iff: "(winding_number \<gamma> z \<in> \<int>) \<longleftrightarrow> (exp (contour_integral p (\<lambda>w. 1 / (w - z))) = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (winding_number \<gamma> z \<in> \<int>) = (exp (contour_integral p (\<lambda>w. 1 / (w - z))) = 1)
[PROOF STEP]
using eq
[PROOF STATE]
proof (prove)
using this:
contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z

goal (1 subgoal):
 1. (winding_number \<gamma> z \<in> \<int>) = (exp (contour_integral p (\<lambda>w. 1 / (w - z))) = 1)
[PROOF STEP]
by (simp add: exp_eq_1 complex_is_Int_iff)
[PROOF STATE]
proof (state)
this:
(winding_number \<gamma> z \<in> \<int>) = (exp (contour_integral p (\<lambda>w. 1 / (w - z))) = 1)

goal (1 subgoal):
 1. (winding_number \<gamma> z \<in> \<int>) = (pathfinish \<gamma> = pathstart \<gamma>)
[PROOF STEP]
have "\<gamma> 0 \<noteq> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<gamma> 0 \<noteq> z
[PROOF STEP]
by (metis pathstart_def pathstart_in_path_image z)
[PROOF STATE]
proof (state)
this:
\<gamma> 0 \<noteq> z

goal (1 subgoal):
 1. (winding_number \<gamma> z \<in> \<int>) = (pathfinish \<gamma> = pathstart \<gamma>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<gamma> 0 \<noteq> z
[PROOF STEP]
have "exp (contour_integral p (\<lambda>w. 1 / (w - z))) = (\<gamma> 1 - z) / (\<gamma> 0 - z)"
[PROOF STATE]
proof (prove)
using this:
\<gamma> 0 \<noteq> z

goal (1 subgoal):
 1. exp (contour_integral p (\<lambda>w. 1 / (w - z))) = (\<gamma> 1 - z) / (\<gamma> 0 - z)
[PROOF STEP]
using p winding_number_exp_integral(2) [of p 0 1 z]
[PROOF STATE]
proof (prove)
using this:
\<gamma> 0 \<noteq> z
valid_path p
z \<notin> path_image p
pathstart p = pathstart \<gamma>
pathfinish p = pathfinish \<gamma>
\<lbrakk>p piecewise_C1_differentiable_on {0..1}; 0 \<le> 1; z \<notin> p ` {0..1}\<rbrakk> \<Longrightarrow> exp (- integral {0..1} (\<lambda>x. vector_derivative p (at x) / (p x - z))) * (p 1 - z) = p 0 - z

goal (1 subgoal):
 1. exp (contour_integral p (\<lambda>w. 1 / (w - z))) = (\<gamma> 1 - z) / (\<gamma> 0 - z)
[PROOF STEP]
by (simp add: valid_path_def path_defs contour_integral_integral exp_minus field_split_simps)
[PROOF STATE]
proof (state)
this:
exp (contour_integral p (\<lambda>w. 1 / (w - z))) = (\<gamma> 1 - z) / (\<gamma> 0 - z)

goal (1 subgoal):
 1. (winding_number \<gamma> z \<in> \<int>) = (pathfinish \<gamma> = pathstart \<gamma>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
exp (contour_integral p (\<lambda>w. 1 / (w - z))) = (\<gamma> 1 - z) / (\<gamma> 0 - z)
[PROOF STEP]
have "winding_number p z \<in> \<int> \<longleftrightarrow> pathfinish p = pathstart p"
[PROOF STATE]
proof (prove)
using this:
exp (contour_integral p (\<lambda>w. 1 / (w - z))) = (\<gamma> 1 - z) / (\<gamma> 0 - z)

goal (1 subgoal):
 1. (winding_number p z \<in> \<int>) = (pathfinish p = pathstart p)
[PROOF STEP]
using p wneq iff
[PROOF STATE]
proof (prove)
using this:
exp (contour_integral p (\<lambda>w. 1 / (w - z))) = (\<gamma> 1 - z) / (\<gamma> 0 - z)
valid_path p
z \<notin> path_image p
pathstart p = pathstart \<gamma>
pathfinish p = pathfinish \<gamma>
winding_number \<gamma> z = winding_number p z
(winding_number \<gamma> z \<in> \<int>) = (exp (contour_integral p (\<lambda>w. 1 / (w - z))) = 1)

goal (1 subgoal):
 1. (winding_number p z \<in> \<int>) = (pathfinish p = pathstart p)
[PROOF STEP]
by (auto simp: path_defs)
[PROOF STATE]
proof (state)
this:
(winding_number p z \<in> \<int>) = (pathfinish p = pathstart p)

goal (1 subgoal):
 1. (winding_number \<gamma> z \<in> \<int>) = (pathfinish \<gamma> = pathstart \<gamma>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(winding_number p z \<in> \<int>) = (pathfinish p = pathstart p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(winding_number p z \<in> \<int>) = (pathfinish p = pathstart p)

goal (1 subgoal):
 1. (winding_number \<gamma> z \<in> \<int>) = (pathfinish \<gamma> = pathstart \<gamma>)
[PROOF STEP]
using p eq
[PROOF STATE]
proof (prove)
using this:
(winding_number p z \<in> \<int>) = (pathfinish p = pathstart p)
valid_path p
z \<notin> path_image p
pathstart p = pathstart \<gamma>
pathfinish p = pathfinish \<gamma>
contour_integral p (\<lambda>w. 1 / (w - z)) = complex_of_real (2 * pi) * \<i> * winding_number \<gamma> z

goal (1 subgoal):
 1. (winding_number \<gamma> z \<in> \<int>) = (pathfinish \<gamma> = pathstart \<gamma>)
[PROOF STEP]
by (auto simp: winding_number_valid_path)
[PROOF STATE]
proof (state)
this:
(winding_number \<gamma> z \<in> \<int>) = (pathfinish \<gamma> = pathstart \<gamma>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iter_tensor_of_H_fst_neg:
  fixes n i j:: nat
  assumes "i \<ge> 2^n \<and> j \<ge> 2^n" and "i < 2^(n+1) \<and> j < 2^(n+1)"
  shows "(H^\<^sub>\<otimes> (Suc n)) $$ (i,j) = -1/sqrt(2) * (H^\<^sub>\<otimes> n) $$ (i mod 2^n, j mod 2^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (- 1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (- 1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)
[PROOF STEP]
have "(H^\<^sub>\<otimes> (Suc n)) $$ (i,j) = (-1)^(bip i (n+1) j)/(sqrt 2)^(n+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real ((- 1) ^ i \<cdot>\<^bsub>n + 1\<^esub>  j / sqrt 2 ^ (n + 1))
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
i < 2 ^ (n + 1) \<and> j < 2 ^ (n + 1)

goal (1 subgoal):
 1. Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real ((- 1) ^ i \<cdot>\<^bsub>n + 1\<^esub>  j / sqrt 2 ^ (n + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real ((- 1) ^ i \<cdot>\<^bsub>n + 1\<^esub>  j / sqrt 2 ^ (n + 1))

goal (1 subgoal):
 1. Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (- 1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real ((- 1) ^ i \<cdot>\<^bsub>n + 1\<^esub>  j / sqrt 2 ^ (n + 1))

goal (1 subgoal):
 1. Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (- 1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)
[PROOF STEP]
have "bip i (n+1) j = 1 + bip (i mod 2^n) n (j mod 2^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<cdot>\<^bsub>n + 1\<^esub>  j = 1 + i mod 2 ^ n \<cdot>\<^bsub>n\<^esub>  j mod 2 ^ n
[PROOF STEP]
using bitwise_inner_prod_fst_el_is_1 assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>2 ^ ?n \<le> ?i \<and> 2 ^ ?n \<le> ?j; ?i < 2 ^ (?n + 1) \<and> ?j < 2 ^ (?n + 1)\<rbrakk> \<Longrightarrow> ?i \<cdot>\<^bsub>?n + 1\<^esub>  ?j = 1 + ?i mod 2 ^ ?n \<cdot>\<^bsub>?n\<^esub>  ?j mod 2 ^ ?n
2 ^ n \<le> i \<and> 2 ^ n \<le> j
i < 2 ^ (n + 1) \<and> j < 2 ^ (n + 1)

goal (1 subgoal):
 1. i \<cdot>\<^bsub>n + 1\<^esub>  j = 1 + i mod 2 ^ n \<cdot>\<^bsub>n\<^esub>  j mod 2 ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i \<cdot>\<^bsub>n + 1\<^esub>  j = 1 + i mod 2 ^ n \<cdot>\<^bsub>n\<^esub>  j mod 2 ^ n

goal (1 subgoal):
 1. Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (- 1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real ((- 1) ^ i \<cdot>\<^bsub>n + 1\<^esub>  j / sqrt 2 ^ (n + 1))
i \<cdot>\<^bsub>n + 1\<^esub>  j = 1 + i mod 2 ^ n \<cdot>\<^bsub>n\<^esub>  j mod 2 ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real ((- 1) ^ i \<cdot>\<^bsub>n + 1\<^esub>  j / sqrt 2 ^ (n + 1))
i \<cdot>\<^bsub>n + 1\<^esub>  j = 1 + i mod 2 ^ n \<cdot>\<^bsub>n\<^esub>  j mod 2 ^ n

goal (1 subgoal):
 1. Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (- 1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Matrix.mat (2 ^ Suc n) (2 ^ Suc n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>Suc n\<^esub>  j / sqrt 2 ^ Suc n)) $$ (i, j) = complex_of_real (- 1 / sqrt 2) * Matrix.mat (2 ^ n) (2 ^ n) (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> (- 1) ^ i \<cdot>\<^bsub>n\<^esub>  j / sqrt 2 ^ n)) $$ (i mod 2 ^ n, j mod 2 ^ n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_poly_times:
  assumes "f 0 = 0" and "\<And>a b. f (a + b) = f a + f b" and "\<And>a b. f (a * b) = f a * f b"
  shows "map_poly f (p * q) = map_poly f p * map_poly f q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly f (p * q) = map_poly f p * map_poly f q
[PROOF STEP]
proof (induct p)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. map_poly f (0 * q) = map_poly f 0 * map_poly f q
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'b) \<or> p \<noteq> 0; map_poly f (p * q) = map_poly f p * map_poly f q\<rbrakk> \<Longrightarrow> map_poly f (pCons a p * q) = map_poly f (pCons a p) * map_poly f q
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. map_poly f (0 * q) = map_poly f 0 * map_poly f q
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'b) \<or> p \<noteq> 0; map_poly f (p * q) = map_poly f p * map_poly f q\<rbrakk> \<Longrightarrow> map_poly f (pCons a p * q) = map_poly f (pCons a p) * map_poly f q
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly f (0 * q) = map_poly f 0 * map_poly f q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map_poly f (0 * q) = map_poly f 0 * map_poly f q

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'b) \<or> p \<noteq> 0; map_poly f (p * q) = map_poly f p * map_poly f q\<rbrakk> \<Longrightarrow> map_poly f (pCons a p * q) = map_poly f (pCons a p) * map_poly f q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'b) \<or> p \<noteq> 0; map_poly f (p * q) = map_poly f p * map_poly f q\<rbrakk> \<Longrightarrow> map_poly f (pCons a p * q) = map_poly f (pCons a p) * map_poly f q
[PROOF STEP]
case (pCons c p)
[PROOF STATE]
proof (state)
this:
c \<noteq> (0::'b) \<or> p \<noteq> 0
map_poly f (p * q) = map_poly f p * map_poly f q

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'b) \<or> p \<noteq> 0; map_poly f (p * q) = map_poly f p * map_poly f q\<rbrakk> \<Longrightarrow> map_poly f (pCons a p * q) = map_poly f (pCons a p) * map_poly f q
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly f (pCons c p * q) = map_poly f (pCons c p) * map_poly f q
[PROOF STEP]
by (simp add: assms map_poly_plus map_poly_smult map_poly_pCons pCons)
[PROOF STATE]
proof (state)
this:
map_poly f (pCons c p * q) = map_poly f (pCons c p) * map_poly f q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem bf_ifex_rel_single: "single_valued bf_ifex_rel" "single_valued (bf_ifex_rel\<inverse>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. single_valued bf_ifex_rel &&& single_valued (bf_ifex_rel\<inverse>)
[PROOF STEP]
unfolding single_valued_def bf_ifex_rel_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. (x, y) \<in> {(a, b). (\<forall>ass. a ass = val_ifex b ass) \<and> ro_ifex b} \<longrightarrow> (\<forall>z. (x, z) \<in> {(a, b). (\<forall>ass. a ass = val_ifex b ass) \<and> ro_ifex b} \<longrightarrow> y = z) &&& \<forall>x y. (x, y) \<in> {(a, b). (\<forall>ass. a ass = val_ifex b ass) \<and> ro_ifex b}\<inverse> \<longrightarrow> (\<forall>z. (x, z) \<in> {(a, b). (\<forall>ass. a ass = val_ifex b ass) \<and> ro_ifex b}\<inverse> \<longrightarrow> y = z)
[PROOF STEP]
using ro_ifex_unique
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>ro_ifex ?x; ro_ifex ?y; \<And>ass. val_ifex ?x ass = val_ifex ?y ass\<rbrakk> \<Longrightarrow> ?x = ?y

goal (1 subgoal):
 1. \<forall>x y. (x, y) \<in> {(a, b). (\<forall>ass. a ass = val_ifex b ass) \<and> ro_ifex b} \<longrightarrow> (\<forall>z. (x, z) \<in> {(a, b). (\<forall>ass. a ass = val_ifex b ass) \<and> ro_ifex b} \<longrightarrow> y = z) &&& \<forall>x y. (x, y) \<in> {(a, b). (\<forall>ass. a ass = val_ifex b ass) \<and> ro_ifex b}\<inverse> \<longrightarrow> (\<forall>z. (x, z) \<in> {(a, b). (\<forall>ass. a ass = val_ifex b ass) \<and> ro_ifex b}\<inverse> \<longrightarrow> y = z)
[PROOF STEP]
by auto


[STATEMENT]
lemma Inf_pres_downset_var: "(\<Inter>x \<in> X. \<down>x) = \<down>(\<Sqinter>X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> (\<down> ` X) = \<down> (\<Sqinter> X)
[PROOF STEP]
unfolding downset_prop
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>x\<in>X. {y. y \<le> x}) = {y. y \<le> \<Sqinter> X}
[PROOF STEP]
by (safe, simp_all add: le_Inf_iff)


[STATEMENT]
lemma rsum_component_le:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes p: "p tagged_division_of (cbox a b)"
      and "\<And>x. x \<in> cbox a b \<Longrightarrow> (f x)\<bullet>i \<le> (g x)\<bullet>i"
    shows "(\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) \<bullet> i \<le> (\<Sum>(x, K)\<in>p. content K *\<^sub>R g x) \<bullet> i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(x, K)\<in>p. content K *\<^sub>R f x) \<bullet> i \<le> (\<Sum>(x, K)\<in>p. content K *\<^sub>R g x) \<bullet> i
[PROOF STEP]
unfolding inner_sum_left
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>p. (case x of (x, K) \<Rightarrow> content K *\<^sub>R f x) \<bullet> i) \<le> (\<Sum>x\<in>p. (case x of (x, K) \<Rightarrow> content K *\<^sub>R g x) \<bullet> i)
[PROOF STEP]
proof (rule sum_mono, clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> p \<Longrightarrow> content b *\<^sub>R f a \<bullet> i \<le> content b *\<^sub>R g a \<bullet> i
[PROOF STEP]
fix x K
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> p \<Longrightarrow> content b *\<^sub>R f a \<bullet> i \<le> content b *\<^sub>R g a \<bullet> i
[PROOF STEP]
assume ab: "(x, K) \<in> p"
[PROOF STATE]
proof (state)
this:
(x, K) \<in> p

goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> p \<Longrightarrow> content b *\<^sub>R f a \<bullet> i \<le> content b *\<^sub>R g a \<bullet> i
[PROOF STEP]
with p
[PROOF STATE]
proof (chain)
picking this:
p tagged_division_of cbox a b
(x, K) \<in> p
[PROOF STEP]
obtain u v where K: "K = cbox u v"
[PROOF STATE]
proof (prove)
using this:
p tagged_division_of cbox a b
(x, K) \<in> p

goal (1 subgoal):
 1. (\<And>u v. K = cbox u v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
K = cbox u v

goal (1 subgoal):
 1. \<And>a b. (a, b) \<in> p \<Longrightarrow> content b *\<^sub>R f a \<bullet> i \<le> content b *\<^sub>R g a \<bullet> i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
K = cbox u v
[PROOF STEP]
show "(content K *\<^sub>R f x) \<bullet> i \<le> (content K *\<^sub>R g x) \<bullet> i"
[PROOF STATE]
proof (prove)
using this:
K = cbox u v

goal (1 subgoal):
 1. content K *\<^sub>R f x \<bullet> i \<le> content K *\<^sub>R g x \<bullet> i
[PROOF STEP]
by (metis ab assms inner_scaleR_left measure_nonneg mult_left_mono tag_in_interval)
[PROOF STATE]
proof (state)
this:
content K *\<^sub>R f x \<bullet> i \<le> content K *\<^sub>R g x \<bullet> i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sums_logderiv_zeta:
  assumes "Re s > 1"
  shows   "(\<lambda>p. if prime p then of_real (ln (real p)) / (of_nat p powr s - 1) else 0) sums
             -(deriv zeta s / zeta s)" (is "?f sums _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>p. if prime p then complex_of_real (ln (real p)) / (of_nat p powr s - 1) else 0) sums - (deriv zeta s / zeta s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>p. if prime p then complex_of_real (ln (real p)) / (of_nat p powr s - 1) else 0) sums - (deriv zeta s / zeta s)
[PROOF STEP]
note * = eval_fds_logderiv_zeta[OF assms]
[PROOF STATE]
proof (state)
this:
(\<lambda>p. complex_of_real (ln (real p)) / (of_nat p powr s - 1)) abs_summable_on {p. prime p}
deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))

goal (1 subgoal):
 1. (\<lambda>p. if prime p then complex_of_real (ln (real p)) / (of_nat p powr s - 1) else 0) sums - (deriv zeta s / zeta s)
[PROOF STEP]
from sums_infsetsum_nat[OF *(1)] and *(2)
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. if n \<in> {p. prime p} then complex_of_real (ln (real n)) / (of_nat n powr s - 1) else 0) sums (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. if n \<in> {p. prime p} then complex_of_real (ln (real n)) / (of_nat n powr s - 1) else 0) sums (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))
deriv zeta s / zeta s = - (\<Sum>\<^sub>ap | prime p. complex_of_real (ln (real p)) / (of_nat p powr s - 1))

goal (1 subgoal):
 1. (\<lambda>p. if prime p then complex_of_real (ln (real p)) / (of_nat p powr s - 1) else 0) sums - (deriv zeta s / zeta s)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>p. if prime p then complex_of_real (ln (real p)) / (of_nat p powr s - 1) else 0) sums - (deriv zeta s / zeta s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gen_fib_recurrence: "gen_fib a b (Suc (Suc n)) = gen_fib a b n + gen_fib a b (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gen_fib a b (Suc (Suc n)) = gen_fib a b n + gen_fib a b (Suc n)
[PROOF STEP]
by (induct a b n rule: gen_fib.induct) simp_all


[STATEMENT]
lemma dist_vector_1:
  fixes x :: "'a::real_normed_vector^1"
  shows "dist x y = dist (x$1) (y$1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x y = dist (x $ 1) (y $ 1)
[PROOF STEP]
by (simp add: dist_norm norm_vector_1)


[STATEMENT]
lemma diag_PAQ_dvd_Gcd_minors:
  fixes P A Q::"'a::{semiring_Gcd,comm_ring_1} mat"
 assumes A: "A \<in> carrier_mat m n"
    and P: "P \<in> carrier_mat m m"
    and Q: "Q \<in> carrier_mat n n"
    and inv_P: "invertible_mat P"
    and inv_Q: "invertible_mat Q"
    and SNF: "Smith_normal_form_mat (P*A*Q)"
  shows "(\<Prod>i=0..<k. (P * A * Q) $$ (i,i)) dvd Gcd (minors A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i)) dvd Gcd (minors A k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i)) dvd Gcd (minors A k)
[PROOF STEP]
have "(\<Prod>i=0..<k. (P*A*Q) $$ (i,i)) dvd Gcd (minors (P * A * Q) k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i)) dvd Gcd (minors (P * A * Q) k)
[PROOF STEP]
by (rule diagonal_dvd_Gcd_minors[OF _ SNF], auto)
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<k. (P * A * Q) $$ (i, i)) dvd Gcd (minors (P * A * Q) k)

goal (1 subgoal):
 1. (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i)) dvd Gcd (minors A k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<k. (P * A * Q) $$ (i, i)) dvd Gcd (minors (P * A * Q) k)

goal (1 subgoal):
 1. (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i)) dvd Gcd (minors A k)
[PROOF STEP]
have "... dvd Gcd (minors A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gcd (minors (P * A * Q) k) dvd Gcd (minors A k)
[PROOF STEP]
by (rule Gcd_minors_PAQ_dvd_Gcd_minors_A[OF _ _ _ inv_P inv_Q], insert P A Q, auto)
[PROOF STATE]
proof (state)
this:
Gcd (minors (P * A * Q) k) dvd Gcd (minors A k)

goal (1 subgoal):
 1. (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i)) dvd Gcd (minors A k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>i = 0..<k. (P * A * Q) $$ (i, i)) dvd Gcd (minors A k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Prod>i = 0..<k. (P * A * Q) $$ (i, i)) dvd Gcd (minors A k)

goal (1 subgoal):
 1. (\<Prod>i = 0..<k. (P * A * Q) $$ (i, i)) dvd Gcd (minors A k)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<k. (P * A * Q) $$ (i, i)) dvd Gcd (minors A k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma imult_is_0: "((m::enat) * n = 0) = (m = 0 \<or> n = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (m * n = 0) = (m = 0 \<or> n = 0)
[PROOF STEP]
by (rule mult_eq_0_iff)


[STATEMENT]
theorem set_vebt_maxt: "invar_vebt t n \<Longrightarrow> vebt_maxt t = Some x \<longleftrightarrow> max_in_set (set_vebt t) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar_vebt t n \<Longrightarrow> (vebt_maxt t = Some x) = max_in_set (set_vebt t) x
[PROOF STEP]
by (metis maxt_sound maxt_corr set_vebt_set_vebt'_valid)


[STATEMENT]
lemma ld_ld_1_less:
  "\<lbrakk>x > 0; y > 0 \<rbrakk> \<Longrightarrow> 1 + log 2 x + log 2 y < 2 * log 2 (x+y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; 0 < y\<rbrakk> \<Longrightarrow> 1 + log 2 x + log 2 y < 2 * log 2 (x + y)
[PROOF STEP]
using ld_sum_inequality[of x y]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < x; 0 < y\<rbrakk> \<Longrightarrow> log 2 x + log 2 y + 2 \<le> 2 * log 2 (x + y)

goal (1 subgoal):
 1. \<lbrakk>0 < x; 0 < y\<rbrakk> \<Longrightarrow> 1 + log 2 x + log 2 y < 2 * log 2 (x + y)
[PROOF STEP]
by linarith


[STATEMENT]
lemma NSDERIV_inverse_fun:
  "NSDERIV f x :> d \<Longrightarrow> f x \<noteq> 0 \<Longrightarrow>
    NSDERIV (\<lambda>x. inverse (f x)) x :> (- (d * inverse (f x ^ Suc (Suc 0))))"
  for x :: "'a::{real_normed_field}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>NSDERIV f x :> d; f x \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> NSDERIV (\<lambda>x. inverse (f x)) x :> - (d * inverse (f x ^ Suc (Suc 0)))
[PROOF STEP]
by (simp add: NSDERIV_DERIV_iff DERIV_inverse_fun del: power_Suc)


[STATEMENT]
lemma homotopic_loops_linear:
  fixes g h :: "real \<Rightarrow> 'a::real_normed_vector"
  assumes "path g" "path h" "pathfinish g = pathstart g" "pathfinish h = pathstart h"
          "\<And>t x. t \<in> {0..1} \<Longrightarrow> closed_segment (g t) (h t) \<subseteq> S"
    shows "homotopic_loops S g h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homotopic_loops S g h
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
path g
path h
pathfinish g = pathstart g
pathfinish h = pathstart h
?t \<in> {0..1} \<Longrightarrow> closed_segment (g ?t) (h ?t) \<subseteq> S

goal (1 subgoal):
 1. homotopic_loops S g h
[PROOF STEP]
unfolding path_defs homotopic_loops_def homotopic_with_def
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} g
continuous_on {0..1} h
g 1 = g 0
h 1 = h 0
?t \<in> {0..1} \<Longrightarrow> closed_segment (g ?t) (h ?t) \<subseteq> S

goal (1 subgoal):
 1. \<exists>ha. continuous_map (prod_topology (top_of_set {0..1}) (top_of_set {0..1})) (top_of_set S) ha \<and> (\<forall>x. ha (0, x) = g x) \<and> (\<forall>x. ha (1, x) = h x) \<and> (\<forall>t\<in>{0..1}. ha (t, 1) = ha (t, 0))
[PROOF STEP]
apply (rule_tac x="\<lambda>y. ((1 - (fst y)) *\<^sub>R g(snd y) + (fst y) *\<^sub>R h(snd y))" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on {0..1} g; continuous_on {0..1} h; g 1 = g 0; h 1 = h 0; \<And>t. t \<in> {0..1} \<Longrightarrow> closed_segment (g t) (h t) \<subseteq> S\<rbrakk> \<Longrightarrow> continuous_map (prod_topology (top_of_set {0..1}) (top_of_set {0..1})) (top_of_set S) (\<lambda>y. (1 - fst y) *\<^sub>R g (snd y) + fst y *\<^sub>R h (snd y)) \<and> (\<forall>x. (1 - fst (0, x)) *\<^sub>R g (snd (0, x)) + fst (0, x) *\<^sub>R h (snd (0, x)) = g x) \<and> (\<forall>x. (1 - fst (1, x)) *\<^sub>R g (snd (1, x)) + fst (1, x) *\<^sub>R h (snd (1, x)) = h x) \<and> (\<forall>t\<in>{0..1}. (1 - fst (t, 1)) *\<^sub>R g (snd (t, 1)) + fst (t, 1) *\<^sub>R h (snd (t, 1)) = (1 - fst (t, 0)) *\<^sub>R g (snd (t, 0)) + fst (t, 0) *\<^sub>R h (snd (t, 0)))
[PROOF STEP]
by (force simp: closed_segment_def intro!: continuous_intros intro: continuous_on_compose2 [where g=g] continuous_on_compose2 [where g=h])


[STATEMENT]
lemma mset_bubblesort:
  "mset (bubblesort xs) = mset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (bubblesort xs) = mset xs
[PROOF STEP]
apply(induction xs rule: bubblesort.induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. mset (bubblesort []) = mset []
 2. \<And>x. mset (bubblesort [x]) = mset [x]
 3. \<And>v vb vc. (\<And>x21 x22. bubble_min (v # vb # vc) = x21 # x22 \<Longrightarrow> mset (bubblesort x22) = mset x22) \<Longrightarrow> mset (bubblesort (v # vb # vc)) = mset (v # vb # vc)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. mset (bubblesort [x]) = mset [x]
 2. \<And>v vb vc. (\<And>x21 x22. bubble_min (v # vb # vc) = x21 # x22 \<Longrightarrow> mset (bubblesort x22) = mset x22) \<Longrightarrow> mset (bubblesort (v # vb # vc)) = mset (v # vb # vc)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v vb vc. (\<And>x21 x22. bubble_min (v # vb # vc) = x21 # x22 \<Longrightarrow> mset (bubblesort x22) = mset x22) \<Longrightarrow> mset (bubblesort (v # vb # vc)) = mset (v # vb # vc)
[PROOF STEP]
by(auto split: list.splits if_splits dest: bubble_minD_mset)


[STATEMENT]
lemma inj_on_mult_units:
  assumes 1: "coprime x (q::nat)" shows "inj_on (\<lambda> b. x*b mod q) ({..<q} - {0})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>b. x * b mod q) ({..<q} - {0})
[PROOF STEP]
apply(auto simp add: inj_on_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa y. \<lbrakk>xa < q; 0 < xa; y < q; x * xa mod q = x * y mod q; 0 < y\<rbrakk> \<Longrightarrow> xa = y
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
coprime x q

goal (1 subgoal):
 1. \<And>xa y. \<lbrakk>xa < q; 0 < xa; y < q; x * xa mod q = x * y mod q; 0 < y\<rbrakk> \<Longrightarrow> xa = y
[PROOF STEP]
by(simp only: inj_mult)


[STATEMENT]
theorem interval_integral_substitution:
  assumes integrable: "set_integrable lborel {g a..g b} f"
  assumes derivg: "\<And>x. x \<in> {a..b} \<Longrightarrow> (g has_real_derivative g' x) (at x)"
  assumes contg': "continuous_on {a..b} g'"
  assumes derivg_nonneg: "\<And>x. x \<in> {a..b} \<Longrightarrow> g' x \<ge> 0"
  assumes "a \<le> b"
  shows "set_integrable lborel {a..b} (\<lambda>x. f (g x) * g' x)"
    and "(LBINT x=g a..g b. f x) = (LBINT x=a..b. f (g x) * g' x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable lborel {a..b} (\<lambda>x. f (g x) * g' x) &&& interval_lebesgue_integral lborel (ereal (g a)) (ereal (g b)) f = LBINT x=ereal a..ereal b. f (g x) * g' x
[PROOF STEP]
apply (rule integral_substitution[OF assms], simp, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval_lebesgue_integral lborel (ereal (g a)) (ereal (g b)) f = LBINT x=ereal a..ereal b. f (g x) * g' x
[PROOF STEP]
apply (subst (1 2) interval_integral_Icc, fact)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. g a \<le> g b
 2. set_lebesgue_integral lborel {g a..g b} f = LBINT x:{a..b}. f (g x) * g' x
[PROOF STEP]
apply (rule deriv_nonneg_imp_mono[OF derivg derivg_nonneg], simp, simp, fact)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_lebesgue_integral lborel {g a..g b} f = LBINT x:{a..b}. f (g x) * g' x
[PROOF STEP]
using integral_substitution(2)[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x. x \<in> {a..b} \<Longrightarrow> x \<in> {a..b}; \<And>x. x \<in> {a..b} \<Longrightarrow> x \<in> {a..b}\<rbrakk> \<Longrightarrow> LBINT x. f x * indicat_real {g a..g b} x = LBINT x. f (g x) * g' x * indicat_real {a..b} x

goal (1 subgoal):
 1. set_lebesgue_integral lborel {g a..g b} f = LBINT x:{a..b}. f (g x) * g' x
[PROOF STEP]
apply (simp add: mult.commute set_lebesgue_integral_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in prob_space) erlang_distributed_variance:
  assumes [arith]: "0 < l" and "distributed M lborel X (erlang_density k l)"
  shows "variance X = (k + 1) / l\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation (\<lambda>x. (X x - expectation X)\<^sup>2) = real (k + 1) / l\<^sup>2
[PROOF STEP]
proof (subst variance_eq)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. integrable M X
 2. integrable M (\<lambda>x. (X x)\<^sup>2)
 3. expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2 = real (k + 1) / l\<^sup>2
[PROOF STEP]
show "integrable M X" "integrable M (\<lambda>x. (X x)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M X &&& integrable M (\<lambda>x. (X x)\<^sup>2)
[PROOF STEP]
using erlang_ith_moment_integrable[OF assms, of 1] erlang_ith_moment_integrable[OF assms, of 2]
[PROOF STATE]
proof (prove)
using this:
integrable M (\<lambda>x. X x ^ 1)
integrable M (\<lambda>x. (X x)\<^sup>2)

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

goal (1 subgoal):
 1. expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2 = real (k + 1) / l\<^sup>2
[PROOF STEP]
show "expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2 = real (k + 1) / l\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2 = real (k + 1) / l\<^sup>2
[PROOF STEP]
using erlang_ith_moment[OF assms, of 1] erlang_ith_moment[OF assms, of 2]
[PROOF STATE]
proof (prove)
using this:
expectation (\<lambda>x. X x ^ 1) = fact (k + 1) / (fact k * l ^ 1)
expectation (\<lambda>x. (X x)\<^sup>2) = fact (k + 2) / (fact k * l\<^sup>2)

goal (1 subgoal):
 1. expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2 = real (k + 1) / l\<^sup>2
[PROOF STEP]
by simp (auto simp: power2_eq_square field_simps of_nat_Suc)
[PROOF STATE]
proof (state)
this:
expectation (\<lambda>x. (X x)\<^sup>2) - (expectation X)\<^sup>2 = real (k + 1) / l\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma trace_measurement2:
  assumes m: "measurement n 2 M" and dA: "A \<in> carrier_mat n n"
  shows "trace ((M 0) * A * adjoint (M 0)) + trace ((M 1) * A * adjoint (M 1)) = trace A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (M 0 * A * adjoint (M 0)) + trace (M 1 * A * adjoint (M 1)) = trace A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. trace (M 0 * A * adjoint (M 0)) + trace (M 1 * A * adjoint (M 1)) = trace A
[PROOF STEP]
from m
[PROOF STATE]
proof (chain)
picking this:
measurement n 2 M
[PROOF STEP]
have dM0: "M 0 \<in> carrier_mat n n" and dM1: "M 1 \<in> carrier_mat n n" and id: "adjoint (M 0) * (M 0) + adjoint (M 1) * (M 1) = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
using this:
measurement n 2 M

goal (1 subgoal):
 1. M 0 \<in> carrier_mat n n &&& M 1 \<in> carrier_mat n n &&& adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m n
[PROOF STEP]
using measurement_def measurement_id2
[PROOF STATE]
proof (prove)
using this:
measurement n 2 M
measurement ?d ?n ?M = ((\<forall>j<?n. ?M j \<in> carrier_mat ?d ?d) \<and> matrix_sum ?d (\<lambda>j. adjoint (?M j) * ?M j) ?n = 1\<^sub>m ?d)
measurement ?d 2 ?M \<Longrightarrow> adjoint (?M 0) * ?M 0 + adjoint (?M 1) * ?M 1 = 1\<^sub>m ?d

goal (1 subgoal):
 1. M 0 \<in> carrier_mat n n &&& M 1 \<in> carrier_mat n n &&& adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M 0 \<in> carrier_mat n n
M 1 \<in> carrier_mat n n
adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m n

goal (1 subgoal):
 1. trace (M 0 * A * adjoint (M 0)) + trace (M 1 * A * adjoint (M 1)) = trace A
[PROOF STEP]
have "trace (M 1 * A * adjoint (M 1)) + trace (M 0 * A * adjoint (M 0))
    = trace ((adjoint (M 0) * M 0 + adjoint (M 1) * M 1) * A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (M 1 * A * adjoint (M 1)) + trace (M 0 * A * adjoint (M 0)) = trace ((adjoint (M 0) * M 0 + adjoint (M 1) * M 1) * A)
[PROOF STEP]
using dM0 dM1 dA
[PROOF STATE]
proof (prove)
using this:
M 0 \<in> carrier_mat n n
M 1 \<in> carrier_mat n n
A \<in> carrier_mat n n

goal (1 subgoal):
 1. trace (M 1 * A * adjoint (M 1)) + trace (M 0 * A * adjoint (M 0)) = trace ((adjoint (M 0) * M 0 + adjoint (M 1) * M 1) * A)
[PROOF STEP]
by (mat_assoc n)
[PROOF STATE]
proof (state)
this:
trace (M 1 * A * adjoint (M 1)) + trace (M 0 * A * adjoint (M 0)) = trace ((adjoint (M 0) * M 0 + adjoint (M 1) * M 1) * A)

goal (1 subgoal):
 1. trace (M 0 * A * adjoint (M 0)) + trace (M 1 * A * adjoint (M 1)) = trace A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace (M 1 * A * adjoint (M 1)) + trace (M 0 * A * adjoint (M 0)) = trace ((adjoint (M 0) * M 0 + adjoint (M 1) * M 1) * A)

goal (1 subgoal):
 1. trace (M 0 * A * adjoint (M 0)) + trace (M 1 * A * adjoint (M 1)) = trace A
[PROOF STEP]
have "\<dots> = trace (1\<^sub>m n * A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace ((adjoint (M 0) * M 0 + adjoint (M 1) * M 1) * A) = trace (1\<^sub>m n * A)
[PROOF STEP]
using id
[PROOF STATE]
proof (prove)
using this:
adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m n

goal (1 subgoal):
 1. trace ((adjoint (M 0) * M 0 + adjoint (M 1) * M 1) * A) = trace (1\<^sub>m n * A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace ((adjoint (M 0) * M 0 + adjoint (M 1) * M 1) * A) = trace (1\<^sub>m n * A)

goal (1 subgoal):
 1. trace (M 0 * A * adjoint (M 0)) + trace (M 1 * A * adjoint (M 1)) = trace A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
trace ((adjoint (M 0) * M 0 + adjoint (M 1) * M 1) * A) = trace (1\<^sub>m n * A)

goal (1 subgoal):
 1. trace (M 0 * A * adjoint (M 0)) + trace (M 1 * A * adjoint (M 1)) = trace A
[PROOF STEP]
have "\<dots> = trace A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (1\<^sub>m n * A) = trace A
[PROOF STEP]
using dA
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n

goal (1 subgoal):
 1. trace (1\<^sub>m n * A) = trace A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (1\<^sub>m n * A) = trace A

goal (1 subgoal):
 1. trace (M 0 * A * adjoint (M 0)) + trace (M 1 * A * adjoint (M 1)) = trace A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
trace (M 1 * A * adjoint (M 1)) + trace (M 0 * A * adjoint (M 0)) = trace A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
trace (M 1 * A * adjoint (M 1)) + trace (M 0 * A * adjoint (M 0)) = trace A

goal (1 subgoal):
 1. trace (M 0 * A * adjoint (M 0)) + trace (M 1 * A * adjoint (M 1)) = trace A
[PROOF STEP]
using dA dM0 dM1 local.id state_sig.trace_measure2_id
[PROOF STATE]
proof (prove)
using this:
trace (M 1 * A * adjoint (M 1)) + trace (M 0 * A * adjoint (M 0)) = trace A
A \<in> carrier_mat n n
M 0 \<in> carrier_mat n n
M 1 \<in> carrier_mat n n
adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m n
\<lbrakk>?M0.0 \<in> carrier_mat ?n ?n; ?M1.0 \<in> carrier_mat ?n ?n; adjoint ?M0.0 * ?M0.0 + adjoint ?M1.0 * ?M1.0 = 1\<^sub>m ?n; ?A \<in> carrier_mat ?n ?n\<rbrakk> \<Longrightarrow> trace (?M0.0 * ?A * adjoint ?M0.0) + trace (?M1.0 * ?A * adjoint ?M1.0) = trace ?A

goal (1 subgoal):
 1. trace (M 0 * A * adjoint (M 0)) + trace (M 1 * A * adjoint (M 1)) = trace A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
trace (M 0 * A * adjoint (M 0)) + trace (M 1 * A * adjoint (M 1)) = trace A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arctan_series':
  assumes "\<bar>x\<bar> \<le> 1"
  shows "(\<lambda>k. (-1)^k * (1 / real (k*2+1) * x ^ (k*2+1))) sums arctan x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1))) sums arctan x
[PROOF STEP]
using summable_arctan_series[OF assms] arctan_series[OF assms]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))

goal (1 subgoal):
 1. (\<lambda>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1))) sums arctan x
[PROOF STEP]
by (simp add: sums_iff)


[STATEMENT]
lemma floor_zero [simp]: "\<lfloor>0\<rfloor> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>0::'a\<rfloor> = 0
[PROOF STEP]
using floor_of_int [of 0]
[PROOF STATE]
proof (prove)
using this:
\<lfloor>of_int 0\<rfloor> = 0

goal (1 subgoal):
 1. \<lfloor>0::'a\<rfloor> = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma (in strategic_space_2p) U\<^sub>B_cnj_times_U\<^sub>B:
  shows "U\<^sub>B\<^sup>\<dagger> * U\<^sub>B = 1\<^sub>m 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]] = 1\<^sub>m 2
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m 2); j < dim_col (1\<^sub>m 2)\<rbrakk> \<Longrightarrow> (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)
 2. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_row (1\<^sub>m 2)
 3. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_col (1\<^sub>m 2)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m 2); j < dim_col (1\<^sub>m 2)\<rbrakk> \<Longrightarrow> (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)
 2. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_row (1\<^sub>m 2)
 3. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_col (1\<^sub>m 2)
[PROOF STEP]
assume a0:"i < dim_row (1\<^sub>m 2)" and a1:"j < dim_col (1\<^sub>m 2)"
[PROOF STATE]
proof (state)
this:
i < dim_row (1\<^sub>m 2)
j < dim_col (1\<^sub>m 2)

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (1\<^sub>m 2); j < dim_col (1\<^sub>m 2)\<rbrakk> \<Longrightarrow> (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)
 2. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_row (1\<^sub>m 2)
 3. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_col (1\<^sub>m 2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < dim_row (1\<^sub>m 2)
j < dim_col (1\<^sub>m 2)
[PROOF STEP]
show "(U\<^sub>B\<^sup>\<dagger> * U\<^sub>B) $$ (i,j) = 1\<^sub>m 2 $$ (i,j)"
[PROOF STATE]
proof (prove)
using this:
i < dim_row (1\<^sub>m 2)
j < dim_col (1\<^sub>m 2)

goal (1 subgoal):
 1. (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>i < dim_row (1\<^sub>m 2); j < dim_col (1\<^sub>m 2)\<rbrakk> \<Longrightarrow> (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)
[PROOF STEP]
have "i\<in>{0,1} \<and> j\<in>{0,1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> {0, 1} \<and> j \<in> {0, 1}
[PROOF STEP]
using a0 a1 mat_of_cols_list_def
[PROOF STATE]
proof (prove)
using this:
i < dim_row (1\<^sub>m 2)
j < dim_col (1\<^sub>m 2)
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)

goal (1 subgoal):
 1. i \<in> {0, 1} \<and> j \<in> {0, 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i \<in> {0, 1} \<and> j \<in> {0, 1}

goal (1 subgoal):
 1. \<lbrakk>i < dim_row (1\<^sub>m 2); j < dim_col (1\<^sub>m 2)\<rbrakk> \<Longrightarrow> (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
i \<in> {0, 1} \<and> j \<in> {0, 1}

goal (1 subgoal):
 1. (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)
[PROOF STEP]
using mat_of_cols_list_def cos_sin_squared_add_cpx hermite_cnj_of_U\<^sub>B exp_sin_cos_squared_add[of "\<phi>\<^sub>B" "\<theta>\<^sub>B / 2"]
[PROOF STATE]
proof (prove)
using this:
i \<in> {0, 1} \<and> j \<in> {0, 1}
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)
complex_of_real (cos (?\<gamma> / 2)) * complex_of_real (cos (?\<gamma> / 2)) - \<i> * complex_of_real (sin (?\<gamma> / 2)) * (\<i> * complex_of_real (sin (?\<gamma> / 2))) = 1
Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> = Tensor.mat_of_cols_list 2 [exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [sin (\<theta>\<^sub>B / 2)], [complex_of_real (- sin (\<theta>\<^sub>B / 2)), exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]
exp (- (\<i> * complex_of_real \<phi>\<^sub>B)) * complex_of_real (cos (\<theta>\<^sub>B / 2)) * (exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))) + complex_of_real (sin (\<theta>\<^sub>B / 2) * sin (\<theta>\<^sub>B / 2)) = 1

goal (1 subgoal):
 1. (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)
[PROOF STEP]
by (auto simp add: set_2 algebra_simps)
[PROOF STATE]
proof (state)
this:
(Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) $$ (i, j) = 1\<^sub>m 2 $$ (i, j)

goal (2 subgoals):
 1. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_row (1\<^sub>m 2)
 2. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_col (1\<^sub>m 2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_row (1\<^sub>m 2)
 2. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_col (1\<^sub>m 2)
[PROOF STEP]
show "dim_row (U\<^sub>B\<^sup>\<dagger> * U\<^sub>B) = dim_row (1\<^sub>m 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_row (1\<^sub>m 2)
[PROOF STEP]
using mat_of_cols_list_def
[PROOF STATE]
proof (prove)
using this:
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)

goal (1 subgoal):
 1. dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_row (1\<^sub>m 2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_row (1\<^sub>m 2)

goal (1 subgoal):
 1. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_col (1\<^sub>m 2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_col (1\<^sub>m 2)
[PROOF STEP]
show "dim_col (U\<^sub>B\<^sup>\<dagger> * U\<^sub>B) = dim_col (1\<^sub>m 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_col (1\<^sub>m 2)
[PROOF STEP]
using mat_of_cols_list_def
[PROOF STATE]
proof (prove)
using this:
Tensor.mat_of_cols_list ?nr ?cs = Matrix.mat ?nr (length ?cs) (\<lambda>(i, j). ?cs ! j ! i)

goal (1 subgoal):
 1. dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_col (1\<^sub>m 2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]\<^sup>\<dagger> * Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]]) = dim_col (1\<^sub>m 2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma locally_translation:
  fixes P :: "'a :: real_normed_vector set \<Rightarrow> bool"
  shows "(\<And>S. P ((+) a ` S) = P S) \<Longrightarrow> locally P ((+) a ` S) = locally P S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>S. P ((+) a ` S) = P S) \<Longrightarrow> locally P ((+) a ` S) = locally P S
[PROOF STEP]
using homeomorphism_locally [OF homeomorphism_translation]
[PROOF STATE]
proof (prove)
using this:
(\<And>S T. homeomorphism S T ((+) (- ?a1)) ((+) ?a1) \<Longrightarrow> ?P S = ?Q T) \<Longrightarrow> locally ?P ((+) ?a1 ` ?T) = locally ?Q ?T

goal (1 subgoal):
 1. (\<And>S. P ((+) a ` S) = P S) \<Longrightarrow> locally P ((+) a ` S) = locally P S
[PROOF STEP]
by (metis (full_types) homeomorphism_image2)


[STATEMENT]
lemma integral_0_iff:
  fixes f :: "'a \<Rightarrow> real"
  shows "integrable M f \<Longrightarrow> (\<integral>x. \<bar>f x\<bar> \<partial>M) = 0 \<longleftrightarrow> emeasure M {x\<in>space M. f x \<noteq> 0} = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M f \<Longrightarrow> (LINT x|M. \<bar>f x\<bar> = 0) = (emeasure M {x \<in> space M. f x \<noteq> 0} = 0)
[PROOF STEP]
using integral_norm_eq_0_iff[of M f]
[PROOF STATE]
proof (prove)
using this:
integrable M f \<Longrightarrow> (LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> 0} = 0)

goal (1 subgoal):
 1. integrable M f \<Longrightarrow> (LINT x|M. \<bar>f x\<bar> = 0) = (emeasure M {x \<in> space M. f x \<noteq> 0} = 0)
[PROOF STEP]
by simp


[STATEMENT]
lemma contour_integral_bound_linepath:
  shows
    "\<lbrakk>f contour_integrable_on (linepath a b);
      0 \<le> B; \<And>x. x \<in> closed_segment a b \<Longrightarrow> norm(f x) \<le> B\<rbrakk>
     \<Longrightarrow> norm(contour_integral (linepath a b) f) \<le> B*norm(b - a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f contour_integrable_on linepath a b; 0 \<le> B; \<And>x. x \<in> closed_segment a b \<Longrightarrow> cmod (f x) \<le> B\<rbrakk> \<Longrightarrow> cmod (contour_integral (linepath a b) f) \<le> B * cmod (b - a)
[PROOF STEP]
using has_contour_integral_bound_linepath [of f]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(f has_contour_integral ?i) (linepath ?a ?b); 0 \<le> ?B; \<And>x. x \<in> closed_segment ?a ?b \<Longrightarrow> cmod (f x) \<le> ?B\<rbrakk> \<Longrightarrow> cmod ?i \<le> ?B * cmod (?b - ?a)

goal (1 subgoal):
 1. \<lbrakk>f contour_integrable_on linepath a b; 0 \<le> B; \<And>x. x \<in> closed_segment a b \<Longrightarrow> cmod (f x) \<le> B\<rbrakk> \<Longrightarrow> cmod (contour_integral (linepath a b) f) \<le> B * cmod (b - a)
[PROOF STEP]
by (auto simp: has_contour_integral_integral)


[STATEMENT]
lemma exp_of_minus_half_pi:
  fixes x:: real
  assumes "x = pi/2"
  shows "exp (-(\<i> * complex_of_real x)) = -\<i>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (- (\<i> * complex_of_real x)) = - \<i>
[PROOF STEP]
using assms cis_conv_exp cis_minus_pi_half
[PROOF STATE]
proof (prove)
using this:
x = pi / 2
cis ?b = exp (\<i> * complex_of_real ?b)
cis (- (pi / 2)) = - \<i>

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


[STATEMENT]
lemma emeasure_point_measure:
  assumes A: "finite {a\<in>X. 0 < f a}" "X \<subseteq> A"
  shows "emeasure (point_measure A f) X = (\<Sum>a|a\<in>X \<and> 0 < f a. f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (point_measure A f) X = (\<Sum>a | a \<in> X \<and> 0 < f a. f a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure (point_measure A f) X = (\<Sum>a | a \<in> X \<and> 0 < f a. f a)
[PROOF STEP]
have "{a. (a \<in> X \<longrightarrow> a \<in> A \<and> 0 < f a) \<and> a \<in> X} = {a\<in>X. 0 < f a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a. (a \<in> X \<longrightarrow> a \<in> A \<and> 0 < f a) \<and> a \<in> X} = {a \<in> X. 0 < f a}
[PROOF STEP]
using \<open>X \<subseteq> A\<close>
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> A

goal (1 subgoal):
 1. {a. (a \<in> X \<longrightarrow> a \<in> A \<and> 0 < f a) \<and> a \<in> X} = {a \<in> X. 0 < f a}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{a. (a \<in> X \<longrightarrow> a \<in> A \<and> 0 < f a) \<and> a \<in> X} = {a \<in> X. 0 < f a}

goal (1 subgoal):
 1. emeasure (point_measure A f) X = (\<Sum>a | a \<in> X \<and> 0 < f a. f a)
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
finite {a \<in> X. 0 < f a}
X \<subseteq> A
{a. (a \<in> X \<longrightarrow> a \<in> A \<and> 0 < f a) \<and> a \<in> X} = {a \<in> X. 0 < f a}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite {a \<in> X. 0 < f a}
X \<subseteq> A
{a. (a \<in> X \<longrightarrow> a \<in> A \<and> 0 < f a) \<and> a \<in> X} = {a \<in> X. 0 < f a}

goal (1 subgoal):
 1. emeasure (point_measure A f) X = (\<Sum>a | a \<in> X \<and> 0 < f a. f a)
[PROOF STEP]
by (simp add: emeasure_density nn_integral_count_space point_measure_def indicator_def of_bool_def)
[PROOF STATE]
proof (state)
this:
emeasure (point_measure A f) X = (\<Sum>a | a \<in> X \<and> 0 < f a. f a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_null_sum:
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c::topological_comm_monoid_add"
  assumes "\<And>i. i \<in> I \<Longrightarrow> ((\<lambda>x. f x i) \<longlongrightarrow> 0) F"
  shows "((\<lambda>i. sum (f i) I) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>i. sum (f i) I) \<longlongrightarrow> (0::'c)) F
[PROOF STEP]
using tendsto_sum [of I "\<lambda>x y. f y x" "\<lambda>x. 0"] assms
[PROOF STATE]
proof (prove)
using this:
(\<And>i. i \<in> I \<Longrightarrow> ((\<lambda>y. f y i) \<longlongrightarrow> (0::'c)) ?F) \<Longrightarrow> ((\<lambda>x. sum (f x) I) \<longlongrightarrow> (\<Sum>i\<in>I. (0::'c))) ?F
?i \<in> I \<Longrightarrow> ((\<lambda>x. f x ?i) \<longlongrightarrow> (0::'c)) F

goal (1 subgoal):
 1. ((\<lambda>i. sum (f i) I) \<longlongrightarrow> (0::'c)) F
[PROOF STEP]
by simp


[STATEMENT]
lemma cross7_triple1: "(x \<times>\<^sub>7 y) \<bullet> z = (y \<times>\<^sub>7 z) \<bullet> x"
and  cross7_triple2: "(x \<times>\<^sub>7 y) \<bullet> z = x \<bullet> (y \<times>\<^sub>7 z)  "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<times>\<^sub>7 y \<bullet> z = y \<times>\<^sub>7 z \<bullet> x &&& x \<times>\<^sub>7 y \<bullet> z = x \<bullet> y \<times>\<^sub>7 z
[PROOF STEP]
by (simp_all add: cross7_def inner_vec_def sum_7 vec_eq_iff algebra_simps)


[STATEMENT]
lemma exp_inv_limit_0_right:
  "((\<lambda>(t::real). exp(-inverse t)) \<longlongrightarrow> 0) (at_right 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. exp (- inverse t)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
apply (rule filterlim_compose[where g = exp])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (exp \<longlongrightarrow> 0) ?F2.0
 2. LIM x at_right 0. - inverse x :> ?F2.0
[PROOF STEP]
apply (rule exp_at_bot)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_right 0. - inverse x :> at_bot
[PROOF STEP]
apply (rule filterlim_compose[where g = uminus])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. filterlim uminus at_bot ?F2.4
 2. filterlim inverse ?F2.4 (at_right 0)
[PROOF STEP]
apply (rule filterlim_uminus_at_bot_at_top)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim inverse at_top (at_right 0)
[PROOF STEP]
by (rule filterlim_inverse_at_top_right)


[STATEMENT]
lemma sum_eq_0_iff:
  fixes f :: "_ \<Rightarrow> 'a :: {comm_monoid_add,ordered_ab_group_add}"
  shows "finite A \<Longrightarrow> (\<And>i. i \<in> A \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (\<Sum>i\<in>A. f i) = 0 \<longleftrightarrow> (\<forall>i\<in>A. f i = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; \<And>i. i \<in> A \<Longrightarrow> (0::'a) \<le> f i\<rbrakk> \<Longrightarrow> (sum f A = (0::'a)) = (\<forall>i\<in>A. f i = (0::'a))
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite A; \<And>i. i \<in> A \<Longrightarrow> (0::'a) \<le> f i; sum f A = (0::'a)\<rbrakk> \<Longrightarrow> \<forall>i\<in>A. f i = (0::'a)
 2. \<lbrakk>finite A; \<And>i. i \<in> A \<Longrightarrow> (0::'a) \<le> f i; \<forall>i\<in>A. f i = (0::'a)\<rbrakk> \<Longrightarrow> sum f A = (0::'a)
[PROOF STEP]
apply (blast intro: sum_nonneg_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; \<And>i. i \<in> A \<Longrightarrow> (0::'a) \<le> f i; \<forall>i\<in>A. f i = (0::'a)\<rbrakk> \<Longrightarrow> sum f A = (0::'a)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sin_cube_plus_cos_cube_gt_zero_iff:
  "(sin x ^ 3 + cos x ^ 3 > 0) = (sin x + cos x > 0)"
  for x ::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < sin x ^ 3 + cos x ^ 3) = (0 < sin x + cos x)
[PROOF STEP]
by (smt (verit, best) cos_zero power3_eq_cube power_zero_numeral sin_cube_plus_cos_cube
       sin_le_one sin_zero zero_less_mult_iff)


[STATEMENT]
lemma power_inject_exp_less_one [simp]:
  "\<lbrakk>0 < a; (a::'a::{linordered_field}) < 1 \<rbrakk>
   \<Longrightarrow> a ^ m = a ^ n \<longleftrightarrow> m = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(0::'a) < a; a < (1::'a)\<rbrakk> \<Longrightarrow> (a ^ m = a ^ n) = (m = n)
[PROOF STEP]
by (metis less_irrefl nat_neq_iff power_strict_decreasing)


[STATEMENT]
lemma complex_eq_0: "z=0 \<longleftrightarrow> (Re z)\<^sup>2 + (Im z)\<^sup>2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z = 0) = ((Re z)\<^sup>2 + (Im z)\<^sup>2 = 0)
[PROOF STEP]
by (metis zero_complex.sel complex_eqI sum_power2_eq_zero_iff)


[STATEMENT]
lemma plus_mtx3: "mtx
  ([a\<^sub>1\<^sub>1, a\<^sub>1\<^sub>2, a\<^sub>1\<^sub>3] #
   [a\<^sub>2\<^sub>1, a\<^sub>2\<^sub>2, a\<^sub>2\<^sub>3] #
   [a\<^sub>3\<^sub>1, a\<^sub>3\<^sub>2, a\<^sub>3\<^sub>3] # []) + mtx
  ([b\<^sub>1\<^sub>1, b\<^sub>1\<^sub>2, b\<^sub>1\<^sub>3] #
   [b\<^sub>2\<^sub>1, b\<^sub>2\<^sub>2, b\<^sub>2\<^sub>3] #
   [b\<^sub>3\<^sub>1, b\<^sub>3\<^sub>2, b\<^sub>3\<^sub>3] # []) = (mtx
  ([a\<^sub>1\<^sub>1+b\<^sub>1\<^sub>1, a\<^sub>1\<^sub>2+b\<^sub>1\<^sub>2, a\<^sub>1\<^sub>3+b\<^sub>1\<^sub>3] #
   [a\<^sub>2\<^sub>1+b\<^sub>2\<^sub>1, a\<^sub>2\<^sub>2+b\<^sub>2\<^sub>2, a\<^sub>2\<^sub>3+b\<^sub>2\<^sub>3] #
   [a\<^sub>3\<^sub>1+b\<^sub>3\<^sub>1, a\<^sub>3\<^sub>2+b\<^sub>3\<^sub>2, a\<^sub>3\<^sub>3+b\<^sub>3\<^sub>3] # [])::3 sq_mtx)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mtx [[a\<^sub>1\<^sub>1, a\<^sub>1\<^sub>2, a\<^sub>1\<^sub>3], [a\<^sub>2\<^sub>1, a\<^sub>2\<^sub>2, a\<^sub>2\<^sub>3], [a\<^sub>3\<^sub>1, a\<^sub>3\<^sub>2, a\<^sub>3\<^sub>3]] + mtx [[b\<^sub>1\<^sub>1, b\<^sub>1\<^sub>2, b\<^sub>1\<^sub>3], [b\<^sub>2\<^sub>1, b\<^sub>2\<^sub>2, b\<^sub>2\<^sub>3], [b\<^sub>3\<^sub>1, b\<^sub>3\<^sub>2, b\<^sub>3\<^sub>3]] = mtx [[a\<^sub>1\<^sub>1 + b\<^sub>1\<^sub>1, a\<^sub>1\<^sub>2 + b\<^sub>1\<^sub>2, a\<^sub>1\<^sub>3 + b\<^sub>1\<^sub>3], [a\<^sub>2\<^sub>1 + b\<^sub>2\<^sub>1, a\<^sub>2\<^sub>2 + b\<^sub>2\<^sub>2, a\<^sub>2\<^sub>3 + b\<^sub>2\<^sub>3], [a\<^sub>3\<^sub>1 + b\<^sub>3\<^sub>1, a\<^sub>3\<^sub>2 + b\<^sub>3\<^sub>2, a\<^sub>3\<^sub>3 + b\<^sub>3\<^sub>3]]
[PROOF STEP]
by (subst sq_mtx_eq_iff) simp