[STATEMENT]
lemma DERIV_arcsin:
  assumes "- 1 < x" "x < 1"
  shows "DERIV arcsin x :> inverse (sqrt (1 - x\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (arcsin has_real_derivative inverse (sqrt (1 - x\<^sup>2))) (at x)
[PROOF STEP]
proof (rule DERIV_inverse_function)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. (?f has_real_derivative sqrt (1 - x\<^sup>2)) (at (arcsin x))
 2. sqrt (1 - x\<^sup>2) \<noteq> 0
 3. ?a < x
 4. x < ?b
 5. \<And>y. \<lbrakk>?a < y; y < ?b\<rbrakk> \<Longrightarrow> ?f (arcsin y) = y
 6. isCont arcsin x
[PROOF STEP]
show "(sin has_real_derivative sqrt (1 - x\<^sup>2)) (at (arcsin x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sin has_real_derivative sqrt (1 - x\<^sup>2)) (at (arcsin x))
[PROOF STEP]
by (rule derivative_eq_intros | use assms cos_arcsin in force)+
[PROOF STATE]
proof (state)
this:
(sin has_real_derivative sqrt (1 - x\<^sup>2)) (at (arcsin x))

goal (5 subgoals):
 1. sqrt (1 - x\<^sup>2) \<noteq> 0
 2. ?a < x
 3. x < ?b
 4. \<And>y. \<lbrakk>?a < y; y < ?b\<rbrakk> \<Longrightarrow> sin (arcsin y) = y
 5. isCont arcsin x
[PROOF STEP]
show "sqrt (1 - x\<^sup>2) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (1 - x\<^sup>2) \<noteq> 0
[PROOF STEP]
using abs_square_eq_1 assms
[PROOF STATE]
proof (prove)
using this:
(?x\<^sup>2 = (1::?'a)) = (\<bar>?x\<bar> = (1::?'a))
- 1 < x
x < 1

goal (1 subgoal):
 1. sqrt (1 - x\<^sup>2) \<noteq> 0
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
sqrt (1 - x\<^sup>2) \<noteq> 0

goal (4 subgoals):
 1. ?a < x
 2. x < ?b
 3. \<And>y. \<lbrakk>?a < y; y < ?b\<rbrakk> \<Longrightarrow> sin (arcsin y) = y
 4. isCont arcsin x
[PROOF STEP]
qed (use assms isCont_arcsin in auto)


