[STATEMENT]
lemma binomial_deriv2:
    "(\<Sum>k\<le>n. (of_nat k * of_nat (k-1) * of_nat (n choose k)) * a^(k-2) * b^(n-k)) =
     of_nat n * of_nat (n-1) * (a+b::real)^(n-2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. real k * real (k - 1) * real (n choose k) * a ^ (k - 2) * b ^ (n - k)) = real n * real (n - 1) * (a + b) ^ (n - 2)
[PROOF STEP]
apply (rule DERIV_unique [where f = "\<lambda>a. of_nat n * (a+b::real)^(n-1)" and x=a])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((\<lambda>a. real n * (a + b) ^ (n - 1)) has_real_derivative (\<Sum>k\<le>n. real k * real (k - 1) * real (n choose k) * a ^ (k - 2) * b ^ (n - k))) (at a)
 2. ((\<lambda>a. real n * (a + b) ^ (n - 1)) has_real_derivative real n * real (n - 1) * (a + b) ^ (n - 2)) (at a)
[PROOF STEP]
apply (subst binomial_deriv1 [symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((\<lambda>a. \<Sum>k\<le>n. real k * real (n choose k) * a ^ (k - 1) * b ^ (n - k)) has_real_derivative (\<Sum>k\<le>n. real k * real (k - 1) * real (n choose k) * a ^ (k - 2) * b ^ (n - k))) (at a)
 2. ((\<lambda>a. real n * (a + b) ^ (n - 1)) has_real_derivative real n * real (n - 1) * (a + b) ^ (n - 2)) (at a)
[PROOF STEP]
apply (rule derivative_eq_intros sum.cong | simp add: Num.numeral_2_eq_2)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma open_Collect_ex: "(\<And>i. open {x. P i x}) \<Longrightarrow> open {x. \<exists>i. P i x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. open {x. P i x}) \<Longrightarrow> open {x. \<exists>i. P i x}
[PROOF STEP]
using open_UN[of UNIV "\<lambda>i. {x. P i x}"]
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>UNIV. open {xa. P x xa} \<Longrightarrow> open (\<Union>x. {xa. P x xa})

goal (1 subgoal):
 1. (\<And>i. open {x. P i x}) \<Longrightarrow> open {x. \<exists>i. P i x}
[PROOF STEP]
unfolding Collect_ex_eq
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>UNIV. open {xa. P x xa} \<Longrightarrow> open (\<Union>x. {xa. P x xa})

goal (1 subgoal):
 1. (\<And>i. open {x. P i x}) \<Longrightarrow> open (\<Union>y. {x. P y x})
[PROOF STEP]
by simp


[STATEMENT]
lemma convergent_erf_remainder_integral:
  assumes "x > 0"
  shows   "convergent (\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (-(t^2)) / t ^ (2*n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n)))
[PROOF STEP]
proof (intro Bseq_mono_convergent BseqI'; clarify?)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>na. norm (integral {x..x + real na} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))) \<le> ?K2
 2. \<And>m na. m \<le> na \<Longrightarrow> integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n)) \<le> integral {x..x + real na} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))
[PROOF STEP]
fix m :: nat
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>na. norm (integral {x..x + real na} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))) \<le> ?K2
 2. \<And>m na. m \<le> na \<Longrightarrow> integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n)) \<le> integral {x..x + real na} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))
[PROOF STEP]
show "norm (integral {x..x + real m} (\<lambda>t. exp (-t\<^sup>2) / t ^ (2*n))) \<le> exp (-x\<^sup>2) / x ^ (2*n+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))) \<le> exp (- x\<^sup>2) / x ^ (2 * n + 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. norm (integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))) \<le> exp (- x\<^sup>2) / x ^ (2 * n + 1)
[PROOF STEP]
by (rule erf_remainder_integral_aux_bound)
[PROOF STATE]
proof (state)
this:
norm (integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))) \<le> exp (- x\<^sup>2) / x ^ (2 * n + 1)

goal (1 subgoal):
 1. \<And>m na. m \<le> na \<Longrightarrow> integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n)) \<le> integral {x..x + real na} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))
[PROOF STEP]
qed (insert assms, auto intro!: integral_subset_le integrable_continuous_real continuous_intros)


[STATEMENT]
lemma mult_vec_zero_right: "p ** 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ** 0 = 0
[PROOF STEP]
by (rule poly_mapping_eqI_proj, simp add: term_simps)


[STATEMENT]
lemma poly_binomial:
  "[:(1::'a::comm_ring_1), 1:]^n = (\<Sum>k\<le>n. monom (of_nat (n choose k)) k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:1::'a, 1::'a:] ^ n = (\<Sum>k\<le>n. monom (of_nat (n choose k)) k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [:1::'a, 1::'a:] ^ n = (\<Sum>k\<le>n. monom (of_nat (n choose k)) k)
[PROOF STEP]
have "[:(1::'a::comm_ring_1), 1:]^n = (monom 1 1 + 1)^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:1::'a, 1::'a:] ^ n = (monom (1::'a) 1 + 1) ^ n
[PROOF STEP]
by (metis (no_types, lifting) add.left_neutral add.right_neutral add_pCons
        monom_altdef pCons_one power_one_right smult_1_left)
