[STATEMENT]
lemma fib_lowerbound:
  defines "\<phi> \<equiv> (1 + sqrt 5) / 2"
  shows "real (fib(n+2)) \<ge> \<phi> ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> ^ n \<le> real (fib (n + 2))
[PROOF STEP]
proof (induction n rule: fib.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<phi> ^ 0 \<le> real (fib (0 + 2))
 2. \<phi> ^ Suc 0 \<le> real (fib (Suc 0 + 2))
 3. \<And>n. \<lbrakk>\<phi> ^ Suc n \<le> real (fib (Suc n + 2)); \<phi> ^ n \<le> real (fib (n + 2))\<rbrakk> \<Longrightarrow> \<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:

goal (3 subgoals):
 1. \<phi> ^ 0 \<le> real (fib (0 + 2))
 2. \<phi> ^ Suc 0 \<le> real (fib (Suc 0 + 2))
 3. \<And>n. \<lbrakk>\<phi> ^ Suc n \<le> real (fib (Suc n + 2)); \<phi> ^ n \<le> real (fib (n + 2))\<rbrakk> \<Longrightarrow> \<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> ^ 0 \<le> real (fib (0 + 2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<phi> ^ 0 \<le> real (fib (0 + 2))

goal (2 subgoals):
 1. \<phi> ^ Suc 0 \<le> real (fib (Suc 0 + 2))
 2. \<And>n. \<lbrakk>\<phi> ^ Suc n \<le> real (fib (Suc n + 2)); \<phi> ^ n \<le> real (fib (n + 2))\<rbrakk> \<Longrightarrow> \<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<phi> ^ Suc 0 \<le> real (fib (Suc 0 + 2))
 2. \<And>n. \<lbrakk>\<phi> ^ Suc n \<le> real (fib (Suc n + 2)); \<phi> ^ n \<le> real (fib (n + 2))\<rbrakk> \<Longrightarrow> \<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))
[PROOF STEP]
case 2
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<phi> ^ Suc 0 \<le> real (fib (Suc 0 + 2))
 2. \<And>n. \<lbrakk>\<phi> ^ Suc n \<le> real (fib (Suc n + 2)); \<phi> ^ n \<le> real (fib (n + 2))\<rbrakk> \<Longrightarrow> \<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> ^ Suc 0 \<le> real (fib (Suc 0 + 2))
[PROOF STEP]
by (simp add: \<phi>_def real_le_lsqrt)
[PROOF STATE]
proof (state)
this:
\<phi> ^ Suc 0 \<le> real (fib (Suc 0 + 2))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<phi> ^ Suc n \<le> real (fib (Suc n + 2)); \<phi> ^ n \<le> real (fib (n + 2))\<rbrakk> \<Longrightarrow> \<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<phi> ^ Suc n \<le> real (fib (Suc n + 2)); \<phi> ^ n \<le> real (fib (n + 2))\<rbrakk> \<Longrightarrow> \<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))
[PROOF STEP]
case (3 n)
[PROOF STATE]
proof (state)
this:
\<phi> ^ Suc n \<le> real (fib (Suc n + 2))
\<phi> ^ n \<le> real (fib (n + 2))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<phi> ^ Suc n \<le> real (fib (Suc n + 2)); \<phi> ^ n \<le> real (fib (n + 2))\<rbrakk> \<Longrightarrow> \<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))
[PROOF STEP]
have "\<phi> ^ Suc (Suc n) = \<phi> ^ 2 * \<phi> ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> ^ Suc (Suc n) = \<phi>\<^sup>2 * \<phi> ^ n
[PROOF STEP]
by (simp add: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
\<phi> ^ Suc (Suc n) = \<phi>\<^sup>2 * \<phi> ^ n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<phi> ^ Suc n \<le> real (fib (Suc n + 2)); \<phi> ^ n \<le> real (fib (n + 2))\<rbrakk> \<Longrightarrow> \<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> ^ Suc (Suc n) = \<phi>\<^sup>2 * \<phi> ^ n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<phi> ^ Suc n \<le> real (fib (Suc n + 2)); \<phi> ^ n \<le> real (fib (n + 2))\<rbrakk> \<Longrightarrow> \<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))
[PROOF STEP]
have "\<dots> = (\<phi> + 1) * \<phi> ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi>\<^sup>2 * \<phi> ^ n = (\<phi> + 1) * \<phi> ^ n
[PROOF STEP]
by (simp_all add: \<phi>_def power2_eq_square field_simps)
[PROOF STATE]
proof (state)
this:
\<phi>\<^sup>2 * \<phi> ^ n = (\<phi> + 1) * \<phi> ^ n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<phi> ^ Suc n \<le> real (fib (Suc n + 2)); \<phi> ^ n \<le> real (fib (n + 2))\<rbrakk> \<Longrightarrow> \<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi>\<^sup>2 * \<phi> ^ n = (\<phi> + 1) * \<phi> ^ n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<phi> ^ Suc n \<le> real (fib (Suc n + 2)); \<phi> ^ n \<le> real (fib (n + 2))\<rbrakk> \<Longrightarrow> \<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))
[PROOF STEP]
have "\<dots> = \<phi> ^ Suc n + \<phi> ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<phi> + 1) * \<phi> ^ n = \<phi> ^ Suc n + \<phi> ^ n
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(\<phi> + 1) * \<phi> ^ n = \<phi> ^ Suc n + \<phi> ^ n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<phi> ^ Suc n \<le> real (fib (Suc n + 2)); \<phi> ^ n \<le> real (fib (n + 2))\<rbrakk> \<Longrightarrow> \<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<phi> + 1) * \<phi> ^ n = \<phi> ^ Suc n + \<phi> ^ n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<phi> ^ Suc n \<le> real (fib (Suc n + 2)); \<phi> ^ n \<le> real (fib (n + 2))\<rbrakk> \<Longrightarrow> \<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))
[PROOF STEP]
have "\<dots> \<le> real (fib (Suc n + 2)) + real (fib (n + 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> ^ Suc n + \<phi> ^ n \<le> real (fib (Suc n + 2)) + real (fib (n + 2))
[PROOF STEP]
by (intro add_mono "3.IH")
[PROOF STATE]
proof (state)
this:
\<phi> ^ Suc n + \<phi> ^ n \<le> real (fib (Suc n + 2)) + real (fib (n + 2))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<phi> ^ Suc n \<le> real (fib (Suc n + 2)); \<phi> ^ n \<le> real (fib (n + 2))\<rbrakk> \<Longrightarrow> \<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<phi> ^ Suc (Suc n) \<le> real (fib (Suc n + 2)) + real (fib (n + 2))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<phi> ^ Suc (Suc n) \<le> real (fib (Suc n + 2)) + real (fib (n + 2))