[STATEMENT]
lemma bigo_bounded_alt: "\<forall>x. 0 \<le> f x \<Longrightarrow> \<forall>x. f x \<le> c * g x \<Longrightarrow> f \<in> O(g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. (0::'b) \<le> f x; \<forall>x. f x \<le> c * g x\<rbrakk> \<Longrightarrow> f \<in> O(g)
[PROOF STEP]
apply (auto simp add: bigo_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. (0::'b) \<le> f x; \<forall>x. f x \<le> c * g x\<rbrakk> \<Longrightarrow> \<exists>c. \<forall>x. f x \<le> c * \<bar>g x\<bar>
[PROOF STEP]
apply (rule_tac x = "\<bar>c\<bar>" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. (0::'b) \<le> f x; \<forall>x. f x \<le> c * g x\<rbrakk> \<Longrightarrow> \<forall>x. f x \<le> \<bar>c\<bar> * \<bar>g x\<bar>
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>x. (0::'b) \<le> f x; \<forall>x. f x \<le> c * g x\<rbrakk> \<Longrightarrow> f x \<le> \<bar>c\<bar> * \<bar>g x\<bar>
[PROOF STEP]
apply (drule_tac x = x in spec)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>(0::'b) \<le> f x; f x \<le> c * g x\<rbrakk> \<Longrightarrow> f x \<le> \<bar>c\<bar> * \<bar>g x\<bar>
[PROOF STEP]
apply (simp flip: abs_mult)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma relChain_under:
assumes "Well_order r"
shows "relChain r (\<lambda> i. under r i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. relChain r (under r)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Well_order r

goal (1 subgoal):
 1. relChain r (under r)
[PROOF STEP]
unfolding relChain_def
[PROOF STATE]
proof (prove)
using this:
Well_order r

goal (1 subgoal):
 1. \<forall>i j. (i, j) \<in> r \<longrightarrow> under r i \<subseteq> under r j
[PROOF STEP]
by auto


[STATEMENT]
lemma card_UNIV_uint64: "CARD(uint64) = 2^64"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD(uint64) = 2 ^ 64
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. CARD(uint64) = 2 ^ 64
[PROOF STEP]
have "inj nat_of_uint64"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj nat_of_uint64
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj unat
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inj nat_of_uint64

goal (1 subgoal):
 1. CARD(uint64) = 2 ^ 64
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inj nat_of_uint64
[PROOF STEP]
have "bij_betw nat_of_uint64 (UNIV :: uint64 set) {..<2^64}"
[PROOF STATE]
proof (prove)
using this:
inj nat_of_uint64

goal (1 subgoal):
 1. bij_betw nat_of_uint64 UNIV {..<2 ^ 64}
[PROOF STEP]
using uint64_range
[PROOF STATE]
proof (prove)
using this:
inj nat_of_uint64
range nat_of_uint64 = {..<2 ^ 64}

goal (1 subgoal):
 1. bij_betw nat_of_uint64 UNIV {..<2 ^ 64}
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj nat_of_uint64
range nat_of_uint64 = {..<2 ^ 64}

goal (1 subgoal):
 1. inj nat_of_uint64 \<and> range nat_of_uint64 = {..<2 ^ 64}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
bij_betw nat_of_uint64 UNIV {..<2 ^ 64}

goal (1 subgoal):
 1. CARD(uint64) = 2 ^ 64
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bij_betw nat_of_uint64 UNIV {..<2 ^ 64}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bij_betw nat_of_uint64 UNIV {..<2 ^ 64}

goal (1 subgoal):
 1. CARD(uint64) = 2 ^ 64
[PROOF STEP]
by (simp add: bij_betw_same_card)
[PROOF STATE]
proof (state)
this:
CARD(uint64) = 2 ^ 64

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma chinese_remainder_aux_nat:
  fixes m1 m2 :: nat
  assumes a:"coprime m1 m2"
  shows "\<exists>b1 b2. b1 mod m1 = 1 mod m1 \<and> b1 mod m2 = 0 mod m2 \<and> b2 mod m1 = 0 mod m1 \<and> b2 mod m2 = 1 mod m2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b1 b2. b1 mod m1 = 1 mod m1 \<and> b1 mod m2 = 0 mod m2 \<and> b2 mod m1 = 0 mod m1 \<and> b2 mod m2 = 1 mod m2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>b1 b2. b1 mod m1 = 1 mod m1 \<and> b1 mod m2 = 0 mod m2 \<and> b2 mod m1 = 0 mod m1 \<and> b2 mod m2 = 1 mod m2
[PROOF STEP]
from cong_solve_coprime_nat [OF a]
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. m1 * x mod m2 = 1 mod m2
[PROOF STEP]
obtain x1 where 1: "(m1*x1) mod m2 = 1 mod m2"
[PROOF STATE]
proof (prove)
using this:
\<exists>x. m1 * x mod m2 = 1 mod m2

goal (1 subgoal):
 1. (\<And>x1. m1 * x1 mod m2 = 1 mod m2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m1 * x1 mod m2 = 1 mod m2

goal (1 subgoal):
 1. \<exists>b1 b2. b1 mod m1 = 1 mod m1 \<and> b1 mod m2 = 0 mod m2 \<and> b2 mod m1 = 0 mod m1 \<and> b2 mod m2 = 1 mod m2
[PROOF STEP]
from a
[PROOF STATE]
proof (chain)
picking this:
coprime m1 m2
[PROOF STEP]
have b: "coprime m2 m1"
[PROOF STATE]
proof (prove)
using this:
coprime m1 m2

goal (1 subgoal):
 1. coprime m2 m1
[PROOF STEP]
by (simp add: coprime_commute)
[PROOF STATE]
proof (state)
this:
coprime m2 m1

goal (1 subgoal):
 1. \<exists>b1 b2. b1 mod m1 = 1 mod m1 \<and> b1 mod m2 = 0 mod m2 \<and> b2 mod m1 = 0 mod m1 \<and> b2 mod m2 = 1 mod m2
[PROOF STEP]
from cong_solve_coprime_nat [OF b]
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. m2 * x mod m1 = 1 mod m1
[PROOF STEP]
obtain x2 where 2: "(m2*x2) mod m1 = 1 mod m1"
[PROOF STATE]
proof (prove)
using this:
\<exists>x. m2 * x mod m1 = 1 mod m1

goal (1 subgoal):
 1. (\<And>x2. m2 * x2 mod m1 = 1 mod m1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m2 * x2 mod m1 = 1 mod m1

goal (1 subgoal):
 1. \<exists>b1 b2. b1 mod m1 = 1 mod m1 \<and> b1 mod m2 = 0 mod m2 \<and> b2 mod m1 = 0 mod m1 \<and> b2 mod m2 = 1 mod m2
[PROOF STEP]
have "(m1*x1) mod m1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m1 * x1 mod m1 = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m1 * x1 mod m1 = 0

goal (1 subgoal):
 1. \<exists>b1 b2. b1 mod m1 = 1 mod m1 \<and> b1 mod m2 = 0 mod m2 \<and> b2 mod m1 = 0 mod m1 \<and> b2 mod m2 = 1 mod m2
[PROOF STEP]
have "(m2*x2) mod m2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m2 * x2 mod m2 = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m2 * x2 mod m2 = 0

goal (1 subgoal):
 1. \<exists>b1 b2. b1 mod m1 = 1 mod m1 \<and> b1 mod m2 = 0 mod m2 \<and> b2 mod m1 = 0 mod m1 \<and> b2 mod m2 = 1 mod m2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b1 b2. b1 mod m1 = 1 mod m1 \<and> b1 mod m2 = 0 mod m2 \<and> b2 mod m1 = 0 mod m1 \<and> b2 mod m2 = 1 mod m2
[PROOF STEP]
using 1 2
[PROOF STATE]
proof (prove)
using this:
m1 * x1 mod m2 = 1 mod m2
m2 * x2 mod m1 = 1 mod m1

goal (1 subgoal):
 1. \<exists>b1 b2. b1 mod m1 = 1 mod m1 \<and> b1 mod m2 = 0 mod m2 \<and> b2 mod m1 = 0 mod m1 \<and> b2 mod m2 = 1 mod m2
[PROOF STEP]
by (metis mod_0 mod_mult_self1_is_0)
[PROOF STATE]
proof (state)
this:
\<exists>b1 b2. b1 mod m1 = 1 mod m1 \<and> b1 mod m2 = 0 mod m2 \<and> b2 mod m1 = 0 mod m1 \<and> b2 mod m2 = 1 mod m2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma of_bl_Cons: "of_bl (x#xs) = of_bool x * 2^length xs + of_bl xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_bl (x # xs) = of_bool x * 2 ^ length xs + of_bl xs
[PROOF STEP]
by (cases x) simp_all


[STATEMENT]
lemma "((0::real) < -x) = (x < 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < - x) = (x < 0)
[PROOF STEP]
by arith


[STATEMENT]
lemma powr_upper_bound: "\<lbrakk>(l::real) > 0; l \<le> x; x \<le> u\<rbrakk> \<Longrightarrow> max (l powr z) (u powr z) \<ge> x powr z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < l; l \<le> x; x \<le> u\<rbrakk> \<Longrightarrow> x powr z \<le> max (l powr z) (u powr z)
[PROOF STEP]
apply (cases "z \<ge> 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < l; l \<le> x; x \<le> u; 0 \<le> z\<rbrakk> \<Longrightarrow> x powr z \<le> max (l powr z) (u powr z)
 2. \<lbrakk>0 < l; l \<le> x; x \<le> u; \<not> 0 \<le> z\<rbrakk> \<Longrightarrow> x powr z \<le> max (l powr z) (u powr z)
[PROOF STEP]
apply (rule order.trans[OF powr_mono2 max.cobounded2], simp_all) []
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < l; l \<le> x; x \<le> u; \<not> 0 \<le> z\<rbrakk> \<Longrightarrow> x powr z \<le> max (l powr z) (u powr z)
[PROOF STEP]
apply (rule order.trans[OF powr_mono2' max.cobounded1], simp_all) []
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cis_arg_mult:
  assumes "z1 * z2 \<noteq> 0"
  shows "cis (Arg (z1 * z2)) = cis (Arg z1 + Arg z2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis (Arg (z1 * z2)) = cis (Arg z1 + Arg z2)
[PROOF STEP]
by (metis assms cis_Arg cis_mult mult_eq_0_iff sgn_mult)


[STATEMENT]
lemma frechet_derivative_norm: "frechet_derivative (\<lambda>x. norm (f x)) (at x) =
    (\<lambda>v. frechet_derivative f (at x) v \<bullet> sgn (f x))"
  if "f differentiable at x" "f x \<noteq> 0"
  for f::"_\<Rightarrow>_::real_inner"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frechet_derivative (\<lambda>x. norm (f x)) (at x) = (\<lambda>v. frechet_derivative f (at x) v \<bullet> sgn (f x))
[PROOF STEP]
apply (rule frechet_derivative_at')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. norm (f x)) has_derivative (\<lambda>v. frechet_derivative f (at x) v \<bullet> sgn (f x))) (at x)
[PROOF STEP]
by (auto intro!: derivative_eq_intros frechet_derivative_worksI that simp: divide_simps)


[STATEMENT]
theorem integer_winding_number:
  "\<lbrakk>path \<gamma>; pathfinish \<gamma> = pathstart \<gamma>; z \<notin> path_image \<gamma>\<rbrakk> \<Longrightarrow> winding_number \<gamma> z \<in> \<int>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>path \<gamma>; pathfinish \<gamma> = pathstart \<gamma>; z \<notin> path_image \<gamma>\<rbrakk> \<Longrightarrow> winding_number \<gamma> z \<in> \<int>
[PROOF STEP]
by (metis integer_winding_number_eq)


[STATEMENT]
theorem join_binary: "x \<squnion> y = \<Squnion>{x, y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> y = \<Squnion>{x, y}
[PROOF STEP]
by (rule join_equality) (rule is_sup_binary)


[STATEMENT]
lemma swap_cols_rows_carrier[simp]:
  "dim_row (swap_cols_rows k l A) = dim_row A"
  "dim_col (swap_cols_rows k l A) = dim_col A"
  "A \<in> carrier_mat n n \<Longrightarrow> swap_cols_rows k l A \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (swap_cols_rows k l A) = dim_row A &&& dim_col (swap_cols_rows k l A) = dim_col A &&& (A \<in> carrier_mat n n \<Longrightarrow> swap_cols_rows k l A \<in> carrier_mat n n)
[PROOF STEP]
unfolding swap_cols_rows_def carrier_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (swaprows k l (swapcols k l A)) = dim_row A &&& dim_col (swaprows k l (swapcols k l A)) = dim_col A &&& (A \<in> {m. dim_row m = n \<and> dim_col m = n} \<Longrightarrow> swaprows k l (swapcols k l A) \<in> {m. dim_row m = n \<and> dim_col m = n})
[PROOF STEP]
by auto


[STATEMENT]
lemma length_subset_card: "\<lbrakk>finite X; distinct (x # xs); set (x # xs) \<subseteq> X\<rbrakk> \<Longrightarrow> length xs < card X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite X; distinct (x # xs); set (x # xs) \<subseteq> X\<rbrakk> \<Longrightarrow> length xs < card X
[PROOF STEP]
by (metis card_mono distinct_card impossible_Cons not_le_imp_less order_trans)


[STATEMENT]
lemma infsetsum_mono_neutral_left:
  fixes f g :: "'a \<Rightarrow> real"
  assumes "f abs_summable_on A" and "g abs_summable_on B"
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<le> g x"
  assumes "A \<subseteq> B"
  assumes "\<And>x. x \<in> B - A \<Longrightarrow> g x \<ge> 0"
  shows   "infsetsum f A \<le> infsetsum g B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infsetsum f A \<le> infsetsum g B
[PROOF STEP]
using \<open>A \<subseteq> B\<close>
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> B

goal (1 subgoal):
 1. infsetsum f A \<le> infsetsum g B
[PROOF STEP]
by (intro infsetsum_mono_neutral assms) auto


[STATEMENT]
lemma dirichlet_prod_prime:
  assumes "prime p"
  shows   "dirichlet_prod f g p  = f 1 * g p + f p * g 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dirichlet_prod f g p = f 1 * g p + f p * g 1
[PROOF STEP]
using dirichlet_prod_prime_power[of p f g 1] assms
[PROOF STATE]
proof (prove)
using this:
prime p \<Longrightarrow> dirichlet_prod f g (p ^ 1) = (\<Sum>i\<le>1. f (p ^ i) * g (p ^ (1 - i)))
prime p

goal (1 subgoal):
 1. dirichlet_prod f g p = f 1 * g p + f p * g 1
[PROOF STEP]
by simp


[STATEMENT]
lemma max_perm_degree_eqI:
  "(\<And>p. p permutes (UNIV::'a::finite set) \<Longrightarrow> (\<Sum>i\<in>UNIV. degree (to_fun A i (p i))) \<le> x) \<Longrightarrow>
    (\<exists>p. p permutes UNIV \<and> (\<Sum>i\<in>UNIV. degree (to_fun A i (p i))) = x) \<Longrightarrow>
    max_perm_degree A = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>p. p permutes UNIV \<Longrightarrow> (\<Sum>i\<in>UNIV. degree (to_fun A i (p i))) \<le> x; \<exists>p. p permutes UNIV \<and> (\<Sum>i\<in>UNIV. degree (to_fun A i (p i))) = x\<rbrakk> \<Longrightarrow> max_perm_degree A = x
[PROOF STEP]
by (auto intro!: Max_eqI  simp: max_perm_degree_def)


[STATEMENT]
lemma (in prob_space) erlang_distributed_gt:
  assumes D[simp]: "distributed M lborel X (erlang_density k l)"
  assumes [arith]: "0 < l" "0 \<le> a"
  shows "\<P>(x in M. a < X x ) = 1 - (erlang_CDF k l a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {x \<in> space M. a < X x} = 1 - erlang_CDF k l a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prob {x \<in> space M. a < X x} = 1 - erlang_CDF k l a
[PROOF STEP]
have " 1 - (erlang_CDF k l a) = 1 - \<P>(x in M. X x \<le> a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - erlang_CDF k l a = 1 - prob {x \<in> space M. X x \<le> a}
[PROOF STEP]
by (subst erlang_distributed_le) auto
[PROOF STATE]
proof (state)
this:
1 - erlang_CDF k l a = 1 - prob {x \<in> space M. X x \<le> a}

goal (1 subgoal):
 1. prob {x \<in> space M. a < X x} = 1 - erlang_CDF k l a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 - erlang_CDF k l a = 1 - prob {x \<in> space M. X x \<le> a}

goal (1 subgoal):
 1. prob {x \<in> space M. a < X x} = 1 - erlang_CDF k l a
[PROOF STEP]
have "\<dots> = prob (space M - {x \<in> space M. X x \<le> a })"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - prob {x \<in> space M. X x \<le> a} = prob (space M - {x \<in> space M. X x \<le> a})
[PROOF STEP]
using distributed_measurable[OF D]
[PROOF STATE]
proof (prove)
using this:
random_variable lborel X

goal (1 subgoal):
 1. 1 - prob {x \<in> space M. X x \<le> a} = prob (space M - {x \<in> space M. X x \<le> a})
[PROOF STEP]
by (auto simp: prob_compl)
[PROOF STATE]
proof (state)
this:
1 - prob {x \<in> space M. X x \<le> a} = prob (space M - {x \<in> space M. X x \<le> a})

goal (1 subgoal):
 1. prob {x \<in> space M. a < X x} = 1 - erlang_CDF k l a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 - prob {x \<in> space M. X x \<le> a} = prob (space M - {x \<in> space M. X x \<le> a})

goal (1 subgoal):
 1. prob {x \<in> space M. a < X x} = 1 - erlang_CDF k l a
[PROOF STEP]
have "\<dots> = \<P>(x in M. a < X x )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob (space M - {x \<in> space M. X x \<le> a}) = prob {x \<in> space M. a < X x}
[PROOF STEP]
by (auto intro!: arg_cong[where f=prob] simp: not_le)
[PROOF STATE]
proof (state)
this:
prob (space M - {x \<in> space M. X x \<le> a}) = prob {x \<in> space M. a < X x}

goal (1 subgoal):
 1. prob {x \<in> space M. a < X x} = 1 - erlang_CDF k l a
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
1 - erlang_CDF k l a = prob {x \<in> space M. a < X x}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 - erlang_CDF k l a = prob {x \<in> space M. a < X x}

goal (1 subgoal):
 1. prob {x \<in> space M. a < X x} = 1 - erlang_CDF k l a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prob {x \<in> space M. a < X x} = 1 - erlang_CDF k l a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_times_elim:
  assumes "x \<in> A * B"
  obtains a b where "x = a * b" and "a \<in> A" and "b \<in> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>x = a * b; a \<in> A; b \<in> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> A * B

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>x = a * b; a \<in> A; b \<in> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding set_times_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {c. \<exists>a\<in>A. \<exists>b\<in>B. c = a * b}

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>x = a * b; a \<in> A; b \<in> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast


[STATEMENT]
lemma feasible_private_ownershipD:
  assumes "feasible_private_ownership A F \<E> Cs Ps X Y"
  shows "(\<Sum>i\<in>A. X i) \<le> (\<Sum>i\<in>A. \<E> i) + (\<Sum>j\<in>F. Y j)"
    and "(\<forall>i\<in>A. X i \<in> Cs)" and "(\<forall>j\<in>F. Y j \<in> Ps j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum X A \<le> sum \<E> A + sum Y F &&& \<forall>i\<in>A. X i \<in> Cs &&& \<forall>j\<in>F. Y j \<in> Ps j
[PROOF STEP]
using assms feasible_private_ownership_def
[PROOF STATE]
proof (prove)
using this:
feasible_private_ownership A F \<E> Cs Ps X Y
feasible_private_ownership ?A ?F ?\<E> ?Cs ?Ps ?X ?Y = (sum ?X ?A \<le> sum ?\<E> ?A + sum ?Y ?F \<and> (\<forall>i\<in>?A. ?X i \<in> ?Cs) \<and> (\<forall>j\<in>?F. ?Y j \<in> ?Ps j))

goal (1 subgoal):
 1. sum X A \<le> sum \<E> A + sum Y F &&& \<forall>i\<in>A. X i \<in> Cs &&& \<forall>j\<in>F. Y j \<in> Ps j
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>i\<in>A. X i \<in> Cs
 2. \<forall>j\<in>F. Y j \<in> Ps j
[PROOF STEP]
by (meson assms feasible_private_ownership_def)
    (meson assms feasible_private_ownership_def)


[STATEMENT]
lemma supp_diff_subset_union_supp :
  fixes     f g :: "'a \<Rightarrow> 'b::group_add"
  shows     "supp (f - g) \<subseteq> supp f \<union> supp g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supp (f - g) \<subseteq> supp f \<union> supp g
[PROOF STEP]
unfolding supp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. (f - g) x \<noteq> (0::'b)} \<subseteq> {x. f x \<noteq> (0::'b)} \<union> {x. g x \<noteq> (0::'b)}
[PROOF STEP]
by        auto


[STATEMENT]
lemma continuous_at_within_divide[continuous_intros]:
  fixes f g :: "'a::t2_space \<Rightarrow> 'b::real_normed_field"
  assumes "continuous (at a within s) f" "continuous (at a within s) g"
    and "g a \<noteq> 0"
  shows "continuous (at a within s) (\<lambda>x. (f x) / (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous (at a within s) (\<lambda>x. f x / g x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous (at a within s) f
continuous (at a within s) g
g a \<noteq> (0::'b)

goal (1 subgoal):
 1. continuous (at a within s) (\<lambda>x. f x / g x)
[PROOF STEP]
unfolding continuous_within
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> f a) (at a within s)
(g \<longlongrightarrow> g a) (at a within s)
g a \<noteq> (0::'b)

goal (1 subgoal):
 1. ((\<lambda>x. f x / g x) \<longlongrightarrow> f a / g a) (at a within s)
[PROOF STEP]
by (rule tendsto_divide)


[STATEMENT]
lemma sum_2: "sum u {1::nat..2} = (u 1)+(u 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum u {1..2} = u 1 + u 2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum u {1..2} = u 1 + u 2
[PROOF STEP]
have "{1::nat..2} = {1::nat,2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {1..2} = {1, 2}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{1..2} = {1, 2}

goal (1 subgoal):
 1. sum u {1..2} = u 1 + u 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{1..2} = {1, 2}

goal (1 subgoal):
 1. sum u {1..2} = u 1 + u 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum u {1..2} = u 1 + u 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lt_imp_ex_zcount_lt:
  assumes m_lt_n: "M < N"
  shows "\<exists>y. zcount M y < zcount N y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>y. zcount M y < zcount N y
[PROOF STEP]
proof (rule ccontr, clarsimp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>y. \<not> zcount M y < zcount N y \<Longrightarrow> False
[PROOF STEP]
assume "\<forall>y. \<not> zcount M y < zcount N y"
[PROOF STATE]
proof (state)
this:
\<forall>y. \<not> zcount M y < zcount N y

goal (1 subgoal):
 1. \<forall>y. \<not> zcount M y < zcount N y \<Longrightarrow> False
[PROOF STEP]
hence "\<forall>y. zcount M y \<ge> zcount N y"
[PROOF STATE]
proof (prove)
using this:
\<forall>y. \<not> zcount M y < zcount N y

goal (1 subgoal):
 1. \<forall>y. zcount N y \<le> zcount M y
[PROOF STEP]
by (simp add: leI)
[PROOF STATE]
proof (state)
this:
\<forall>y. zcount N y \<le> zcount M y

goal (1 subgoal):
 1. \<forall>y. \<not> zcount M y < zcount N y \<Longrightarrow> False
[PROOF STEP]
hence "M \<supseteq>#\<^sub>z N"
[PROOF STATE]
proof (prove)
using this:
\<forall>y. zcount N y \<le> zcount M y

goal (1 subgoal):
 1. N \<subseteq>#\<^sub>z M
[PROOF STEP]
by (simp add: zmset_subset_eqI)
[PROOF STATE]
proof (state)
this:
N \<subseteq>#\<^sub>z M

goal (1 subgoal):
 1. \<forall>y. \<not> zcount M y < zcount N y \<Longrightarrow> False
[PROOF STEP]
hence "M \<ge> N"
[PROOF STATE]
proof (prove)
using this:
N \<subseteq>#\<^sub>z M

goal (1 subgoal):
 1. N \<le> M
[PROOF STEP]
by (simp add: subset_eq_imp_le_zmset)
[PROOF STATE]
proof (state)
this:
N \<le> M

goal (1 subgoal):
 1. \<forall>y. \<not> zcount M y < zcount N y \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
N \<le> M

goal (1 subgoal):
 1. False
[PROOF STEP]
using m_lt_n
[PROOF STATE]
proof (prove)
using this:
N \<le> M
M < N

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subcocycle_int_tendsto_avg_ereal:
  assumes "subcocycle u"
  shows "(\<lambda>n. (\<integral>x. u n x / n \<partial>M)) \<longlonglongrightarrow> subcocycle_avg_ereal u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ereal (LINT xa|M. u x xa / real x)) \<longlonglongrightarrow> subcocycle_avg_ereal u
[PROOF STEP]
unfolding subcocycle_avg_ereal_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ereal (LINT xa|M. u x xa / real x)) \<longlonglongrightarrow> \<Sqinter> {ereal (integral\<^sup>L M (u n) / real n) |n. 0 < n}
[PROOF STEP]
using subadditive_converges_ereal[OF subcocycle_avg_subadditive[OF assms]]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>m. ereal (integral\<^sup>L M (u m) / real m)) \<longlonglongrightarrow> \<Sqinter> {ereal (integral\<^sup>L M (u n) / real n) |n. 0 < n}

goal (1 subgoal):
 1. (\<lambda>x. ereal (LINT xa|M. u x xa / real x)) \<longlonglongrightarrow> \<Sqinter> {ereal (integral\<^sup>L M (u n) / real n) |n. 0 < n}
[PROOF STEP]
by auto


[STATEMENT]
lemma similar_sq_mtx_matrix: "(A \<sim> B) = similar_matrix (to_vec A) (to_vec B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<sim> B) = similar_matrix (to_vec A) (to_vec B)
[PROOF STEP]
apply(unfold similar_matrix_def similar_sq_mtx_def, safe)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>P. \<lbrakk>mtx_invertible P; A = P\<^sup>-\<^sup>1 * B * P\<rbrakk> \<Longrightarrow> \<exists>Pa. invertible Pa \<and> to_vec (P\<^sup>-\<^sup>1 * B * P) = matrix_inv Pa ** to_vec B ** Pa
 2. \<And>P. \<lbrakk>invertible P; to_vec A = matrix_inv P ** to_vec B ** P\<rbrakk> \<Longrightarrow> \<exists>P. mtx_invertible P \<and> A = P\<^sup>-\<^sup>1 * B * P
[PROOF STEP]
apply (metis sq_mtx_inv.rep_eq times_sq_mtx.rep_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>P. \<lbrakk>invertible P; to_vec A = matrix_inv P ** to_vec B ** P\<rbrakk> \<Longrightarrow> \<exists>P. mtx_invertible P \<and> A = P\<^sup>-\<^sup>1 * B * P
[PROOF STEP]
by (metis UNIV_I sq_mtx_inv.abs_eq times_sq_mtx.abs_eq to_mtx_inverse to_vec_inverse)


[STATEMENT]
lemma coclop_Sup_closed_var:
  fixes f :: "'a::complete_lattice_with_dual \<Rightarrow> 'a"
  shows "coclop f \<Longrightarrow> f \<circ> Sup \<circ> (`) f  = Sup \<circ> (`) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coclop f \<Longrightarrow> f \<circ> Sup \<circ> (`) f = Sup \<circ> (`) f
[PROOF STEP]
unfolding coclop_def mono_def comp_def le_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. f x \<le> id x) \<and> (\<forall>x y. x \<le> y \<longrightarrow> f x \<le> f y) \<and> (\<forall>x. f x \<le> f (f x)) \<Longrightarrow> (\<lambda>x. f (\<Squnion> (f ` x))) = (\<lambda>x. \<Squnion> (f ` x))
[PROOF STEP]
by (metis (mono_tags, lifting) SUP_le_iff antisym id_apply order_refl)


[STATEMENT]
lemma r2p_inter_hom: "R \<subseteq> Id \<Longrightarrow> S \<subseteq> Id \<Longrightarrow> r2p (R \<inter> S) = (r2p R) \<sqinter> (r2p S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R \<subseteq> Id; S \<subseteq> Id\<rbrakk> \<Longrightarrow> r2p (R \<inter> S) = r2p R \<sqinter> r2p S
[PROOF STEP]
by (simp add: r2s2p r2s_inter_hom s2p_inter_hom)


[STATEMENT]
lemma mult_one_time_pad:
  assumes coprime: "coprime x q"
  shows "map_spmf (\<lambda> b. x*b mod q) (sample_uniform q) = sample_uniform q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_spmf (\<lambda>b. x * b mod q) (sample_uniform q) = sample_uniform q
[PROOF STEP]
using inj_on_mult surj_on_mult one_time_pad coprime
[PROOF STATE]
proof (prove)
using this:
coprime ?x ?q \<Longrightarrow> inj_on (\<lambda>b. ?x * b mod ?q) {..<?q}
\<lbrakk>coprime ?x ?q; inj_on (\<lambda>b. ?x * b mod ?q) {..<?q}\<rbrakk> \<Longrightarrow> (\<lambda>b. ?x * b mod ?q) ` {..<?q} = {..<?q}
\<lbrakk>inj_on ?f {..<?q}; ?f ` {..<?q} = {..<?q}\<rbrakk> \<Longrightarrow> map_spmf ?f (sample_uniform ?q) = sample_uniform ?q
coprime x q

goal (1 subgoal):
 1. map_spmf (\<lambda>b. x * b mod q) (sample_uniform q) = sample_uniform q
[PROOF STEP]
by simp


[STATEMENT]
lemma is_top_sorted_append: "is_top_sorted R (l1@l2)
  \<longleftrightarrow> (set l1\<times>set l2 \<inter> (R\<^sup>*)\<inverse> = {}) \<and> is_top_sorted R l1 \<and> is_top_sorted R l2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_top_sorted R (l1 @ l2) = (set l1 \<times> set l2 \<inter> (R\<^sup>*)\<inverse> = {} \<and> is_top_sorted R l1 \<and> is_top_sorted R l2)
[PROOF STEP]
by (induction l1) (auto simp: is_top_sorted_cons)


[STATEMENT]
lemma size_random_bst:
  assumes "t \<in> set_pmf (random_bst A)" "finite A"
  shows   "size t = card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size t = card A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. size t = card A
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
t \<in> set_pmf (random_bst A)
finite A
[PROOF STEP]
obtain xs where "distinct xs" "A = set xs" "t = bst_of_list xs"
[PROOF STATE]
proof (prove)
using this:
t \<in> set_pmf (random_bst A)
finite A

goal (1 subgoal):
 1. (\<And>xs. \<lbrakk>distinct xs; A = set xs; t = bst_of_list xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: random_bst_altdef dest: permutations_of_setD)
[PROOF STATE]
proof (state)
this:
distinct xs
A = set xs
t = bst_of_list xs

goal (1 subgoal):
 1. size t = card A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
distinct xs
A = set xs
t = bst_of_list xs

goal (1 subgoal):
 1. size t = card A
[PROOF STEP]
using \<open>finite A\<close>
[PROOF STATE]
proof (prove)
using this:
distinct xs
A = set xs
t = bst_of_list xs
finite A

goal (1 subgoal):
 1. size t = card A
[PROOF STEP]
by (simp add: distinct_card)
[PROOF STATE]
proof (state)
this:
size t = card A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inverse_infty_ereal_tendsto_0: "inverse \<midarrow>\<infinity>\<rightarrow> (0::ereal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse \<midarrow>\<infinity>\<rightarrow> 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inverse \<midarrow>\<infinity>\<rightarrow> 0
[PROOF STEP]
have **: "((\<lambda>x. ereal (inverse x)) \<longlongrightarrow> ereal 0) at_infinity"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. ereal (inverse x)) \<longlongrightarrow> ereal 0) at_infinity
[PROOF STEP]
by (intro tendsto_intros tendsto_inverse_0)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. ereal (inverse x)) \<longlongrightarrow> ereal 0) at_infinity

goal (1 subgoal):
 1. inverse \<midarrow>\<infinity>\<rightarrow> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. ereal (inverse x)) \<longlongrightarrow> ereal 0) at_infinity
[PROOF STEP]
have "((\<lambda>x. if x = 0 then \<infinity> else ereal (inverse x)) \<longlongrightarrow> 0) at_top"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. ereal (inverse x)) \<longlongrightarrow> ereal 0) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. if x = 0 then \<infinity> else ereal (inverse x)) \<longlongrightarrow> 0) at_top
[PROOF STEP]
proof (rule filterlim_mono_eventually)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. nhds (ereal 0) \<le> nhds 0
 2. at_top \<le> at_infinity
 3. \<forall>\<^sub>F x in at_top. ereal (inverse x) = (if x = 0 then \<infinity> else ereal (inverse x))
[PROOF STEP]
show "nhds (ereal 0) \<le> nhds 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nhds (ereal 0) \<le> nhds 0
[PROOF STEP]
by (simp add: zero_ereal_def)
[PROOF STATE]
proof (state)
this:
nhds (ereal 0) \<le> nhds 0

goal (2 subgoals):
 1. at_top \<le> at_infinity
 2. \<forall>\<^sub>F x in at_top. ereal (inverse x) = (if x = 0 then \<infinity> else ereal (inverse x))
[PROOF STEP]
show "(at_top::real filter) \<le> at_infinity"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. at_top \<le> at_infinity
[PROOF STEP]
by (simp add: at_top_le_at_infinity)
[PROOF STATE]
proof (state)
this:
at_top \<le> at_infinity

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. ereal (inverse x) = (if x = 0 then \<infinity> else ereal (inverse x))
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. if x = 0 then \<infinity> else ereal (inverse x)) \<longlongrightarrow> 0) at_top

goal (1 subgoal):
 1. inverse \<midarrow>\<infinity>\<rightarrow> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. if x = 0 then \<infinity> else ereal (inverse x)) \<longlongrightarrow> 0) at_top
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. if x = 0 then \<infinity> else ereal (inverse x)) \<longlongrightarrow> 0) at_top

