[STATEMENT]
theorem bound_main_lemma:
  fixes PROB :: "'a problem"
  assumes "finite PROB"
  shows "(problem_plan_bound PROB \<le> (2 ^ (card (prob_dom PROB))) - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. problem_plan_bound PROB \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. problem_plan_bound PROB \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
have "MPLS PROB \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPLS PROB \<noteq> {}
[PROOF STEP]
using assms MPLS_nempty
[PROOF STATE]
proof (prove)
using this:
finite PROB
finite ?PROB \<Longrightarrow> MPLS ?PROB \<noteq> {}

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

goal (1 subgoal):
 1. problem_plan_bound PROB \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
MPLS PROB \<noteq> {}

goal (1 subgoal):
 1. problem_plan_bound PROB \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
have "(\<forall>x. x \<in> MPLS PROB \<longrightarrow> x \<le> 2 ^ card (prob_dom PROB) - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. x \<in> MPLS PROB \<longrightarrow> x \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
using assms in_MPLS_leq_2_pow_n
[PROOF STATE]
proof (prove)
using this:
finite PROB
\<lbrakk>finite ?PROB; ?x \<in> MPLS ?PROB\<rbrakk> \<Longrightarrow> ?x \<le> 2 ^ card (prob_dom ?PROB) - 1

goal (1 subgoal):
 1. \<forall>x. x \<in> MPLS PROB \<longrightarrow> x \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>x. x \<in> MPLS PROB \<longrightarrow> x \<le> 2 ^ card (prob_dom PROB) - 1

goal (1 subgoal):
 1. problem_plan_bound PROB \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
MPLS PROB \<noteq> {}
\<forall>x. x \<in> MPLS PROB \<longrightarrow> x \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
MPLS PROB \<noteq> {}
\<forall>x. x \<in> MPLS PROB \<longrightarrow> x \<le> 2 ^ card (prob_dom PROB) - 1

goal (1 subgoal):
 1. problem_plan_bound PROB \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
unfolding problem_plan_bound_def
[PROOF STATE]
proof (prove)
using this:
MPLS PROB \<noteq> {}
\<forall>x. x \<in> MPLS PROB \<longrightarrow> x \<le> 2 ^ card (prob_dom PROB) - 1

goal (1 subgoal):
 1. Sup (MPLS PROB) \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
using cSup_least
[PROOF STATE]
proof (prove)
using this:
MPLS PROB \<noteq> {}
\<forall>x. x \<in> MPLS PROB \<longrightarrow> x \<le> 2 ^ card (prob_dom PROB) - 1
\<lbrakk>?X \<noteq> {}; \<And>x. x \<in> ?X \<Longrightarrow> x \<le> ?z\<rbrakk> \<Longrightarrow> Sup ?X \<le> ?z

goal (1 subgoal):
 1. Sup (MPLS PROB) \<le> 2 ^ card (prob_dom PROB) - 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
problem_plan_bound PROB \<le> 2 ^ card (prob_dom PROB) - 1

goal:
No subgoals!
[PROOF STEP]
qed

\<comment> \<open>NOTE types in premise had to be fixed to be able to match `valid\_as\_valid\_exec`.\<close>


[STATEMENT]
lemma card_bijections_domain_and_range_permutation_eq_0:
  assumes "card A \<noteq> card B"
  shows "card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B) = 0
[PROOF STEP]
using bij_betw_quotient_domain_and_range_permutation_eq_empty[OF assms]
[PROOF STATE]
proof (prove)
using this:
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B = {}

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B) = 0
[PROOF STEP]
by (simp only: card.empty)


[STATEMENT]
lemma solution_set_rel_solve:
  fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
  assumes con: "consistent A b"
  shows "solution_set A b = {fst (the (solve A b))} + vec.span (snd (the (solve A b)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. solution_set A b = {fst (the (solve A b))} + vec.span (snd (the (solve A b)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. solution_set A b = {fst (the (solve A b))} + vec.span (snd (the (solve A b)))
[PROOF STEP]
have s: "is_solution (fst (the (solve A b))) A b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_solution (fst (the (solve A b))) A b
[PROOF STEP]
using consistent_imp_is_solution_solve[OF con]
[PROOF STATE]
proof (prove)
using this:
is_solution (fst (the (solve A b))) A b

goal (1 subgoal):
 1. is_solution (fst (the (solve A b))) A b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
is_solution (fst (the (solve A b))) A b

goal (1 subgoal):
 1. solution_set A b = {fst (the (solve A b))} + vec.span (snd (the (solve A b)))
[PROOF STEP]
have "solution_set A b = {fst (the (solve A b))} + solution_set A 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. solution_set A b = {fst (the (solve A b))} + solution_set A 0
[PROOF STEP]
using solution_set_rel[OF s]
[PROOF STATE]
proof (prove)
using this:
solution_set A b = {fst (the (solve A b))} + solution_set A 0

goal (1 subgoal):
 1. solution_set A b = {fst (the (solve A b))} + solution_set A 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
solution_set A b = {fst (the (solve A b))} + solution_set A 0