[PROOF STATE]
proof (state)
this:
[:1::'a, 1::'a:] ^ n = (monom (1::'a) 1 + 1) ^ n

goal (1 subgoal):
 1. [:1::'a, 1::'a:] ^ n = (\<Sum>k\<le>n. monom (of_nat (n choose k)) k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[:1::'a, 1::'a:] ^ n = (monom (1::'a) 1 + 1) ^ n

goal (1 subgoal):
 1. [:1::'a, 1::'a:] ^ n = (\<Sum>k\<le>n. monom (of_nat (n choose k)) k)
[PROOF STEP]
have "... = (\<Sum>k\<le>n. of_nat (n choose k) * monom 1 1 ^ k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (monom (1::'a) 1 + 1) ^ n = (\<Sum>k\<le>n. of_nat (n choose k) * monom (1::'a) 1 ^ k)
[PROOF STEP]
apply (subst binomial_ring)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. of_nat (n choose k) * monom (1::'a) 1 ^ k * 1 ^ (n - k)) = (\<Sum>k\<le>n. of_nat (n choose k) * monom (1::'a) 1 ^ k)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(monom (1::'a) 1 + 1) ^ n = (\<Sum>k\<le>n. of_nat (n choose k) * monom (1::'a) 1 ^ k)

goal (1 subgoal):
 1. [:1::'a, 1::'a:] ^ n = (\<Sum>k\<le>n. monom (of_nat (n choose k)) k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(monom (1::'a) 1 + 1) ^ n = (\<Sum>k\<le>n. of_nat (n choose k) * monom (1::'a) 1 ^ k)

goal (1 subgoal):
 1. [:1::'a, 1::'a:] ^ n = (\<Sum>k\<le>n. monom (of_nat (n choose k)) k)
[PROOF STEP]
have "... = (\<Sum>k\<le>n. monom (of_nat (n choose k)) k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. of_nat (n choose k) * monom (1::'a) 1 ^ k) = (\<Sum>k\<le>n. monom (of_nat (n choose k)) k)
[PROOF STEP]
by (auto simp: monom_altdef of_nat_poly)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n. of_nat (n choose k) * monom (1::'a) 1 ^ k) = (\<Sum>k\<le>n. monom (of_nat (n choose k)) k)

goal (1 subgoal):
 1. [:1::'a, 1::'a:] ^ n = (\<Sum>k\<le>n. monom (of_nat (n choose k)) k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[:1::'a, 1::'a:] ^ n = (\<Sum>k\<le>n. monom (of_nat (n choose k)) k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[:1::'a, 1::'a:] ^ n = (\<Sum>k\<le>n. monom (of_nat (n choose k)) k)

goal (1 subgoal):
 1. [:1::'a, 1::'a:] ^ n = (\<Sum>k\<le>n. monom (of_nat (n choose k)) k)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
[:1::'a, 1::'a:] ^ n = (\<Sum>k\<le>n. monom (of_nat (n choose k)) k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group_action) composition_rule:
  assumes "x \<in> E" "g1 \<in> carrier G" "g2 \<in> carrier G"
  shows "\<phi> (g1 \<otimes> g2) x = (\<phi> g1) (\<phi> g2 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (g1 \<otimes> g2) x = \<phi> g1 (\<phi> g2 x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<phi> (g1 \<otimes> g2) x = \<phi> g1 (\<phi> g2 x)
[PROOF STEP]
have "\<phi> (g1 \<otimes> g2) x = ((\<phi> g1) \<otimes>\<^bsub>BijGroup E\<^esub> (\<phi> g2)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> (g1 \<otimes> g2) x = (\<phi> g1 \<otimes>\<^bsub>BijGroup E\<^esub> \<phi> g2) x
[PROOF STEP]
using assms(2) assms(3) group_hom group_hom.hom_mult
[PROOF STATE]
proof (prove)
using this:
g1 \<in> carrier G
g2 \<in> carrier G
group_hom G (BijGroup E) \<phi>
\<lbrakk>group_hom ?G ?H ?h; ?x \<in> carrier ?G; ?y \<in> carrier ?G\<rbrakk> \<Longrightarrow> ?h (?x \<otimes>\<^bsub>?G\<^esub> ?y) = ?h ?x \<otimes>\<^bsub>?H\<^esub> ?h ?y

goal (1 subgoal):
 1. \<phi> (g1 \<otimes> g2) x = (\<phi> g1 \<otimes>\<^bsub>BijGroup E\<^esub> \<phi> g2) x
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<phi> (g1 \<otimes> g2) x = (\<phi> g1 \<otimes>\<^bsub>BijGroup E\<^esub> \<phi> g2) x

goal (1 subgoal):
 1. \<phi> (g1 \<otimes> g2) x = \<phi> g1 (\<phi> g2 x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> (g1 \<otimes> g2) x = (\<phi> g1 \<otimes>\<^bsub>BijGroup E\<^esub> \<phi> g2) x

goal (1 subgoal):
 1. \<phi> (g1 \<otimes> g2) x = \<phi> g1 (\<phi> g2 x)
[PROOF STEP]
have " ... = (compose E (\<phi> g1) (\<phi> g2)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<phi> g1 \<otimes>\<^bsub>BijGroup E\<^esub> \<phi> g2) x = compose E (\<phi> g1) (\<phi> g2) x
[PROOF STEP]
unfolding BijGroup_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<phi> g1 \<otimes>\<^bsub>\<lparr>carrier = Bij E, mult = \<lambda>g\<in>Bij E. restrict (compose E g) (Bij E), one = \<lambda>x\<in>E. x\<rparr>\<^esub> \<phi> g2) x = compose E (\<phi> g1) (\<phi> g2) x
[PROOF STEP]
by (simp add: assms bij_prop0)
[PROOF STATE]
proof (state)
this:
(\<phi> g1 \<otimes>\<^bsub>BijGroup E\<^esub> \<phi> g2) x = compose E (\<phi> g1) (\<phi> g2) x

goal (1 subgoal):
 1. \<phi> (g1 \<otimes> g2) x = \<phi> g1 (\<phi> g2 x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<phi> (g1 \<otimes> g2) x = compose E (\<phi> g1) (\<phi> g2) x
[PROOF STEP]
show "\<phi> (g1 \<otimes> g2) x = (\<phi> g1) (\<phi> g2 x)"
[PROOF STATE]
proof (prove)
using this:
\<phi> (g1 \<otimes> g2) x = compose E (\<phi> g1) (\<phi> g2) x

goal (1 subgoal):
 1. \<phi> (g1 \<otimes> g2) x = \<phi> g1 (\<phi> g2 x)
[PROOF STEP]
by (simp add: assms(1) compose_eq)
[PROOF STATE]
proof (state)
this:
\<phi> (g1 \<otimes> g2) x = \<phi> g1 (\<phi> g2 x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma negligible_countable_Union [intro]:
  assumes "countable \<F>" and meas: "\<And>S. S \<in> \<F> \<Longrightarrow> negligible S"
  shows "negligible (\<Union>\<F>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. negligible (\<Union> \<F>)
[PROOF STEP]
proof (cases "\<F> = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<F> = {} \<Longrightarrow> negligible (\<Union> \<F>)
 2. \<F> \<noteq> {} \<Longrightarrow> negligible (\<Union> \<F>)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<F> \<noteq> {}

goal (2 subgoals):
 1. \<F> = {} \<Longrightarrow> negligible (\<Union> \<F>)
 2. \<F> \<noteq> {} \<Longrightarrow> negligible (\<Union> \<F>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<F> \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<F> \<noteq> {}

goal (1 subgoal):
 1. negligible (\<Union> \<F>)
[PROOF STEP]
by (metis from_nat_into range_from_nat_into assms negligible_Union_nat)
[PROOF STATE]
proof (state)
this:
negligible (\<Union> \<F>)

goal (1 subgoal):
 1. \<F> = {} \<Longrightarrow> negligible (\<Union> \<F>)
[PROOF STEP]
qed simp


[STATEMENT]
lemma nonneg_matD: assumes "nonneg_mat A"
  and "i < dim_row A" and "j < dim_col A"
shows "A $$ (i,j) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> A $$ (i, j)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
nonneg_mat A
i < dim_row A
j < dim_col A

goal (1 subgoal):
 1. (0::'a) \<le> A $$ (i, j)
[PROOF STEP]
unfolding nonneg_mat_def elements_mat
[PROOF STATE]
proof (prove)
using this:
\<forall>a\<in>{A $$ (i, j) |i j. i < dim_row A \<and> j < dim_col A}. (0::'a) \<le> a
i < dim_row A
j < dim_col A

goal (1 subgoal):
 1. (0::'a) \<le> A $$ (i, j)
[PROOF STEP]
by auto


[STATEMENT]
lemma matrix_to_iarray_snd_Gauss_Jordan_PA:
shows "matrix_to_iarray (snd (Gauss_Jordan_PA A)) = snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (snd (Gauss_Jordan_PA A)) = snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))
[PROOF STEP]
unfolding Gauss_Jordan_PA_def Gauss_Jordan_iarrays_PA_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (snd (Gauss_Jordan_upt_k_PA A (ncols A - 1))) = snd (Gauss_Jordan_upt_k_iarrays_PA (matrix_to_iarray A) (ncols_iarray (matrix_to_iarray A) - 1))
[PROOF STEP]
using matrix_to_iarray_snd_Gauss_Jordan_upt_k_PA[of "ncols A - 1" A]
[PROOF STATE]
proof (prove)
using this:
ncols A - 1 < ncols A \<Longrightarrow> matrix_to_iarray (snd (Gauss_Jordan_upt_k_PA A (ncols A - 1))) = snd (Gauss_Jordan_upt_k_iarrays_PA (matrix_to_iarray A) (ncols A - 1))

goal (1 subgoal):
 1. matrix_to_iarray (snd (Gauss_Jordan_upt_k_PA A (ncols A - 1))) = snd (Gauss_Jordan_upt_k_iarrays_PA (matrix_to_iarray A) (ncols_iarray (matrix_to_iarray A) - 1))
[PROOF STEP]
by (simp add: ncols_def ncols_eq_card_columns)


[STATEMENT]
lemma mult_mat_of_col: "A \<in> carrier_mat nr nc \<Longrightarrow> v \<in> carrier_vec nc \<Longrightarrow>
                        A * mat_of_col v = mat_of_col (A *\<^sub>v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat nr nc; v \<in> carrier_vec nc\<rbrakk> \<Longrightarrow> A * mat_of_col v = mat_of_col (A *\<^sub>v v)
[PROOF STEP]
by (intro mat_col_eqI, auto)


[STATEMENT]
lemma sums_confine_mult:
  fixes f :: "nat \<Rightarrow> 'a::real_normed_algebra"
  shows "confine f N sums a \<Longrightarrow> confine (\<lambda>n. c * f n) N sums (c * a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. confine f N sums a \<Longrightarrow> confine (\<lambda>n. c * f n) N sums (c * a)
[PROOF STEP]
using sums_mult [of "confine f N" a c]
[PROOF STATE]
proof (prove)
using this:
confine f N sums a \<Longrightarrow> (\<lambda>n. c * confine f N n) sums (c * a)

goal (1 subgoal):
 1. confine f N sums a \<Longrightarrow> confine (\<lambda>n. c * f n) N sums (c * a)
[PROOF STEP]
by (simp add: confine_def if_distrib [of "(*)c"] cong: if_cong)


[STATEMENT]
lemma monom_vars_eval_monom:
  "(\<And> x. x \<in> monom_vars m \<Longrightarrow> f x = g x) \<Longrightarrow> eval_monom f m = eval_monom g m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> monom_vars m \<Longrightarrow> f x = g x) \<Longrightarrow> eval_monom f m = eval_monom g m
[PROOF STEP]
by (rule eval_monom_vars_list, auto simp: monom_vars_def)


[STATEMENT]
lemma  inter_sorted_correct_col:
  assumes "sorted (rev xs)"
      and "sorted (rev ys)"
    shows "(inter_sorted_rev xs ys) = rev (sorted_list_of_set (set xs \<inter> set ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inter_sorted_rev xs ys = rev (sorted_list_of_set (set xs \<inter> set ys))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev xs)
Sorted_Less.sorted (rev ys)

goal (1 subgoal):
 1. inter_sorted_rev xs ys = rev (sorted_list_of_set (set xs \<inter> set ys))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>Sorted_Less.sorted (rev xs); Sorted_Less.sorted (rev ys)\<rbrakk> \<Longrightarrow> inter_sorted_rev xs ys = rev (sorted_list_of_set (set xs \<inter> set ys))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted (rev xs)
Sorted_Less.sorted (rev ys)
[PROOF STEP]
have 1: "sorted (rev (inter_sorted_rev xs ys)) "
              and 2: "set (inter_sorted_rev xs ys) = set xs \<inter> set ys"
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev xs)
Sorted_Less.sorted (rev ys)

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (inter_sorted_rev xs ys)) &&& set (inter_sorted_rev xs ys) = set xs \<inter> set ys
[PROOF STEP]
using inter_sorted_correct
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev xs)
Sorted_Less.sorted (rev ys)
\<lbrakk>Sorted_Less.sorted (rev ?l1.0); Sorted_Less.sorted (rev ?l2.0)\<rbrakk> \<Longrightarrow> Sorted_Less.sorted (rev (inter_sorted_rev ?l1.0 ?l2.0)) \<and> set (inter_sorted_rev ?l1.0 ?l2.0) = set ?l1.0 \<inter> set ?l2.0

goal (1 subgoal):
 1. Sorted_Less.sorted (rev (inter_sorted_rev xs ys)) &&& set (inter_sorted_rev xs ys) = set xs \<inter> set ys
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (inter_sorted_rev xs ys))
set (inter_sorted_rev xs ys) = set xs \<inter> set ys

goal (1 subgoal):
 1. \<lbrakk>Sorted_Less.sorted (rev xs); Sorted_Less.sorted (rev ys)\<rbrakk> \<Longrightarrow> inter_sorted_rev xs ys = rev (sorted_list_of_set (set xs \<inter> set ys))
[PROOF STEP]
have "sorted (rev (rev (sorted_list_of_set (set xs \<inter> set ys))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorted_Less.sorted (rev (rev (sorted_list_of_set (set xs \<inter> set ys))))
[PROOF STEP]
by ( simp add:sorted_less_sorted_list_of_set)
[PROOF STATE]
proof (state)
this:
Sorted_Less.sorted (rev (rev (sorted_list_of_set (set xs \<inter> set ys))))

goal (1 subgoal):
 1. \<lbrakk>Sorted_Less.sorted (rev xs); Sorted_Less.sorted (rev ys)\<rbrakk> \<Longrightarrow> inter_sorted_rev xs ys = rev (sorted_list_of_set (set xs \<inter> set ys))
[PROOF STEP]
with 1 2
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted (rev (inter_sorted_rev xs ys))
set (inter_sorted_rev xs ys) = set xs \<inter> set ys
Sorted_Less.sorted (rev (rev (sorted_list_of_set (set xs \<inter> set ys))))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev (inter_sorted_rev xs ys))
set (inter_sorted_rev xs ys) = set xs \<inter> set ys
Sorted_Less.sorted (rev (rev (sorted_list_of_set (set xs \<inter> set ys))))

goal (1 subgoal):
 1. inter_sorted_rev xs ys = rev (sorted_list_of_set (set xs \<inter> set ys))
[PROOF STEP]
by (auto intro:sorted_less_rev_set_unique)
[PROOF STATE]
proof (state)
this:
inter_sorted_rev xs ys = rev (sorted_list_of_set (set xs \<inter> set ys))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma artanh_tanh_real: "artanh (tanh x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. artanh (tanh x) = x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. artanh (tanh x) = x
[PROOF STEP]
have "artanh (tanh x) = ln (cosh x * (cosh x + sinh x) / (cosh x * (cosh x - sinh x))) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. artanh (tanh x) = ln (cosh x * (cosh x + sinh x) / (cosh x * (cosh x - sinh x))) / 2
[PROOF STEP]
by (simp add: artanh_def tanh_def field_split_simps)
[PROOF STATE]
proof (state)
this:
artanh (tanh x) = ln (cosh x * (cosh x + sinh x) / (cosh x * (cosh x - sinh x))) / 2

goal (1 subgoal):
 1. artanh (tanh x) = x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
artanh (tanh x) = ln (cosh x * (cosh x + sinh x) / (cosh x * (cosh x - sinh x))) / 2

goal (1 subgoal):
 1. artanh (tanh x) = x
[PROOF STEP]
have "cosh x * (cosh x + sinh x) / (cosh x * (cosh x - sinh x)) =
               (cosh x + sinh x) / (cosh x - sinh x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cosh x * (cosh x + sinh x) / (cosh x * (cosh x - sinh x)) = (cosh x + sinh x) / (cosh x - sinh x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cosh x * (cosh x + sinh x) / (cosh x * (cosh x - sinh x)) = (cosh x + sinh x) / (cosh x - sinh x)

goal (1 subgoal):
 1. artanh (tanh x) = x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cosh x * (cosh x + sinh x) / (cosh x * (cosh x - sinh x)) = (cosh x + sinh x) / (cosh x - sinh x)

goal (1 subgoal):
 1. artanh (tanh x) = x
[PROOF STEP]
have "\<dots> = (exp x)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cosh x + sinh x) / (cosh x - sinh x) = (exp x)\<^sup>2
[PROOF STEP]
by (simp add: cosh_plus_sinh cosh_minus_sinh exp_minus field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
(cosh x + sinh x) / (cosh x - sinh x) = (exp x)\<^sup>2

goal (1 subgoal):
 1. artanh (tanh x) = x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(cosh x + sinh x) / (cosh x - sinh x) = (exp x)\<^sup>2

goal (1 subgoal):
 1. artanh (tanh x) = x
[PROOF STEP]
have "ln ((exp x)^2) / 2 = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln ((exp x)\<^sup>2) / 2 = x
[PROOF STEP]
by (simp add: ln_realpow)
[PROOF STATE]
proof (state)
this:
ln ((exp x)\<^sup>2) / 2 = x

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

goal (1 subgoal):
 1. artanh (tanh x) = x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
artanh (tanh x) = x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma INT_le_Suc_equals_Int:
     "(\<Inter>i \<in> atMost (Suc n). A i) =
      A 0 \<inter> (\<Inter>i \<in> atMost n. -A i \<union> A(Suc i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> (A ` {..Suc n}) = A 0 \<inter> (\<Inter>i\<le>n. - A i \<union> A (Suc i))
[PROOF STEP]
by (simp add: lessThan_Suc_atMost INT_le_equals_Int)


[STATEMENT]
lemma finite_ordering_bij:
  assumes orderingX: "ordering f ord X"
      and finiteX: "finite X"
      and non_empty: "X \<noteq> {}"
  shows "bij_betw f {0..card X - 1} X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw f {0..card X - 1} X
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bij_betw f {0..card X - 1} X
[PROOF STEP]
have f_image: "f ` {0..card X - 1} = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` {0..card X - 1} = X
[PROOF STEP]
by (metis orderingX finiteX finite_ordering_img non_empty)
[PROOF STATE]
proof (state)
this:
f ` {0..card X - 1} = X

goal (1 subgoal):
 1. bij_betw f {0..card X - 1} X
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f ` {0..card X - 1} = X

goal (1 subgoal):
 1. bij_betw f {0..card X - 1} X
[PROOF STEP]
by (metis inj_on_imp_bij_betw orderingX finiteX finite_ordering_inj_on)
[PROOF STATE]
proof (state)
this:
bij_betw f {0..card X - 1} X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma multiplicity_gt_zero_iff:
  shows   "multiplicity p x > 0 \<longleftrightarrow> p dvd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < multiplicity p x) = (p dvd x)
[PROOF STEP]
using power_dvd_iff_le_multiplicity[of 1]
[PROOF STATE]
proof (prove)
using this:
(p ^ 1 dvd x) = (1 \<le> multiplicity p x)

goal (1 subgoal):
 1. (0 < multiplicity p x) = (p dvd x)
[PROOF STEP]
by auto


[STATEMENT]
lemma inner_prod_vec_norm_pow2:
  shows "(vec_norm v)\<^sup>2 = v \<bullet>c v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (vec_norm v)\<^sup>2 = Complex_Matrix.inner_prod v v
[PROOF STEP]
using vec_norm_def
[PROOF STATE]
proof (prove)
using this:
vec_norm ?v \<equiv> csqrt (Complex_Matrix.inner_prod ?v ?v)

goal (1 subgoal):
 1. (vec_norm v)\<^sup>2 = Complex_Matrix.inner_prod v v
[PROOF STEP]
by (metis power2_csqrt)


[STATEMENT]
lemma path_add: "\<lbrakk>path f; path g\<rbrakk> \<Longrightarrow> path (\<lambda>t. f t + g t)" for f::"real\<Rightarrow>'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>path f; path g\<rbrakk> \<Longrightarrow> path (\<lambda>t. f t + g t)
[PROOF STEP]
unfolding path_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on {0..1} f; continuous_on {0..1} g\<rbrakk> \<Longrightarrow> continuous_on {0..1} (\<lambda>t. f t + g t)
[PROOF STEP]
by (intro continuous_intros)


[STATEMENT]
lemma ceiling_less_zero [simp]: "\<lceil>x\<rceil> < 0 \<longleftrightarrow> x \<le> -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lceil>x\<rceil> < 0) = (x \<le> - (1::'a))
[PROOF STEP]
by (simp add: ceiling_less_iff)


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

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

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

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

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

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

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

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

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

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

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

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem time_vebt_pred:   fixes t defines "u \<equiv> 2^n"
  shows "invar_vebt t n \<Longrightarrow> T\<^sub>p\<^sub>r\<^sub>e\<^sub>d t x \<le> 58 + 29 * lb (lb u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar_vebt t n \<Longrightarrow> real (T\<^sub>p\<^sub>r\<^sub>e\<^sub>d t x) \<le> 58 + 29 * log 2 (log 2 u)
[PROOF STEP]
unfolding u_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar_vebt t n \<Longrightarrow> real (T\<^sub>p\<^sub>r\<^sub>e\<^sub>d t x) \<le> 58 + 29 * log 2 (log 2 (2 ^ n))
[PROOF STEP]
by (meson pred_bound_size_univ)


[STATEMENT]
lemma jointfun_surj:"\<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> A; surj_to f {j. j \<le> (n::nat)} A;
      g \<in> {j. j \<le> (m::nat)} \<rightarrow> B; surj_to g {j. j \<le> m} B\<rbrakk> \<Longrightarrow>
       surj_to (jointfun n f m g) {j. j \<le> Suc (n + m)} (A \<union> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> A; surj_to f {j. j \<le> n} A; g \<in> {j. j \<le> m} \<rightarrow> B; surj_to g {j. j \<le> m} B\<rbrakk> \<Longrightarrow> surj_to (jointfun n f m g) {j. j \<le> Suc (n + m)} (A \<union> B)
[PROOF STEP]
apply (simp add:surj_to_def [of "jointfun n f m g"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> A; surj_to f {j. j \<le> n} A; g \<in> {j. j \<le> m} \<rightarrow> B; surj_to g {j. j \<le> m} B\<rbrakk> \<Longrightarrow> jointfun n f m g ` {j. j \<le> Suc (n + m)} = A \<union> B
[PROOF STEP]
apply (simp add:im_jointfun)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> A; surj_to f {j. j \<le> n} A; g \<in> {j. j \<le> m} \<rightarrow> B; surj_to g {j. j \<le> m} B\<rbrakk> \<Longrightarrow> f ` {j. j \<le> n} \<union> g ` {j. j \<le> m} = A \<union> B
[PROOF STEP]
apply (simp add:surj_to_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma iT_Mult_card: "0 < k \<Longrightarrow> card (I \<otimes> k) = card I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> card (I \<otimes> k) = card I
[PROOF STEP]
apply (unfold iT_Mult_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> card ((\<lambda>n. n * k) ` I) = card I
[PROOF STEP]
apply (rule card_image)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> inj_on (\<lambda>n. n * k) I
[PROOF STEP]
apply (rule inj_imp_inj_on)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> inj (\<lambda>n. n * k)
[PROOF STEP]
apply (rule mult_right_inj)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> 0 < k
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mtx_vec_mult_add_rdistl: "A *\<^sub>V (x + y) = A *\<^sub>V x + A *\<^sub>V y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>V (x + y) = A *\<^sub>V x + A *\<^sub>V y
[PROOF STEP]
unfolding plus_sq_mtx_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>V (x + y) = A *\<^sub>V x + A *\<^sub>V y
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A x y. A *v (x + y) = A *v x + A *v y
[PROOF STEP]
by (simp add: matrix_vector_right_distrib)


[STATEMENT]
lemma floor_has_real_derivative:
  fixes f :: "real \<Rightarrow> 'a::{floor_ceiling,order_topology}"
  assumes "isCont f x"
    and "f x \<notin> \<int>"
  shows "((\<lambda>x. floor (f x)) has_real_derivative 0) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. real_of_int \<lfloor>f x\<rfloor>) has_real_derivative 0) (at x)
[PROOF STEP]
proof (subst DERIV_cong_ev[OF refl _ refl])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>\<^sub>F x in nhds x. real_of_int \<lfloor>f x\<rfloor> = ?g x
 2. (?g has_real_derivative 0) (at x)
[PROOF STEP]
show "((\<lambda>_. floor (f x)) has_real_derivative 0) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>xa. real_of_int \<lfloor>f x\<rfloor>) has_real_derivative 0) (at x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>xa. real_of_int \<lfloor>f x\<rfloor>) has_real_derivative 0) (at x)

goal (1 subgoal):
 1. \<forall>\<^sub>F xa in nhds x. real_of_int \<lfloor>f xa\<rfloor> = real_of_int \<lfloor>f x\<rfloor>
[PROOF STEP]
have "\<forall>\<^sub>F y in at x. \<lfloor>f y\<rfloor> = \<lfloor>f x\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F y in at x. \<lfloor>f y\<rfloor> = \<lfloor>f x\<rfloor>
[PROOF STEP]
by (rule eventually_floor_eq[OF assms[unfolded continuous_at]])
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F y in at x. \<lfloor>f y\<rfloor> = \<lfloor>f x\<rfloor>

goal (1 subgoal):
 1. \<forall>\<^sub>F xa in nhds x. real_of_int \<lfloor>f xa\<rfloor> = real_of_int \<lfloor>f x\<rfloor>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F y in at x. \<lfloor>f y\<rfloor> = \<lfloor>f x\<rfloor>
[PROOF STEP]
show "\<forall>\<^sub>F y in nhds x. real_of_int \<lfloor>f y\<rfloor> = real_of_int \<lfloor>f x\<rfloor>"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F y in at x. \<lfloor>f y\<rfloor> = \<lfloor>f x\<rfloor>

goal (1 subgoal):
 1. \<forall>\<^sub>F y in nhds x. real_of_int \<lfloor>f y\<rfloor> = real_of_int \<lfloor>f x\<rfloor>
[PROOF STEP]
unfolding eventually_at_filter
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F xa in nhds x. xa \<noteq> x \<longrightarrow> xa \<in> UNIV \<longrightarrow> \<lfloor>f xa\<rfloor> = \<lfloor>f x\<rfloor>

goal (1 subgoal):
 1. \<forall>\<^sub>F y in nhds x. real_of_int \<lfloor>f y\<rfloor> = real_of_int \<lfloor>f x\<rfloor>
[PROOF STEP]
by eventually_elim auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F y in nhds x. real_of_int \<lfloor>f y\<rfloor> = real_of_int \<lfloor>f x\<rfloor>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma topology_finer_closedin:
  "topspace X = topspace Y \<Longrightarrow> (\<forall>S. openin Y S \<longrightarrow> openin X S) \<longleftrightarrow> (\<forall>S. closedin Y S \<longrightarrow> closedin X S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. topspace X = topspace Y \<Longrightarrow> (\<forall>S. openin Y S \<longrightarrow> openin X S) = (\<forall>S. closedin Y S \<longrightarrow> closedin X S)
[PROOF STEP]
by (metis closedin_def openin_closedin_eq)


[STATEMENT]
lemma poly_neighbourhood_same_sign:
  assumes "poly p (x\<^sub>0 :: real) \<noteq> 0"
  shows "eventually (\<lambda>x. sgn (poly p x) = sgn (poly p x\<^sub>0)) (at x\<^sub>0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at x\<^sub>0. sgn (poly p x) = sgn (poly p x\<^sub>0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at x\<^sub>0. sgn (poly p x) = sgn (poly p x\<^sub>0)
[PROOF STEP]
have cont: "isCont (\<lambda>x. sgn (poly p x)) x\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont (\<lambda>x. sgn (poly p x)) x\<^sub>0
[PROOF STEP]
by (rule isCont_sgn, rule poly_isCont, rule assms)
[PROOF STATE]
proof (state)
this:
isCont (\<lambda>x. sgn (poly p x)) x\<^sub>0

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at x\<^sub>0. sgn (poly p x) = sgn (poly p x\<^sub>0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
isCont (\<lambda>x. sgn (poly p x)) x\<^sub>0
[PROOF STEP]
have "eventually (\<lambda>x. \<bar>sgn (poly p x) - sgn (poly p x\<^sub>0)\<bar> < 1) (at x\<^sub>0)"
[PROOF STATE]
proof (prove)
using this:
isCont (\<lambda>x. sgn (poly p x)) x\<^sub>0

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at x\<^sub>0. \<bar>sgn (poly p x) - sgn (poly p x\<^sub>0)\<bar> < 1
[PROOF STEP]
by (auto simp: isCont_def tendsto_iff dist_real_def)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at x\<^sub>0. \<bar>sgn (poly p x) - sgn (poly p x\<^sub>0)\<bar> < 1

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at x\<^sub>0. sgn (poly p x) = sgn (poly p x\<^sub>0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at x\<^sub>0. \<bar>sgn (poly p x) - sgn (poly p x\<^sub>0)\<bar> < 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at x\<^sub>0. \<bar>sgn (poly p x) - sgn (poly p x\<^sub>0)\<bar> < 1

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at x\<^sub>0. sgn (poly p x) = sgn (poly p x\<^sub>0)
[PROOF STEP]
by (rule eventually_mono) (simp add: sgn_real_def split: if_split_asm)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at x\<^sub>0. sgn (poly p x) = sgn (poly p x\<^sub>0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homeomorphic_space_trans [trans]:
     "\<lbrakk>X1 homeomorphic_space X2; X2 homeomorphic_space X3\<rbrakk> \<Longrightarrow> X1 homeomorphic_space X3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X1 homeomorphic_space X2; X2 homeomorphic_space X3\<rbrakk> \<Longrightarrow> X1 homeomorphic_space X3
[PROOF STEP]
unfolding homeomorphic_space_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>f g. homeomorphic_maps X1 X2 f g; \<exists>f g. homeomorphic_maps X2 X3 f g\<rbrakk> \<Longrightarrow> \<exists>f g. homeomorphic_maps X1 X3 f g
[PROOF STEP]
by (metis homeomorphic_maps_compose)


[STATEMENT]
lemma line_integral_primitive_lemma: (*Only for real normed fields, i.e. vectors with products*)
  fixes f :: "'a::{euclidean_space,real_normed_field} \<Rightarrow> 'a::{euclidean_space,real_normed_field}" and
        g :: "real \<Rightarrow> 'a"
  assumes "\<And>(a::'a). a \<in> s \<Longrightarrow> (f has_field_derivative (f' a)) (at a within s)"
      and "g piecewise_differentiable_on {0::real..1}"  "\<And>x. x \<in> {0..1} \<Longrightarrow> g x \<in> s"
      and "base_vec \<in> Basis"
    shows "((\<lambda>x. ((f'(g x)) * (vector_derivative g (at x within {0..1}))) \<bullet> base_vec)
             has_integral (((f(g 1)) \<bullet> base_vec - (f(g 0)) \<bullet> base_vec))) {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
obtain k where k: "finite k" "\<forall>x\<in>{0..1} - k. g differentiable (at x within {0..1})" and cg: "continuous_on {0..1} g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. \<lbrakk>finite k; \<forall>x\<in>{0..1} - k. g differentiable at x within {0..1}; continuous_on {0..1} g\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?a \<in> s \<Longrightarrow> (f has_field_derivative f' ?a) (at ?a within s)
g piecewise_differentiable_on {0..1}
?x \<in> {0..1} \<Longrightarrow> g ?x \<in> s
base_vec \<in> Basis

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>finite k; \<forall>x\<in>{0..1} - k. g differentiable at x within {0..1}; continuous_on {0..1} g\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: piecewise_differentiable_on_def)
[PROOF STATE]
proof (state)
this:
finite k
\<forall>x\<in>{0..1} - k. g differentiable at x within {0..1}
continuous_on {0..1} g

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
have cfg: "continuous_on {0..1} (\<lambda>x. f (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {0..1} (\<lambda>x. f (g x))
[PROOF STEP]
apply (rule continuous_on_compose [OF cg, unfolded o_def])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (g ` {0..1}) f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?a \<in> s \<Longrightarrow> (f has_field_derivative f' ?a) (at ?a within s)
g piecewise_differentiable_on {0..1}
?x \<in> {0..1} \<Longrightarrow> g ?x \<in> s
base_vec \<in> Basis

goal (1 subgoal):
 1. continuous_on (g ` {0..1}) f
[PROOF STEP]
apply (metis field_differentiable_def field_differentiable_imp_continuous_at continuous_on_eq_continuous_within continuous_on_subset image_subset_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
continuous_on {0..1} (\<lambda>x. f (g x))

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
continuous_on {0..1} (\<lambda>x. f (g x))

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
fix x::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
assume a: "0 < x" and b: "x < 1" and xk: "x \<notin> k"
[PROOF STATE]
proof (state)
this:
0 < x
x < 1
x \<notin> k

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < x
x < 1
x \<notin> k
[PROOF STEP]
have "g differentiable at x within {0..1}"
[PROOF STATE]
proof (prove)
using this:
0 < x
x < 1
x \<notin> k

goal (1 subgoal):
 1. g differentiable at x within {0..1}
[PROOF STEP]
using k
[PROOF STATE]
proof (prove)
using this:
0 < x
x < 1
x \<notin> k
finite k
\<forall>x\<in>{0..1} - k. g differentiable at x within {0..1}

goal (1 subgoal):
 1. g differentiable at x within {0..1}
[PROOF STEP]
by (simp add: differentiable_at_withinI)
[PROOF STATE]
proof (state)
this:
g differentiable at x within {0..1}

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g differentiable at x within {0..1}
[PROOF STEP]
have "(g has_vector_derivative vector_derivative g (at x within {0..1})) (at x within {0..1})"
[PROOF STATE]
proof (prove)
using this:
g differentiable at x within {0..1}

goal (1 subgoal):
 1. (g has_vector_derivative vector_derivative g (at x within {0..1})) (at x within {0..1})
[PROOF STEP]
by (simp add: vector_derivative_works has_field_derivative_def scaleR_conv_of_real)
[PROOF STATE]
proof (state)
this:
(g has_vector_derivative vector_derivative g (at x within {0..1})) (at x within {0..1})

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(g has_vector_derivative vector_derivative g (at x within {0..1})) (at x within {0..1})
[PROOF STEP]
have gdiff: "(g has_derivative (\<lambda>u. of_real u * vector_derivative g (at x within {0..1}))) (at x within {0..1})"
[PROOF STATE]
proof (prove)
using this:
(g has_vector_derivative vector_derivative g (at x within {0..1})) (at x within {0..1})

goal (1 subgoal):
 1. (g has_derivative (\<lambda>u. of_real u * vector_derivative g (at x within {0..1}))) (at x within {0..1})
[PROOF STEP]
by (simp add: has_vector_derivative_def scaleR_conv_of_real)
[PROOF STATE]
proof (state)
this:
(g has_derivative (\<lambda>u. of_real u * vector_derivative g (at x within {0..1}))) (at x within {0..1})

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
have "(f has_field_derivative (f' (g x))) (at (g x) within g ` {0..1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_field_derivative f' (g x)) (at (g x) within g ` {0..1})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?a \<in> s \<Longrightarrow> (f has_field_derivative f' ?a) (at ?a within s)
g piecewise_differentiable_on {0..1}
?x \<in> {0..1} \<Longrightarrow> g ?x \<in> s
base_vec \<in> Basis

goal (1 subgoal):
 1. (f has_field_derivative f' (g x)) (at (g x) within g ` {0..1})
[PROOF STEP]
by (metis a atLeastAtMost_iff b DERIV_subset image_subset_iff less_eq_real_def)
[PROOF STATE]
proof (state)
this:
(f has_field_derivative f' (g x)) (at (g x) within g ` {0..1})

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(f has_field_derivative f' (g x)) (at (g x) within g ` {0..1})
[PROOF STEP]
have fdiff: "(f has_derivative (*) (f' (g x))) (at (g x) within g ` {0..1})"
[PROOF STATE]
proof (prove)
using this:
(f has_field_derivative f' (g x)) (at (g x) within g ` {0..1})

goal (1 subgoal):
 1. (f has_derivative (*) (f' (g x))) (at (g x) within g ` {0..1})
[PROOF STEP]
by (simp add: has_field_derivative_def)
[PROOF STATE]
proof (state)
this:
(f has_derivative (*) (f' (g x))) (at (g x) within g ` {0..1})

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
have "((\<lambda>x. f (g x)) has_vector_derivative f' (g x) * vector_derivative g (at x within {0..1})) (at x within {0..1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (g x)) has_vector_derivative f' (g x) * vector_derivative g (at x within {0..1})) (at x within {0..1})
[PROOF STEP]
using diff_chain_within [OF gdiff fdiff]
[PROOF STATE]
proof (prove)
using this:
(f \<circ> g has_derivative (*) (f' (g x)) \<circ> (\<lambda>u. of_real u * vector_derivative g (at x within {0..1}))) (at x within {0..1})

goal (1 subgoal):
 1. ((\<lambda>x. f (g x)) has_vector_derivative f' (g x) * vector_derivative g (at x within {0..1})) (at x within {0..1})
[PROOF STEP]
by (simp add: has_vector_derivative_def scaleR_conv_of_real o_def mult_ac)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (g x)) has_vector_derivative f' (g x) * vector_derivative g (at x within {0..1})) (at x within {0..1})

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < ?x2; ?x2 < 1; ?x2 \<notin> k\<rbrakk> \<Longrightarrow> ((\<lambda>x. f (g x)) has_vector_derivative f' (g ?x2) * vector_derivative g (at ?x2 within {0..1})) (at ?x2 within {0..1})

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < ?x2; ?x2 < 1; ?x2 \<notin> k\<rbrakk> \<Longrightarrow> ((\<lambda>x. f (g x)) has_vector_derivative f' (g ?x2) * vector_derivative g (at ?x2 within {0..1})) (at ?x2 within {0..1})
[PROOF STEP]
have *: "\<And>x. x\<in>{0<..<1} - k \<Longrightarrow> ((\<lambda>x. f (g x)) has_vector_derivative f' (g x) * vector_derivative g (at x within {0..1})) (at x within {0..1})"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?x2; ?x2 < 1; ?x2 \<notin> k\<rbrakk> \<Longrightarrow> ((\<lambda>x. f (g x)) has_vector_derivative f' (g ?x2) * vector_derivative g (at ?x2 within {0..1})) (at ?x2 within {0..1})

goal (1 subgoal):
 1. \<And>x. x \<in> {0<..<1} - k \<Longrightarrow> ((\<lambda>x. f (g x)) has_vector_derivative f' (g x) * vector_derivative g (at x within {0..1})) (at x within {0..1})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x \<in> {0<..<1} - k \<Longrightarrow> ((\<lambda>x. f (g x)) has_vector_derivative f' (g ?x) * vector_derivative g (at ?x within {0..1})) (at ?x within {0..1})

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
have "((\<lambda>x. ((f'(g x))) * ((vector_derivative g (at x within {0..1}))))
             has_integral (((f(g 1)) - (f(g 0))))) {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f' (g x) * vector_derivative g (at x within {0..1})) has_integral f (g 1) - f (g 0)) {0..1}
[PROOF STEP]
using fundamental_theorem_of_calculus_interior_strong[OF k(1) zero_le_one _ cfg]
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> {0<..<1} - k \<Longrightarrow> ((\<lambda>x. f (g x)) has_vector_derivative ?f' x) (at x)) \<Longrightarrow> (?f' has_integral f (g 1) - f (g 0)) {0..1}

goal (1 subgoal):
 1. ((\<lambda>x. f' (g x) * vector_derivative g (at x within {0..1})) has_integral f (g 1) - f (g 0)) {0..1}
[PROOF STEP]
using k assms cfg *
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> {0<..<1} - k \<Longrightarrow> ((\<lambda>x. f (g x)) has_vector_derivative ?f' x) (at x)) \<Longrightarrow> (?f' has_integral f (g 1) - f (g 0)) {0..1}
finite k
\<forall>x\<in>{0..1} - k. g differentiable at x within {0..1}
?a \<in> s \<Longrightarrow> (f has_field_derivative f' ?a) (at ?a within s)
g piecewise_differentiable_on {0..1}
?x \<in> {0..1} \<Longrightarrow> g ?x \<in> s
base_vec \<in> Basis
continuous_on {0..1} (\<lambda>x. f (g x))
?x \<in> {0<..<1} - k \<Longrightarrow> ((\<lambda>x. f (g x)) has_vector_derivative f' (g ?x) * vector_derivative g (at ?x within {0..1})) (at ?x within {0..1})

goal (1 subgoal):
 1. ((\<lambda>x. f' (g x) * vector_derivative g (at x within {0..1})) has_integral f (g 1) - f (g 0)) {0..1}
[PROOF STEP]
by (auto simp: at_within_Icc_at)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f' (g x) * vector_derivative g (at x within {0..1})) has_integral f (g 1) - f (g 0)) {0..1}

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. f' (g x) * vector_derivative g (at x within {0..1})) has_integral f (g 1) - f (g 0)) {0..1}
[PROOF STEP]
have "((\<lambda>x. (((f'(g x))) * ((vector_derivative g (at x within {0..1})))) \<bullet> base_vec)
             has_integral (((f(g 1)) - (f(g 0)))) \<bullet> base_vec) {0..1}"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. f' (g x) * vector_derivative g (at x within {0..1})) has_integral f (g 1) - f (g 0)) {0..1}

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral (f (g 1) - f (g 0)) \<bullet> base_vec) {0..1}
[PROOF STEP]
using has_integral_componentwise_iff assms(4)
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. f' (g x) * vector_derivative g (at x within {0..1})) has_integral f (g 1) - f (g 0)) {0..1}
(?f has_integral ?y) ?A = (\<forall>b\<in>Basis. ((\<lambda>x. ?f x \<bullet> b) has_integral ?y \<bullet> b) ?A)
base_vec \<in> Basis

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral (f (g 1) - f (g 0)) \<bullet> base_vec) {0..1}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral (f (g 1) - f (g 0)) \<bullet> base_vec) {0..1}

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral (f (g 1) - f (g 0)) \<bullet> base_vec) {0..1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral (f (g 1) - f (g 0)) \<bullet> base_vec) {0..1}

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
using inner_mult_left'
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral (f (g 1) - f (g 0)) \<bullet> base_vec) {0..1}
(?a * of_real ?m) \<bullet> ?b = ?m * (?a \<bullet> ?b)

goal (1 subgoal):
 1. ((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}
[PROOF STEP]
by (simp add: inner_mult_left' inner_diff_left)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. (f' (g x) * vector_derivative g (at x within {0..1})) \<bullet> base_vec) has_integral f (g 1) \<bullet> base_vec - f (g 0) \<bullet> base_vec) {0..1}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lnth_lappend2:
  "\<lbrakk> llength xs = enat k; k \<le> n \<rbrakk> \<Longrightarrow> lnth (lappend xs ys) n = lnth ys (n - k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>llength xs = enat k; k \<le> n\<rbrakk> \<Longrightarrow> lnth (lappend xs ys) n = lnth ys (n - k)
[PROOF STEP]
proof(induct n arbitrary: xs k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs k. \<lbrakk>llength xs = enat k; k \<le> 0\<rbrakk> \<Longrightarrow> lnth (lappend xs ys) 0 = lnth ys (0 - k)
 2. \<And>n xs k. \<lbrakk>\<And>xs k. \<lbrakk>llength xs = enat k; k \<le> n\<rbrakk> \<Longrightarrow> lnth (lappend xs ys) n = lnth ys (n - k); llength xs = enat k; k \<le> Suc n\<rbrakk> \<Longrightarrow> lnth (lappend xs ys) (Suc n) = lnth ys (Suc n - k)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
llength xs = enat k
k \<le> 0

goal (2 subgoals):
 1. \<And>xs k. \<lbrakk>llength xs = enat k; k \<le> 0\<rbrakk> \<Longrightarrow> lnth (lappend xs ys) 0 = lnth ys (0 - k)
 2. \<And>n xs k. \<lbrakk>\<And>xs k. \<lbrakk>llength xs = enat k; k \<le> n\<rbrakk> \<Longrightarrow> lnth (lappend xs ys) n = lnth ys (n - k); llength xs = enat k; k \<le> Suc n\<rbrakk> \<Longrightarrow> lnth (lappend xs ys) (Suc n) = lnth ys (Suc n - k)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
llength xs = enat k
k \<le> 0

goal (1 subgoal):
 1. lnth (lappend xs ys) 0 = lnth ys (0 - k)
[PROOF STEP]
by(simp add: zero_enat_def[symmetric] lappend_lnull1)
[PROOF STATE]
proof (state)
this:
lnth (lappend xs ys) 0 = lnth ys (0 - k)

goal (1 subgoal):
 1. \<And>n xs k. \<lbrakk>\<And>xs k. \<lbrakk>llength xs = enat k; k \<le> n\<rbrakk> \<Longrightarrow> lnth (lappend xs ys) n = lnth ys (n - k); llength xs = enat k; k \<le> Suc n\<rbrakk> \<Longrightarrow> lnth (lappend xs ys) (Suc n) = lnth ys (Suc n - k)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n xs k. \<lbrakk>\<And>xs k. \<lbrakk>llength xs = enat k; k \<le> n\<rbrakk> \<Longrightarrow> lnth (lappend xs ys) n = lnth ys (n - k); llength xs = enat k; k \<le> Suc n\<rbrakk> \<Longrightarrow> lnth (lappend xs ys) (Suc n) = lnth ys (Suc n - k)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>llength ?xs = enat ?k; ?k \<le> n\<rbrakk> \<Longrightarrow> lnth (lappend ?xs ys) n = lnth ys (n - ?k)
llength xs = enat k
k \<le> Suc n

goal (1 subgoal):
 1. \<And>n xs k. \<lbrakk>\<And>xs k. \<lbrakk>llength xs = enat k; k \<le> n\<rbrakk> \<Longrightarrow> lnth (lappend xs ys) n = lnth ys (n - k); llength xs = enat k; k \<le> Suc n\<rbrakk> \<Longrightarrow> lnth (lappend xs ys) (Suc n) = lnth ys (Suc n - k)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>llength ?xs = enat ?k; ?k \<le> n\<rbrakk> \<Longrightarrow> lnth (lappend ?xs ys) n = lnth ys (n - ?k)
llength xs = enat k
k \<le> Suc n

goal (1 subgoal):
 1. lnth (lappend xs ys) (Suc n) = lnth ys (Suc n - k)
[PROOF STEP]
by(cases xs)(auto simp add: eSuc_def zero_enat_def split: enat.split_asm)
[PROOF STATE]
proof (state)
this:
lnth (lappend xs ys) (Suc n) = lnth ys (Suc n - k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem conjunction: "valid (Con' p q) \<longleftrightarrow> valid p \<and> valid q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid (Con' p q) = (valid p \<and> valid q)
[PROOF STEP]
unfolding valid_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i. eval i (Con' p q) = Det True) = ((\<forall>i. eval i p = Det True) \<and> (\<forall>i. eval i q = Det True))
[PROOF STEP]
by auto


[STATEMENT]
lemma sq_mtx_one_idty: "1 * A = A" "A * 1 = A" for A :: "'a sq_mtx"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 * A = A &&& A * 1 = A
[PROOF STEP]
by(transfer, transfer, unfold mat_def matrix_matrix_mult_def, simp add: vec_eq_iff)+


[STATEMENT]
theorem findMin_correct:
  assumes I: "invar q"
  assumes NE: "q\<noteq>Nil"
  shows "findMin q \<in># queue_to_multiset q"
  "\<forall>y\<in>set_mset (queue_to_multiset q). snd (findMin q) \<le> snd y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. findMin q \<in># queue_to_multiset q &&& \<forall>y\<in>#queue_to_multiset q. snd (findMin q) \<le> snd y
[PROOF STEP]
using I NE findMin_mset
[PROOF STATE]
proof (prove)
using this:
invar q
q \<noteq> []
\<lbrakk>queue_invar ?q; ?q \<noteq> []\<rbrakk> \<Longrightarrow> findMin ?q \<in># queue_to_multiset ?q
\<lbrakk>queue_invar ?q; ?q \<noteq> []\<rbrakk> \<Longrightarrow> \<forall>y\<in>#queue_to_multiset ?q. snd (findMin ?q) \<le> snd y

goal (1 subgoal):
 1. findMin q \<in># queue_to_multiset q &&& \<forall>y\<in>#queue_to_multiset q. snd (findMin q) \<le> snd y
[PROOF STEP]
unfolding invar_def
[PROOF STATE]
proof (prove)
using this:
queue_invar q \<and> rank_skew_invar q
q \<noteq> []
\<lbrakk>queue_invar ?q; ?q \<noteq> []\<rbrakk> \<Longrightarrow> findMin ?q \<in># queue_to_multiset ?q
\<lbrakk>queue_invar ?q; ?q \<noteq> []\<rbrakk> \<Longrightarrow> \<forall>y\<in>#queue_to_multiset ?q. snd (findMin ?q) \<le> snd y

goal (1 subgoal):
 1. findMin q \<in># queue_to_multiset q &&& \<forall>y\<in>#queue_to_multiset q. snd (findMin q) \<le> snd y
[PROOF STEP]
by auto


[STATEMENT]
lemma circle_y_bounds:
  assumes "-1/2 \<le> (x::real) \<and> x \<le> 1/2"
  shows "0 \<le> circle_y x" "circle_y x \<le> 1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> circle_y x &&& circle_y x \<le> 1 / 2
[PROOF STEP]
unfolding circle_y_def real_sqrt_ge_0_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> 1 / 4 - x * x &&& sqrt (1 / 4 - x * x) \<le> 1 / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> 1 / 4 - x * x
 2. sqrt (1 / 4 - x * x) \<le> 1 / 2
[PROOF STEP]
show "0 \<le> 1/4 - x * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> 1 / 4 - x * x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
- 1 / 2 \<le> x \<and> x \<le> 1 / 2

goal (1 subgoal):
 1. 0 \<le> 1 / 4 - x * x
[PROOF STEP]
by (sos "(((A<0 * R<1) + ((A<=0 * (A<=1 * R<1)) * (R<1 * [1]^2))))")
[PROOF STATE]
proof (state)
this:
0 \<le> 1 / 4 - x * x

goal (1 subgoal):
 1. sqrt (1 / 4 - x * x) \<le> 1 / 2
[PROOF STEP]
show "sqrt (1/4 - x * x) \<le> 1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (1 / 4 - x * x) \<le> 1 / 2
[PROOF STEP]
apply (rule real_le_lsqrt)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 0 \<le> 1 / 4 - x * x
 2. 0 \<le> 1 / 2
 3. 1 / 4 - x * x \<le> (1 / 2)\<^sup>2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
- 1 / 2 \<le> x \<and> x \<le> 1 / 2

goal (3 subgoals):
 1. 0 \<le> 1 / 4 - x * x
 2. 0 \<le> 1 / 2
 3. 1 / 4 - x * x \<le> (1 / 2)\<^sup>2
[PROOF STEP]
apply(auto simp add: divide_simps algebra_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- 1 \<le> x * 2; x * 2 \<le> 1\<rbrakk> \<Longrightarrow> x * (x * 4) \<le> 1
[PROOF STEP]
by (sos "(((A<0 * R<1) + ((A<=0 * (A<=1 * R<1)) * (R<1 * [1]^2))))")
[PROOF STATE]
proof (state)
this:
sqrt (1 / 4 - x * x) \<le> 1 / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eventually_at_right_field:
  "eventually P (at_right x) \<longleftrightarrow> (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)"
  for x :: "'a::{linordered_field, linorder_topology}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (at_right x) = (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)
[PROOF STEP]
using linordered_field_no_ub[rule_format, of x]
[PROOF STATE]
proof (prove)
using this:
Ex ((<) x)

goal (1 subgoal):
 1. eventually P (at_right x) = (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)
[PROOF STEP]
by (auto simp: eventually_at_right)


[STATEMENT]
lemma Max_le_Min_conv_singleton: "
  \<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> (Max A \<le> Min A) = (\<exists>x. A = {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> (Max A \<le> Min A) = (\<exists>x. A = {x})
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite A; A \<noteq> {}; Max A \<le> Min A\<rbrakk> \<Longrightarrow> \<exists>x. A = {x}
 2. \<lbrakk>finite A; A \<noteq> {}; \<exists>x. A = {x}\<rbrakk> \<Longrightarrow> Max A \<le> Min A
[PROOF STEP]
apply (rule_tac x="Min A" in exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite A; A \<noteq> {}; Max A \<le> Min A\<rbrakk> \<Longrightarrow> A = {Min A}
 2. \<lbrakk>finite A; A \<noteq> {}; \<exists>x. A = {x}\<rbrakk> \<Longrightarrow> Max A \<le> Min A
[PROOF STEP]
apply (rule Max_le_Min_imp_singleton, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}; \<exists>x. A = {x}\<rbrakk> \<Longrightarrow> Max A \<le> Min A
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma binomial_int_ineq_1:
  assumes "0 \<le> x" and "0 \<le> (y::int)"
  shows "2 * (x + y gchoose k) \<le> x gchoose k + ((x + 2 * y) gchoose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (x + y gchoose k) \<le> x gchoose k + (x + 2 * y gchoose k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 * (x + y gchoose k) \<le> x gchoose k + (x + 2 * y gchoose k)
[PROOF STEP]
from binomial_ineq_1[of "nat x" "nat y" k]
[PROOF STATE]
proof (chain)
picking this:
2 * (nat x + nat y choose k) \<le> nat x choose k + (nat x + 2 * nat y choose k)
[PROOF STEP]
have "int (2 * (nat x + nat y choose k)) \<le> int (nat x choose k + (nat x + 2 * nat y choose k))"
[PROOF STATE]
proof (prove)
using this:
2 * (nat x + nat y choose k) \<le> nat x choose k + (nat x + 2 * nat y choose k)

goal (1 subgoal):
 1. int (2 * (nat x + nat y choose k)) \<le> int (nat x choose k + (nat x + 2 * nat y choose k))
[PROOF STEP]
by (simp only: zle_int)
[PROOF STATE]
proof (state)
this:
int (2 * (nat x + nat y choose k)) \<le> int (nat x choose k + (nat x + 2 * nat y choose k))

goal (1 subgoal):
 1. 2 * (x + y gchoose k) \<le> x gchoose k + (x + 2 * y gchoose k)
[PROOF STEP]
hence "2 * (int (nat x) + int (nat y) gchoose k) \<le> int (nat x) gchoose k + (int (nat x) + 2 * int (nat y) gchoose k)"
[PROOF STATE]
proof (prove)
using this:
int (2 * (nat x + nat y choose k)) \<le> int (nat x choose k + (nat x + 2 * nat y choose k))

goal (1 subgoal):
 1. 2 * (int (nat x) + int (nat y) gchoose k) \<le> int (nat x) gchoose k + (int (nat x) + 2 * int (nat y) gchoose k)
[PROOF STEP]
by (simp only: int_binomial int_plus int_ops(7)) simp
[PROOF STATE]
proof (state)
this:
2 * (int (nat x) + int (nat y) gchoose k) \<le> int (nat x) gchoose k + (int (nat x) + 2 * int (nat y) gchoose k)

goal (1 subgoal):
 1. 2 * (x + y gchoose k) \<le> x gchoose k + (x + 2 * y gchoose k)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 \<le> x
0 \<le> y
2 * (int (nat x) + int (nat y) gchoose k) \<le> int (nat x) gchoose k + (int (nat x) + 2 * int (nat y) gchoose k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
0 \<le> y
2 * (int (nat x) + int (nat y) gchoose k) \<le> int (nat x) gchoose k + (int (nat x) + 2 * int (nat y) gchoose k)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma val_ultrametric0:
  assumes "x \<in> nonzero Q\<^sub>p"
  assumes "y \<in> nonzero Q\<^sub>p"
  assumes "x \<oplus> y \<in> nonzero Q\<^sub>p"
  shows " min (val x) (val y) \<le> val (x \<oplus> y)  "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (val x) (val y) \<le> val (x \<oplus> y)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. min (val x) (val y) \<le> val (x \<oplus> y)
[PROOF STEP]
have 0: "val (x \<oplus> y) = ord (x \<oplus> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val (x \<oplus> y) = eint (ord (x \<oplus> y))
[PROOF STEP]
using assms(3) nonzero_def val_def[of "(x \<oplus> y)"]
[PROOF STATE]
proof (prove)
using this:
x \<oplus> y \<in> nonzero Q\<^sub>p
nonzero ?R = {a \<in> carrier ?R. a \<noteq> \<zero>\<^bsub>?R\<^esub>}
val (x \<oplus> y) = (if x \<oplus> y = \<zero> then \<infinity> else eint (ord (x \<oplus> y)))

goal (1 subgoal):
 1. val (x \<oplus> y) = eint (ord (x \<oplus> y))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
val (x \<oplus> y) = eint (ord (x \<oplus> y))

goal (1 subgoal):
 1. min (val x) (val y) \<le> val (x \<oplus> y)
[PROOF STEP]
have 1: "val x = ord x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val x = eint (ord x)
[PROOF STEP]
using assms(1) nonzero_def val_def
[PROOF STATE]
proof (prove)
using this:
x \<in> nonzero Q\<^sub>p
nonzero ?R = {a \<in> carrier ?R. a \<noteq> \<zero>\<^bsub>?R\<^esub>}
val ?x = (if ?x = \<zero> then \<infinity> else eint (ord ?x))

goal (1 subgoal):
 1. val x = eint (ord x)
[PROOF STEP]
by (simp add: nonzero_def)
[PROOF STATE]
proof (state)
this:
val x = eint (ord x)

goal (1 subgoal):
 1. min (val x) (val y) \<le> val (x \<oplus> y)
[PROOF STEP]
have 2: "val y = ord y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val y = eint (ord y)
[PROOF STEP]
using assms(2) nonzero_def val_def val_ord
[PROOF STATE]
proof (prove)
using this:
y \<in> nonzero Q\<^sub>p
nonzero ?R = {a \<in> carrier ?R. a \<noteq> \<zero>\<^bsub>?R\<^esub>}
val ?x = (if ?x = \<zero> then \<infinity> else eint (ord ?x))
?a \<in> nonzero Q\<^sub>p \<Longrightarrow> val ?a = eint (ord ?a)

goal (1 subgoal):
 1. val y = eint (ord y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
val y = eint (ord y)

goal (1 subgoal):
 1. min (val x) (val y) \<le> val (x \<oplus> y)
[PROOF STEP]
have 3: "ord (x \<oplus> y) \<ge> min (ord x) (ord y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (ord x) (ord y) \<le> ord (x \<oplus> y)
[PROOF STEP]
by (simp add: assms(1) assms(2) assms(3) ord_ultrametric)
[PROOF STATE]
proof (state)
this:
min (ord x) (ord y) \<le> ord (x \<oplus> y)

goal (1 subgoal):
 1. min (val x) (val y) \<le> val (x \<oplus> y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
min (ord x) (ord y) \<le> ord (x \<oplus> y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
min (ord x) (ord y) \<le> ord (x \<oplus> y)

goal (1 subgoal):
 1. min (val x) (val y) \<le> val (x \<oplus> y)
[PROOF STEP]
by (simp add: "0" "1" "2")
[PROOF STATE]
proof (state)
this:
min (val x) (val y) \<le> val (x \<oplus> y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem list_order_total:
  assumes "list_ops ops"
    and "x \<in> set (fst (interp_ops ops))"
    and "y \<in> set (fst (interp_ops ops))"
    and "x \<noteq> y"
  shows "list_order ops x y \<or> list_order ops y x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. List_Spec.list_order ops x y \<or> List_Spec.list_order ops y x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. List_Spec.list_order ops x y \<or> List_Spec.list_order ops y x
[PROOF STEP]
have "distinct (fst (interp_ops ops))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (fst (interp_ops ops))
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
list_ops ops

goal (1 subgoal):
 1. distinct (fst (interp_ops ops))
[PROOF STEP]
by (simp add: interp_ops_distinct)
[PROOF STATE]
proof (state)
this:
distinct (fst (interp_ops ops))

goal (1 subgoal):
 1. List_Spec.list_order ops x y \<or> List_Spec.list_order ops y x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distinct (fst (interp_ops ops))
[PROOF STEP]
obtain pre mid suf
    where "fst (interp_ops ops) = pre @ x # mid @ y # suf \<or>
           fst (interp_ops ops) = pre @ y # mid @ x # suf"
[PROOF STATE]
proof (prove)
using this:
distinct (fst (interp_ops ops))

goal (1 subgoal):
 1. (\<And>pre mid suf. fst (interp_ops ops) = pre @ x # mid @ y # suf \<or> fst (interp_ops ops) = pre @ y # mid @ x # suf \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using list_split_two_elems assms
[PROOF STATE]
proof (prove)
using this:
distinct (fst (interp_ops ops))
\<lbrakk>distinct ?xs; ?x \<in> set ?xs; ?y \<in> set ?xs; ?x \<noteq> ?y\<rbrakk> \<Longrightarrow> \<exists>pre mid suf. ?xs = pre @ ?x # mid @ ?y # suf \<or> ?xs = pre @ ?y # mid @ ?x # suf
list_ops ops
x \<in> set (fst (interp_ops ops))
y \<in> set (fst (interp_ops ops))
x \<noteq> y

goal (1 subgoal):
 1. (\<And>pre mid suf. fst (interp_ops ops) = pre @ x # mid @ y # suf \<or> fst (interp_ops ops) = pre @ y # mid @ x # suf \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
fst (interp_ops ops) = pre @ x # mid @ y # suf \<or> fst (interp_ops ops) = pre @ y # mid @ x # suf

goal (1 subgoal):
 1. List_Spec.list_order ops x y \<or> List_Spec.list_order ops y x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fst (interp_ops ops) = pre @ x # mid @ y # suf \<or> fst (interp_ops ops) = pre @ y # mid @ x # suf
[PROOF STEP]
show "list_order ops x y \<or> list_order ops y x"
[PROOF STATE]
proof (prove)
using this:
fst (interp_ops ops) = pre @ x # mid @ y # suf \<or> fst (interp_ops ops) = pre @ y # mid @ x # suf

goal (1 subgoal):
 1. List_Spec.list_order ops x y \<or> List_Spec.list_order ops y x
[PROOF STEP]
by (simp add: list_order_def, blast)
[PROOF STATE]
proof (state)
this:
List_Spec.list_order ops x y \<or> List_Spec.list_order ops y x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eval_fds_of_real [simp]:
  assumes "fds_converges f s"
  shows   "eval_fds (fds_of_real f) (of_real s :: 'a :: {nat_power_normed_field,banach}) =
             of_real (eval_fds f s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fds (fds_of_real f) (of_real s) = of_real (eval_fds f s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
fds_converges f s

goal (1 subgoal):
 1. eval_fds (fds_of_real f) (of_real s) = of_real (eval_fds f s)
[PROOF STEP]
unfolding eval_fds_def
[PROOF STATE]
proof (prove)
using this:
fds_converges f s

goal (1 subgoal):
 1. (\<Sum>n. fds_nth (fds_of_real f) n / nat_power n (of_real s)) = of_real (\<Sum>n. fds_nth f n / nat_power n s)
[PROOF STEP]
by (auto simp: fds_converges_def suminf_of_real)


[STATEMENT]
lemma minus_sin_cos_eq: "- sin x = cos (x + of_real pi/2)"
  for x :: "'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - sin x = cos (x + of_real pi / (2::'a))
[PROOF STEP]
by (simp add: cos_add nonzero_of_real_divide)


[STATEMENT]
lemma dis_log_break':
  assumes "y < order \<G>"
    and "\<not> m' < m"
    and "m \<noteq> m'"
    and m: "m' < order \<G>"
    and "\<^bold>g [^] d \<otimes> (\<^bold>g [^] y) [^] m = \<^bold>g [^] d' \<otimes> (\<^bold>g [^] y) [^] m'"
  shows "y = nat ((int d - int d') * fst (bezw ((m' - m)) (order \<G>)) mod int (order \<G>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y = nat ((int d - int d') * Number_Theory_Aux.inverse (m' - m) (order \<G>) mod int (order \<G>))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y = nat ((int d - int d') * Number_Theory_Aux.inverse (m' - m) (order \<G>) mod int (order \<G>))
[PROOF STEP]
have "m' > m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m < m'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
y < order \<G>
\<not> m' < m
m \<noteq> m'
m' < order \<G>
\<^bold>g [^] d \<otimes> (\<^bold>g [^] y) [^] m = \<^bold>g [^] d' \<otimes> (\<^bold>g [^] y) [^] m'

goal (1 subgoal):
 1. m < m'
[PROOF STEP]
using group_eq_pow_eq_mod nat_neq_iff order_gt_0
[PROOF STATE]
proof (prove)
using this:
y < order \<G>
\<not> m' < m
m \<noteq> m'
m' < order \<G>
\<^bold>g [^] d \<otimes> (\<^bold>g [^] y) [^] m = \<^bold>g [^] d' \<otimes> (\<^bold>g [^] y) [^] m'
\<lbrakk>\<^bold>g [^] ?a = \<^bold>g [^] ?b; 0 < order \<G>\<rbrakk> \<Longrightarrow> [?a = ?b] (mod order \<G>)
(?m \<noteq> ?n) = (?m < ?n \<or> ?n < ?m)
0 < order \<G>

goal (1 subgoal):
 1. m < m'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
m < m'

goal (1 subgoal):
 1. y = nat ((int d - int d') * Number_Theory_Aux.inverse (m' - m) (order \<G>) mod int (order \<G>))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
m < m'

goal (1 subgoal):
 1. y = nat ((int d - int d') * Number_Theory_Aux.inverse (m' - m) (order \<G>) mod int (order \<G>))
[PROOF STEP]
using dis_log_break[of d y m d' m' ]assms cong_sym_eq assms
[PROOF STATE]
proof (prove)
using this:
m < m'
\<lbrakk>\<^bold>g [^] d \<otimes> (\<^bold>g [^] y) [^] m = \<^bold>g [^] d' \<otimes> (\<^bold>g [^] y) [^] m'; y < order \<G>; m < m'; m' < order \<G>\<rbrakk> \<Longrightarrow> y = nat ((int d - int d') * Number_Theory_Aux.inverse (m' - m) (order \<G>) mod int (order \<G>))
y < order \<G>
\<not> m' < m
m \<noteq> m'
m' < order \<G>
\<^bold>g [^] d \<otimes> (\<^bold>g [^] y) [^] m = \<^bold>g [^] d' \<otimes> (\<^bold>g [^] y) [^] m'
[?b = ?c] (mod ?a) = [?c = ?b] (mod ?a)
y < order \<G>
\<not> m' < m
m \<noteq> m'
m' < order \<G>
\<^bold>g [^] d \<otimes> (\<^bold>g [^] y) [^] m = \<^bold>g [^] d' \<otimes> (\<^bold>g [^] y) [^] m'

goal (1 subgoal):
 1. y = nat ((int d - int d') * Number_Theory_Aux.inverse (m' - m) (order \<G>) mod int (order \<G>))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y = nat ((int d - int d') * Number_Theory_Aux.inverse (m' - m) (order \<G>) mod int (order \<G>))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_list_replicate:
  "sum_list (replicate n x) = n * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (replicate n x) = n * x
[PROOF STEP]
by (induct n) auto


[STATEMENT]
lemma vec0_plus[simp]: assumes "vec nr u" shows "vec_plus (vec0 nr) u = u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_plus (vec0 nr) u = u
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
vec nr u

goal (1 subgoal):
 1. vec_plus (vec0 nr) u = u
[PROOF STEP]
unfolding vec_def vec_plusI_def vec0I_def
[PROOF STATE]
proof (prove)
using this:
length u = nr

goal (1 subgoal):
 1. map (\<lambda>xy. fst xy + snd xy) (zip (replicate nr (0::'a)) u) = u
[PROOF STEP]
proof (induct nr arbitrary: u)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>u. length u = 0 \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip (replicate 0 (0::'a)) u) = u
 2. \<And>nr u. \<lbrakk>\<And>u. length u = nr \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip (replicate nr (0::'a)) u) = u; length u = Suc nr\<rbrakk> \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip (replicate (Suc nr) (0::'a)) u) = u
[PROOF STEP]
case (Suc nn)
[PROOF STATE]
proof (state)
this:
length ?u = nn \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip (replicate nn (0::'a)) ?u) = ?u
length u = Suc nn

goal (2 subgoals):
 1. \<And>u. length u = 0 \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip (replicate 0 (0::'a)) u) = u
 2. \<And>nr u. \<lbrakk>\<And>u. length u = nr \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip (replicate nr (0::'a)) u) = u; length u = Suc nr\<rbrakk> \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip (replicate (Suc nr) (0::'a)) u) = u
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
length ?u = nn \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip (replicate nn (0::'a)) ?u) = ?u
length u = Suc nn

goal (1 subgoal):
 1. map (\<lambda>xy. fst xy + snd xy) (zip (replicate (Suc nn) (0::'a)) u) = u
[PROOF STEP]
by (cases u, auto)
[PROOF STATE]
proof (state)
this:
map (\<lambda>xy. fst xy + snd xy) (zip (replicate (Suc nn) (0::'a)) u) = u

goal (1 subgoal):
 1. \<And>u. length u = 0 \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip (replicate 0 (0::'a)) u) = u
[PROOF STEP]
qed simp