goal (1 subgoal):
 1. inverse \<midarrow>\<infinity>\<rightarrow> 0
[PROOF STEP]
unfolding at_infty_ereal_eq_at_top tendsto_compose_filtermap[symmetric] comp_def
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. if x = 0 then \<infinity> else ereal (inverse x)) \<longlongrightarrow> 0) at_top

goal (1 subgoal):
 1. ((\<lambda>x. inverse (ereal x)) \<longlongrightarrow> 0) at_top
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inverse \<midarrow>\<infinity>\<rightarrow> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Fourier_coefficient_minus:
  assumes "f absolutely_integrable_on {-pi..pi}"
  shows "Fourier_coefficient (\<lambda>x. - f x) i = - Fourier_coefficient f i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fourier_coefficient (\<lambda>x. - f x) i = - Fourier_coefficient f i
[PROOF STEP]
using assms trigonometric_set_mul_integrable
[PROOF STATE]
proof (prove)
using this:
f absolutely_integrable_on {- pi..pi}
?f absolutely_integrable_on {- pi..pi} \<Longrightarrow> integrable (lebesgue_on {- pi..pi}) (\<lambda>x. trigonometric_set ?n x * ?f x)

goal (1 subgoal):
 1. Fourier_coefficient (\<lambda>x. - f x) i = - Fourier_coefficient f i
[PROOF STEP]
by (simp add: Fourier_coefficient_def orthonormal_coeff_def l2product_def)


[STATEMENT]
lemma invertible_times_eq_zero:
  fixes x :: "real^'n" and A :: "real^'n^'n"
  assumes "invertible A" and "A *v x = 0"
  shows "x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = 0