goal (1 subgoal):
 1. solution_set A b = {fst (the (solve A b))} + vec.span (snd (the (solve A b)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
solution_set A b = {fst (the (solve A b))} + solution_set A 0

goal (1 subgoal):
 1. solution_set A b = {fst (the (solve A b))} + vec.span (snd (the (solve A b)))
[PROOF STEP]
have "... = {fst (the (solve A b))} + vec.span (snd (the (solve A b)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {fst (the (solve A b))} + solution_set A 0 = {fst (the (solve A b))} + vec.span (snd (the (solve A b)))
[PROOF STEP]
unfolding set_plus_def solve_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {c. \<exists>a\<in>{fst (the (if consistent A b then Some (solve_consistent_rref (fst (solve_system A b)) (snd (solve_system A b)), basis_null_space A) else None))}. \<exists>b\<in>solution_set A 0. c = a + b} = {c. \<exists>a\<in>{fst (the (if consistent A b then Some (solve_consistent_rref (fst (solve_system A b)) (snd (solve_system A b)), basis_null_space A) else None))}. \<exists>b\<in>vec.span (snd (the (if consistent A b then Some (solve_consistent_rref (fst (solve_system A b)) (snd (solve_system A b)), basis_null_space A) else None))). c = a + b}
[PROOF STEP]
unfolding if_P[OF con] snd_conv fst_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {c. \<exists>a\<in>{fst (the (Some (solve_consistent_rref (fst (solve_system A b)) (snd (solve_system A b)), basis_null_space A)))}. \<exists>b\<in>solution_set A 0. c = a + b} = {c. \<exists>a\<in>{fst (the (Some (solve_consistent_rref (fst (solve_system A b)) (snd (solve_system A b)), basis_null_space A)))}. \<exists>b\<in>vec.span (snd (the (Some (solve_consistent_rref (fst (solve_system A b)) (snd (solve_system A b)), basis_null_space A)))). c = a + b}
[PROOF STEP]
proof (safe, simp_all)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>b. b \<in> solution_set A 0 \<Longrightarrow> b \<in> vec.span (basis_null_space A)
 2. \<And>b. b \<in> vec.span (basis_null_space A) \<Longrightarrow> b \<in> solution_set A 0
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>b. b \<in> solution_set A 0 \<Longrightarrow> b \<in> vec.span (basis_null_space A)
 2. \<And>b. b \<in> vec.span (basis_null_space A) \<Longrightarrow> b \<in> solution_set A 0
[PROOF STEP]
assume "b \<in> solution_set A 0"
[PROOF STATE]
proof (state)
this:
b \<in> solution_set A 0

goal (2 subgoals):
 1. \<And>b. b \<in> solution_set A 0 \<Longrightarrow> b \<in> vec.span (basis_null_space A)
 2. \<And>b. b \<in> vec.span (basis_null_space A) \<Longrightarrow> b \<in> solution_set A 0
[PROOF STEP]
thus "b \<in> vec.span (basis_null_space A)"
[PROOF STATE]
proof (prove)
using this:
b \<in> solution_set A 0

goal (1 subgoal):
 1. b \<in> vec.span (basis_null_space A)
[PROOF STEP]
unfolding null_space_eq_solution_set[symmetric]
[PROOF STATE]
proof (prove)
using this:
b \<in> null_space A

goal (1 subgoal):
 1. b \<in> vec.span (basis_null_space A)
[PROOF STEP]
using basis_null_space[of A]
[PROOF STATE]
proof (prove)
using this:
b \<in> null_space A
vec.independent (basis_null_space A) \<and> null_space A = vec.span (basis_null_space A)

goal (1 subgoal):
 1. b \<in> vec.span (basis_null_space A)
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
b \<in> vec.span (basis_null_space A)

goal (1 subgoal):
 1. \<And>b. b \<in> vec.span (basis_null_space A) \<Longrightarrow> b \<in> solution_set A 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. b \<in> vec.span (basis_null_space A) \<Longrightarrow> b \<in> solution_set A 0
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. b \<in> vec.span (basis_null_space A) \<Longrightarrow> b \<in> solution_set A 0
[PROOF STEP]
assume b: "b \<in> vec.span (basis_null_space A)"
[PROOF STATE]
proof (state)
this:
b \<in> vec.span (basis_null_space A)

goal (1 subgoal):
 1. \<And>b. b \<in> vec.span (basis_null_space A) \<Longrightarrow> b \<in> solution_set A 0
[PROOF STEP]
thus "b \<in> solution_set A 0"
[PROOF STATE]
proof (prove)
using this:
b \<in> vec.span (basis_null_space A)

goal (1 subgoal):
 1. b \<in> solution_set A 0
[PROOF STEP]
unfolding null_space_eq_solution_set[symmetric]
[PROOF STATE]
proof (prove)
using this:
b \<in> vec.span (basis_null_space A)

goal (1 subgoal):
 1. b \<in> null_space A
[PROOF STEP]
using basis_null_space
[PROOF STATE]
proof (prove)
using this:
b \<in> vec.span (basis_null_space A)
vec.independent (basis_null_space ?A) \<and> null_space ?A = vec.span (basis_null_space ?A)

goal (1 subgoal):
 1. b \<in> null_space A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b \<in> solution_set A 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{fst (the (solve A b))} + solution_set A 0 = {fst (the (solve A b))} + vec.span (snd (the (solve A b)))

goal (1 subgoal):
 1. solution_set A b = {fst (the (solve A b))} + vec.span (snd (the (solve A b)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
solution_set A b = {fst (the (solve A b))} + vec.span (snd (the (solve A b)))
[PROOF STEP]
show "solution_set A b = {fst (the (solve A b))} + vec.span (snd (the (solve A b)))"
[PROOF STATE]
proof (prove)
using this:
solution_set A b = {fst (the (solve A b))} + vec.span (snd (the (solve A b)))

goal (1 subgoal):
 1. solution_set A b = {fst (the (solve A b))} + vec.span (snd (the (solve A b)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
solution_set A b = {fst (the (solve A b))} + vec.span (snd (the (solve A b)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linord_of_list_Linear_order:
  assumes "distinct xs"
  assumes "ys = set xs"
  shows "linear_order_on ys (linord_of_list xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear_order_on ys (linord_of_list xs)
[PROOF STEP]
using %invisible assms linord_of_list_range linord_of_list_refl_on linord_of_list_trans linord_of_list_antisym linord_of_list_total_on
[PROOF STATE]
proof (prove)
using this:
distinct xs
ys = set xs
linord_of_list ?xs \<subseteq> set ?xs \<times> set ?xs
refl_on (set ?xs) (linord_of_list ?xs)
distinct ?xs \<Longrightarrow> trans (linord_of_list ?xs)
distinct ?xs \<Longrightarrow> antisym (linord_of_list ?xs)
total_on (set ?xs) (linord_of_list ?xs)

goal (1 subgoal):
 1. linear_order_on ys (linord_of_list xs)
[PROOF STEP]
unfolding order_on_defs
[PROOF STATE]
proof (prove)
using this:
distinct xs
ys = set xs
linord_of_list ?xs \<subseteq> set ?xs \<times> set ?xs
refl_on (set ?xs) (linord_of_list ?xs)
distinct ?xs \<Longrightarrow> trans (linord_of_list ?xs)
distinct ?xs \<Longrightarrow> antisym (linord_of_list ?xs)
total_on (set ?xs) (linord_of_list ?xs)

goal (1 subgoal):
 1. ((refl_on ys (linord_of_list xs) \<and> trans (linord_of_list xs)) \<and> antisym (linord_of_list xs)) \<and> total_on ys (linord_of_list xs)
[PROOF STEP]
by force


[STATEMENT]
lemma matrix_sum_cong:
  fixes f :: "nat \<Rightarrow> 'b::semiring_1 mat"
  shows "(\<And>k. k < n \<Longrightarrow> f k = f' k) \<Longrightarrow> matrix_sum d f n = matrix_sum d f' n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. k < n \<Longrightarrow> f k = f' k) \<Longrightarrow> matrix_sum d f n = matrix_sum d f' n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>k. k < 0 \<Longrightarrow> f k = f' k) \<Longrightarrow> matrix_sum d f 0 = matrix_sum d f' 0
 2. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k = f' k) \<Longrightarrow> matrix_sum d f n = matrix_sum d f' n; \<And>k. k < Suc n \<Longrightarrow> f k = f' k\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) = matrix_sum d f' (Suc n)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
?k < 0 \<Longrightarrow> f ?k = f' ?k

goal (2 subgoals):
 1. (\<And>k. k < 0 \<Longrightarrow> f k = f' k) \<Longrightarrow> matrix_sum d f 0 = matrix_sum d f' 0
 2. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k = f' k) \<Longrightarrow> matrix_sum d f n = matrix_sum d f' n; \<And>k. k < Suc n \<Longrightarrow> f k = f' k\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) = matrix_sum d f' (Suc n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d f 0 = matrix_sum d f' 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d f 0 = matrix_sum d f' 0

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k = f' k) \<Longrightarrow> matrix_sum d f n = matrix_sum d f' n; \<And>k. k < Suc n \<Longrightarrow> f k = f' k\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) = matrix_sum d f' (Suc n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k = f' k) \<Longrightarrow> matrix_sum d f n = matrix_sum d f' n; \<And>k. k < Suc n \<Longrightarrow> f k = f' k\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) = matrix_sum d f' (Suc n)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
(\<And>k. k < n \<Longrightarrow> f k = f' k) \<Longrightarrow> matrix_sum d f n = matrix_sum d f' n
?k < Suc n \<Longrightarrow> f ?k = f' ?k

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k = f' k) \<Longrightarrow> matrix_sum d f n = matrix_sum d f' n; \<And>k. k < Suc n \<Longrightarrow> f k = f' k\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) = matrix_sum d f' (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<And>k. k < n \<Longrightarrow> f k = f' k) \<Longrightarrow> matrix_sum d f n = matrix_sum d f' n
?k < Suc n \<Longrightarrow> f ?k = f' ?k
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<And>k. k < n \<Longrightarrow> f k = f' k) \<Longrightarrow> matrix_sum d f n = matrix_sum d f' n
?k < Suc n \<Longrightarrow> f ?k = f' ?k

goal (1 subgoal):
 1. matrix_sum d f (Suc n) = matrix_sum d f' (Suc n)
[PROOF STEP]
unfolding matrix_sum.simps
[PROOF STATE]
proof (prove)
using this:
(\<And>k. k < n \<Longrightarrow> f k = f' k) \<Longrightarrow> matrix_sum d f n = matrix_sum d f' n
?k < Suc n \<Longrightarrow> f ?k = f' ?k

goal (1 subgoal):
 1. f n + matrix_sum d f n = f' n + matrix_sum d f' n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d f (Suc n) = matrix_sum d f' (Suc n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convex_halfspace_ge: "convex {x. inner a x \<ge> b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex {x. b \<le> a \<bullet> x}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex {x. b \<le> a \<bullet> x}
[PROOF STEP]
have *: "{x. inner a x \<ge> b} = {x. inner (-a) x \<le> -b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. b \<le> a \<bullet> x} = {x. - a \<bullet> x \<le> - b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x. b \<le> a \<bullet> x} = {x. - a \<bullet> x \<le> - b}

goal (1 subgoal):
 1. convex {x. b \<le> a \<bullet> x}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex {x. b \<le> a \<bullet> x}
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex {x. - a \<bullet> x \<le> - b}
[PROOF STEP]
using convex_halfspace_le[of "-a" "-b"]
[PROOF STATE]
proof (prove)
using this:
convex {x. - a \<bullet> x \<le> - b}

goal (1 subgoal):
 1. convex {x. - a \<bullet> x \<le> - b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
convex {x. b \<le> a \<bullet> x}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exp_cnj: "cnj (exp z) = exp (cnj z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj (exp z) = exp (cnj z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cnj (exp z) = exp (cnj z)
[PROOF STEP]
have "(\<lambda>n. cnj (z ^ n /\<^sub>R (fact n))) = (\<lambda>n. (cnj z)^n /\<^sub>R (fact n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. cnj (z ^ n /\<^sub>R fact n)) = (\<lambda>n. cnj z ^ n /\<^sub>R fact n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. cnj (z ^ n /\<^sub>R fact n)) = (\<lambda>n. cnj z ^ n /\<^sub>R fact n)

goal (1 subgoal):
 1. cnj (exp z) = exp (cnj z)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. cnj (z ^ n /\<^sub>R fact n)) = (\<lambda>n. cnj z ^ n /\<^sub>R fact n)

goal (1 subgoal):
 1. cnj (exp z) = exp (cnj z)
[PROOF STEP]
have "\<dots> sums (exp (cnj z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. cnj z ^ n /\<^sub>R fact n) sums exp (cnj z)
[PROOF STEP]
by (rule exp_converges)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. cnj z ^ n /\<^sub>R fact n) sums exp (cnj z)

goal (1 subgoal):
 1. cnj (exp z) = exp (cnj z)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. cnj (z ^ n /\<^sub>R fact n)) sums exp (cnj z)
[PROOF STEP]
have "(\<lambda>n. cnj (z ^ n /\<^sub>R (fact n))) sums (exp (cnj z))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. cnj (z ^ n /\<^sub>R fact n)) sums exp (cnj z)

goal (1 subgoal):
 1. (\<lambda>n. cnj (z ^ n /\<^sub>R fact n)) sums exp (cnj z)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. cnj (z ^ n /\<^sub>R fact n)) sums exp (cnj z)

goal (1 subgoal):
 1. cnj (exp z) = exp (cnj z)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>n. cnj (z ^ n /\<^sub>R fact n)) sums exp (cnj z)

goal (1 subgoal):
 1. cnj (exp z) = exp (cnj z)
[PROOF STEP]
have "(\<lambda>n. cnj (z ^ n /\<^sub>R (fact n))) sums (cnj (exp z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. cnj (z ^ n /\<^sub>R fact n)) sums cnj (exp z)
[PROOF STEP]
by (metis exp_converges sums_cnj)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. cnj (z ^ n /\<^sub>R fact n)) sums cnj (exp z)

goal (1 subgoal):
 1. cnj (exp z) = exp (cnj z)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. cnj (z ^ n /\<^sub>R fact n)) sums exp (cnj z)
(\<lambda>n. cnj (z ^ n /\<^sub>R fact n)) sums cnj (exp z)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. cnj (z ^ n /\<^sub>R fact n)) sums exp (cnj z)
(\<lambda>n. cnj (z ^ n /\<^sub>R fact n)) sums cnj (exp z)

goal (1 subgoal):
 1. cnj (exp z) = exp (cnj z)
[PROOF STEP]
using sums_unique2
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. cnj (z ^ n /\<^sub>R fact n)) sums exp (cnj z)
(\<lambda>n. cnj (z ^ n /\<^sub>R fact n)) sums cnj (exp z)
\<lbrakk>?f sums ?a; ?f sums ?b\<rbrakk> \<Longrightarrow> ?a = ?b

goal (1 subgoal):
 1. cnj (exp z) = exp (cnj z)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
cnj (exp z) = exp (cnj z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rtos_inj:"\<lbrakk> (0::nat) < r; (0::nat) < s \<rbrakk> \<Longrightarrow>
                   inj_on (rtos r s) {i. i \<le> (r * s - Suc 0)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s\<rbrakk> \<Longrightarrow> inj_on (rtos r s) {i. i \<le> r * s - Suc 0}
[PROOF STEP]
apply (simp add:inj_on_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s\<rbrakk> \<Longrightarrow> \<forall>x\<le>r * s - Suc 0. \<forall>y\<le>r * s - Suc 0. rtos r s x = rtos r s y \<longrightarrow> x = y
[PROOF STEP]
apply ((rule allI, rule impI)+, rule impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 < r; 0 < s; x \<le> r * s - Suc 0; y \<le> r * s - Suc 0; rtos r s x = rtos r s y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
apply (frule_tac i1 = x in rtos_hom3_1[THEN sym, of "r" "s"], assumption+,
        frule_tac i1 = x in rtos_hom3[THEN sym, of "r" "s"], assumption+,
        frule_tac i = y in rtos_hom3_1[of "r" "s"], assumption+,
        frule_tac i = y in rtos_hom3[of "r" "s"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 < r; 0 < s; x \<le> r * s - Suc 0; y \<le> r * s - Suc 0; rtos r s x = rtos r s y; x div s = rtos r s x mod r; x mod s = rtos r s x div r; rtos r s y mod r = y div s; rtos r s y div r = y mod s\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>0 < r; 0 < s; x \<le> r * s - Suc 0; y \<le> r * s - Suc 0; rtos r s x = rtos r s y; x div s = y div s; x mod s = y mod s; rtos r s y mod r = y div s; rtos r s y div r = y mod s\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
apply (rule_tac x = x and y = y in mod_div_injTr[of "s"], assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bilinear_sum:
  assumes "bilinear h"
  shows "h (sum f S) (sum g T) = sum (\<lambda>(i,j). h (f i) (g j)) (S \<times> T) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h (sum f S) (sum g T) = (\<Sum>(i, j)\<in>S \<times> T. h (f i) (g j))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. h (sum f S) (sum g T) = (\<Sum>(i, j)\<in>S \<times> T. h (f i) (g j))
[PROOF STEP]
interpret l: linear "\<lambda>x. h x y" for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear (\<lambda>x. h x y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bilinear h

goal (1 subgoal):
 1. linear (\<lambda>x. h x y)
[PROOF STEP]
by (simp add: bilinear_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. h (sum f S) (sum g T) = (\<Sum>(i, j)\<in>S \<times> T. h (f i) (g j))
[PROOF STEP]
interpret r: linear "\<lambda>y. h x y" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear (h x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bilinear h

goal (1 subgoal):
 1. linear (h x)
[PROOF STEP]
by (simp add: bilinear_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. h (sum f S) (sum g T) = (\<Sum>(i, j)\<in>S \<times> T. h (f i) (g j))
[PROOF STEP]
have "h (sum f S) (sum g T) = sum (\<lambda>x. h (f x) (sum g T)) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h (sum f S) (sum g T) = (\<Sum>x\<in>S. h (f x) (sum g T))
[PROOF STEP]
by (simp add: l.sum)
[PROOF STATE]
proof (state)
this:
h (sum f S) (sum g T) = (\<Sum>x\<in>S. h (f x) (sum g T))

goal (1 subgoal):
 1. h (sum f S) (sum g T) = (\<Sum>(i, j)\<in>S \<times> T. h (f i) (g j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
h (sum f S) (sum g T) = (\<Sum>x\<in>S. h (f x) (sum g T))

goal (1 subgoal):
 1. h (sum f S) (sum g T) = (\<Sum>(i, j)\<in>S \<times> T. h (f i) (g j))
[PROOF STEP]
have "\<dots> = sum (\<lambda>x. sum (\<lambda>y. h (f x) (g y)) T) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>S. h (f x) (sum g T)) = (\<Sum>x\<in>S. \<Sum>y\<in>T. h (f x) (g y))
[PROOF STEP]
by (rule sum.cong) (simp_all add: r.sum)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>S. h (f x) (sum g T)) = (\<Sum>x\<in>S. \<Sum>y\<in>T. h (f x) (g y))

goal (1 subgoal):
 1. h (sum f S) (sum g T) = (\<Sum>(i, j)\<in>S \<times> T. h (f i) (g j))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
h (sum f S) (sum g T) = (\<Sum>x\<in>S. \<Sum>y\<in>T. h (f x) (g y))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
h (sum f S) (sum g T) = (\<Sum>x\<in>S. \<Sum>y\<in>T. h (f x) (g y))

goal (1 subgoal):
 1. h (sum f S) (sum g T) = (\<Sum>(i, j)\<in>S \<times> T. h (f i) (g j))
[PROOF STEP]
unfolding sum.cartesian_product
[PROOF STATE]
proof (prove)
using this:
h (sum f S) (sum g T) = (\<Sum>(x, y)\<in>S \<times> T. h (f x) (g y))

goal (1 subgoal):
 1. h (sum f S) (sum g T) = (\<Sum>(i, j)\<in>S \<times> T. h (f i) (g j))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
h (sum f S) (sum g T) = (\<Sum>(i, j)\<in>S \<times> T. h (f i) (g j))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prob_short: "\<P>((x,\<phi>) in Buffon. needle l x \<phi> \<inter> {-d/2, d/2} \<noteq> {}) = 2 * l / (d * pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {(x, \<phi>). (x, \<phi>) \<in> space local.Buffon \<and> needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = 2 * l / (d * pi)
[PROOF STEP]
using prob_short_aux
[PROOF STATE]
proof (prove)
using this:
emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 * l / (d * pi))

goal (1 subgoal):
 1. prob {(x, \<phi>). (x, \<phi>) \<in> space local.Buffon \<and> needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = 2 * l / (d * pi)
[PROOF STEP]
unfolding emeasure_eq_measure
[PROOF STATE]
proof (prove)
using this:
ennreal (prob {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}}) = ennreal (2 * l / (d * pi))

goal (1 subgoal):
 1. prob {(x, \<phi>). (x, \<phi>) \<in> space local.Buffon \<and> needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = 2 * l / (d * pi)
[PROOF STEP]
using l d
[PROOF STATE]
proof (prove)
using this:
ennreal (prob {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}}) = ennreal (2 * l / (d * pi))
0 < l
0 < d

goal (1 subgoal):
 1. prob {(x, \<phi>). (x, \<phi>) \<in> space local.Buffon \<and> needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = 2 * l / (d * pi)
[PROOF STEP]
by (subst (asm) ennreal_inj) auto


[STATEMENT]
theorem weak_integer_composition_enum_correct:
  "set (weak_integer_composition_enum i l) = weak_integer_compositions i l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (weak_integer_composition_enum i l) = weak_integer_compositions i l
[PROOF STEP]
proof standard
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set (weak_integer_composition_enum i l) \<subseteq> weak_integer_compositions i l
 2. weak_integer_compositions i l \<subseteq> set (weak_integer_composition_enum i l)
[PROOF STEP]
show "set (weak_integer_composition_enum i l) \<subseteq> weak_integer_compositions i l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (weak_integer_composition_enum i l) \<subseteq> weak_integer_compositions i l
[PROOF STEP]
unfolding weak_integer_compositions_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (weak_integer_composition_enum i l) \<subseteq> {xs. length xs = l \<and> sum_list xs = i}
[PROOF STEP]
using weak_integer_composition_enum_length weak_integer_composition_enum_sum_list
[PROOF STATE]
proof (prove)
using this:
?xs \<in> set (weak_integer_composition_enum ?i ?l) \<Longrightarrow> length ?xs = ?l
?xs \<in> set (weak_integer_composition_enum ?i ?l) \<Longrightarrow> sum_list ?xs = ?i

goal (1 subgoal):
 1. set (weak_integer_composition_enum i l) \<subseteq> {xs. length xs = l \<and> sum_list xs = i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (weak_integer_composition_enum i l) \<subseteq> weak_integer_compositions i l

goal (1 subgoal):
 1. weak_integer_compositions i l \<subseteq> set (weak_integer_composition_enum i l)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. weak_integer_compositions i l \<subseteq> set (weak_integer_composition_enum i l)
[PROOF STEP]
show "weak_integer_compositions i l \<subseteq> set (weak_integer_composition_enum i l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. weak_integer_compositions i l \<subseteq> set (weak_integer_composition_enum i l)
[PROOF STEP]
unfolding weak_integer_compositions_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {xs. length xs = l \<and> sum_list xs = i} \<subseteq> set (weak_integer_composition_enum i l)
[PROOF STEP]
using weak_integer_composition_enum_correct_aux
[PROOF STATE]
proof (prove)
using this:
?xs \<in> set (weak_integer_composition_enum (sum_list ?xs) (length ?xs))

goal (1 subgoal):
 1. {xs. length xs = l \<and> sum_list xs = i} \<subseteq> set (weak_integer_composition_enum i l)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
weak_integer_compositions i l \<subseteq> set (weak_integer_composition_enum i l)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Example2_lemma2_aux: "j<n \<Longrightarrow>
 (\<Sum>i=0..<n. (b i::nat)) =
 (\<Sum>i=0..<j. b i) + b j + (\<Sum>i=0..<n-(Suc j) . b (Suc j + i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < n \<Longrightarrow> sum b {0..<n} = sum b {0..<j} + b j + (\<Sum>i = 0..<n - Suc j. b (Suc j + i))
[PROOF STEP]
apply(induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. j < 0 \<Longrightarrow> sum b {0..<0} = sum b {0..<j} + b j + (\<Sum>i = 0..<0 - Suc j. b (Suc j + i))
 2. \<And>n. \<lbrakk>j < n \<Longrightarrow> sum b {0..<n} = sum b {0..<j} + b j + (\<Sum>i = 0..<n - Suc j. b (Suc j + i)); j < Suc n\<rbrakk> \<Longrightarrow> sum b {0..<Suc n} = sum b {0..<j} + b j + (\<Sum>i = 0..<Suc n - Suc j. b (Suc j + i))
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>j < n \<Longrightarrow> sum b {0..<n} = sum b {0..<j} + b j + (\<Sum>i = 0..<n - Suc j. b (Suc (j + i))); j < Suc n\<rbrakk> \<Longrightarrow> sum b {0..<n} + b n = sum b {0..<j} + b j + (\<Sum>i = 0..<n - j. b (Suc (j + i)))
[PROOF STEP]
apply(simp add:less_Suc_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>j < n \<Longrightarrow> sum b {0..<n} = sum b {0..<j} + b j + (\<Sum>i = 0..<n - Suc j. b (Suc (j + i))); j < n \<or> j = n\<rbrakk> \<Longrightarrow> sum b {0..<n} + b n = sum b {0..<j} + b j + (\<Sum>i = 0..<n - j. b (Suc (j + i)))
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>sum b {0..<n} = sum b {0..<j} + b j + (\<Sum>i = 0..<n - Suc j. b (Suc (j + i))); j < n\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<n - Suc j. b (Suc (j + i))) + b n = (\<Sum>i = 0..<n - j. b (Suc (j + i)))
[PROOF STEP]
apply(subgoal_tac "n - j = Suc(n- Suc j)")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>sum b {0..<n} = sum b {0..<j} + b j + (\<Sum>i = 0..<n - Suc j. b (Suc (j + i))); j < n; n - j = Suc (n - Suc j)\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<n - Suc j. b (Suc (j + i))) + b n = (\<Sum>i = 0..<n - j. b (Suc (j + i)))
 2. \<And>n. \<lbrakk>sum b {0..<n} = sum b {0..<j} + b j + (\<Sum>i = 0..<n - Suc j. b (Suc (j + i))); j < n\<rbrakk> \<Longrightarrow> n - j = Suc (n - Suc j)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>sum b {0..<n} = sum b {0..<j} + b j + (\<Sum>i = 0..<n - Suc j. b (Suc (j + i))); j < n\<rbrakk> \<Longrightarrow> n - j = Suc (n - Suc j)
[PROOF STEP]
apply arith
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cartesian_product_subsetI:
  assumes "C \<subseteq> A"
  assumes "D \<subseteq> B"
  shows "cartesian_product C D \<subseteq> cartesian_product A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cartesian_product C D \<subseteq> cartesian_product A B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
C \<subseteq> A
D \<subseteq> B

goal (1 subgoal):
 1. cartesian_product C D \<subseteq> cartesian_product A B
[PROOF STEP]
unfolding cartesian_product_def
[PROOF STATE]
proof (prove)
using this:
C \<subseteq> A
D \<subseteq> B

goal (1 subgoal):
 1. {xs. \<exists>as\<in>C. \<exists>bs\<in>D. xs = as @ bs} \<subseteq> {xs. \<exists>as\<in>A. \<exists>bs\<in>B. xs = as @ bs}
[PROOF STEP]
by blast


[STATEMENT]
lemma GDERIV_scaleR:
    "\<lbrakk>DERIV f x :> df; GDERIV g x :> dg\<rbrakk>
     \<Longrightarrow> GDERIV (\<lambda>x. scaleR (f x) (g x)) x
      :> (scaleR (f x) dg + scaleR df (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_real_derivative df) (at x); GDERIV g x :> dg\<rbrakk> \<Longrightarrow> GDERIV (\<lambda>x. f x *\<^sub>R g x) x :> f x *\<^sub>R dg + df *\<^sub>R g x
[PROOF STEP]
unfolding gderiv_def has_field_derivative_def inner_add_right inner_scaleR_right
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_derivative (*) df) (at x); (g has_derivative (\<lambda>h. inner h dg)) (at x)\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x *\<^sub>R g x) has_derivative (\<lambda>h. f x * inner h dg + df * inner h (g x))) (at x)
[PROOF STEP]
apply (rule has_derivative_subst)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(f has_derivative (*) df) (at x); (g has_derivative (\<lambda>h. inner h dg)) (at x)\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x *\<^sub>R g x) has_derivative ?df) (at x)
 2. \<lbrakk>(f has_derivative (*) df) (at x); (g has_derivative (\<lambda>h. inner h dg)) (at x)\<rbrakk> \<Longrightarrow> ?df = (\<lambda>h. f x * inner h dg + df * inner h (g x))
[PROOF STEP]
apply (erule (1) has_derivative_scaleR)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_derivative (*) df) (at x); (g has_derivative (\<lambda>h. inner h dg)) (at x)\<rbrakk> \<Longrightarrow> (\<lambda>h. f x *\<^sub>R inner h dg + (df * h) *\<^sub>R g x) = (\<lambda>h. f x * inner h dg + df * inner h (g x))
[PROOF STEP]
apply (simp add: ac_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bacc_upper_bound:
  "bacc (r :: ('a \<times> 'a) set)  (card (UNIV :: 'a::finite set)) = (\<Union>n. bacc r n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bacc r (card UNIV) = \<Union> (range (bacc r))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bacc r (card UNIV) = \<Union> (range (bacc r))
[PROOF STEP]
have "mono (bacc r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono (bacc r)
[PROOF STEP]
unfolding mono_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. x \<le> y \<longrightarrow> bacc r x \<subseteq> bacc r y
[PROOF STEP]
by (simp add: bacc_mono)
[PROOF STATE]
proof (state)
this:
mono (bacc r)

goal (1 subgoal):
 1. bacc r (card UNIV) = \<Union> (range (bacc r))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mono (bacc r)

goal (1 subgoal):
 1. bacc r (card UNIV) = \<Union> (range (bacc r))
[PROOF STEP]
have "\<forall>n. bacc r n = bacc r (Suc n) \<longrightarrow> bacc r (Suc n) = bacc r (Suc (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. bacc r n = bacc r (Suc n) \<longrightarrow> bacc r (Suc n) = bacc r (Suc (Suc n))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>n. bacc r n = bacc r (Suc n) \<longrightarrow> bacc r (Suc n) = bacc r (Suc (Suc n))

goal (1 subgoal):
 1. bacc r (card UNIV) = \<Union> (range (bacc r))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>n. bacc r n = bacc r (Suc n) \<longrightarrow> bacc r (Suc n) = bacc r (Suc (Suc n))

goal (1 subgoal):
 1. bacc r (card UNIV) = \<Union> (range (bacc r))
[PROOF STEP]
have "finite (range (bacc r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (range (bacc r))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (range (bacc r))

goal (1 subgoal):
 1. bacc r (card UNIV) = \<Union> (range (bacc r))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
mono (bacc r)
\<forall>n. bacc r n = bacc r (Suc n) \<longrightarrow> bacc r (Suc n) = bacc r (Suc (Suc n))
finite (range (bacc r))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mono (bacc r)
\<forall>n. bacc r n = bacc r (Suc n) \<longrightarrow> bacc r (Suc n) = bacc r (Suc (Suc n))
finite (range (bacc r))

goal (1 subgoal):
 1. bacc r (card UNIV) = \<Union> (range (bacc r))
[PROOF STEP]
by (intro finite_mono_strict_prefix_implies_finite_fixpoint)
     (auto intro: finite_mono_remains_stable_implies_strict_prefix)
[PROOF STATE]
proof (state)
this:
bacc r (card UNIV) = \<Union> (range (bacc r))

goal:
No subgoals!
[PROOF STEP]
qed


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

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


[STATEMENT]
lemma ordIso_lists_mono:
assumes "r \<le>o r'"
shows "|lists(Field r)| \<le>o |lists(Field r')|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |lists (Field r)| \<le>o |lists (Field r')|
[PROOF STEP]
using assms card_of_mono2 card_of_lists_mono
[PROOF STATE]
proof (prove)
using this:
r \<le>o r'
?r \<le>o ?r' \<Longrightarrow> |Field ?r| \<le>o |Field ?r'|
|?A| \<le>o |?B| \<Longrightarrow> |lists ?A| \<le>o |lists ?B|

goal (1 subgoal):
 1. |lists (Field r)| \<le>o |lists (Field r')|
[PROOF STEP]
by blast


[STATEMENT]
lemma Digamma_numeral: "Digamma (numeral n) = harm (pred_numeral n) - euler_mascheroni"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Digamma (numeral n) = harm (pred_numeral n) - euler_mascheroni
[PROOF STEP]
by (subst of_nat_numeral[symmetric], subst numeral_eq_Suc, subst Digamma_of_nat) (rule refl)


[STATEMENT]
lemma unwinding: "of_int (unwinding z) = (z - Ln(exp z)) / (of_real(2*pi) * \<i>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (unwinding z) = (z - Ln (exp z)) / (complex_of_real (2 * pi) * \<i>)
[PROOF STEP]
using unwinding_in_Ints [of z]
[PROOF STATE]
proof (prove)
using this:
(z - Ln (exp z)) / (complex_of_real (2 * pi) * \<i>) \<in> \<int>

goal (1 subgoal):
 1. of_int (unwinding z) = (z - Ln (exp z)) / (complex_of_real (2 * pi) * \<i>)
[PROOF STEP]
unfolding unwinding_def Ints_def
[PROOF STATE]
proof (prove)
using this:
(z - Ln (exp z)) / (complex_of_real (2 * pi) * \<i>) \<in> range of_int

goal (1 subgoal):
 1. of_int (THE k. of_int k = (z - Ln (exp z)) / (complex_of_real (2 * pi) * \<i>)) = (z - Ln (exp z)) / (complex_of_real (2 * pi) * \<i>)
[PROOF STEP]
by force


[STATEMENT]
lemma proj_psi_lR_mult_proj_psi_lR:
  "proj_psi_l R * proj_psi_l R = proj_psi_l R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj_psi_l R * proj_psi_l R = proj_psi_l R
[PROOF STEP]
unfolding proj_psi_l_def psi_lR_is_beta
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod \<beta> \<beta> * outer_prod \<beta> \<beta> = outer_prod \<beta> \<beta>
[PROOF STEP]
apply (subst outer_prod_mult_outer_prod[of _ N _ N _ _ N])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<beta> \<in> carrier_vec N
 2. inner_prod \<beta> \<beta> \<cdot>\<^sub>m outer_prod \<beta> \<beta> = outer_prod \<beta> \<beta>
[PROOF STEP]
by (auto simp add: \<beta>_inner)


[STATEMENT]
lemma Smith_normal_form_upt_k_condition1:
  fixes A::"'a::{bezout_ring}^'cols::mod_type^'rows::mod_type"
  assumes "Smith_normal_form_upt_k A k"
  and "to_nat a = to_nat b" and " to_nat a + 1 < k" and "to_nat b + 1 < k "
  shows "A $ a $ b dvd A $ (a+1) $ (b+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ a $ b dvd A $ (a + (1::'rows)) $ (b + (1::'cols))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Smith_normal_form_upt_k A k
mod_type_class.to_nat a = mod_type_class.to_nat b
mod_type_class.to_nat a + 1 < k
mod_type_class.to_nat b + 1 < k

goal (1 subgoal):
 1. A $ a $ b dvd A $ (a + (1::'rows)) $ (b + (1::'cols))
[PROOF STEP]
unfolding Smith_normal_form_upt_k_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>a b. mod_type_class.to_nat a = mod_type_class.to_nat b \<and> mod_type_class.to_nat a + 1 < k \<and> mod_type_class.to_nat b + 1 < k \<longrightarrow> A $ a $ b dvd A $ (a + (1::'rows)) $ (b + (1::'cols))) \<and> isDiagonal_upt_k A k
mod_type_class.to_nat a = mod_type_class.to_nat b
mod_type_class.to_nat a + 1 < k
mod_type_class.to_nat b + 1 < k

goal (1 subgoal):
 1. A $ a $ b dvd A $ (a + (1::'rows)) $ (b + (1::'cols))
[PROOF STEP]
by auto


[STATEMENT]
lemma cmod_eq_Im: "Re z = 0 \<Longrightarrow> cmod z = \<bar>Im z\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re z = 0 \<Longrightarrow> cmod z = \<bar>Im z\<bar>
[PROOF STEP]
by (simp add: norm_complex_def)


[STATEMENT]
lemma INF_Inf: "(\<Sqinter>x\<in>X. f x) = (\<Sqinter>{f x |x. x \<in> X})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> (f ` X) = \<Sqinter> {f x |x::'b. x \<in> X}
variables:
X :: 'b set
f :: 'b \<Rightarrow> 'a
Inf :: 'a set \<Rightarrow> 'a
type variables:
'a, 'b :: type
[PROOF STEP]
by (simp add: Setcompr_eq_image)


[STATEMENT]
lemma pmf_random_dictatorship:
  assumes "is_pref_profile R"
  shows "pmf (RD R) x =
           (\<Sum>i\<in>agents. indicator (favorites R i) x /
              real (card (favorites R i))) / real (card agents)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (RD R) x = (\<Sum>i\<in>agents. indicat_real (favorites R i) x / real (card (favorites R i))) / real (card agents)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pmf (RD R) x = (\<Sum>i\<in>agents. indicat_real (favorites R i) x / real (card (favorites R i))) / real (card agents)
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
is_pref_profile R
[PROOF STEP]
interpret pref_profile_wf agents alts R
[PROOF STATE]
proof (prove)
using this:
is_pref_profile R

goal (1 subgoal):
 1. is_pref_profile R
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pmf (RD R) x = (\<Sum>i\<in>agents. indicat_real (favorites R i) x / real (card (favorites R i))) / real (card agents)
[PROOF STEP]
from nonempty_dom
[PROOF STATE]
proof (chain)
picking this:
agents \<noteq> {}
[PROOF STEP]
have "card agents > 0"
[PROOF STATE]
proof (prove)
using this:
agents \<noteq> {}

goal (1 subgoal):
 1. 0 < card agents
[PROOF STEP]
by (auto simp del: nonempty_agents)
[PROOF STATE]
proof (state)
this:
0 < card agents

goal (1 subgoal):
 1. pmf (RD R) x = (\<Sum>i\<in>agents. indicat_real (favorites R i) x / real (card (favorites R i))) / real (card agents)
[PROOF STEP]
hence "ennreal (pmf (RD R) x) =
           ennreal ((\<Sum>i\<in>agents. pmf (pmf_of_set (favorites R i)) x) / real (card agents))"
    (is "_ = ennreal (?p / _)")
[PROOF STATE]
proof (prove)
using this:
0 < card agents

goal (1 subgoal):
 1. ennreal (pmf (RD R) x) = ennreal ((\<Sum>i\<in>agents. pmf (pmf_of_set (favorites R i)) x) / real (card agents))
[PROOF STEP]
unfolding random_dictatorship_def[OF assms]
[PROOF STATE]
proof (prove)
using this:
0 < card agents

goal (1 subgoal):
 1. ennreal (pmf (pmf_of_set agents \<bind> (\<lambda>i. pmf_of_set (favorites R i))) x) = ennreal ((\<Sum>i\<in>agents. pmf (pmf_of_set (favorites R i)) x) / real (card agents))
[PROOF STEP]
by (simp_all add: ennreal_pmf_bind nn_integral_pmf_of_set max_def
          divide_ennreal [symmetric] ennreal_of_nat_eq_real_of_nat sum_nonneg)
[PROOF STATE]
proof (state)
this:
ennreal (pmf (RD R) x) = ennreal ((\<Sum>i\<in>agents. pmf (pmf_of_set (favorites R i)) x) / real (card agents))

goal (1 subgoal):
 1. pmf (RD R) x = (\<Sum>i\<in>agents. indicat_real (favorites R i) x / real (card (favorites R i))) / real (card agents)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (pmf (RD R) x) = ennreal ((\<Sum>i\<in>agents. pmf (pmf_of_set (favorites R i)) x) / real (card agents))

goal (1 subgoal):
 1. pmf (RD R) x = (\<Sum>i\<in>agents. indicat_real (favorites R i) x / real (card (favorites R i))) / real (card agents)
[PROOF STEP]
have "?p = (\<Sum>i\<in>agents. indicator (favorites R i) x / real (card (favorites R i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>agents. pmf (pmf_of_set (favorites R i)) x) = (\<Sum>i\<in>agents. indicat_real (favorites R i) x / real (card (favorites R i)))
[PROOF STEP]
by (intro sum.cong) (simp_all add: favorites_nonempty)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>agents. pmf (pmf_of_set (favorites R i)) x) = (\<Sum>i\<in>agents. indicat_real (favorites R i) x / real (card (favorites R i)))

goal (1 subgoal):
 1. pmf (RD R) x = (\<Sum>i\<in>agents. indicat_real (favorites R i) x / real (card (favorites R i))) / real (card agents)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ennreal (pmf (RD R) x) = ennreal ((\<Sum>i\<in>agents. indicat_real (favorites R i) x / real (card (favorites R i))) / real (card agents))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ennreal (pmf (RD R) x) = ennreal ((\<Sum>i\<in>agents. indicat_real (favorites R i) x / real (card (favorites R i))) / real (card agents))

goal (1 subgoal):
 1. pmf (RD R) x = (\<Sum>i\<in>agents. indicat_real (favorites R i) x / real (card (favorites R i))) / real (card agents)
[PROOF STEP]
by (subst (asm) ennreal_inj) (auto intro!: sum_nonneg divide_nonneg_nonneg)
[PROOF STATE]
proof (state)
this:
pmf (RD R) x = (\<Sum>i\<in>agents. indicat_real (favorites R i) x / real (card (favorites R i))) / real (card agents)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_stabiliser: "card (tetrahedral.stabiliser A) = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (tetrahedral.stabiliser A) = 3
[PROOF STEP]
using is_stabiliser card_stabiliser_help
[PROOF STATE]
proof (prove)
using this:
tetrahedral.stabiliser A = stabiliser_A
card stabiliser_A = 3

goal (1 subgoal):
 1. card (tetrahedral.stabiliser A) = 3
[PROOF STEP]
by simp


[STATEMENT]
lemma connected_iff_connected_component_eq:
  "connected S \<longleftrightarrow> (\<forall>x \<in> S. \<forall>y \<in> S. connected_component_set S x = connected_component_set S y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected S = (\<forall>x\<in>S. \<forall>y\<in>S. connected_component_set S x = connected_component_set S y)
[PROOF STEP]
by (simp add: connected_component_eq_eq connected_iff_connected_component)


[STATEMENT]
lemma integral_subset_le:
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
  assumes "s \<subseteq> t"
    and "f integrable_on s"
    and "f integrable_on t"
    and "\<forall>x \<in> t. 0 \<le> f x"
  shows "integral s f \<le> integral t f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral s f \<le> integral t f
[PROOF STEP]
using assms has_integral_subset_le
[PROOF STATE]
proof (prove)
using this:
s \<subseteq> t
f integrable_on s
f integrable_on t
\<forall>x\<in>t. 0 \<le> f x
\<lbrakk>?s \<subseteq> ?t; (?f has_integral ?i) ?s; (?f has_integral ?j) ?t; \<forall>x\<in>?t. 0 \<le> ?f x\<rbrakk> \<Longrightarrow> ?i \<le> ?j

goal (1 subgoal):
 1. integral s f \<le> integral t f
[PROOF STEP]
by blast


[STATEMENT]
lemma ifte_ifte_distrib:
  "ifte x (ifte y a b) (ifte y c d) = ifte y (ifte x a c) (ifte x b d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ifte x (ifte y a b) (ifte y c d) = ifte y (ifte x a c) (ifte x b d)
[PROOF STEP]
unfolding ifte_def [of x] sup_conv_inf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (- (x \<sqinter> ifte y a b) \<sqinter> - (- x \<sqinter> ifte y c d)) = ifte y (- (- (x \<sqinter> a) \<sqinter> - (- x \<sqinter> c))) (- (- (x \<sqinter> b) \<sqinter> - (- x \<sqinter> d)))
[PROOF STEP]
by (simp only: compl_ifte [symmetric] inf_ifte_distrib [symmetric] ifte_same)


[STATEMENT]
lemma Max_subset: "\<lbrakk> A \<noteq> {}; A \<subseteq> B; finite B \<rbrakk> \<Longrightarrow> Max A \<le> Max B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; A \<subseteq> B; finite B\<rbrakk> \<Longrightarrow> Max A \<le> Max B
[PROOF STEP]
by (rule linorder_class.Max_mono)


[STATEMENT]
theorem reduction_correct: "S.language \<subseteq> F.language \<longleftrightarrow> R.language \<subseteq> F.language"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S.language \<subseteq> F.language) = (R.language \<subseteq> F.language)
[PROOF STEP]
using reduction_language_subset reduction_language_indistinguishable
[PROOF STATE]
proof (prove)
using this:
R.language \<subseteq> S.language
R.language \<subseteq> F.language \<Longrightarrow> S.language \<subseteq> F.language

goal (1 subgoal):
 1. (S.language \<subseteq> F.language) = (R.language \<subseteq> F.language)
[PROOF STEP]
by blast


[STATEMENT]
lemma cnorm_eq_square: "norm x = a \<longleftrightarrow> 0 \<le> a \<and> cinner x x = complex_of_real (a\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm x = a) = (0 \<le> a \<and> cinner x x = complex_of_real (a\<^sup>2))
[PROOF STEP]
by (metis cdot_square_norm norm_ge_zero of_real_eq_iff power2_eq_iff_nonneg)


[STATEMENT]
lemma not_irreducibleD:
  assumes "\<not> irreducible x" and "x \<noteq> 0" and "\<not> x dvd 1"
  shows "\<exists>y z. x = y * z \<and> \<not> y dvd 1 \<and> \<not> z dvd 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>y z. x = y * z \<and> \<not> y dvd (1::'a) \<and> \<not> z dvd (1::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<not> irreducible x
x \<noteq> (0::'a)
\<not> x dvd (1::'a)

goal (1 subgoal):
 1. \<exists>y z. x = y * z \<and> \<not> y dvd (1::'a) \<and> \<not> z dvd (1::'a)
[PROOF STEP]
apply (unfold Factorial_Ring.irreducible_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> (x \<noteq> (0::'a) \<and> \<not> x dvd (1::'a) \<and> (\<forall>a b. x = a * b \<longrightarrow> a dvd (1::'a) \<or> b dvd (1::'a))); x \<noteq> (0::'a); \<not> x dvd (1::'a)\<rbrakk> \<Longrightarrow> \<exists>y z. x = y * z \<and> \<not> y dvd (1::'a) \<and> \<not> z dvd (1::'a)
[PROOF STEP]
by auto


[STATEMENT]
lemma unity_root_conv_exp:
  "unity_root k n = exp (of_real (2*pi*n/k) * \<i>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unity_root k n = exp (complex_of_real (2 * pi * real_of_int n / real k) * \<i>)
[PROOF STEP]
unfolding unity_root_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis (2 * pi * real_of_int n / real k) = exp (complex_of_real (2 * pi * real_of_int n / real k) * \<i>)
[PROOF STEP]
by (subst cis_conv_exp,subst mult.commute,blast)


[STATEMENT]
lemma expectation_X: "expectation (X i) = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation (X i) = p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. expectation (X i) = p
[PROOF STEP]
have "expectation (X i) =
        lebesgue_integral (distr M (count_space UNIV) (\<lambda>f. f i)) (\<lambda>b. if b then 1 else 0 :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation (X i) = LINT b|distr M (count_space UNIV) (\<lambda>f. f i). (if b then 1 else 0)
[PROOF STEP]
by (subst integral_distr) (simp_all add: random_variable_component X_def)
[PROOF STATE]
proof (state)
this:
expectation (X i) = LINT b|distr M (count_space UNIV) (\<lambda>f. f i). (if b then 1 else 0)

goal (1 subgoal):
 1. expectation (X i) = p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
expectation (X i) = LINT b|distr M (count_space UNIV) (\<lambda>f. f i). (if b then 1 else 0)

goal (1 subgoal):
 1. expectation (X i) = p
[PROOF STEP]
have "distr M (count_space UNIV) (\<lambda>x. x i) = measure_pmf (bernoulli_pmf p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr M (count_space UNIV) (\<lambda>x. x i) = measure_pmf (bernoulli_pmf p)
[PROOF STEP]
by (rule distr_M_component)
[PROOF STATE]
proof (state)
this:
distr M (count_space UNIV) (\<lambda>x. x i) = measure_pmf (bernoulli_pmf p)

goal (1 subgoal):
 1. expectation (X i) = p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
distr M (count_space UNIV) (\<lambda>x. x i) = measure_pmf (bernoulli_pmf p)

goal (1 subgoal):
 1. expectation (X i) = p
[PROOF STEP]
have "measure_pmf.expectation (bernoulli_pmf p) (\<lambda>b. if b then 1 else 0 :: real) = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.expectation (bernoulli_pmf p) (\<lambda>b. if b then 1 else 0) = p
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
p \<in> {0..1}

goal (1 subgoal):
 1. measure_pmf.expectation (bernoulli_pmf p) (\<lambda>b. if b then 1 else 0) = p
[PROOF STEP]
by (subst integral_bernoulli_pmf) auto
[PROOF STATE]
proof (state)
this:
measure_pmf.expectation (bernoulli_pmf p) (\<lambda>b. if b then 1 else 0) = p

goal (1 subgoal):
 1. expectation (X i) = p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
expectation (X i) = p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
expectation (X i) = p

goal (1 subgoal):
 1. expectation (X i) = p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
expectation (X i) = p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem wls_psubst_Op_simp[simp]:
assumes "wlsInp delta inp" and "wlsBinp delta binp" and "wlsEnv rho"
shows
"((Op delta inp binp) #[rho]) = Op delta (inp %[rho]) (binp %%[rho])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Op delta inp binp #[rho] = Op delta inp %[rho] binp %%[rho]
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wlsInp delta inp
wlsBinp delta binp
wlsEnv rho

goal (1 subgoal):
 1. Op delta inp binp #[rho] = Op delta inp %[rho] binp %%[rho]
[PROOF STEP]
by simp


[STATEMENT]
lemma admits_diagonal_reduction_eq_exists_algorithm_is_SNF_all:
  shows "(\<forall>(A::'a::comm_ring_1 mat) \<in> carrier_mat m n. admits_diagonal_reduction A)
  = (\<exists>algorithm. \<forall>(A::'a mat) \<in> carrier_mat m n. is_SNF A (algorithm A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>A\<in>carrier_mat m n. admits_diagonal_reduction A) = (\<exists>algorithm. \<forall>A\<in>carrier_mat m n. is_SNF A (algorithm A))
[PROOF STEP]
using exists_algorithm_is_SNF_imp_admits_diagonal_reduction_all
[PROOF STATE]
proof (prove)
using this:
\<exists>algorithm. \<forall>A\<in>carrier_mat ?m ?n. is_SNF A (algorithm A) \<Longrightarrow> \<forall>A\<in>carrier_mat ?m ?n. admits_diagonal_reduction A

goal (1 subgoal):
 1. (\<forall>A\<in>carrier_mat m n. admits_diagonal_reduction A) = (\<exists>algorithm. \<forall>A\<in>carrier_mat m n. is_SNF A (algorithm A))
[PROOF STEP]
using admits_diagonal_reduction_imp_exists_algorithm_is_SNF_all
[PROOF STATE]
proof (prove)
using this:
\<exists>algorithm. \<forall>A\<in>carrier_mat ?m ?n. is_SNF A (algorithm A) \<Longrightarrow> \<forall>A\<in>carrier_mat ?m ?n. admits_diagonal_reduction A
\<forall>A\<in>carrier_mat ?m ?n. admits_diagonal_reduction A \<Longrightarrow> \<exists>algorithm. \<forall>A\<in>carrier_mat ?m ?n. is_SNF A (algorithm A)

goal (1 subgoal):
 1. (\<forall>A\<in>carrier_mat m n. admits_diagonal_reduction A) = (\<exists>algorithm. \<forall>A\<in>carrier_mat m n. is_SNF A (algorithm A))
[PROOF STEP]
by auto


[STATEMENT]
lemma Stirling_fps_nth: "Stirling_fps m $ n = Stirling n m / fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Stirling_fps m $ n = real (Stirling n m) / fact n
[PROOF STEP]
unfolding Stirling_fps_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fps_const (1 / fact m) * (fps_exp 1 - 1) ^ m) $ n = real (Stirling n m) / fact n
[PROOF STEP]
using Stirling_fps_aux[of m n]
[PROOF STATE]
proof (prove)
using this:
(fps_exp 1 - 1) ^ m $ n * fact n = fact m * real (Stirling n m)

goal (1 subgoal):
 1. (fps_const (1 / fact m) * (fps_exp 1 - 1) ^ m) $ n = real (Stirling n m) / fact n
[PROOF STEP]
by (simp add: field_simps)


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

goal (1 subgoal):
 1. Complex_Matrix.unitary U &&& similar_mat_wit A B U (Complex_Matrix.adjoint U)
[PROOF STEP]
unfolding unitarily_equiv_def
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.unitary U \<and> similar_mat_wit A B U (Complex_Matrix.adjoint U)

goal (1 subgoal):
 1. Complex_Matrix.unitary U &&& similar_mat_wit A B U (Complex_Matrix.adjoint U)
[PROOF STEP]
by auto


[STATEMENT]
lemma gcd_1_int [simp]: "gcd m 1 = 1"
  for m :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd m 1 = 1
[PROOF STEP]
by (simp add: gcd_int_def)


[STATEMENT]
lemma frechet_derivative_compose:
  "frechet_derivative (f o g) (at x) = frechet_derivative (f) (at (g x)) o frechet_derivative g (at x)"
  if "g differentiable at x" "f differentiable at (g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frechet_derivative (f \<circ> g) (at x) = frechet_derivative f (at (g x)) \<circ> frechet_derivative g (at x)
[PROOF STEP]
by (meson diff_chain_at frechet_derivative_at' frechet_derivative_works that)


[STATEMENT]
lemma eventually_power_mono:
  assumes "eventually (\<lambda>x. 0 \<le> l x) at_top" "eventually (\<lambda>x. l x \<le> f x) at_top"
          "eventually (\<lambda>x. f x \<le> g x) at_top" "n \<equiv> n"
  shows   "eventually (\<lambda>x. f x ^ n \<le> (g x :: real) ^ n) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x ^ n \<le> g x ^ n
[PROOF STEP]
using assms(1-3)
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. 0 \<le> l x
\<forall>\<^sub>F x in at_top. l x \<le> f x
\<forall>\<^sub>F x in at_top. f x \<le> g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x ^ n \<le> g x ^ n
[PROOF STEP]
by eventually_elim (auto intro: power_mono)


[STATEMENT]
lemma subcocycle_ineq:
  assumes "subcocycle u"
  shows "u (n+m) x \<le> u n x + u m ((T^^n) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u (n + m) x \<le> u n x + u m ((T ^^ n) x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
subcocycle u

goal (1 subgoal):
 1. u (n + m) x \<le> u n x + u m ((T ^^ n) x)
[PROOF STEP]
unfolding subcocycle_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>n. integrable M (u n)) \<and> (\<forall>n m x. u (n + m) x \<le> u n x + u m ((T ^^ n) x))

goal (1 subgoal):
 1. u (n + m) x \<le> u n x + u m ((T ^^ n) x)
[PROOF STEP]
by blast


[STATEMENT]
lemma icard_image: "inj_on f A \<Longrightarrow> icard (f ` A) = icard A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f A \<Longrightarrow> icard (f ` A) = icard A
[PROOF STEP]
apply (case_tac "finite A")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>inj_on f A; finite A\<rbrakk> \<Longrightarrow> icard (f ` A) = icard A
 2. \<lbrakk>inj_on f A; infinite A\<rbrakk> \<Longrightarrow> icard (f ` A) = icard A
[PROOF STEP]
apply (simp add: icard_finite card_image)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f A; infinite A\<rbrakk> \<Longrightarrow> icard (f ` A) = icard A
[PROOF STEP]
apply (simp add: icard_infinite_conv inj_on_imp_infinite_image)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lincomb_list_append:
  assumes Ws: "set Ws \<subseteq> carrier_vec n"
  shows "set Vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list f (Vs @ Ws) =
    lincomb_list f Vs + lincomb_list (\<lambda> i. f (i + length Vs)) Ws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set Vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list f (Vs @ Ws) = lincomb_list f Vs + lincomb_list (\<lambda>i. f (i + length Vs)) Ws
[PROOF STEP]
proof (induction Vs arbitrary: f)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>f. set [] \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list f ([] @ Ws) = lincomb_list f [] + lincomb_list (\<lambda>i. f (i + length [])) Ws
 2. \<And>a Vs f. \<lbrakk>\<And>f. set Vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list f (Vs @ Ws) = lincomb_list f Vs + lincomb_list (\<lambda>i. f (i + length Vs)) Ws; set (a # Vs) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb_list f ((a # Vs) @ Ws) = lincomb_list f (a # Vs) + lincomb_list (\<lambda>i. f (i + length (a # Vs))) Ws
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
set [] \<subseteq> carrier_vec n

goal (2 subgoals):
 1. \<And>f. set [] \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list f ([] @ Ws) = lincomb_list f [] + lincomb_list (\<lambda>i. f (i + length [])) Ws
 2. \<And>a Vs f. \<lbrakk>\<And>f. set Vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list f (Vs @ Ws) = lincomb_list f Vs + lincomb_list (\<lambda>i. f (i + length Vs)) Ws; set (a # Vs) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb_list f ((a # Vs) @ Ws) = lincomb_list f (a # Vs) + lincomb_list (\<lambda>i. f (i + length (a # Vs))) Ws
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb_list f ([] @ Ws) = lincomb_list f [] + lincomb_list (\<lambda>i. f (i + length [])) Ws
[PROOF STEP]
by(simp add: lincomb_list_carrier[OF Ws])
[PROOF STATE]
proof (state)
this:
lincomb_list f ([] @ Ws) = lincomb_list f [] + lincomb_list (\<lambda>i. f (i + length [])) Ws

goal (1 subgoal):
 1. \<And>a Vs f. \<lbrakk>\<And>f. set Vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list f (Vs @ Ws) = lincomb_list f Vs + lincomb_list (\<lambda>i. f (i + length Vs)) Ws; set (a # Vs) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb_list f ((a # Vs) @ Ws) = lincomb_list f (a # Vs) + lincomb_list (\<lambda>i. f (i + length (a # Vs))) Ws
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a Vs f. \<lbrakk>\<And>f. set Vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list f (Vs @ Ws) = lincomb_list f Vs + lincomb_list (\<lambda>i. f (i + length Vs)) Ws; set (a # Vs) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb_list f ((a # Vs) @ Ws) = lincomb_list f (a # Vs) + lincomb_list (\<lambda>i. f (i + length (a # Vs))) Ws
[PROOF STEP]
case (Cons x Vs)
[PROOF STATE]
proof (state)
this:
set Vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list ?f1 (Vs @ Ws) = lincomb_list ?f1 Vs + lincomb_list (\<lambda>i. ?f1 (i + length Vs)) Ws
set (x # Vs) \<subseteq> carrier_vec n

goal (1 subgoal):
 1. \<And>a Vs f. \<lbrakk>\<And>f. set Vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list f (Vs @ Ws) = lincomb_list f Vs + lincomb_list (\<lambda>i. f (i + length Vs)) Ws; set (a # Vs) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb_list f ((a # Vs) @ Ws) = lincomb_list f (a # Vs) + lincomb_list (\<lambda>i. f (i + length (a # Vs))) Ws
[PROOF STEP]
have "lincomb_list f (x # (Vs @ Ws)) = f 0 \<cdot>\<^sub>v x + lincomb_list (f \<circ> Suc) (Vs @ Ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb_list f (x # Vs @ Ws) = f 0 \<cdot>\<^sub>v x + lincomb_list (f \<circ> Suc) (Vs @ Ws)
[PROOF STEP]
by (rule lincomb_list_Cons)
[PROOF STATE]
proof (state)
this:
lincomb_list f (x # Vs @ Ws) = f 0 \<cdot>\<^sub>v x + lincomb_list (f \<circ> Suc) (Vs @ Ws)

goal (1 subgoal):
 1. \<And>a Vs f. \<lbrakk>\<And>f. set Vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list f (Vs @ Ws) = lincomb_list f Vs + lincomb_list (\<lambda>i. f (i + length Vs)) Ws; set (a # Vs) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb_list f ((a # Vs) @ Ws) = lincomb_list f (a # Vs) + lincomb_list (\<lambda>i. f (i + length (a # Vs))) Ws
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lincomb_list f (x # Vs @ Ws) = f 0 \<cdot>\<^sub>v x + lincomb_list (f \<circ> Suc) (Vs @ Ws)

goal (1 subgoal):
 1. \<And>a Vs f. \<lbrakk>\<And>f. set Vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list f (Vs @ Ws) = lincomb_list f Vs + lincomb_list (\<lambda>i. f (i + length Vs)) Ws; set (a # Vs) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb_list f ((a # Vs) @ Ws) = lincomb_list f (a # Vs) + lincomb_list (\<lambda>i. f (i + length (a # Vs))) Ws
[PROOF STEP]
have "lincomb_list (f \<circ> Suc) (Vs @ Ws) =
             lincomb_list (f \<circ> Suc) Vs + lincomb_list (\<lambda> i. (f \<circ> Suc) (i + length Vs)) Ws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb_list (f \<circ> Suc) (Vs @ Ws) = lincomb_list (f \<circ> Suc) Vs + lincomb_list (\<lambda>i. (f \<circ> Suc) (i + length Vs)) Ws
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
set Vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list ?f1 (Vs @ Ws) = lincomb_list ?f1 Vs + lincomb_list (\<lambda>i. ?f1 (i + length Vs)) Ws
set (x # Vs) \<subseteq> carrier_vec n

goal (1 subgoal):
 1. lincomb_list (f \<circ> Suc) (Vs @ Ws) = lincomb_list (f \<circ> Suc) Vs + lincomb_list (\<lambda>i. (f \<circ> Suc) (i + length Vs)) Ws
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lincomb_list (f \<circ> Suc) (Vs @ Ws) = lincomb_list (f \<circ> Suc) Vs + lincomb_list (\<lambda>i. (f \<circ> Suc) (i + length Vs)) Ws

goal (1 subgoal):
 1. \<And>a Vs f. \<lbrakk>\<And>f. set Vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list f (Vs @ Ws) = lincomb_list f Vs + lincomb_list (\<lambda>i. f (i + length Vs)) Ws; set (a # Vs) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb_list f ((a # Vs) @ Ws) = lincomb_list f (a # Vs) + lincomb_list (\<lambda>i. f (i + length (a # Vs))) Ws
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lincomb_list (f \<circ> Suc) (Vs @ Ws) = lincomb_list (f \<circ> Suc) Vs + lincomb_list (\<lambda>i. (f \<circ> Suc) (i + length Vs)) Ws

goal (1 subgoal):
 1. \<And>a Vs f. \<lbrakk>\<And>f. set Vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list f (Vs @ Ws) = lincomb_list f Vs + lincomb_list (\<lambda>i. f (i + length Vs)) Ws; set (a # Vs) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb_list f ((a # Vs) @ Ws) = lincomb_list f (a # Vs) + lincomb_list (\<lambda>i. f (i + length (a # Vs))) Ws
[PROOF STEP]
have "(\<lambda> i. (f \<circ> Suc) (i + length Vs)) = (\<lambda> i. f (i + length (x # Vs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. (f \<circ> Suc) (i + length Vs)) = (\<lambda>i. f (i + length (x # Vs)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>i. (f \<circ> Suc) (i + length Vs)) = (\<lambda>i. f (i + length (x # Vs)))

goal (1 subgoal):
 1. \<And>a Vs f. \<lbrakk>\<And>f. set Vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list f (Vs @ Ws) = lincomb_list f Vs + lincomb_list (\<lambda>i. f (i + length Vs)) Ws; set (a # Vs) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb_list f ((a # Vs) @ Ws) = lincomb_list f (a # Vs) + lincomb_list (\<lambda>i. f (i + length (a # Vs))) Ws
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>i. (f \<circ> Suc) (i + length Vs)) = (\<lambda>i. f (i + length (x # Vs)))

goal (1 subgoal):
 1. \<And>a Vs f. \<lbrakk>\<And>f. set Vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list f (Vs @ Ws) = lincomb_list f Vs + lincomb_list (\<lambda>i. f (i + length Vs)) Ws; set (a # Vs) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb_list f ((a # Vs) @ Ws) = lincomb_list f (a # Vs) + lincomb_list (\<lambda>i. f (i + length (a # Vs))) Ws
[PROOF STEP]
have "f 0 \<cdot>\<^sub>v x + ((lincomb_list (f \<circ> Suc) Vs) + lincomb_list \<dots> Ws) =
             (f 0 \<cdot>\<^sub>v x + (lincomb_list (f \<circ> Suc) Vs)) + lincomb_list \<dots> Ws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f 0 \<cdot>\<^sub>v x + (lincomb_list (f \<circ> Suc) Vs + lincomb_list (\<lambda>i. f (i + length (x # Vs))) Ws) = f 0 \<cdot>\<^sub>v x + lincomb_list (f \<circ> Suc) Vs + lincomb_list (\<lambda>i. f (i + length (x # Vs))) Ws
[PROOF STEP]
using assoc_add_vec Cons.prems Ws lincomb_list_carrier
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v\<^sub>1 \<in> carrier_vec ?n; ?v\<^sub>2 \<in> carrier_vec ?n; ?v\<^sub>3 \<in> carrier_vec ?n\<rbrakk> \<Longrightarrow> ?v\<^sub>1 + ?v\<^sub>2 + ?v\<^sub>3 = ?v\<^sub>1 + (?v\<^sub>2 + ?v\<^sub>3)
set (x # Vs) \<subseteq> carrier_vec n
set Ws \<subseteq> carrier_vec n
set ?vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list ?c ?vs \<in> carrier_vec n

goal (1 subgoal):
 1. f 0 \<cdot>\<^sub>v x + (lincomb_list (f \<circ> Suc) Vs + lincomb_list (\<lambda>i. f (i + length (x # Vs))) Ws) = f 0 \<cdot>\<^sub>v x + lincomb_list (f \<circ> Suc) Vs + lincomb_list (\<lambda>i. f (i + length (x # Vs))) Ws
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f 0 \<cdot>\<^sub>v x + (lincomb_list (f \<circ> Suc) Vs + lincomb_list (\<lambda>i. f (i + length (x # Vs))) Ws) = f 0 \<cdot>\<^sub>v x + lincomb_list (f \<circ> Suc) Vs + lincomb_list (\<lambda>i. f (i + length (x # Vs))) Ws

goal (1 subgoal):
 1. \<And>a Vs f. \<lbrakk>\<And>f. set Vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list f (Vs @ Ws) = lincomb_list f Vs + lincomb_list (\<lambda>i. f (i + length Vs)) Ws; set (a # Vs) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb_list f ((a # Vs) @ Ws) = lincomb_list f (a # Vs) + lincomb_list (\<lambda>i. f (i + length (a # Vs))) Ws
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lincomb_list f (x # Vs @ Ws) = f 0 \<cdot>\<^sub>v x + lincomb_list (f \<circ> Suc) Vs + lincomb_list (\<lambda>i. f (i + length (x # Vs))) Ws
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
lincomb_list f (x # Vs @ Ws) = f 0 \<cdot>\<^sub>v x + lincomb_list (f \<circ> Suc) Vs + lincomb_list (\<lambda>i. f (i + length (x # Vs))) Ws

goal (1 subgoal):
 1. lincomb_list f ((x # Vs) @ Ws) = lincomb_list f (x # Vs) + lincomb_list (\<lambda>i. f (i + length (x # Vs))) Ws
[PROOF STEP]
using lincomb_list_Cons
[PROOF STATE]
proof (prove)
using this:
lincomb_list f (x # Vs @ Ws) = f 0 \<cdot>\<^sub>v x + lincomb_list (f \<circ> Suc) Vs + lincomb_list (\<lambda>i. f (i + length (x # Vs))) Ws
lincomb_list ?c (?v # ?vs) = ?c 0 \<cdot>\<^sub>v ?v + lincomb_list (?c \<circ> Suc) ?vs

goal (1 subgoal):
 1. lincomb_list f ((x # Vs) @ Ws) = lincomb_list f (x # Vs) + lincomb_list (\<lambda>i. f (i + length (x # Vs))) Ws
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lincomb_list f ((x # Vs) @ Ws) = lincomb_list f (x # Vs) + lincomb_list (\<lambda>i. f (i + length (x # Vs))) Ws

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma smult_mat_mult_mat_vec_assoc:
  fixes A :: "'a::comm_ring_1 mat"
  assumes A: "A \<in> carrier_mat n m" and w: "w \<in> carrier_vec m"
  shows "a \<cdot>\<^sub>m A *\<^sub>v w = a \<cdot>\<^sub>v (A *\<^sub>v w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<cdot>\<^sub>m A *\<^sub>v w = a \<cdot>\<^sub>v (A *\<^sub>v w)
[PROOF STEP]
apply (rule eq_vecI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (a \<cdot>\<^sub>v (A *\<^sub>v w)) \<Longrightarrow> (a \<cdot>\<^sub>m A *\<^sub>v w) $ i = (a \<cdot>\<^sub>v (A *\<^sub>v w)) $ i
 2. dim_vec (a \<cdot>\<^sub>m A *\<^sub>v w) = dim_vec (a \<cdot>\<^sub>v (A *\<^sub>v w))
[PROOF STEP]
apply (simp add: scalar_prod_def carrier_matD[OF A] carrier_vecD[OF w])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < n \<Longrightarrow> (\<Sum>ia = 0..<m. a * A $$ (i, ia) * w $ ia) = a * (\<Sum>ia = 0..<m. A $$ (i, ia) * w $ ia)
 2. dim_vec (a \<cdot>\<^sub>m A *\<^sub>v w) = dim_vec (a \<cdot>\<^sub>v (A *\<^sub>v w))
[PROOF STEP]
apply (subst sum_distrib_left)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < n \<Longrightarrow> (\<Sum>ia = 0..<m. a * A $$ (i, ia) * w $ ia) = (\<Sum>n = 0..<m. a * (A $$ (i, n) * w $ n))
 2. dim_vec (a \<cdot>\<^sub>m A *\<^sub>v w) = dim_vec (a \<cdot>\<^sub>v (A *\<^sub>v w))
[PROOF STEP]
apply (rule sum.cong, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i x. \<lbrakk>i < n; x \<in> {0..<m}\<rbrakk> \<Longrightarrow> a * A $$ (i, x) * w $ x = a * (A $$ (i, x) * w $ x)
 2. dim_vec (a \<cdot>\<^sub>m A *\<^sub>v w) = dim_vec (a \<cdot>\<^sub>v (A *\<^sub>v w))
[PROOF STEP]
by auto


[STATEMENT]
lemma iprod_left_add_distrib: "\<langle>xs + ys,zs\<rangle> = \<langle>xs,zs\<rangle> + \<langle>ys,zs\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>xs + ys,zs\<rangle> = \<langle>xs,zs\<rangle> + \<langle>ys,zs\<rangle>
[PROOF STEP]
apply(induct xs arbitrary: ys zs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>ys zs. \<langle>[] + ys,zs\<rangle> = \<langle>[],zs\<rangle> + \<langle>ys,zs\<rangle>
 2. \<And>a xs ys zs. (\<And>ys zs. \<langle>xs + ys,zs\<rangle> = \<langle>xs,zs\<rangle> + \<langle>ys,zs\<rangle>) \<Longrightarrow> \<langle>a # xs + ys,zs\<rangle> = \<langle>a # xs,zs\<rangle> + \<langle>ys,zs\<rangle>
[PROOF STEP]
apply (simp add: o_def split_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs ys zs. (\<And>ys zs. \<langle>xs + ys,zs\<rangle> = \<langle>xs,zs\<rangle> + \<langle>ys,zs\<rangle>) \<Longrightarrow> \<langle>a # xs + ys,zs\<rangle> = \<langle>a # xs,zs\<rangle> + \<langle>ys,zs\<rangle>
[PROOF STEP]
apply(case_tac ys)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs ys zs. \<lbrakk>\<And>ys zs. \<langle>xs + ys,zs\<rangle> = \<langle>xs,zs\<rangle> + \<langle>ys,zs\<rangle>; ys = []\<rbrakk> \<Longrightarrow> \<langle>a # xs + ys,zs\<rangle> = \<langle>a # xs,zs\<rangle> + \<langle>ys,zs\<rangle>
 2. \<And>a xs ys zs aa list. \<lbrakk>\<And>ys zs. \<langle>xs + ys,zs\<rangle> = \<langle>xs,zs\<rangle> + \<langle>ys,zs\<rangle>; ys = aa # list\<rbrakk> \<Longrightarrow> \<langle>a # xs + ys,zs\<rangle> = \<langle>a # xs,zs\<rangle> + \<langle>ys,zs\<rangle>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs ys zs aa list. \<lbrakk>\<And>ys zs. \<langle>xs + ys,zs\<rangle> = \<langle>xs,zs\<rangle> + \<langle>ys,zs\<rangle>; ys = aa # list\<rbrakk> \<Longrightarrow> \<langle>a # xs + ys,zs\<rangle> = \<langle>a # xs,zs\<rangle> + \<langle>ys,zs\<rangle>
[PROOF STEP]
apply(case_tac zs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs ys zs aa list. \<lbrakk>\<And>ys zs. \<langle>xs + ys,zs\<rangle> = \<langle>xs,zs\<rangle> + \<langle>ys,zs\<rangle>; ys = aa # list; zs = []\<rbrakk> \<Longrightarrow> \<langle>a # xs + ys,zs\<rangle> = \<langle>a # xs,zs\<rangle> + \<langle>ys,zs\<rangle>
 2. \<And>a xs ys zs aa list ab lista. \<lbrakk>\<And>ys zs. \<langle>xs + ys,zs\<rangle> = \<langle>xs,zs\<rangle> + \<langle>ys,zs\<rangle>; ys = aa # list; zs = ab # lista\<rbrakk> \<Longrightarrow> \<langle>a # xs + ys,zs\<rangle> = \<langle>a # xs,zs\<rangle> + \<langle>ys,zs\<rangle>
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs ys zs aa list ab lista. \<lbrakk>\<And>ys zs. \<langle>xs + ys,zs\<rangle> = \<langle>xs,zs\<rangle> + \<langle>ys,zs\<rangle>; ys = aa # list; zs = ab # lista\<rbrakk> \<Longrightarrow> \<langle>a # xs + ys,zs\<rangle> = \<langle>a # xs,zs\<rangle> + \<langle>ys,zs\<rangle>
[PROOF STEP]
apply(simp add: distrib_right)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cmod_eqI:
  assumes "z1 * cnj z1 = z2 * cnj z2"
  shows "cmod z1 = cmod z2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod z1 = cmod z2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
z1 * cnj z1 = z2 * cnj z2

goal (1 subgoal):
 1. cmod z1 = cmod z2
[PROOF STEP]
by (subst complex_mod_sqrt_Re_mult_cnj)+ auto


[STATEMENT]
lemma cSup_asclose:
  fixes S :: "'a::{linordered_idom,conditionally_complete_linorder} set"
  assumes S: "S \<noteq> {}"
    and b: "\<forall>x\<in>S. \<bar>x - l\<bar> \<le> e"
  shows "\<bar>Sup S - l\<bar> \<le> e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>Sup S - l\<bar> \<le> e
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>Sup S - l\<bar> \<le> e
[PROOF STEP]
have *: "\<bar>x - l\<bar> \<le> e \<longleftrightarrow> l - e \<le> x \<and> x \<le> l + e" for x l e :: 'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<bar>x - l\<bar> \<le> e) = (l - e \<le> x \<and> x \<le> l + e)
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
(\<bar>?x - ?l\<bar> \<le> ?e) = (?l - ?e \<le> ?x \<and> ?x \<le> ?l + ?e)

goal (1 subgoal):
 1. \<bar>Sup S - l\<bar> \<le> e
[PROOF STEP]
have "bdd_above S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above S
[PROOF STEP]
using b
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. \<bar>x - l\<bar> \<le> e

goal (1 subgoal):
 1. bdd_above S
[PROOF STEP]
by (auto intro!: bdd_aboveI[of _ "l + e"])
[PROOF STATE]
proof (state)
this:
bdd_above S

goal (1 subgoal):
 1. \<bar>Sup S - l\<bar> \<le> e
[PROOF STEP]
with S b
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
\<forall>x\<in>S. \<bar>x - l\<bar> \<le> e
bdd_above S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
\<forall>x\<in>S. \<bar>x - l\<bar> \<le> e
bdd_above S

goal (1 subgoal):
 1. \<bar>Sup S - l\<bar> \<le> e
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
\<forall>x\<in>S. l - e \<le> x \<and> x \<le> l + e
bdd_above S

goal (1 subgoal):
 1. l - e \<le> Sup S \<and> Sup S \<le> l + e
[PROOF STEP]
by (auto intro!: cSup_upper2 cSup_least)
[PROOF STATE]
proof (state)
this:
\<bar>Sup S - l\<bar> \<le> e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convex_supp_sum:
  assumes "convex S" and 1: "supp_sum u I = 1"
      and "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> u i \<and> (u i = 0 \<or> f i \<in> S)"
    shows "supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S
[PROOF STEP]
have fin: "finite {i \<in> I. u i \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {i \<in> I. u i \<noteq> 0}
[PROOF STEP]
using 1 sum.infinite
[PROOF STATE]
proof (prove)
using this:
supp_sum u I = 1
infinite ?A \<Longrightarrow> sum ?g ?A = (0::?'a)

goal (1 subgoal):
 1. finite {i \<in> I. u i \<noteq> 0}
[PROOF STEP]
by (force simp: supp_sum_def support_on_def)
[PROOF STATE]
proof (state)
this:
finite {i \<in> I. u i \<noteq> 0}

goal (1 subgoal):
 1. supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite {i \<in> I. u i \<noteq> 0}
[PROOF STEP]
have "supp_sum (\<lambda>i. u i *\<^sub>R f i) I = sum (\<lambda>i. u i *\<^sub>R f i) {i \<in> I. u i \<noteq> 0}"
[PROOF STATE]
proof (prove)
using this:
finite {i \<in> I. u i \<noteq> 0}

goal (1 subgoal):
 1. supp_sum (\<lambda>i. u i *\<^sub>R f i) I = (\<Sum>i | i \<in> I \<and> u i \<noteq> 0. u i *\<^sub>R f i)
[PROOF STEP]
by (force intro: sum.mono_neutral_left simp: supp_sum_def support_on_def)
[PROOF STATE]
proof (state)
this:
supp_sum (\<lambda>i. u i *\<^sub>R f i) I = (\<Sum>i | i \<in> I \<and> u i \<noteq> 0. u i *\<^sub>R f i)

goal (1 subgoal):
 1. supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
supp_sum (\<lambda>i. u i *\<^sub>R f i) I = (\<Sum>i | i \<in> I \<and> u i \<noteq> 0. u i *\<^sub>R f i)

goal (1 subgoal):
 1. supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S
[PROOF STEP]
have "... \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | i \<in> I \<and> u i \<noteq> 0. u i *\<^sub>R f i) \<in> S
[PROOF STEP]
using 1 assms
[PROOF STATE]
proof (prove)
using this:
supp_sum u I = 1
convex S
supp_sum u I = 1
?i \<in> I \<Longrightarrow> 0 \<le> u ?i \<and> (u ?i = 0 \<or> f ?i \<in> S)

goal (1 subgoal):
 1. (\<Sum>i | i \<in> I \<and> u i \<noteq> 0. u i *\<^sub>R f i) \<in> S
[PROOF STEP]
by (force simp: supp_sum_def support_on_def intro: convex_sum [OF fin \<open>convex S\<close>])
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i \<in> I \<and> u i \<noteq> 0. u i *\<^sub>R f i) \<in> S

goal (1 subgoal):
 1. supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S

goal (1 subgoal):
 1. supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ceiling_minus: "\<lceil>- x\<rceil> = - \<lfloor>x\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>- x\<rceil> = - \<lfloor>x\<rfloor>
[PROOF STEP]
unfolding ceiling_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - \<lfloor>- (- x)\<rfloor> = - \<lfloor>x\<rfloor>
[PROOF STEP]
by simp


[STATEMENT]
lemma sinh_diff: "sinh (x - y) = sinh x * cosh y - cosh x * sinh y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sinh (x - y) = sinh x * cosh y - cosh x * sinh y
[PROOF STEP]
by (simp add: sinh_def cosh_def algebra_simps scaleR_conv_of_real exp_add [symmetric])


[STATEMENT]
lemma path_image_part_circlepath_subset:
    "\<lbrakk>s \<le> t; 0 \<le> r\<rbrakk> \<Longrightarrow> path_image(part_circlepath z r s t) \<subseteq> sphere z r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>s \<le> t; 0 \<le> r\<rbrakk> \<Longrightarrow> path_image (part_circlepath z r s t) \<subseteq> sphere z r
[PROOF STEP]
by (auto simp: path_image_part_circlepath sphere_def dist_norm algebra_simps norm_mult)


[STATEMENT]
lemma nat_of_integer_less_iff: "x\<ge>0 \<Longrightarrow> y\<ge>0 \<Longrightarrow> nat_of_integer x < nat_of_integer y \<longleftrightarrow> x<y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> (nat_of_integer x < nat_of_integer y) = (x < y)
[PROOF STEP]
unfolding nat_of_integer.rep_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> (nat (int_of_integer x) < nat (int_of_integer y)) = (x < y)
[PROOF STEP]
by (auto simp: int_of_integer_less_iff nat_less_eq_zless int_of_integer_less_iff[of 0, simplified])


[STATEMENT]
lemma fact_binomial_limit:
  "(\<lambda>n. of_nat ((k + n) choose n) / of_nat (n ^ k) :: 'a :: Gamma) \<longlonglongrightarrow> 1 / fact k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. of_nat (k + n choose n) / of_nat (n ^ k)) \<longlonglongrightarrow> (1::'a) / fact k
[PROOF STEP]
proof (rule Lim_transform_eventually)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?f \<longlonglongrightarrow> (1::'a) / fact k
 2. \<forall>\<^sub>F x in sequentially. ?f x = of_nat (k + x choose x) / of_nat (x ^ k)
[PROOF STEP]
have "(\<lambda>n. of_nat ((k + n) choose n) / of_real (exp (of_nat k * ln (real_of_nat n))))
            \<longlonglongrightarrow> 1 / Gamma (of_nat (Suc k) :: 'a)" (is "?f \<longlonglongrightarrow> _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. of_nat (k + n choose n) / of_real (exp (real k * ln (real n)))) \<longlonglongrightarrow> (1::'a) / Gamma (of_nat (Suc k))
[PROOF STEP]
using Gamma_gbinomial[of "of_nat k :: 'a"]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (of_nat k + of_nat n gchoose n) * exp (- of_nat k * of_real (ln (real n)))) \<longlonglongrightarrow> rGamma (of_nat k + (1::'a))

goal (1 subgoal):
 1. (\<lambda>n. of_nat (k + n choose n) / of_real (exp (real k * ln (real n)))) \<longlonglongrightarrow> (1::'a) / Gamma (of_nat (Suc k))
[PROOF STEP]
by (simp add: binomial_gbinomial Gamma_def field_split_simps exp_of_real [symmetric] exp_minus)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. of_nat (k + n choose n) / of_real (exp (real k * ln (real n)))) \<longlonglongrightarrow> (1::'a) / Gamma (of_nat (Suc k))

goal (2 subgoals):
 1. ?f \<longlonglongrightarrow> (1::'a) / fact k
 2. \<forall>\<^sub>F x in sequentially. ?f x = of_nat (k + x choose x) / of_nat (x ^ k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. of_nat (k + n choose n) / of_real (exp (real k * ln (real n)))) \<longlonglongrightarrow> (1::'a) / Gamma (of_nat (Suc k))

goal (2 subgoals):
 1. ?f \<longlonglongrightarrow> (1::'a) / fact k
 2. \<forall>\<^sub>F x in sequentially. ?f x = of_nat (k + x choose x) / of_nat (x ^ k)
[PROOF STEP]
have "Gamma (of_nat (Suc k)) = fact k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gamma (of_nat (Suc k)) = fact k
[PROOF STEP]
by (simp add: Gamma_fact)
[PROOF STATE]
proof (state)
this:
Gamma (of_nat (Suc k)) = fact k

goal (2 subgoals):
 1. ?f \<longlonglongrightarrow> (1::'a) / fact k
 2. \<forall>\<^sub>F x in sequentially. ?f x = of_nat (k + x choose x) / of_nat (x ^ k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. of_nat (k + n choose n) / of_real (exp (real k * ln (real n)))) \<longlonglongrightarrow> (1::'a) / fact k
[PROOF STEP]
show "?f \<longlonglongrightarrow> 1 / fact k"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. of_nat (k + n choose n) / of_real (exp (real k * ln (real n)))) \<longlonglongrightarrow> (1::'a) / fact k

goal (1 subgoal):
 1. (\<lambda>n. of_nat (k + n choose n) / of_real (exp (real k * ln (real n)))) \<longlonglongrightarrow> (1::'a) / fact k
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. of_nat (k + n choose n) / of_real (exp (real k * ln (real n)))) \<longlonglongrightarrow> (1::'a) / fact k

goal (1 subgoal):
 1. \<forall>\<^sub>F x in sequentially. of_nat (k + x choose x) / of_real (exp (real k * ln (real x))) = of_nat (k + x choose x) / of_nat (x ^ k)
[PROOF STEP]
show "eventually (\<lambda>n. ?f n = of_nat ((k + n) choose n) / of_nat (n ^ k)) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. of_nat (k + n choose n) / of_real (exp (real k * ln (real n))) = of_nat (k + n choose n) / of_nat (n ^ k)
[PROOF STEP]
using eventually_gt_at_top[of "0::nat"]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. of_nat (k + n choose n) / of_real (exp (real k * ln (real n))) = of_nat (k + n choose n) / of_nat (n ^ k)
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> of_nat (k + n choose n) / of_real (exp (real k * ln (real n))) = of_nat (k + n choose n) / of_nat (n ^ k)
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> of_nat (k + n choose n) / of_real (exp (real k * ln (real n))) = of_nat (k + n choose n) / of_nat (n ^ k)
[PROOF STEP]
assume n: "n > 0"
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> of_nat (k + n choose n) / of_real (exp (real k * ln (real n))) = of_nat (k + n choose n) / of_nat (n ^ k)
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "exp (real_of_nat k * ln (real_of_nat n)) = real_of_nat (n^k)"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. exp (real k * ln (real n)) = real (n ^ k)
[PROOF STEP]
by (simp add: exp_of_nat_mult)
[PROOF STATE]
proof (state)
this:
exp (real k * ln (real n)) = real (n ^ k)

goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> of_nat (k + n choose n) / of_real (exp (real k * ln (real n))) = of_nat (k + n choose n) / of_nat (n ^ k)
[PROOF STEP]
thus "?f n = of_nat ((k + n) choose n) / of_nat (n ^ k)"
[PROOF STATE]
proof (prove)
using this:
exp (real k * ln (real n)) = real (n ^ k)

goal (1 subgoal):
 1. of_nat (k + n choose n) / of_real (exp (real k * ln (real n))) = of_nat (k + n choose n) / of_nat (n ^ k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_nat (k + n choose n) / of_real (exp (real k * ln (real n))) = of_nat (k + n choose n) / of_nat (n ^ k)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. of_nat (k + n choose n) / of_real (exp (real k * ln (real n))) = of_nat (k + n choose n) / of_nat (n ^ k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [simp]:
  "n \<le> 2 ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> 2 ^ n
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 \<le> 2 ^ 0
 2. \<And>n. n \<le> 2 ^ n \<Longrightarrow> Suc n \<le> 2 ^ Suc n
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. Suc n \<le> 2 * 2 ^ n
[PROOF STEP]
apply (rule_tac y = "1 + 2 ^ n" in order_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. Suc n \<le> 1 + 2 ^ n
 2. \<And>n. 1 + 2 ^ n \<le> 2 * 2 ^ n
[PROOF STEP]
by auto


[STATEMENT]
lemma not_subset_not_in: "(\<not> s1 \<subseteq> s2) = (\<exists>i. i \<in> s1 \<and> i \<notin> s2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> s1 \<subseteq> s2) = (\<exists>i. i \<in> s1 \<and> i \<notin> s2)
[PROOF STEP]
by auto


[STATEMENT]
lemma cos_squared_eq: "(cos x)\<^sup>2 = 1 - (sin x)\<^sup>2"
  for x :: "'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cos x)\<^sup>2 = (1::'a) - (sin x)\<^sup>2
[PROOF STEP]
unfolding eq_diff_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cos x)\<^sup>2 + (sin x)\<^sup>2 = (1::'a)
[PROOF STEP]
by (rule sin_cos_squared_add2)


[STATEMENT]
lemma set_8_atLeast0 [simp]: "{0..<8::nat} = {0,1,2,3,4,5,6,7}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<8} = {0, 1, 2, 3, 4, 5, 6, 7}
[PROOF STEP]
by auto


[STATEMENT]
theorem wf_list_graph_iff_wf_graph:
    "wf_graph (list_graph_to_graph G) \<longleftrightarrow> wf_list_graph_axioms G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_graph (list_graph_to_graph G) = wf_list_graph_axioms G
[PROOF STEP]
apply(unfold list_graph_to_graph_def wf_graph_def wf_list_graph_axioms_def wf_list_graph_impl_axioms_locale_props)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((fst ` edges \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr> \<subseteq> nodes \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr> \<and> snd ` edges \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr> \<subseteq> nodes \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr>) \<and> finite (edges \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr>) \<and> finite (nodes \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr>)) = (fst ` set (edgesL G) \<subseteq> set (nodesL G) \<and> snd ` set (edgesL G) \<subseteq> set (nodesL G))
[PROOF STEP]
by simp


[STATEMENT]
lemma sin_cos_squared_add_cpx:
  "\<i>*complex_of_real (sin (\<gamma>/2)) * (\<i>*complex_of_real (sin (\<gamma>/2))) -
   complex_of_real (cos (\<gamma>/2)) * complex_of_real (cos (\<gamma>/2)) = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<i> * complex_of_real (sin (\<gamma> / 2)) * (\<i> * complex_of_real (sin (\<gamma> / 2))) - complex_of_real (cos (\<gamma> / 2)) * complex_of_real (cos (\<gamma> / 2)) = - 1
[PROOF STEP]
apply (auto simp add: algebra_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (cos (\<gamma> / 2)) * complex_of_real (cos (\<gamma> / 2)) + complex_of_real (sin (\<gamma> / 2)) * complex_of_real (sin (\<gamma> / 2)) = 1
[PROOF STEP]
by (metis of_real_add of_real_hom.hom_one of_real_mult sin_cos_squared_add3)


[STATEMENT]
lemma nth_plus_list [rule_format, simp]:
  "\<forall>xs ys i. length xs = n \<longrightarrow> length ys = n \<longrightarrow> i<n \<longrightarrow>
  (xs +[f] ys)!i = (xs!i) +_f (ys!i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xs ys i. length xs = n \<longrightarrow> length ys = n \<longrightarrow> i < n \<longrightarrow> (xs +[f] ys) ! i = xs ! i \<squnion>\<^bsub>f\<^esub> ys ! i
[PROOF STEP]
apply (induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>xs ys i. length xs = 0 \<longrightarrow> length ys = 0 \<longrightarrow> i < 0 \<longrightarrow> (xs +[f] ys) ! i = xs ! i \<squnion>\<^bsub>f\<^esub> ys ! i
 2. \<And>n. \<forall>xs ys i. length xs = n \<longrightarrow> length ys = n \<longrightarrow> i < n \<longrightarrow> (xs +[f] ys) ! i = xs ! i \<squnion>\<^bsub>f\<^esub> ys ! i \<Longrightarrow> \<forall>xs ys i. length xs = Suc n \<longrightarrow> length ys = Suc n \<longrightarrow> i < Suc n \<longrightarrow> (xs +[f] ys) ! i = xs ! i \<squnion>\<^bsub>f\<^esub> ys ! i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<forall>xs ys i. length xs = n \<longrightarrow> length ys = n \<longrightarrow> i < n \<longrightarrow> (xs +[f] ys) ! i = xs ! i \<squnion>\<^bsub>f\<^esub> ys ! i \<Longrightarrow> \<forall>xs ys i. length xs = Suc n \<longrightarrow> length ys = Suc n \<longrightarrow> i < Suc n \<longrightarrow> (xs +[f] ys) ! i = xs ! i \<squnion>\<^bsub>f\<^esub> ys ! i
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n xs ys i. \<lbrakk>\<forall>xs ys i. length xs = n \<longrightarrow> length ys = n \<longrightarrow> i < n \<longrightarrow> (xs +[f] ys) ! i = xs ! i \<squnion>\<^bsub>f\<^esub> ys ! i; length xs = Suc n; length ys = Suc n; i < Suc n\<rbrakk> \<Longrightarrow> (xs +[f] ys) ! i = xs ! i \<squnion>\<^bsub>f\<^esub> ys ! i
[PROOF STEP]
apply (case_tac xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n xs ys i. \<lbrakk>\<forall>xs ys i. length xs = n \<longrightarrow> length ys = n \<longrightarrow> i < n \<longrightarrow> (xs +[f] ys) ! i = xs ! i \<squnion>\<^bsub>f\<^esub> ys ! i; length xs = Suc n; length ys = Suc n; i < Suc n; xs = []\<rbrakk> \<Longrightarrow> (xs +[f] ys) ! i = xs ! i \<squnion>\<^bsub>f\<^esub> ys ! i
 2. \<And>n xs ys i a list. \<lbrakk>\<forall>xs ys i. length xs = n \<longrightarrow> length ys = n \<longrightarrow> i < n \<longrightarrow> (xs +[f] ys) ! i = xs ! i \<squnion>\<^bsub>f\<^esub> ys ! i; length xs = Suc n; length ys = Suc n; i < Suc n; xs = a # list\<rbrakk> \<Longrightarrow> (xs +[f] ys) ! i = xs ! i \<squnion>\<^bsub>f\<^esub> ys ! i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n xs ys i a list. \<lbrakk>\<forall>xs ys i. length xs = n \<longrightarrow> length ys = n \<longrightarrow> i < n \<longrightarrow> (xs +[f] ys) ! i = xs ! i \<squnion>\<^bsub>f\<^esub> ys ! i; length xs = Suc n; length ys = Suc n; i < Suc n; xs = a # list\<rbrakk> \<Longrightarrow> (xs +[f] ys) ! i = xs ! i \<squnion>\<^bsub>f\<^esub> ys ! i
[PROOF STEP]
apply (force simp add: nth_Cons split: list.split nat.split)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sum_inverse_squares_expansion_bigo_simple:
  "(\<lambda>n. (\<Sum>i=1..n. 1 / real i ^ 2) - (pi ^ 2 / 6 - 1 / n + 1 / (2*n^2))) \<in> O(\<lambda>n. 1 / n ^ 3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>i = 1..n. 1 / (real i)\<^sup>2) - (pi\<^sup>2 / 6 - 1 / real n + 1 / (2 * (real n)\<^sup>2))) \<in> O(\<lambda>x. 1 / real x ^ 3)
[PROOF STEP]
using sum_inverse_squares_expansion_bigo[of 0]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (\<Sum>i = 1..n. 1 / (real i)\<^sup>2) - (pi\<^sup>2 / 6 - 1 / real n + 1 / (2 * (real n)\<^sup>2) - (\<Sum>i = 1..0. bernoulli (2 * i) / real n ^ (2 * i + 1)))) \<in> O(\<lambda>n. 1 / real n ^ (2 * 0 + 3))

goal (1 subgoal):
 1. (\<lambda>n. (\<Sum>i = 1..n. 1 / (real i)\<^sup>2) - (pi\<^sup>2 / 6 - 1 / real n + 1 / (2 * (real n)\<^sup>2))) \<in> O(\<lambda>x. 1 / real x ^ 3)
[PROOF STEP]
by (simp add: power2_eq_square)


[STATEMENT]
lemma squarefree_factorial_semiring'':
  assumes "n \<noteq> 0"
  shows   "squarefree (n :: 'a :: factorial_semiring) \<longleftrightarrow>
             (\<forall>p. prime p \<longrightarrow> multiplicity p n \<le> 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. squarefree n = (\<forall>p. prime p \<longrightarrow> multiplicity p n \<le> 1)
[PROOF STEP]
by (subst squarefree_factorial_semiring'[OF assms]) (auto simp: prime_factors_multiplicity)


[STATEMENT]
lemma size_hps_link: "size_hps(hps (link h1 h2)) = size_hp h1 + size_hp h2 - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size_hps (hps (link h1 h2)) = Pairing_Heap_List2_Analysis.size_hp h1 + Pairing_Heap_List2_Analysis.size_hp h2 - 1
[PROOF STEP]
by (induction rule: link.induct) simp_all


[STATEMENT]
lemma ENR_linear_image_eq:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes "linear f" "inj f"
  shows "ENR (image f S) \<longleftrightarrow> ENR S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ENR (f ` S) = ENR S
[PROOF STEP]
by (meson assms homeomorphic_ENR_iff_ENR linear_homeomorphic_image)


[STATEMENT]
lemma condition_4_part_1:
  fixes A::"'a::{field}^'columns::{mod_type}^'rows::{mod_type}" and k::nat
  defines ia:"ia\<equiv>(if \<forall>m. is_zero_row_upt_k m k A then 0 else to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1)"
  defines B:"B\<equiv>(snd (Gauss_Jordan_column_k (ia,A) k))"
  assumes not_zero_i_suc_k:  "\<not> is_zero_row_upt_k i (Suc k) B"
  and all_zero: "\<forall>m. is_zero_row_upt_k m k A"
  and all_zero_k: "\<forall>m. A $ m $ from_nat k = 0"
  shows "A $ j $ (LEAST n. A $ i $ n \<noteq> 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
have ia2: "ia = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ia = 0
[PROOF STEP]
using ia all_zero
[PROOF STATE]
proof (prove)
using this:
ia \<equiv> if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1
\<forall>m. is_zero_row_upt_k m k A

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

goal (1 subgoal):
 1. A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
have B_eq_A: "B=A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B = A
[PROOF STEP]
unfolding B Gauss_Jordan_column_k_def Let_def fst_conv snd_conv ia2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (if (\<forall>m\<ge>mod_type_class.from_nat 0. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> 0 = nrows A then (0, A) else (0 + 1, Gauss_Jordan_in_ij A (mod_type_class.from_nat 0) (mod_type_class.from_nat k))) = A
[PROOF STEP]
using all_zero_k
[PROOF STATE]
proof (prove)
using this:
\<forall>m. A $ m $ mod_type_class.from_nat k = (0::'a)

goal (1 subgoal):
 1. snd (if (\<forall>m\<ge>mod_type_class.from_nat 0. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> 0 = nrows A then (0, A) else (0 + 1, Gauss_Jordan_in_ij A (mod_type_class.from_nat 0) (mod_type_class.from_nat k))) = A
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
B = A

goal (1 subgoal):
 1. A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
using B_eq_A all_zero all_zero_k is_zero_row_upt_k_suc not_zero_i_suc_k
[PROOF STATE]
proof (prove)
using this:
B = A
\<forall>m. is_zero_row_upt_k m k A
\<forall>m. A $ m $ mod_type_class.from_nat k = (0::'a)
\<lbrakk>is_zero_row_upt_k ?i ?k ?A; ?A $ ?i $ mod_type_class.from_nat ?k = (0::?'b)\<rbrakk> \<Longrightarrow> is_zero_row_upt_k ?i (Suc ?k) ?A
\<not> is_zero_row_upt_k i (Suc k) B

goal (1 subgoal):
 1. A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed