[STATEMENT]
theorem (in finite_field) card_irred:
  assumes "n > 0"
  shows "n * card {f. monic_irreducible_poly R f \<and> degree f = n} =
    (\<Sum>d | d dvd n. moebius_mu d * (order R^(n div d)))"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}) = (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}) = (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d)))
[PROOF STEP]
have "?lhs = dirichlet_prod moebius_mu (\<lambda>x. int (order R) ^ x) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}) = dirichlet_prod moebius_mu ((^) (int (order R))) n
[PROOF STEP]
using card_irred_aux
[PROOF STATE]
proof (prove)
using this:
0 < ?n \<Longrightarrow> order R ^ ?n = (\<Sum>d | d dvd ?n. d * card {f. m_i_p R f \<and> Polynomials.degree f = d})

goal (1 subgoal):
 1. int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}) = dirichlet_prod moebius_mu ((^) (int (order R))) n
[PROOF STEP]
by (intro moebius_inversion assms) (simp flip:of_nat_power)
[PROOF STATE]
proof (state)
this:
int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}) = dirichlet_prod moebius_mu ((^) (int (order R))) n

goal (1 subgoal):
 1. int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}) = (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}) = dirichlet_prod moebius_mu ((^) (int (order R))) n

goal (1 subgoal):
 1. int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}) = (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d)))
[PROOF STEP]
have "... = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dirichlet_prod moebius_mu ((^) (int (order R))) n = (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d)))
[PROOF STEP]
by (simp add:dirichlet_prod_def)
[PROOF STATE]
proof (state)
this:
dirichlet_prod moebius_mu ((^) (int (order R))) n = (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d)))

goal (1 subgoal):
 1. int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}) = (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}) = (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}) = (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d)))