[PROOF STEP]
using assms invertible_def matrix_left_invertible_ker
[PROOF STATE]
proof (prove)
using this:
invertible A
A *v x = 0
invertible ?A = (\<exists>A'. ?A ** A' = mat (1::?'a) \<and> A' ** ?A = mat (1::?'a))
(\<exists>B. B ** ?A = mat (1::?'a)) = (\<forall>x. ?A *v x = 0 \<longrightarrow> x = 0)

goal (1 subgoal):
 1. x = 0
[PROOF STEP]
by blast


[STATEMENT]
lemma local_lipschitzI:
  assumes "\<And>t x. t \<in> T \<Longrightarrow> x \<in> X \<Longrightarrow> \<exists>u>0. \<exists>L. \<forall>t \<in> cball t u \<inter> T. L-lipschitz_on (cball x u \<inter> X) (f t)"
  shows "local_lipschitz T X f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local_lipschitz T X f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?t \<in> T; ?x \<in> X\<rbrakk> \<Longrightarrow> \<exists>u>0. \<exists>L. \<forall>t\<in>cball ?t u \<inter> T. L-lipschitz_on (cball ?x u \<inter> X) (f t)

goal (1 subgoal):
 1. local_lipschitz T X f
[PROOF STEP]
unfolding local_lipschitz_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?t \<in> T; ?x \<in> X\<rbrakk> \<Longrightarrow> \<exists>u>0. \<exists>L. \<forall>t\<in>cball ?t u \<inter> T. L-lipschitz_on (cball ?x u \<inter> X) (f t)

goal (1 subgoal):
 1. \<forall>x\<in>X. \<forall>t\<in>T. \<exists>u>0. \<exists>L. \<forall>t\<in>cball t u \<inter> T. L-lipschitz_on (cball x u \<inter> X) (f t)
[PROOF STEP]
by auto


[STATEMENT]
lemma tendsto_dist_iff:
  "((f \<longlongrightarrow> l) F) \<longleftrightarrow> (((\<lambda>x. dist (f x) l) \<longlongrightarrow> 0) F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> l) F = ((\<lambda>x. dist (f x) l) \<longlongrightarrow> 0) F
[PROOF STEP]
unfolding tendsto_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>e>0. \<forall>\<^sub>F x in F. dist (f x) l < e) = (\<forall>e>0. \<forall>\<^sub>F x in F. dist (dist (f x) l) 0 < e)
[PROOF STEP]
by simp


[STATEMENT]
lemma borel_integrable_atLeastAtMost':
  fixes f :: "real \<Rightarrow> 'a::{banach, second_countable_topology}"
  assumes f: "continuous_on {a..b} f"
  shows "set_integrable lborel {a..b} f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable lborel {a..b} f
[PROOF STEP]
unfolding set_integrable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable lborel (\<lambda>x. indicat_real {a..b} x *\<^sub>R f x)
[PROOF STEP]
by (intro borel_integrable_compact compact_Icc f)


[STATEMENT]
lemma exp_of_real_cnj2:
  fixes x ::real
  shows "cnj (exp (-(\<i> * x))) = exp (\<i> * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj (exp (- (\<i> * complex_of_real x))) = exp (\<i> * complex_of_real x)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Re (cnj (exp (- (\<i> * complex_of_real x)))) = Re (exp (\<i> * complex_of_real x))
 2. Im (cnj (exp (- (\<i> * complex_of_real x)))) = Im (exp (\<i> * complex_of_real x))
[PROOF STEP]
show "Re (cnj (exp (-(\<i> * x)))) = Re (exp (\<i> * x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (cnj (exp (- (\<i> * complex_of_real x)))) = Re (exp (\<i> * complex_of_real x))
[PROOF STEP]
using Re_exp
[PROOF STATE]
proof (prove)
using this:
Re (exp ?z) = exp (Re ?z) * cos (Im ?z)

goal (1 subgoal):
 1. Re (cnj (exp (- (\<i> * complex_of_real x)))) = Re (exp (\<i> * complex_of_real x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Re (cnj (exp (- (\<i> * complex_of_real x)))) = Re (exp (\<i> * complex_of_real x))

goal (1 subgoal):
 1. Im (cnj (exp (- (\<i> * complex_of_real x)))) = Im (exp (\<i> * complex_of_real x))
[PROOF STEP]
show "Im (cnj (exp (-(\<i> * x)))) = Im (exp (\<i> * x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (cnj (exp (- (\<i> * complex_of_real x)))) = Im (exp (\<i> * complex_of_real x))
[PROOF STEP]
using Im_exp
[PROOF STATE]
proof (prove)
using this:
Im (exp ?z) = exp (Re ?z) * sin (Im ?z)

goal (1 subgoal):
 1. Im (cnj (exp (- (\<i> * complex_of_real x)))) = Im (exp (\<i> * complex_of_real x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Im (cnj (exp (- (\<i> * complex_of_real x)))) = Im (exp (\<i> * complex_of_real x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Ring) npow_suc_i:
  "\<lbrakk> x \<in> carrier R; i \<le> n \<rbrakk>
        \<Longrightarrow> npow R x (Suc n - i) =  x \<cdot>\<^sub>r (npow R x (n-i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; i \<le> n\<rbrakk> \<Longrightarrow> x^\<^bsup>R (Suc n - i)\<^esup> = x \<cdot>\<^sub>r x^\<^bsup>R (n - i)\<^esup>
[PROOF STEP]
apply (subst diffLessSuc [THEN sym, of "i" "n"], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; i \<le> n\<rbrakk> \<Longrightarrow> x^\<^bsup>R Suc (n - i)\<^esup> = x \<cdot>\<^sub>r x^\<^bsup>R (n - i)\<^esup>
[PROOF STEP]
apply (frule_tac n = "n - i" in npClose,
         simp add:ring_tOp_commute[of x])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma filtermap_at_minus: "filtermap (\<lambda>x. - x) (at a) = at (- a)"
  for a :: "'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap uminus (at a) = at (- a)
[PROOF STEP]
by (simp add: filter_eq_iff eventually_filtermap eventually_at_filter filtermap_nhds_minus[symmetric])


[STATEMENT]
lemma factorial_time: "VARS a b t
 {a=A & t=0}
 b := 1; t := t+1;
 WHILE a > 0
 INV {fac A = b * fac a & a \<le> A & t = 2*(A-a)+1}
 DO b := b*a; t := t+1; a := a - 1; t := t+1 OD
 {b = fac A & t = 2*A + 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a = A \<and> t = 0}
b := 1; t := t + 1; WHILE 0 < a INV {fac A = b * fac a \<and> a \<le> A \<and> t = 2 * (A - a) + 1}  VAR {0}
DO b := b * a; t := t + 1; a := a - 1; t := t + 1 OD
{b = fac A \<and> t = 2 * A + 1}
[PROOF STEP]
apply vcg_simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. fac A = b * fac a \<and> a \<le> A \<and> 0 < a \<Longrightarrow> (b = 0 \<or> fac a = a * fac (a - Suc 0)) \<and> a - Suc 0 \<le> A \<and> Suc (Suc (2 * (A - a))) = 2 * (Suc A - a)
[PROOF STEP]
apply(clarsimp split: nat_diff_split)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sum_indicator_eq_card2:
  assumes "finite I"
  shows "(\<Sum>i\<in>I. (indicator (P i) x)::nat) = card {i\<in>I. x \<in> P i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>I. indicator (P i) x) = card {i \<in> I. x \<in> P i}
[PROOF STEP]
using sum_mult_indicator [OF assms, of "\<lambda>y. 1::nat" P "\<lambda>y. x"]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>xa\<in>I. 1 * indicator (P xa) x) = (\<Sum>x | x \<in> I \<and> x \<in> P x. 1)

goal (1 subgoal):
 1. (\<Sum>i\<in>I. indicator (P i) x) = card {i \<in> I. x \<in> P i}
[PROOF STEP]
unfolding card_eq_sum
[PROOF STATE]
proof (prove)
using this:
(\<Sum>xa\<in>I. 1 * indicator (P xa) x) = (\<Sum>x | x \<in> I \<and> x \<in> P x. 1)

goal (1 subgoal):
 1. (\<Sum>i\<in>I. indicator (P i) x) = (\<Sum>x\<in>{i \<in> I. x \<in> P i}. 1)
[PROOF STEP]
by auto


[STATEMENT]
lemma reverse_subpaths_join:
  shows " subpath 1 (1 / 2) p +++ subpath (1 / 2) 0 p = reversepath p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subpath 1 (1 / 2) p +++ subpath (1 / 2) 0 p = reversepath p
[PROOF STEP]
using reversepath_subpath join_subpaths_middle pathfinish_subpath pathstart_subpath reversepath_joinpaths
[PROOF STATE]
proof (prove)
using this:
reversepath (subpath ?u ?v ?g) = subpath ?v ?u ?g
subpath 0 (1 / 2) ?p +++ subpath (1 / 2) 1 ?p = ?p
pathfinish (subpath ?u ?v ?g) = ?g ?v
pathstart (subpath ?u ?v ?g) = ?g ?u
pathfinish ?g1.0 = pathstart ?g2.0 \<Longrightarrow> reversepath (?g1.0 +++ ?g2.0) = reversepath ?g2.0 +++ reversepath ?g1.0

goal (1 subgoal):
 1. subpath 1 (1 / 2) p +++ subpath (1 / 2) 0 p = reversepath p
[PROOF STEP]
by (metis (no_types, lifting))


[STATEMENT]
lemma lm044:
  assumes "\<forall>l \<in> set L1. set L2 = f2 (set l) N"
  shows "set [set L2. l <- L1]  =  {f2 P N| P. P \<in> set (map set L1)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map (\<lambda>l. set L2) L1) = {f2 P N |P. P \<in> set (map set L1)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>l\<in>set L1. set L2 = f2 (set l) N

goal (1 subgoal):
 1. set (map (\<lambda>l. set L2) L1) = {f2 P N |P. P \<in> set (map set L1)}
[PROOF STEP]
by auto


[STATEMENT]
lemma eventually_at_le: "eventually P (at a within S) \<longleftrightarrow> (\<exists>d>0. \<forall>x\<in>S. x \<noteq> a \<and> dist x a \<le> d \<longrightarrow> P x)"
  for a :: "'a::metric_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (at a within S) = (\<exists>d>0. \<forall>x\<in>S. x \<noteq> a \<and> dist x a \<le> d \<longrightarrow> P x)
[PROOF STEP]
unfolding eventually_at_filter eventually_nhds_metric
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>d>0. \<forall>x. dist x a < d \<longrightarrow> x \<noteq> a \<longrightarrow> x \<in> S \<longrightarrow> P x) = (\<exists>d>0. \<forall>x\<in>S. x \<noteq> a \<and> dist x a \<le> d \<longrightarrow> P x)
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>d. \<lbrakk>0 < d; \<forall>x. dist x a < d \<longrightarrow> x \<noteq> a \<longrightarrow> x \<in> S \<longrightarrow> P x\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>x\<in>S. x \<noteq> a \<and> dist x a \<le> d \<longrightarrow> P x
 2. \<And>d. \<lbrakk>0 < d; \<forall>x\<in>S. x \<noteq> a \<and> dist x a \<le> d \<longrightarrow> P x\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>x. dist x a < d \<longrightarrow> x \<noteq> a \<longrightarrow> x \<in> S \<longrightarrow> P x
[PROOF STEP]
apply (rule_tac x="d / 2" in exI, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sin_of_real_pi_half [simp]: "sin ((of_real pi/2) :: 'a) = 1"
  if "SORT_CONSTRAINT('a::{real_field,banach,real_normed_algebra_1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (of_real pi / (2::'a)) = (1::'a)
[PROOF STEP]
using sin_pi_half
[PROOF STATE]
proof (prove)
using this:
sin (pi / 2) = 1

goal (1 subgoal):
 1. sin (of_real pi / (2::'a)) = (1::'a)
[PROOF STEP]
by (metis sin_pi_half eq_numeral_simps(4) nonzero_of_real_divide of_real_1 of_real_numeral sin_of_real)


[STATEMENT]
lemma CH_card:
  shows "card (CH X) = (\<Sum>h\<in>UNIV. card (Ch h X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (CH X) = (\<Sum>h\<in>UNIV. card (Ch h X))
[PROOF STEP]
unfolding CH_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (\<Union>h. Ch h X) = (\<Sum>h\<in>UNIV. card (Ch h X))
[PROOF STEP]
by (simp add: card_UN_disjoint Ch_range_disjoint)


[STATEMENT]
lemma compact_space:
   "compact_space X \<longleftrightarrow>
        (\<forall>\<U>. (\<forall>U \<in> \<U>. openin X U) \<and> \<Union>\<U> = topspace X
            \<longrightarrow> (\<exists>\<F>. finite \<F> \<and> \<F> \<subseteq> \<U> \<and> \<Union>\<F> = topspace X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact_space X = (\<forall>\<U>. (\<forall>U\<in>\<U>. openin X U) \<and> \<Union> \<U> = topspace X \<longrightarrow> (\<exists>\<F>. finite \<F> \<and> \<F> \<subseteq> \<U> \<and> \<Union> \<F> = topspace X))
[PROOF STEP]
unfolding compact_space_alt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>\<U>. Ball \<U> (openin X) \<and> topspace X \<subseteq> \<Union> \<U> \<longrightarrow> (\<exists>\<F>. finite \<F> \<and> \<F> \<subseteq> \<U> \<and> topspace X \<subseteq> \<Union> \<F>)) = (\<forall>\<U>. (\<forall>U\<in>\<U>. openin X U) \<and> \<Union> \<U> = topspace X \<longrightarrow> (\<exists>\<F>. finite \<F> \<and> \<F> \<subseteq> \<U> \<and> \<Union> \<F> = topspace X))
[PROOF STEP]
using openin_subset
[PROOF STATE]
proof (prove)
using this:
openin ?U ?S \<Longrightarrow> ?S \<subseteq> topspace ?U

goal (1 subgoal):
 1. (\<forall>\<U>. Ball \<U> (openin X) \<and> topspace X \<subseteq> \<Union> \<U> \<longrightarrow> (\<exists>\<F>. finite \<F> \<and> \<F> \<subseteq> \<U> \<and> topspace X \<subseteq> \<Union> \<F>)) = (\<forall>\<U>. (\<forall>U\<in>\<U>. openin X U) \<and> \<Union> \<U> = topspace X \<longrightarrow> (\<exists>\<F>. finite \<F> \<and> \<F> \<subseteq> \<U> \<and> \<Union> \<F> = topspace X))
[PROOF STEP]
by fastforce


[STATEMENT]
lemma member_mset_neg_iff_zcount: "x \<in># mset_neg M \<longleftrightarrow> zcount M x < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in># mset_neg M) = (zcount M x < 0)
[PROOF STEP]
by (metis member_mset_pos_iff_zcount mset_pos_uminus neg_le_0_iff_le not_le zcount_uminus)


[STATEMENT]
lemma inner_prod_with_unitary_mat [simp]:
  assumes "unitary U" and "dim_vec u = dim_col U" and "dim_vec v = dim_col U"
  shows "\<langle>U * |u\<rangle>|U * |v\<rangle>\<rangle> = \<langle>u|v\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = \<langle>u|v\<rangle>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = \<langle>u|v\<rangle>
[PROOF STEP]
have f1:"\<langle>U * |u\<rangle>|U * |v\<rangle>\<rangle> = (\<langle>|u\<rangle>| * (U\<^sup>\<dagger>) * U * |v\<rangle>) $$ (0,0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = (\<langle>|u\<rangle>| * U\<^sup>\<dagger> * U * |v\<rangle>) $$ (0, 0)
[PROOF STEP]
using assms(2-3) bra_mat_on_vec mult_ket_vec_is_ket_vec_of_mult
[PROOF STATE]
proof (prove)
using this:
dim_vec u = dim_col U
dim_vec v = dim_col U
dim_col ?A = dim_vec ?v \<Longrightarrow> \<langle>?A * |?v\<rangle>| = \<langle>|?v\<rangle>| * ?A\<^sup>\<dagger>
dim_col ?A = dim_vec ?v \<Longrightarrow> |col_fst (?A * |?v\<rangle>)\<rangle> = ?A * |?v\<rangle>

goal (1 subgoal):
 1. \<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = (\<langle>|u\<rangle>| * U\<^sup>\<dagger> * U * |v\<rangle>) $$ (0, 0)
[PROOF STEP]
by (smt assoc_mult_mat carrier_mat_triv col_fst_def dim_vec dim_col_of_dagger index_mult_mat(2)
        index_mult_mat(3) inner_prod_with_times_mat ket_vec_def mat_carrier)
[PROOF STATE]
proof (state)
this:
\<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = (\<langle>|u\<rangle>| * U\<^sup>\<dagger> * U * |v\<rangle>) $$ (0, 0)

goal (1 subgoal):
 1. \<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = \<langle>u|v\<rangle>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = (\<langle>|u\<rangle>| * U\<^sup>\<dagger> * U * |v\<rangle>) $$ (0, 0)

goal (1 subgoal):
 1. \<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = \<langle>u|v\<rangle>
[PROOF STEP]
have f2:"\<langle>|u\<rangle>| \<in> carrier_mat 1 (dim_vec v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>|u\<rangle>| \<in> carrier_mat 1 (dim_vec v)
[PROOF STEP]
using bra_def ket_vec_def assms(2-3)
[PROOF STATE]
proof (prove)
using this:
\<langle>?v| \<equiv> mat 1 (dim_row ?v) (\<lambda>(i, j). cnj (?v $$ (j, i)))
|?v\<rangle> \<equiv> mat (dim_vec ?v) 1 (\<lambda>(i, j). ?v $ i)
dim_vec u = dim_col U
dim_vec v = dim_col U

goal (1 subgoal):
 1. \<langle>|u\<rangle>| \<in> carrier_mat 1 (dim_vec v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<langle>|u\<rangle>| \<in> carrier_mat 1 (dim_vec v)

goal (1 subgoal):
 1. \<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = \<langle>u|v\<rangle>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<langle>|u\<rangle>| \<in> carrier_mat 1 (dim_vec v)

goal (1 subgoal):
 1. \<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = \<langle>u|v\<rangle>
[PROOF STEP]
have f3:"U\<^sup>\<dagger> \<in> carrier_mat (dim_col U) (dim_row U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U\<^sup>\<dagger> \<in> carrier_mat (dim_col U) (dim_row U)
[PROOF STEP]
using dagger_def
[PROOF STATE]
proof (prove)
using this:
?M\<^sup>\<dagger> \<equiv> mat (dim_col ?M) (dim_row ?M) (\<lambda>(i, j). cnj (?M $$ (j, i)))

goal (1 subgoal):
 1. U\<^sup>\<dagger> \<in> carrier_mat (dim_col U) (dim_row U)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
U\<^sup>\<dagger> \<in> carrier_mat (dim_col U) (dim_row U)

goal (1 subgoal):
 1. \<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = \<langle>u|v\<rangle>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = (\<langle>|u\<rangle>| * U\<^sup>\<dagger> * U * |v\<rangle>) $$ (0, 0)
\<langle>|u\<rangle>| \<in> carrier_mat 1 (dim_vec v)
U\<^sup>\<dagger> \<in> carrier_mat (dim_col U) (dim_row U)
[PROOF STEP]
have "\<langle>U * |u\<rangle>|U * |v\<rangle>\<rangle> = (\<langle>|u\<rangle>| * (U\<^sup>\<dagger> * U) * |v\<rangle>) $$ (0,0)"
[PROOF STATE]
proof (prove)
using this:
\<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = (\<langle>|u\<rangle>| * U\<^sup>\<dagger> * U * |v\<rangle>) $$ (0, 0)
\<langle>|u\<rangle>| \<in> carrier_mat 1 (dim_vec v)
U\<^sup>\<dagger> \<in> carrier_mat (dim_col U) (dim_row U)

goal (1 subgoal):
 1. \<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = (\<langle>|u\<rangle>| * (U\<^sup>\<dagger> * U) * |v\<rangle>) $$ (0, 0)
[PROOF STEP]
using assms(3) assoc_mult_mat
[PROOF STATE]
proof (prove)
using this:
\<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = (\<langle>|u\<rangle>| * U\<^sup>\<dagger> * U * |v\<rangle>) $$ (0, 0)
\<langle>|u\<rangle>| \<in> carrier_mat 1 (dim_vec v)
U\<^sup>\<dagger> \<in> carrier_mat (dim_col U) (dim_row U)
dim_vec v = dim_col U
\<lbrakk>?A \<in> carrier_mat ?n\<^sub>1 ?n\<^sub>2; ?B \<in> carrier_mat ?n\<^sub>2 ?n\<^sub>3; ?C \<in> carrier_mat ?n\<^sub>3 ?n\<^sub>4\<rbrakk> \<Longrightarrow> ?A * ?B * ?C = ?A * (?B * ?C)

goal (1 subgoal):
 1. \<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = (\<langle>|u\<rangle>| * (U\<^sup>\<dagger> * U) * |v\<rangle>) $$ (0, 0)
[PROOF STEP]
by (metis carrier_mat_triv)
[PROOF STATE]
proof (state)
this:
\<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = (\<langle>|u\<rangle>| * (U\<^sup>\<dagger> * U) * |v\<rangle>) $$ (0, 0)

goal (1 subgoal):
 1. \<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = \<langle>u|v\<rangle>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = (\<langle>|u\<rangle>| * (U\<^sup>\<dagger> * U) * |v\<rangle>) $$ (0, 0)

goal (1 subgoal):
 1. \<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = \<langle>u|v\<rangle>
[PROOF STEP]
have "\<dots> = (\<langle>|u\<rangle>| * |v\<rangle>) $$ (0,0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<langle>|u\<rangle>| * (U\<^sup>\<dagger> * U) * |v\<rangle>) $$ (0, 0) = (\<langle>|u\<rangle>| * |v\<rangle>) $$ (0, 0)
[PROOF STEP]
using assms(1) unitary_def
[PROOF STATE]
proof (prove)
using this:
unitary U
unitary ?M \<equiv> ?M\<^sup>\<dagger> * ?M = 1\<^sub>m (dim_col ?M) \<and> ?M * ?M\<^sup>\<dagger> = 1\<^sub>m (dim_row ?M)

goal (1 subgoal):
 1. (\<langle>|u\<rangle>| * (U\<^sup>\<dagger> * U) * |v\<rangle>) $$ (0, 0) = (\<langle>|u\<rangle>| * |v\<rangle>) $$ (0, 0)
[PROOF STEP]
by (simp add: assms(2) bra_def ket_vec_def)
[PROOF STATE]
proof (state)
this:
(\<langle>|u\<rangle>| * (U\<^sup>\<dagger> * U) * |v\<rangle>) $$ (0, 0) = (\<langle>|u\<rangle>| * |v\<rangle>) $$ (0, 0)

goal (1 subgoal):
 1. \<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = \<langle>u|v\<rangle>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = (\<langle>|u\<rangle>| * |v\<rangle>) $$ (0, 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = (\<langle>|u\<rangle>| * |v\<rangle>) $$ (0, 0)

goal (1 subgoal):
 1. \<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = \<langle>u|v\<rangle>
[PROOF STEP]
using assms(2-3) inner_prod_with_times_mat
[PROOF STATE]
proof (prove)
using this:
\<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = (\<langle>|u\<rangle>| * |v\<rangle>) $$ (0, 0)
dim_vec u = dim_col U
dim_vec v = dim_col U
dim_vec ?u = dim_vec ?v \<Longrightarrow> \<langle>?u|?v\<rangle> = (\<langle>|?u\<rangle>| * |?v\<rangle>) $$ (0, 0)

goal (1 subgoal):
 1. \<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = \<langle>u|v\<rangle>
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
\<langle>col_fst (U * |u\<rangle>)|col_fst (U * |v\<rangle>)\<rangle> = \<langle>u|v\<rangle>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem (in group_action) orbit_stabilizer_theorem:
  assumes "x \<in> E"
  shows "card (orbit G \<phi> x) * card (stabilizer G \<phi> x) = order G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (orbit G \<phi> x) * card (stabilizer G \<phi> x) = order G
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (orbit G \<phi> x) * card (stabilizer G \<phi> x) = order G
[PROOF STEP]
have "card (rcosets stabilizer G \<phi> x) = card (orbit G \<phi> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (rcosets stabilizer G \<phi> x) = card (orbit G \<phi> x)
[PROOF STEP]
using orbit_stab_fun_is_bij[OF assms(1)] bij_betw_same_card
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>R. \<phi> (inv (SOME h. h \<in> R)) x) (rcosets stabilizer G \<phi> x) (orbit G \<phi> x)
bij_betw ?f ?A ?B \<Longrightarrow> card ?A = card ?B

goal (1 subgoal):
 1. card (rcosets stabilizer G \<phi> x) = card (orbit G \<phi> x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card (rcosets stabilizer G \<phi> x) = card (orbit G \<phi> x)

goal (1 subgoal):
 1. card (orbit G \<phi> x) * card (stabilizer G \<phi> x) = order G
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (rcosets stabilizer G \<phi> x) = card (orbit G \<phi> x)

goal (1 subgoal):
 1. card (orbit G \<phi> x) * card (stabilizer G \<phi> x) = order G
[PROOF STEP]
have "card (rcosets stabilizer G \<phi> x) * card (stabilizer G \<phi> x) = order G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (rcosets stabilizer G \<phi> x) * card (stabilizer G \<phi> x) = order G
[PROOF STEP]
using stabilizer_subgroup assms group.lagrange group_hom group_hom.axioms(1)
[PROOF STATE]
proof (prove)
using this:
?x \<in> E \<Longrightarrow> subgroup (stabilizer G \<phi> ?x) G
x \<in> E
\<lbrakk>Group.group ?G; subgroup ?H ?G\<rbrakk> \<Longrightarrow> card (rcosets\<^bsub>?G\<^esub> ?H) * card ?H = order ?G
group_hom G (BijGroup E) \<phi>
group_hom ?G ?H ?h \<Longrightarrow> Group.group ?G

goal (1 subgoal):
 1. card (rcosets stabilizer G \<phi> x) * card (stabilizer G \<phi> x) = order G
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card (rcosets stabilizer G \<phi> x) * card (stabilizer G \<phi> x) = order G

goal (1 subgoal):
 1. card (orbit G \<phi> x) * card (stabilizer G \<phi> x) = order G
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (rcosets stabilizer G \<phi> x) = card (orbit G \<phi> x)
card (rcosets stabilizer G \<phi> x) * card (stabilizer G \<phi> x) = order G
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (rcosets stabilizer G \<phi> x) = card (orbit G \<phi> x)
card (rcosets stabilizer G \<phi> x) * card (stabilizer G \<phi> x) = order G

goal (1 subgoal):
 1. card (orbit G \<phi> x) * card (stabilizer G \<phi> x) = order G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (orbit G \<phi> x) * card (stabilizer G \<phi> x) = order G

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fdia_Un_rel: "( |\<Union>\<R>\<rangle> f x) = \<Squnion>{|R\<rangle> f x |R. R \<in> \<R>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1.  |\<Union> \<R>\<rangle> f x = \<Squnion>{ |R\<rangle> f x |R. R \<in> \<R>}
[PROOF STEP]
apply (simp add: fdia_im)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion>(f ` \<Union> \<R> `` {x}) = \<Squnion>{\<Squnion>(f ` R `` {x}) |R. R \<in> \<R>}
[PROOF STEP]
apply (rule antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<Squnion>(f ` \<Union> \<R> `` {x}) \<le> \<Squnion>{\<Squnion>(f ` R `` {x}) |R. R \<in> \<R>}
 2. \<Squnion>{\<Squnion>(f ` R `` {x}) |R. R \<in> \<R>} \<le> \<Squnion>(f ` \<Union> \<R> `` {x})
[PROOF STEP]
apply (intro SUP_least, safe)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa xaa X. \<lbrakk>(x, xa) \<in> X; X \<in> \<R>\<rbrakk> \<Longrightarrow> f xa \<le> \<Squnion>{\<Squnion>(f ` R `` {x}) |R. R \<in> \<R>}
 2. \<Squnion>{\<Squnion>(f ` R `` {x}) |R. R \<in> \<R>} \<le> \<Squnion>(f ` \<Union> \<R> `` {x})
[PROOF STEP]
apply (rule Sup_upper2, force)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa xaa X. \<lbrakk>(x, xa) \<in> X; X \<in> \<R>\<rbrakk> \<Longrightarrow> f xa \<le> \<Squnion>(f ` X `` {x})
 2. \<Squnion>{\<Squnion>(f ` R `` {x}) |R. R \<in> \<R>} \<le> \<Squnion>(f ` \<Union> \<R> `` {x})
[PROOF STEP]
apply (rule SUP_upper, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion>{\<Squnion>(f ` R `` {x}) |R. R \<in> \<R>} \<le> \<Squnion>(f ` \<Union> \<R> `` {x})
[PROOF STEP]
apply (rule Sup_least)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {\<Squnion>(f ` R `` {x}) |R. R \<in> \<R>} \<Longrightarrow> xa \<le> \<Squnion>(f ` \<Union> \<R> `` {x})
[PROOF STEP]
by (clarsimp simp: Image_mono SUP_subset_mono Sup_upper)


[STATEMENT]
lemma finite_pow2_eq:
  fixes n :: nat
  shows "finite {i. 2 ^ i = n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {i. 2 ^ i = n}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {i. 2 ^ i = n}
[PROOF STEP]
have "((^) 2) ` {i. 2 ^ i = n} \<subseteq> {n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (^) 2 ` {i. 2 ^ i = n} \<subseteq> {n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(^) 2 ` {i. 2 ^ i = n} \<subseteq> {n}

goal (1 subgoal):
 1. finite {i. 2 ^ i = n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(^) 2 ` {i. 2 ^ i = n} \<subseteq> {n}
[PROOF STEP]
have "finite (((^) (2 :: nat)) ` {i. 2 ^ i = n})"
[PROOF STATE]
proof (prove)
using this:
(^) 2 ` {i. 2 ^ i = n} \<subseteq> {n}

goal (1 subgoal):
 1. finite ((^) 2 ` {i. 2 ^ i = n})
[PROOF STEP]
by (rule finite_subset) blast
[PROOF STATE]
proof (state)
this:
finite ((^) 2 ` {i. 2 ^ i = n})

goal (1 subgoal):
 1. finite {i. 2 ^ i = n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite ((^) 2 ` {i. 2 ^ i = n})
[PROOF STEP]
show "finite {i. 2 ^ i = n}"
[PROOF STATE]
proof (prove)
using this:
finite ((^) 2 ` {i. 2 ^ i = n})

goal (1 subgoal):
 1. finite {i. 2 ^ i = n}
[PROOF STEP]
by (rule finite_imageD) (auto simp: inj_on_def)
[PROOF STATE]
proof (state)
this:
finite {i. 2 ^ i = n}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convex_onD:
  assumes "convex_on A f"
  shows "\<And>t x y. t \<ge> 0 \<Longrightarrow> t \<le> 1 \<Longrightarrow> x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow>
    f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t x y. \<lbrakk>0 \<le> t; t \<le> 1; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
convex_on A f

goal (1 subgoal):
 1. \<And>t x y. \<lbrakk>0 \<le> t; t \<le> 1; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y
[PROOF STEP]
by (auto simp: convex_on_def)


[STATEMENT]
lemma absolutely_integrable_mult_Fejer_kernel:
  assumes "f absolutely_integrable_on {-pi..pi}"
  shows "(\<lambda>x. Fejer_kernel n x * f x) absolutely_integrable_on {-pi..pi}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. Fejer_kernel n x * f x) absolutely_integrable_on {- pi..pi}
[PROOF STEP]
proof (rule absolutely_integrable_bounded_measurable_product_real)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. Fejer_kernel n \<in> borel_measurable (lebesgue_on {- pi..pi})
 2. {- pi..pi} \<in> sets lebesgue
 3. bounded (Fejer_kernel n ` {- pi..pi})
 4. f absolutely_integrable_on {- pi..pi}
[PROOF STEP]
show "Fejer_kernel n \<in> borel_measurable (lebesgue_on {-pi..pi})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fejer_kernel n \<in> borel_measurable (lebesgue_on {- pi..pi})
[PROOF STEP]
by (simp add: Fejer_kernel_continuous continuous_imp_measurable_on_sets_lebesgue)
[PROOF STATE]
proof (state)
this:
Fejer_kernel n \<in> borel_measurable (lebesgue_on {- pi..pi})

goal (3 subgoals):
 1. {- pi..pi} \<in> sets lebesgue
 2. bounded (Fejer_kernel n ` {- pi..pi})
 3. f absolutely_integrable_on {- pi..pi}
[PROOF STEP]
show "bounded (Fejer_kernel n ` {-pi..pi})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded (Fejer_kernel n ` {- pi..pi})
[PROOF STEP]
using Fejer_kernel_continuous compact_continuous_image compact_imp_bounded
[PROOF STATE]
proof (prove)
using this:
continuous_on {- pi..pi} (Fejer_kernel ?n)
\<lbrakk>continuous_on ?s ?f; compact ?s\<rbrakk> \<Longrightarrow> compact (?f ` ?s)
compact ?U \<Longrightarrow> bounded ?U

goal (1 subgoal):
 1. bounded (Fejer_kernel n ` {- pi..pi})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
bounded (Fejer_kernel n ` {- pi..pi})

goal (2 subgoals):
 1. {- pi..pi} \<in> sets lebesgue
 2. f absolutely_integrable_on {- pi..pi}
[PROOF STEP]
qed (use assms in auto)


[STATEMENT]
lemma measurement_id2:
  assumes "measurement d 2 M"
  shows "adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m d
[PROOF STEP]
have ssz: "(Suc (Suc 0)) = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (Suc 0) = 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Suc (Suc 0) = 2

goal (1 subgoal):
 1. adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m d
[PROOF STEP]
have "M 0 \<in> carrier_mat d d" "M 1 \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M 0 \<in> carrier_mat d d &&& M 1 \<in> carrier_mat d d
[PROOF STEP]
using assms measurement_def
[PROOF STATE]
proof (prove)
using this:
measurement d 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)

goal (1 subgoal):
 1. M 0 \<in> carrier_mat d d &&& M 1 \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M 0 \<in> carrier_mat d d
M 1 \<in> carrier_mat d d

goal (1 subgoal):
 1. adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
M 0 \<in> carrier_mat d d
M 1 \<in> carrier_mat d d
[PROOF STEP]
have "adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = matrix_sum d (\<lambda>j. (adjoint (M j)) * M j) (Suc (Suc 0)) "
[PROOF STATE]
proof (prove)
using this:
M 0 \<in> carrier_mat d d
M 1 \<in> carrier_mat d d

goal (1 subgoal):
 1. adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = matrix_sum d (\<lambda>j. adjoint (M j) * M j) (Suc (Suc 0))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = matrix_sum d (\<lambda>j. adjoint (M j) * M j) (Suc (Suc 0))

goal (1 subgoal):
 1. adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m d
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = matrix_sum d (\<lambda>j. adjoint (M j) * M j) (Suc (Suc 0))

goal (1 subgoal):
 1. adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m d
[PROOF STEP]
have "\<dots> = matrix_sum d (\<lambda>j. (adjoint (M j)) * M j) (2::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d (\<lambda>j. adjoint (M j) * M j) (Suc (Suc 0)) = matrix_sum d (\<lambda>j. adjoint (M j) * M j) 2
[PROOF STEP]
by (subst ssz, auto)
[PROOF STATE]
proof (state)
this:
matrix_sum d (\<lambda>j. adjoint (M j) * M j) (Suc (Suc 0)) = matrix_sum d (\<lambda>j. adjoint (M j) * M j) 2

goal (1 subgoal):
 1. adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m d
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix_sum d (\<lambda>j. adjoint (M j) * M j) (Suc (Suc 0)) = matrix_sum d (\<lambda>j. adjoint (M j) * M j) 2

goal (1 subgoal):
 1. adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m d
[PROOF STEP]
have "\<dots> = 1\<^sub>m d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d (\<lambda>j. adjoint (M j) * M j) 2 = 1\<^sub>m d
[PROOF STEP]
using measurement_def[of d 2 M] assms
[PROOF STATE]
proof (prove)
using this:
measurement d 2 M = ((\<forall>j<2. M j \<in> carrier_mat d d) \<and> matrix_sum d (\<lambda>j. adjoint (M j) * M j) 2 = 1\<^sub>m d)
measurement d 2 M

goal (1 subgoal):
 1. matrix_sum d (\<lambda>j. adjoint (M j) * M j) 2 = 1\<^sub>m d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d (\<lambda>j. adjoint (M j) * M j) 2 = 1\<^sub>m d

goal (1 subgoal):
 1. adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m d
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
adjoint (M 0) * M 0 + adjoint (M 1) * M 1 = 1\<^sub>m d

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma of_rat_diff: "of_rat (a - b) = of_rat a - of_rat b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_rat (a - b) = of_rat a - of_rat b
[PROOF STEP]
using of_rat_add [of a "- b"]
[PROOF STATE]
proof (prove)
using this:
of_rat (a + - b) = of_rat a + of_rat (- b)

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


[STATEMENT]
lemma list_rel_append1: "(as @ bs, l) \<in> \<langle>R\<rangle>list_rel
  \<longleftrightarrow> (\<exists>cs ds. l = cs@ds \<and> (as,cs)\<in>\<langle>R\<rangle>list_rel \<and> (bs,ds)\<in>\<langle>R\<rangle>list_rel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((as @ bs, l) \<in> \<langle>R\<rangle>list_rel) = (\<exists>cs ds. l = cs @ ds \<and> (as, cs) \<in> \<langle>R\<rangle>list_rel \<and> (bs, ds) \<in> \<langle>R\<rangle>list_rel)
[PROOF STEP]
apply (simp add: list_rel_def list_all2_append1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>us vs. l = us @ vs \<and> length us = length as \<and> length vs = length bs \<and> list_all2 (\<lambda>x x'. (x, x') \<in> R) as us \<and> list_all2 (\<lambda>x x'. (x, x') \<in> R) bs vs) = (\<exists>cs ds. l = cs @ ds \<and> list_all2 (\<lambda>x x'. (x, x') \<in> R) as cs \<and> list_all2 (\<lambda>x x'. (x, x') \<in> R) bs ds)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>cs ds. \<lbrakk>l = cs @ ds; list_all2 (\<lambda>x x'. (x, x') \<in> R) as cs; list_all2 (\<lambda>x x'. (x, x') \<in> R) bs ds\<rbrakk> \<Longrightarrow> \<exists>us vs. cs @ ds = us @ vs \<and> length us = length as \<and> length vs = length bs \<and> list_all2 (\<lambda>x x'. (x, x') \<in> R) as us \<and> list_all2 (\<lambda>x x'. (x, x') \<in> R) bs vs
[PROOF STEP]
apply (metis list_all2_lengthD)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in prob_space) sum_measure_le_measure_Inter:
  assumes [measurable]: "finite I" "I \<noteq> {}" "\<And>i. i \<in> I \<Longrightarrow> A i \<in> sets M"
  shows "(\<Sum>i\<in>I. prob (A i)) \<le> real(card I) - 1 + prob (\<Inter>i\<in>I. A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>I. prob (A i)) \<le> real (card I) - 1 + prob (\<Inter> (A ` I))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite I
I \<noteq> {}
?i12 \<in> I \<Longrightarrow> A ?i12 \<in> events

goal (1 subgoal):
 1. (\<Sum>i\<in>I. prob (A i)) \<le> real (card I) - 1 + prob (\<Inter> (A ` I))
[PROOF STEP]
proof (induct I rule: finite_ne_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. (\<And>i. i \<in> {x} \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>{x}. prob (A i)) \<le> real (card {x}) - 1 + prob (\<Inter> (A ` {x}))
 2. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>F. prob (A i)) \<le> real (card F) - 1 + prob (\<Inter> (A ` F)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> events\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>insert x F. prob (A i)) \<le> real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))
[PROOF STEP]
fix x F
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. (\<And>i. i \<in> {x} \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>{x}. prob (A i)) \<le> real (card {x}) - 1 + prob (\<Inter> (A ` {x}))
 2. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>F. prob (A i)) \<le> real (card F) - 1 + prob (\<Inter> (A ` F)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> events\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>insert x F. prob (A i)) \<le> real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))
[PROOF STEP]
assume H: "finite F" "F \<noteq> {}" "x \<notin> F"
            "((\<And>i. i \<in> F \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>F. prob (A i)) \<le> real (card F) - 1 + prob (\<Inter>(A ` F)))"
        and [measurable]: "(\<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> events)"
[PROOF STATE]
proof (state)
this:
finite F
F \<noteq> {}
x \<notin> F
(\<And>i. i \<in> F \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>F. prob (A i)) \<le> real (card F) - 1 + prob (\<Inter> (A ` F))
?i12 \<in> insert x F \<Longrightarrow> A ?i12 \<in> events

goal (2 subgoals):
 1. \<And>x. (\<And>i. i \<in> {x} \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>{x}. prob (A i)) \<le> real (card {x}) - 1 + prob (\<Inter> (A ` {x}))
 2. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>F. prob (A i)) \<le> real (card F) - 1 + prob (\<Inter> (A ` F)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> events\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>insert x F. prob (A i)) \<le> real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))
[PROOF STEP]
have "(\<Inter>x\<in>F. A x) \<in> events"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> (A ` F) \<in> events
[PROOF STEP]
using \<open>finite F\<close> \<open>F \<noteq> {}\<close>
[PROOF STATE]
proof (prove)
using this:
finite F
F \<noteq> {}

goal (1 subgoal):
 1. \<Inter> (A ` F) \<in> events
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Inter> (A ` F) \<in> events

goal (2 subgoals):
 1. \<And>x. (\<And>i. i \<in> {x} \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>{x}. prob (A i)) \<le> real (card {x}) - 1 + prob (\<Inter> (A ` {x}))
 2. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>F. prob (A i)) \<le> real (card F) - 1 + prob (\<Inter> (A ` F)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> events\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>insert x F. prob (A i)) \<le> real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))
[PROOF STEP]
have "(\<Sum>i\<in>insert x F. prob (A i)) = (\<Sum>i\<in>F. prob (A i)) + prob (A x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>insert x F. prob (A i)) = (\<Sum>i\<in>F. prob (A i)) + prob (A x)
[PROOF STEP]
using H(1) H(3)
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F

goal (1 subgoal):
 1. (\<Sum>i\<in>insert x F. prob (A i)) = (\<Sum>i\<in>F. prob (A i)) + prob (A x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>insert x F. prob (A i)) = (\<Sum>i\<in>F. prob (A i)) + prob (A x)

goal (2 subgoals):
 1. \<And>x. (\<And>i. i \<in> {x} \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>{x}. prob (A i)) \<le> real (card {x}) - 1 + prob (\<Inter> (A ` {x}))
 2. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>F. prob (A i)) \<le> real (card F) - 1 + prob (\<Inter> (A ` F)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> events\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>insert x F. prob (A i)) \<le> real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>insert x F. prob (A i)) = (\<Sum>i\<in>F. prob (A i)) + prob (A x)

goal (2 subgoals):
 1. \<And>x. (\<And>i. i \<in> {x} \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>{x}. prob (A i)) \<le> real (card {x}) - 1 + prob (\<Inter> (A ` {x}))
 2. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>F. prob (A i)) \<le> real (card F) - 1 + prob (\<Inter> (A ` F)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> events\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>insert x F. prob (A i)) \<le> real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))
[PROOF STEP]
have "... \<le> real (card F)-1 + prob (\<Inter>(A ` F)) + prob (A x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>F. prob (A i)) + prob (A x) \<le> real (card F) - 1 + prob (\<Inter> (A ` F)) + prob (A x)
[PROOF STEP]
using H(4)
[PROOF STATE]
proof (prove)
using this:
(\<And>i. i \<in> F \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>F. prob (A i)) \<le> real (card F) - 1 + prob (\<Inter> (A ` F))

goal (1 subgoal):
 1. (\<Sum>i\<in>F. prob (A i)) + prob (A x) \<le> real (card F) - 1 + prob (\<Inter> (A ` F)) + prob (A x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>F. prob (A i)) + prob (A x) \<le> real (card F) - 1 + prob (\<Inter> (A ` F)) + prob (A x)

goal (2 subgoals):
 1. \<And>x. (\<And>i. i \<in> {x} \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>{x}. prob (A i)) \<le> real (card {x}) - 1 + prob (\<Inter> (A ` {x}))
 2. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>F. prob (A i)) \<le> real (card F) - 1 + prob (\<Inter> (A ` F)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> events\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>insert x F. prob (A i)) \<le> real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>F. prob (A i)) + prob (A x) \<le> real (card F) - 1 + prob (\<Inter> (A ` F)) + prob (A x)