goal (1 subgoal):
 1. \<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<phi> ^ Suc (Suc n) \<le> real (fib (Suc (Suc n) + 2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ldrop_iterates: "ldrop (enat n) (iterates f x) = iterates f ((f ^^ n) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ldrop (enat n) (iterates f x) = iterates f ((f ^^ n) x)
[PROOF STEP]
proof(induct n arbitrary: x)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. ldrop (enat 0) (iterates f x) = iterates f ((f ^^ 0) x)
 2. \<And>n x. (\<And>x. ldrop (enat n) (iterates f x) = iterates f ((f ^^ n) x)) \<Longrightarrow> ldrop (enat (Suc n)) (iterates f x) = iterates f ((f ^^ Suc n) x)
[PROOF STEP]
case Suc
[PROOF STATE]
proof (state)
this:
ldrop (enat n_) (iterates f ?x) = iterates f ((f ^^ n_) ?x)

goal (2 subgoals):
 1. \<And>x. ldrop (enat 0) (iterates f x) = iterates f ((f ^^ 0) x)
 2. \<And>n x. (\<And>x. ldrop (enat n) (iterates f x) = iterates f ((f ^^ n) x)) \<Longrightarrow> ldrop (enat (Suc n)) (iterates f x) = iterates f ((f ^^ Suc n) x)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
ldrop (enat n_) (iterates f ?x) = iterates f ((f ^^ n_) ?x)

goal (1 subgoal):
 1. ldrop (enat (Suc n_)) (iterates f x) = iterates f ((f ^^ Suc n_) x)
[PROOF STEP]
by(subst iterates)(simp add: eSuc_enat[symmetric] funpow_swap1)
[PROOF STATE]
proof (state)
this:
ldrop (enat (Suc n_)) (iterates f x) = iterates f ((f ^^ Suc n_) x)

goal (1 subgoal):
 1. \<And>x. ldrop (enat 0) (iterates f x) = iterates f ((f ^^ 0) x)
[PROOF STEP]
qed(simp add: zero_enat_def[symmetric])


[STATEMENT]
lemma Lcm_eq_Max_nat:
  fixes M :: "nat set"
  assumes M: "finite M" "M \<noteq> {}" "0 \<notin> M" and lcm: "\<And>m n. \<lbrakk>m \<in> M; n \<in> M\<rbrakk> \<Longrightarrow> lcm m n \<in> M"
  shows "Lcm M = Max M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lcm M = Max M
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Lcm M \<le> Max M
 2. Max M \<le> Lcm M
[PROOF STEP]
show "Lcm M \<le> Max M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lcm M \<le> Max M
[PROOF STEP]
by (simp add: Lcm_in_lcm_closed_set_nat \<open>finite M\<close> \<open>M \<noteq> {}\<close> lcm)
[PROOF STATE]
proof (state)
this:
Lcm M \<le> Max M

goal (1 subgoal):
 1. Max M \<le> Lcm M
[PROOF STEP]
show "Max M \<le> Lcm M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max M \<le> Lcm M
[PROOF STEP]
by (meson Lcm_0_iff Max_in M dvd_Lcm dvd_imp_le le_0_eq not_le)
[PROOF STATE]
proof (state)
this:
Max M \<le> Lcm M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma converse_power: fixes r :: "'a rel" shows "(r\<inverse>)^^n = (r^^n)\<inverse>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r\<inverse> ^^ n = (r ^^ n)\<inverse>
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. r\<inverse> ^^ 0 = (r ^^ 0)\<inverse>
 2. \<And>n. r\<inverse> ^^ n = (r ^^ n)\<inverse> \<Longrightarrow> r\<inverse> ^^ Suc n = (r ^^ Suc n)\<inverse>
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
r\<inverse> ^^ n = (r ^^ n)\<inverse>

goal (2 subgoals):
 1. r\<inverse> ^^ 0 = (r ^^ 0)\<inverse>
 2. \<And>n. r\<inverse> ^^ n = (r ^^ n)\<inverse> \<Longrightarrow> r\<inverse> ^^ Suc n = (r ^^ Suc n)\<inverse>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r\<inverse> ^^ Suc n = (r ^^ Suc n)\<inverse>
[PROOF STEP]
unfolding relpow.simps(2)[of _ "r\<inverse>"] relpow_Suc[of _ r]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r\<inverse> ^^ n O r\<inverse> = (r O r ^^ n)\<inverse>
[PROOF STEP]
by (simp add: Suc converse_relcomp)
[PROOF STATE]
proof (state)
this:
r\<inverse> ^^ Suc n = (r ^^ Suc n)\<inverse>

goal (1 subgoal):
 1. r\<inverse> ^^ 0 = (r ^^ 0)\<inverse>
[PROOF STEP]
qed simp


[STATEMENT]
lemma matrix_match_condn_1:
"matrix_match A1 A2 B1 B2
      \<and>((i<(row_length A1)*(row_length B1))
      \<and>(j<(length A2)*(length B2)))
       \<Longrightarrow>  ((matrix_mult A1  A2)\<otimes>(matrix_mult B1  B2))!j!i
  =  f
       (scalar_product
                 (row A1 (i div (row_length B1)))
                 (col A2  (j div (length B2))))
       (scalar_product
                 (row B1 (i mod (row_length B1)))
                 (col B2 (j mod (length B2))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_match A1 A2 B1 B2 \<and> i < row_length A1 * row_length B1 \<and> j < length A2 * length B2 \<Longrightarrow> (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
using elements_matrix_distribution_1
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>mat (row_length ?A1.0) (length ?A1.0) ?A1.0; mat (row_length ?A2.0) (length ?A2.0) ?A2.0; mat (row_length ?B1.0) (length ?B1.0) ?B1.0; mat (row_length ?B2.0) (length ?B2.0) ?B2.0; length ?A1.0 = row_length ?A2.0; length ?B1.0 = row_length ?B2.0; ?A1.0 \<noteq> [] \<and> ?A2.0 \<noteq> [] \<and> ?B1.0 \<noteq> [] \<and> ?B2.0 \<noteq> []; ?i < row_length ?A1.0 * row_length ?B1.0; ?j < length ?A2.0 * length ?B2.0\<rbrakk> \<Longrightarrow> (?A1.0 \<circ> ?A2.0 \<otimes> ?B1.0 \<circ> ?B2.0) ! ?j ! ?i = scalar_product (row ?A1.0 (?i div row_length ?B1.0)) (col ?A2.0 (?j div length ?B2.0)) * scalar_product (row ?B1.0 (?i mod row_length ?B1.0)) (col ?B2.0 (?j mod length ?B2.0))

goal (1 subgoal):
 1. matrix_match A1 A2 B1 B2 \<and> i < row_length A1 * row_length B1 \<and> j < length A2 * length B2 \<Longrightarrow> (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
unfolding matrix_match_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>mat (row_length ?A1.0) (length ?A1.0) ?A1.0; mat (row_length ?A2.0) (length ?A2.0) ?A2.0; mat (row_length ?B1.0) (length ?B1.0) ?B1.0; mat (row_length ?B2.0) (length ?B2.0) ?B2.0; length ?A1.0 = row_length ?A2.0; length ?B1.0 = row_length ?B2.0; ?A1.0 \<noteq> [] \<and> ?A2.0 \<noteq> [] \<and> ?B1.0 \<noteq> [] \<and> ?B2.0 \<noteq> []; ?i < row_length ?A1.0 * row_length ?B1.0; ?j < length ?A2.0 * length ?B2.0\<rbrakk> \<Longrightarrow> (?A1.0 \<circ> ?A2.0 \<otimes> ?B1.0 \<circ> ?B2.0) ! ?j ! ?i = scalar_product (row ?A1.0 (?i div row_length ?B1.0)) (col ?A2.0 (?j div length ?B2.0)) * scalar_product (row ?B1.0 (?i mod row_length ?B1.0)) (col ?B2.0 (?j mod length ?B2.0))

goal (1 subgoal):
 1. (mat (row_length A1) (length A1) A1 \<and> mat (row_length A2) (length A2) A2 \<and> mat (row_length B1) (length B1) B1 \<and> mat (row_length B2) (length B2) B2 \<and> length A1 = row_length A2 \<and> length B1 = row_length B2 \<and> A1 \<noteq> [] \<and> A2 \<noteq> [] \<and> B1 \<noteq> [] \<and> B2 \<noteq> []) \<and> i < row_length A1 * row_length B1 \<and> j < length A2 * length B2 \<Longrightarrow> (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
by auto


[STATEMENT]
lemma cong_mersenne_mod2: "[mersenne_mod2 k n = k] (mod (2 ^ n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [mersenne_mod2 k n = k] (mod 2 ^ n - 1)
[PROOF STEP]
unfolding mersenne_mod2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [mersenne_mod (mersenne_mod k n) n = k] (mod 2 ^ n - 1)
[PROOF STEP]
by (rule cong_trans) (rule cong_mersenne_mod)+


[STATEMENT]
lemma edge_density_Un:
  assumes "disjnt X1 X2" "finite X1" "finite X2"
  shows "edge_density (X1 \<union> X2) Y G = (edge_density X1 Y G * card X1 + edge_density X2 Y G * card X2) / (card X1 + card X2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. edge_density (X1 \<union> X2) Y G = (edge_density X1 Y G * real (card X1) + edge_density X2 Y G * real (card X2)) / real (card X1 + card X2)
[PROOF STEP]
proof (cases "finite Y")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite Y \<Longrightarrow> edge_density (X1 \<union> X2) Y G = (edge_density X1 Y G * real (card X1) + edge_density X2 Y G * real (card X2)) / real (card X1 + card X2)
 2. infinite Y \<Longrightarrow> edge_density (X1 \<union> X2) Y G = (edge_density X1 Y G * real (card X1) + edge_density X2 Y G * real (card X2)) / real (card X1 + card X2)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite Y

goal (2 subgoals):
 1. finite Y \<Longrightarrow> edge_density (X1 \<union> X2) Y G = (edge_density X1 Y G * real (card X1) + edge_density X2 Y G * real (card X2)) / real (card X1 + card X2)
 2. infinite Y \<Longrightarrow> edge_density (X1 \<union> X2) Y G = (edge_density X1 Y G * real (card X1) + edge_density X2 Y G * real (card X2)) / real (card X1 + card X2)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
disjnt X1 X2
finite X1
finite X2
finite Y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
disjnt X1 X2
finite X1
finite X2
finite Y

goal (1 subgoal):
 1. edge_density (X1 \<union> X2) Y G = (edge_density X1 Y G * real (card X1) + edge_density X2 Y G * real (card X2)) / real (card X1 + card X2)
[PROOF STEP]
by (simp add: edge_density_def all_edges_between_disjnt1 all_edges_between_Un1 finite_all_edges_between card_Un_disjnt card_ge_0_finite divide_simps)
[PROOF STATE]
proof (state)
this:
edge_density (X1 \<union> X2) Y G = (edge_density X1 Y G * real (card X1) + edge_density X2 Y G * real (card X2)) / real (card X1 + card X2)

goal (1 subgoal):
 1. infinite Y \<Longrightarrow> edge_density (X1 \<union> X2) Y G = (edge_density X1 Y G * real (card X1) + edge_density X2 Y G * real (card X2)) / real (card X1 + card X2)
[PROOF STEP]
qed (simp add: edge_density_def)


[STATEMENT]
lemma absolutely_integrable_change_of_variables_linear:
  fixes f :: "real^'m::{finite,wellorder} \<Rightarrow> real^'n" and g :: "real^'m::_ \<Rightarrow> real^'m::_"
  assumes "linear g"
  shows "(\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f(g x)) absolutely_integrable_on S
     \<longleftrightarrow> f absolutely_integrable_on (g ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S) = (f absolutely_integrable_on g ` S)
[PROOF STEP]
using assms has_absolute_integral_change_of_variables_linear
[PROOF STATE]
proof (prove)
using this:
linear g
linear ?g \<Longrightarrow> ((\<lambda>x. \<bar>det (matrix ?g)\<bar> *\<^sub>R ?f (?g x)) absolutely_integrable_on ?S \<and> integral ?S (\<lambda>x. \<bar>det (matrix ?g)\<bar> *\<^sub>R ?f (?g x)) = ?b) = (?f absolutely_integrable_on ?g ` ?S \<and> integral (?g ` ?S) ?f = ?b)

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S) = (f absolutely_integrable_on g ` S)
[PROOF STEP]
by blast


[STATEMENT]
lemma list_every_elemnt_bound_sum_bound_real:"\<forall> x \<in> set (xs::'a list). (f::'a\<Rightarrow>real) x \<le> (bound::real) \<Longrightarrow>  foldr (\<lambda> a b. a+b) (map f xs) i \<le> real(length xs) * bound + i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set xs. f x \<le> bound \<Longrightarrow> foldr (+) (map f xs) i \<le> real (length xs) * bound + i
[PROOF STEP]
apply(induction xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>x\<in>set []. f x \<le> bound \<Longrightarrow> foldr (+) (map f []) i \<le> real (length []) * bound + i
 2. \<And>a xs. \<lbrakk>\<forall>x\<in>set xs. f x \<le> bound \<Longrightarrow> foldr (+) (map f xs) i \<le> real (length xs) * bound + i; \<forall>x\<in>set (a # xs). f x \<le> bound\<rbrakk> \<Longrightarrow> foldr (+) (map f (a # xs)) i \<le> real (length (a # xs)) * bound + i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<forall>x\<in>set xs. f x \<le> bound \<Longrightarrow> foldr (+) (map f xs) i \<le> real (length xs) * bound + i; \<forall>x\<in>set (a # xs). f x \<le> bound\<rbrakk> \<Longrightarrow> foldr (+) (map f (a # xs)) i \<le> real (length (a # xs)) * bound + i
[PROOF STEP]
apply (simp add: algebra_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma gbinomial_altdef_of_nat: "a gchoose k = (\<Prod>i = 0..<k. (a - of_nat i) / of_nat (k - i) :: 'a)"
  for k :: nat and a :: "'a::field_char_0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a gchoose k = (\<Prod>i = 0..<k. (a - of_nat i) / of_nat (k - i))
[PROOF STEP]
by (simp add: prod_dividef gbinomial_prod_rev fact_prod_rev)


[STATEMENT]
lemma card_Int_Un_le_Sum_card_Int:
  assumes "finite S"
  shows "card (A \<inter> \<Union>S) \<le> (\<Sum>B \<in> S. card (A \<inter> B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
proof (induction "card S" arbitrary: S)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>S. \<lbrakk>0 = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
 2. \<And>x S. \<lbrakk>\<And>S. \<lbrakk>x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B)); Suc x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>n = card ?S; finite ?S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> ?S) \<le> (\<Sum>B\<in>?S. card (A \<inter> B))
Suc n = card S
finite S

goal (2 subgoals):
 1. \<And>S. \<lbrakk>0 = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
 2. \<And>x S. \<lbrakk>\<And>S. \<lbrakk>x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B)); Suc x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>n = card ?S; finite ?S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> ?S) \<le> (\<Sum>B\<in>?S. card (A \<inter> B))
Suc n = card S
finite S
[PROOF STEP]
obtain B T where *: "S = { B } \<union> T" "card T = n" "B \<notin> T"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n = card ?S; finite ?S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> ?S) \<le> (\<Sum>B\<in>?S. card (A \<inter> B))
Suc n = card S
finite S

goal (1 subgoal):
 1. (\<And>B T. \<lbrakk>S = {B} \<union> T; card T = n; B \<notin> T\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis card_Suc_eq Suc_eq_plus1 insert_is_Un)
[PROOF STATE]
proof (state)
this:
S = {B} \<union> T
card T = n
B \<notin> T

goal (2 subgoals):
 1. \<And>S. \<lbrakk>0 = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
 2. \<And>x S. \<lbrakk>\<And>S. \<lbrakk>x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B)); Suc x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
hence "card (A \<inter> \<Union>S) = card (A \<inter> \<Union>({ B } \<union> T))"
[PROOF STATE]
proof (prove)
using this:
S = {B} \<union> T
card T = n
B \<notin> T

goal (1 subgoal):
 1. card (A \<inter> \<Union> S) = card (A \<inter> \<Union> ({B} \<union> T))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card (A \<inter> \<Union> S) = card (A \<inter> \<Union> ({B} \<union> T))

goal (2 subgoals):
 1. \<And>S. \<lbrakk>0 = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
 2. \<And>x S. \<lbrakk>\<And>S. \<lbrakk>x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B)); Suc x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (A \<inter> \<Union> S) = card (A \<inter> \<Union> ({B} \<union> T))