goal (1 subgoal):
 1. int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}) = (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int (n * card {f. m_i_p R f \<and> Polynomials.degree f = n}) = (\<Sum>d | d dvd n. moebius_mu d * int (order R ^ (n div d)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subset_list_set : "subset_list xs ys = ((set xs) \<subseteq> (set ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subset_list xs ys = (set xs \<subseteq> set ys)
[PROOF STEP]
unfolding subset_list.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all (\<lambda>x. x \<in> set ys) xs = (set xs \<subseteq> set ys)
[PROOF STEP]
by (simp add: Ball_set subset_code(1))


[STATEMENT]
lemma right_inv_of_unitary_transpose [simp]:
  assumes "unitary U"
  shows "U\<^sup>t * ((U\<^sup>t)\<^sup>\<dagger>) = 1\<^sub>m(dim_col U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U\<^sup>t * U\<^sup>t\<^sup>\<dagger> = 1\<^sub>m (dim_col U)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. U\<^sup>t * U\<^sup>t\<^sup>\<dagger> = 1\<^sub>m (dim_col U)
[PROOF STEP]
have "dim_col ((U\<^sup>t)\<^sup>\<star>) = dim_row U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col U\<^sup>t\<^sup>\<star> = dim_row U
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col U\<^sup>t\<^sup>\<star> = dim_row U

goal (1 subgoal):
 1. U\<^sup>t * U\<^sup>t\<^sup>\<dagger> = 1\<^sub>m (dim_col U)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dim_col U\<^sup>t\<^sup>\<star> = dim_row U
[PROOF STEP]
have "U\<^sup>t * ((U\<^sup>t)\<^sup>\<dagger>) = (((U\<^sup>t)\<^sup>\<star> * U)\<^sup>\<star>)"
[PROOF STATE]
proof (prove)
using this:
dim_col U\<^sup>t\<^sup>\<star> = dim_row U

goal (1 subgoal):
 1. U\<^sup>t * U\<^sup>t\<^sup>\<dagger> = U\<^sup>t\<^sup>\<star> * U\<^sup>\<star>
[PROOF STEP]
using cpx_mat_cnj_cnj cpx_mat_cnj_prod dagger_of_transpose_is_cnj
[PROOF STATE]
proof (prove)
using this:
dim_col U\<^sup>t\<^sup>\<star> = dim_row U
?M\<^sup>\<star>\<^sup>\<star> = ?M
dim_col ?M = dim_row ?N \<Longrightarrow> ?M * ?N\<^sup>\<star> = ?M\<^sup>\<star> * ?N\<^sup>\<star>
?M\<^sup>t\<^sup>\<dagger> = ?M\<^sup>\<star>

goal (1 subgoal):
 1. U\<^sup>t * U\<^sup>t\<^sup>\<dagger> = U\<^sup>t\<^sup>\<star> * U\<^sup>\<star>
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
U\<^sup>t * U\<^sup>t\<^sup>\<dagger> = U\<^sup>t\<^sup>\<star> * U\<^sup>\<star>

goal (1 subgoal):
 1. U\<^sup>t * U\<^sup>t\<^sup>\<dagger> = 1\<^sub>m (dim_col U)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
U\<^sup>t * U\<^sup>t\<^sup>\<dagger> = U\<^sup>t\<^sup>\<star> * U\<^sup>\<star>

goal (1 subgoal):
 1. U\<^sup>t * U\<^sup>t\<^sup>\<dagger> = 1\<^sub>m (dim_col U)
[PROOF STEP]
have "\<dots> = (U\<^sup>\<dagger> * U)\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U\<^sup>t\<^sup>\<star> * U\<^sup>\<star> = U\<^sup>\<dagger> * U\<^sup>\<star>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
U\<^sup>t\<^sup>\<star> * U\<^sup>\<star> = U\<^sup>\<dagger> * U\<^sup>\<star>

goal (1 subgoal):
 1. U\<^sup>t * U\<^sup>t\<^sup>\<dagger> = 1\<^sub>m (dim_col U)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
U\<^sup>t * U\<^sup>t\<^sup>\<dagger> = U\<^sup>\<dagger> * U\<^sup>\<star>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
U\<^sup>t * U\<^sup>t\<^sup>\<dagger> = U\<^sup>\<dagger> * U\<^sup>\<star>

goal (1 subgoal):
 1. U\<^sup>t * U\<^sup>t\<^sup>\<dagger> = 1\<^sub>m (dim_col U)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
U\<^sup>t * U\<^sup>t\<^sup>\<dagger> = U\<^sup>\<dagger> * U\<^sup>\<star>
unitary U

goal (1 subgoal):
 1. U\<^sup>t * U\<^sup>t\<^sup>\<dagger> = 1\<^sub>m (dim_col U)
[PROOF STEP]
by (metis cpx_mat_cnj_id unitary_def)
[PROOF STATE]
proof (state)
this:
U\<^sup>t * U\<^sup>t\<^sup>\<dagger> = 1\<^sub>m (dim_col U)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma N_of_norm_zero_space [simp]:
  "zero_space\<^sub>N N_of_norm = {0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zero_space\<^sub>N N_of_norm = {0::'a}
[PROOF STEP]
unfolding zero_space\<^sub>N_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f. eNorm N_of_norm f = 0} = {0::'a}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. eNorm N_of_norm x = 0 \<Longrightarrow> x = (0::'a)
[PROOF STEP]
unfolding N_of_norm(1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. ennreal (norm x) = 0 \<Longrightarrow> x = (0::'a)
[PROOF STEP]
by auto


[STATEMENT]
lemma rtrancl_edges_sym': "(u,v)\<in>(edges g)\<^sup>* \<Longrightarrow> (v,u)\<in>(edges g)\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u, v) \<in> (edges g)\<^sup>* \<Longrightarrow> (v, u) \<in> (edges g)\<^sup>*
[PROOF STEP]
by (simp add: edges_sym symD sym_rtrancl)


[STATEMENT]
lemma is_const_sum_mod_2:
  assumes "is_const"
  shows "(f 0 + f 1) mod 2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f 0 + f 1) mod 2 = 0
[PROOF STEP]
using assms is_const_def const_0_sum_mod_2 const_1_sum_mod_2
[PROOF STATE]
proof (prove)
using this:
is_const
is_const \<equiv> const 0 \<or> const 1
const 0 \<Longrightarrow> (f 0 + f 1) mod 2 = 0
const 1 \<Longrightarrow> (f 0 + f 1) mod 2 = 0

goal (1 subgoal):
 1. (f 0 + f 1) mod 2 = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma matrix_inv_Gauss:
fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}"
assumes inv_A: "invertible A" and Gauss_eq: "Gauss_Jordan A = P ** A"
shows "matrix_inv A = P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_inv A = P
[PROOF STEP]
proof (unfold matrix_inv_def, rule some1_equality)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>!A'. A ** A' = mat (1::'a) \<and> A' ** A = mat (1::'a)
 2. A ** P = mat (1::'a) \<and> P ** A = mat (1::'a)
[PROOF STEP]
show "\<exists>!A'. A ** A' = mat 1 \<and> A' ** A = mat 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!A'. A ** A' = mat (1::'a) \<and> A' ** A = mat (1::'a)
[PROOF STEP]
by (metis inv_A invertible_def matrix_inv_unique matrix_left_right_inverse)
[PROOF STATE]
proof (state)
this:
\<exists>!A'. A ** A' = mat (1::'a) \<and> A' ** A = mat (1::'a)

goal (1 subgoal):
 1. A ** P = mat (1::'a) \<and> P ** A = mat (1::'a)
[PROOF STEP]
show "A ** P = mat 1 \<and> P ** A = mat 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A ** P = mat (1::'a) \<and> P ** A = mat (1::'a)
[PROOF STEP]
by (metis Gauss_eq inv_A invertible_implies_rref_id matrix_left_right_inverse)
[PROOF STATE]
proof (state)
this:
A ** P = mat (1::'a) \<and> P ** A = mat (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eventually_at_top_within_linorder:
  assumes sn:"s \<noteq> {}"
  shows "eventually P (at_top_within s) \<longleftrightarrow> (\<exists>x0::'a::{linorder_topology} \<in> s. \<forall>x \<ge> x0. x\<in> s \<longrightarrow> P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (at_top_within s) = (\<exists>x0\<in>s. \<forall>x\<ge>x0. x \<in> s \<longrightarrow> P x)
[PROOF STEP]
unfolding at_top_within_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (INF k\<in>s. principal ({k..} \<inter> s)) = (\<exists>x0\<in>s. \<forall>x\<ge>x0. x \<in> s \<longrightarrow> P x)
[PROOF STEP]
apply (subst eventually_INF_base)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. s \<noteq> {}
 2. \<And>a b. \<lbrakk>a \<in> s; b \<in> s\<rbrakk> \<Longrightarrow> \<exists>x\<in>s. principal ({x..} \<inter> s) \<le> inf (principal ({a..} \<inter> s)) (principal ({b..} \<inter> s))
 3. (\<exists>b\<in>s. eventually P (principal ({b..} \<inter> s))) = (\<exists>x0\<in>s. \<forall>x\<ge>x0. x \<in> s \<longrightarrow> P x)
[PROOF STEP]
apply (auto simp:eventually_principal sn)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> s; b \<in> s\<rbrakk> \<Longrightarrow> \<exists>x\<in>s. {x..} \<inter> s \<subseteq> {a..} \<and> {x..} \<inter> s \<subseteq> {b..}
[PROOF STEP]
by (metis atLeast_subset_iff inf.coboundedI2 inf_commute linear)


[STATEMENT]
lemma Bseq_isUb: "\<And>X :: nat \<Rightarrow> real. Bseq X \<Longrightarrow> \<exists>U. isUb (UNIV::real set) {x. \<exists>n. X n = x} U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>X. Bseq X \<Longrightarrow> \<exists>U. isUb UNIV {x. \<exists>n. X n = x} U
[PROOF STEP]
by (auto intro: isUbI setleI simp add: Bseq_def abs_le_iff)


[STATEMENT]
lemma fps_exp_neg: "fps_exp (- a) = inverse (fps_exp (a::'a::field_char_0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_exp (- a) = inverse (fps_exp a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_exp (- a) = inverse (fps_exp a)
[PROOF STEP]
from fps_exp_add_mult[of a "- a"]
[PROOF STATE]
proof (chain)
picking this:
fps_exp (a + - a) = fps_exp a * fps_exp (- a)
[PROOF STEP]
have th0: "fps_exp a * fps_exp (- a) = 1"
[PROOF STATE]
proof (prove)
using this:
fps_exp (a + - a) = fps_exp a * fps_exp (- a)

goal (1 subgoal):
 1. fps_exp a * fps_exp (- a) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_exp a * fps_exp (- a) = 1

goal (1 subgoal):
 1. fps_exp (- a) = inverse (fps_exp a)
[PROOF STEP]
from fps_inverse_unique[OF th0]
[PROOF STATE]
proof (chain)
picking this:
inverse (fps_exp a) = fps_exp (- a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inverse (fps_exp a) = fps_exp (- a)

goal (1 subgoal):
 1. fps_exp (- a) = inverse (fps_exp a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_exp (- a) = inverse (fps_exp a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cf_adjunction_of_unit_AdjNT_NTMap_vdomain[adj_cs_simps]:
  assumes "\<FF> : \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \
"
  shows "\<D>\<^sub>\<circ> (cf_adjunction_of_unit \<alpha> \<FF> \<GG> \<eta>\<lparr>AdjNT\<rparr>\<lparr>NTMap\<rparr>) =
    (op_cat \<CC> \<times>\<^sub>C \
)\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_adjunction_of_unit \<alpha> \<FF> \<GG> \<eta>\<lparr>AdjNT\<rparr>\<lparr>NTMap\<rparr>) = (op_cat \<CC> \<times>\<^sub>C \
)\<lparr>Obj\<rparr>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<FF> : \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \

goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_adjunction_of_unit \<alpha> \<FF> \<GG> \<eta>\<lparr>AdjNT\<rparr>\<lparr>NTMap\<rparr>) = (op_cat \<CC> \<times>\<^sub>C \
)\<lparr>Obj\<rparr>
[PROOF STEP]
unfolding cf_adjunction_of_unit_components(3)
[PROOF STATE]
proof (prove)
using this:
\<FF> : \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \

goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (cf_adjunction_AdjNT_of_unit \<alpha> \<FF> \<GG> \<eta>\<lparr>NTMap\<rparr>) = (op_cat \<CC> \<times>\<^sub>C \
)\<lparr>Obj\<rparr>
[PROOF STEP]
by (rule cf_adjunction_AdjNT_of_unit_NTMap_vdomain)


[STATEMENT]
lemma gbinomial_parallel_sum: "(\<Sum>k\<le>n. (a + of_nat k) gchoose k) = (a + of_nat n + 1) gchoose n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. a + of_nat k gchoose k) = a + of_nat n + (1::'a) gchoose n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Sum>k\<le>0. a + of_nat k gchoose k) = a + of_nat 0 + (1::'a) gchoose 0
 2. \<And>n. (\<Sum>k\<le>n. a + of_nat k gchoose k) = a + of_nat n + (1::'a) gchoose n \<Longrightarrow> (\<Sum>k\<le>Suc n. a + of_nat k gchoose k) = a + of_nat (Suc n) + (1::'a) gchoose Suc n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (\<Sum>k\<le>0. a + of_nat k gchoose k) = a + of_nat 0 + (1::'a) gchoose 0
 2. \<And>n. (\<Sum>k\<le>n. a + of_nat k gchoose k) = a + of_nat n + (1::'a) gchoose n \<Longrightarrow> (\<Sum>k\<le>Suc n. a + of_nat k gchoose k) = a + of_nat (Suc n) + (1::'a) gchoose Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>0. a + of_nat k gchoose k) = a + of_nat 0 + (1::'a) gchoose 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>0. a + of_nat k gchoose k) = a + of_nat 0 + (1::'a) gchoose 0

goal (1 subgoal):
 1. \<And>n. (\<Sum>k\<le>n. a + of_nat k gchoose k) = a + of_nat n + (1::'a) gchoose n \<Longrightarrow> (\<Sum>k\<le>Suc n. a + of_nat k gchoose k) = a + of_nat (Suc n) + (1::'a) gchoose Suc n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (\<Sum>k\<le>n. a + of_nat k gchoose k) = a + of_nat n + (1::'a) gchoose n \<Longrightarrow> (\<Sum>k\<le>Suc n. a + of_nat k gchoose k) = a + of_nat (Suc n) + (1::'a) gchoose Suc n
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>m. a + of_nat k gchoose k) = a + of_nat m + (1::'a) gchoose m

goal (1 subgoal):
 1. \<And>n. (\<Sum>k\<le>n. a + of_nat k gchoose k) = a + of_nat n + (1::'a) gchoose n \<Longrightarrow> (\<Sum>k\<le>Suc n. a + of_nat k gchoose k) = a + of_nat (Suc n) + (1::'a) gchoose Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k\<le>m. a + of_nat k gchoose k) = a + of_nat m + (1::'a) gchoose m
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<le>m. a + of_nat k gchoose k) = a + of_nat m + (1::'a) gchoose m

goal (1 subgoal):
 1. (\<Sum>k\<le>Suc m. a + of_nat k gchoose k) = a + of_nat (Suc m) + (1::'a) gchoose Suc m
[PROOF STEP]
using gbinomial_Suc_Suc[of "(a + of_nat m + 1)" m]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<le>m. a + of_nat k gchoose k) = a + of_nat m + (1::'a) gchoose m
a + of_nat m + (1::'a) + (1::'a) gchoose Suc m = a + of_nat m + (1::'a) gchoose m + (a + of_nat m + (1::'a) gchoose Suc m)

goal (1 subgoal):
 1. (\<Sum>k\<le>Suc m. a + of_nat k gchoose k) = a + of_nat (Suc m) + (1::'a) gchoose Suc m
[PROOF STEP]
by (simp add: add_ac)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>Suc m. a + of_nat k gchoose k) = a + of_nat (Suc m) + (1::'a) gchoose Suc m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unitary_Z:
  shows "Complex_Matrix.unitary Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.unitary Z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Complex_Matrix.unitary Z
[PROOF STEP]
have "Complex_Matrix.adjoint Z * Z = (1\<^sub>m 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint Z * Z = 1\<^sub>m 2
[PROOF STEP]
using dagger_adjoint[of Z]
[PROOF STATE]
proof (prove)
using this:
Z\<^sup>\<dagger> = Complex_Matrix.adjoint Z

goal (1 subgoal):
 1. Complex_Matrix.adjoint Z * Z = 1\<^sub>m 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint Z * Z = 1\<^sub>m 2

goal (1 subgoal):
 1. Complex_Matrix.unitary Z
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.adjoint Z * Z = 1\<^sub>m 2

goal (1 subgoal):
 1. Complex_Matrix.unitary Z
[PROOF STEP]
unfolding unitary_def
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.adjoint Z * Z = 1\<^sub>m 2

goal (1 subgoal):
 1. Z \<in> carrier_mat (dim_row Z) (dim_row Z) \<and> inverts_mat Z (Complex_Matrix.adjoint Z)
[PROOF STEP]
by (metis Complex_Matrix.adjoint_adjoint Complex_Matrix.unitary_def Z_carrier adjoint_dim
        carrier_matD(1) inverts_mat_def unitary_adjoint)
[PROOF STATE]
proof (state)
this:
Complex_Matrix.unitary Z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma listrel_app_same_size: "size xs1 = size ys1 \<Longrightarrow> size xs2 = size ys2 \<Longrightarrow>
  (xs1@xs2, ys1@ys2) : listrel r \<longleftrightarrow>
  (xs1,ys1) : listrel r \<and> (xs2,ys2) : listrel r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs1 = length ys1; length xs2 = length ys2\<rbrakk> \<Longrightarrow> ((xs1 @ xs2, ys1 @ ys2) \<in> listrel r) = ((xs1, ys1) \<in> listrel r \<and> (xs2, ys2) \<in> listrel r)
[PROOF STEP]
by(auto simp add: listrel_iff_zip)


[STATEMENT]
lemma an_0[simp]:"an 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. an 0 = 0
[PROOF STEP]
by (simp add:an_def Zero_ant_def)


[STATEMENT]
lemma isUCont_def: "isUCont f \<longleftrightarrow> (\<forall>r>0. \<exists>s>0. \<forall>x y. dist x y < s \<longrightarrow> dist (f x) (f y) < r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isUCont f = (\<forall>r>0. \<exists>s>0. \<forall>x y. dist x y < s \<longrightarrow> dist (f x) (f y) < r)
[PROOF STEP]
by (auto simp: uniformly_continuous_on_def dist_commute)


[STATEMENT]
lemma powreal_minus:
    "a pow\<^sub>\<real> -x = inverse (a pow\<^sub>\<real> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a pow\<^sub>\<real> - x = inverse (a pow\<^sub>\<real> x)
[PROOF STEP]
proof (cases "a < 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a < 0 \<Longrightarrow> a pow\<^sub>\<real> - x = inverse (a pow\<^sub>\<real> x)
 2. \<not> a < 0 \<Longrightarrow> a pow\<^sub>\<real> - x = inverse (a pow\<^sub>\<real> x)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a < 0

goal (2 subgoals):
 1. a < 0 \<Longrightarrow> a pow\<^sub>\<real> - x = inverse (a pow\<^sub>\<real> x)
 2. \<not> a < 0 \<Longrightarrow> a pow\<^sub>\<real> - x = inverse (a pow\<^sub>\<real> x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a < 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a < 0

goal (1 subgoal):
 1. a pow\<^sub>\<real> - x = inverse (a pow\<^sub>\<real> x)
[PROOF STEP]
using powreal_def
[PROOF STATE]
proof (prove)
using this:
a < 0
?a pow\<^sub>\<real> ?x = (if 0 < ?a \<and> ?a < 1 then inverse ?a powa - ?x else if 1 \<le> ?a then ?a powa ?x else 0)

goal (1 subgoal):
 1. a pow\<^sub>\<real> - x = inverse (a pow\<^sub>\<real> x)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
a pow\<^sub>\<real> - x = inverse (a pow\<^sub>\<real> x)

goal (1 subgoal):
 1. \<not> a < 0 \<Longrightarrow> a pow\<^sub>\<real> - x = inverse (a pow\<^sub>\<real> x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> a < 0 \<Longrightarrow> a pow\<^sub>\<real> - x = inverse (a pow\<^sub>\<real> x)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> a < 0

goal (1 subgoal):
 1. \<not> a < 0 \<Longrightarrow> a pow\<^sub>\<real> - x = inverse (a pow\<^sub>\<real> x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> a < 0
[PROOF STEP]
have "a pow\<^sub>\<real> (x + -x) = a pow\<^sub>\<real> x * a pow\<^sub>\<real> -x"
[PROOF STATE]
proof (prove)
using this:
\<not> a < 0

goal (1 subgoal):
 1. a pow\<^sub>\<real> (x + - x) = a pow\<^sub>\<real> x * a pow\<^sub>\<real> - x
[PROOF STEP]
using powreal_add
[PROOF STATE]
proof (prove)
using this:
\<not> a < 0
?a pow\<^sub>\<real> (?x + ?y) = ?a pow\<^sub>\<real> ?x * ?a pow\<^sub>\<real> ?y

goal (1 subgoal):
 1. a pow\<^sub>\<real> (x + - x) = a pow\<^sub>\<real> x * a pow\<^sub>\<real> - x
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
a pow\<^sub>\<real> (x + - x) = a pow\<^sub>\<real> x * a pow\<^sub>\<real> - x

goal (1 subgoal):
 1. \<not> a < 0 \<Longrightarrow> a pow\<^sub>\<real> - x = inverse (a pow\<^sub>\<real> x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a pow\<^sub>\<real> (x + - x) = a pow\<^sub>\<real> x * a pow\<^sub>\<real> - x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a pow\<^sub>\<real> (x + - x) = a pow\<^sub>\<real> x * a pow\<^sub>\<real> - x

goal (1 subgoal):
 1. a pow\<^sub>\<real> - x = inverse (a pow\<^sub>\<real> x)
[PROOF STEP]
using inverse_unique powreal_def powreal_zero_eq_one
[PROOF STATE]
proof (prove)
using this:
a pow\<^sub>\<real> (x + - x) = a pow\<^sub>\<real> x * a pow\<^sub>\<real> - x
?a * ?b = (1::?'a) \<Longrightarrow> inverse ?a = ?b
?a pow\<^sub>\<real> ?x = (if 0 < ?a \<and> ?a < 1 then inverse ?a powa - ?x else if 1 \<le> ?a then ?a powa ?x else 0)
0 < ?a \<Longrightarrow> ?a pow\<^sub>\<real> 0 = 1

goal (1 subgoal):
 1. a pow\<^sub>\<real> - x = inverse (a pow\<^sub>\<real> x)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
a pow\<^sub>\<real> - x = inverse (a pow\<^sub>\<real> x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zeta_partial_sum_neg_asymp_equiv:
  assumes "s > 0"
  shows "sum_upto (\<lambda>n. n powr s) \<sim>[at_top] (\<lambda>x. x powr (1 + s) / (1 + s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. real n powr s) \<sim>[at_top] (\<lambda>x. x powr (1 + s) / (1 + s))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. real n powr s) \<sim>[at_top] (\<lambda>x. x powr (1 + s) / (1 + s))
[PROOF STEP]
from zeta_partial_sum_le_neg[of s] assms
[PROOF STATE]
proof (chain)
picking this:
0 < s \<Longrightarrow> \<exists>c>0. \<forall>x\<ge>1. \<bar>sum_upto (\<lambda>n. real n powr s) x - x powr (1 + s) / (1 + s)\<bar> \<le> c * x powr s
0 < s
[PROOF STEP]
obtain c where
    c: "c > 0" "\<forall>x\<ge>1. \<bar>sum_upto (\<lambda>x. real x powr s) x - x powr (1 + s) / (1 + s)\<bar> \<le> c * x powr s"
[PROOF STATE]
proof (prove)
using this:
0 < s \<Longrightarrow> \<exists>c>0. \<forall>x\<ge>1. \<bar>sum_upto (\<lambda>n. real n powr s) x - x powr (1 + s) / (1 + s)\<bar> \<le> c * x powr s
0 < s

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>0 < c; \<forall>x\<ge>1. \<bar>sum_upto (\<lambda>x. real x powr s) x - x powr (1 + s) / (1 + s)\<bar> \<le> c * x powr s\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < c
\<forall>x\<ge>1. \<bar>sum_upto (\<lambda>x. real x powr s) x - x powr (1 + s) / (1 + s)\<bar> \<le> c * x powr s

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real n powr s) \<sim>[at_top] (\<lambda>x. x powr (1 + s) / (1 + s))
[PROOF STEP]
hence "(\<lambda>x. sum_upto (\<lambda>x. real x powr s) x - x powr (1 + s) / (1 + s)) \<in> O(\<lambda>x. x powr s)"
[PROOF STATE]
proof (prove)
using this:
0 < c
\<forall>x\<ge>1. \<bar>sum_upto (\<lambda>x. real x powr s) x - x powr (1 + s) / (1 + s)\<bar> \<le> c * x powr s

goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>x. real x powr s) x - x powr (1 + s) / (1 + s)) \<in> O(\<lambda>x. x powr s)
[PROOF STEP]
by (intro bigoI[of _ c] eventually_mono[OF eventually_ge_at_top[of 1]]) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sum_upto (\<lambda>x. real x powr s) x - x powr (1 + s) / (1 + s)) \<in> O(\<lambda>x. x powr s)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real n powr s) \<sim>[at_top] (\<lambda>x. x powr (1 + s) / (1 + s))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sum_upto (\<lambda>x. real x powr s) x - x powr (1 + s) / (1 + s)) \<in> O(\<lambda>x. x powr s)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real n powr s) \<sim>[at_top] (\<lambda>x. x powr (1 + s) / (1 + s))
[PROOF STEP]
have "(\<lambda>x. x powr s) \<in> o(\<lambda>x. x powr (1 + s) / (1 + s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x powr s) \<in> o(\<lambda>x. x powr (1 + s) / (1 + s))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < s

goal (1 subgoal):
 1. (\<lambda>x. x powr s) \<in> o(\<lambda>x. x powr (1 + s) / (1 + s))
[PROOF STEP]
by real_asymp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x powr s) \<in> o(\<lambda>x. x powr (1 + s) / (1 + s))

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real n powr s) \<sim>[at_top] (\<lambda>x. x powr (1 + s) / (1 + s))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. sum_upto (\<lambda>x. real x powr s) x - x powr (1 + s) / (1 + s)) \<in> o(\<lambda>x. x powr (1 + s) / (1 + s))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. sum_upto (\<lambda>x. real x powr s) x - x powr (1 + s) / (1 + s)) \<in> o(\<lambda>x. x powr (1 + s) / (1 + s))

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real n powr s) \<sim>[at_top] (\<lambda>x. x powr (1 + s) / (1 + s))
[PROOF STEP]
by (rule smallo_imp_asymp_equiv)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. real n powr s) \<sim>[at_top] (\<lambda>x. x powr (1 + s) / (1 + s))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fds_converges_add:
  assumes "fds_converges f s" "fds_converges g s"
  shows   "fds_converges (f + g) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_converges (f + g) s
[PROOF STEP]
using summable_add[OF assms[unfolded fds_converges_def]]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. fds_nth f n / nat_power n s + fds_nth g n / nat_power n s)

goal (1 subgoal):
 1. fds_converges (f + g) s
[PROOF STEP]
by (simp add: fds_converges_def add_divide_distrib)


[STATEMENT]
lemma const_smallo_ln_chain: "(\<lambda>_. 1) \<in> o((ln::real\<Rightarrow>real)^^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>_. 1) \<in> o(ln ^^ n)
[PROOF STEP]
proof (intro smalloI_tendsto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ((\<lambda>x. 1 / (ln ^^ n) x) \<longlongrightarrow> 0) at_top
 2. \<forall>\<^sub>F x in at_top. (ln ^^ n) x \<noteq> 0
[PROOF STEP]
show "((\<lambda>x::real. 1 / (ln^^n) x) \<longlongrightarrow> 0) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. 1 / (ln ^^ n) x) \<longlongrightarrow> 0) at_top
[PROOF STEP]
by (rule tendsto_divide_0 tendsto_const filterlim_at_top_imp_at_infinity
             fun_chain_at_top_at_top ln_at_top)+
[PROOF STATE]
proof (state)
this:
((\<lambda>x. 1 / (ln ^^ n) x) \<longlongrightarrow> 0) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (ln ^^ n) x \<noteq> 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (ln ^^ n) x \<noteq> 0
[PROOF STEP]
from fun_chain_at_top_at_top[OF ln_at_top, of n]
[PROOF STATE]
proof (chain)
picking this:
filterlim (ln ^^ n) at_top at_top
[PROOF STEP]
have "eventually (\<lambda>x::real. (ln^^n) x > 0) at_top"
[PROOF STATE]
proof (prove)
using this:
filterlim (ln ^^ n) at_top at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < (ln ^^ n) x
[PROOF STEP]
by (simp add: filterlim_at_top_dense)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. 0 < (ln ^^ n) x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (ln ^^ n) x \<noteq> 0
[PROOF STEP]
thus "eventually (\<lambda>x::real. (ln^^n) x \<noteq> 0) at_top"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. 0 < (ln ^^ n) x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (ln ^^ n) x \<noteq> 0
[PROOF STEP]
by eventually_elim simp_all
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. (ln ^^ n) x \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_diff_mult: "(x * y - a * b) = x * (y - b) + (x - a) * b"
  for x y a b :: "'a::ring"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * y - a * b = x * (y - b) + (x - a) * b
[PROOF STEP]
by (simp add: algebra_simps)


[STATEMENT]
lemma nn_integral_real_affine:
  fixes c :: real assumes [measurable]: "f \<in> borel_measurable borel" and c: "c \<noteq> 0"
  shows "(\<integral>\<^sup>+x. f x \<partial>lborel) = \<bar>c\<bar> * (\<integral>\<^sup>+x. f (t + c * x) \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N lborel f = ennreal \<bar>c\<bar> * \<integral>\<^sup>+ x. f (t + c * x) \<partial>lborel
[PROOF STEP]
by (subst lborel_real_affine[OF c, of t])
     (simp add: nn_integral_density nn_integral_distr nn_integral_cmult)


[STATEMENT]
lemma snds_neq_img_snds_neq:
  assumes "\<forall>(t,e) \<in> fset xs. \<forall>(t2,e2) \<in> fset xs. e\<noteq>e2 \<or> (t,e) = (t2,e2)"
  shows "\<forall>(t1,e1) \<in> fset ((\<lambda>(t1,e1). (f t1, e1)) |`| xs).
          \<forall>(t2,e2) \<in> fset ((\<lambda>(t1,e1). (f t1, e1)) |`| xs). e1\<noteq>e2 \<or> (t1,e1) = (t2,e2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>(t1, e1)\<in>fset ((\<lambda>(t1, e1). (f t1, e1)) |`| xs). \<forall>(t2, e2)\<in>fset ((\<lambda>(t1, e1). (f t1, e1)) |`| xs). e1 \<noteq> e2 \<or> (t1, e1) = (t2, e2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>(t, e)\<in>fset xs. \<forall>(t2, e2)\<in>fset xs. e \<noteq> e2 \<or> (t, e) = (t2, e2)

goal (1 subgoal):
 1. \<forall>(t1, e1)\<in>fset ((\<lambda>(t1, e1). (f t1, e1)) |`| xs). \<forall>(t2, e2)\<in>fset ((\<lambda>(t1, e1). (f t1, e1)) |`| xs). e1 \<noteq> e2 \<or> (t1, e1) = (t2, e2)
[PROOF STEP]
by auto


[STATEMENT]
lemma Cauchy_theorem_flat_lemma:
  assumes f: "continuous_on (convex hull {a,b,c}) f"
      and c: "c - a = k *\<^sub>R (b - a)"
      and k: "0 \<le> k"
    shows "contour_integral (linepath a b) f + contour_integral (linepath b c) f +
          contour_integral (linepath c a) f = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = 0
[PROOF STEP]
have fabc: "continuous_on (closed_segment a b) f" "continuous_on (closed_segment b c) f" "continuous_on (closed_segment c a) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (closed_segment a b) f &&& continuous_on (closed_segment b c) f &&& continuous_on (closed_segment c a) f
[PROOF STEP]
using f continuous_on_subset segments_subset_convex_hull
[PROOF STATE]
proof (prove)
using this:
continuous_on (convex hull {a, b, c}) f
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f
closed_segment ?a ?b \<subseteq> convex hull {?a, ?b, ?c}
closed_segment ?a ?c \<subseteq> convex hull {?a, ?b, ?c}
closed_segment ?b ?c \<subseteq> convex hull {?a, ?b, ?c}
closed_segment ?b ?a \<subseteq> convex hull {?a, ?b, ?c}
closed_segment ?c ?a \<subseteq> convex hull {?a, ?b, ?c}
closed_segment ?c ?b \<subseteq> convex hull {?a, ?b, ?c}

goal (1 subgoal):
 1. continuous_on (closed_segment a b) f &&& continuous_on (closed_segment b c) f &&& continuous_on (closed_segment c a) f
[PROOF STEP]
by metis+
[PROOF STATE]
proof (state)
this:
continuous_on (closed_segment a b) f
continuous_on (closed_segment b c) f
continuous_on (closed_segment c a) f

goal (1 subgoal):
 1. contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = 0
[PROOF STEP]
proof (cases "k \<le> 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k \<le> 1 \<Longrightarrow> contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = 0
 2. \<not> k \<le> 1 \<Longrightarrow> contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = 0
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
k \<le> 1

goal (2 subgoals):
 1. k \<le> 1 \<Longrightarrow> contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = 0
 2. \<not> k \<le> 1 \<Longrightarrow> contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = 0
[PROOF STEP]
by (simp add: contour_integral_split [OF fabc(1) k True c] contour_integral_reverse_linepath fabc)
[PROOF STATE]
proof (state)
this:
contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = 0

goal (1 subgoal):
 1. \<not> k \<le> 1 \<Longrightarrow> contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> k \<le> 1 \<Longrightarrow> contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = 0
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> k \<le> 1

goal (1 subgoal):
 1. \<not> k \<le> 1 \<Longrightarrow> contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = 0
[PROOF STEP]
proof (subst contour_integral_split [symmetric])
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. continuous_on (closed_segment a c) f
 2. 0 \<le> ?k
 3. ?k \<le> 1
 4. b - a = ?k *\<^sub>R (c - a)
 5. contour_integral (linepath a c) f + contour_integral (linepath c a) f = 0
[PROOF STEP]
show "b - a = (1/k) *\<^sub>R (c - a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b - a = (1 / k) *\<^sub>R (c - a)
[PROOF STEP]
using False c
[PROOF STATE]
proof (prove)
using this:
\<not> k \<le> 1
c - a = k *\<^sub>R (b - a)

goal (1 subgoal):
 1. b - a = (1 / k) *\<^sub>R (c - a)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
b - a = (1 / k) *\<^sub>R (c - a)

goal (4 subgoals):
 1. continuous_on (closed_segment a c) f
 2. 0 \<le> 1 / k
 3. 1 / k \<le> 1
 4. contour_integral (linepath a c) f + contour_integral (linepath c a) f = 0
[PROOF STEP]
show "contour_integral (linepath a c) f + contour_integral (linepath c a) f = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (linepath a c) f + contour_integral (linepath c a) f = 0
[PROOF STEP]
by (simp add: contour_integral_reverse_linepath fabc(3))
[PROOF STATE]
proof (state)
this:
contour_integral (linepath a c) f + contour_integral (linepath c a) f = 0

goal (3 subgoals):
 1. continuous_on (closed_segment a c) f
 2. 0 \<le> 1 / k
 3. 1 / k \<le> 1
[PROOF STEP]
show "continuous_on (closed_segment a c) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (closed_segment a c) f
[PROOF STEP]
by (metis closed_segment_commute fabc(3))
[PROOF STATE]
proof (state)
this:
continuous_on (closed_segment a c) f

goal (2 subgoals):
 1. 0 \<le> 1 / k
 2. 1 / k \<le> 1
[PROOF STEP]
qed (use False in auto)
[PROOF STATE]
proof (state)
this:
contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c a) f = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_list_of_set_length: "length (sorted_list_of_set A) = card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (sorted_list_of_set A) = card A
[PROOF STEP]
using distinct_card sorted_list_of_set[of A]
[PROOF STATE]
proof (prove)
using this:
distinct ?xs \<Longrightarrow> card (set ?xs) = length ?xs
finite A \<Longrightarrow> set (sorted_list_of_set A) = A
sorted (sorted_list_of_set A)
distinct (sorted_list_of_set A)

goal (1 subgoal):
 1. length (sorted_list_of_set A) = card A
[PROOF STEP]
by (cases "finite A") fastforce+


[STATEMENT]
lemma has_sum_superconst_infinite_enat:
  fixes f :: \<open>'a \<Rightarrow> enat\<close>
  assumes \<open>\<And>x. x \<in> S \<Longrightarrow> f x \<ge> b\<close>
  assumes \<open>b > 0\<close>
  assumes \<open>infinite S\<close>
  shows "has_sum f S \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_sum f S \<infinity>
[PROOF STEP]
by (metis assms i0_lb has_sum_infsum infsum_superconst_infinite_enat nonneg_summable_on_complete)


[STATEMENT]
theorem element_match:
 "matrix_match A1 A2 B1 B2 \<Longrightarrow>(\<forall>i<((row_length A1)*(row_length B1)).
                              \<forall>j<((length A2)*(length B2)).
(((A1 \<circ> A2)\<otimes>(B1 \<circ>  B2))!j!i
                  = ((A1 \<otimes> B1)\<circ>(A2 \<otimes> B2))!j!i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_match A1 A2 B1 B2 \<Longrightarrow> \<forall>i<row_length A1 * row_length B1. \<forall>j<length A2 * length B2. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = ((A1 \<otimes> B1) \<circ> (A2 \<otimes> B2)) ! j ! i
[PROOF STEP]
using prelim_element_match
[PROOF STATE]
proof (prove)
using this:
matrix_match ?A1.0 ?A2.0 ?B1.0 ?B2.0 \<Longrightarrow> \<forall>i j. i < row_length ?A1.0 * row_length ?B1.0 \<and> j < length ?A2.0 * length ?B2.0 \<longrightarrow> (?A1.0 \<circ> ?A2.0 \<otimes> ?B1.0 \<circ> ?B2.0) ! j ! i = ((?A1.0 \<otimes> ?B1.0) \<circ> (?A2.0 \<otimes> ?B2.0)) ! j ! i

goal (1 subgoal):
 1. matrix_match A1 A2 B1 B2 \<Longrightarrow> \<forall>i<row_length A1 * row_length B1. \<forall>j<length A2 * length B2. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = ((A1 \<otimes> B1) \<circ> (A2 \<otimes> B2)) ! j ! i
[PROOF STEP]
by auto


[STATEMENT]
lemma prodinf_le_const:
  fixes f :: "nat \<Rightarrow> real"
  assumes "convergent_prod f" "\<And>n. prod f {..<n} \<le> x"
  shows "prodinf f \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prodinf f \<le> x
[PROOF STEP]
by (metis lessThan_Suc_atMost assms convergent_prod_LIMSEQ LIMSEQ_le_const2)


[STATEMENT]
lemma convex_prod:
  assumes "\<And>i. i \<in> Basis \<Longrightarrow> convex {x. P i x}"
  shows "convex {x. \<forall>i\<in>Basis. P i (x\<bullet>i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex {x. \<forall>i\<in>Basis. P i (x \<bullet> i)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?i \<in> Basis \<Longrightarrow> convex {x. P ?i x}

goal (1 subgoal):
 1. convex {x. \<forall>i\<in>Basis. P i (x \<bullet> i)}
[PROOF STEP]
unfolding convex_def
[PROOF STATE]
proof (prove)
using this:
?i \<in> Basis \<Longrightarrow> \<forall>x\<in>Collect (P ?i). \<forall>y\<in>Collect (P ?i). \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> Collect (P ?i)

goal (1 subgoal):
 1. \<forall>x\<in>{x. \<forall>i\<in>Basis. P i (x \<bullet> i)}. \<forall>y\<in>{x. \<forall>i\<in>Basis. P i (x \<bullet> i)}. \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> {x. \<forall>i\<in>Basis. P i (x \<bullet> i)}
[PROOF STEP]
by (auto simp: inner_add_left)


[STATEMENT]
lemma cosh_dist_at_least_1:
  assumes "a \<in> hyp2" and "b \<in> hyp2"
  shows "cosh_dist a b \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> cosh_dist a b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 \<le> cosh_dist a b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
a \<in> hyp2
b \<in> hyp2
[PROOF STEP]
have "exp_2dist a b > 0"
[PROOF STATE]
proof (prove)
using this:
a \<in> hyp2
b \<in> hyp2

goal (1 subgoal):
 1. 0 < exp_2dist a b
[PROOF STEP]
by (rule exp_2dist_positive)
[PROOF STATE]
proof (state)
this:
0 < exp_2dist a b

goal (1 subgoal):
 1. 1 \<le> cosh_dist a b
[PROOF STEP]
with am_gm2(1) [of "sqrt (exp_2dist a b)" "sqrt (1 / exp_2dist a b)"]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 \<le> sqrt (exp_2dist a b); 0 \<le> sqrt (1 / exp_2dist a b)\<rbrakk> \<Longrightarrow> sqrt (sqrt (exp_2dist a b) * sqrt (1 / exp_2dist a b)) \<le> (sqrt (exp_2dist a b) + sqrt (1 / exp_2dist a b)) / 2
0 < exp_2dist a b
[PROOF STEP]
show "cosh_dist a b \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> sqrt (exp_2dist a b); 0 \<le> sqrt (1 / exp_2dist a b)\<rbrakk> \<Longrightarrow> sqrt (sqrt (exp_2dist a b) * sqrt (1 / exp_2dist a b)) \<le> (sqrt (exp_2dist a b) + sqrt (1 / exp_2dist a b)) / 2
0 < exp_2dist a b

goal (1 subgoal):
 1. 1 \<le> cosh_dist a b
[PROOF STEP]
by (unfold cosh_dist_def) (simp add: real_sqrt_mult [symmetric])
[PROOF STATE]
proof (state)
this:
1 \<le> cosh_dist a b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma word_diff_less:
  fixes n :: "'a :: len word"
  shows "\<lbrakk>0 < n; 0 < m; n \<le> m\<rbrakk> \<Longrightarrow> m - n < m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; 0 < m; n \<le> m\<rbrakk> \<Longrightarrow> m - n < m
[PROOF STEP]
apply (subst word_less_nat_alt)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; 0 < m; n \<le> m\<rbrakk> \<Longrightarrow> unat (m - n) < unat m
[PROOF STEP]
apply (subst unat_sub)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < n; 0 < m; n \<le> m\<rbrakk> \<Longrightarrow> n \<le> m
 2. \<lbrakk>0 < n; 0 < m; n \<le> m\<rbrakk> \<Longrightarrow> unat m - unat n < unat m
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; 0 < m; n \<le> m\<rbrakk> \<Longrightarrow> unat m - unat n < unat m
[PROOF STEP]
apply (rule diff_less)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < n; 0 < m; n \<le> m\<rbrakk> \<Longrightarrow> 0 < unat n
 2. \<lbrakk>0 < n; 0 < m; n \<le> m\<rbrakk> \<Longrightarrow> 0 < unat m
[PROOF STEP]
apply (simp_all add: word_less_nat_alt)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cf_prod_2_Rel_ObjMap_app[cat_cs_simps]:
  assumes "AB = [A, B]\<^sub>\<circ>" and "AB \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C \<AA>)\<lparr>Obj\<rparr>"
  shows "A \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>cf_prod_2_Rel \<AA>\<^esub> B = A \<times>\<^sub>\<circ> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>cf_prod_2_Rel \<AA>\<^esub> B = A \<times>\<^sub>\<circ> B
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
AB \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C \<AA>)\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. A \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>cf_prod_2_Rel \<AA>\<^esub> B = A \<times>\<^sub>\<circ> B
[PROOF STEP]
unfolding assms(1) cf_prod_2_Rel_components
[PROOF STATE]
proof (prove)
using this:
[A, B]\<^sub>\<circ> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C \<AA>)\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. (\<lambda>AB\<in>\<^sub>\<circ>(\<AA> \<times>\<^sub>C \<AA>)\<lparr>Obj\<rparr>. AB\<lparr>[]\<^sub>\<circ>\<rparr> \<times>\<^sub>\<circ> AB\<lparr>1\<^sub>\<nat>\<rparr>) \<lparr>A, B\<rparr>\<^sub>\<bullet> = A \<times>\<^sub>\<circ> B
[PROOF STEP]
by (simp add: nat_omega_simps)


[STATEMENT]
lemma range_eq:
  fixes a::"'a::linorder"
  assumes non_empty: "a \<le> b"
  shows "({a..b} = {c..d}) = (a = c \<and> b = d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({a..b} = {c..d}) = (a = c \<and> b = d)
[PROOF STEP]
by (metis atLeastatMost_subset_iff eq_iff non_empty)


[STATEMENT]
lemma GDERIV_add:
    "\<lbrakk>GDERIV f x :> df; GDERIV g x :> dg\<rbrakk>
     \<Longrightarrow> GDERIV (\<lambda>x. f x + g x) x :> df + dg"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>GDERIV f x :> df; GDERIV g x :> dg\<rbrakk> \<Longrightarrow> GDERIV (\<lambda>x. f x + g x) x :> df + dg
[PROOF STEP]
unfolding gderiv_def inner_add_right
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_derivative (\<lambda>h. inner h df)) (at x); (g has_derivative (\<lambda>h. inner h dg)) (at x)\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x + g x) has_derivative (\<lambda>h. inner h df + inner h dg)) (at x)
[PROOF STEP]
by (rule has_derivative_add)


[STATEMENT]
lemma N_2: "N 2 = 1 / (q ^ 2 * (q - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N 2 = 1 / (q\<^sup>2 * (q - 1))
[PROOF STEP]
using q_gt_1
[PROOF STATE]
proof (prove)
using this:
1 < q

goal (1 subgoal):
 1. N 2 = 1 / (q\<^sup>2 * (q - 1))
[PROOF STEP]
by (auto simp: N_prime N_1 field_simps power2_eq_square)


[STATEMENT]
lemma Lim_transform_eventually:
  "\<lbrakk>(f \<longlongrightarrow> l) F; eventually (\<lambda>x. f x = g x) F\<rbrakk> \<Longrightarrow> (g \<longlongrightarrow> l) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> l) F; \<forall>\<^sub>F x in F. f x = g x\<rbrakk> \<Longrightarrow> (g \<longlongrightarrow> l) F
[PROOF STEP]
using eventually_elim2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>eventually ?P ?F; eventually ?Q ?F; \<And>i. \<lbrakk>?P i; ?Q i\<rbrakk> \<Longrightarrow> ?R i\<rbrakk> \<Longrightarrow> eventually ?R ?F

goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> l) F; \<forall>\<^sub>F x in F. f x = g x\<rbrakk> \<Longrightarrow> (g \<longlongrightarrow> l) F
[PROOF STEP]
by (fastforce simp add: tendsto_def)


[STATEMENT]
lemma complex_i_not_one [simp]: "\<i> \<noteq> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<i> \<noteq> 1
[PROOF STEP]
by (simp add: complex_eq_iff)


[STATEMENT]
lemma matrix_mult_0_left [simp]:
  "0 *\<^sub>M (A::('a::{comm_monoid_add,mult_zero},'m,'n) matrix) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 *\<^sub>M A = 0
[PROOF STEP]
by (cases A, simp add: zero_matrix_def)


[STATEMENT]
lemma take_bit_numeral_minus_numeral_int:
  \<open>take_bit (numeral m) (- numeral n :: int) =
    (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))\<close> (is \<open>?lhs = ?rhs\<close>)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
proof (cases \<open>take_bit_num (numeral m) n\<close>)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. take_bit_num (numeral m) n = None \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
 2. \<And>a. take_bit_num (numeral m) n = Some a \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
case None
[PROOF STATE]
proof (state)
this:
take_bit_num (numeral m) n = None

goal (2 subgoals):
 1. take_bit_num (numeral m) n = None \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
 2. \<And>a. take_bit_num (numeral m) n = Some a \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
take_bit_num (numeral m) n = None
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
take_bit_num (numeral m) n = None

goal (1 subgoal):
 1. take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
by (auto dest: take_bit_num_eq_None_imp [where ?'a = int] simp add: take_bit_eq_0_iff)
[PROOF STATE]
proof (state)
this:
take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))

goal (1 subgoal):
 1. \<And>a. take_bit_num (numeral m) n = Some a \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. take_bit_num (numeral m) n = Some a \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
case (Some q)
[PROOF STATE]
proof (state)
this:
take_bit_num (numeral m) n = Some q

goal (1 subgoal):
 1. \<And>a. take_bit_num (numeral m) n = Some a \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
take_bit_num (numeral m) n = Some q
[PROOF STEP]
have q: \<open>take_bit (numeral m) (numeral n :: int) = numeral q\<close>
[PROOF STATE]
proof (prove)
using this:
take_bit_num (numeral m) n = Some q

goal (1 subgoal):
 1. take_bit (numeral m) (numeral n) = numeral q
[PROOF STEP]
by (auto dest: take_bit_num_eq_Some_imp)
[PROOF STATE]
proof (state)
this:
take_bit (numeral m) (numeral n) = numeral q

goal (1 subgoal):
 1. \<And>a. take_bit_num (numeral m) n = Some a \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
let ?T = \<open>take_bit (numeral m) :: int \<Rightarrow> int\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. take_bit_num (numeral m) n = Some a \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
have *: \<open>?T (2 ^ numeral m) = ?T (?T 0)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (numeral m) (2 ^ numeral m) = take_bit (numeral m) (take_bit (numeral m) 0)
[PROOF STEP]
by (simp add: take_bit_eq_0_iff)
[PROOF STATE]
proof (state)
this:
take_bit (numeral m) (2 ^ numeral m) = take_bit (numeral m) (take_bit (numeral m) 0)

goal (1 subgoal):
 1. \<And>a. take_bit_num (numeral m) n = Some a \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
have \<open>?lhs = ?T (0 - numeral n)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (numeral m) (- numeral n) = take_bit (numeral m) (0 - numeral n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
take_bit (numeral m) (- numeral n) = take_bit (numeral m) (0 - numeral n)

goal (1 subgoal):
 1. \<And>a. take_bit_num (numeral m) n = Some a \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
take_bit (numeral m) (- numeral n) = take_bit (numeral m) (0 - numeral n)

goal (1 subgoal):
 1. \<And>a. take_bit_num (numeral m) n = Some a \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
have \<open>\<dots> = ?T (?T (?T 0) - ?T (?T (numeral n)))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (numeral m) (0 - numeral n) = take_bit (numeral m) (take_bit (numeral m) (take_bit (numeral m) 0) - take_bit (numeral m) (take_bit (numeral m) (numeral n)))
[PROOF STEP]
by (simp only: take_bit_diff)
[PROOF STATE]
proof (state)
this:
take_bit (numeral m) (0 - numeral n) = take_bit (numeral m) (take_bit (numeral m) (take_bit (numeral m) 0) - take_bit (numeral m) (take_bit (numeral m) (numeral n)))

goal (1 subgoal):
 1. \<And>a. take_bit_num (numeral m) n = Some a \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
take_bit (numeral m) (0 - numeral n) = take_bit (numeral m) (take_bit (numeral m) (take_bit (numeral m) 0) - take_bit (numeral m) (take_bit (numeral m) (numeral n)))

goal (1 subgoal):
 1. \<And>a. take_bit_num (numeral m) n = Some a \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
have \<open>\<dots> = ?T (2 ^ numeral m - ?T (numeral n))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (numeral m) (take_bit (numeral m) (take_bit (numeral m) 0) - take_bit (numeral m) (take_bit (numeral m) (numeral n))) = take_bit (numeral m) (2 ^ numeral m - take_bit (numeral m) (numeral n))
[PROOF STEP]
by (simp only: take_bit_diff flip: *)
[PROOF STATE]
proof (state)
this:
take_bit (numeral m) (take_bit (numeral m) (take_bit (numeral m) 0) - take_bit (numeral m) (take_bit (numeral m) (numeral n))) = take_bit (numeral m) (2 ^ numeral m - take_bit (numeral m) (numeral n))

goal (1 subgoal):
 1. \<And>a. take_bit_num (numeral m) n = Some a \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
take_bit (numeral m) (take_bit (numeral m) (take_bit (numeral m) 0) - take_bit (numeral m) (take_bit (numeral m) (numeral n))) = take_bit (numeral m) (2 ^ numeral m - take_bit (numeral m) (numeral n))

goal (1 subgoal):
 1. \<And>a. take_bit_num (numeral m) n = Some a \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
have \<open>\<dots> = ?rhs\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (numeral m) (2 ^ numeral m - take_bit (numeral m) (numeral n)) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
by (simp add: q Some)
[PROOF STATE]
proof (state)
this:
take_bit (numeral m) (2 ^ numeral m - take_bit (numeral m) (numeral n)) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))

goal (1 subgoal):
 1. \<And>a. take_bit_num (numeral m) n = Some a \<Longrightarrow> take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))

goal (1 subgoal):
 1. take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
take_bit (numeral m) (- numeral n) = (case take_bit_num (numeral m) n of None \<Rightarrow> 0 | Some q \<Rightarrow> take_bit (numeral m) (2 ^ numeral m - numeral q))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lipschitz_on_Pair[lipschitz_intros]:
  assumes f: "L-lipschitz_on A f"
  assumes g: "M-lipschitz_on A g"
  shows "(sqrt (L\<^sup>2 + M\<^sup>2))-lipschitz_on A (\<lambda>a. (f a, g a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sqrt (L\<^sup>2 + M\<^sup>2))-lipschitz_on A (\<lambda>a. (f a, g a))
[PROOF STEP]
proof (rule lipschitz_onI, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> dist (f x, g x) (f y, g y) \<le> sqrt (L\<^sup>2 + M\<^sup>2) * dist x y
 2. 0 \<le> sqrt (L\<^sup>2 + M\<^sup>2)
[PROOF STEP]
case (1 x y)
[PROOF STATE]
proof (state)
this:
x \<in> A
y \<in> A

goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> dist (f x, g x) (f y, g y) \<le> sqrt (L\<^sup>2 + M\<^sup>2) * dist x y
 2. 0 \<le> sqrt (L\<^sup>2 + M\<^sup>2)
[PROOF STEP]
have "dist (f x, g x) (f y, g y) = sqrt ((dist (f x) (f y))\<^sup>2 + (dist (g x) (g y))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (f x, g x) (f y, g y) = sqrt ((dist (f x) (f y))\<^sup>2 + (dist (g x) (g y))\<^sup>2)
[PROOF STEP]
by (auto simp add: dist_Pair_Pair real_le_lsqrt)
[PROOF STATE]
proof (state)
this:
dist (f x, g x) (f y, g y) = sqrt ((dist (f x) (f y))\<^sup>2 + (dist (g x) (g y))\<^sup>2)

goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> dist (f x, g x) (f y, g y) \<le> sqrt (L\<^sup>2 + M\<^sup>2) * dist x y
 2. 0 \<le> sqrt (L\<^sup>2 + M\<^sup>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist (f x, g x) (f y, g y) = sqrt ((dist (f x) (f y))\<^sup>2 + (dist (g x) (g y))\<^sup>2)

goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> dist (f x, g x) (f y, g y) \<le> sqrt (L\<^sup>2 + M\<^sup>2) * dist x y
 2. 0 \<le> sqrt (L\<^sup>2 + M\<^sup>2)
[PROOF STEP]
have "\<dots> \<le> sqrt ((L * dist x y)\<^sup>2 + (M * dist x y)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt ((dist (f x) (f y))\<^sup>2 + (dist (g x) (g y))\<^sup>2) \<le> sqrt ((L * dist x y)\<^sup>2 + (M * dist x y)\<^sup>2)
[PROOF STEP]
by (auto intro!: real_sqrt_le_mono add_mono power_mono 1 lipschitz_onD f g)
[PROOF STATE]
proof (state)
this:
sqrt ((dist (f x) (f y))\<^sup>2 + (dist (g x) (g y))\<^sup>2) \<le> sqrt ((L * dist x y)\<^sup>2 + (M * dist x y)\<^sup>2)

goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> dist (f x, g x) (f y, g y) \<le> sqrt (L\<^sup>2 + M\<^sup>2) * dist x y
 2. 0 \<le> sqrt (L\<^sup>2 + M\<^sup>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt ((dist (f x) (f y))\<^sup>2 + (dist (g x) (g y))\<^sup>2) \<le> sqrt ((L * dist x y)\<^sup>2 + (M * dist x y)\<^sup>2)

goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> dist (f x, g x) (f y, g y) \<le> sqrt (L\<^sup>2 + M\<^sup>2) * dist x y
 2. 0 \<le> sqrt (L\<^sup>2 + M\<^sup>2)
[PROOF STEP]
have "\<dots> \<le> sqrt (L\<^sup>2 + M\<^sup>2) * dist x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt ((L * dist x y)\<^sup>2 + (M * dist x y)\<^sup>2) \<le> sqrt (L\<^sup>2 + M\<^sup>2) * dist x y
[PROOF STEP]
by (auto simp: power_mult_distrib ring_distribs[symmetric] real_sqrt_mult)
[PROOF STATE]
proof (state)
this:
sqrt ((L * dist x y)\<^sup>2 + (M * dist x y)\<^sup>2) \<le> sqrt (L\<^sup>2 + M\<^sup>2) * dist x y

goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> dist (f x, g x) (f y, g y) \<le> sqrt (L\<^sup>2 + M\<^sup>2) * dist x y
 2. 0 \<le> sqrt (L\<^sup>2 + M\<^sup>2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dist (f x, g x) (f y, g y) \<le> sqrt (L\<^sup>2 + M\<^sup>2) * dist x y
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
dist (f x, g x) (f y, g y) \<le> sqrt (L\<^sup>2 + M\<^sup>2) * dist x y

goal (1 subgoal):
 1. dist (f x, g x) (f y, g y) \<le> sqrt (L\<^sup>2 + M\<^sup>2) * dist x y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dist (f x, g x) (f y, g y) \<le> sqrt (L\<^sup>2 + M\<^sup>2) * dist x y

goal (1 subgoal):
 1. 0 \<le> sqrt (L\<^sup>2 + M\<^sup>2)
[PROOF STEP]
qed simp


[STATEMENT]
lemma Bernstein_Poly_01_span:
  "poly_vs.span {Bernstein_Poly_01 x p | x. x \<le> p}
      = {x. degree x \<le> p}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_vs.span {Bernstein_Poly_01 x p |x. x \<le> p} = {x. degree x \<le> p}
[PROOF STEP]
apply (subst monom_span[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_vs.span {Bernstein_Poly_01 x p |x. x \<le> p} = poly_vs.span {monom 1 x |x. x \<le> p}
[PROOF STEP]
apply (subst poly_vs.span_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {Bernstein_Poly_01 x p |x. x \<le> p} \<subseteq> poly_vs.span {monom 1 x |x. x \<le> p} \<and> {monom 1 x |x. x \<le> p} \<subseteq> poly_vs.span {Bernstein_Poly_01 x p |x. x \<le> p}
[PROOF STEP]
by (auto simp: monom_span degree_Bernstein_le
      Bernstein_Poly_01_span1 degree_monom_eq)


[STATEMENT]
lemma continuous_on_open_UN:
  "(\<And>s. s \<in> S \<Longrightarrow> open (A s)) \<Longrightarrow> (\<And>s. s \<in> S \<Longrightarrow> continuous_on (A s) f) \<Longrightarrow>
    continuous_on (\<Union>s\<in>S. A s) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>s. s \<in> S \<Longrightarrow> open (A s); \<And>s. s \<in> S \<Longrightarrow> continuous_on (A s) f\<rbrakk> \<Longrightarrow> continuous_on (\<Union> (A ` S)) f
[PROOF STEP]
by (rule continuous_on_open_Union) auto


[STATEMENT]
lemma raw_has_prod_mult: "\<lbrakk>raw_has_prod f M a; raw_has_prod g M b\<rbrakk> \<Longrightarrow> raw_has_prod (\<lambda>n. f n * g n) M (a * b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>raw_has_prod f M a; raw_has_prod g M b\<rbrakk> \<Longrightarrow> raw_has_prod (\<lambda>n. f n * g n) M (a * b)
[PROOF STEP]
by (force simp add: prod.distrib tendsto_mult raw_has_prod_def)


[STATEMENT]
lemma (in prob_space) borel_0_1_law:
  fixes F :: "nat \<Rightarrow> 'a set"
  assumes F2: "indep_events F UNIV"
  shows "prob (\<Inter>n. \<Union>m\<in>{n..}. F m) = 0 \<or> prob (\<Inter>n. \<Union>m\<in>{n..}. F m) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob (\<Inter>n. \<Union> (F ` {n..})) = 0 \<or> prob (\<Inter>n. \<Union> (F ` {n..})) = 1
[PROOF STEP]
proof (rule kolmogorov_0_1_law[of "\<lambda>i. sigma_sets (space M) { F i }"])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i. sigma_algebra (space M) (sigma_sets (space M) {F i})
 2. indep_sets (\<lambda>i. sigma_sets (space M) {F i}) UNIV
 3. (\<Inter>n. \<Union> (F ` {n..})) \<in> tail_events (\<lambda>i. sigma_sets (space M) {F i})
[PROOF STEP]
have F1: "range F \<subseteq> events"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range F \<subseteq> events
[PROOF STEP]
using F2
[PROOF STATE]
proof (prove)
using this:
indep_events F UNIV

goal (1 subgoal):
 1. range F \<subseteq> events
[PROOF STEP]
by (simp add: indep_events_def subset_eq)
[PROOF STATE]
proof (state)
this:
range F \<subseteq> events

goal (3 subgoals):
 1. \<And>i. sigma_algebra (space M) (sigma_sets (space M) {F i})
 2. indep_sets (\<lambda>i. sigma_sets (space M) {F i}) UNIV
 3. (\<Inter>n. \<Union> (F ` {n..})) \<in> tail_events (\<lambda>i. sigma_sets (space M) {F i})
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
range F \<subseteq> events

goal (3 subgoals):
 1. \<And>i. sigma_algebra (space M) (sigma_sets (space M) {F i})
 2. indep_sets (\<lambda>i. sigma_sets (space M) {F i}) UNIV
 3. (\<Inter>n. \<Union> (F ` {n..})) \<in> tail_events (\<lambda>i. sigma_sets (space M) {F i})
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i. sigma_algebra (space M) (sigma_sets (space M) {F i})
 2. indep_sets (\<lambda>i. sigma_sets (space M) {F i}) UNIV
 3. (\<Inter>n. \<Union> (F ` {n..})) \<in> tail_events (\<lambda>i. sigma_sets (space M) {F i})
[PROOF STEP]
show "sigma_algebra (space M) (sigma_sets (space M) {F i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_algebra (space M) (sigma_sets (space M) {F i})
[PROOF STEP]
using sigma_algebra_sigma_sets[of "{F i}" "space M"] F1 sets.sets_into_space
[PROOF STATE]
proof (prove)
using this:
{F i} \<subseteq> Pow (space M) \<Longrightarrow> sigma_algebra (space M) (sigma_sets (space M) {F i})
range F \<subseteq> events
?x \<in> sets ?M \<Longrightarrow> ?x \<subseteq> space ?M

goal (1 subgoal):
 1. sigma_algebra (space M) (sigma_sets (space M) {F i})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sigma_algebra (space M) (sigma_sets (space M) {F i})

goal (2 subgoals):
 1. indep_sets (\<lambda>i. sigma_sets (space M) {F i}) UNIV
 2. (\<Inter>n. \<Union> (F ` {n..})) \<in> tail_events (\<lambda>i. sigma_sets (space M) {F i})
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
sigma_algebra (space M) (sigma_sets (space M) {F ?i10})

goal (2 subgoals):
 1. indep_sets (\<lambda>i. sigma_sets (space M) {F i}) UNIV
 2. (\<Inter>n. \<Union> (F ` {n..})) \<in> tail_events (\<lambda>i. sigma_sets (space M) {F i})
[PROOF STEP]
show "indep_sets (\<lambda>i. sigma_sets (space M) {F i}) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_sets (\<lambda>i. sigma_sets (space M) {F i}) UNIV
[PROOF STEP]
proof (rule indep_sets_sigma)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. indep_sets (\<lambda>i. {F i}) UNIV
 2. \<And>i. i \<in> UNIV \<Longrightarrow> Int_stable {F i}
[PROOF STEP]
show "indep_sets (\<lambda>i. {F i}) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_sets (\<lambda>i. {F i}) UNIV
[PROOF STEP]
unfolding indep_events_def_alt[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_events F UNIV
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
indep_sets (\<lambda>i. {F i}) UNIV

goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> Int_stable {F i}
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> Int_stable {F i}
[PROOF STEP]
show "Int_stable {F i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Int_stable {F i}
[PROOF STEP]
unfolding Int_stable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a\<in>{F i}. \<forall>b\<in>{F i}. a \<inter> b \<in> {F i}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Int_stable {F i}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
indep_sets (\<lambda>i. sigma_sets (space M) {F i}) UNIV

goal (1 subgoal):
 1. (\<Inter>n. \<Union> (F ` {n..})) \<in> tail_events (\<lambda>i. sigma_sets (space M) {F i})
[PROOF STEP]
let ?Q = "\<lambda>n. \<Union>i\<in>{n..}. F i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Inter>n. \<Union> (F ` {n..})) \<in> tail_events (\<lambda>i. sigma_sets (space M) {F i})
[PROOF STEP]
show "(\<Inter>n. \<Union>m\<in>{n..}. F m) \<in> tail_events (\<lambda>i. sigma_sets (space M) {F i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>n. \<Union> (F ` {n..})) \<in> tail_events (\<lambda>i. sigma_sets (space M) {F i})
[PROOF STEP]
unfolding tail_events_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>n. \<Union> (F ` {n..})) \<in> (\<Inter>n. sigma_sets (space M) (\<Union>i\<in>{n..}. sigma_sets (space M) {F i}))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. n \<in> UNIV \<Longrightarrow> (\<Inter>n. \<Union> (F ` {n..})) \<in> sigma_sets (space M) (\<Union>i\<in>{n..}. sigma_sets (space M) {F i})
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. n \<in> UNIV \<Longrightarrow> (\<Inter>n. \<Union> (F ` {n..})) \<in> sigma_sets (space M) (\<Union>i\<in>{n..}. sigma_sets (space M) {F i})
[PROOF STEP]
interpret S: sigma_algebra "space M" "sigma_sets (space M) (\<Union>i\<in>{j..}. sigma_sets (space M) {F i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_algebra (space M) (sigma_sets (space M) (\<Union>i\<in>{j..}. sigma_sets (space M) {F i}))
[PROOF STEP]
using order_trans[OF F1 sets.space_closed]
[PROOF STATE]
proof (prove)
using this:
range F \<subseteq> Pow (space M)

goal (1 subgoal):
 1. sigma_algebra (space M) (sigma_sets (space M) (\<Union>i\<in>{j..}. sigma_sets (space M) {F i}))
[PROOF STEP]
by (intro sigma_algebra_sigma_sets) (simp add: sigma_sets_singleton subset_eq)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. n \<in> UNIV \<Longrightarrow> (\<Inter>n. \<Union> (F ` {n..})) \<in> sigma_sets (space M) (\<Union>i\<in>{n..}. sigma_sets (space M) {F i})
[PROOF STEP]
have "(\<Inter>n. ?Q n) = (\<Inter>n\<in>{j..}. ?Q n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>n. \<Union> (F ` {n..})) = (\<Inter>n\<in>{j..}. \<Union> (F ` {n..}))
[PROOF STEP]
by (intro decseq_SucI INT_decseq_offset UN_mono) auto
[PROOF STATE]
proof (state)
this:
(\<Inter>n. \<Union> (F ` {n..})) = (\<Inter>n\<in>{j..}. \<Union> (F ` {n..}))

goal (1 subgoal):
 1. \<And>n. n \<in> UNIV \<Longrightarrow> (\<Inter>n. \<Union> (F ` {n..})) \<in> sigma_sets (space M) (\<Union>i\<in>{n..}. sigma_sets (space M) {F i})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Inter>n. \<Union> (F ` {n..})) = (\<Inter>n\<in>{j..}. \<Union> (F ` {n..}))

goal (1 subgoal):
 1. \<And>n. n \<in> UNIV \<Longrightarrow> (\<Inter>n. \<Union> (F ` {n..})) \<in> sigma_sets (space M) (\<Union>i\<in>{n..}. sigma_sets (space M) {F i})
[PROOF STEP]
have "\<dots> \<in> sigma_sets (space M) (\<Union>i\<in>{j..}. sigma_sets (space M) {F i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>n\<in>{j..}. \<Union> (F ` {n..})) \<in> sigma_sets (space M) (\<Union>i\<in>{j..}. sigma_sets (space M) {F i})
[PROOF STEP]
using order_trans[OF F1 sets.space_closed]
[PROOF STATE]
proof (prove)
using this:
range F \<subseteq> Pow (space M)

goal (1 subgoal):
 1. (\<Inter>n\<in>{j..}. \<Union> (F ` {n..})) \<in> sigma_sets (space M) (\<Union>i\<in>{j..}. sigma_sets (space M) {F i})
[PROOF STEP]
by (safe intro!: S.countable_INT S.countable_UN)
         (auto simp: sigma_sets_singleton intro!: sigma_sets.Basic bexI)
[PROOF STATE]
proof (state)
this:
(\<Inter>n\<in>{j..}. \<Union> (F ` {n..})) \<in> sigma_sets (space M) (\<Union>i\<in>{j..}. sigma_sets (space M) {F i})

goal (1 subgoal):
 1. \<And>n. n \<in> UNIV \<Longrightarrow> (\<Inter>n. \<Union> (F ` {n..})) \<in> sigma_sets (space M) (\<Union>i\<in>{n..}. sigma_sets (space M) {F i})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Inter>n. \<Union> (F ` {n..})) \<in> sigma_sets (space M) (\<Union>i\<in>{j..}. sigma_sets (space M) {F i})
[PROOF STEP]
show "(\<Inter>n. ?Q n) \<in> sigma_sets (space M) (\<Union>i\<in>{j..}. sigma_sets (space M) {F i})"
[PROOF STATE]
proof (prove)
using this:
(\<Inter>n. \<Union> (F ` {n..})) \<in> sigma_sets (space M) (\<Union>i\<in>{j..}. sigma_sets (space M) {F i})

goal (1 subgoal):
 1. (\<Inter>n. \<Union> (F ` {n..})) \<in> sigma_sets (space M) (\<Union>i\<in>{j..}. sigma_sets (space M) {F i})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Inter>n. \<Union> (F ` {n..})) \<in> sigma_sets (space M) (\<Union>i\<in>{j..}. sigma_sets (space M) {F i})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Inter>n. \<Union> (F ` {n..})) \<in> tail_events (\<lambda>i. sigma_sets (space M) {F i})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in filtrated_prob_space) borel_adapt_stoch_proc_times:
  fixes X::"'b \<Rightarrow> 'a \<Rightarrow> ('c::{second_countable_topology, real_normed_algebra})"
  assumes "borel_adapt_stoch_proc F X"
  and "borel_adapt_stoch_proc F Y"
shows "borel_adapt_stoch_proc F (\<lambda>t w. X t w * Y t w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. borel_adapt_stoch_proc F (\<lambda>t w. X t w * Y t w)
[PROOF STEP]
unfolding adapt_stoch_proc_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>t. (\<lambda>w. X t w * Y t w) \<in> borel_measurable (F t)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t. (\<lambda>w. X t w * Y t w) \<in> borel_measurable (F t)
[PROOF STEP]
fix t
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t. (\<lambda>w. X t w * Y t w) \<in> borel_measurable (F t)
[PROOF STEP]
have "X t \<in> borel_measurable (F t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X t \<in> borel_measurable (F t)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
borel_adapt_stoch_proc F X
borel_adapt_stoch_proc F Y

goal (1 subgoal):
 1. X t \<in> borel_measurable (F t)
[PROOF STEP]
unfolding adapt_stoch_proc_def
[PROOF STATE]
proof (prove)
using this:
\<forall>t. X t \<in> borel_measurable (F t)
\<forall>t. Y t \<in> borel_measurable (F t)

goal (1 subgoal):
 1. X t \<in> borel_measurable (F t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
X t \<in> borel_measurable (F t)

goal (1 subgoal):
 1. \<And>t. (\<lambda>w. X t w * Y t w) \<in> borel_measurable (F t)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
X t \<in> borel_measurable (F t)

goal (1 subgoal):
 1. \<And>t. (\<lambda>w. X t w * Y t w) \<in> borel_measurable (F t)
[PROOF STEP]
have "Y t \<in> borel_measurable (F t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Y t \<in> borel_measurable (F t)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
borel_adapt_stoch_proc F X
borel_adapt_stoch_proc F Y

goal (1 subgoal):
 1. Y t \<in> borel_measurable (F t)
[PROOF STEP]
unfolding adapt_stoch_proc_def
[PROOF STATE]
proof (prove)
using this:
\<forall>t. X t \<in> borel_measurable (F t)
\<forall>t. Y t \<in> borel_measurable (F t)

goal (1 subgoal):
 1. Y t \<in> borel_measurable (F t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Y t \<in> borel_measurable (F t)

goal (1 subgoal):
 1. \<And>t. (\<lambda>w. X t w * Y t w) \<in> borel_measurable (F t)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
X t \<in> borel_measurable (F t)
Y t \<in> borel_measurable (F t)
[PROOF STEP]
show "(\<lambda>w. X t w * Y t w) \<in> borel_measurable (F t)"
[PROOF STATE]
proof (prove)
using this:
X t \<in> borel_measurable (F t)
Y t \<in> borel_measurable (F t)

goal (1 subgoal):
 1. (\<lambda>w. X t w * Y t w) \<in> borel_measurable (F t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>w. X t w * Y t w) \<in> borel_measurable (F t)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ideal_generated_dvd:
  assumes i: "ideal_generated {a,b::'a} = ideal_generated{d} "
  and a: "d' dvd a" and b: "d' dvd b"
shows "d' dvd d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d' dvd d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. d' dvd d
[PROOF STEP]
obtain p q where "p*a+q*b = d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p q. p * a + q * b = d \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using i ideal_generated_pair_exists
[PROOF STATE]
proof (prove)
using this:
ideal_generated {a, b} = ideal_generated {d}
ideal_generated {?a, ?b} = ideal_generated {?d} \<Longrightarrow> \<exists>p q. p * ?a + q * ?b = ?d

goal (1 subgoal):
 1. (\<And>p q. p * a + q * b = d \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
p * a + q * b = d

goal (1 subgoal):
 1. d' dvd d
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
p * a + q * b = d

goal (1 subgoal):
 1. d' dvd d
[PROOF STEP]
using a b
[PROOF STATE]
proof (prove)
using this:
p * a + q * b = d
d' dvd a
d' dvd b

goal (1 subgoal):
 1. d' dvd d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d' dvd d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compress_in_range:
  assumes "x\<in>{0..\<lceil>q-(q/(2*2^d))\<rceil>-1}"
          "of_nat d < \<lceil>(log 2 q)::real\<rceil>"
  shows "round (real_of_int (2^d * x) / real_of_int q) < 2^d "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. round (real_of_int (2 ^ d * x) / real_of_int q) < 2 ^ d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. round (real_of_int (2 ^ d * x) / real_of_int q) < 2 ^ d
[PROOF STEP]
have "(2::int)^d \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ d \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ d \<noteq> 0

goal (1 subgoal):
 1. round (real_of_int (2 ^ d * x) / real_of_int q) < 2 ^ d
[PROOF STEP]
have "real_of_int x < real_of_int q - real_of_int q / (2 * 2^d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int x < real_of_int q - real_of_int q / (2 * 2 ^ d)
[PROOF STEP]
using assms(1) less_ceiling_iff
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..\<lceil>real_of_int q - real_of_int q / (2 * 2 ^ d)\<rceil> - 1}
(?z < \<lceil>?x\<rceil>) = (of_int ?z < ?x)

goal (1 subgoal):
 1. real_of_int x < real_of_int q - real_of_int q / (2 * 2 ^ d)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of_int x < real_of_int q - real_of_int q / (2 * 2 ^ d)

goal (1 subgoal):
 1. round (real_of_int (2 ^ d * x) / real_of_int q) < 2 ^ d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_of_int x < real_of_int q - real_of_int q / (2 * 2 ^ d)
[PROOF STEP]
have "2^d * real_of_int x / real_of_int q <
    2^d * (real_of_int q - real_of_int q / (2 * 2^d)) /
    real_of_int q"
[PROOF STATE]
proof (prove)
using this:
real_of_int x < real_of_int q - real_of_int q / (2 * 2 ^ d)

goal (1 subgoal):
 1. 2 ^ d * real_of_int x / real_of_int q < 2 ^ d * (real_of_int q - real_of_int q / (2 * 2 ^ d)) / real_of_int q
[PROOF STEP]
by (simp add: divide_strict_right_mono q_gt_zero)
[PROOF STATE]
proof (state)
this:
2 ^ d * real_of_int x / real_of_int q < 2 ^ d * (real_of_int q - real_of_int q / (2 * 2 ^ d)) / real_of_int q

goal (1 subgoal):
 1. round (real_of_int (2 ^ d * x) / real_of_int q) < 2 ^ d
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 ^ d * real_of_int x / real_of_int q < 2 ^ d * (real_of_int q - real_of_int q / (2 * 2 ^ d)) / real_of_int q

goal (1 subgoal):
 1. round (real_of_int (2 ^ d * x) / real_of_int q) < 2 ^ d
[PROOF STEP]
have "\<dots> = 2^d * ((real_of_int q / real_of_int q) -
    (real_of_int q / real_of_int q) / (2 * 2^d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ d * (real_of_int q - real_of_int q / (2 * 2 ^ d)) / real_of_int q = 2 ^ d * (real_of_int q / real_of_int q - real_of_int q / real_of_int q / (2 * 2 ^ d))
[PROOF STEP]
by (simp add:algebra_simps diff_divide_distrib)
[PROOF STATE]
proof (state)
this:
2 ^ d * (real_of_int q - real_of_int q / (2 * 2 ^ d)) / real_of_int q = 2 ^ d * (real_of_int q / real_of_int q - real_of_int q / real_of_int q / (2 * 2 ^ d))

goal (1 subgoal):
 1. round (real_of_int (2 ^ d * x) / real_of_int q) < 2 ^ d
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 ^ d * (real_of_int q - real_of_int q / (2 * 2 ^ d)) / real_of_int q = 2 ^ d * (real_of_int q / real_of_int q - real_of_int q / real_of_int q / (2 * 2 ^ d))

goal (1 subgoal):
 1. round (real_of_int (2 ^ d * x) / real_of_int q) < 2 ^ d
[PROOF STEP]
have "\<dots> = 2^d * (1 - 1/(2*2^d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ d * (real_of_int q / real_of_int q - real_of_int q / real_of_int q / (2 * 2 ^ d)) = 2 ^ d * (1 - 1 / (2 * 2 ^ d))
[PROOF STEP]
using q_nonzero
[PROOF STATE]
proof (prove)
using this:
q \<noteq> 0

goal (1 subgoal):
 1. 2 ^ d * (real_of_int q / real_of_int q - real_of_int q / real_of_int q / (2 * 2 ^ d)) = 2 ^ d * (1 - 1 / (2 * 2 ^ d))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ d * (real_of_int q / real_of_int q - real_of_int q / real_of_int q / (2 * 2 ^ d)) = 2 ^ d * (1 - 1 / (2 * 2 ^ d))

goal (1 subgoal):
 1. round (real_of_int (2 ^ d * x) / real_of_int q) < 2 ^ d
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 ^ d * (real_of_int q / real_of_int q - real_of_int q / real_of_int q / (2 * 2 ^ d)) = 2 ^ d * (1 - 1 / (2 * 2 ^ d))

goal (1 subgoal):
 1. round (real_of_int (2 ^ d * x) / real_of_int q) < 2 ^ d
[PROOF STEP]
have "\<dots> = 2^d - 1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ d * (1 - 1 / (2 * 2 ^ d)) = 2 ^ d - 1 / 2
[PROOF STEP]
using \<open>2^d \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
2 ^ d \<noteq> 0

goal (1 subgoal):
 1. 2 ^ d * (1 - 1 / (2 * 2 ^ d)) = 2 ^ d - 1 / 2
[PROOF STEP]
by (simp add: right_diff_distrib')
[PROOF STATE]
proof (state)
this:
2 ^ d * (1 - 1 / (2 * 2 ^ d)) = 2 ^ d - 1 / 2

goal (1 subgoal):
 1. round (real_of_int (2 ^ d * x) / real_of_int q) < 2 ^ d
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 ^ d * real_of_int x / real_of_int q < 2 ^ d - 1 / 2
[PROOF STEP]
have "2^d * real_of_int x / real_of_int q <
    2^d - (1::real)/(2::real)"
[PROOF STATE]
proof (prove)
using this:
2 ^ d * real_of_int x / real_of_int q < 2 ^ d - 1 / 2

goal (1 subgoal):
 1. 2 ^ d * real_of_int x / real_of_int q < 2 ^ d - 1 / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 ^ d * real_of_int x / real_of_int q < 2 ^ d - 1 / 2

goal (1 subgoal):
 1. round (real_of_int (2 ^ d * x) / real_of_int q) < 2 ^ d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 ^ d * real_of_int x / real_of_int q < 2 ^ d - 1 / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 ^ d * real_of_int x / real_of_int q < 2 ^ d - 1 / 2

goal (1 subgoal):
 1. round (real_of_int (2 ^ d * x) / real_of_int q) < 2 ^ d
[PROOF STEP]
unfolding round_def
[PROOF STATE]
proof (prove)
using this:
2 ^ d * real_of_int x / real_of_int q < 2 ^ d - 1 / 2

goal (1 subgoal):
 1. \<lfloor>real_of_int (2 ^ d * x) / real_of_int q + 1 / 2\<rfloor> < 2 ^ d
[PROOF STEP]
using floor_less_iff
[PROOF STATE]
proof (prove)
using this:
2 ^ d * real_of_int x / real_of_int q < 2 ^ d - 1 / 2
(\<lfloor>?x\<rfloor> < ?z) = (?x < of_int ?z)

goal (1 subgoal):
 1. \<lfloor>real_of_int (2 ^ d * x) / real_of_int q + 1 / 2\<rfloor> < 2 ^ d
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
round (real_of_int (2 ^ d * x) / real_of_int q) < 2 ^ d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sylvester_sum_mat_lower:
  fixes p q :: "'a :: comm_semiring_1 poly"
  defines "m \<equiv> degree p" and "n \<equiv> degree q"
  assumes ni: "n \<le> i" and imn: "i < m+n"
  shows "(\<Sum>j<m+n. monom (sylvester_mat p q $$ (i,j)) (m + n - Suc j)) =
    monom 1 (m + n - Suc i) * q" (is "sum ?f _ = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
define l where "l = m+n-1"
[PROOF STATE]
proof (state)
this:
l = m + n - 1

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
hence l: "Suc l = m+n"
[PROOF STATE]
proof (prove)
using this:
l = m + n - 1

goal (1 subgoal):
 1. Suc l = m + n
[PROOF STEP]
using imn
[PROOF STATE]
proof (prove)
using this:
l = m + n - 1
i < m + n

goal (1 subgoal):
 1. Suc l = m + n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Suc l = m + n

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
define mni1 where "mni1 = m + n - Suc i"
[PROOF STATE]
proof (state)
this:
mni1 = m + n - Suc i

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
hence mni1: "m+n-i = Suc mni1"
[PROOF STATE]
proof (prove)
using this:
mni1 = m + n - Suc i

goal (1 subgoal):
 1. m + n - i = Suc mni1
[PROOF STEP]
using imn
[PROOF STATE]
proof (prove)
using this:
mni1 = m + n - Suc i
i < m + n

goal (1 subgoal):
 1. m + n - i = Suc mni1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m + n - i = Suc mni1

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
let ?g = "\<lambda>j. monom (coeff (monom 1 (m + n - Suc i) * q) j) j"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
let ?p = "\<lambda>j. l-j"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
have "sum ?f {..<m+n} = sum ?f {..l}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = (\<Sum>j\<le>l. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j))
[PROOF STEP]
unfolding l[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j<Suc l. monom (sylvester_mat p q $$ (i, j)) (Suc l - Suc j)) = (\<Sum>j\<le>l. monom (sylvester_mat p q $$ (i, j)) (Suc l - Suc j))
[PROOF STEP]
unfolding lessThan_Suc_atMost
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<le>l. monom (sylvester_mat p q $$ (i, j)) (Suc l - Suc j)) = (\<Sum>j\<le>l. monom (sylvester_mat p q $$ (i, j)) (Suc l - Suc j))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = (\<Sum>j\<le>l. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j))

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = (\<Sum>j\<le>l. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j))

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = (\<Sum>j\<le>l. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j))

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
assume j: "j\<le>l"
[PROOF STATE]
proof (state)
this:
j \<le> l

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
have "?f j = ((\<lambda>j. monom (coeff (monom 1 (m+n-i) * q) (Suc j)) j) \<circ> ?p) j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j) = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - i) * q) (Suc j)) j) \<circ> (-) l) j
[PROOF STEP]
apply(subst sylvester_index_mat2)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. i < degree p + degree q
 2. j < degree p + degree q
 3. monom (if i < degree q then coeff (monom (1::'a) (degree q - i) * p) (degree p + degree q - j) else coeff (monom (1::'a) (degree p + degree q - i) * q) (degree p + degree q - j)) (m + n - Suc j) = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - i) * q) (Suc j)) j) \<circ> (-) l) j