goal (2 subgoals):
 1. \<And>x. (\<And>i. i \<in> {x} \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>{x}. prob (A i)) \<le> real (card {x}) - 1 + prob (\<Inter> (A ` {x}))
 2. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>F. prob (A i)) \<le> real (card F) - 1 + prob (\<Inter> (A ` F)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> events\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>insert x F. prob (A i)) \<le> real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))
[PROOF STEP]
have "... \<le> real (card F) + prob ((\<Inter>(A ` F)) \<inter> A x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card F) - 1 + prob (\<Inter> (A ` F)) + prob (A x) \<le> real (card F) + prob (\<Inter> (A ` F) \<inter> A x)
[PROOF STEP]
using sum_measure_le_measure_inter[OF \<open>(\<Inter>x\<in>F. A x) \<in> events\<close>, of "A x"]
[PROOF STATE]
proof (prove)
using this:
A x \<in> events \<Longrightarrow> prob (\<Inter> (A ` F)) + prob (A x) \<le> 1 + prob (\<Inter> (A ` F) \<inter> A x)

goal (1 subgoal):
 1. real (card F) - 1 + prob (\<Inter> (A ` F)) + prob (A x) \<le> real (card F) + prob (\<Inter> (A ` F) \<inter> A x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real (card F) - 1 + prob (\<Inter> (A ` F)) + prob (A x) \<le> real (card F) + prob (\<Inter> (A ` F) \<inter> A x)

goal (2 subgoals):
 1. \<And>x. (\<And>i. i \<in> {x} \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>{x}. prob (A i)) \<le> real (card {x}) - 1 + prob (\<Inter> (A ` {x}))
 2. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>F. prob (A i)) \<le> real (card F) - 1 + prob (\<Inter> (A ` F)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> events\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>insert x F. prob (A i)) \<le> real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (card F) - 1 + prob (\<Inter> (A ` F)) + prob (A x) \<le> real (card F) + prob (\<Inter> (A ` F) \<inter> A x)

goal (2 subgoals):
 1. \<And>x. (\<And>i. i \<in> {x} \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>{x}. prob (A i)) \<le> real (card {x}) - 1 + prob (\<Inter> (A ` {x}))
 2. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>F. prob (A i)) \<le> real (card F) - 1 + prob (\<Inter> (A ` F)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> events\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>insert x F. prob (A i)) \<le> real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))