goal (2 subgoals):
 1. \<And>S. \<lbrakk>0 = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
 2. \<And>x S. \<lbrakk>\<And>S. \<lbrakk>x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B)); Suc x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
have "... \<le> card (A \<inter> B) + card (A \<inter> \<Union>T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (A \<inter> \<Union> ({B} \<union> T)) \<le> card (A \<inter> B) + card (A \<inter> \<Union> T)
[PROOF STEP]
by (simp add: card_Un_le inf_sup_distrib1)
[PROOF STATE]
proof (state)
this:
card (A \<inter> \<Union> ({B} \<union> T)) \<le> card (A \<inter> B) + card (A \<inter> \<Union> T)

goal (2 subgoals):
 1. \<And>S. \<lbrakk>0 = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
 2. \<And>x S. \<lbrakk>\<And>S. \<lbrakk>x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B)); Suc x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (A \<inter> \<Union> ({B} \<union> T)) \<le> card (A \<inter> B) + card (A \<inter> \<Union> T)

goal (2 subgoals):
 1. \<And>S. \<lbrakk>0 = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
 2. \<And>x S. \<lbrakk>\<And>S. \<lbrakk>x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B)); Suc x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
have "... \<le> card (A \<inter> B) + (\<Sum>B \<in> T. card (A \<inter> B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (A \<inter> B) + card (A \<inter> \<Union> T) \<le> card (A \<inter> B) + (\<Sum>B\<in>T. card (A \<inter> B))
[PROOF STEP]
using Suc *
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n = card ?S; finite ?S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> ?S) \<le> (\<Sum>B\<in>?S. card (A \<inter> B))
Suc n = card S
finite S
S = {B} \<union> T
card T = n
B \<notin> T

goal (1 subgoal):
 1. card (A \<inter> B) + card (A \<inter> \<Union> T) \<le> card (A \<inter> B) + (\<Sum>B\<in>T. card (A \<inter> B))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (A \<inter> B) + card (A \<inter> \<Union> T) \<le> card (A \<inter> B) + (\<Sum>B\<in>T. card (A \<inter> B))

goal (2 subgoals):
 1. \<And>S. \<lbrakk>0 = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
 2. \<And>x S. \<lbrakk>\<And>S. \<lbrakk>x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B)); Suc x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (A \<inter> B) + card (A \<inter> \<Union> T) \<le> card (A \<inter> B) + (\<Sum>B\<in>T. card (A \<inter> B))

goal (2 subgoals):
 1. \<And>S. \<lbrakk>0 = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
 2. \<And>x S. \<lbrakk>\<And>S. \<lbrakk>x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B)); Suc x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
have "... \<le> (\<Sum>B \<in> S. card (A \<inter> B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (A \<inter> B) + (\<Sum>B\<in>T. card (A \<inter> B)) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
using Suc.prems *
[PROOF STATE]
proof (prove)
using this:
finite S
S = {B} \<union> T
card T = n
B \<notin> T

goal (1 subgoal):
 1. card (A \<inter> B) + (\<Sum>B\<in>T. card (A \<inter> B)) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (A \<inter> B) + (\<Sum>B\<in>T. card (A \<inter> B)) \<le> (\<Sum>B\<in>S. card (A \<inter> B))

goal (2 subgoals):
 1. \<And>S. \<lbrakk>0 = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
 2. \<And>x S. \<lbrakk>\<And>S. \<lbrakk>x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B)); Suc x = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))

goal (1 subgoal):
 1. card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))

goal (1 subgoal):
 1. \<And>S. \<lbrakk>0 = card S; finite S\<rbrakk> \<Longrightarrow> card (A \<inter> \<Union> S) \<le> (\<Sum>B\<in>S. card (A \<inter> B))
[PROOF STEP]
qed simp


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


[STATEMENT]
lemma binomial_code[code]:
  "n choose k = (if k \<le> n then fact n div (fact k * fact (n - k)) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose k = (if k \<le> n then fact n div (fact k * fact (n - k)) else 0)
[PROOF STEP]
using binomial_eq_0[of n k] binomial_altdef_nat[of k n]
[PROOF STATE]
proof (prove)
using this:
n < k \<Longrightarrow> n choose k = 0
k \<le> n \<Longrightarrow> n choose k = fact n div (fact k * fact (n - k))

goal (1 subgoal):
 1. n choose k = (if k \<le> n then fact n div (fact k * fact (n - k)) else 0)
[PROOF STEP]
by simp


[STATEMENT]
lemma convex_Inter: "(\<And>s. s\<in>f \<Longrightarrow> convex s) \<Longrightarrow> convex(\<Inter>f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s. s \<in> f \<Longrightarrow> convex s) \<Longrightarrow> convex (\<Inter> f)
[PROOF STEP]
unfolding convex_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s. s \<in> f \<Longrightarrow> \<forall>x\<in>s. \<forall>y\<in>s. \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> s) \<Longrightarrow> \<forall>x\<in>\<Inter> f. \<forall>y\<in>\<Inter> f. \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> \<Inter> f
[PROOF STEP]
by auto