[PROOF STEP]
using ni imn j
[PROOF STATE]
proof (prove)
using this:
n \<le> i
i < m + n
j \<le> l

goal (3 subgoals):
 1. i < degree p + degree q
 2. j < degree p + degree q
 3. monom (if i < degree q then coeff (monom (1::'a) (degree q - i) * p) (degree p + degree q - j) else coeff (monom (1::'a) (degree p + degree q - i) * q) (degree p + degree q - j)) (m + n - Suc j) = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - i) * q) (Suc j)) j) \<circ> (-) l) j
[PROOF STEP]
unfolding l_def m_def[symmetric] n_def[symmetric]
[PROOF STATE]
proof (prove)
using this:
n \<le> i
i < m + n
j \<le> m + n - 1

goal (3 subgoals):
 1. i < m + n
 2. j < m + n
 3. monom (if i < n then coeff (monom (1::'a) (n - i) * p) (m + n - j) else coeff (monom (1::'a) (m + n - i) * q) (m + n - j)) (m + n - Suc j) = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - i) * q) (Suc j)) j) \<circ> (-) (m + n - 1)) j
[PROOF STEP]
by (auto simp add: Suc_diff_Suc)
[PROOF STATE]
proof (state)
this:
monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j) = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - i) * q) (Suc j)) j) \<circ> (-) l) j

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j) = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - i) * q) (Suc j)) j) \<circ> (-) l) j

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
have "... = (?g \<circ> ?p) j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - i) * q) (Suc j)) j) \<circ> (-) l) j = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) j
[PROOF STEP]
unfolding mni1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>j. monom (coeff (monom (1::'a) (Suc mni1) * q) (Suc j)) j) \<circ> (-) l) j = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) j
[PROOF STEP]
unfolding coeff_monom_Suc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>j. monom (coeff (monom (1::'a) mni1 * q) j) j) \<circ> (-) l) j = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) j
[PROOF STEP]
unfolding mni1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) j = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) j
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
((\<lambda>j. monom (coeff (monom (1::'a) (m + n - i) * q) (Suc j)) j) \<circ> (-) l) j = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) j

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j) = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) j
[PROOF STEP]
have "?f j = ..."
[PROOF STATE]
proof (prove)
using this:
monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j) = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) j

goal (1 subgoal):
 1. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j) = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) j
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j) = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) j

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?j2 \<le> l \<Longrightarrow> monom (sylvester_mat p q $$ (i, ?j2)) (m + n - Suc ?j2) = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) ?j2

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
hence "(\<Sum>j\<le>l. ?f j) = (\<Sum>j\<le>l. (?g\<circ>?p) j)"
[PROOF STATE]
proof (prove)
using this:
?j2 \<le> l \<Longrightarrow> monom (sylvester_mat p q $$ (i, ?j2)) (m + n - Suc ?j2) = ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) ?j2