[PROOF STEP]
have "... = real (card (insert x F)) - 1 + prob (\<Inter>(A ` (insert x F)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card F) + prob (\<Inter> (A ` F) \<inter> A x) = real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))
[PROOF STEP]
using H(1) H(2)
[PROOF STATE]
proof (prove)
using this:
finite F
F \<noteq> {}

goal (1 subgoal):
 1. real (card F) + prob (\<Inter> (A ` F) \<inter> A x) = real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))
[PROOF STEP]
unfolding card_insert_disjoint[OF \<open>finite F\<close> \<open>x \<notin> F\<close>]
[PROOF STATE]
proof (prove)
using this:
finite F
F \<noteq> {}

goal (1 subgoal):
 1. real (card F) + prob (\<Inter> (A ` F) \<inter> A x) = real (Suc (card F)) - 1 + prob (\<Inter> (A ` insert x F))
[PROOF STEP]
by (simp add: inf_commute)
[PROOF STATE]
proof (state)
this:
real (card F) + prob (\<Inter> (A ` F) \<inter> A x) = real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))

goal (2 subgoals):
 1. \<And>x. (\<And>i. i \<in> {x} \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>{x}. prob (A i)) \<le> real (card {x}) - 1 + prob (\<Inter> (A ` {x}))
 2. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>F. prob (A i)) \<le> real (card F) - 1 + prob (\<Inter> (A ` F)); \<And>i. i \<in> insert x F \<Longrightarrow> A i \<in> events\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>insert x F. prob (A i)) \<le> real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i\<in>insert x F. prob (A i)) \<le> real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))
