[STATEMENT]
lemma sum_of_squares_ge_ennreal:
  fixes a b :: ennreal
  shows "2 * a * b \<le> a\<^sup>2 + b\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
[PROOF STEP]
proof (cases a; cases b)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>r ra. \<lbrakk>0 \<le> r; a = ennreal r; 0 \<le> ra; b = ennreal ra\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 2. \<And>r. \<lbrakk>0 \<le> r; a = ennreal r; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 3. \<And>r. \<lbrakk>a = top; 0 \<le> r; b = ennreal r\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 4. \<lbrakk>a = top; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>r ra. \<lbrakk>0 \<le> r; a = ennreal r; 0 \<le> ra; b = ennreal ra\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 2. \<And>r. \<lbrakk>0 \<le> r; a = ennreal r; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 3. \<And>r. \<lbrakk>a = top; 0 \<le> r; b = ennreal r\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 4. \<lbrakk>a = top; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
[PROOF STEP]
assume xy: "x \<ge> 0" "y \<ge> 0" and [simp]: "a = ennreal x" "b = ennreal y"
[PROOF STATE]
proof (state)
this:
0 \<le> x
0 \<le> y
a = ennreal x
b = ennreal y

goal (4 subgoals):
 1. \<And>r ra. \<lbrakk>0 \<le> r; a = ennreal r; 0 \<le> ra; b = ennreal ra\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 2. \<And>r. \<lbrakk>0 \<le> r; a = ennreal r; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 3. \<And>r. \<lbrakk>a = top; 0 \<le> r; b = ennreal r\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 4. \<lbrakk>a = top; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
[PROOF STEP]
have "0 \<le> (x - y)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (x - y)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> (x - y)\<^sup>2

goal (4 subgoals):
 1. \<And>r ra. \<lbrakk>0 \<le> r; a = ennreal r; 0 \<le> ra; b = ennreal ra\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 2. \<And>r. \<lbrakk>0 \<le> r; a = ennreal r; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 3. \<And>r. \<lbrakk>a = top; 0 \<le> r; b = ennreal r\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 4. \<lbrakk>a = top; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 \<le> (x - y)\<^sup>2

goal (4 subgoals):
 1. \<And>r ra. \<lbrakk>0 \<le> r; a = ennreal r; 0 \<le> ra; b = ennreal ra\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 2. \<And>r. \<lbrakk>0 \<le> r; a = ennreal r; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 3. \<And>r. \<lbrakk>a = top; 0 \<le> r; b = ennreal r\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 4. \<lbrakk>a = top; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