goal (1 subgoal):
 1. (\<Sum>j\<le>l. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = sum ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) {..l}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<le>l. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = sum ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) {..l}

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<le>l. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = sum ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) {..l}

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
have "... = (\<Sum>j\<le>l. ?g j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) {..l} = (\<Sum>j\<le>l. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j)
[PROOF STEP]
using sum.reindex[OF inj_on_diff_nat2,symmetric,unfolded image_diff_atMost]
[PROOF STATE]
proof (prove)
using this:
sum (?g \<circ> (-) ?n) {..?n} = sum ?g {..?n}

goal (1 subgoal):
 1. sum ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) {..l} = (\<Sum>j\<le>l. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) {..l} = (\<Sum>j\<le>l. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j)

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum ((\<lambda>j. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) \<circ> (-) l) {..l} = (\<Sum>j\<le>l. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j)

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
have "degree ?r \<le> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (monom (1::'a) (m + n - Suc i) * q) \<le> l
[PROOF STEP]
using degree_mult_le[of "monom 1 (m+n-1-i)" q]
[PROOF STATE]
proof (prove)
using this:
degree (monom (1::'a) (m + n - 1 - i) * q) \<le> degree (monom (1::'a) (m + n - 1 - i)) + degree q

goal (1 subgoal):
 1. degree (monom (1::'a) (m + n - Suc i) * q) \<le> l
[PROOF STEP]
unfolding l_def n_def[symmetric]
[PROOF STATE]
proof (prove)
using this:
degree (monom (1::'a) (m + n - 1 - i) * q) \<le> degree (monom (1::'a) (m + n - 1 - i)) + n

goal (1 subgoal):
 1. degree (monom (1::'a) (m + n - Suc i) * q) \<le> m + n - 1
[PROOF STEP]
unfolding degree_monom_eq[OF one_neq_zero]
[PROOF STATE]
proof (prove)
using this:
degree (monom (1::'a) (m + n - 1 - i) * q) \<le> m + n - 1 - i + n

goal (1 subgoal):
 1. degree (monom (1::'a) (m + n - Suc i) * q) \<le> m + n - 1
[PROOF STEP]
using ni imn
[PROOF STATE]
proof (prove)
using this:
degree (monom (1::'a) (m + n - 1 - i) * q) \<le> m + n - 1 - i + n
n \<le> i
i < m + n

goal (1 subgoal):
 1. degree (monom (1::'a) (m + n - Suc i) * q) \<le> m + n - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree (monom (1::'a) (m + n - Suc i) * q) \<le> l

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
from poly_as_sum_of_monoms'[OF this]
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>ia\<le>l. monom (coeff (monom (1::'a) (m + n - Suc i) * q) ia) ia) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
have "(\<Sum>j\<le>l. ?g j) = ?r"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>ia\<le>l. monom (coeff (monom (1::'a) (m + n - Suc i) * q) ia) ia) = monom (1::'a) (m + n - Suc i) * q

goal (1 subgoal):
 1. (\<Sum>j\<le>l. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<le>l. monom (coeff (monom (1::'a) (m + n - Suc i) * q) j) j) = monom (1::'a) (m + n - Suc i) * q

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q

goal (1 subgoal):
 1. (\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>j<m + n. monom (sylvester_mat p q $$ (i, j)) (m + n - Suc j)) = monom (1::'a) (m + n - Suc i) * q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_lattice_complete_Sup_upper:
  "(x::'a::finite_lattice_complete) \<in> A \<Longrightarrow> Sup A \<ge> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> A \<Longrightarrow> x \<le> Sup A
[PROOF STEP]
using finite [of A]
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. x \<in> A \<Longrightarrow> x \<le> Sup A
[PROOF STEP]
by (induct A) (auto simp add: finite_lattice_complete_Sup_insert intro: le_supI2)