[PROOF STEP]
show "(\<Sum>i\<in>insert x F. prob (A i)) \<le> real (card (insert x F)) - 1 + prob (\<Inter>(A ` (insert x F)))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<in>insert x F. prob (A i)) \<le> real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))

goal (1 subgoal):
 1. (\<Sum>i\<in>insert x F. prob (A i)) \<le> real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>insert x F. prob (A i)) \<le> real (card (insert x F)) - 1 + prob (\<Inter> (A ` insert x F))

goal (1 subgoal):
 1. \<And>x. (\<And>i. i \<in> {x} \<Longrightarrow> A i \<in> events) \<Longrightarrow> (\<Sum>i\<in>{x}. prob (A i)) \<le> real (card {x}) - 1 + prob (\<Inter> (A ` {x}))
[PROOF STEP]
qed (auto)


[STATEMENT]
lemma bezout_coefficients:
  assumes "bezout_coefficients a b = (x, y)"
  shows "x * a + y * b = gcd a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * a + y * b = gcd a b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bezout_coefficients a b = (x, y)

goal (1 subgoal):
 1. x * a + y * b = gcd a b
[PROOF STEP]
by (simp add: bezout_coefficients_def
    euclid_ext_aux_bezout [of a b a b 1 0 0 1 x y] prod_eq_iff)


[STATEMENT]
lemma choose_mono:
  assumes "x \<le> y"
  shows "x choose n \<le> y choose n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x choose n \<le> y choose n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x choose n \<le> y choose n
[PROOF STEP]
have "finite {0..<y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {0..<y}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite {0..<y}

goal (1 subgoal):
 1. x choose n \<le> y choose n
[PROOF STEP]
with finite_Pow_iff[of "{0..<y}"]
[PROOF STATE]
proof (chain)
picking this:
finite (Pow {0..<y}) = finite {0..<y}
finite {0..<y}
[PROOF STEP]
have finiteness: "finite {K \<in> Pow {0..<y}. card K = n}"
[PROOF STATE]
proof (prove)
using this:
finite (Pow {0..<y}) = finite {0..<y}
finite {0..<y}