[STATEMENT]
lemma [simp]: "(a * b = 1) = (a = 1 \<and> b = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * b = (1::'a)) = (a = (1::'a) \<and> b = (1::'a))
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a * b = (1::'a) \<Longrightarrow> a = (1::'a) \<and> b = (1::'a)
 2. a = (1::'a) \<and> b = (1::'a) \<Longrightarrow> a * b = (1::'a)
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. a * b = (1::'a) \<Longrightarrow> a = (1::'a)
 2. a * b = (1::'a) \<Longrightarrow> b = (1::'a)
 3. a = (1::'a) \<and> b = (1::'a) \<Longrightarrow> a * b = (1::'a)
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. a * b = (1::'a) \<Longrightarrow> a \<le> (1::'a)
 2. a * b = (1::'a) \<Longrightarrow> (1::'a) \<le> a
 3. a * b = (1::'a) \<Longrightarrow> b = (1::'a)
 4. a = (1::'a) \<and> b = (1::'a) \<Longrightarrow> a * b = (1::'a)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. a * b = (1::'a) \<Longrightarrow> (1::'a) \<le> a
 2. a * b = (1::'a) \<Longrightarrow> b = (1::'a)
 3. a = (1::'a) \<and> b = (1::'a) \<Longrightarrow> a * b = (1::'a)
[PROOF STEP]
apply (rule_tac y = "a*b" in order_trans)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. a * b = (1::'a) \<Longrightarrow> (1::'a) \<le> a * b
 2. a * b = (1::'a) \<Longrightarrow> a * b \<le> a
 3. a * b = (1::'a) \<Longrightarrow> b = (1::'a)
 4. a = (1::'a) \<and> b = (1::'a) \<Longrightarrow> a * b = (1::'a)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. a * b = (1::'a) \<Longrightarrow> a * b \<le> a
 2. a * b = (1::'a) \<Longrightarrow> b = (1::'a)
 3. a = (1::'a) \<and> b = (1::'a) \<Longrightarrow> a * b = (1::'a)
[PROOF STEP]
apply (drule drop_assumption)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. True \<Longrightarrow> a * b \<le> a
 2. a * b = (1::'a) \<Longrightarrow> b = (1::'a)
 3. a = (1::'a) \<and> b = (1::'a) \<Longrightarrow> a * b = (1::'a)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a * b = (1::'a) \<Longrightarrow> b = (1::'a)
 2. a = (1::'a) \<and> b = (1::'a) \<Longrightarrow> a * b = (1::'a)
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. a * b = (1::'a) \<Longrightarrow> b \<le> (1::'a)
 2. a * b = (1::'a) \<Longrightarrow> (1::'a) \<le> b
 3. a = (1::'a) \<and> b = (1::'a) \<Longrightarrow> a * b = (1::'a)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a * b = (1::'a) \<Longrightarrow> (1::'a) \<le> b
 2. a = (1::'a) \<and> b = (1::'a) \<Longrightarrow> a * b = (1::'a)
[PROOF STEP]
apply (rule_tac y = "a*b" in order_trans)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. a * b = (1::'a) \<Longrightarrow> (1::'a) \<le> a * b
 2. a * b = (1::'a) \<Longrightarrow> a * b \<le> b
 3. a = (1::'a) \<and> b = (1::'a) \<Longrightarrow> a * b = (1::'a)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a * b = (1::'a) \<Longrightarrow> a * b \<le> b
 2. a = (1::'a) \<and> b = (1::'a) \<Longrightarrow> a * b = (1::'a)
[PROOF STEP]
apply (drule drop_assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. True \<Longrightarrow> a * b \<le> b
 2. a = (1::'a) \<and> b = (1::'a) \<Longrightarrow> a * b = (1::'a)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = (1::'a) \<and> b = (1::'a) \<Longrightarrow> a * b = (1::'a)
[PROOF STEP]
by simp


[STATEMENT]
lemma scalar_product_append:
 "\<forall>xs ys zs ws.(length zs = length ws)
               \<and>(length xs = length ys)
               \<and>(length xs = n)  \<longrightarrow>
                     (scalar_product (xs@zs) (ys@ws))
                                   = (scalar_product xs ys)
                                         +(scalar_product zs ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xs ys zs ws. length zs = length ws \<and> length xs = length ys \<and> length xs = n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
apply(rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. \<forall>ys zs ws. length zs = length ws \<and> length xs = length ys \<and> length xs = n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
apply(rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs ys. \<forall>zs ws. length zs = length ws \<and> length xs = length ys \<and> length xs = n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
apply(rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs ys zs. \<forall>ws. length zs = length ws \<and> length xs = length ys \<and> length xs = n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
apply(rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs ys zs ws. length zs = length ws \<and> length xs = length ys \<and> length xs = n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
proof(induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs ys zs ws. length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
 2. \<And>n xs ys zs ws. (\<And>xs ys zs ws. length zs = length ws \<and> length xs = length ys \<and> length xs = n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws) \<Longrightarrow> length zs = length ws \<and> length xs = length ys \<and> length xs = Suc n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>xs ys zs ws. length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
 2. \<And>n xs ys zs ws. (\<And>xs ys zs ws. length zs = length ws \<and> length xs = length ys \<and> length xs = n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws) \<Longrightarrow> length zs = length ws \<and> length xs = length ys \<and> length xs = Suc n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
have "(length zs = length ws) \<and>(length xs = length ys) \<and>(length xs = 0)
          \<Longrightarrow>
           (scalar_product (xs@zs) (ys@ws))
                                   = (scalar_product xs ys)
                                          +(scalar_product zs ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
assume assms:"(length zs = length ws)\<and>(length xs = length ys)
                                        \<and>(length xs = 0)"
[PROOF STATE]
proof (state)
this:
length zs = length ws \<and> length xs = length ys \<and> length xs = 0

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
have 1:"xs = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs = []
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length zs = length ws \<and> length xs = length ys \<and> length xs = 0

goal (1 subgoal):
 1. xs = []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xs = []

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
xs = []

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
have 2:"ys = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ys = []
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length zs = length ws \<and> length xs = length ys \<and> length xs = 0

goal (1 subgoal):
 1. ys = []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ys = []

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
xs = []
ys = []
[PROOF STEP]
have "scalar_product xs ys = zer"
[PROOF STATE]
proof (prove)
using this:
xs = []
ys = []

goal (1 subgoal):
 1. scalar_product xs ys = zer
[PROOF STEP]
unfolding scalar_product_def scalar_prodI_def zip_def
[PROOF STATE]
proof (prove)
using this:
xs = []
ys = []

goal (1 subgoal):
 1. foldr (\<lambda>(x, y). (+) (x * y)) (rec_list (\<lambda>xs. []) (\<lambda>y ys ysa. case_list [] (\<lambda>z zs. (z, y) # ysa zs)) ys xs) zer = zer
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
scalar_product xs ys = zer

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
scalar_product xs ys = zer
[PROOF STEP]
have "(scalar_product xs ys)+(scalar_product zs ws)
                                       = (scalar_product zs ws)"
[PROOF STATE]
proof (prove)
using this:
scalar_product xs ys = zer

goal (1 subgoal):
 1. scalar_product xs ys + scalar_product zs ws = scalar_product zs ws
[PROOF STEP]
using plus_left_id
[PROOF STATE]
proof (prove)
using this:
scalar_product xs ys = zer
zer + ?x = ?x

goal (1 subgoal):
 1. scalar_product xs ys + scalar_product zs ws = scalar_product zs ws
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
scalar_product xs ys + scalar_product zs ws = scalar_product zs ws

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
scalar_product xs ys + scalar_product zs ws = scalar_product zs ws

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
have "(scalar_product (xs@zs) (ys@ws)) = (scalar_product zs ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. scalar_product (xs @ zs) (ys @ ws) = scalar_product zs ws
[PROOF STEP]
using 1 2
[PROOF STATE]
proof (prove)
using this:
xs = []
ys = []

goal (1 subgoal):
 1. scalar_product (xs @ zs) (ys @ ws) = scalar_product zs ws
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
scalar_product (xs @ zs) (ys @ ws) = scalar_product zs ws

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
scalar_product xs ys + scalar_product zs ws = scalar_product zs ws
scalar_product (xs @ zs) (ys @ ws) = scalar_product zs ws
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
scalar_product xs ys + scalar_product zs ws = scalar_product zs ws
scalar_product (xs @ zs) (ys @ ws) = scalar_product zs ws

goal (1 subgoal):
 1. scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws

goal (2 subgoals):
 1. \<And>xs ys zs ws. length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
 2. \<And>n xs ys zs ws. (\<And>xs ys zs ws. length zs = length ws \<and> length xs = length ys \<and> length xs = n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws) \<Longrightarrow> length zs = length ws \<and> length xs = length ys \<and> length xs = Suc n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length zs = length ws \<and> length xs = length ys \<and> length xs = 0 \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws

goal (1 subgoal):
 1. \<And>n xs ys zs ws. (\<And>xs ys zs ws. length zs = length ws \<and> length xs = length ys \<and> length xs = n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws) \<Longrightarrow> length zs = length ws \<and> length xs = length ys \<and> length xs = Suc n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n xs ys zs ws. (\<And>xs ys zs ws. length zs = length ws \<and> length xs = length ys \<and> length xs = n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws) \<Longrightarrow> length zs = length ws \<and> length xs = length ys \<and> length xs = Suc n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
length ?zs = length ?ws \<and> length ?xs = length ?ys \<and> length ?xs = k \<longrightarrow> scalar_product (?xs @ ?zs) (?ys @ ?ws) = scalar_product ?xs ?ys + scalar_product ?zs ?ws

goal (1 subgoal):
 1. \<And>n xs ys zs ws. (\<And>xs ys zs ws. length zs = length ws \<and> length xs = length ys \<and> length xs = n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws) \<Longrightarrow> length zs = length ws \<and> length xs = length ys \<and> length xs = Suc n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
have "(length zs = length ws)\<and>(length xs = length ys)\<and>(length xs = (Suc k))  \<Longrightarrow>
        (scalar_product (xs@zs) (ys@ws))
                                   = (scalar_product xs ys)
                                      +(scalar_product zs ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
assume assms:"(length zs = length ws)
                   \<and>(length xs = length ys)
                   \<and>(length xs = (Suc k))"
[PROOF STATE]
proof (state)
this:
length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
have "\<exists>x xss.(xs = x#xss)\<and>(length xss = k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x xss. xs = x # xss \<and> length xss = k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k

goal (1 subgoal):
 1. \<exists>x xss. xs = x # xss \<and> length xss = k
[PROOF STEP]
by (metis Suc_length_conv)
[PROOF STATE]
proof (state)
this:
\<exists>x xss. xs = x # xss \<and> length xss = k

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x xss. xs = x # xss \<and> length xss = k
[PROOF STEP]
obtain x xss where "(xs = x#xss)\<and>(length xss = k)"
[PROOF STATE]
proof (prove)
using this:
\<exists>x xss. xs = x # xss \<and> length xss = k

goal (1 subgoal):
 1. (\<And>x xss. xs = x # xss \<and> length xss = k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xs = x # xss \<and> length xss = k

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xs = x # xss \<and> length xss = k
[PROOF STEP]
have 1:"(xs = x#xss)\<and>(length xss = k)"
[PROOF STATE]
proof (prove)
using this:
xs = x # xss \<and> length xss = k

goal (1 subgoal):
 1. xs = x # xss \<and> length xss = k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xs = x # xss \<and> length xss = k

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
have "\<exists>y yss.(ys = y#yss)\<and>(length yss = k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>y yss. ys = y # yss \<and> length yss = k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k

goal (1 subgoal):
 1. \<exists>y yss. ys = y # yss \<and> length yss = k
[PROOF STEP]
by (metis Suc_length_conv)
[PROOF STATE]
proof (state)
this:
\<exists>y yss. ys = y # yss \<and> length yss = k

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>y yss. ys = y # yss \<and> length yss = k
[PROOF STEP]
obtain y yss where "(ys = y#yss)\<and>(length yss = k)"
[PROOF STATE]
proof (prove)
using this:
\<exists>y yss. ys = y # yss \<and> length yss = k

goal (1 subgoal):
 1. (\<And>y yss. ys = y # yss \<and> length yss = k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ys = y # yss \<and> length yss = k

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ys = y # yss \<and> length yss = k
[PROOF STEP]
have 2:"(ys = y#yss)\<and>(length yss = k)"
[PROOF STATE]
proof (prove)
using this:
ys = y # yss \<and> length yss = k

goal (1 subgoal):
 1. ys = y # yss \<and> length yss = k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ys = y # yss \<and> length yss = k

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
xs = x # xss \<and> length xss = k
ys = y # yss \<and> length yss = k
[PROOF STEP]
have "length xss = length yss \<and> length xss = k"
[PROOF STATE]
proof (prove)
using this:
xs = x # xss \<and> length xss = k
ys = y # yss \<and> length yss = k

goal (1 subgoal):
 1. length xss = length yss \<and> length xss = k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length xss = length yss \<and> length xss = k

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length xss = length yss \<and> length xss = k
[PROOF STEP]
have 3:"(scalar_product (xss@zs) (yss@ws))
                                   = (scalar_product xss yss)
                                    +(scalar_product zs ws)"
[PROOF STATE]
proof (prove)
using this:
length xss = length yss \<and> length xss = k

goal (1 subgoal):
 1. scalar_product (xss @ zs) (yss @ ws) = scalar_product xss yss + scalar_product zs ws
[PROOF STEP]
using 1 2 assms Suc
[PROOF STATE]
proof (prove)
using this:
length xss = length yss \<and> length xss = k
xs = x # xss \<and> length xss = k
ys = y # yss \<and> length yss = k
length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k
length ?zs = length ?ws \<and> length ?xs = length ?ys \<and> length ?xs = k \<longrightarrow> scalar_product (?xs @ ?zs) (?ys @ ?ws) = scalar_product ?xs ?ys + scalar_product ?zs ?ws

goal (1 subgoal):
 1. scalar_product (xss @ zs) (yss @ ws) = scalar_product xss yss + scalar_product zs ws
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
scalar_product (xss @ zs) (yss @ ws) = scalar_product xss yss + scalar_product zs ws

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
scalar_product (xss @ zs) (yss @ ws) = scalar_product xss yss + scalar_product zs ws
[PROOF STEP]
have 4:"(scalar_product ((x#xss)@zs) ((y#yss)@ws)) =
                        (scalar_product (x#(xss@zs)) (y#(yss@ws)))"
[PROOF STATE]
proof (prove)
using this:
scalar_product (xss @ zs) (yss @ ws) = scalar_product xss yss + scalar_product zs ws

goal (1 subgoal):
 1. scalar_product ((x # xss) @ zs) ((y # yss) @ ws) = scalar_product (x # xss @ zs) (y # yss @ ws)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
scalar_product ((x # xss) @ zs) ((y # yss) @ ws) = scalar_product (x # xss @ zs) (y # yss @ ws)

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
scalar_product ((x # xss) @ zs) ((y # yss) @ ws) = scalar_product (x # xss @ zs) (y # yss @ ws)
[PROOF STEP]
have "... =  (x*y) + (scalar_product (xss@zs) (yss@ws))"
[PROOF STATE]
proof (prove)
using this:
scalar_product ((x # xss) @ zs) ((y # yss) @ ws) = scalar_product (x # xss @ zs) (y # yss @ ws)

goal (1 subgoal):
 1. scalar_product (x # xss @ zs) (y # yss @ ws) = x * y + scalar_product (xss @ zs) (yss @ ws)
[PROOF STEP]
unfolding scalar_product_def scalar_prodI_def
[PROOF STATE]
proof (prove)
using this:
foldr (\<lambda>(x, y). (+) (x * y)) (zip ((x # xss) @ zs) ((y # yss) @ ws)) zer = foldr (\<lambda>(x, y). (+) (x * y)) (zip (x # xss @ zs) (y # yss @ ws)) zer

goal (1 subgoal):
 1. foldr (\<lambda>(x, y). (+) (x * y)) (zip (x # xss @ zs) (y # yss @ ws)) zer = x * y + foldr (\<lambda>(x, y). (+) (x * y)) (zip (xss @ zs) (yss @ ws)) zer
[PROOF STEP]
using zip_Cons  scalar_prodI_def scalar_prod_cons
[PROOF STATE]
proof (prove)
using this:
foldr (\<lambda>(x, y). (+) (x * y)) (zip ((x # xss) @ zs) ((y # yss) @ ws)) zer = foldr (\<lambda>(x, y). (+) (x * y)) (zip (x # xss @ zs) (y # yss @ ws)) zer
length ?v = length ?w \<Longrightarrow> zip (?a # ?v) (?b # ?w) = (?a, ?b) # zip ?v ?w
scalar_prodI ?ze ?pl ?ti ?v ?w = foldr (\<lambda>(x, y). ?pl (?ti x y)) (zip ?v ?w) ?ze
scalar_prodI ?ze ?pl ?ti (?a # ?as) (?b # ?bs) = ?pl (?ti ?a ?b) (scalar_prodI ?ze ?pl ?ti ?as ?bs)

goal (1 subgoal):
 1. foldr (\<lambda>(x, y). (+) (x * y)) (zip (x # xss @ zs) (y # yss @ ws)) zer = x * y + foldr (\<lambda>(x, y). (+) (x * y)) (zip (xss @ zs) (yss @ ws)) zer
[PROOF STEP]
by (metis)
[PROOF STATE]
proof (state)
this:
scalar_product (x # xss @ zs) (y # yss @ ws) = x * y + scalar_product (xss @ zs) (yss @ ws)

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
with 4
[PROOF STATE]
proof (chain)
picking this:
scalar_product ((x # xss) @ zs) ((y # yss) @ ws) = scalar_product (x # xss @ zs) (y # yss @ ws)
scalar_product (x # xss @ zs) (y # yss @ ws) = x * y + scalar_product (xss @ zs) (yss @ ws)
[PROOF STEP]
have 5:"(scalar_product (xs@zs) ((ys)@ws))
                       =  (x*y) + (scalar_product (xss@zs) (yss@ws))"
[PROOF STATE]
proof (prove)
using this:
scalar_product ((x # xss) @ zs) ((y # yss) @ ws) = scalar_product (x # xss @ zs) (y # yss @ ws)
scalar_product (x # xss @ zs) (y # yss @ ws) = x * y + scalar_product (xss @ zs) (yss @ ws)

goal (1 subgoal):
 1. scalar_product (xs @ zs) (ys @ ws) = x * y + scalar_product (xss @ zs) (yss @ ws)
[PROOF STEP]
using 1 2
[PROOF STATE]
proof (prove)
using this:
scalar_product ((x # xss) @ zs) ((y # yss) @ ws) = scalar_product (x # xss @ zs) (y # yss @ ws)
scalar_product (x # xss @ zs) (y # yss @ ws) = x * y + scalar_product (xss @ zs) (yss @ ws)
xs = x # xss \<and> length xss = k
ys = y # yss \<and> length yss = k

goal (1 subgoal):
 1. scalar_product (xs @ zs) (ys @ ws) = x * y + scalar_product (xss @ zs) (yss @ ws)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
scalar_product (xs @ zs) (ys @ ws) = x * y + scalar_product (xss @ zs) (yss @ ws)

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
scalar_product (xs @ zs) (ys @ ws) = x * y + scalar_product (xss @ zs) (yss @ ws)

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
have "(scalar_product xs ys) = (x*y) + (scalar_product xss yss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. scalar_product xs ys = x * y + scalar_product xss yss
[PROOF STEP]
unfolding scalar_product_def scalar_prodI_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (\<lambda>(x, y). (+) (x * y)) (zip xs ys) zer = x * y + foldr (\<lambda>(x, y). (+) (x * y)) (zip xss yss) zer
[PROOF STEP]
using zip_Cons
[PROOF STATE]
proof (prove)
using this:
length ?v = length ?w \<Longrightarrow> zip (?a # ?v) (?b # ?w) = (?a, ?b) # zip ?v ?w

goal (1 subgoal):
 1. foldr (\<lambda>(x, y). (+) (x * y)) (zip xs ys) zer = x * y + foldr (\<lambda>(x, y). (+) (x * y)) (zip xss yss) zer
[PROOF STEP]
by (metis "1" "2" scalar_prodI_def scalar_prod_cons)
[PROOF STATE]
proof (state)
this:
scalar_product xs ys = x * y + scalar_product xss yss

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
scalar_product xs ys = x * y + scalar_product xss yss

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
scalar_product xs ys = x * y + scalar_product xss yss
[PROOF STEP]
have "(scalar_product xs ys)+(scalar_product zs ws)
                               =  (x*y)
                                       + (scalar_product xss yss)
                                       + (scalar_product zs ws)"
[PROOF STATE]
proof (prove)
using this:
scalar_product xs ys = x * y + scalar_product xss yss

goal (1 subgoal):
 1. scalar_product xs ys + scalar_product zs ws = x * y + scalar_product xss yss + scalar_product zs ws
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
scalar_product xs ys + scalar_product zs ws = x * y + scalar_product xss yss + scalar_product zs ws

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
scalar_product (xs @ zs) (ys @ ws) = x * y + scalar_product (xss @ zs) (yss @ ws)
scalar_product xs ys = x * y + scalar_product xss yss
scalar_product xs ys + scalar_product zs ws = x * y + scalar_product xss yss + scalar_product zs ws
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
scalar_product (xs @ zs) (ys @ ws) = x * y + scalar_product (xss @ zs) (yss @ ws)
scalar_product xs ys = x * y + scalar_product xss yss
scalar_product xs ys + scalar_product zs ws = x * y + scalar_product xss yss + scalar_product zs ws

goal (1 subgoal):
 1. scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
using 3 plus_assoc
[PROOF STATE]
proof (prove)
using this:
scalar_product (xs @ zs) (ys @ ws) = x * y + scalar_product (xss @ zs) (yss @ ws)
scalar_product xs ys = x * y + scalar_product xss yss
scalar_product xs ys + scalar_product zs ws = x * y + scalar_product xss yss + scalar_product zs ws
scalar_product (xss @ zs) (yss @ ws) = scalar_product xss yss + scalar_product zs ws
?a + ?b + ?c = ?a + (?b + ?c)

goal (1 subgoal):
 1. scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws

goal (1 subgoal):
 1. \<And>n xs ys zs ws. (\<And>xs ys zs ws. length zs = length ws \<and> length xs = length ys \<and> length xs = n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws) \<Longrightarrow> length zs = length ws \<and> length xs = length ys \<and> length xs = Suc n \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<Longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws

goal (1 subgoal):
 1. length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length zs = length ws \<and> length xs = length ys \<and> length xs = Suc k \<longrightarrow> scalar_product (xs @ zs) (ys @ ws) = scalar_product xs ys + scalar_product zs ws

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in finite_measure) finite_measure_dist:
  assumes AE: "AE x in M. x \<notin> C \<longrightarrow> (x \<in> A \<longleftrightarrow> x \<in> B)"
  assumes sets: "A \<in> sets M" "B \<in> sets M" "C \<in> sets M"
  shows "dist (measure M A) (measure M B) \<le> measure M C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C
[PROOF STEP]
have "measure M A \<le> measure M (B \<union> C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M A \<le> Sigma_Algebra.measure M (B \<union> C)
[PROOF STEP]
using AE sets
[PROOF STATE]
proof (prove)
using this:
AE x in M. x \<notin> C \<longrightarrow> (x \<in> A) = (x \<in> B)
A \<in> sets M
B \<in> sets M
C \<in> sets M

goal (1 subgoal):
 1. Sigma_Algebra.measure M A \<le> Sigma_Algebra.measure M (B \<union> C)
[PROOF STEP]
by (auto intro: finite_measure_mono_AE)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M A \<le> Sigma_Algebra.measure M (B \<union> C)

goal (1 subgoal):
 1. dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M A \<le> Sigma_Algebra.measure M (B \<union> C)

goal (1 subgoal):
 1. dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C
[PROOF STEP]
have "\<dots> \<le> measure M B + measure M C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (B \<union> C) \<le> Sigma_Algebra.measure M B + Sigma_Algebra.measure M C
[PROOF STEP]
using sets
[PROOF STATE]
proof (prove)
using this:
A \<in> sets M
B \<in> sets M
C \<in> sets M

goal (1 subgoal):
 1. Sigma_Algebra.measure M (B \<union> C) \<le> Sigma_Algebra.measure M B + Sigma_Algebra.measure M C
[PROOF STEP]
by (auto intro: finite_measure_subadditive)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M (B \<union> C) \<le> Sigma_Algebra.measure M B + Sigma_Algebra.measure M C

goal (1 subgoal):
 1. dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Sigma_Algebra.measure M A \<le> Sigma_Algebra.measure M B + Sigma_Algebra.measure M C
[PROOF STEP]
have A: "measure M A \<le> measure M B + measure M C"
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure M A \<le> Sigma_Algebra.measure M B + Sigma_Algebra.measure M C

goal (1 subgoal):
 1. Sigma_Algebra.measure M A \<le> Sigma_Algebra.measure M B + Sigma_Algebra.measure M C
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M A \<le> Sigma_Algebra.measure M B + Sigma_Algebra.measure M C

goal (1 subgoal):
 1. dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M A \<le> Sigma_Algebra.measure M B + Sigma_Algebra.measure M C

goal (1 subgoal):
 1. dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M A \<le> Sigma_Algebra.measure M B + Sigma_Algebra.measure M C

goal (1 subgoal):
 1. dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M A \<le> Sigma_Algebra.measure M B + Sigma_Algebra.measure M C

goal (1 subgoal):
 1. dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C
[PROOF STEP]
have "measure M B \<le> measure M (A \<union> C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M B \<le> Sigma_Algebra.measure M (A \<union> C)
[PROOF STEP]
using AE sets
[PROOF STATE]
proof (prove)
using this:
AE x in M. x \<notin> C \<longrightarrow> (x \<in> A) = (x \<in> B)
A \<in> sets M
B \<in> sets M
C \<in> sets M

goal (1 subgoal):
 1. Sigma_Algebra.measure M B \<le> Sigma_Algebra.measure M (A \<union> C)
[PROOF STEP]
by (auto intro: finite_measure_mono_AE)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M B \<le> Sigma_Algebra.measure M (A \<union> C)

goal (1 subgoal):
 1. dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M B \<le> Sigma_Algebra.measure M (A \<union> C)

goal (1 subgoal):
 1. dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C
[PROOF STEP]
have "\<dots> \<le> measure M A + measure M C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (A \<union> C) \<le> Sigma_Algebra.measure M A + Sigma_Algebra.measure M C
[PROOF STEP]
using sets
[PROOF STATE]
proof (prove)
using this:
A \<in> sets M
B \<in> sets M
C \<in> sets M

goal (1 subgoal):
 1. Sigma_Algebra.measure M (A \<union> C) \<le> Sigma_Algebra.measure M A + Sigma_Algebra.measure M C
[PROOF STEP]
by (auto intro: finite_measure_subadditive)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M (A \<union> C) \<le> Sigma_Algebra.measure M A + Sigma_Algebra.measure M C

goal (1 subgoal):
 1. dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Sigma_Algebra.measure M B \<le> Sigma_Algebra.measure M A + Sigma_Algebra.measure M C
[PROOF STEP]
have B: "measure M B \<le> measure M A + measure M C"
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure M B \<le> Sigma_Algebra.measure M A + Sigma_Algebra.measure M C

goal (1 subgoal):
 1. Sigma_Algebra.measure M B \<le> Sigma_Algebra.measure M A + Sigma_Algebra.measure M C
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M B \<le> Sigma_Algebra.measure M A + Sigma_Algebra.measure M C

goal (1 subgoal):
 1. dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M B \<le> Sigma_Algebra.measure M A + Sigma_Algebra.measure M C

goal (1 subgoal):
 1. dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Sigma_Algebra.measure M A \<le> Sigma_Algebra.measure M B + Sigma_Algebra.measure M C
Sigma_Algebra.measure M B \<le> Sigma_Algebra.measure M A + Sigma_Algebra.measure M C
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure M A \<le> Sigma_Algebra.measure M B + Sigma_Algebra.measure M C
Sigma_Algebra.measure M B \<le> Sigma_Algebra.measure M A + Sigma_Algebra.measure M C

goal (1 subgoal):
 1. dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C
[PROOF STEP]
by (simp add: dist_real_def)
[PROOF STATE]
proof (state)
this:
dist (Sigma_Algebra.measure M A) (Sigma_Algebra.measure M B) \<le> Sigma_Algebra.measure M C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Polygamma_real_strict_antimono:
  assumes "x > 0" "x < (y::real)" "odd n"
  shows   "Polygamma n x > Polygamma n y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polygamma n y < Polygamma n x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Polygamma n y < Polygamma n x
[PROOF STEP]
have "\<exists>\<xi>. x < \<xi> \<and> \<xi> < y \<and> Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>\<xi>>x. \<xi> < y \<and> Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x
x < y
odd n

goal (1 subgoal):
 1. \<exists>\<xi>>x. \<xi> < y \<and> Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>
[PROOF STEP]
by (intro MVT2 derivative_intros impI allI) (auto elim!: nonpos_Ints_cases)
[PROOF STATE]
proof (state)
this:
\<exists>\<xi>>x. \<xi> < y \<and> Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>

goal (1 subgoal):
 1. Polygamma n y < Polygamma n x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>\<xi>>x. \<xi> < y \<and> Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>
[PROOF STEP]
obtain \<xi>
    where \<xi>: "x < \<xi>" "\<xi> < y"
      and Polygamma: "Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>"
[PROOF STATE]
proof (prove)
using this:
\<exists>\<xi>>x. \<xi> < y \<and> Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>

goal (1 subgoal):
 1. (\<And>\<xi>. \<lbrakk>x < \<xi>; \<xi> < y; Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x < \<xi>
\<xi> < y
Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>

goal (1 subgoal):
 1. Polygamma n y < Polygamma n x
[PROOF STEP]
note Polygamma
[PROOF STATE]
proof (state)
this:
Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>

goal (1 subgoal):
 1. Polygamma n y < Polygamma n x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Polygamma n y - Polygamma n x = (y - x) * Polygamma (Suc n) \<xi>

goal (1 subgoal):
 1. Polygamma n y < Polygamma n x
[PROOF STEP]
from \<xi> assms
[PROOF STATE]
proof (chain)
picking this:
x < \<xi>
\<xi> < y
0 < x
x < y
odd n
[PROOF STEP]
have "(y - x) * Polygamma (Suc n) \<xi> < 0"
[PROOF STATE]
proof (prove)
using this:
x < \<xi>
\<xi> < y
0 < x
x < y
odd n

goal (1 subgoal):
 1. (y - x) * Polygamma (Suc n) \<xi> < 0
[PROOF STEP]
by (intro mult_pos_neg Polygamma_real_even_neg) simp_all
[PROOF STATE]
proof (state)
this:
(y - x) * Polygamma (Suc n) \<xi> < 0

goal (1 subgoal):
 1. Polygamma n y < Polygamma n x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Polygamma n y - Polygamma n x < 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Polygamma n y - Polygamma n x < 0

goal (1 subgoal):
 1. Polygamma n y < Polygamma n x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Polygamma n y < Polygamma n x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Majority_exQ:
  assumes asm1: "\<exists>D \<in> MajoritySet. \<forall>d\<in>D. P d"
  shows "\<forall>D\<in>MajoritySet.\<exists>d\<in>D. P d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>D\<in>MajoritySet. \<exists>d\<in>D. P d
[PROOF STEP]
using asm1
[PROOF STATE]
proof (prove)
using this:
\<exists>D\<in>MajoritySet. \<forall>d\<in>D. P d

goal (1 subgoal):
 1. \<forall>D\<in>MajoritySet. \<exists>d\<in>D. P d
[PROOF STEP]
proof(auto simp add: MajoritySet_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>D Da. \<lbrakk>IsMajority D; \<forall>x\<in>D. P x; IsMajority Da\<rbrakk> \<Longrightarrow> \<exists>x\<in>Da. P x
[PROOF STEP]
fix D1 D2
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>D Da. \<lbrakk>IsMajority D; \<forall>x\<in>D. P x; IsMajority Da\<rbrakk> \<Longrightarrow> \<exists>x\<in>Da. P x
[PROOF STEP]
assume D1: "IsMajority D1" and D2: "IsMajority D2"
     and Px: "\<forall>x\<in>D1. P x"
[PROOF STATE]
proof (state)
this:
IsMajority D1
IsMajority D2
\<forall>x\<in>D1. P x

goal (1 subgoal):
 1. \<And>D Da. \<lbrakk>IsMajority D; \<forall>x\<in>D. P x; IsMajority Da\<rbrakk> \<Longrightarrow> \<exists>x\<in>Da. P x
[PROOF STEP]
from D1 D2 majorities_intersect
[PROOF STATE]
proof (chain)
picking this:
IsMajority D1
IsMajority D2
\<forall>S T. IsMajority S \<and> IsMajority T \<longrightarrow> S \<inter> T \<noteq> {}
[PROOF STEP]
have "\<exists>d\<in>D1. d\<in>D2"
[PROOF STATE]
proof (prove)
using this:
IsMajority D1
IsMajority D2
\<forall>S T. IsMajority S \<and> IsMajority T \<longrightarrow> S \<inter> T \<noteq> {}

goal (1 subgoal):
 1. \<exists>d\<in>D1. d \<in> D2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>d\<in>D1. d \<in> D2

goal (1 subgoal):
 1. \<And>D Da. \<lbrakk>IsMajority D; \<forall>x\<in>D. P x; IsMajority Da\<rbrakk> \<Longrightarrow> \<exists>x\<in>Da. P x
[PROOF STEP]
with Px
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>D1. P x
\<exists>d\<in>D1. d \<in> D2
[PROOF STEP]
show "\<exists>x\<in>D2. P x"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>D1. P x
\<exists>d\<in>D1. d \<in> D2

goal (1 subgoal):
 1. \<exists>x\<in>D2. P x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>D2. P x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in complete_measure) null_sets_outer:
  "S \<in> null_sets M \<longleftrightarrow> (\<forall>e>0. \<exists>T\<in>fmeasurable M. S \<subseteq> T \<and> measure M T < e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S \<in> null_sets M) = (\<forall>e>0. \<exists>T\<in>fmeasurable M. S \<subseteq> T \<and> Sigma_Algebra.measure M T < e)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (S \<in> null_sets M) = (\<forall>e>0. \<exists>T\<in>fmeasurable M. S \<subseteq> T \<and> Sigma_Algebra.measure M T < e)
[PROOF STEP]
have "S \<in> null_sets M \<longleftrightarrow> (S \<in> fmeasurable M \<and> 0 = measure M S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S \<in> null_sets M) = (S \<in> fmeasurable M \<and> 0 = Sigma_Algebra.measure M S)
[PROOF STEP]
by (auto simp: null_sets_def emeasure_eq_measure2 intro: fmeasurableI) (simp add: measure_def)
[PROOF STATE]
proof (state)
this:
(S \<in> null_sets M) = (S \<in> fmeasurable M \<and> 0 = Sigma_Algebra.measure M S)

goal (1 subgoal):
 1. (S \<in> null_sets M) = (\<forall>e>0. \<exists>T\<in>fmeasurable M. S \<subseteq> T \<and> Sigma_Algebra.measure M T < e)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(S \<in> null_sets M) = (S \<in> fmeasurable M \<and> 0 = Sigma_Algebra.measure M S)

goal (1 subgoal):
 1. (S \<in> null_sets M) = (\<forall>e>0. \<exists>T\<in>fmeasurable M. S \<subseteq> T \<and> Sigma_Algebra.measure M T < e)
[PROOF STEP]
have "\<dots> = (\<forall>e>0. \<exists>T\<in>fmeasurable M. S \<subseteq> T \<and> measure M T < e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S \<in> fmeasurable M \<and> 0 = Sigma_Algebra.measure M S) = (\<forall>e>0. \<exists>T\<in>fmeasurable M. S \<subseteq> T \<and> Sigma_Algebra.measure M T < e)
[PROOF STEP]
unfolding fmeasurable_measure_inner_outer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>e>0. \<exists>T\<in>fmeasurable M. T \<subseteq> S \<and> 0 - e < Sigma_Algebra.measure M T) \<and> (\<forall>e>0. \<exists>U\<in>fmeasurable M. S \<subseteq> U \<and> Sigma_Algebra.measure M U < 0 + e)) = (\<forall>e>0. \<exists>T\<in>fmeasurable M. S \<subseteq> T \<and> Sigma_Algebra.measure M T < e)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(S \<in> fmeasurable M \<and> 0 = Sigma_Algebra.measure M S) = (\<forall>e>0. \<exists>T\<in>fmeasurable M. S \<subseteq> T \<and> Sigma_Algebra.measure M T < e)

goal (1 subgoal):
 1. (S \<in> null_sets M) = (\<forall>e>0. \<exists>T\<in>fmeasurable M. S \<subseteq> T \<and> Sigma_Algebra.measure M T < e)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(S \<in> null_sets M) = (\<forall>e>0. \<exists>T\<in>fmeasurable M. S \<subseteq> T \<and> Sigma_Algebra.measure M T < e)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(S \<in> null_sets M) = (\<forall>e>0. \<exists>T\<in>fmeasurable M. S \<subseteq> T \<and> Sigma_Algebra.measure M T < e)

goal (1 subgoal):
 1. (S \<in> null_sets M) = (\<forall>e>0. \<exists>T\<in>fmeasurable M. S \<subseteq> T \<and> Sigma_Algebra.measure M T < e)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(S \<in> null_sets M) = (\<forall>e>0. \<exists>T\<in>fmeasurable M. S \<subseteq> T \<and> Sigma_Algebra.measure M T < e)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma H_tensor_Id_1:
  defines d:"v \<equiv>  mat_of_cols_list 4 [[1/sqrt(2), 0, 1/sqrt(2), 0],
                                  [0, 1/sqrt(2), 0, 1/sqrt(2)],
                                  [1/sqrt(2), 0, -1/sqrt(2), 0],
                                  [0, 1/sqrt(2), 0, -1/sqrt(2)]]"
  shows "(H \<Otimes> Id 1) = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H \<Otimes> Quantum.Id 1 = v
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row v; j < dim_col v\<rbrakk> \<Longrightarrow> (H \<Otimes> Quantum.Id 1) $$ (i, j) = v $$ (i, j)
 2. dim_row (H \<Otimes> Quantum.Id 1) = dim_row v
 3. dim_col (H \<Otimes> Quantum.Id 1) = dim_col v
[PROOF STEP]
show "dim_col (H \<Otimes> Id 1) = dim_col v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (H \<Otimes> Quantum.Id 1) = dim_col v
[PROOF STEP]
by (simp add: d H_def Id_def mat_of_cols_list_def)
[PROOF STATE]
proof (state)
this:
dim_col (H \<Otimes> Quantum.Id 1) = dim_col v

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row v; j < dim_col v\<rbrakk> \<Longrightarrow> (H \<Otimes> Quantum.Id 1) $$ (i, j) = v $$ (i, j)
 2. dim_row (H \<Otimes> Quantum.Id 1) = dim_row v
[PROOF STEP]
show "dim_row (H \<Otimes> Id 1) = dim_row v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (H \<Otimes> Quantum.Id 1) = dim_row v
[PROOF STEP]
by (simp add: d H_def Id_def mat_of_cols_list_def)
[PROOF STATE]
proof (state)
this:
dim_row (H \<Otimes> Quantum.Id 1) = dim_row v

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row v; j < dim_col v\<rbrakk> \<Longrightarrow> (H \<Otimes> Quantum.Id 1) $$ (i, j) = v $$ (i, j)
[PROOF STEP]
fix i j:: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row v; j < dim_col v\<rbrakk> \<Longrightarrow> (H \<Otimes> Quantum.Id 1) $$ (i, j) = v $$ (i, j)
[PROOF STEP]
assume "i < dim_row v" and "j < dim_col v"
[PROOF STATE]
proof (state)
this:
i < dim_row v
j < dim_col v

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row v; j < dim_col v\<rbrakk> \<Longrightarrow> (H \<Otimes> Quantum.Id 1) $$ (i, j) = v $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < dim_row v
j < dim_col v
[PROOF STEP]
have "i \<in> {0..<4} \<and> j \<in> {0..<4}"
[PROOF STATE]
proof (prove)
using this:
i < dim_row v
j < dim_col v

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

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row v; j < dim_col v\<rbrakk> \<Longrightarrow> (H \<Otimes> Quantum.Id 1) $$ (i, j) = v $$ (i, j)
[PROOF STEP]
thus "(H \<Otimes> Id 1) $$ (i, j) = v $$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
i \<in> {0..<4} \<and> j \<in> {0..<4}

goal (1 subgoal):
 1. (H \<Otimes> Quantum.Id 1) $$ (i, j) = v $$ (i, j)
[PROOF STEP]
by (auto simp add: d Id_def H_def mat_of_cols_list_def)
[PROOF STATE]
proof (state)
this:
(H \<Otimes> Quantum.Id 1) $$ (i, j) = v $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in prime_number_theorem) totient_primorial'_asymp_equiv:
  "(\<lambda>k. totient (primorial' k)) \<sim>[at_top] (\<lambda>k. third_mertens_const * primorial' k / ln k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real (totient (primorial' x))) \<sim>[sequentially] (\<lambda>k. third_mertens_const * real (primorial' k) / ln (real k))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. real (totient (primorial' x))) \<sim>[sequentially] (\<lambda>k. third_mertens_const * real (primorial' k) / ln (real k))
[PROOF STEP]
let ?C = third_mertens_const
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. real (totient (primorial' x))) \<sim>[sequentially] (\<lambda>k. third_mertens_const * real (primorial' k) / ln (real k))
[PROOF STEP]
have "(\<lambda>k. totient (primorial' k)) \<sim>[at_top] (\<lambda>k. primorial' k * (\<Prod>i<k. 1 - 1 / nth_prime i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real (totient (primorial' x))) \<sim>[sequentially] (\<lambda>k. real (primorial' k) * (\<Prod>i<k. 1 - 1 / real (nth_prime i)))
[PROOF STEP]
by (subst totient_primorial') auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real (totient (primorial' x))) \<sim>[sequentially] (\<lambda>k. real (primorial' k) * (\<Prod>i<k. 1 - 1 / real (nth_prime i)))

goal (1 subgoal):
 1. (\<lambda>x. real (totient (primorial' x))) \<sim>[sequentially] (\<lambda>k. third_mertens_const * real (primorial' k) / ln (real k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real (totient (primorial' x))) \<sim>[sequentially] (\<lambda>k. real (primorial' k) * (\<Prod>i<k. 1 - 1 / real (nth_prime i)))

goal (1 subgoal):
 1. (\<lambda>x. real (totient (primorial' x))) \<sim>[sequentially] (\<lambda>k. third_mertens_const * real (primorial' k) / ln (real k))
[PROOF STEP]
have "\<dots> \<sim>[at_top] (\<lambda>k. primorial' k * (?C / ln k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. real (primorial' k) * (\<Prod>i<k. 1 - 1 / real (nth_prime i))) \<sim>[sequentially] (\<lambda>k. real (primorial' k) * (third_mertens_const / ln (real k)))
[PROOF STEP]
by (intro asymp_equiv_intros mertens_third_theorem_asymp_equiv')
[PROOF STATE]
proof (state)
this:
(\<lambda>k. real (primorial' k) * (\<Prod>i<k. 1 - 1 / real (nth_prime i))) \<sim>[sequentially] (\<lambda>k. real (primorial' k) * (third_mertens_const / ln (real k)))

goal (1 subgoal):
 1. (\<lambda>x. real (totient (primorial' x))) \<sim>[sequentially] (\<lambda>k. third_mertens_const * real (primorial' k) / ln (real k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>c d. c \<sim>[sequentially] d \<Longrightarrow> c \<sim>[sequentially] d) \<Longrightarrow> (\<lambda>x. real (totient (primorial' x))) \<sim>[sequentially] (\<lambda>a. real (primorial' a) * (third_mertens_const / ln (real a)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<And>c d. c \<sim>[sequentially] d \<Longrightarrow> c \<sim>[sequentially] d) \<Longrightarrow> (\<lambda>x. real (totient (primorial' x))) \<sim>[sequentially] (\<lambda>a. real (primorial' a) * (third_mertens_const / ln (real a)))

goal (1 subgoal):
 1. (\<lambda>x. real (totient (primorial' x))) \<sim>[sequentially] (\<lambda>k. third_mertens_const * real (primorial' k) / ln (real k))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real (totient (primorial' x))) \<sim>[sequentially] (\<lambda>k. third_mertens_const * real (primorial' k) / ln (real k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nu_witness_properties:
  "mu < nu_witness"
  "nu_witness \<le> lambda + mu"
  "lambda dvd nu_witness"
  "mu = 0 \<Longrightarrow> nu_witness = lambda"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mu < nu_witness &&& nu_witness \<le> lambda + mu) &&& lambda dvd nu_witness &&& (mu = 0 \<Longrightarrow> nu_witness = lambda)
[PROOF STEP]
unfolding nu_witness_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mu < mu + lambda - mu mod lambda &&& mu + lambda - mu mod lambda \<le> lambda + mu) &&& lambda dvd mu + lambda - mu mod lambda &&& (mu = 0 \<Longrightarrow> mu + lambda - mu mod lambda = lambda)
[PROOF STEP]
using properties_lambda_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < lambda

goal (1 subgoal):
 1. (mu < mu + lambda - mu mod lambda &&& mu + lambda - mu mod lambda \<le> lambda + mu) &&& lambda dvd mu + lambda - mu mod lambda &&& (mu = 0 \<Longrightarrow> mu + lambda - mu mod lambda = lambda)
[PROOF STEP]
apply (simp_all add: less_diff_conv divide_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < lambda \<Longrightarrow> lambda dvd mu + lambda - mu mod lambda
[PROOF STEP]
apply (metis minus_mod_eq_div_mult [symmetric] dvd_def mod_add_self2 mult.commute)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma card_extensional_funcset:
  assumes "finite A"
  shows "card (A \<rightarrow>\<^sub>E B) = card B ^ card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (A \<rightarrow>\<^sub>E B) = card B ^ card A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. card (A \<rightarrow>\<^sub>E B) = card B ^ card A
[PROOF STEP]
by (simp add: card_PiE prod_constant)


[STATEMENT]
lemma lin_bound_arg_general_list:
  fixes xs ::"('a :: {field})vec list"
  assumes "distinct xs"
  assumes "(set xs) \<subseteq> carrier_vec nr"
  assumes "vec_space.lin_indpt_vs nr (set xs)"
  shows "length (xs) \<le> nr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs \<le> nr
[PROOF STEP]
using lin_bound_arg_general_set[of "set xs" nr] distinct_card assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set xs \<subseteq> carrier_vec nr; vec_space.lin_indpt_vs nr (set xs)\<rbrakk> \<Longrightarrow> card (set xs) \<le> nr
distinct ?xs \<Longrightarrow> card (set ?xs) = length ?xs
distinct xs
set xs \<subseteq> carrier_vec nr
vec_space.lin_indpt_vs nr (set xs)

goal (1 subgoal):
 1. length xs \<le> nr
[PROOF STEP]
by force


[STATEMENT]
lemma le_SUP_diff:
  fixes A' :: "'a \<Rightarrow> real"
  assumes "X \<noteq> {}" "bounded (B ` X)" "bounded (A' ` X)" "(\<Squnion>a \<in> X. A' a) \<le> (\<Squnion>b \<in> X. B b)"
  shows  "0 \<le> (\<Squnion>c \<in> X. B c - A' c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (\<Squnion>c\<in>X. B c - A' c)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
X \<noteq> {}
bounded (B ` X)
bounded (A' ` X)
\<Squnion> (A' ` X) \<le> \<Squnion> (B ` X)

goal (1 subgoal):
 1. 0 \<le> (\<Squnion>c\<in>X. B c - A' c)
[PROOF STEP]
by (auto intro!: order.trans[OF _ le_SUP_diff'])


[STATEMENT]
lemma arcsin_arccos_sqrt_pos: "0 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> arcsin x = arccos(sqrt(1 - x\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> arcsin x = arccos (sqrt (1 - x\<^sup>2))
[PROOF STEP]
apply (simp add: abs_square_le_1 arcsin_eq_Re_Arcsin arccos_eq_Re_Arccos)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> Re (Arcsin (complex_of_real x)) = Re (Arccos (complex_of_real (sqrt (1 - x\<^sup>2))))
[PROOF STEP]
apply (subst Arcsin_Arccos_csqrt_pos)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> 0 < Re (complex_of_real x) \<or> Re (complex_of_real x) = 0 \<and> 0 \<le> Im (complex_of_real x)
 2. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> Re (Arccos (csqrt (1 - (complex_of_real x)\<^sup>2))) = Re (Arccos (complex_of_real (sqrt (1 - x\<^sup>2))))
[PROOF STEP]
apply (auto simp: power_le_one csqrt_1_diff_eq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem pappus_iff_pascal: "is_pappus = pascal_prop"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_pappus = pascal_prop
[PROOF STEP]
using pappus_pascal pascal_pappus
[PROOF STATE]
proof (prove)
using this:
is_pappus \<Longrightarrow> pascal_prop
pascal_prop \<Longrightarrow> is_pappus

goal (1 subgoal):
 1. is_pappus = pascal_prop
[PROOF STEP]
by blast


[STATEMENT]
lemma Z_XpZ_rho_psim[simp]:
  shows "Complex_Matrix.trace (rho_psim * Z_XpZ) =1/ (sqrt 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (rho_psim * Z_XpZ) = complex_of_real (1 / sqrt 2)
[PROOF STEP]
apply (auto simp add: rho_psim_def ket_psim_def ket_10_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (rank_1_proj (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>v (ket_01 - (ket_1 \<otimes> ket_0))) * Z_XpZ) = 1 / complex_of_real (sqrt 2)
[PROOF STEP]
apply (auto simp add: Z_XpZ_def  XpZ_def X_def Z_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (rank_1_proj (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>v (ket_01 - (ket_1 \<otimes> ket_0))) * (Matrix.mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 0 else if i = 0 then 1 else - 1) \<Otimes> - (1 / complex_of_real (sqrt 2)) \<cdot>\<^sub>m (Matrix.mat 2 2 (\<lambda>(i, j). if i = j then 0 else 1) + Matrix.mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 0 else if i = 0 then 1 else - 1)))) = 1 / complex_of_real (sqrt 2)
[PROOF STEP]
apply (auto simp add: rank_1_proj_def outer_prod_def ket_01_def ket_1_def ket_0_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (Matrix.mat 4 (Suc 0) (\<lambda>(i, j). (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>v ((unit_vec 2 0 \<otimes> unit_vec 2 (Suc 0)) - (unit_vec 2 (Suc 0) \<otimes> unit_vec 2 0))) $ i) * Matrix.mat (Suc 0) 4 (\<lambda>(i, j). conjugate (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>v ((unit_vec 2 0 \<otimes> unit_vec 2 (Suc 0)) - (unit_vec 2 (Suc 0) \<otimes> unit_vec 2 0))) $ j) * (Matrix.mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 0 else if i = 0 then 1 else - 1) \<Otimes> - (1 / complex_of_real (sqrt 2)) \<cdot>\<^sub>m (Matrix.mat 2 2 (\<lambda>(i, j). if i = j then 0 else 1) + Matrix.mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 0 else if i = 0 then 1 else - 1)))) = 1 / complex_of_real (sqrt 2)
[PROOF STEP]
apply (auto simp add: Complex_Matrix.trace_def sum_4_elems)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 / (complex_of_real (sqrt 2) * (complex_of_real (sqrt 2) * complex_of_real (sqrt 2))) = 1 / complex_of_real (sqrt 2)
[PROOF STEP]
apply (simp add: csqrt_2_sq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sorted_list_of_set_Un:
  assumes AB: "less_sets A B" and fin: "finite A" "finite B"
  shows "sorted_list_of_set (A \<union> B) = sorted_list_of_set A @ sorted_list_of_set B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set (A \<union> B) = sorted_list_of_set A @ sorted_list_of_set B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted_list_of_set (A \<union> B) = sorted_list_of_set A @ sorted_list_of_set B
[PROOF STEP]
have "strict_sorted (sorted_list_of_set A @ sorted_list_of_set B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_sorted (sorted_list_of_set A @ sorted_list_of_set B)
[PROOF STEP]
using AB
[PROOF STATE]
proof (prove)
using this:
A \<lless> B

goal (1 subgoal):
 1. strict_sorted (sorted_list_of_set A @ sorted_list_of_set B)
[PROOF STEP]
unfolding less_sets_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>A. \<forall>y\<in>B. x < y

goal (1 subgoal):
 1. strict_sorted (sorted_list_of_set A @ sorted_list_of_set B)
[PROOF STEP]
by (metis fin set_sorted_list_of_set sorted_wrt_append strict_sorted_list_of_set)
[PROOF STATE]
proof (state)
this:
strict_sorted (sorted_list_of_set A @ sorted_list_of_set B)

goal (1 subgoal):
 1. sorted_list_of_set (A \<union> B) = sorted_list_of_set A @ sorted_list_of_set B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
strict_sorted (sorted_list_of_set A @ sorted_list_of_set B)

goal (1 subgoal):
 1. sorted_list_of_set (A \<union> B) = sorted_list_of_set A @ sorted_list_of_set B
[PROOF STEP]
have "card A + card B = card (A \<union> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A + card B = card (A \<union> B)
[PROOF STEP]
using less_sets_imp_disjnt [OF AB]
[PROOF STATE]
proof (prove)
using this:
disjnt A B

goal (1 subgoal):
 1. card A + card B = card (A \<union> B)
[PROOF STEP]
by (simp add: assms card_Un_disjoint disjnt_def)
[PROOF STATE]
proof (state)
this:
card A + card B = card (A \<union> B)

goal (1 subgoal):
 1. sorted_list_of_set (A \<union> B) = sorted_list_of_set A @ sorted_list_of_set B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
strict_sorted (sorted_list_of_set A @ sorted_list_of_set B)
card A + card B = card (A \<union> B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
strict_sorted (sorted_list_of_set A @ sorted_list_of_set B)
card A + card B = card (A \<union> B)

goal (1 subgoal):
 1. sorted_list_of_set (A \<union> B) = sorted_list_of_set A @ sorted_list_of_set B
[PROOF STEP]
by (simp add: assms strict_sorted_equal)
[PROOF STATE]
proof (state)
this:
sorted_list_of_set (A \<union> B) = sorted_list_of_set A @ sorted_list_of_set B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma birthday_paradox:
  assumes "card S = 23" "card T = 365"
  shows "2 * card {f \<in> extensional_funcset S T. \<not> inj_on f S} \<ge> card (extensional_funcset S T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (S \<rightarrow>\<^sub>E T) \<le> 2 * card {f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (S \<rightarrow>\<^sub>E T) \<le> 2 * card {f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S}
[PROOF STEP]
from \<open>card S = 23\<close> \<open>card T = 365\<close>
[PROOF STATE]
proof (chain)
picking this:
card S = 23
card T = 365
[PROOF STEP]
have "finite S" "finite T" "card S <= card T"
[PROOF STATE]
proof (prove)
using this:
card S = 23
card T = 365

goal (1 subgoal):
 1. finite S &&& finite T &&& card S \<le> card T
[PROOF STEP]
by (auto intro: card_ge_0_finite)
[PROOF STATE]
proof (state)
this:
finite S
finite T
card S \<le> card T

goal (1 subgoal):
 1. card (S \<rightarrow>\<^sub>E T) \<le> 2 * card {f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
card S = 23
card T = 365
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card S = 23
card T = 365

goal (1 subgoal):
 1. card (S \<rightarrow>\<^sub>E T) \<le> 2 * card {f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S}
[PROOF STEP]
using card_PiE[OF \<open>finite S\<close>, of "\<lambda>i. T"] \<open>finite S\<close>
      card_extensional_funcset_not_inj_on[OF \<open>finite S\<close> \<open>finite T\<close> \<open>card S <= card T\<close>]
[PROOF STATE]
proof (prove)
using this:
card S = 23
card T = 365
card (S \<rightarrow>\<^sub>E T) = (\<Prod>i\<in>S. card T)
finite S
card {f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S} = card T ^ card S - fact (card T) div fact (card T - card S)

goal (1 subgoal):
 1. card (S \<rightarrow>\<^sub>E T) \<le> 2 * card {f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S}
[PROOF STEP]
by (simp add: fact_div_fact prod_upto_nat_unfold prod_constant)
[PROOF STATE]
proof (state)
this:
card (S \<rightarrow>\<^sub>E T) \<le> 2 * card {f \<in> S \<rightarrow>\<^sub>E T. \<not> inj_on f S}

goal:
No subgoals!
[PROOF STEP]
qed