[PROOF STEP]
have "\<dots> = x\<^sup>2 + y\<^sup>2 - 2 * x * y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - y)\<^sup>2 = x\<^sup>2 + y\<^sup>2 - 2 * x * y
[PROOF STEP]
by (simp add: algebra_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
(x - y)\<^sup>2 = x\<^sup>2 + y\<^sup>2 - 2 * x * y

goal (4 subgoals):
 1. \<And>r ra. \<lbrakk>0 \<le> r; a = ennreal r; 0 \<le> ra; b = ennreal ra\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 2. \<And>r. \<lbrakk>0 \<le> r; a = ennreal r; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 3. \<And>r. \<lbrakk>a = top; 0 \<le> r; b = ennreal r\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 4. \<lbrakk>a = top; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 \<le> x\<^sup>2 + y\<^sup>2 - 2 * x * y
[PROOF STEP]
have "2 * x * y \<le> x\<^sup>2 + y\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
0 \<le> x\<^sup>2 + y\<^sup>2 - 2 * x * y

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

goal (4 subgoals):
 1. \<And>r ra. \<lbrakk>0 \<le> r; a = ennreal r; 0 \<le> ra; b = ennreal ra\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 2. \<And>r. \<lbrakk>0 \<le> r; a = ennreal r; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 3. \<And>r. \<lbrakk>a = top; 0 \<le> r; b = ennreal r\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 4. \<lbrakk>a = top; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
[PROOF STEP]
hence "ennreal (2 * x * y) \<le> ennreal (x\<^sup>2 + y\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
2 * x * y \<le> x\<^sup>2 + y\<^sup>2

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

goal (4 subgoals):
 1. \<And>r ra. \<lbrakk>0 \<le> r; a = ennreal r; 0 \<le> ra; b = ennreal ra\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 2. \<And>r. \<lbrakk>0 \<le> r; a = ennreal r; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 3. \<And>r. \<lbrakk>a = top; 0 \<le> r; b = ennreal r\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 4. \<lbrakk>a = top; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ennreal (2 * x * y) \<le> ennreal (x\<^sup>2 + y\<^sup>2)

goal (1 subgoal):
 1. 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
[PROOF STEP]
using xy
[PROOF STATE]
proof (prove)
using this:
ennreal (2 * x * y) \<le> ennreal (x\<^sup>2 + y\<^sup>2)
0 \<le> x
0 \<le> y

goal (1 subgoal):
 1. 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
[PROOF STEP]
by (simp add: ennreal_mult ennreal_power)
[PROOF STATE]
proof (state)
this:
2 * a * b \<le> a\<^sup>2 + b\<^sup>2

goal (3 subgoals):
 1. \<And>r. \<lbrakk>0 \<le> r; a = ennreal r; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 2. \<And>r. \<lbrakk>a = top; 0 \<le> r; b = ennreal r\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
 3. \<lbrakk>a = top; b = top\<rbrakk> \<Longrightarrow> 2 * a * b \<le> a\<^sup>2 + b\<^sup>2
[PROOF STEP]
qed auto


[STATEMENT]
lemma matroid_ax_2_alt: "rk X \<le> rk (X \<union> {x}) \<and> rk (X \<union> {x}) \<le> rk X + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk X \<le> rk (X \<union> {x}) \<and> rk (X \<union> {x}) \<le> rk X + 1
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rk X \<le> rk (X \<union> {x})
 2. rk (X \<union> {x}) \<le> rk X + 1
[PROOF STEP]
have "X \<subseteq> X \<union> {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<subseteq> X \<union> {x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X \<subseteq> X \<union> {x}

goal (2 subgoals):
 1. rk X \<le> rk (X \<union> {x})
 2. rk (X \<union> {x}) \<le> rk X + 1
[PROOF STEP]
thus "rk X \<le> rk (X \<union> {x})"
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> X \<union> {x}

goal (1 subgoal):
 1. rk X \<le> rk (X \<union> {x})
[PROOF STEP]
by (simp add: matroid_ax_2)
[PROOF STATE]
proof (state)
this:
rk X \<le> rk (X \<union> {x})

goal (1 subgoal):
 1. rk (X \<union> {x}) \<le> rk X + 1
[PROOF STEP]
have "rk {x} \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {x} \<le> 1
[PROOF STEP]
by (metis One_nat_def card.empty card_Suc_eq insert_absorb insert_not_empty matroid_ax_1b)
[PROOF STATE]
proof (state)
this:
rk {x} \<le> 1

goal (1 subgoal):
 1. rk (X \<union> {x}) \<le> rk X + 1
[PROOF STEP]
thus "rk (X \<union> {x}) \<le> rk X + 1"
[PROOF STATE]
proof (prove)
using this:
rk {x} \<le> 1

goal (1 subgoal):
 1. rk (X \<union> {x}) \<le> rk X + 1
[PROOF STEP]
by (metis add_leD1 le_antisym matroid_ax_3 rk_ax_singleton)
[PROOF STATE]
proof (state)
this:
rk (X \<union> {x}) \<le> rk X + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "((A \<or> B) \<and> (A \<longrightarrow> C) \<and> (B \<longrightarrow> C)) \<longrightarrow> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<or> B) \<and> (A \<longrightarrow> C) \<and> (B \<longrightarrow> C) \<longrightarrow> C
[PROOF STEP]
apply prop_solver
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma complex_box_ne_empty:
  fixes a b::complex
  shows
    "cbox a b \<noteq> {} \<longleftrightarrow> (Re a \<le> Re b \<and> Im a \<le> Im b)"
    "box a b \<noteq> {} \<longleftrightarrow> (Re a < Re b \<and> Im a < Im b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cbox a b \<noteq> {}) = (Re a \<le> Re b \<and> Im a \<le> Im b) &&& (box a b \<noteq> {}) = (Re a < Re b \<and> Im a < Im b)
[PROOF STEP]
by (auto simp add:box_ne_empty Basis_complex_def)


[STATEMENT]
lemma partitionsE:
  assumes "p partitions n"
  obtains "\<And>i. p i \<noteq> 0 \<Longrightarrow> 1 \<le> i \<and> i \<le> n" "(\<Sum>i\<le>n. p i * i) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>\<And>i. p i \<noteq> 0 \<Longrightarrow> 1 \<le> i \<and> i \<le> n; (\<Sum>i\<le>n. p i * i) = n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p partitions n

goal (1 subgoal):
 1. (\<lbrakk>\<And>i. p i \<noteq> 0 \<Longrightarrow> 1 \<le> i \<and> i \<le> n; (\<Sum>i\<le>n. p i * i) = n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding partitions_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>i. p i \<noteq> 0 \<longrightarrow> 1 \<le> i \<and> i \<le> n) \<and> (\<Sum>i\<le>n. p i * i) = n

goal (1 subgoal):
 1. (\<lbrakk>\<And>i. p i \<noteq> 0 \<Longrightarrow> 1 \<le> i \<and> i \<le> n; (\<Sum>i\<le>n. p i * i) = n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto


[STATEMENT]
lemma inverse_divisor_sigma:
  fixes a :: "'a :: {field, nat_power}"
  shows "inverse (fds (divisor_sigma a)) = fds_shift a (fds moebius_mu) * fds moebius_mu"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (fds (divisor_sigma a)) = fds_shift a (fds moebius_mu) * fds moebius_mu
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inverse (fds (divisor_sigma a)) = fds_shift a (fds moebius_mu) * fds moebius_mu
[PROOF STEP]
have "fds (divisor_sigma a) = fds_zeta * fds_shift a fds_zeta"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds (divisor_sigma a) = fds_zeta * fds_shift a fds_zeta
[PROOF STEP]
by (simp add: fds_divisor_sigma)
[PROOF STATE]
proof (state)
this:
fds (divisor_sigma a) = fds_zeta * fds_shift a fds_zeta

goal (1 subgoal):
 1. inverse (fds (divisor_sigma a)) = fds_shift a (fds moebius_mu) * fds moebius_mu
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fds (divisor_sigma a) = fds_zeta * fds_shift a fds_zeta

goal (1 subgoal):
 1. inverse (fds (divisor_sigma a)) = fds_shift a (fds moebius_mu) * fds moebius_mu
[PROOF STEP]
have "inverse \<dots> = fds moebius_mu * inverse (fds_shift a fds_zeta)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (fds_zeta * fds_shift a fds_zeta) = fds moebius_mu * inverse (fds_shift a fds_zeta)
[PROOF STEP]
by (simp add: fds_moebius_inverse_zeta inverse_mult_fds)
[PROOF STATE]
proof (state)
this:
inverse (fds_zeta * fds_shift a fds_zeta) = fds moebius_mu * inverse (fds_shift a fds_zeta)

goal (1 subgoal):
 1. inverse (fds (divisor_sigma a)) = fds_shift a (fds moebius_mu) * fds moebius_mu
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inverse (fds_zeta * fds_shift a fds_zeta) = fds moebius_mu * inverse (fds_shift a fds_zeta)

goal (1 subgoal):
 1. inverse (fds (divisor_sigma a)) = fds_shift a (fds moebius_mu) * fds moebius_mu
[PROOF STEP]
have "inverse (fds_shift a fds_zeta) =
               fds (\<lambda>n. moebius_mu n * fds_nth (fds_shift a fds_zeta) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (fds_shift a fds_zeta) = fds (\<lambda>n. moebius_mu n * fds_nth (fds_shift a fds_zeta) n)
[PROOF STEP]
by (intro completely_multiplicative_fds_inverse', unfold_locales)
       (auto simp: nat_power_mult_distrib)
[PROOF STATE]
proof (state)
this:
inverse (fds_shift a fds_zeta) = fds (\<lambda>n. moebius_mu n * fds_nth (fds_shift a fds_zeta) n)

goal (1 subgoal):
 1. inverse (fds (divisor_sigma a)) = fds_shift a (fds moebius_mu) * fds moebius_mu
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inverse (fds_shift a fds_zeta) = fds (\<lambda>n. moebius_mu n * fds_nth (fds_shift a fds_zeta) n)

goal (1 subgoal):
 1. inverse (fds (divisor_sigma a)) = fds_shift a (fds moebius_mu) * fds moebius_mu
[PROOF STEP]
have "\<dots> = fds_shift a (fds moebius_mu)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds (\<lambda>n. moebius_mu n * fds_nth (fds_shift a fds_zeta) n) = fds_shift a (fds moebius_mu)
[PROOF STEP]
by (auto simp: fds_eq_iff)
[PROOF STATE]
proof (state)
this:
fds (\<lambda>n. moebius_mu n * fds_nth (fds_shift a fds_zeta) n) = fds_shift a (fds moebius_mu)

goal (1 subgoal):
 1. inverse (fds (divisor_sigma a)) = fds_shift a (fds moebius_mu) * fds moebius_mu
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
inverse (fds (divisor_sigma a)) = fds moebius_mu * fds_shift a (fds moebius_mu)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inverse (fds (divisor_sigma a)) = fds moebius_mu * fds_shift a (fds moebius_mu)

goal (1 subgoal):
 1. inverse (fds (divisor_sigma a)) = fds_shift a (fds moebius_mu) * fds moebius_mu
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
inverse (fds (divisor_sigma a)) = fds_shift a (fds moebius_mu) * fds moebius_mu

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Least_strict_mono:
  assumes \<open>strict_mono f\<close>
  and     \<open>\<exists>x \<in> S. \<forall>y \<in> S. x \<le> y\<close>
  shows   \<open>(LEAST y. y \<in> f ` S) = f (LEAST x. x \<in> S)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST y. y \<in> f ` S) = f (LEAST x. x \<in> S)
[PROOF STEP]
using Least_mono[OF strict_mono_mono, OF assms]
[PROOF STATE]
proof (prove)
using this:
(LEAST y. y \<in> f ` S) = f (LEAST x. x \<in> S)

goal (1 subgoal):
 1. (LEAST y. y \<in> f ` S) = f (LEAST x. x \<in> S)
[PROOF STEP]
.


[STATEMENT]
lemma foldl_mult_start:
  fixes v :: "'a::comm_ring_1"
  shows "foldl (\<lambda>r x. r * f x) v as * x = foldl (\<lambda>r x. r * f x) (v * x) as "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl (\<lambda>r x. r * f x) v as * x = foldl (\<lambda>r x. r * f x) (v * x) as
[PROOF STEP]
by (induct as arbitrary: x v) (auto simp add: algebra_simps)


[STATEMENT]
lemma set_pmf_map: "set_pmf (map_pmf f M) = f ` set_pmf M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_pmf (map_pmf f M) = f ` set_pmf M
[PROOF STEP]
using pmf_set_map[of f]
[PROOF STATE]
proof (prove)
using this:
set_pmf \<circ> map_pmf f = (`) f \<circ> set_pmf

goal (1 subgoal):
 1. set_pmf (map_pmf f M) = f ` set_pmf M
[PROOF STEP]
by (simp add: comp_def fun_eq_iff)


[STATEMENT]
lemma floor_numeral_power [simp]: "\<lfloor>numeral x ^ n\<rfloor> = numeral x ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>numeral x ^ n\<rfloor> = numeral x ^ n
[PROOF STEP]
by (metis floor_of_int of_int_numeral of_int_power)


[STATEMENT]
lemma (in wf_sub_rel) Nil_sp :
  "subpath g v1 [] v2 subs \<longleftrightarrow> sub_rel_of g subs
                             \<and> v1 \<in> Graph.vertices g
                             \<and> (v1 = v2 \<or> (v1,v2) \<in> subs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SubRel.subpath g v1 [] v2 subs = (sub_rel_of g subs \<and> v1 \<in> Graph.vertices g \<and> (v1 = v2 \<or> (v1, v2) \<in> subs))
[PROOF STEP]
using trancl_eq
[PROOF STATE]
proof (prove)
using this:
subs\<^sup>+ = subs

goal (1 subgoal):
 1. SubRel.subpath g v1 [] v2 subs = (sub_rel_of g subs \<and> v1 \<in> Graph.vertices g \<and> (v1 = v2 \<or> (v1, v2) \<in> subs))
[PROOF STEP]
by (simp add : Nil_sp)


[STATEMENT]
lemma concat_map_cons_rev:
  "rev (concat (map ((#) j) xss)) = concat (map (\<lambda> xs. xs @ [j]) (rev (map rev xss)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rev (concat (map ((#) j) xss)) = concat (map (\<lambda>xs. xs @ [j]) (rev (map rev xss)))
[PROOF STEP]
by (induction xss) auto


[STATEMENT]
lemma lcm_right_idem: "lcm (lcm a b) b = lcm a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcm (lcm a b) b = lcm a b
[PROOF STEP]
by (fact lcm.right_idem)


[STATEMENT]
lemma four_block_unitarily_equiv:
  assumes "unitarily_equiv A1 B1 U1"
  and "unitarily_equiv A2 B2 U2"
  and "dim_row A1 = dim_col A1"
  and "dim_row A2 = dim_col A2"
shows "unitarily_equiv
  (four_block_diag A1 A2)
  (four_block_diag B1 B2)
  (four_block_diag U1 U2)"
(is "unitarily_equiv ?fA ?fB ?fU")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitarily_equiv (four_block_diag A1 A2) (four_block_diag B1 B2) (four_block_diag U1 U2)
[PROOF STEP]
unfolding unitarily_equiv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.unitary (four_block_diag U1 U2) \<and> similar_mat_wit (four_block_diag A1 A2) (four_block_diag B1 B2) (four_block_diag U1 U2) (Complex_Matrix.adjoint (four_block_diag U1 U2))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Complex_Matrix.unitary (four_block_diag U1 U2)
 2. similar_mat_wit (four_block_diag A1 A2) (four_block_diag B1 B2) (four_block_diag U1 U2) (Complex_Matrix.adjoint (four_block_diag U1 U2))
[PROOF STEP]
show "unitary ?fU"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.unitary (four_block_diag U1 U2)
[PROOF STEP]
using four_block_diag_unitary assms unitarily_equivD(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Complex_Matrix.unitary ?U1.0; Complex_Matrix.unitary ?U2.0\<rbrakk> \<Longrightarrow> Complex_Matrix.unitary (four_block_diag ?U1.0 ?U2.0)
unitarily_equiv A1 B1 U1
unitarily_equiv A2 B2 U2
dim_row A1 = dim_col A1
dim_row A2 = dim_col A2
unitarily_equiv ?A ?B ?U \<Longrightarrow> Complex_Matrix.unitary ?U

goal (1 subgoal):
 1. Complex_Matrix.unitary (four_block_diag U1 U2)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Complex_Matrix.unitary (four_block_diag U1 U2)

goal (1 subgoal):
 1. similar_mat_wit (four_block_diag A1 A2) (four_block_diag B1 B2) (four_block_diag U1 U2) (Complex_Matrix.adjoint (four_block_diag U1 U2))
[PROOF STEP]
show "similar_mat_wit ?fA ?fB ?fU (Complex_Matrix.adjoint ?fU)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. similar_mat_wit (four_block_diag A1 A2) (four_block_diag B1 B2) (four_block_diag U1 U2) (Complex_Matrix.adjoint (four_block_diag U1 U2))
[PROOF STEP]
using assms four_block_diag_similar[of A1]
[PROOF STATE]
proof (prove)
using this:
unitarily_equiv A1 B1 U1
unitarily_equiv A2 B2 U2
dim_row A1 = dim_col A1
dim_row A2 = dim_col A2
\<lbrakk>unitarily_equiv A1 ?B1.0 ?U1.0; unitarily_equiv ?A2.0 ?B2.0 ?U2.0; dim_row A1 = dim_col A1; dim_row ?A2.0 = dim_col ?A2.0\<rbrakk> \<Longrightarrow> similar_mat_wit (four_block_diag A1 ?A2.0) (four_block_diag ?B1.0 ?B2.0) (four_block_diag ?U1.0 ?U2.0) (Complex_Matrix.adjoint (four_block_diag ?U1.0 ?U2.0))

goal (1 subgoal):
 1. similar_mat_wit (four_block_diag A1 A2) (four_block_diag B1 B2) (four_block_diag U1 U2) (Complex_Matrix.adjoint (four_block_diag U1 U2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
similar_mat_wit (four_block_diag A1 A2) (four_block_diag B1 B2) (four_block_diag U1 U2) (Complex_Matrix.adjoint (four_block_diag U1 U2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma winding_number_comp:
  assumes "open s" "f holomorphic_on s" "path_image \<gamma> \<subseteq> s"
    "valid_path \<gamma>" "z \<notin> path_image (f \<circ> \<gamma>)"
  shows "winding_number (f \<circ> \<gamma>) z = 1/(2*pi*\<i>)* contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number (f \<circ> \<gamma>) z = 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. winding_number (f \<circ> \<gamma>) z = 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
[PROOF STEP]
obtain spikes where "finite spikes" and \<gamma>_diff: "\<gamma> C1_differentiable_on {0..1} - spikes"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>spikes. \<lbrakk>finite spikes; \<gamma> C1_differentiable_on {0..1} - spikes\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>valid_path \<gamma>\<close>
[PROOF STATE]
proof (prove)
using this:
valid_path \<gamma>

goal (1 subgoal):
 1. (\<And>spikes. \<lbrakk>finite spikes; \<gamma> C1_differentiable_on {0..1} - spikes\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding valid_path_def piecewise_C1_differentiable_on_def
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} \<gamma> \<and> (\<exists>S. finite S \<and> \<gamma> C1_differentiable_on {0..1} - S)

goal (1 subgoal):
 1. (\<And>spikes. \<lbrakk>finite spikes; \<gamma> C1_differentiable_on {0..1} - spikes\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite spikes
\<gamma> C1_differentiable_on {0..1} - spikes

goal (1 subgoal):
 1. winding_number (f \<circ> \<gamma>) z = 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
[PROOF STEP]
have "valid_path (f \<circ> \<gamma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_path (f \<circ> \<gamma>)
[PROOF STEP]
using valid_path_compose_holomorphic assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>valid_path ?g; ?f holomorphic_on ?S; open ?S; path_image ?g \<subseteq> ?S\<rbrakk> \<Longrightarrow> valid_path (?f \<circ> ?g)
open s
f holomorphic_on s
path_image \<gamma> \<subseteq> s
valid_path \<gamma>
z \<notin> path_image (f \<circ> \<gamma>)

goal (1 subgoal):
 1. valid_path (f \<circ> \<gamma>)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
valid_path (f \<circ> \<gamma>)

goal (1 subgoal):
 1. winding_number (f \<circ> \<gamma>) z = 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
valid_path (f \<circ> \<gamma>)

goal (1 subgoal):
 1. winding_number (f \<circ> \<gamma>) z = 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
[PROOF STEP]
have "contour_integral (f \<circ> \<gamma>) (\<lambda>w. 1 / (w - z))
      = contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (f \<circ> \<gamma>) (\<lambda>w. 1 / (w - z)) = contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
[PROOF STEP]
unfolding contour_integral_integral
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. 1 / ((f \<circ> \<gamma>) x - z) * vector_derivative (f \<circ> \<gamma>) (at x)) = integral {0..1} (\<lambda>x. deriv f (\<gamma> x) / (f (\<gamma> x) - z) * vector_derivative \<gamma> (at x))
[PROOF STEP]
proof (rule integral_spike[rule_format,OF negligible_finite[OF \<open>finite spikes\<close>]])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} - spikes \<Longrightarrow> deriv f (\<gamma> x) / (f (\<gamma> x) - z) * vector_derivative \<gamma> (at x) = 1 / ((f \<circ> \<gamma>) x - z) * vector_derivative (f \<circ> \<gamma>) (at x)
[PROOF STEP]
fix t::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} - spikes \<Longrightarrow> deriv f (\<gamma> x) / (f (\<gamma> x) - z) * vector_derivative \<gamma> (at x) = 1 / ((f \<circ> \<gamma>) x - z) * vector_derivative (f \<circ> \<gamma>) (at x)
[PROOF STEP]
assume t:"t \<in> {0..1} - spikes"
[PROOF STATE]
proof (state)
this:
t \<in> {0..1} - spikes

goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} - spikes \<Longrightarrow> deriv f (\<gamma> x) / (f (\<gamma> x) - z) * vector_derivative \<gamma> (at x) = 1 / ((f \<circ> \<gamma>) x - z) * vector_derivative (f \<circ> \<gamma>) (at x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t \<in> {0..1} - spikes
[PROOF STEP]
have "\<gamma> differentiable at t"
[PROOF STATE]
proof (prove)
using this:
t \<in> {0..1} - spikes

goal (1 subgoal):
 1. \<gamma> differentiable at t
[PROOF STEP]
using \<gamma>_diff
[PROOF STATE]
proof (prove)
using this:
t \<in> {0..1} - spikes
\<gamma> C1_differentiable_on {0..1} - spikes

goal (1 subgoal):
 1. \<gamma> differentiable at t
[PROOF STEP]
unfolding C1_differentiable_on_eq
[PROOF STATE]
proof (prove)
using this:
t \<in> {0..1} - spikes
(\<forall>x\<in>{0..1} - spikes. \<gamma> differentiable at x) \<and> continuous_on ({0..1} - spikes) (\<lambda>x. vector_derivative \<gamma> (at x))

goal (1 subgoal):
 1. \<gamma> differentiable at t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<gamma> differentiable at t

goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} - spikes \<Longrightarrow> deriv f (\<gamma> x) / (f (\<gamma> x) - z) * vector_derivative \<gamma> (at x) = 1 / ((f \<circ> \<gamma>) x - z) * vector_derivative (f \<circ> \<gamma>) (at x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<gamma> differentiable at t

goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} - spikes \<Longrightarrow> deriv f (\<gamma> x) / (f (\<gamma> x) - z) * vector_derivative \<gamma> (at x) = 1 / ((f \<circ> \<gamma>) x - z) * vector_derivative (f \<circ> \<gamma>) (at x)
[PROOF STEP]
have "f field_differentiable at (\<gamma> t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f field_differentiable at (\<gamma> t)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f field_differentiable at (\<gamma> t)
[PROOF STEP]
have "\<gamma> t \<in> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<gamma> t \<in> s
[PROOF STEP]
using \<open>path_image \<gamma> \<subseteq> s\<close> t
[PROOF STATE]
proof (prove)
using this:
path_image \<gamma> \<subseteq> s
t \<in> {0..1} - spikes

goal (1 subgoal):
 1. \<gamma> t \<in> s
[PROOF STEP]
unfolding path_image_def
[PROOF STATE]
proof (prove)
using this:
\<gamma> ` {0..1} \<subseteq> s
t \<in> {0..1} - spikes

goal (1 subgoal):
 1. \<gamma> t \<in> s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<gamma> t \<in> s

goal (1 subgoal):
 1. f field_differentiable at (\<gamma> t)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<gamma> t \<in> s

goal (1 subgoal):
 1. f field_differentiable at (\<gamma> t)
[PROOF STEP]
using \<open>open s\<close> \<open>f holomorphic_on s\<close>  holomorphic_on_imp_differentiable_at
[PROOF STATE]
proof (prove)
using this:
\<gamma> t \<in> s
open s
f holomorphic_on s
\<lbrakk>?f holomorphic_on ?s; open ?s; ?x \<in> ?s\<rbrakk> \<Longrightarrow> ?f field_differentiable at ?x

goal (1 subgoal):
 1. f field_differentiable at (\<gamma> t)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f field_differentiable at (\<gamma> t)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f field_differentiable at (\<gamma> t)

goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} - spikes \<Longrightarrow> deriv f (\<gamma> x) / (f (\<gamma> x) - z) * vector_derivative \<gamma> (at x) = 1 / ((f \<circ> \<gamma>) x - z) * vector_derivative (f \<circ> \<gamma>) (at x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<gamma> differentiable at t
f field_differentiable at (\<gamma> t)
[PROOF STEP]
show " deriv f (\<gamma> t) / (f (\<gamma> t) - z) * vector_derivative \<gamma> (at t) =
         1 / ((f \<circ> \<gamma>) t - z) * vector_derivative (f \<circ> \<gamma>) (at t)"
[PROOF STATE]
proof (prove)
using this:
\<gamma> differentiable at t
f field_differentiable at (\<gamma> t)

goal (1 subgoal):
 1. deriv f (\<gamma> t) / (f (\<gamma> t) - z) * vector_derivative \<gamma> (at t) = 1 / ((f \<circ> \<gamma>) t - z) * vector_derivative (f \<circ> \<gamma>) (at t)
[PROOF STEP]
apply (subst vector_derivative_chain_at_general)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>\<gamma> differentiable at t; f field_differentiable at (\<gamma> t)\<rbrakk> \<Longrightarrow> \<gamma> differentiable at t
 2. \<lbrakk>\<gamma> differentiable at t; f field_differentiable at (\<gamma> t)\<rbrakk> \<Longrightarrow> f field_differentiable at (\<gamma> t)
 3. \<lbrakk>\<gamma> differentiable at t; f field_differentiable at (\<gamma> t)\<rbrakk> \<Longrightarrow> deriv f (\<gamma> t) / (f (\<gamma> t) - z) * vector_derivative \<gamma> (at t) = 1 / ((f \<circ> \<gamma>) t - z) * (vector_derivative \<gamma> (at t) * deriv f (\<gamma> t))
[PROOF STEP]
by (simp_all add:field_simps)
[PROOF STATE]
proof (state)
this:
deriv f (\<gamma> t) / (f (\<gamma> t) - z) * vector_derivative \<gamma> (at t) = 1 / ((f \<circ> \<gamma>) t - z) * vector_derivative (f \<circ> \<gamma>) (at t)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
contour_integral (f \<circ> \<gamma>) (\<lambda>w. 1 / (w - z)) = contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))

goal (1 subgoal):
 1. winding_number (f \<circ> \<gamma>) z = 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
contour_integral (f \<circ> \<gamma>) (\<lambda>w. 1 / (w - z)) = contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))

goal (1 subgoal):
 1. winding_number (f \<circ> \<gamma>) z = 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
[PROOF STEP]
note \<open>z \<notin> path_image (f \<circ> \<gamma>)\<close>
[PROOF STATE]
proof (state)
this:
z \<notin> path_image (f \<circ> \<gamma>)

goal (1 subgoal):
 1. winding_number (f \<circ> \<gamma>) z = 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
valid_path (f \<circ> \<gamma>)
contour_integral (f \<circ> \<gamma>) (\<lambda>w. 1 / (w - z)) = contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
z \<notin> path_image (f \<circ> \<gamma>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
valid_path (f \<circ> \<gamma>)
contour_integral (f \<circ> \<gamma>) (\<lambda>w. 1 / (w - z)) = contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
z \<notin> path_image (f \<circ> \<gamma>)

goal (1 subgoal):
 1. winding_number (f \<circ> \<gamma>) z = 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
[PROOF STEP]
apply (subst winding_number_valid_path)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>valid_path (f \<circ> \<gamma>); contour_integral (f \<circ> \<gamma>) (\<lambda>w. 1 / (w - z)) = contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)); z \<notin> path_image (f \<circ> \<gamma>)\<rbrakk> \<Longrightarrow> valid_path (f \<circ> \<gamma>)
 2. \<lbrakk>valid_path (f \<circ> \<gamma>); contour_integral (f \<circ> \<gamma>) (\<lambda>w. 1 / (w - z)) = contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)); z \<notin> path_image (f \<circ> \<gamma>)\<rbrakk> \<Longrightarrow> z \<notin> path_image (f \<circ> \<gamma>)
 3. \<lbrakk>valid_path (f \<circ> \<gamma>); contour_integral (f \<circ> \<gamma>) (\<lambda>w. 1 / (w - z)) = contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z)); z \<notin> path_image (f \<circ> \<gamma>)\<rbrakk> \<Longrightarrow> 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral (f \<circ> \<gamma>) (\<lambda>w. 1 / (w - z)) = 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
winding_number (f \<circ> \<gamma>) z = 1 / (complex_of_real (2 * pi) * \<i>) * contour_integral \<gamma> (\<lambda>w. deriv f w / (f w - z))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma transpose_of_unitary_is_unitary [simp]:
  assumes "unitary U"
  shows "unitary (U\<^sup>t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary U\<^sup>t
[PROOF STEP]
using unitary_def assms left_inv_of_unitary_transpose right_inv_of_unitary_transpose
[PROOF STATE]
proof (prove)
using this:
unitary ?M \<equiv> ?M\<^sup>\<dagger> * ?M = 1\<^sub>m (dim_col ?M) \<and> ?M * ?M\<^sup>\<dagger> = 1\<^sub>m (dim_row ?M)
unitary U
unitary ?U \<Longrightarrow> ?U\<^sup>t\<^sup>\<dagger> * ?U\<^sup>t = 1\<^sub>m (dim_row ?U)
unitary ?U \<Longrightarrow> ?U\<^sup>t * ?U\<^sup>t\<^sup>\<dagger> = 1\<^sub>m (dim_col ?U)

goal (1 subgoal):
 1. unitary U\<^sup>t
[PROOF STEP]
by simp


[STATEMENT]
lemma det_col_minus: "det (upd_col M i (a - b)) = det (upd_col M i a) - det (upd_col M i b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Square_Matrix.det (upd_col M i (a - b)) = Square_Matrix.det (upd_col M i a) - Square_Matrix.det (upd_col M i b)
[PROOF STEP]
unfolding diff_conv_add_uminus det_col_add det_col_uminus
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Square_Matrix.det (upd_col M i a) + - Square_Matrix.det (upd_col M i b) = Square_Matrix.det (upd_col M i a) + - Square_Matrix.det (upd_col M i b)
[PROOF STEP]
..


[STATEMENT]
lemma lm092:
  assumes "\<forall>x \<in> set L. set (F x) = G x"
  shows "set (concat [ F x . x <- L]) = (\<Union> x\<in>set L. G x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (concat (map F L)) = \<Union> (G ` set L)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set L. set (F x) = G x

goal (1 subgoal):
 1. set (concat (map F L)) = \<Union> (G ` set L)
[PROOF STEP]
by force


[STATEMENT]
lemma isCont_real_sqrt: "isCont sqrt x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont sqrt x
[PROOF STEP]
unfolding sqrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont (root 2) x
[PROOF STEP]
by (rule isCont_real_root)


[STATEMENT]
lemma PiE_over_singleton_iff: "(\<Pi>\<^sub>E x\<in>{a}. B x) = (\<Union>b \<in> B a. {\<lambda>x \<in> {a}. b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pi\<^sub>E {a} B = (\<Union>b\<in>B a. {\<lambda>x\<in>{a}. b})
[PROOF STEP]
apply (auto simp: PiE_iff split: if_split_asm)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x a \<in> B a; x \<in> extensional {a}\<rbrakk> \<Longrightarrow> \<exists>xa\<in>B a. x = (\<lambda>x\<in>{a}. xa)
[PROOF STEP]
apply (metis (no_types, lifting) extensionalityI restrict_apply' restrict_extensional singletonD)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem coprime_pairs_asymptotics'':
  "(\<lambda>N. real (card (A N))) \<sim>[at_top] (\<lambda>N. 6 / pi\<^sup>2 * (real N)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>N. real (card (A N))) \<sim>[sequentially] (\<lambda>N. 6 / pi\<^sup>2 * (real N)\<^sup>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>N. real (card (A N))) \<sim>[sequentially] (\<lambda>N. 6 / pi\<^sup>2 * (real N)\<^sup>2)
[PROOF STEP]
have "(\<lambda>N. real (card (A N)) - 6 / pi\<^sup>2 * (real N) ^ 2) \<in> O(\<lambda>N. real N * ln (real N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>N. real (card (A N)) - 6 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))
[PROOF STEP]
by (rule coprime_pairs_asymptotics)
[PROOF STATE]
proof (state)
this:
(\<lambda>N. real (card (A N)) - 6 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))

goal (1 subgoal):
 1. (\<lambda>N. real (card (A N))) \<sim>[sequentially] (\<lambda>N. 6 / pi\<^sup>2 * (real N)\<^sup>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>N. real (card (A N)) - 6 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))

goal (1 subgoal):
 1. (\<lambda>N. real (card (A N))) \<sim>[sequentially] (\<lambda>N. 6 / pi\<^sup>2 * (real N)\<^sup>2)
[PROOF STEP]
have "(\<lambda>N. real N * ln (real N)) \<in> o(\<lambda>N. 6 / pi ^ 2 * real N ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>N. real N * ln (real N)) \<in> o(\<lambda>N. 6 / pi\<^sup>2 * (real N)\<^sup>2)
[PROOF STEP]
by (rule landau_o.small.compose[OF _ filterlim_real_sequentially]) simp
[PROOF STATE]
proof (state)
this:
(\<lambda>N. real N * ln (real N)) \<in> o(\<lambda>N. 6 / pi\<^sup>2 * (real N)\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>N. real (card (A N))) \<sim>[sequentially] (\<lambda>N. 6 / pi\<^sup>2 * (real N)\<^sup>2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>N. real (card (A N)) - 6 / pi\<^sup>2 * (real N)\<^sup>2) \<in> o(\<lambda>N. 6 / pi\<^sup>2 * (real N)\<^sup>2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>N. real (card (A N)) - 6 / pi\<^sup>2 * (real N)\<^sup>2) \<in> o(\<lambda>N. 6 / pi\<^sup>2 * (real N)\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>N. real (card (A N))) \<sim>[sequentially] (\<lambda>N. 6 / pi\<^sup>2 * (real N)\<^sup>2)
[PROOF STEP]
by (simp add: asymp_equiv_altdef)
[PROOF STATE]
proof (state)
this:
(\<lambda>N. real (card (A N))) \<sim>[sequentially] (\<lambda>N. 6 / pi\<^sup>2 * (real N)\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma invertible_eq_full_rank[code_unfold]:
fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}"
shows "invertible A = (rank A = nrows A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible A = (rank A = nrows A)
[PROOF STEP]
by (metis full_rank_implies_invertible invertible_implies_full_rank)


[STATEMENT]
lemma has_integral_stretch_real:
  fixes f :: "real \<Rightarrow> 'b::real_normed_vector"
  assumes "(f has_integral i) {a..b}" and "m \<noteq> 0"
  shows "((\<lambda>x. f (m * x)) has_integral (1 / \<bar>m\<bar>) *\<^sub>R i) ((\<lambda>x. x / m) ` {a..b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (m * x)) has_integral (1 / \<bar>m\<bar>) *\<^sub>R i) ((\<lambda>x. x / m) ` {a..b})
[PROOF STEP]
using has_integral_stretch [of f i a b "\<lambda>b. m"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(f has_integral i) (cbox a b); \<forall>k\<in>Basis. m \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. f (\<Sum>k\<in>Basis. (m * (x \<bullet> k)) *\<^sub>R k)) has_integral (1 / \<bar>\<Prod>b\<in>Basis. m\<bar>) *\<^sub>R i) ((\<lambda>x. \<Sum>k\<in>Basis. (1 / m * (x \<bullet> k)) *\<^sub>R k) ` cbox a b)
(f has_integral i) {a..b}
m \<noteq> 0

goal (1 subgoal):
 1. ((\<lambda>x. f (m * x)) has_integral (1 / \<bar>m\<bar>) *\<^sub>R i) ((\<lambda>x. x / m) ` {a..b})
[PROOF STEP]
by simp


[STATEMENT]
lemma isDiagonal_diagonal_to_Smith_aux_general:
  assumes elements_xs_range: "\<forall>x. x \<in> set xs \<longrightarrow> x<min (nrows A) (ncols A)"
  and "isDiagonal A"
shows "isDiagonal (diagonal_to_Smith_aux A xs bezout)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isDiagonal (diagonal_to_Smith_aux A xs bezout)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows A) (ncols A)
isDiagonal A

goal (1 subgoal):
 1. isDiagonal (diagonal_to_Smith_aux A xs bezout)
[PROOF STEP]
proof (induct A xs bezout rule: diagonal_to_Smith_aux.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A bezout. \<lbrakk>\<forall>x. x \<in> set [] \<longrightarrow> x < min (nrows A) (ncols A); isDiagonal A\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux A [] bezout)
 2. \<And>A i xs bezout. \<lbrakk>\<lbrakk>\<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows (Diagonal_to_Smith_row_i A i bezout)) (ncols (Diagonal_to_Smith_row_i A i bezout)); isDiagonal (Diagonal_to_Smith_row_i A i bezout)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout); \<forall>x. x \<in> set (i # xs) \<longrightarrow> x < min (nrows A) (ncols A); isDiagonal A\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux A (i # xs) bezout)
[PROOF STEP]
case (1 A)
[PROOF STATE]
proof (state)
this:
\<forall>x. x \<in> set [] \<longrightarrow> x < min (nrows A) (ncols A)
isDiagonal A

goal (2 subgoals):
 1. \<And>A bezout. \<lbrakk>\<forall>x. x \<in> set [] \<longrightarrow> x < min (nrows A) (ncols A); isDiagonal A\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux A [] bezout)
 2. \<And>A i xs bezout. \<lbrakk>\<lbrakk>\<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows (Diagonal_to_Smith_row_i A i bezout)) (ncols (Diagonal_to_Smith_row_i A i bezout)); isDiagonal (Diagonal_to_Smith_row_i A i bezout)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout); \<forall>x. x \<in> set (i # xs) \<longrightarrow> x < min (nrows A) (ncols A); isDiagonal A\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux A (i # xs) bezout)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. x \<in> set [] \<longrightarrow> x < min (nrows A) (ncols A)
isDiagonal A
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x \<in> set [] \<longrightarrow> x < min (nrows A) (ncols A)
isDiagonal A

goal (1 subgoal):
 1. isDiagonal (diagonal_to_Smith_aux A [] bezout_)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
isDiagonal (diagonal_to_Smith_aux A [] bezout_)

goal (1 subgoal):
 1. \<And>A i xs bezout. \<lbrakk>\<lbrakk>\<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows (Diagonal_to_Smith_row_i A i bezout)) (ncols (Diagonal_to_Smith_row_i A i bezout)); isDiagonal (Diagonal_to_Smith_row_i A i bezout)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout); \<forall>x. x \<in> set (i # xs) \<longrightarrow> x < min (nrows A) (ncols A); isDiagonal A\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux A (i # xs) bezout)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A i xs bezout. \<lbrakk>\<lbrakk>\<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows (Diagonal_to_Smith_row_i A i bezout)) (ncols (Diagonal_to_Smith_row_i A i bezout)); isDiagonal (Diagonal_to_Smith_row_i A i bezout)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout); \<forall>x. x \<in> set (i # xs) \<longrightarrow> x < min (nrows A) (ncols A); isDiagonal A\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux A (i # xs) bezout)
[PROOF STEP]
case (2 A i xs bezout)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows (Diagonal_to_Smith_row_i A i bezout)) (ncols (Diagonal_to_Smith_row_i A i bezout)); isDiagonal (Diagonal_to_Smith_row_i A i bezout)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout)
\<forall>x. x \<in> set (i # xs) \<longrightarrow> x < min (nrows A) (ncols A)
isDiagonal A

goal (1 subgoal):
 1. \<And>A i xs bezout. \<lbrakk>\<lbrakk>\<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows (Diagonal_to_Smith_row_i A i bezout)) (ncols (Diagonal_to_Smith_row_i A i bezout)); isDiagonal (Diagonal_to_Smith_row_i A i bezout)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout); \<forall>x. x \<in> set (i # xs) \<longrightarrow> x < min (nrows A) (ncols A); isDiagonal A\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux A (i # xs) bezout)
[PROOF STEP]
note k = "2.prems"(1)
[PROOF STATE]
proof (state)
this:
\<forall>x. x \<in> set (i # xs) \<longrightarrow> x < min (nrows A) (ncols A)

goal (1 subgoal):
 1. \<And>A i xs bezout. \<lbrakk>\<lbrakk>\<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows (Diagonal_to_Smith_row_i A i bezout)) (ncols (Diagonal_to_Smith_row_i A i bezout)); isDiagonal (Diagonal_to_Smith_row_i A i bezout)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout); \<forall>x. x \<in> set (i # xs) \<longrightarrow> x < min (nrows A) (ncols A); isDiagonal A\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux A (i # xs) bezout)
[PROOF STEP]
note elements_xs_range = "2.prems"(2)
[PROOF STATE]
proof (state)
this:
isDiagonal A

goal (1 subgoal):
 1. \<And>A i xs bezout. \<lbrakk>\<lbrakk>\<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows (Diagonal_to_Smith_row_i A i bezout)) (ncols (Diagonal_to_Smith_row_i A i bezout)); isDiagonal (Diagonal_to_Smith_row_i A i bezout)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout); \<forall>x. x \<in> set (i # xs) \<longrightarrow> x < min (nrows A) (ncols A); isDiagonal A\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux A (i # xs) bezout)
[PROOF STEP]
have "diagonal_to_Smith_aux A (i # xs) bezout
  = diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diagonal_to_Smith_aux A (i # xs) bezout = diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
diagonal_to_Smith_aux A (i # xs) bezout = diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout

goal (1 subgoal):
 1. \<And>A i xs bezout. \<lbrakk>\<lbrakk>\<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows (Diagonal_to_Smith_row_i A i bezout)) (ncols (Diagonal_to_Smith_row_i A i bezout)); isDiagonal (Diagonal_to_Smith_row_i A i bezout)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout); \<forall>x. x \<in> set (i # xs) \<longrightarrow> x < min (nrows A) (ncols A); isDiagonal A\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux A (i # xs) bezout)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
diagonal_to_Smith_aux A (i # xs) bezout = diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout

goal (1 subgoal):
 1. \<And>A i xs bezout. \<lbrakk>\<lbrakk>\<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows (Diagonal_to_Smith_row_i A i bezout)) (ncols (Diagonal_to_Smith_row_i A i bezout)); isDiagonal (Diagonal_to_Smith_row_i A i bezout)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout); \<forall>x. x \<in> set (i # xs) \<longrightarrow> x < min (nrows A) (ncols A); isDiagonal A\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux A (i # xs) bezout)
[PROOF STEP]
have "isDiagonal (...)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isDiagonal (diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout)
[PROOF STEP]
by (rule "2.hyps", insert isDiagonal_Diagonal_to_Smith_row_i "2.prems" k, auto)
[PROOF STATE]
proof (state)
this:
isDiagonal (diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout)

goal (1 subgoal):
 1. \<And>A i xs bezout. \<lbrakk>\<lbrakk>\<forall>x. x \<in> set xs \<longrightarrow> x < min (nrows (Diagonal_to_Smith_row_i A i bezout)) (ncols (Diagonal_to_Smith_row_i A i bezout)); isDiagonal (Diagonal_to_Smith_row_i A i bezout)\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux (Diagonal_to_Smith_row_i A i bezout) xs bezout); \<forall>x. x \<in> set (i # xs) \<longrightarrow> x < min (nrows A) (ncols A); isDiagonal A\<rbrakk> \<Longrightarrow> isDiagonal (diagonal_to_Smith_aux A (i # xs) bezout)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
isDiagonal (diagonal_to_Smith_aux A (i # xs) bezout)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
isDiagonal (diagonal_to_Smith_aux A (i # xs) bezout)

goal (1 subgoal):
 1. isDiagonal (diagonal_to_Smith_aux A (i # xs) bezout)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
isDiagonal (diagonal_to_Smith_aux A (i # xs) bezout)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma jordan_nf_char_poly: assumes "jordan_nf A n_as"
  shows "char_poly A = (\<Prod> (n,a) \<leftarrow> n_as. [:- a, 1:] ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_poly A = (\<Prod>(n, a)\<leftarrow>n_as. [:- a, 1::'a:] ^ n)
[PROOF STEP]
unfolding jordan_matrix_char_poly[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_poly A = char_poly (jordan_matrix n_as)
[PROOF STEP]
by (rule char_poly_similar, insert assms[unfolded jordan_nf_def], auto)


[STATEMENT]
lemma unique_default_example2: "succ_tran \<lparr>nodes = {vertex_1, vertex_2}, edges = {(vertex_2, vertex_1)}\<rparr> vertex_1 = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. succ_tran \<lparr>nodes = {vertex_1, vertex_2}, edges = {(vertex_2, vertex_1)}\<rparr> vertex_1 = {}
[PROOF STEP]
apply (simp add: succ_tran_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. (vertex_1, x) \<notin> {(vertex_2, vertex_1)}\<^sup>+
[PROOF STEP]
by (metis Domain.DomainI Domain_empty Domain_insert distinct_vertices12 singleton_iff trancl_domain)


[STATEMENT]
lemma stable_natLeq: "stable natLeq"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stable natLeq
[PROOF STEP]
proof(unfold stable_def, safe)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A F. \<lbrakk>|A| <o natLeq; \<forall>a\<in>A. |F a| <o natLeq\<rbrakk> \<Longrightarrow> |Sigma A F| <o natLeq
[PROOF STEP]
fix A :: "'a set" and F :: "'a \<Rightarrow> 'a set"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A F. \<lbrakk>|A| <o natLeq; \<forall>a\<in>A. |F a| <o natLeq\<rbrakk> \<Longrightarrow> |Sigma A F| <o natLeq
[PROOF STEP]
assume "|A| <o natLeq" and "\<forall>a\<in>A. |F a| <o natLeq"
[PROOF STATE]
proof (state)
this:
|A| <o natLeq
\<forall>a\<in>A. |F a| <o natLeq

goal (1 subgoal):
 1. \<And>A F. \<lbrakk>|A| <o natLeq; \<forall>a\<in>A. |F a| <o natLeq\<rbrakk> \<Longrightarrow> |Sigma A F| <o natLeq
[PROOF STEP]
hence "finite A \<and> (\<forall>a \<in> A. finite(F a))"
[PROOF STATE]
proof (prove)
using this:
|A| <o natLeq
\<forall>a\<in>A. |F a| <o natLeq

goal (1 subgoal):
 1. finite A \<and> (\<forall>a\<in>A. finite (F a))
[PROOF STEP]
by (auto simp add: finite_iff_ordLess_natLeq)
[PROOF STATE]
proof (state)
this:
finite A \<and> (\<forall>a\<in>A. finite (F a))

goal (1 subgoal):
 1. \<And>A F. \<lbrakk>|A| <o natLeq; \<forall>a\<in>A. |F a| <o natLeq\<rbrakk> \<Longrightarrow> |Sigma A F| <o natLeq
[PROOF STEP]
hence "finite(Sigma A F)"
[PROOF STATE]
proof (prove)
using this:
finite A \<and> (\<forall>a\<in>A. finite (F a))

goal (1 subgoal):
 1. finite (Sigma A F)
[PROOF STEP]
by (simp only: finite_SigmaI[of A F])
[PROOF STATE]
proof (state)
this:
finite (Sigma A F)

goal (1 subgoal):
 1. \<And>A F. \<lbrakk>|A| <o natLeq; \<forall>a\<in>A. |F a| <o natLeq\<rbrakk> \<Longrightarrow> |Sigma A F| <o natLeq
[PROOF STEP]
thus "|Sigma A F | <o natLeq"
[PROOF STATE]
proof (prove)
using this:
finite (Sigma A F)

goal (1 subgoal):
 1. |Sigma A F| <o natLeq
[PROOF STEP]
by (auto simp add: finite_iff_ordLess_natLeq)
[PROOF STATE]
proof (state)
this:
|Sigma A F| <o natLeq

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in linordered_nonzero_semiring) prod_mono3:
  assumes "finite J" "I \<subseteq> J" "\<And>i. i \<in> J \<Longrightarrow> 0 \<le> g i" "\<And>i. i \<in> I \<Longrightarrow> g i \<le> f i" "(\<And>i. i \<in> J - I \<Longrightarrow> g i \<le> 1)"
  shows "prod g J \<le> prod f I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod g J \<le> prod f I
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prod g J \<le> prod f I
[PROOF STEP]
have "prod g J \<le> (\<Prod>i\<in>J. if i \<in> I then f i else 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod g J \<le> (\<Prod>i\<in>J. if i \<in> I then f i else (1::'a))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite J
I \<subseteq> J
?i1 \<in> J \<Longrightarrow> (0::'a) \<le> g ?i1
?i1 \<in> I \<Longrightarrow> g ?i1 \<le> f ?i1
?i1 \<in> J - I \<Longrightarrow> g ?i1 \<le> (1::'a)

goal (1 subgoal):
 1. prod g J \<le> (\<Prod>i\<in>J. if i \<in> I then f i else (1::'a))
[PROOF STEP]
by (intro prod_mono) auto
[PROOF STATE]
proof (state)
this:
prod g J \<le> (\<Prod>i\<in>J. if i \<in> I then f i else (1::'a))

goal (1 subgoal):
 1. prod g J \<le> prod f I
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod g J \<le> (\<Prod>i\<in>J. if i \<in> I then f i else (1::'a))

goal (1 subgoal):
 1. prod g J \<le> prod f I
[PROOF STEP]
have "\<dots> = prod f I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i\<in>J. if i \<in> I then f i else (1::'a)) = prod f I
[PROOF STEP]
using \<open>finite J\<close> \<open>I \<subseteq> J\<close>
[PROOF STATE]
proof (prove)
using this:
finite J
I \<subseteq> J

goal (1 subgoal):
 1. (\<Prod>i\<in>J. if i \<in> I then f i else (1::'a)) = prod f I
[PROOF STEP]
by (simp add: prod.If_cases Int_absorb1)
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<in>J. if i \<in> I then f i else (1::'a)) = prod f I

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

goal (1 subgoal):
 1. prod g J \<le> prod f I
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
prod g J \<le> prod f I

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma winding_number_ivt_neg:
    assumes \<gamma>: "valid_path \<gamma>" and z: "z \<notin> path_image \<gamma>" and "Re(winding_number \<gamma> z) \<le> w" "w \<le> 0"
      shows "\<exists>t \<in> {0..1}. Re(winding_number(subpath 0 t \<gamma>) z) = w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w
[PROOF STEP]
have "continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x \<gamma>) z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x \<gamma>) z)
[PROOF STEP]
using \<gamma> winding_number_subpath_continuous z
[PROOF STATE]
proof (prove)
using this:
valid_path \<gamma>
\<lbrakk>valid_path ?\<gamma>; ?z \<notin> path_image ?\<gamma>\<rbrakk> \<Longrightarrow> continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x ?\<gamma>) ?z)
z \<notin> path_image \<gamma>

goal (1 subgoal):
 1. continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x \<gamma>) z)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x \<gamma>) z)

goal (1 subgoal):
 1. \<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x \<gamma>) z)

goal (1 subgoal):
 1. \<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w
[PROOF STEP]
have "Re (winding_number (subpath 0 0 \<gamma>) z) \<ge> w" "w \<ge> Re (winding_number (subpath 0 1 \<gamma>) z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<le> Re (winding_number (subpath 0 0 \<gamma>) z) &&& Re (winding_number (subpath 0 1 \<gamma>) z) \<le> w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
valid_path \<gamma>
z \<notin> path_image \<gamma>
Re (winding_number \<gamma> z) \<le> w
w \<le> 0

goal (1 subgoal):
 1. w \<le> Re (winding_number (subpath 0 0 \<gamma>) z) &&& Re (winding_number (subpath 0 1 \<gamma>) z) \<le> w
[PROOF STEP]
by (auto simp: path_image_def image_def)
[PROOF STATE]
proof (state)
this:
w \<le> Re (winding_number (subpath 0 0 \<gamma>) z)
Re (winding_number (subpath 0 1 \<gamma>) z) \<le> w

goal (1 subgoal):
 1. \<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x \<gamma>) z)
w \<le> Re (winding_number (subpath 0 0 \<gamma>) z)
Re (winding_number (subpath 0 1 \<gamma>) z) \<le> w
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x \<gamma>) z)
w \<le> Re (winding_number (subpath 0 0 \<gamma>) z)
Re (winding_number (subpath 0 1 \<gamma>) z) \<le> w

goal (1 subgoal):
 1. \<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w
[PROOF STEP]
using ivt_decreasing_component_on_1[of 0 1, where ?k = "1"]
[PROOF STATE]
proof (prove)
using this:
continuous_on {0..1} (\<lambda>x. winding_number (subpath 0 x \<gamma>) z)
w \<le> Re (winding_number (subpath 0 0 \<gamma>) z)
Re (winding_number (subpath 0 1 \<gamma>) z) \<le> w
\<lbrakk>0 \<le> 1; continuous_on {0..1} ?f; ?f 1 \<bullet> (1::?'a1) \<le> ?y; ?y \<le> ?f 0 \<bullet> (1::?'a1)\<rbrakk> \<Longrightarrow> \<exists>x\<in>{0..1}. ?f x \<bullet> (1::?'a1) = ?y

goal (1 subgoal):
 1. \<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem powerset_enum_distinct: "distinct xs \<Longrightarrow> distinct (powerset_enum xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct xs \<Longrightarrow> distinct (powerset_enum xs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distinct xs \<Longrightarrow> distinct (powerset_enum xs)
[PROOF STEP]
assume dis: "distinct xs"
[PROOF STATE]
proof (state)
this:
distinct xs

goal (1 subgoal):
 1. distinct xs \<Longrightarrow> distinct (powerset_enum xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distinct xs
[PROOF STEP]
have " distinct (map (\<lambda>x. filter_bool_list x xs) (all_bool_lists (length xs)))"
[PROOF STATE]
proof (prove)
using this:
distinct xs

goal (1 subgoal):
 1. distinct (map (\<lambda>x. filter_bool_list x xs) (all_bool_lists (length xs)))
[PROOF STEP]
using distinct_map filter_bool_list_inj distinct_all_bool_lists
[PROOF STATE]
proof (prove)
using this:
distinct xs
distinct (map ?f ?xs) = (distinct ?xs \<and> inj_on ?f (set ?xs))
distinct ?xs \<Longrightarrow> inj_on (\<lambda>bs. filter_bool_list bs ?xs) {bs. length bs = length ?xs}
distinct (all_bool_lists ?x)

goal (1 subgoal):
 1. distinct (map (\<lambda>x. filter_bool_list x xs) (all_bool_lists (length xs)))
[PROOF STEP]
by (metis all_bool_lists_correct)
[PROOF STATE]
proof (state)
this:
distinct (map (\<lambda>x. filter_bool_list x xs) (all_bool_lists (length xs)))

goal (1 subgoal):
 1. distinct xs \<Longrightarrow> distinct (powerset_enum xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distinct (map (\<lambda>x. filter_bool_list x xs) (all_bool_lists (length xs)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
distinct (map (\<lambda>x. filter_bool_list x xs) (all_bool_lists (length xs)))

goal (1 subgoal):
 1. distinct (powerset_enum xs)
[PROOF STEP]
using dis
[PROOF STATE]
proof (prove)
using this:
distinct (map (\<lambda>x. filter_bool_list x xs) (all_bool_lists (length xs)))
distinct xs

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem double_orthogonal_complement_id[simp]:
  fixes M :: \<open>'a::chilbert_space set\<close>
  assumes a1: "closed_csubspace M"
  shows "orthogonal_complement (orthogonal_complement M) = M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement M) = M
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement M) = M
[PROOF STEP]
have b2: "x \<in> (id - projection M) -` {0}"
    if c1: "x \<in> M" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> (id - projection M) -` {0::'a}
[PROOF STEP]
by (simp add: assms projection_fixes_image that)
[PROOF STATE]
proof (state)
this:
?x \<in> M \<Longrightarrow> ?x \<in> (id - projection M) -` {0::'a}

goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement M) = M
[PROOF STEP]
have b3: \<open>x \<in> M\<close>
    if c1: \<open>x \<in> (id - projection M) -` {0}\<close> for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> M
[PROOF STEP]
by (metis assms closed_csubspace.closed closed_csubspace.subspace complex_vector.subspace_0 csubspace_is_convex eq_id_iff equals0D fun_diff_def projection_in_image right_minus_eq that vimage_singleton_eq)
[PROOF STATE]
proof (state)
this:
?x \<in> (id - projection M) -` {0::'a} \<Longrightarrow> ?x \<in> M

goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement M) = M
[PROOF STEP]
have \<open>x \<in>  M \<longleftrightarrow> x \<in> (id - projection M) -` {0}\<close> for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> M) = (x \<in> (id - projection M) -` {0::'a})
[PROOF STEP]
using b2 b3
[PROOF STATE]
proof (prove)
using this:
?x \<in> M \<Longrightarrow> ?x \<in> (id - projection M) -` {0::'a}
?x \<in> (id - projection M) -` {0::'a} \<Longrightarrow> ?x \<in> M

goal (1 subgoal):
 1. (x \<in> M) = (x \<in> (id - projection M) -` {0::'a})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(?x \<in> M) = (?x \<in> (id - projection M) -` {0::'a})

goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement M) = M
[PROOF STEP]
hence b4: \<open>( id - (projection M) ) -` {0} =  M\<close>
[PROOF STATE]
proof (prove)
using this:
(?x \<in> M) = (?x \<in> (id - projection M) -` {0::'a})

goal (1 subgoal):
 1. (id - projection M) -` {0::'a} = M
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(id - projection M) -` {0::'a} = M

goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement M) = M
[PROOF STEP]
have b1: "orthogonal_complement (orthogonal_complement M)
          = (projection (orthogonal_complement M)) -` {0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement M) = projection (orthogonal_complement M) -` {0::'a}
[PROOF STEP]
by (simp add: a1 projection_kernel_is_orthogonal_complement del: projection_on_orthogonal_complement)
[PROOF STATE]
proof (state)
this:
orthogonal_complement (orthogonal_complement M) = projection (orthogonal_complement M) -` {0::'a}

goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement M) = M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
orthogonal_complement (orthogonal_complement M) = projection (orthogonal_complement M) -` {0::'a}

goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement M) = M
[PROOF STEP]
have \<open>... = ( id - (projection M) ) -` {0}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. projection (orthogonal_complement M) -` {0::'a} = (id - projection M) -` {0::'a}
[PROOF STEP]
by (simp add: a1)
[PROOF STATE]
proof (state)
this:
projection (orthogonal_complement M) -` {0::'a} = (id - projection M) -` {0::'a}

goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement M) = M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
projection (orthogonal_complement M) -` {0::'a} = (id - projection M) -` {0::'a}

goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement M) = M
[PROOF STEP]
have \<open>... = M\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (id - projection M) -` {0::'a} = M
[PROOF STEP]
by (simp add: b4)
[PROOF STATE]
proof (state)
this:
(id - projection M) -` {0::'a} = M

goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement M) = M
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
orthogonal_complement (orthogonal_complement M) = M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
orthogonal_complement (orthogonal_complement M) = M

goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement M) = M
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
orthogonal_complement (orthogonal_complement M) = M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in BinOpSetGroup) lift_hom:
  fixes T :: "'a \<Rightarrow> 'b::group_add"
  assumes "\<forall>g\<in>G. \<forall>h\<in>G. T (binop g h) = T g + T h"
  shows   "GroupHom pG (lift_hom T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. GroupHom pG (lift_hom T)
[PROOF STEP]
proof (intro_locales, rule Group, unfold_locales)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>g g'. \<lbrakk>g \<in> pG; g' \<in> pG\<rbrakk> \<Longrightarrow> lift_hom T (g + g') = lift_hom T g + lift_hom T g'
 2. supp (lift_hom T) \<subseteq> pG
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<forall>g\<in>G. \<forall>h\<in>G. T (binop g h) = T g + T h
[PROOF STEP]
show  "\<And>x y. x\<in>pG \<Longrightarrow> y\<in>pG \<Longrightarrow>
            lift_hom T (x+y) = lift_hom T x + lift_hom T y"
[PROOF STATE]
proof (prove)
using this:
\<forall>g\<in>G. \<forall>h\<in>G. T (binop g h) = T g + T h

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> pG; y \<in> pG\<rbrakk> \<Longrightarrow> lift_hom T (x + y) = lift_hom T x + lift_hom T y
[PROOF STEP]
using Group.add_closed[OF Group] inv_correspondence_into
[PROOF STATE]
proof (prove)
using this:
\<forall>g\<in>G. \<forall>h\<in>G. T (binop g h) = T g + T h
\<lbrakk>?g \<in> pG; ?h \<in> pG\<rbrakk> \<Longrightarrow> ?g + ?h \<in> pG
?x \<in> pG \<Longrightarrow> \<ii>\<pp> ?x \<in> G

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> pG; y \<in> pG\<rbrakk> \<Longrightarrow> lift_hom T (x + y) = lift_hom T x + lift_hom T y
[PROOF STEP]
by    (simp add: homs(2)[THEN sym])
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x1 \<in> pG; ?y1 \<in> pG\<rbrakk> \<Longrightarrow> lift_hom T (?x1 + ?y1) = lift_hom T ?x1 + lift_hom T ?y1

goal (1 subgoal):
 1. supp (lift_hom T) \<subseteq> pG
[PROOF STEP]
qed (rule supp_restrict0)


[STATEMENT]
theorem n_permutation_distinct: "distinct xs \<Longrightarrow> distinct (n_permutation_enum xs n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct xs \<Longrightarrow> distinct (n_permutation_enum xs n)
[PROOF STEP]
proof(induct n arbitrary: xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. distinct xs \<Longrightarrow> distinct (n_permutation_enum xs 0)
 2. \<And>n xs. \<lbrakk>\<And>xs. distinct xs \<Longrightarrow> distinct (n_permutation_enum xs n); distinct xs\<rbrakk> \<Longrightarrow> distinct (n_permutation_enum xs (Suc n))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
distinct xs

goal (2 subgoals):
 1. \<And>xs. distinct xs \<Longrightarrow> distinct (n_permutation_enum xs 0)
 2. \<And>n xs. \<lbrakk>\<And>xs. distinct xs \<Longrightarrow> distinct (n_permutation_enum xs n); distinct xs\<rbrakk> \<Longrightarrow> distinct (n_permutation_enum xs (Suc n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distinct xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
distinct xs

goal (1 subgoal):
 1. distinct (n_permutation_enum xs 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distinct (n_permutation_enum xs 0)

goal (1 subgoal):
 1. \<And>n xs. \<lbrakk>\<And>xs. distinct xs \<Longrightarrow> distinct (n_permutation_enum xs n); distinct xs\<rbrakk> \<Longrightarrow> distinct (n_permutation_enum xs (Suc n))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n xs. \<lbrakk>\<And>xs. distinct xs \<Longrightarrow> distinct (n_permutation_enum xs n); distinct xs\<rbrakk> \<Longrightarrow> distinct (n_permutation_enum xs (Suc n))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
distinct ?xs \<Longrightarrow> distinct (n_permutation_enum ?xs n)
distinct xs

goal (1 subgoal):
 1. \<And>n xs. \<lbrakk>\<And>xs. distinct xs \<Longrightarrow> distinct (n_permutation_enum xs n); distinct xs\<rbrakk> \<Longrightarrow> distinct (n_permutation_enum xs (Suc n))
[PROOF STEP]
let ?f = "\<lambda>x. (n_permutation_enum (remove1 x xs) n)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n xs. \<lbrakk>\<And>xs. distinct xs \<Longrightarrow> distinct (n_permutation_enum xs n); distinct xs\<rbrakk> \<Longrightarrow> distinct (n_permutation_enum xs (Suc n))
[PROOF STEP]
from Suc
[PROOF STATE]
proof (chain)
picking this:
distinct ?xs \<Longrightarrow> distinct (n_permutation_enum ?xs n)
distinct xs
[PROOF STEP]
have "distinct (?f x)" for x
[PROOF STATE]
proof (prove)
using this:
distinct ?xs \<Longrightarrow> distinct (n_permutation_enum ?xs n)
distinct xs

goal (1 subgoal):
 1. distinct (n_permutation_enum (remove1 x xs) n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distinct (n_permutation_enum (remove1 ?x xs) n)

goal (1 subgoal):
 1. \<And>n xs. \<lbrakk>\<And>xs. distinct xs \<Longrightarrow> distinct (n_permutation_enum xs n); distinct xs\<rbrakk> \<Longrightarrow> distinct (n_permutation_enum xs (Suc n))
[PROOF STEP]
from this Suc
[PROOF STATE]
proof (chain)
picking this:
distinct (n_permutation_enum (remove1 ?x xs) n)
distinct ?xs \<Longrightarrow> distinct (n_permutation_enum ?xs n)
distinct xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
distinct (n_permutation_enum (remove1 ?x xs) n)
distinct ?xs \<Longrightarrow> distinct (n_permutation_enum ?xs n)
distinct xs

goal (1 subgoal):
 1. distinct (n_permutation_enum xs (Suc n))
[PROOF STEP]
by (auto simp: Cons_distinct_concat_map_function_distinct_on_all [of ?f xs])
[PROOF STATE]
proof (state)
this:
distinct (n_permutation_enum xs (Suc n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subspace_image: assumes S: "m1.subspace S" shows "m2.subspace (f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m2.subspace (f ` S)
[PROOF STEP]
unfolding m2.subspace_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'c) \<in> f ` S \<and> (\<forall>x\<in>f ` S. \<forall>y\<in>f ` S. x + y \<in> f ` S) \<and> (\<forall>c. \<forall>x\<in>f ` S. c *b x \<in> f ` S)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (0::'c) \<in> f ` S
 2. \<And>x xa y xb. \<lbrakk>xa \<in> S; xb \<in> S\<rbrakk> \<Longrightarrow> f xa + f xb \<in> f ` S
 3. \<And>c x xa. xa \<in> S \<Longrightarrow> c *b f xa \<in> f ` S
[PROOF STEP]
show "0 \<in> f ` S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'c) \<in> f ` S
[PROOF STEP]
by (rule image_eqI[of _ _ 0]) (auto simp: S m1.subspace_0)
[PROOF STATE]
proof (state)
this:
(0::'c) \<in> f ` S

goal (2 subgoals):
 1. \<And>x xa y xb. \<lbrakk>xa \<in> S; xb \<in> S\<rbrakk> \<Longrightarrow> f xa + f xb \<in> f ` S
 2. \<And>c x xa. xa \<in> S \<Longrightarrow> c *b f xa \<in> f ` S
[PROOF STEP]
show "x \<in> S \<Longrightarrow> y \<in> S \<Longrightarrow> f x + f y \<in> f ` S" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> f x + f y \<in> f ` S
[PROOF STEP]
by (rule image_eqI[of _ _ "x + y"]) (auto simp: S m1.subspace_add add)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> S; ?y \<in> S\<rbrakk> \<Longrightarrow> f ?x + f ?y \<in> f ` S

goal (1 subgoal):
 1. \<And>c x xa. xa \<in> S \<Longrightarrow> c *b f xa \<in> f ` S
[PROOF STEP]
show "x \<in> S \<Longrightarrow> r *b f x \<in> f ` S" for r x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> S \<Longrightarrow> r *b f x \<in> f ` S
[PROOF STEP]
by (rule image_eqI[of _ _ "r *a x"]) (auto simp: S m1.subspace_scale scale)
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> ?r *b f ?x \<in> f ` S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem real_mon_conv_add:
  assumes xy: "x\<up>(y::real)" and ab: "a\<up>(b::real)"
  shows "(\<lambda>m. x m + a m)\<up>(y + b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. x m + a m)\<up>y + b
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. x m + a m)\<up>y + b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>m. x m + a m)\<up>y + b
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>m. x m + a m)\<up>y + b
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>m. x m + a m)\<up>y + b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x\<up>y
a\<up>b
[PROOF STEP]
have "x n \<le> x (Suc n)" and "a n \<le> a (Suc n)"
[PROOF STATE]
proof (prove)
using this:
x\<up>y
a\<up>b

goal (1 subgoal):
 1. x n \<le> x (Suc n) &&& a n \<le> a (Suc n)
[PROOF STEP]
by (simp_all add: mon_conv_real_def)
[PROOF STATE]
proof (state)
this:
x n \<le> x (Suc n)
a n \<le> a (Suc n)

goal (1 subgoal):
 1. (\<lambda>m. x m + a m)\<up>y + b
[PROOF STEP]
hence "x n + a n \<le> x (Suc n) + a (Suc n)"
[PROOF STATE]
proof (prove)
using this:
x n \<le> x (Suc n)
a n \<le> a (Suc n)

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

goal (1 subgoal):
 1. (\<lambda>m. x m + a m)\<up>y + b
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
x ?n2 + a ?n2 \<le> x (Suc ?n2) + a (Suc ?n2)

goal (1 subgoal):
 1. (\<lambda>m. x m + a m)\<up>y + b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x ?n2 + a ?n2 \<le> x (Suc ?n2) + a (Suc ?n2)

goal (1 subgoal):
 1. (\<lambda>m. x m + a m)\<up>y + b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x\<up>y
a\<up>b
[PROOF STEP]
have "(\<lambda>m. x m + a m)\<longlonglongrightarrow>(y + b)"
[PROOF STATE]
proof (prove)
using this:
x\<up>y
a\<up>b

goal (1 subgoal):
 1. (\<lambda>m. x m + a m) \<longlonglongrightarrow> y + b
[PROOF STEP]
by (simp add: mon_conv_real_def tendsto_add)
[PROOF STATE]
proof (state)
this:
(\<lambda>m. x m + a m) \<longlonglongrightarrow> y + b

goal (1 subgoal):
 1. (\<lambda>m. x m + a m)\<up>y + b
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x ?n2 + a ?n2 \<le> x (Suc ?n2) + a (Suc ?n2)
(\<lambda>m. x m + a m) \<longlonglongrightarrow> y + b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x ?n2 + a ?n2 \<le> x (Suc ?n2) + a (Suc ?n2)
(\<lambda>m. x m + a m) \<longlonglongrightarrow> y + b

goal (1 subgoal):
 1. (\<lambda>m. x m + a m)\<up>y + b
[PROOF STEP]
by (simp add: mon_conv_real_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>m. x m + a m)\<up>y + b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linepath_in_convex_hull:
  fixes x::real
  assumes a: "a \<in> convex hull S"
    and b: "b \<in> convex hull S"
    and x: "0\<le>x" "x\<le>1"
  shows "linepath a b x \<in> convex hull S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linepath a b x \<in> convex hull S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. linepath a b x \<in> convex hull S
[PROOF STEP]
have "linepath a b x \<in> closed_segment a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linepath a b x \<in> closed_segment a b
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
x \<le> 1

goal (1 subgoal):
 1. linepath a b x \<in> closed_segment a b
[PROOF STEP]
by (auto simp flip: linepath_image_01)
[PROOF STATE]
proof (state)
this:
linepath a b x \<in> closed_segment a b

goal (1 subgoal):
 1. linepath a b x \<in> convex hull S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
linepath a b x \<in> closed_segment a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
linepath a b x \<in> closed_segment a b

goal (1 subgoal):
 1. linepath a b x \<in> convex hull S
[PROOF STEP]
using a b convex_contains_segment
[PROOF STATE]
proof (prove)
using this:
linepath a b x \<in> closed_segment a b
a \<in> convex hull S
b \<in> convex hull S
convex ?S = (\<forall>a\<in>?S. \<forall>b\<in>?S. closed_segment a b \<subseteq> ?S)

goal (1 subgoal):
 1. linepath a b x \<in> convex hull S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
linepath a b x \<in> convex hull S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma of_nat_eq_0[simp]: "of_nat x = 0 \<longleftrightarrow> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_nat x = (0::'a)) = (x = 0)
[PROOF STEP]
proof(induct x,simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (of_nat x = (0::'a)) = (x = 0) \<Longrightarrow> (of_nat (Suc x) = (0::'a)) = (Suc x = 0)
[PROOF STEP]
case (Suc x)
[PROOF STATE]
proof (state)
this:
(of_nat x = (0::'a)) = (x = 0)

goal (1 subgoal):
 1. \<And>x. (of_nat x = (0::'a)) = (x = 0) \<Longrightarrow> (of_nat (Suc x) = (0::'a)) = (Suc x = 0)
[PROOF STEP]
have "of_nat (Suc x) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < of_nat (Suc x)
[PROOF STEP]
apply(rule le_less_trans[of _ "of_nat x"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (0::'a) \<le> of_nat x
 2. of_nat x < of_nat (Suc x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0::'a) < of_nat (Suc x)

goal (1 subgoal):
 1. \<And>x. (of_nat x = (0::'a)) = (x = 0) \<Longrightarrow> (of_nat (Suc x) = (0::'a)) = (Suc x = 0)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
(0::'a) < of_nat (Suc x)

goal (1 subgoal):
 1. (of_nat (Suc x) = (0::'a)) = (Suc x = 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(of_nat (Suc x) = (0::'a)) = (Suc x = 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gather_by_strictness:
"sum (\<lambda>g. sum (\<lambda>(f,\<pi>). weight f \<pi>) (Z_good g)) F_strict
  = sum (\<lambda>g. det (submatrix A UNIV (g`{0..<n})) * det (submatrix B (g`{0..<n}) UNIV)) F_strict"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>g\<in>F_strict. \<Sum>(x, y)\<in>Z_good g. weight x y) = (\<Sum>g\<in>F_strict. Determinant.det (submatrix A UNIV (g ` {0..<n})) * Determinant.det (submatrix B (g ` {0..<n}) UNIV))
[PROOF STEP]
proof (rule sum.cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. F_strict = F_strict
 2. \<And>x. x \<in> F_strict \<Longrightarrow> (\<Sum>(x, y)\<in>Z_good x. weight x y) = Determinant.det (submatrix A UNIV (x ` {0..<n})) * Determinant.det (submatrix B (x ` {0..<n}) UNIV)
[PROOF STEP]
fix f
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. F_strict = F_strict
 2. \<And>x. x \<in> F_strict \<Longrightarrow> (\<Sum>(x, y)\<in>Z_good x. weight x y) = Determinant.det (submatrix A UNIV (x ` {0..<n})) * Determinant.det (submatrix B (x ` {0..<n}) UNIV)
[PROOF STEP]
assume f: "f \<in> F_strict"
[PROOF STATE]
proof (state)
this:
f \<in> F_strict

goal (2 subgoals):
 1. F_strict = F_strict
 2. \<And>x. x \<in> F_strict \<Longrightarrow> (\<Sum>(x, y)\<in>Z_good x. weight x y) = Determinant.det (submatrix A UNIV (x ` {0..<n})) * Determinant.det (submatrix B (x ` {0..<n}) UNIV)
[PROOF STEP]
show "(\<Sum>(x, y)\<in>Z_good f. weight x y)
    = det (submatrix A UNIV (f ` {0..<n})) * det (submatrix B (f ` {0..<n}) UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(x, y)\<in>Z_good f. weight x y) = Determinant.det (submatrix A UNIV (f ` {0..<n})) * Determinant.det (submatrix B (f ` {0..<n}) UNIV)
[PROOF STEP]
by (rule one_step[symmetric], rule f)
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, y)\<in>Z_good f. weight x y) = Determinant.det (submatrix A UNIV (f ` {0..<n})) * Determinant.det (submatrix B (f ` {0..<n}) UNIV)

goal (1 subgoal):
 1. F_strict = F_strict
[PROOF STEP]
qed (simp)


[STATEMENT]
lemma cos_zero [simp]: "cos 0 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (0::'a) = (1::'a)
[PROOF STEP]
by (simp add: cos_def cos_coeff_def scaleR_conv_of_real)


[STATEMENT]
lemma gbinomial_int_pochhammer: "(a::int) gchoose k = (- 1) ^ k * pochhammer (- a) k div fact k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a gchoose k = (- 1) ^ k * pochhammer (- a) k div fact k
[PROOF STEP]
by (simp only: gbinomial_prod_rev falling_fact_pochhammer)


[STATEMENT]
lemma eint_minus_plus:
"a - (eint b + eint c) = a - eint b - eint c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - (eint b + eint c) = a - eint b - eint c
[PROOF STEP]
apply(induction a)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>int. eint int - (eint b + eint c) = eint int - eint b - eint c
 2. \<infinity> - (eint b + eint c) = \<infinity> - eint b - eint c
[PROOF STEP]
apply (metis diff_add_eq_diff_diff_swap idiff_eint_eint plus_eint_simps(1) semiring_normalization_rules(24))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<infinity> - (eint b + eint c) = \<infinity> - eint b - eint c
[PROOF STEP]
using idiff_infinity
[PROOF STATE]
proof (prove)
using this:
\<infinity> - ?n = \<infinity>

goal (1 subgoal):
 1. \<infinity> - (eint b + eint c) = \<infinity> - eint b - eint c
[PROOF STEP]
by presburger


[STATEMENT]
lemma cinner_sup_norm_cblinfun:
  fixes A :: \<open>'a::{complex_normed_vector,not_singleton} \<Rightarrow>\<^sub>C\<^sub>L 'b::complex_inner\<close>
  shows \<open>norm A = (SUP (\<psi>,\<phi>). cmod (cinner \<psi> (A *\<^sub>V \<phi>)) / (norm \<psi> * norm \<phi>))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm A = (\<Squnion>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C (A *\<^sub>V \<phi>)) / (norm \<psi> * norm \<phi>))
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A. bounded_clinear A \<Longrightarrow> onorm A = (\<Squnion>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>))
[PROOF STEP]
apply (rule cinner_sup_onorm)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A. bounded_clinear A \<Longrightarrow> bounded_linear A
[PROOF STEP]
by (simp add: bounded_clinear.bounded_linear)


[STATEMENT]
lemma open_contains_ball_eq: "open S \<Longrightarrow> x\<in>S \<longleftrightarrow> (\<exists>e>0. ball x e \<subseteq> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open S \<Longrightarrow> (x \<in> S) = (\<exists>e>0. ball x e \<subseteq> S)
[PROOF STEP]
by (metis open_contains_ball subset_eq centre_in_ball)


[STATEMENT]
lemma "filterlim (\<lambda>x::real. 1 - 1 / x + ln x) at_top at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_top. 1 - 1 / x + ln x :> at_top
[PROOF STEP]
by (force intro: tendsto_diff filterlim_tendsto_add_at_top
        real_tendsto_divide_at_top filterlim_ident ln_at_top)


[STATEMENT]
lemma
  fixes f :: "'a \<Rightarrow> 'b::semiring_1"
  assumes "finite A"
  shows sum_mult_indicator[simp]: "(\<Sum>x \<in> A. f x * indicator B x) = (\<Sum>x \<in> A \<inter> B. f x)"
    and sum_indicator_mult[simp]: "(\<Sum>x \<in> A. indicator B x * f x) = (\<Sum>x \<in> A \<inter> B. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>A. f x * indicator B x) = sum f (A \<inter> B) &&& (\<Sum>x\<in>A. indicator B x * f x) = sum f (A \<inter> B)
[PROOF STEP]
unfolding indicator_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>A. f x * of_bool (x \<in> B)) = sum f (A \<inter> B) &&& (\<Sum>x\<in>A. of_bool (x \<in> B) * f x) = sum f (A \<inter> B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. (\<Sum>x\<in>A. f x * of_bool (x \<in> B)) = sum f (A \<inter> B) &&& (\<Sum>x\<in>A. of_bool (x \<in> B) * f x) = sum f (A \<inter> B)
[PROOF STEP]
by (auto intro!: sum.mono_neutral_cong_right split: if_split_asm)


[STATEMENT]
lemma Im_Arcsin: "Im(Arcsin z) = - ln (cmod (\<i> * z + csqrt (1 - z\<^sup>2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (Arcsin z) = - ln (cmod (\<i> * z + csqrt (1 - z\<^sup>2)))
[PROOF STEP]
by (simp add: Arcsin_def Arcsin_body_lemma)


[STATEMENT]
theorem Crypt2_Nonce_neq_Nonce: "Crypt K (Crypt K' (Nonce M)) \<noteq> Nonce N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Crypt K (Crypt K' (Nonce M)) \<noteq> Nonce N
[PROOF STEP]
by (auto simp add: Nonce_def Crypt dest: msgrel_imp_eq_freediscrim)


[STATEMENT]
lemma Suc_times_binomial_add: "Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)"
  \<comment> \<open>by Lukas Bulwahn\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
have dvd: "Suc a * (fact a * fact b) dvd fact (Suc (a + b))" for a b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc a * (fact a * fact b) dvd fact (Suc (a + b))
[PROOF STEP]
using fact_fact_dvd_fact[of "Suc a" "b", where 'a=nat]
[PROOF STATE]
proof (prove)
using this:
fact (Suc a) * fact b dvd fact (Suc a + b)

goal (1 subgoal):
 1. Suc a * (fact a * fact b) dvd fact (Suc (a + b))
[PROOF STEP]
by (simp only: fact_Suc add_Suc[symmetric] of_nat_id mult.assoc)
[PROOF STATE]
proof (state)
this:
Suc ?a * (fact ?a * fact ?b) dvd fact (Suc (?a + ?b))

goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
have "Suc a * (fact (Suc (a + b)) div (Suc a * fact a * fact b)) =
      Suc a * fact (Suc (a + b)) div (Suc a * (fact a * fact b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc a * (fact (Suc (a + b)) div (Suc a * fact a * fact b)) = Suc a * fact (Suc (a + b)) div (Suc a * (fact a * fact b))
[PROOF STEP]
by (subst div_mult_swap[symmetric]; simp only: mult.assoc dvd)
[PROOF STATE]
proof (state)
this:
Suc a * (fact (Suc (a + b)) div (Suc a * fact a * fact b)) = Suc a * fact (Suc (a + b)) div (Suc a * (fact a * fact b))

goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Suc a * (fact (Suc (a + b)) div (Suc a * fact a * fact b)) = Suc a * fact (Suc (a + b)) div (Suc a * (fact a * fact b))

goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
have "\<dots> = Suc b * fact (Suc (a + b)) div (Suc b * (fact a * fact b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc a * fact (Suc (a + b)) div (Suc a * (fact a * fact b)) = Suc b * fact (Suc (a + b)) div (Suc b * (fact a * fact b))
[PROOF STEP]
by (simp only: div_mult_mult1)
[PROOF STATE]
proof (state)
this:
Suc a * fact (Suc (a + b)) div (Suc a * (fact a * fact b)) = Suc b * fact (Suc (a + b)) div (Suc b * (fact a * fact b))

goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Suc a * fact (Suc (a + b)) div (Suc a * (fact a * fact b)) = Suc b * fact (Suc (a + b)) div (Suc b * (fact a * fact b))

goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
have "\<dots> = Suc b * (fact (Suc (a + b)) div (Suc b * (fact a * fact b)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc b * fact (Suc (a + b)) div (Suc b * (fact a * fact b)) = Suc b * (fact (Suc (a + b)) div (Suc b * (fact a * fact b)))
[PROOF STEP]
using dvd[of b a]
[PROOF STATE]
proof (prove)
using this:
Suc b * (fact b * fact a) dvd fact (Suc (b + a))

goal (1 subgoal):
 1. Suc b * fact (Suc (a + b)) div (Suc b * (fact a * fact b)) = Suc b * (fact (Suc (a + b)) div (Suc b * (fact a * fact b)))
[PROOF STEP]
by (subst div_mult_swap[symmetric]; simp only: ac_simps dvd)
[PROOF STATE]
proof (state)
this:
Suc b * fact (Suc (a + b)) div (Suc b * (fact a * fact b)) = Suc b * (fact (Suc (a + b)) div (Suc b * (fact a * fact b)))

goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Suc a * (fact (Suc (a + b)) div (Suc a * fact a * fact b)) = Suc b * (fact (Suc (a + b)) div (Suc b * (fact a * fact b)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Suc a * (fact (Suc (a + b)) div (Suc a * fact a * fact b)) = Suc b * (fact (Suc (a + b)) div (Suc b * (fact a * fact b)))

goal (1 subgoal):
 1. Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)
[PROOF STEP]
by (subst (1 2) binomial_altdef_nat)
      (simp_all only: ac_simps diff_Suc_Suc Suc_diff_le diff_add_inverse fact_Suc of_nat_id)
[PROOF STATE]
proof (state)
this:
Suc a * (Suc (a + b) choose Suc a) = Suc b * (Suc (a + b) choose a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bigtheta_const_ln [simp]: "a > 0 \<Longrightarrow> (\<lambda>x::real. ln (a*x)) \<in> \<Theta>(\<lambda>x. ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a \<Longrightarrow> (\<lambda>x. ln (a * x)) \<in> \<Theta>(ln)
[PROOF STEP]
using tendsto_ln_over_ln[of a 1]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < a; 0 < 1\<rbrakk> \<Longrightarrow> ((\<lambda>x. ln (a * x) / ln (1 * x)) \<longlongrightarrow> 1) at_top

goal (1 subgoal):
 1. 0 < a \<Longrightarrow> (\<lambda>x. ln (a * x)) \<in> \<Theta>(ln)
[PROOF STEP]
by (intro bigthetaI_tendsto[of 1]) simp_all


[STATEMENT]
lemma emeasure_Collect_T:
  assumes f[measurable]: "Measurable.pred S P"
  shows "emeasure (T s) {x\<in>space (T s). P x} = (\<integral>\<^sup>+t. emeasure (T t) {x\<in>space (T t). P (t ## x)} \<partial>K s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (T s) {x \<in> space (T s). P x} = \<integral>\<^sup>+ t. emeasure (T t) {x \<in> space (T t). P (t ## x)} \<partial>measure_pmf (K s)
[PROOF STEP]
apply (subst (1 2) nn_integral_indicator[symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>t. {x \<in> space (T t). P (t ## x)} \<in> T.events t
 2. {x \<in> space (T s). P x} \<in> T.events s
 3. integral\<^sup>N (T s) (indicator {x \<in> space (T s). P x}) = \<integral>\<^sup>+ t. integral\<^sup>N (T t) (indicator {x \<in> space (T t). P (t ## x)}) \<partial>measure_pmf (K s)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {x \<in> space (T s). P x} \<in> T.events s
 2. integral\<^sup>N (T s) (indicator {x \<in> space (T s). P x}) = \<integral>\<^sup>+ t. integral\<^sup>N (T t) (indicator {x \<in> space (T t). P (t ## x)}) \<partial>measure_pmf (K s)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (T s) (indicator {x \<in> space (T s). P x}) = \<integral>\<^sup>+ t. integral\<^sup>N (T t) (indicator {x \<in> space (T t). P (t ## x)}) \<partial>measure_pmf (K s)
[PROOF STEP]
apply (subst nn_integral_T)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. indicator {x \<in> space (T s). P x} \<in> borel_measurable (stream_space (count_space UNIV))
 2. \<integral>\<^sup>+ t. \<integral>\<^sup>+ \<omega>. indicator {x \<in> space (T s). P x} (t ## \<omega>) \<partial>T t \<partial>measure_pmf (K s) = \<integral>\<^sup>+ t. integral\<^sup>N (T t) (indicator {x \<in> space (T t). P (t ## x)}) \<partial>measure_pmf (K s)
[PROOF STEP]
apply (auto intro!: nn_integral_cong simp add: space_stream_space indicator_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma locally_path_connected_space_open_path_components:
   "locally_path_connected_space X \<longleftrightarrow>
        (\<forall>U c. openin X U \<and> c \<in> path_components_of(subtopology X U) \<longrightarrow> openin X c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally_path_connected_space X = (\<forall>U c. openin X U \<and> c \<in> path_components_of (subtopology X U) \<longrightarrow> openin X c)
[PROOF STEP]
apply (auto simp: locally_path_connected_space_eq_open_path_component_of path_components_of_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>U x. \<lbrakk>\<forall>U c. openin X U \<and> c \<in> path_component_of_set (subtopology X U) ` (topspace X \<inter> U) \<longrightarrow> openin X c; openin X U; x \<in> U\<rbrakk> \<Longrightarrow> openin X (path_component_of_set (subtopology X U) x)
[PROOF STEP]
by (metis imageI inf.absorb_iff2 openin_closedin_eq)


[STATEMENT]
lemma gcd_neg_numeral_2_int [simp]: "gcd x (- numeral n :: int) = gcd x (numeral n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd x (- numeral n) = gcd x (numeral n)
[PROOF STEP]
by (fact gcd_neg2_int)


[STATEMENT]
lemma sbintrunc_numeral:
  "(signed_take_bit :: nat \<Rightarrow> int \<Rightarrow> int) (numeral k) x = of_bool (odd x) + 2 * (signed_take_bit :: nat \<Rightarrow> int \<Rightarrow> int) (pred_numeral k) (x div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. signed_take_bit (numeral k) x = of_bool (odd x) + 2 * signed_take_bit (pred_numeral k) (x div 2)
[PROOF STEP]
by (simp add: numeral_eq_Suc signed_take_bit_Suc mod2_eq_if)


[STATEMENT]
lemma bigo_lesso4: "f <o g =o O(k) \<Longrightarrow> g =o h +o O(k) \<Longrightarrow> f <o h =o O(k)"
  for k :: "'a \<Rightarrow> 'b::linordered_field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f <o g \<in> O(k); g \<in> h +o O(k)\<rbrakk> \<Longrightarrow> f <o h \<in> O(k)
[PROOF STEP]
apply (unfold lesso_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(k); g \<in> h +o O(k)\<rbrakk> \<Longrightarrow> (\<lambda>x. max (f x - h x) (0::'b)) \<in> O(k)
[PROOF STEP]
apply (drule set_plus_imp_minus)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(k); g - h \<in> O(k)\<rbrakk> \<Longrightarrow> (\<lambda>x. max (f x - h x) (0::'b)) \<in> O(k)
[PROOF STEP]
apply (drule bigo_abs5)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g - h \<in> O(k); (\<lambda>x. \<bar>max (f x - g x) (0::'b)\<bar>) \<in> O(k)\<rbrakk> \<Longrightarrow> (\<lambda>x. max (f x - h x) (0::'b)) \<in> O(k)
[PROOF STEP]
back
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(k); (\<lambda>x. \<bar>(g - h) x\<bar>) \<in> O(k)\<rbrakk> \<Longrightarrow> (\<lambda>x. max (f x - h x) (0::'b)) \<in> O(k)
[PROOF STEP]
apply (simp add: fun_diff_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(k); (\<lambda>x. \<bar>g x - h x\<bar>) \<in> O(k)\<rbrakk> \<Longrightarrow> (\<lambda>x. max (f x - h x) (0::'b)) \<in> O(k)
[PROOF STEP]
apply (drule bigo_useful_add)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<lambda>x. \<bar>g x - h x\<bar>) \<in> O(k) \<Longrightarrow> ?g4 \<in> O(k)
 2. \<lbrakk>(\<lambda>x. \<bar>g x - h x\<bar>) \<in> O(k); (\<lambda>x. max (f x - g x) (0::'b)) + ?g4 \<in> O(k)\<rbrakk> \<Longrightarrow> (\<lambda>x. max (f x - h x) (0::'b)) \<in> O(k)
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>x. \<bar>g x - h x\<bar>) \<in> O(k); (\<lambda>x. max (f x - g x) (0::'b)) + (\<lambda>x. \<bar>g x - h x\<bar>) \<in> O(k)\<rbrakk> \<Longrightarrow> (\<lambda>x. max (f x - h x) (0::'b)) \<in> O(k)
[PROOF STEP]
apply (erule bigo_lesseq2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. max (f x - g x) (0::'b)) + (\<lambda>x. \<bar>g x - h x\<bar>) \<in> O(k) \<Longrightarrow> \<forall>x. \<bar>max (f x - h x) (0::'b)\<bar> \<le> \<bar>g x - h x\<bar>
[PROOF STEP]
back
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<bar>g x - h x\<bar>) \<in> O(k) \<Longrightarrow> \<forall>x. \<bar>max (f x - h x) (0::'b)\<bar> \<le> ((\<lambda>x. max (f x - g x) (0::'b)) + (\<lambda>x. \<bar>g x - h x\<bar>)) x
[PROOF STEP]
apply (rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (\<lambda>x. \<bar>g x - h x\<bar>) \<in> O(k) \<Longrightarrow> \<bar>max (f x - h x) (0::'b)\<bar> \<le> ((\<lambda>x. max (f x - g x) (0::'b)) + (\<lambda>x. \<bar>g x - h x\<bar>)) x
[PROOF STEP]
apply (auto simp add: func_plus fun_diff_def algebra_simps split: split_max abs_split)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma infinite_imp_asc_chain: "infinite S \<Longrightarrow> \<forall>m\<in>S. \<exists>n\<in>S. m < (n::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite S \<Longrightarrow> \<forall>m\<in>S. \<exists>n\<in>S. m < n
[PROOF STEP]
by (rule infinite_nat_iff_asc_chain[THEN iffD1, OF infinite_imp_nonempty])


[STATEMENT]
lemma normalize_quot_proj:
  "fst (normalize_quot (a, b)) = a div (gcd a b * unit_factor b)"
  "snd (normalize_quot (a, b)) = normalize b div gcd a b" if "b \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (normalize_quot (a, b)) = a div (gcd a b * unit_factor b) &&& snd (normalize_quot (a, b)) = normalize b div gcd a b
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
b \<noteq> (0::'a)

goal (1 subgoal):
 1. fst (normalize_quot (a, b)) = a div (gcd a b * unit_factor b) &&& snd (normalize_quot (a, b)) = normalize b div gcd a b
[PROOF STEP]
by (simp_all add: normalize_quot_def Let_def mult.commute [of _ "unit_factor b"] dvd_div_mult2_eq mult_unit_dvd_iff')


[STATEMENT]
lemma height_balance_list:
  "height (balance_list xs) = nat \<lceil>log 2 (length xs + 1)\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. height (balance_list xs) = nat \<lceil>log 2 (real (length xs + 1))\<rceil>
[PROOF STEP]
by (simp add: balance_list_def height_bal_list)


[STATEMENT]
lemma pnPlus_flatten_PLUS:
  "\<lbrakk>X1 \<noteq> {}; X2 \<noteq> {}; finite X1; finite X2; \<forall>x \<in> X1 \<union> X2.  \<not>is_Zero x \<and> \<not>is_Plus x\<rbrakk>\<Longrightarrow>
  pnPlus (flatten PLUS X1) (flatten PLUS X2) = flatten PLUS (X1 \<union> X2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X1 \<noteq> {}; X2 \<noteq> {}; finite X1; finite X2; \<forall>x\<in>X1 \<union> X2. \<not> is_Zero x \<and> \<not> is_Plus x\<rbrakk> \<Longrightarrow> pnPlus (flatten PLUS X1) (flatten PLUS X2) = flatten PLUS (X1 \<union> X2)
[PROOF STEP]
by (rule trans[OF pnPlus_PLUS]) auto