goal (1 subgoal):
 1. finite {K \<in> Pow {0..<y}. card K = n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {K \<in> Pow {0..<y}. card K = n}

goal (1 subgoal):
 1. x choose n \<le> y choose n
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x \<le> y
[PROOF STEP]
have "Pow {0..<x} \<subseteq> Pow {0..<y}"
[PROOF STATE]
proof (prove)
using this:
x \<le> y

goal (1 subgoal):
 1. Pow {0..<x} \<subseteq> Pow {0..<y}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
Pow {0..<x} \<subseteq> Pow {0..<y}

goal (1 subgoal):
 1. x choose n \<le> y choose n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Pow {0..<x} \<subseteq> Pow {0..<y}
[PROOF STEP]
have "{K \<in> Pow {0..<x}. card K = n} \<subseteq> {K \<in> Pow {0..<y}. card K = n}"
[PROOF STATE]
proof (prove)
using this:
Pow {0..<x} \<subseteq> Pow {0..<y}

goal (1 subgoal):
 1. {K \<in> Pow {0..<x}. card K = n} \<subseteq> {K \<in> Pow {0..<y}. card K = n}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{K \<in> Pow {0..<x}. card K = n} \<subseteq> {K \<in> Pow {0..<y}. card K = n}

goal (1 subgoal):
 1. x choose n \<le> y choose n
[PROOF STEP]
from card_mono[OF finiteness this]
[PROOF STATE]
proof (chain)
picking this:
card {K \<in> Pow {0..<x}. card K = n} \<le> card {K \<in> Pow {0..<y}. card K = n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {K \<in> Pow {0..<x}. card K = n} \<le> card {K \<in> Pow {0..<y}. card K = n}

goal (1 subgoal):
 1. x choose n \<le> y choose n
[PROOF STEP]
unfolding binomial_def
[PROOF STATE]
proof (prove)
using this:
card {K \<in> Pow {0..<x}. card K = n} \<le> card {K \<in> Pow {0..<y}. card K = n}

goal (1 subgoal):
 1. card {K \<in> Pow {0..<x}. card K = n} \<le> card {K \<in> Pow {0..<y}. card K = n}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x choose n \<le> y choose n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem "\<exists>(j::int). \<forall>i. j \<le> i --> (\<exists>x y. 0 \<le> x & 0 \<le> y & 3 * x + 5 * y = i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>j. \<forall>i\<ge>j. \<exists>x y. 0 \<le> x \<and> 0 \<le> y \<and> 3 * x + 5 * y = i
[PROOF STEP]
by presburger


[STATEMENT]
lemma at_most_one_player_winning:
shows "\<not> (\<exists> \<sigma>\<^sub>e. strategy_winning_by_Even \<sigma>\<^sub>e p) \<or> \<not> (\<exists> \<sigma>\<^sub>o. strategy_winning_by_Odd \<sigma>\<^sub>o p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>\<sigma>\<^sub>e. strategy_winning_by_Even \<sigma>\<^sub>e p) \<or> (\<nexists>\<sigma>\<^sub>o. strategy_winning_by_Odd \<sigma>\<^sub>o p)
[PROOF STEP]
unfolding strategy_winning_by_Even_def strategy_winning_by_Odd_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>\<sigma>\<^sub>e. \<forall>\<sigma>\<^sub>o. induced_play (joint_strategy \<sigma>\<^sub>e \<sigma>\<^sub>o) p \<in> A) \<or> (\<nexists>\<sigma>\<^sub>o. \<forall>\<sigma>\<^sub>e. induced_play (joint_strategy \<sigma>\<^sub>e \<sigma>\<^sub>o) p \<notin> A)
[PROOF STEP]
by auto


[STATEMENT]
lemma differentiable_power_int [simp, derivative_intros]:
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_field"
  shows "f differentiable (at x within s) \<Longrightarrow> f x \<noteq> 0 \<Longrightarrow>
           (\<lambda>x. power_int (f x) n) differentiable (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f differentiable at x within s; f x \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> (\<lambda>x. f x powi n) differentiable at x within s
[PROOF STEP]
unfolding differentiable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>D. (f has_derivative D) (at x within s); f x \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> \<exists>D. ((\<lambda>x. f x powi n) has_derivative D) (at x within s)
[PROOF STEP]
by (blast intro: has_derivative_power_int)


[STATEMENT]
lemma powr_mult_2: "(x::real) > 0 \<Longrightarrow> x powr (y * 2) = (x^2) powr y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> x powr (y * 2) = x\<^sup>2 powr y
[PROOF STEP]
by (subst mult.commute, subst powr_powr [symmetric]) (simp add: powr_numeral)


[STATEMENT]
lemma primepow_power_iff_nat:
  "p > 0 \<Longrightarrow> primepow (p ^ n) \<longleftrightarrow> primepow (p :: nat) \<and> n > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < p \<Longrightarrow> primepow (p ^ n) = (primepow p \<and> 0 < n)
[PROOF STEP]
by (rule primepow_power_iff) (simp_all add: unit_factor_nat_def)


[STATEMENT]
lemma (in jozsa) prob0_fst_qubits_of_jozsa_algo:
  shows "(prob0_fst_qubits n jozsa_algo) = (\<Sum>j\<in>{0,1}. (cmod(jozsa_algo $$ (j,0)))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob0_fst_qubits n jozsa_algo = (\<Sum>j\<in>{0, 1}. (cmod (jozsa_algo $$ (j, 0)))\<^sup>2)
[PROOF STEP]
using prob0_fst_qubits_eq
[PROOF STATE]
proof (prove)
using this:
prob0_fst_qubits ?n ?v = (cmod (?v $$ (0, 0)))\<^sup>2 + (cmod (?v $$ (1, 0)))\<^sup>2

goal (1 subgoal):
 1. prob0_fst_qubits n jozsa_algo = (\<Sum>j\<in>{0, 1}. (cmod (jozsa_algo $$ (j, 0)))\<^sup>2)
[PROOF STEP]
by simp


[STATEMENT]
lemma merge_msets_aux: "\<lbrakk>l\<le>m; m\<le>h\<rbrakk> \<Longrightarrow> mset (lran a l m) + mset (lran a m h) = mset (lran a l h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>l \<le> m; m \<le> h\<rbrakk> \<Longrightarrow> mset (lran a l m) + mset (lran a m h) = mset (lran a l h)
[PROOF STEP]
by (auto simp: mset_lran mset_ran_combine ivl_disj_un_two)


[STATEMENT]
lemma ex_k1_k2:
  assumes coprime: "coprime (e :: nat) ((P-1)*(Q-1))"
    and "[e*d = 1] (mod (P-1))"
  shows "\<exists> k1 k2. e*d + k1*(P-1) = 1 + k2*(P-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k1 k2. e * d + k1 * (P - 1) = 1 + k2 * (P - 1)
[PROOF STEP]
by (metis assms(2) cong_iff_lin_nat)


[STATEMENT]
lemma sumset_subgroup_eq_iff:
  assumes "a \<in> G" and "b \<in> G"
  shows "sumset {a} H = sumset {b} H \<longleftrightarrow>
    (sumset {a} H) \<inter> (sumset {b} H) \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sumset {a} H = sumset {b} H) = (sumset {a} H \<inter> sumset {b} H \<noteq> {})
[PROOF STEP]
using Right_Coset_eq_iff assms Left_Coset_eq_sumset Left_equals_Right_coset
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> G; ?y \<in> G\<rbrakk> \<Longrightarrow> (Right_Coset H ?x = Right_Coset H ?y) = (Right_Coset H ?x \<inter> Right_Coset H ?y \<noteq> {})
a \<in> G
b \<in> G
?x \<in> G \<Longrightarrow> sumset {?x} H = ?x \<cdot>| H
?g \<in> G \<Longrightarrow> ?g \<cdot>| H = Right_Coset H ?g

goal (1 subgoal):
 1. (sumset {a} H = sumset {b} H) = (sumset {a} H \<inter> sumset {b} H \<noteq> {})
[PROOF STEP]
by presburger


[STATEMENT]
lemma affine_dependent_imp_collinear_3:
  "affine_dependent {a,b,c} \<Longrightarrow> collinear{a,b,c}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine_dependent {a, b, c} \<Longrightarrow> collinear {a, b, c}
[PROOF STEP]
by (simp add: collinear_3_eq_affine_dependent)


[STATEMENT]
lemma bit_word_roti_iff [bit_simps]:
  \<open>bit (word_roti k w) n \<longleftrightarrow>
    n < LENGTH('a) \<and> bit w (nat ((int n + k) mod int LENGTH('a)))\<close>
  for w :: \<open>'a::len word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit (word_roti k w) n = (n < LENGTH('a) \<and> bit w (nat ((int n + k) mod int LENGTH('a))))
[PROOF STEP]
proof transfer
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k w n. (n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - nat (k mod int LENGTH('a))) (drop_bit (nat (k mod int LENGTH('a))) (take_bit LENGTH('a) w)) (take_bit (nat (k mod int LENGTH('a))) w)) n) = (n < LENGTH('a) \<and> nat ((int n + k) mod int LENGTH('a)) < LENGTH('a) \<and> bit w (nat ((int n + k) mod int LENGTH('a))))
[PROOF STEP]
fix k l :: int and n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k w n. (n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - nat (k mod int LENGTH('a))) (drop_bit (nat (k mod int LENGTH('a))) (take_bit LENGTH('a) w)) (take_bit (nat (k mod int LENGTH('a))) w)) n) = (n < LENGTH('a) \<and> nat ((int n + k) mod int LENGTH('a)) < LENGTH('a) \<and> bit w (nat ((int n + k) mod int LENGTH('a))))
[PROOF STEP]
define m where \<open>m = nat (k mod int LENGTH('a))\<close>
[PROOF STATE]
proof (state)
this:
m = nat (k mod int LENGTH('a))

goal (1 subgoal):
 1. \<And>k w n. (n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - nat (k mod int LENGTH('a))) (drop_bit (nat (k mod int LENGTH('a))) (take_bit LENGTH('a) w)) (take_bit (nat (k mod int LENGTH('a))) w)) n) = (n < LENGTH('a) \<and> nat ((int n + k) mod int LENGTH('a)) < LENGTH('a) \<and> bit w (nat ((int n + k) mod int LENGTH('a))))
[PROOF STEP]
have \<open>m < LENGTH('a)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m < LENGTH('a)
[PROOF STEP]
by (simp add: nat_less_iff m_def)
[PROOF STATE]
proof (state)
this:
m < LENGTH('a)

goal (1 subgoal):
 1. \<And>k w n. (n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - nat (k mod int LENGTH('a))) (drop_bit (nat (k mod int LENGTH('a))) (take_bit LENGTH('a) w)) (take_bit (nat (k mod int LENGTH('a))) w)) n) = (n < LENGTH('a) \<and> nat ((int n + k) mod int LENGTH('a)) < LENGTH('a) \<and> bit w (nat ((int n + k) mod int LENGTH('a))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m < LENGTH('a)
[PROOF STEP]
have \<open>m \<le> LENGTH('a)\<close>
[PROOF STATE]
proof (prove)
using this:
m < LENGTH('a)

goal (1 subgoal):
 1. m \<le> LENGTH('a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m \<le> LENGTH('a)

goal (1 subgoal):
 1. \<And>k w n. (n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - nat (k mod int LENGTH('a))) (drop_bit (nat (k mod int LENGTH('a))) (take_bit LENGTH('a) w)) (take_bit (nat (k mod int LENGTH('a))) w)) n) = (n < LENGTH('a) \<and> nat ((int n + k) mod int LENGTH('a)) < LENGTH('a) \<and> bit w (nat ((int n + k) mod int LENGTH('a))))
[PROOF STEP]
have \<open>k mod int LENGTH('a) = int m\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k mod int LENGTH('a) = int m
[PROOF STEP]
by (simp add: nat_less_iff m_def)
[PROOF STATE]
proof (state)
this:
k mod int LENGTH('a) = int m

goal (1 subgoal):
 1. \<And>k w n. (n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - nat (k mod int LENGTH('a))) (drop_bit (nat (k mod int LENGTH('a))) (take_bit LENGTH('a) w)) (take_bit (nat (k mod int LENGTH('a))) w)) n) = (n < LENGTH('a) \<and> nat ((int n + k) mod int LENGTH('a)) < LENGTH('a) \<and> bit w (nat ((int n + k) mod int LENGTH('a))))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
k mod int LENGTH('a) = int m

goal (1 subgoal):
 1. \<And>k w n. (n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - nat (k mod int LENGTH('a))) (drop_bit (nat (k mod int LENGTH('a))) (take_bit LENGTH('a) w)) (take_bit (nat (k mod int LENGTH('a))) w)) n) = (n < LENGTH('a) \<and> nat ((int n + k) mod int LENGTH('a)) < LENGTH('a) \<and> bit w (nat ((int n + k) mod int LENGTH('a))))
[PROOF STEP]
have \<open>(int n + k) mod int LENGTH('a) = int ((n + m) mod LENGTH('a))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (int n + k) mod int LENGTH('a) = int ((n + m) mod LENGTH('a))
[PROOF STEP]
by (subst mod_add_right_eq [symmetric]) (simp add: of_nat_mod \<open>k mod int LENGTH('a) = int m\<close>)
[PROOF STATE]
proof (state)
this:
(int n + k) mod int LENGTH('a) = int ((n + m) mod LENGTH('a))

goal (1 subgoal):
 1. \<And>k w n. (n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - nat (k mod int LENGTH('a))) (drop_bit (nat (k mod int LENGTH('a))) (take_bit LENGTH('a) w)) (take_bit (nat (k mod int LENGTH('a))) w)) n) = (n < LENGTH('a) \<and> nat ((int n + k) mod int LENGTH('a)) < LENGTH('a) \<and> bit w (nat ((int n + k) mod int LENGTH('a))))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(int n + k) mod int LENGTH('a) = int ((n + m) mod LENGTH('a))

goal (1 subgoal):
 1. \<And>k w n. (n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - nat (k mod int LENGTH('a))) (drop_bit (nat (k mod int LENGTH('a))) (take_bit LENGTH('a) w)) (take_bit (nat (k mod int LENGTH('a))) w)) n) = (n < LENGTH('a) \<and> nat ((int n + k) mod int LENGTH('a)) < LENGTH('a) \<and> bit w (nat ((int n + k) mod int LENGTH('a))))
[PROOF STEP]
have \<open>n < LENGTH('a) \<and>
    bit (concat_bit (LENGTH('a) - m) (drop_bit m (take_bit LENGTH('a) l)) (take_bit m l)) n \<longleftrightarrow>
    n < LENGTH('a) \<and> bit l ((n + m) mod LENGTH('a))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - m) (drop_bit m (take_bit LENGTH('a) l)) (take_bit m l)) n) = (n < LENGTH('a) \<and> bit l ((n + m) mod LENGTH('a)))
[PROOF STEP]
using \<open>m < LENGTH('a)\<close>
[PROOF STATE]
proof (prove)
using this:
m < LENGTH('a)

goal (1 subgoal):
 1. (n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - m) (drop_bit m (take_bit LENGTH('a) l)) (take_bit m l)) n) = (n < LENGTH('a) \<and> bit l ((n + m) mod LENGTH('a)))
[PROOF STEP]
by (cases \<open>m + n \<ge> LENGTH('a)\<close>)
     (auto simp add: bit_concat_bit_iff bit_drop_bit_eq
        bit_take_bit_iff nat_less_iff not_le not_less ac_simps
        le_diff_conv le_mod_geq)
[PROOF STATE]
proof (state)
this:
(n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - m) (drop_bit m (take_bit LENGTH('a) l)) (take_bit m l)) n) = (n < LENGTH('a) \<and> bit l ((n + m) mod LENGTH('a)))

goal (1 subgoal):
 1. \<And>k w n. (n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - nat (k mod int LENGTH('a))) (drop_bit (nat (k mod int LENGTH('a))) (take_bit LENGTH('a) w)) (take_bit (nat (k mod int LENGTH('a))) w)) n) = (n < LENGTH('a) \<and> nat ((int n + k) mod int LENGTH('a)) < LENGTH('a) \<and> bit w (nat ((int n + k) mod int LENGTH('a))))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
k mod int LENGTH('a) = int m
(int n + k) mod int LENGTH('a) = int ((n + m) mod LENGTH('a))
(n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - m) (drop_bit m (take_bit LENGTH('a) l)) (take_bit m l)) n) = (n < LENGTH('a) \<and> bit l ((n + m) mod LENGTH('a)))
[PROOF STEP]
show \<open>n < LENGTH('a)
    \<and> bit (concat_bit (LENGTH('a) - nat (k mod int LENGTH('a)))
             (drop_bit (nat (k mod int LENGTH('a))) (take_bit LENGTH('a) l))
             (take_bit (nat (k mod int LENGTH('a))) l)) n \<longleftrightarrow>
       n < LENGTH('a)
    \<and> nat ((int n + k) mod int LENGTH('a)) < LENGTH('a)
    \<and> bit l (nat ((int n + k) mod int LENGTH('a)))\<close>
[PROOF STATE]
proof (prove)
using this:
k mod int LENGTH('a) = int m
(int n + k) mod int LENGTH('a) = int ((n + m) mod LENGTH('a))
(n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - m) (drop_bit m (take_bit LENGTH('a) l)) (take_bit m l)) n) = (n < LENGTH('a) \<and> bit l ((n + m) mod LENGTH('a)))

goal (1 subgoal):
 1. (n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - nat (k mod int LENGTH('a))) (drop_bit (nat (k mod int LENGTH('a))) (take_bit LENGTH('a) l)) (take_bit (nat (k mod int LENGTH('a))) l)) n) = (n < LENGTH('a) \<and> nat ((int n + k) mod int LENGTH('a)) < LENGTH('a) \<and> bit l (nat ((int n + k) mod int LENGTH('a))))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(n < LENGTH('a) \<and> bit (concat_bit (LENGTH('a) - nat (k mod int LENGTH('a))) (drop_bit (nat (k mod int LENGTH('a))) (take_bit LENGTH('a) l)) (take_bit (nat (k mod int LENGTH('a))) l)) n) = (n < LENGTH('a) \<and> nat ((int n + k) mod int LENGTH('a)) < LENGTH('a) \<and> bit l (nat ((int n + k) mod int LENGTH('a))))

goal:
No subgoals!
[PROOF STEP]
qed