[STATEMENT]
lemma Lcm_0_iff:
  assumes "finite A"
  shows "Lcm A = 0 \<longleftrightarrow> 0 \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Lcm A = (0::'a)) = ((0::'a) \<in> A)
[PROOF STEP]
proof (cases "A = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A = {} \<Longrightarrow> (Lcm A = (0::'a)) = ((0::'a) \<in> A)
 2. A \<noteq> {} \<Longrightarrow> (Lcm A = (0::'a)) = ((0::'a) \<in> A)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
A = {}

goal (2 subgoals):
 1. A = {} \<Longrightarrow> (Lcm A = (0::'a)) = ((0::'a) \<in> A)
 2. A \<noteq> {} \<Longrightarrow> (Lcm A = (0::'a)) = ((0::'a) \<in> A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A = {}

goal (1 subgoal):
 1. (Lcm A = (0::'a)) = ((0::'a) \<in> A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(Lcm A = (0::'a)) = ((0::'a) \<in> A)

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> (Lcm A = (0::'a)) = ((0::'a) \<in> A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> (Lcm A = (0::'a)) = ((0::'a) \<in> A)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
A \<noteq> {}

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> (Lcm A = (0::'a)) = ((0::'a) \<in> A)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}

goal (1 subgoal):
 1. (Lcm A = (0::'a)) = ((0::'a) \<in> A)
[PROOF STEP]
by (induct A rule: finite_ne_induct) (auto simp: lcm_eq_0_iff)
[PROOF STATE]
proof (state)
this:
(Lcm A = (0::'a)) = ((0::'a) \<in> A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eval_fps_cos [simp]:
  fixes z :: "'a :: {banach, real_normed_field, field_char_0}"
  shows "eval_fps (fps_cos c) z = cos (c * z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fps (fps_cos c) z = cos (c * z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eval_fps (fps_cos c) z = cos (c * z)
[PROOF STEP]
have "(\<lambda>n. cos_coeff n *\<^sub>R (c * z) ^ n) sums cos (c * z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. cos_coeff n *\<^sub>R (c * z) ^ n) sums cos (c * z)
[PROOF STEP]
by (rule cos_converges)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. cos_coeff n *\<^sub>R (c * z) ^ n) sums cos (c * z)

goal (1 subgoal):
 1. eval_fps (fps_cos c) z = cos (c * z)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. cos_coeff n *\<^sub>R (c * z) ^ n) sums cos (c * z)

goal (1 subgoal):
 1. eval_fps (fps_cos c) z = cos (c * z)
[PROOF STEP]
have "(\<lambda>n. cos_coeff n *\<^sub>R (c * z) ^ n) = (\<lambda>n. fps_nth (fps_cos c) n * z ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. cos_coeff n *\<^sub>R (c * z) ^ n) = (\<lambda>n. fps_nth (fps_cos c) n * z ^ n)
[PROOF STEP]
by (rule ext) (auto simp: cos_coeff_def fps_cos_def power_mult_distrib scaleR_conv_of_real)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. cos_coeff n *\<^sub>R (c * z) ^ n) = (\<lambda>n. fps_nth (fps_cos c) n * z ^ n)

goal (1 subgoal):
 1. eval_fps (fps_cos c) z = cos (c * z)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. fps_nth (fps_cos c) n * z ^ n) sums cos (c * z)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. fps_nth (fps_cos c) n * z ^ n) sums cos (c * z)

goal (1 subgoal):
 1. eval_fps (fps_cos c) z = cos (c * z)
[PROOF STEP]
by (simp add: sums_iff eval_fps_def)
[PROOF STATE]
proof (state)
this:
eval_fps (fps_cos c) z = cos (c * z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_to_mset_add: "nat_to_mset i (n + m) = (nat_to_mset i n) + (nat_to_mset i m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_mset i (n + m) = nat_to_mset i n + nat_to_mset i m
[PROOF STEP]
apply(rule multiset_eqI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. count (nat_to_mset i (n + m)) x = count (nat_to_mset i n + nat_to_mset i m) x
[PROOF STEP]
by (metis add.right_neutral nat_to_msetE nat_to_msetE' count_union)


[STATEMENT]
lemma poly_pos_leq:
  "(\<forall>x. x \<le> a \<longrightarrow> poly p x > 0) \<longleftrightarrow>
   ( p \<noteq> 0 \<and> poly_neg_inf p = 1 \<and> count_roots_below p a = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<le>a. 0 < poly p x) = (p \<noteq> 0 \<and> poly_neg_inf p = 1 \<and> count_roots_below p a = 0)
[PROOF STEP]
by (simp only: poly_pos_leq Let_def poly_no_roots_leq, blast)


[STATEMENT]
lemma finite_distrib_lattice_complete_sup_Inf:
  "sup (x::'a::finite_distrib_lattice_complete) (Inf A) = (INF y\<in>A. sup x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sup x (Inf A) = Inf (sup x ` A)
[PROOF STEP]
using finite
[PROOF STATE]
proof (prove)
using this:
finite ?A

goal (1 subgoal):
 1. sup x (Inf A) = Inf (sup x ` A)
[PROOF STEP]
by (induct A rule: finite_induct) (simp_all add: sup_inf_distrib1)


[STATEMENT]
lemma interior_injective_linear_image:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'a::euclidean_space"
  assumes "linear f" "inj f"
   shows "interior(f ` S) = f ` (interior S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior (f ` S) = f ` interior S
[PROOF STEP]
by (simp add: linear_injective_imp_surjective assms bijI interior_bijective_linear_image)


[STATEMENT]
lemma uniformly_continuous_on_def:
  fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space"
  shows "uniformly_continuous_on s f \<longleftrightarrow>
    (\<forall>e>0. \<exists>d>0. \<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniformly_continuous_on s f = (\<forall>e>0. \<exists>d>0. \<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)
[PROOF STEP]
unfolding uniformly_continuous_on_uniformity
    uniformity_dist filterlim_INF filterlim_principal eventually_inf_principal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>b\<in>{0<..}. \<forall>\<^sub>F x in INF e\<in>{0<..}. principal {(x, y). dist x y < e}. x \<in> s \<times> s \<longrightarrow> (case x of (x, y) \<Rightarrow> (f x, f y)) \<in> {(x, y). dist x y < b}) = (\<forall>e>0. \<exists>d>0. \<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)
[PROOF STEP]
by (force simp: Ball_def uniformity_dist[symmetric] eventually_uniformity_metric)


[STATEMENT]
lemma V_disjoint_iff: "x \<sqinter> y = 0 \<longleftrightarrow> elts x \<inter> elts y = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<sqinter> y = 0) = (elts x \<inter> elts y = {})
[PROOF STEP]
by (metis down elts_of_set inf_V_def inf_le1 zero_V_def)


[STATEMENT]
theorem p52: "\<exists>z w. \<forall>x y. F(x,y) \<longleftrightarrow> x = z \<and> y = w \<Longrightarrow>
  \<exists>w. \<forall>y. (\<exists>z. \<forall>x. F(x,y) \<longleftrightarrow> x = z) \<longleftrightarrow> y = w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z w. \<forall>x y. F (x, y) = (x = z \<and> y = w) \<Longrightarrow> \<exists>w. \<forall>y. (\<exists>z. \<forall>x. F (x, y) = (x = z)) = (y = w)
[PROOF STEP]
@proof
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z w. \<forall>x y. F (x, y) = (x = z \<and> y = w) \<Longrightarrow> \<exists>w. \<forall>y. (\<exists>z. \<forall>x. F (x, y) = (x = z)) = (y = w)
[PROOF STEP]
@obtain z w where "\<forall>x y. F(x,y) \<longleftrightarrow> x = z \<and> y = w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z w. \<forall>x y. F (x, y) = (x = z \<and> y = w) \<Longrightarrow> \<exists>w. \<forall>y. (\<exists>z. \<forall>x. F (x, y) = (x = z)) = (y = w)
[PROOF STEP]
@have"\<forall>y. (\<exists>z. \<forall>x. F(x,y) \<longleftrightarrow> x = z) \<longleftrightarrow> y = w" @with
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z w. \<forall>x y. F (x, y) = (x = z \<and> y = w) \<Longrightarrow> \<exists>w. \<forall>y. (\<exists>z. \<forall>x. F (x, y) = (x = z)) = (y = w)
[PROOF STEP]
@case "y = w" @with
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z w. \<forall>x y. F (x, y) = (x = z \<and> y = w) \<Longrightarrow> \<exists>w. \<forall>y. (\<exists>z. \<forall>x. F (x, y) = (x = z)) = (y = w)
[PROOF STEP]
@have "\<forall>x. F(x,y) \<longleftrightarrow> x = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z w. \<forall>x y. F (x, y) = (x = z \<and> y = w) \<Longrightarrow> \<exists>w. \<forall>y. (\<exists>z. \<forall>x. F (x, y) = (x = z)) = (y = w)
[PROOF STEP]
@end
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z w. \<forall>x y. F (x, y) = (x = z \<and> y = w) \<Longrightarrow> \<exists>w. \<forall>y. (\<exists>z. \<forall>x. F (x, y) = (x = z)) = (y = w)
[PROOF STEP]
@end
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z w. \<forall>x y. F (x, y) = (x = z \<and> y = w) \<Longrightarrow> \<exists>w. \<forall>y. (\<exists>z. \<forall>x. F (x, y) = (x = z)) = (y = w)
[PROOF STEP]
@qed


[STATEMENT]
lemma Cons_set_sub:
  assumes "Finite_Set.card xs = Suc n"
  shows "{ys. set ys = xs \<and> distinct ys}
    \<subseteq> {x # y |x y. x \<in> xs \<and> y \<in> (\<Union>y \<in> xs. {as. set as = xs - {y} \<and> distinct as})}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {ys. set ys = xs \<and> distinct ys} \<subseteq> {x # y |x y. x \<in> xs \<and> y \<in> (\<Union>y\<in>xs. {as. set as = xs - {y} \<and> distinct as})}
[PROOF STEP]
using distinct_seteq_eq_set_union[OF assms]
[PROOF STATE]
proof (prove)
using this:
{ys. set ys = xs \<and> distinct ys} = {y # ys |y ys. y \<in> xs \<and> ys \<in> {as. set as = xs - {y} \<and> distinct as}}

goal (1 subgoal):
 1. {ys. set ys = xs \<and> distinct ys} \<subseteq> {x # y |x y. x \<in> xs \<and> y \<in> (\<Union>y\<in>xs. {as. set as = xs - {y} \<and> distinct as})}
[PROOF STEP]
by auto


[STATEMENT]
lemma fact_num_eq_if: "fact m = (if m = 0 then 1 else of_nat m * fact (m - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact m = (if m = 0 then 1::'a else of_nat m * fact (m - 1))
[PROOF STEP]
by (cases m) auto


[STATEMENT]
lemma SUP_Lim:
  fixes X :: "nat \<Rightarrow> 'a::{complete_linorder,linorder_topology}"
  assumes inc: "incseq X"
    and l: "X \<longlonglongrightarrow> l"
  shows "(SUP n. X n) = l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (range X) = l
[PROOF STEP]
using LIMSEQ_SUP[OF inc] tendsto_unique[OF trivial_limit_sequentially l]
[PROOF STATE]
proof (prove)
using this:
X \<longlonglongrightarrow> Sup (range X)
X \<longlonglongrightarrow> ?b \<Longrightarrow> l = ?b

goal (1 subgoal):
 1. Sup (range X) = l
[PROOF STEP]
by simp


[STATEMENT]
lemma subspace_image_invertible_mat:
  fixes P::"'a::{field}^'m^'m"
  assumes inv_P: "invertible P"
    and sub_W: "vec.subspace W"
  shows "vec.subspace ((\<lambda>x. P *v x)` W)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.subspace ((*v) P ` W)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
invertible P
vec.subspace W

goal (1 subgoal):
 1. vec.subspace ((*v) P ` W)
[PROOF STEP]
by (intro vec.subspace_image)


[STATEMENT]
lemma differentiable_divide [simp, derivative_intros]:
  fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_field"
  shows "f differentiable (at x within s) \<Longrightarrow> g differentiable (at x within s) \<Longrightarrow>
    g x \<noteq> 0 \<Longrightarrow> (\<lambda>x. f x / g x) differentiable (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f differentiable at x within s; g differentiable at x within s; g x \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> (\<lambda>x. f x / g x) differentiable at x within s
[PROOF STEP]
unfolding divide_inverse
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f differentiable at x within s; g differentiable at x within s; g x \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> (\<lambda>x. f x * inverse (g x)) differentiable at x within s
[PROOF STEP]
by simp


[STATEMENT]
lemma vec_module_col_helper:
  fixes A:: "('a :: field) mat"
  shows "(0\<^sub>v (dim_row A) \<in> LinearCombinations.module.span class_ring \<lparr>carrier = carrier_vec (dim_row A), mult = undefined, one = undefined, zero = 0\<^sub>v (dim_row A), add = (+), smult = (\<cdot>\<^sub>v)\<rparr> (set (cols A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0\<^sub>v (dim_row A) \<in> LinearCombinations.module.span class_ring \<lparr>carrier = carrier_vec (dim_row A), mult = undefined, one = undefined, zero = 0\<^sub>v (dim_row A), add = (+), smult = (\<cdot>\<^sub>v)\<rparr> (set (cols A))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0\<^sub>v (dim_row A) \<in> LinearCombinations.module.span class_ring \<lparr>carrier = carrier_vec (dim_row A), mult = undefined, one = undefined, zero = 0\<^sub>v (dim_row A), add = (+), smult = (\<cdot>\<^sub>v)\<rparr> (set (cols A))
[PROOF STEP]
have "\<forall>v. (0::'a) \<cdot>\<^sub>v v + v = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>v. (0::'a) \<cdot>\<^sub>v v + v = v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>v. (0::'a) \<cdot>\<^sub>v v + v = v

goal (1 subgoal):
 1. 0\<^sub>v (dim_row A) \<in> LinearCombinations.module.span class_ring \<lparr>carrier = carrier_vec (dim_row A), mult = undefined, one = undefined, zero = 0\<^sub>v (dim_row A), add = (+), smult = (\<cdot>\<^sub>v)\<rparr> (set (cols A))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>v. (0::'a) \<cdot>\<^sub>v v + v = v
[PROOF STEP]
show "0\<^sub>v (dim_row A) \<in> LinearCombinations.module.span class_ring \<lparr>carrier = carrier_vec (dim_row A), mult = undefined, one = undefined, zero = 0\<^sub>v (dim_row A), add = (+), smult = (\<cdot>\<^sub>v)\<rparr> (set (cols A))"
[PROOF STATE]
proof (prove)
using this:
\<forall>v. (0::'a) \<cdot>\<^sub>v v + v = v

goal (1 subgoal):
 1. 0\<^sub>v (dim_row A) \<in> LinearCombinations.module.span class_ring \<lparr>carrier = carrier_vec (dim_row A), mult = undefined, one = undefined, zero = 0\<^sub>v (dim_row A), add = (+), smult = (\<cdot>\<^sub>v)\<rparr> (set (cols A))
[PROOF STEP]
by (metis cols_dim module_vec_def right_zero_vec smult_carrier_vec vec_space.prod_in_span zero_carrier_vec)
[PROOF STATE]
proof (state)
this:
0\<^sub>v (dim_row A) \<in> LinearCombinations.module.span class_ring \<lparr>carrier = carrier_vec (dim_row A), mult = undefined, one = undefined, zero = 0\<^sub>v (dim_row A), add = (+), smult = (\<cdot>\<^sub>v)\<rparr> (set (cols A))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma x_plus_y_p_le_xp_plus_yp:
  fixes p x y::real
  assumes "p > 0" "p \<le> 1" "x \<ge> 0" "y \<ge> 0"
  shows "(x + y) powr p \<le> x powr p + y powr p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y) powr p \<le> x powr p + y powr p
[PROOF STEP]
using convex_fx_plus_fy_ineq[OF convex_powr'[OF \<open>p > 0\<close> \<open>p \<le> 1\<close>] \<open>x \<ge> 0\<close> \<open>y \<ge> 0\<close>]
[PROOF STATE]
proof (prove)
using this:
- (0 powr p) = 0 \<Longrightarrow> - (x powr p) + - (y powr p) \<le> - ((x + y) powr p)

goal (1 subgoal):
 1. (x + y) powr p \<le> x powr p + y powr p
[PROOF STEP]
by auto


[STATEMENT]
lemma cross7_eq_self: "x \<times>\<^sub>7 y = x \<longleftrightarrow> x = 0" "x \<times>\<^sub>7 y = y \<longleftrightarrow> y = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<times>\<^sub>7 y = x) = (x = 0) &&& (x \<times>\<^sub>7 y = y) = (y = 0)
[PROOF STEP]
apply (metis cross7_zero_left dot_cross7_self(1) inner_eq_zero_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<times>\<^sub>7 y = y) = (y = 0)
[PROOF STEP]
apply (metis cross7_zero_right dot_cross7_self(2) inner_eq_zero_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma inequality_2:
  "x > 0 \<Longrightarrow> y > 0 \<Longrightarrow> ((2 :: nat) ^ (x + 1)) + (2 ^ (y + 1)) \<le> (2 ^ (x + y + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; 0 < y\<rbrakk> \<Longrightarrow> 2 ^ (x + 1) + 2 ^ (y + 1) \<le> 2 ^ (x + y + 1)
[PROOF STEP]
by (induction x; simp; induction y; simp; fastforce)


[STATEMENT]
lemma length_filter_P_impl_Q:
   "(\<And>x. P x \<Longrightarrow> Q x) \<Longrightarrow> length (filter P xs) \<le> length (filter Q xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. P x \<Longrightarrow> Q x) \<Longrightarrow> length (filter P xs) \<le> length (filter Q xs)
[PROOF STEP]
by (induction xs) auto


[STATEMENT]
lemma euclid_diff2:
   "PRE (\<lambda>s::nat store. s ''x'' = x \<and> s ''y'' = y \<and> x > 0 \<and> y > 0)
    (WHILE (\<lambda>s. s ''x''\<noteq> s ''y'') INV (\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y)
     DO
        (IF (\<lambda>s. s ''x'' >  s ''y'')
         THEN (''x'' ::= (\<lambda>s. s ''x'' - s ''y''))
         ELSE (''y'' ::= (\<lambda>s. s ''y'' - s ''x''))
         FI)
    OD)
    POST (\<lambda>s. s ''x'' = gcd x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rdom \<lceil>\<lambda>s. s ''x'' = x \<and> s ''y'' = y \<and> zero_class.zero < x \<and> zero_class.zero < y\<rceil> \<subseteq> wp (WHILE (\<lambda>s. s ''x'' \<noteq> s ''y'') INV (\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y) DO (IF (\<lambda>s. s ''y'' < s ''x'') THEN (''x'' ::= (\<lambda>s. s ''x'' - s ''y'')) ELSE (''y'' ::= (\<lambda>s. s ''y'' - s ''x'')) FI) OD) \<lceil>\<lambda>s. s ''x'' = gcd x y\<rceil>
[PROOF STEP]
by (hoare; clarsimp; metis gcd.commute gcd_diff1_nat le_cases nat_less_le)


[STATEMENT]
lemma nonneg_infsum_le_0D_complex:
  fixes f :: "'a \<Rightarrow> complex"
  assumes "infsum f A \<le> 0"
    and abs_sum: "f summable_on A"
    and nneg: "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"
    and "x \<in> A"
  shows "f x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f x = 0
[PROOF STEP]
have \<open>Im (f x) = 0\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (f x) = 0
[PROOF STEP]
apply (rule nonneg_infsum_le_0D[where A=A])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. (\<Sum>\<^sub>\<infinity>a\<in>A. Im (f a)) \<le> 0
 2. (\<lambda>a. Im (f a)) summable_on A
 3. \<And>x. x \<in> A \<Longrightarrow> 0 \<le> Im (f x)
 4. x \<in> A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
infsum f A \<le> 0
f summable_on A
?x \<in> A \<Longrightarrow> 0 \<le> f ?x
x \<in> A

goal (4 subgoals):
 1. (\<Sum>\<^sub>\<infinity>a\<in>A. Im (f a)) \<le> 0
 2. (\<lambda>a. Im (f a)) summable_on A
 3. \<And>x. x \<in> A \<Longrightarrow> 0 \<le> Im (f x)
 4. x \<in> A
[PROOF STEP]
by (auto simp add: infsum_Im summable_on_Im less_eq_complex_def)
[PROOF STATE]
proof (state)
this:
Im (f x) = 0

goal (1 subgoal):
 1. f x = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Im (f x) = 0

goal (1 subgoal):
 1. f x = 0
[PROOF STEP]
have \<open>Re (f x) = 0\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (f x) = 0
[PROOF STEP]
apply (rule nonneg_infsum_le_0D[where A=A])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. (\<Sum>\<^sub>\<infinity>a\<in>A. Re (f a)) \<le> 0
 2. (\<lambda>a. Re (f a)) summable_on A
 3. \<And>x. x \<in> A \<Longrightarrow> 0 \<le> Re (f x)
 4. x \<in> A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
infsum f A \<le> 0
f summable_on A
?x \<in> A \<Longrightarrow> 0 \<le> f ?x
x \<in> A

goal (4 subgoals):
 1. (\<Sum>\<^sub>\<infinity>a\<in>A. Re (f a)) \<le> 0
 2. (\<lambda>a. Re (f a)) summable_on A
 3. \<And>x. x \<in> A \<Longrightarrow> 0 \<le> Re (f x)
 4. x \<in> A
[PROOF STEP]
by (auto simp add: summable_on_Re infsum_Re less_eq_complex_def)
[PROOF STATE]
proof (state)
this:
Re (f x) = 0

goal (1 subgoal):
 1. f x = 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Im (f x) = 0
Re (f x) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Im (f x) = 0
Re (f x) = 0

goal (1 subgoal):
 1. f x = 0
[PROOF STEP]
by (simp add: complex_eqI)
[PROOF STATE]
proof (state)
this:
f x = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma circuit_in_iff_rank_of:
  assumes "X \<subseteq> \<E>"
  shows "circuit_in \<E> X \<longleftrightarrow> X \<noteq> {} \<and> (\<forall>x \<in> X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. circuit_in \<E> X = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. circuit_in \<E> X = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
have "circuit_in \<E> X \<longleftrightarrow> \<E>.circuit X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. circuit_in \<E> X = \<E>.circuit X
[PROOF STEP]
unfolding circuit_in_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<E>.circuit X = \<E>.circuit X
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
circuit_in \<E> X = \<E>.circuit X

goal (1 subgoal):
 1. circuit_in \<E> X = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
circuit_in \<E> X = \<E>.circuit X

goal (1 subgoal):
 1. circuit_in \<E> X = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
have "\<dots> \<longleftrightarrow>  X \<noteq> {} \<and> (\<forall>x \<in> X. \<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<E>.circuit X = (X \<noteq> {} \<and> (\<forall>x\<in>X. \<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X))
[PROOF STEP]
using \<E>.circuit_iff_rank_of[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<E>.circuit X = (X \<noteq> {} \<and> (\<forall>x\<in>X. \<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X))

goal (1 subgoal):
 1. \<E>.circuit X = (X \<noteq> {} \<and> (\<forall>x\<in>X. \<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<E>.circuit X = (X \<noteq> {} \<and> (\<forall>x\<in>X. \<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X))

goal (1 subgoal):
 1. circuit_in \<E> X = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<E>.circuit X = (X \<noteq> {} \<and> (\<forall>x\<in>X. \<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X))

goal (1 subgoal):
 1. circuit_in \<E> X = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> X \<noteq> {} \<and> (\<forall>x \<in> X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X \<noteq> {} \<and> (\<forall>x\<in>X. \<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X)) = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (X \<noteq> {} \<and> (\<forall>x\<in>X. \<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X)) = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (X \<noteq> {} \<and> (\<forall>x\<in>X. \<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X)) = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (X \<noteq> {} \<and> (\<forall>x\<in>X. \<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X)) = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
have "\<E>.rank_of (X - {x}) = rank_of (X - {x})" "\<E>.rank_of X = rank_of X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<E>.rank_of (X - {x}) = rank_of (X - {x}) &&& \<E>.rank_of X = rank_of X
[PROOF STEP]
using assms rank_of_sub_cong[OF *, of "X - {x}"] rank_of_sub_cong[OF *, of X]
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> \<E>
X - {x} \<subseteq> \<E> \<Longrightarrow> \<E>.rank_of (X - {x}) = rank_of (X - {x})
X \<subseteq> \<E> \<Longrightarrow> \<E>.rank_of X = rank_of X

goal (1 subgoal):
 1. \<E>.rank_of (X - {x}) = rank_of (X - {x}) &&& \<E>.rank_of X = rank_of X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<E>.rank_of (X - {x}) = rank_of (X - {x})
\<E>.rank_of X = rank_of X

goal (1 subgoal):
 1. (X \<noteq> {} \<and> (\<forall>x\<in>X. \<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X)) = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<E>.rank_of (X - {x}) = rank_of (X - {x})
\<E>.rank_of X = rank_of X
[PROOF STEP]
have "\<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X \<longleftrightarrow> rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X"
[PROOF STATE]
proof (prove)
using this:
\<E>.rank_of (X - {x}) = rank_of (X - {x})
\<E>.rank_of X = rank_of X

goal (1 subgoal):
 1. (\<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X) = (rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X) = (rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X)

goal (1 subgoal):
 1. (X \<noteq> {} \<and> (\<forall>x\<in>X. \<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X)) = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(\<E>.rank_of (X - {?x2}) = card (X - {?x2}) \<and> card (X - {?x2}) = \<E>.rank_of X) = (rank_of (X - {?x2}) = card (X - {?x2}) \<and> card (X - {?x2}) = rank_of X)

goal (1 subgoal):
 1. (X \<noteq> {} \<and> (\<forall>x\<in>X. \<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X)) = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<E>.rank_of (X - {?x2}) = card (X - {?x2}) \<and> card (X - {?x2}) = \<E>.rank_of X) = (rank_of (X - {?x2}) = card (X - {?x2}) \<and> card (X - {?x2}) = rank_of X)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<E>.rank_of (X - {?x2}) = card (X - {?x2}) \<and> card (X - {?x2}) = \<E>.rank_of X) = (rank_of (X - {?x2}) = card (X - {?x2}) \<and> card (X - {?x2}) = rank_of X)

goal (1 subgoal):
 1. (X \<noteq> {} \<and> (\<forall>x\<in>X. \<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X)) = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
by (auto simp: simp del: card_Diff_insert)
[PROOF STATE]
proof (state)
this:
(X \<noteq> {} \<and> (\<forall>x\<in>X. \<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X)) = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(X \<noteq> {} \<and> (\<forall>x\<in>X. \<E>.rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = \<E>.rank_of X)) = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))

goal (1 subgoal):
 1. circuit_in \<E> X = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
circuit_in \<E> X = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
circuit_in \<E> X = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))

goal (1 subgoal):
 1. circuit_in \<E> X = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
circuit_in \<E> X = (X \<noteq> {} \<and> (\<forall>x\<in>X. rank_of (X - {x}) = card (X - {x}) \<and> card (X - {x}) = rank_of X))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rep_monomial [simp]: "rep (monomial c x) = c *s x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rep (monomial c x) = c *s x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rep (monomial c x) = c *s x
[PROOF STEP]
have sub: "keys (monomial c x) \<subseteq> {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. keys (monomial c x) \<subseteq> {x}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
keys (monomial c x) \<subseteq> {x}

goal (1 subgoal):
 1. rep (monomial c x) = c *s x
[PROOF STEP]
have "rep (monomial c x) = (\<Sum>v\<in>{x}. lookup (monomial c x) v *s v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rep (monomial c x) = (\<Sum>v\<in>{x}. lookup (monomial c x) v *s v)
[PROOF STEP]
unfolding rep_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>keys (monomial c x). lookup (monomial c x) v *s v) = (\<Sum>v\<in>{x}. lookup (monomial c x) v *s v)
[PROOF STEP]
by (rule sum.mono_neutral_left, simp, fact sub, simp)
[PROOF STATE]
proof (state)
this:
rep (monomial c x) = (\<Sum>v\<in>{x}. lookup (monomial c x) v *s v)

goal (1 subgoal):
 1. rep (monomial c x) = c *s x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rep (monomial c x) = (\<Sum>v\<in>{x}. lookup (monomial c x) v *s v)

goal (1 subgoal):
 1. rep (monomial c x) = c *s x
[PROOF STEP]
have "... = c *s x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>{x}. lookup (monomial c x) v *s v) = c *s x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>{x}. lookup (monomial c x) v *s v) = c *s x

goal (1 subgoal):
 1. rep (monomial c x) = c *s x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rep (monomial c x) = c *s x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rep (monomial c x) = c *s x

goal (1 subgoal):
 1. rep (monomial c x) = c *s x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
rep (monomial c x) = c *s x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dirichlet_prod_const_right [simp]:
  assumes "n > 0"
  shows   "dirichlet_prod f (\<lambda>n. if n = Suc 0 then c else 0) n = f n * c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dirichlet_prod f (\<lambda>n. if n = Suc 0 then c else (0::'a)) n = f n * c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dirichlet_prod f (\<lambda>n. if n = Suc 0 then c else (0::'a)) n = f n * c
[PROOF STEP]
have "dirichlet_prod f (\<lambda>n. if n = Suc 0 then c else 0) n =
          (\<Sum>d | d dvd n. (if d = n then f n * c else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dirichlet_prod f (\<lambda>n. if n = Suc 0 then c else (0::'a)) n = (\<Sum>d | d dvd n. if d = n then f n * c else (0::'a))
[PROOF STEP]
unfolding dirichlet_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. f d * (if n div d = Suc 0 then c else (0::'a))) = (\<Sum>d | d dvd n. if d = n then f n * c else (0::'a))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. f d * (if n div d = Suc 0 then c else (0::'a))) = (\<Sum>d | d dvd n. if d = n then f n * c else (0::'a))
[PROOF STEP]
by (intro sum.cong refl) (auto elim!: dvdE split: if_splits)
[PROOF STATE]
proof (state)
this:
dirichlet_prod f (\<lambda>n. if n = Suc 0 then c else (0::'a)) n = (\<Sum>d | d dvd n. if d = n then f n * c else (0::'a))

goal (1 subgoal):
 1. dirichlet_prod f (\<lambda>n. if n = Suc 0 then c else (0::'a)) n = f n * c
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dirichlet_prod f (\<lambda>n. if n = Suc 0 then c else (0::'a)) n = (\<Sum>d | d dvd n. if d = n then f n * c else (0::'a))

goal (1 subgoal):
 1. dirichlet_prod f (\<lambda>n. if n = Suc 0 then c else (0::'a)) n = f n * c
[PROOF STEP]
have "\<dots> = f n * c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. if d = n then f n * c else (0::'a)) = f n * c
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. if d = n then f n * c else (0::'a)) = f n * c
[PROOF STEP]
by (subst sum.delta) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. if d = n then f n * c else (0::'a)) = f n * c

goal (1 subgoal):
 1. dirichlet_prod f (\<lambda>n. if n = Suc 0 then c else (0::'a)) n = f n * c
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dirichlet_prod f (\<lambda>n. if n = Suc 0 then c else (0::'a)) n = f n * c
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dirichlet_prod f (\<lambda>n. if n = Suc 0 then c else (0::'a)) n = f n * c

goal (1 subgoal):
 1. dirichlet_prod f (\<lambda>n. if n = Suc 0 then c else (0::'a)) n = f n * c
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dirichlet_prod f (\<lambda>n. if n = Suc 0 then c else (0::'a)) n = f n * c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sinh_plus_cosh: "sinh x + cosh x = exp x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sinh x + cosh x = exp x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sinh x + cosh x = exp x
[PROOF STEP]
have "sinh x + cosh x = (1 / 2) *\<^sub>R (exp x + exp x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sinh x + cosh x = (1 / 2) *\<^sub>R (exp x + exp x)
[PROOF STEP]
by (simp add: sinh_def cosh_def algebra_simps)
[PROOF STATE]
proof (state)
this:
sinh x + cosh x = (1 / 2) *\<^sub>R (exp x + exp x)

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

goal (1 subgoal):
 1. sinh x + cosh x = exp x
[PROOF STEP]
have "\<dots> = exp x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / 2) *\<^sub>R (exp x + exp x) = exp x
[PROOF STEP]
by (rule scaleR_half_double)
[PROOF STATE]
proof (state)
this:
(1 / 2) *\<^sub>R (exp x + exp x) = exp x

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

goal (1 subgoal):
 1. sinh x + cosh x = exp x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sinh x + cosh x = exp x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fixes M1 M2 M3
      shows "(mat (row_length M1) (length M1) M1)
            \<and>(mat (row_length M2) (length M2) M2)
            \<and>(mat (row_length M3) (length M3) M3)
             \<Longrightarrow> (M1 \<otimes> (M2 \<otimes> M3)) = ((M1 \<otimes> M2) \<otimes> M3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<and> mat (row_length M3) (length M3) M3 \<Longrightarrow> M1 \<otimes> (M2 \<otimes> M3) = M1 \<otimes> M2 \<otimes> M3
[PROOF STEP]
using associativity
[PROOF STATE]
proof (prove)
using this:
mat (row_length ?M1.0) (length ?M1.0) ?M1.0 \<and> mat (row_length ?M2.0) (length ?M2.0) ?M2.0 \<and> mat (row_length ?M3.0) (length ?M3.0) ?M3.0 \<Longrightarrow> ?M1.0 \<otimes> (?M2.0 \<otimes> ?M3.0) = ?M1.0 \<otimes> ?M2.0 \<otimes> ?M3.0

goal (1 subgoal):
 1. mat (row_length M1) (length M1) M1 \<and> mat (row_length M2) (length M2) M2 \<and> mat (row_length M3) (length M3) M3 \<Longrightarrow> M1 \<otimes> (M2 \<otimes> M3) = M1 \<otimes> M2 \<otimes> M3
[PROOF STEP]
by auto


[STATEMENT]
lemma infinite_solutions_homogeneous_imp_dim_solution_set_not_zero:
  fixes A::"'a::{field}^'n::{mod_type}^'rows::{mod_type}"
  assumes i: "infinite (solution_set A 0)"
  shows "vec.dim (solution_set A 0) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < vec.dim (solution_set A 0)
[PROOF STEP]
by (metis dim_solution_set_0 finite.simps gr0I i)


[STATEMENT]
lemma ceiling_eq_iff: "\<lceil>x\<rceil> = a \<longleftrightarrow> of_int a - 1 < x \<and> x \<le> of_int a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lceil>x\<rceil> = a) = (of_int a - (1::'a) < x \<and> x \<le> of_int a)
[PROOF STEP]
using ceiling_correct ceiling_unique
[PROOF STATE]
proof (prove)
using this:
of_int \<lceil>?x\<rceil> - (1::?'a) < ?x \<and> ?x \<le> of_int \<lceil>?x\<rceil>
\<lbrakk>of_int ?z - (1::?'a) < ?x; ?x \<le> of_int ?z\<rbrakk> \<Longrightarrow> \<lceil>?x\<rceil> = ?z

goal (1 subgoal):
 1. (\<lceil>x\<rceil> = a) = (of_int a - (1::'a) < x \<and> x \<le> of_int a)
[PROOF STEP]
by auto


[STATEMENT]
lemma sq_norm_of_int: "\<parallel>map_vec of_int v :: 'a :: {conjugatable_ring,ring_1} vec\<parallel>\<^sup>2 = of_int \<parallel>v\<parallel>\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>of_int_hom.vec_hom v\<parallel>\<^sup>2 = of_int \<parallel>v\<parallel>\<^sup>2
[PROOF STEP]
unfolding sq_norm_vec_as_cscalar_prod scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (conjugate (of_int_hom.vec_hom v)). of_int_hom.vec_hom v $ i * conjugate (of_int_hom.vec_hom v) $ i) = of_int (\<Sum>i = 0..<dim_vec (conjugate v). v $ i * conjugate v $ i)
[PROOF STEP]
unfolding hom_distribs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (conjugate (of_int_hom.vec_hom v)). of_int_hom.vec_hom v $ i * conjugate (of_int_hom.vec_hom v) $ i) = (\<Sum>x = 0..<dim_vec (conjugate v). of_int (v $ x) * of_int (conjugate v $ x))
[PROOF STEP]
by (rule sum.cong, auto)


[STATEMENT]
lemma Digamma_real_strict_mono: "(0::real) < x \<Longrightarrow> x < y \<Longrightarrow> Digamma x < Digamma y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; x < y\<rbrakk> \<Longrightarrow> Digamma x < Digamma y
[PROOF STEP]
by (rule Polygamma_real_strict_mono) simp_all


[STATEMENT]
lemma perzeta_one_half_left':
  "perzeta (1 / 2) s =
         (if s = 1 then -ln 2 else (2 powr (1 - s) - 1) / (s - 1)) * ((s - 1) * pre_zeta 1 s + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. perzeta (1 / 2) s = (if s = 1 then - Ln 2 else (2 powr (1 - s) - 1) / (s - 1)) * ((s - 1) * pre_zeta 1 s + 1)
[PROOF STEP]
by (cases "s = 1") (auto simp: perzeta_one_half_left field_simps zeta_def hurwitz_zeta_def)


[STATEMENT]
lemma sq_mtx_vec_mult_sum_cols: "A *\<^sub>V x = sum (\<lambda>i. x $ i *\<^sub>R \<c>\<o>\<l> i A) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>V x = (\<Sum>i\<in>UNIV. x $ i *\<^sub>R \<c>\<o>\<l> i A)
[PROOF STEP]
by(transfer) (simp add: matrix_mult_sum scalar_mult_eq_scaleR)


[STATEMENT]
lemma cosine_law_vector:
  "norm (u - v) ^ 2 = norm u ^ 2 + norm v ^ 2 - 2 * norm u * norm v * cos (vangle u v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm (u - v))\<^sup>2 = (norm u)\<^sup>2 + (norm v)\<^sup>2 - 2 * norm u * norm v * cos (vangle u v)
[PROOF STEP]
by (simp add: power2_norm_eq_inner cos_vangle algebra_simps inner_commute)


[STATEMENT]
lemma det_identical_rows: "i \<noteq> i' \<Longrightarrow> row A i = row A i' \<Longrightarrow> det A = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<noteq> i'; Square_Matrix.row A i = Square_Matrix.row A i'\<rbrakk> \<Longrightarrow> Square_Matrix.det A = (0::'b)
[PROOF STEP]
using det_identical_cols[of i i' "transpose A"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i \<noteq> i'; col (Square_Matrix.transpose A) i = col (Square_Matrix.transpose A) i'\<rbrakk> \<Longrightarrow> Square_Matrix.det (Square_Matrix.transpose A) = (0::'b)

goal (1 subgoal):
 1. \<lbrakk>i \<noteq> i'; Square_Matrix.row A i = Square_Matrix.row A i'\<rbrakk> \<Longrightarrow> Square_Matrix.det A = (0::'b)
[PROOF STEP]
by (simp add: det_transpose col_transpose)


[STATEMENT]
lemma tendsto_compose: "g \<midarrow>l\<rightarrow> g l \<Longrightarrow> (f \<longlongrightarrow> l) F \<Longrightarrow> ((\<lambda>x. g (f x)) \<longlongrightarrow> g l) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g \<midarrow>l\<rightarrow> g l; (f \<longlongrightarrow> l) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. g (f x)) \<longlongrightarrow> g l) F
[PROOF STEP]
unfolding tendsto_at_iff_tendsto_nhds
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(g \<longlongrightarrow> g l) (nhds l); (f \<longlongrightarrow> l) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. g (f x)) \<longlongrightarrow> g l) F
[PROOF STEP]
by (rule filterlim_compose[of g])


[STATEMENT]
lemma relabel_vars_smult:
  assumes "g \<in> I \<rightarrow> J"
  assumes "P \<in> carrier (Pring R I)"
  assumes "a \<in> carrier R"
  shows "relabel_vars I J g (a \<odot>\<^bsub>Pring R I\<^esub>P) = a \<odot>\<^bsub>Pring R J\<^esub>relabel_vars I J g P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. relabel_vars I J g (a \<odot>\<^bsub>Pring R I\<^esub> P) = a \<odot>\<^bsub>Pring R J\<^esub> relabel_vars I J g P
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. relabel_vars I J g (a \<odot>\<^bsub>Pring R I\<^esub> P) = a \<odot>\<^bsub>Pring R J\<^esub> relabel_vars I J g P
[PROOF STEP]
have 0: "a \<odot>\<^bsub>Pring R I\<^esub>P = indexed_const a \<otimes>\<^bsub>Pring R I\<^esub> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<odot>\<^bsub>Pring R I\<^esub> P = indexed_const a \<otimes>\<^bsub>Pring R I\<^esub> P
[PROOF STEP]
by (metis Pring_car Pring_mult Pring_smult assms(2) assms(3) poly_scalar_mult_eq)
[PROOF STATE]
proof (state)
this:
a \<odot>\<^bsub>Pring R I\<^esub> P = indexed_const a \<otimes>\<^bsub>Pring R I\<^esub> P

goal (1 subgoal):
 1. relabel_vars I J g (a \<odot>\<^bsub>Pring R I\<^esub> P) = a \<odot>\<^bsub>Pring R J\<^esub> relabel_vars I J g P
[PROOF STEP]
have 1: "a \<odot>\<^bsub>Pring R J\<^esub>relabel_vars I J g P = indexed_const a \<otimes>\<^bsub>Pring R J\<^esub> relabel_vars I J g P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<odot>\<^bsub>Pring R J\<^esub> relabel_vars I J g P = indexed_const a \<otimes>\<^bsub>Pring R J\<^esub> relabel_vars I J g P
[PROOF STEP]
by (metis Pring_car Pring_mult Pring_smult assms(1) assms(2) assms(3) poly_scalar_mult_eq relabel_vars_closed)
[PROOF STATE]
proof (state)
this:
a \<odot>\<^bsub>Pring R J\<^esub> relabel_vars I J g P = indexed_const a \<otimes>\<^bsub>Pring R J\<^esub> relabel_vars I J g P

goal (1 subgoal):
 1. relabel_vars I J g (a \<odot>\<^bsub>Pring R I\<^esub> P) = a \<odot>\<^bsub>Pring R J\<^esub> relabel_vars I J g P
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. relabel_vars I J g (a \<odot>\<^bsub>Pring R I\<^esub> P) = a \<odot>\<^bsub>Pring R J\<^esub> relabel_vars I J g P
[PROOF STEP]
using 0 1 assms relabel_vars_mult relabel_vars_is_morphism(3)[of g I J a]
[PROOF STATE]
proof (prove)
using this:
a \<odot>\<^bsub>Pring R I\<^esub> P = indexed_const a \<otimes>\<^bsub>Pring R I\<^esub> P
a \<odot>\<^bsub>Pring R J\<^esub> relabel_vars I J g P = indexed_const a \<otimes>\<^bsub>Pring R J\<^esub> relabel_vars I J g P
g \<in> I \<rightarrow> J
P \<in> carrier (Pring R I)
a \<in> carrier R
\<lbrakk>?g \<in> ?I \<rightarrow> ?J; ?P \<in> carrier (Pring R ?I); ?Q \<in> carrier (Pring R ?I)\<rbrakk> \<Longrightarrow> relabel_vars ?I ?J ?g (?P \<otimes>\<^bsub>Pring R ?I\<^esub> ?Q) = relabel_vars ?I ?J ?g ?P \<otimes>\<^bsub>Pring R ?J\<^esub> relabel_vars ?I ?J ?g ?Q
\<lbrakk>g \<in> I \<rightarrow> J; a \<in> carrier R\<rbrakk> \<Longrightarrow> relabel_vars I J g (indexed_const a) = indexed_const a

goal (1 subgoal):
 1. relabel_vars I J g (a \<odot>\<^bsub>Pring R I\<^esub> P) = a \<odot>\<^bsub>Pring R J\<^esub> relabel_vars I J g P
[PROOF STEP]
by (metis indexed_const_closed)
[PROOF STATE]
proof (state)
this:
relabel_vars I J g (a \<odot>\<^bsub>Pring R I\<^esub> P) = a \<odot>\<^bsub>Pring R J\<^esub> relabel_vars I J g P

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma state_set_card_iii:
  fixes X a
  shows "card (state_set (a # X)) = 1 + card (state_set X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (state_set (a # X)) = 1 + card (state_set X)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (state_set (a # X)) = 1 + card (state_set X)
[PROOF STEP]
have "card (state_set (a # X)) = card (insert [a] (Cons a ` state_set X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (state_set (a # X)) = card (insert [a] ((#) a ` state_set X))
[PROOF STEP]
by auto
      \<comment> \<open>TODO unwrap this metis step.\<close>
[PROOF STATE]
proof (state)
this:
card (state_set (a # X)) = card (insert [a] ((#) a ` state_set X))

goal (1 subgoal):
 1. card (state_set (a # X)) = 1 + card (state_set X)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (state_set (a # X)) = card (insert [a] ((#) a ` state_set X))

goal (1 subgoal):
 1. card (state_set (a # X)) = 1 + card (state_set X)
[PROOF STEP]
have "\<dots> = 1 + card (Cons a ` state_set X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (insert [a] ((#) a ` state_set X)) = 1 + card ((#) a ` state_set X)
[PROOF STEP]
using state_set_card_i
[PROOF STATE]
proof (prove)
using this:
[?a] \<notin> (#) ?a ` state_set ?X

goal (1 subgoal):
 1. card (insert [a] ((#) a ` state_set X)) = 1 + card ((#) a ` state_set X)
[PROOF STEP]
by (metis Suc_eq_plus1_left card_insert_disjoint finite_imageI state_set_finite)
[PROOF STATE]
proof (state)
this:
card (insert [a] ((#) a ` state_set X)) = 1 + card ((#) a ` state_set X)

goal (1 subgoal):
 1. card (state_set (a # X)) = 1 + card (state_set X)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (insert [a] ((#) a ` state_set X)) = 1 + card ((#) a ` state_set X)

goal (1 subgoal):
 1. card (state_set (a # X)) = 1 + card (state_set X)
[PROOF STEP]
have"\<dots> = 1 + card (state_set X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + card ((#) a ` state_set X) = 1 + card (state_set X)
[PROOF STEP]
using state_set_card_ii
[PROOF STATE]
proof (prove)
using this:
card ((#) ?a ` state_set ?X) = card (state_set ?X)

goal (1 subgoal):
 1. 1 + card ((#) a ` state_set X) = 1 + card (state_set X)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
1 + card ((#) a ` state_set X) = 1 + card (state_set X)

goal (1 subgoal):
 1. card (state_set (a # X)) = 1 + card (state_set X)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (state_set (a # X)) = 1 + card (state_set X)
[PROOF STEP]
show "card (state_set (a # X)) = 1 + card (state_set X)"
[PROOF STATE]
proof (prove)
using this:
card (state_set (a # X)) = 1 + card (state_set X)

goal (1 subgoal):
 1. card (state_set (a # X)) = 1 + card (state_set X)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card (state_set (a # X)) = 1 + card (state_set X)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_cot [tendsto_intros]: "(f \<longlongrightarrow> a) F \<Longrightarrow> sin a \<noteq> 0 \<Longrightarrow> ((\<lambda>x. cot (f x)) \<longlongrightarrow> cot a) F"
  for f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> a) F; sin a \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> ((\<lambda>x. cot (f x)) \<longlongrightarrow> cot a) F
[PROOF STEP]
by (rule isCont_tendsto_compose [OF isCont_cot])


[STATEMENT]
lemma tan_sec: "cos x \<noteq> 0 \<Longrightarrow> 1 + (tan x)\<^sup>2 = (inverse (cos x))\<^sup>2"
  for x :: "'a::{real_normed_field,banach,field}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x \<noteq> (0::'a) \<Longrightarrow> (1::'a) + (tan x)\<^sup>2 = (inverse (cos x))\<^sup>2
[PROOF STEP]
by (simp add: add_divide_eq_iff inverse_eq_divide power2_eq_square tan_def)


[STATEMENT]
lemma card_insert_disjoint': "\<lbrakk>finite A; x \<notin> A\<rbrakk> \<Longrightarrow> card (insert x A) - Suc 0 = card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; x \<notin> A\<rbrakk> \<Longrightarrow> card (insert x A) - Suc 0 = card A
[PROOF STEP]
by (drule (1) card_insert_disjoint) auto


[STATEMENT]
lemma homeomorphic_closed_intervals_real:
  fixes a::real and b and c::real and d
  assumes "a<b" and "c<d"
  shows "{a..b} homeomorphic {c..d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a..b} homeomorphic {c..d}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a < b
c < d

goal (1 subgoal):
 1. {a..b} homeomorphic {c..d}
[PROOF STEP]
by (auto intro: homeomorphic_convex_compact)


[STATEMENT]
lemma divisor_sigma_0_left_nat: "divisor_sigma 0 n = divisor_count n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_sigma 0 n = divisor_count n
[PROOF STEP]
by (simp add: divisor_sigma_def divisor_count_def)


[STATEMENT]
lemma induced_ghom_ginjec: "\<lbrakk>Group F; Group G; f \<in> gHom F G \<rbrakk> \<Longrightarrow>
            ginj\<^bsub>(F/(gker\<^bsub>F,G\<^esub> f)),G\<^esub> (f\<dieresis>\<^bsub>F,G\<^esub>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> ginj\<^bsub>(F / gker\<^bsub>F,G\<^esub> f),G\<^esub> (f\<dieresis>\<^bsub>F,G\<^esub>)
[PROOF STEP]
apply (simp add:ginjec_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> f\<dieresis>\<^bsub>F,G\<^esub> \<in> gHom (F / gker\<^bsub>F,G\<^esub> f) G \<and> inj_on (f\<dieresis>\<^bsub>F,G\<^esub>) (carrier (F / gker\<^bsub>F,G\<^esub> f))
[PROOF STEP]
apply (simp add:inducedHom)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> inj_on (f\<dieresis>\<^bsub>F,G\<^esub>) (carrier (F / gker\<^bsub>F,G\<^esub> f))
[PROOF STEP]
apply (simp add:inj_on_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). \<forall>y\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). (f\<dieresis>\<^bsub>F,G\<^esub>) x = (f\<dieresis>\<^bsub>F,G\<^esub>) y \<longrightarrow> x = y
[PROOF STEP]
apply (rule ballI)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>Group F; Group G; f \<in> gHom F G; x \<in> carrier (F / gker\<^bsub>F,G\<^esub> f); y \<in> carrier (F / gker\<^bsub>F,G\<^esub> f)\<rbrakk> \<Longrightarrow> (f\<dieresis>\<^bsub>F,G\<^esub>) x = (f\<dieresis>\<^bsub>F,G\<^esub>) y \<longrightarrow> x = y
[PROOF STEP]
apply (simp add:Qg_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>Group F; Group G; f \<in> gHom F G; x \<in> set_rcs F (gker\<^bsub>F,G\<^esub> f); y \<in> set_rcs F (gker\<^bsub>F,G\<^esub> f)\<rbrakk> \<Longrightarrow> (f\<dieresis>\<^bsub>F,G\<^esub>) x = (f\<dieresis>\<^bsub>F,G\<^esub>) y \<longrightarrow> x = y
[PROOF STEP]
apply (simp add:set_rcs_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>Group F; Group G; f \<in> gHom F G; \<exists>a\<in>carrier F. x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; \<exists>a\<in>carrier F. y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a\<rbrakk> \<Longrightarrow> (f\<dieresis>\<^bsub>F,G\<^esub>) x = (f\<dieresis>\<^bsub>F,G\<^esub>) y \<longrightarrow> x = y
[PROOF STEP]
apply ((erule bexE)+, rule impI, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; (f\<dieresis>\<^bsub>F,G\<^esub>) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a) = (f\<dieresis>\<^bsub>F,G\<^esub>) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa)\<rbrakk> \<Longrightarrow> gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa
[PROOF STEP]
apply (simp add:inducedHOMTr0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; f a = f aa\<rbrakk> \<Longrightarrow> gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa
[PROOF STEP]
apply (simp add: gkernTr11[THEN sym])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma llist_all2_conv_all_lnth:
  "llist_all2 P xs ys \<longleftrightarrow>
   llength xs = llength ys \<and>
   (\<forall>n. enat n < llength ys \<longrightarrow> P (lnth xs n) (lnth ys n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llist_all2 P xs ys = (llength xs = llength ys \<and> (\<forall>n. enat n < llength ys \<longrightarrow> P (lnth xs n) (lnth ys n)))
[PROOF STEP]
by(auto dest: llist_all2_llengthD llist_all2_lnthD2 intro: llist_all2_all_lnthI)


[STATEMENT]
lemma matrix'_matrix_change_of_basis:
  fixes B::"'a::{field}^'n^'n" and B'::"'a^'n^'n" and C::"'a^'m^'m" and C'::"'a^'m^'m"
  assumes basis_B: "is_basis (set_of_vector B)" and basis_B': "is_basis (set_of_vector B')"
  and basis_C: "is_basis (set_of_vector C)" and basis_C': "is_basis (set_of_vector C')"
  and linear_f: "linear ((*s)) ((*s)) f"
  shows "matrix' B' C' f = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix' B' C' f = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B
[PROOF STEP]
proof (unfold matrix_eq, clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x
[PROOF STEP]
obtain v where v: "x=coord B' v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>v. x = coord B' v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using bij_coord[OF basis_B']
[PROOF STATE]
proof (prove)
using this:
bij (coord B')

goal (1 subgoal):
 1. (\<And>v. x = coord B' v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson bij_pointE)
[PROOF STATE]
proof (state)
this:
x = coord B' v

goal (1 subgoal):
 1. \<And>x. matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x
[PROOF STEP]
have "matrix_change_of_basis C C' ** matrix' B C f** matrix_change_of_basis B' B *v (coord B' v)
    = matrix_change_of_basis C C' ** matrix' B C f *v (matrix_change_of_basis B' B *v (coord B' v)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v coord B' v = matrix_change_of_basis C C' ** matrix' B C f *v (matrix_change_of_basis B' B *v coord B' v)
[PROOF STEP]
unfolding matrix_vector_mul_assoc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v coord B' v = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v coord B' v
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v coord B' v = matrix_change_of_basis C C' ** matrix' B C f *v (matrix_change_of_basis B' B *v coord B' v)

goal (1 subgoal):
 1. \<And>x. matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v coord B' v = matrix_change_of_basis C C' ** matrix' B C f *v (matrix_change_of_basis B' B *v coord B' v)

goal (1 subgoal):
 1. \<And>x. matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x
[PROOF STEP]
have "... = matrix_change_of_basis C C' ** matrix' B C f *v (coord B v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis C C' ** matrix' B C f *v (matrix_change_of_basis B' B *v coord B' v) = matrix_change_of_basis C C' ** matrix' B C f *v coord B v
[PROOF STEP]
unfolding matrix_change_of_basis_works[OF basis_B' basis_B]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis C C' ** matrix' B C f *v coord B v = matrix_change_of_basis C C' ** matrix' B C f *v coord B v
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis C C' ** matrix' B C f *v (matrix_change_of_basis B' B *v coord B' v) = matrix_change_of_basis C C' ** matrix' B C f *v coord B v

goal (1 subgoal):
 1. \<And>x. matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis C C' ** matrix' B C f *v (matrix_change_of_basis B' B *v coord B' v) = matrix_change_of_basis C C' ** matrix' B C f *v coord B v

goal (1 subgoal):
 1. \<And>x. matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x
[PROOF STEP]
have "... = matrix_change_of_basis C C' *v (matrix' B C f *v (coord B v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis C C' ** matrix' B C f *v coord B v = matrix_change_of_basis C C' *v (matrix' B C f *v coord B v)
[PROOF STEP]
unfolding matrix_vector_mul_assoc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis C C' ** matrix' B C f *v coord B v = matrix_change_of_basis C C' ** matrix' B C f *v coord B v
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis C C' ** matrix' B C f *v coord B v = matrix_change_of_basis C C' *v (matrix' B C f *v coord B v)

goal (1 subgoal):
 1. \<And>x. matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis C C' ** matrix' B C f *v coord B v = matrix_change_of_basis C C' *v (matrix' B C f *v coord B v)

goal (1 subgoal):
 1. \<And>x. matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x
[PROOF STEP]
have "... = matrix_change_of_basis C C' *v (coord C (f v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis C C' *v (matrix' B C f *v coord B v) = matrix_change_of_basis C C' *v coord C (f v)
[PROOF STEP]
unfolding coord_matrix'[OF basis_B basis_C linear_f]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis C C' *v (matrix' B C f *v coord B v) = matrix_change_of_basis C C' *v (matrix' B C f *v coord B v)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis C C' *v (matrix' B C f *v coord B v) = matrix_change_of_basis C C' *v coord C (f v)

goal (1 subgoal):
 1. \<And>x. matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis C C' *v (matrix' B C f *v coord B v) = matrix_change_of_basis C C' *v coord C (f v)

goal (1 subgoal):
 1. \<And>x. matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x
[PROOF STEP]
have "... = coord C' (f v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis C C' *v coord C (f v) = coord C' (f v)
[PROOF STEP]
unfolding matrix_change_of_basis_works[OF basis_C basis_C']
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coord C' (f v) = coord C' (f v)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis C C' *v coord C (f v) = coord C' (f v)

goal (1 subgoal):
 1. \<And>x. matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis C C' *v coord C (f v) = coord C' (f v)

goal (1 subgoal):
 1. \<And>x. matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x
[PROOF STEP]
have "... = matrix' B' C' f *v coord B' v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coord C' (f v) = matrix' B' C' f *v coord B' v
[PROOF STEP]
unfolding coord_matrix'[OF basis_B' basis_C' linear_f]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix' B' C' f *v coord B' v = matrix' B' C' f *v coord B' v
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
coord C' (f v) = matrix' B' C' f *v coord B' v

goal (1 subgoal):
 1. \<And>x. matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v coord B' v = matrix' B' C' f *v coord B' v
[PROOF STEP]
show " matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x"
[PROOF STATE]
proof (prove)
using this:
matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v coord B' v = matrix' B' C' f *v coord B' v

goal (1 subgoal):
 1. matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x
[PROOF STEP]
unfolding v
[PROOF STATE]
proof (prove)
using this:
matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v coord B' v = matrix' B' C' f *v coord B' v

goal (1 subgoal):
 1. matrix' B' C' f *v coord B' v = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v coord B' v
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
matrix' B' C' f *v x = matrix_change_of_basis C C' ** matrix' B C f ** matrix_change_of_basis B' B *v x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma complete_algebra_summable_geometric:
  fixes x :: "'a::{real_normed_algebra_1,banach}"
  assumes "norm x < 1"
  shows "summable (\<lambda>n. x ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable ((^) x)
[PROOF STEP]
proof (rule summable_comparison_test)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>N. \<forall>n\<ge>N. norm (x ^ n) \<le> ?g n
 2. summable ?g
[PROOF STEP]
show "\<exists>N. \<forall>n\<ge>N. norm (x ^ n) \<le> norm x ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. norm (x ^ n) \<le> norm x ^ n
[PROOF STEP]
by (simp add: norm_power_ineq)
[PROOF STATE]
proof (state)
this:
\<exists>N. \<forall>n\<ge>N. norm (x ^ n) \<le> norm x ^ n

goal (1 subgoal):
 1. summable ((^) (norm x))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
norm x < 1
[PROOF STEP]
show "summable (\<lambda>n. norm x ^ n)"
[PROOF STATE]
proof (prove)
using this:
norm x < 1

goal (1 subgoal):
 1. summable ((^) (norm x))
[PROOF STEP]
by (simp add: summable_geometric)
[PROOF STATE]
proof (state)
this:
summable ((^) (norm x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_minus_distrib_mat_vec[algebra_simps]: assumes A: "(A :: 'a :: ring mat) \<in> carrier_mat nr nc"
  and v: "v \<in> carrier_vec nc"
  and w: "w \<in> carrier_vec nc"
shows "A *\<^sub>v (v - w) = A *\<^sub>v v - A *\<^sub>v w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>v (v - w) = A *\<^sub>v v - A *\<^sub>v w
[PROOF STEP]
unfolding minus_add_uminus_vec[OF v w]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>v (v + - w) = A *\<^sub>v v - A *\<^sub>v w
[PROOF STEP]
by (subst mult_add_distrib_mat_vec[OF A], insert A v w, auto)


[STATEMENT]
lemma closed_scaling:
  fixes S :: "'a::real_normed_vector set"
  assumes "closed S"
  shows "closed ((\<lambda>x. c *\<^sub>R x) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed ((*\<^sub>R) c ` S)
[PROOF STEP]
proof (cases "c = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c = 0 \<Longrightarrow> closed ((*\<^sub>R) c ` S)
 2. c \<noteq> 0 \<Longrightarrow> closed ((*\<^sub>R) c ` S)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
c = 0

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> closed ((*\<^sub>R) c ` S)
 2. c \<noteq> 0 \<Longrightarrow> closed ((*\<^sub>R) c ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c = 0

goal (1 subgoal):
 1. closed ((*\<^sub>R) c ` S)
[PROOF STEP]
by (auto simp: image_constant_conv)
[PROOF STATE]
proof (state)
this:
closed ((*\<^sub>R) c ` S)

goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> closed ((*\<^sub>R) c ` S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> closed ((*\<^sub>R) c ` S)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
c \<noteq> 0

goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> closed ((*\<^sub>R) c ` S)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
closed S
[PROOF STEP]
have "closed ((\<lambda>x. inverse c *\<^sub>R x) -` S)"
[PROOF STATE]
proof (prove)
using this:
closed S

goal (1 subgoal):
 1. closed ((\<lambda>x. x /\<^sub>R c) -` S)
[PROOF STEP]
by (simp add: continuous_closed_vimage)
[PROOF STATE]
proof (state)
this:
closed ((\<lambda>x. x /\<^sub>R c) -` S)

goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> closed ((*\<^sub>R) c ` S)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
closed ((\<lambda>x. x /\<^sub>R c) -` S)

goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> closed ((*\<^sub>R) c ` S)
[PROOF STEP]
have "(\<lambda>x. inverse c *\<^sub>R x) -` S = (\<lambda>x. c *\<^sub>R x) ` S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x /\<^sub>R c) -` S = (*\<^sub>R) c ` S
[PROOF STEP]
using \<open>c \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0

goal (1 subgoal):
 1. (\<lambda>x. x /\<^sub>R c) -` S = (*\<^sub>R) c ` S
[PROOF STEP]
by (auto elim: image_eqI [rotated])
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x /\<^sub>R c) -` S = (*\<^sub>R) c ` S

goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> closed ((*\<^sub>R) c ` S)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
closed ((*\<^sub>R) c ` S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
closed ((*\<^sub>R) c ` S)

goal (1 subgoal):
 1. closed ((*\<^sub>R) c ` S)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
closed ((*\<^sub>R) c ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma strict_mono_on_subset: "\<lbrakk> strict_mono_on f A ; B \<subseteq> A \<rbrakk> \<Longrightarrow> strict_mono_on f B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>SetInterval2.strict_mono_on f A; B \<subseteq> A\<rbrakk> \<Longrightarrow> SetInterval2.strict_mono_on f B
[PROOF STEP]
unfolding strict_mono_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>a\<in>A. \<forall>b\<in>A. a < b \<longrightarrow> f a < f b; B \<subseteq> A\<rbrakk> \<Longrightarrow> \<forall>a\<in>B. \<forall>b\<in>B. a < b \<longrightarrow> f a < f b
[PROOF STEP]
by blast


[STATEMENT]
lemma ass_function_int_UNIV: "(ass_function_int` UNIV) = {x. x\<ge>0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range ass_function_int = {x. 0 \<le> x}
[PROOF STEP]
unfolding ass_function_int_def image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>x\<in>UNIV. y = \<bar>x\<bar>} = {x. 0 \<le> x}
[PROOF STEP]
by (auto, metis abs_of_nonneg)


[STATEMENT]
lemma mset_le_single_right_iff[simp]:
  "M \<le> {#y#} \<longleftrightarrow> M = {#y#} \<or> (\<forall>x \<in># M. x < y)" for y :: "'a::linorder"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M \<le> {#y#}) = (M = {#y#} \<or> (\<forall>x\<in>#M. x < y))
[PROOF STEP]
by (meson less_eq_multiset_def mset_lt_single_right_iff)


[STATEMENT]
lemma proj_list_3_length:
  assumes "proj_list_3 xs (ys, z, zs) = (ys', z', zs')"
    "length xs = length ys + 1 + length zs"
  shows "length ys = length ys'" "length zs = length zs'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ys = length ys' &&& length zs = length zs'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
proj_list_3 xs (ys, z, zs) = (ys', z', zs')
length xs = length ys + 1 + length zs

goal (1 subgoal):
 1. length ys = length ys' &&& length zs = length zs'
[PROOF STEP]
by auto


[STATEMENT]
lemma inc_mat_col_list_map_elem: "j < length Bs \<Longrightarrow> i < length Vs \<Longrightarrow>
    col (inc_mat_of Vs Bs) j $ i = map_vec (\<lambda> x . if (x \<in> (Bs ! j)) then 1 else 0) (vec_of_list Vs) $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < length Bs; i < length Vs\<rbrakk> \<Longrightarrow> col (inc_mat_of Vs Bs) j $ i = map_vec (\<lambda>x. if x \<in> Bs ! j then 1::'b else (0::'b)) (vec_of_list Vs) $ i
[PROOF STEP]
by (simp add: inc_mat_of_def index_vec_of_list)


[STATEMENT]
lemma sum_mset_mono_complex_lex:
  assumes "rel_mset (\<le>\<^sub>\<complex>) A B"
  shows   "sum_mset A \<le>\<^sub>\<complex> sum_mset B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum>\<^sub># A \<le>\<^sub>\<complex> \<Sum>\<^sub># B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
rel_mset (\<le>\<^sub>\<complex>) A B

goal (1 subgoal):
 1. \<Sum>\<^sub># A \<le>\<^sub>\<complex> \<Sum>\<^sub># B
[PROOF STEP]
by (auto simp: rel_mset_def sum_mset_sum_list intro: sum_list_mono_complex_lex)


[STATEMENT]
lemma divisor_sum_naive [code]:
  "divisor_sum n = (if n = 0 then 0 else
     fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then d + acc else acc) 1 n 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_sum n = (if n = 0 then 0 else fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then d + acc else acc) 1 n 0)
[PROOF STEP]
using divisor_sigma_naive[of "Suc 0" n]
[PROOF STATE]
proof (prove)
using this:
divisor_sigma (Suc 0) n = (if n = 0 then 0 else fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then nat_power d (Suc 0) + acc else acc) 1 n 0)

goal (1 subgoal):
 1. divisor_sum n = (if n = 0 then 0 else fold_atLeastAtMost_nat (\<lambda>d acc. if d dvd n then d + acc else acc) 1 n 0)
[PROOF STEP]
by (simp split: if_splits add: divisor_sum_altdef cong: if_cong)


[STATEMENT]
lemma disjoint_in_Un: "
  \<lbrakk> A \<inter> B = {}; x \<in> A \<union> B \<rbrakk> \<Longrightarrow> x \<notin> A \<or> x \<notin> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<inter> B = {}; x \<in> A \<union> B\<rbrakk> \<Longrightarrow> x \<notin> A \<or> x \<notin> B
[PROOF STEP]
by (blast intro: disjoint_iff_in_not_in1[THEN iffD1])+


[STATEMENT]
lemma finite_FSet_Lex_Wrapper_UNIV:
  assumes "finite (UNIV :: 'a set)"
  shows "finite (UNIV :: 'a FSet_Lex_Wrapper set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite UNIV
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite UNIV

goal (1 subgoal):
 1. finite UNIV
[PROOF STEP]
unfolding FSet_Lex_Wrapper_UNIV
[PROOF STATE]
proof (prove)
using this:
finite UNIV

goal (1 subgoal):
 1. finite ((Wrapp \<circ> Abs_fset) ` Fpow UNIV)
[PROOF STEP]
using finite_image_iff[OF Wrapp_Abs_fset_inj]
[PROOF STATE]
proof (prove)
using this:
finite UNIV
finite ((Wrapp \<circ> Abs_fset) ` Fpow ?A1) = finite (Fpow ?A1)

goal (1 subgoal):
 1. finite ((Wrapp \<circ> Abs_fset) ` Fpow UNIV)
[PROOF STEP]
using finite_finite_Fpow[OF assms]
[PROOF STATE]
proof (prove)
using this:
finite UNIV
finite ((Wrapp \<circ> Abs_fset) ` Fpow ?A1) = finite (Fpow ?A1)
finite (Fpow UNIV)

goal (1 subgoal):
 1. finite ((Wrapp \<circ> Abs_fset) ` Fpow UNIV)
[PROOF STEP]
by simp


[STATEMENT]
lemma (in CRR_market) asian_borel:
  shows "asian_option T \<in> borel_measurable (G T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. asian_option T \<in> borel_measurable (G T)
[PROOF STEP]
unfolding asian_option_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>w. (\<Sum>i = 1..T. prices Mkt stk i w) / real T) \<in> borel_measurable (G T)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>w. (\<Sum>i = 1..T. prices Mkt stk i w) / real T) \<in> borel_measurable (G T)
[PROOF STEP]
have "(\<lambda> w. (\<Sum> i\<in> {1.. T}. prices Mkt stk i w)) \<in> borel_measurable (G T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>w. \<Sum>i = 1..T. prices Mkt stk i w) \<in> borel_measurable (G T)
[PROOF STEP]
proof (rule borel_measurable_sum)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> {1..T} \<Longrightarrow> prices Mkt stk i \<in> borel_measurable (G T)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> {1..T} \<Longrightarrow> prices Mkt stk i \<in> borel_measurable (G T)
[PROOF STEP]
assume "i\<in> {1..T}"
[PROOF STATE]
proof (state)
this:
i \<in> {1..T}

goal (1 subgoal):
 1. \<And>i. i \<in> {1..T} \<Longrightarrow> prices Mkt stk i \<in> borel_measurable (G T)
[PROOF STEP]
show "prices Mkt stk i \<in> borel_measurable (G T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prices Mkt stk i \<in> borel_measurable (G T)
[PROOF STEP]
by (metis \<open>i \<in> {1..T}\<close> adapt_stoch_proc_def atLeastAtMost_iff increasing_measurable_info
            stock_price_borel_measurable)
[PROOF STATE]
proof (state)
this:
prices Mkt stk i \<in> borel_measurable (G T)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>w. \<Sum>i = 1..T. prices Mkt stk i w) \<in> borel_measurable (G T)

goal (1 subgoal):
 1. (\<lambda>w. (\<Sum>i = 1..T. prices Mkt stk i w) / real T) \<in> borel_measurable (G T)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>w. \<Sum>i = 1..T. prices Mkt stk i w) \<in> borel_measurable (G T)
[PROOF STEP]
show "(\<lambda>w. (\<Sum>i = 1..T. prices Mkt stk i w) / real T) \<in> borel_measurable (G T)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>w. \<Sum>i = 1..T. prices Mkt stk i w) \<in> borel_measurable (G T)

goal (1 subgoal):
 1. (\<lambda>w. (\<Sum>i = 1..T. prices Mkt stk i w) / real T) \<in> borel_measurable (G T)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>w. (\<Sum>i = 1..T. prices Mkt stk i w) / real T) \<in> borel_measurable (G T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma square_mod_8_eq_1_iff: "[x\<^sup>2 = 1] (mod 8) \<longleftrightarrow> odd (x :: nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [x\<^sup>2 = 1] (mod 8) = odd x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [x\<^sup>2 = 1] (mod 8) = odd x
[PROOF STEP]
have "[x\<^sup>2 = 1] (mod 8) \<longleftrightarrow> ((x mod 8)\<^sup>2 mod 8 = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [x\<^sup>2 = 1] (mod 8) = ((x mod 8)\<^sup>2 mod 8 = 1)
[PROOF STEP]
by (simp add: power_mod cong_def)
[PROOF STATE]
proof (state)
this:
[x\<^sup>2 = 1] (mod 8) = ((x mod 8)\<^sup>2 mod 8 = 1)

goal (1 subgoal):
 1. [x\<^sup>2 = 1] (mod 8) = odd x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[x\<^sup>2 = 1] (mod 8) = ((x mod 8)\<^sup>2 mod 8 = 1)

goal (1 subgoal):
 1. [x\<^sup>2 = 1] (mod 8) = odd x
[PROOF STEP]
have "\<dots> \<longleftrightarrow> x mod 8 \<in> {1, 3, 5, 7}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x mod 8)\<^sup>2 mod 8 = 1) = (x mod 8 \<in> {1, 3, 5, 7})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (x mod 8)\<^sup>2 mod 8 = 1 \<Longrightarrow> x mod 8 \<in> {1, 3, 5, 7}
 2. x mod 8 \<in> {1, 3, 5, 7} \<Longrightarrow> (x mod 8)\<^sup>2 mod 8 = 1
[PROOF STEP]
assume x: "(x mod 8)\<^sup>2 mod 8 = 1"
[PROOF STATE]
proof (state)
this:
(x mod 8)\<^sup>2 mod 8 = 1

goal (2 subgoals):
 1. (x mod 8)\<^sup>2 mod 8 = 1 \<Longrightarrow> x mod 8 \<in> {1, 3, 5, 7}
 2. x mod 8 \<in> {1, 3, 5, 7} \<Longrightarrow> (x mod 8)\<^sup>2 mod 8 = 1
[PROOF STEP]
have "x mod 8 \<in> {..<8}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x mod 8 \<in> {..<8}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x mod 8 \<in> {..<8}

goal (2 subgoals):
 1. (x mod 8)\<^sup>2 mod 8 = 1 \<Longrightarrow> x mod 8 \<in> {1, 3, 5, 7}
 2. x mod 8 \<in> {1, 3, 5, 7} \<Longrightarrow> (x mod 8)\<^sup>2 mod 8 = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x mod 8 \<in> {..<8}

goal (2 subgoals):
 1. (x mod 8)\<^sup>2 mod 8 = 1 \<Longrightarrow> x mod 8 \<in> {1, 3, 5, 7}
 2. x mod 8 \<in> {1, 3, 5, 7} \<Longrightarrow> (x mod 8)\<^sup>2 mod 8 = 1
[PROOF STEP]
have "{..<8} = {0, 1, 2, 3, 4, 5, 6, 7::nat}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..<8} = {0, 1, 2, 3, 4, 5, 6, 7}
[PROOF STEP]
by (simp add: lessThan_nat_numeral lessThan_Suc insert_commute)
[PROOF STATE]
proof (state)
this:
{..<8} = {0, 1, 2, 3, 4, 5, 6, 7}

goal (2 subgoals):
 1. (x mod 8)\<^sup>2 mod 8 = 1 \<Longrightarrow> x mod 8 \<in> {1, 3, 5, 7}
 2. x mod 8 \<in> {1, 3, 5, 7} \<Longrightarrow> (x mod 8)\<^sup>2 mod 8 = 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x mod 8 \<in> {0, 1, 2, 3, 4, 5, 6, 7}
[PROOF STEP]
have x_cases: "x mod 8 \<in> {0, 1, 2, 3, 4, 5, 6, 7}"
[PROOF STATE]
proof (prove)
using this:
x mod 8 \<in> {0, 1, 2, 3, 4, 5, 6, 7}

goal (1 subgoal):
 1. x mod 8 \<in> {0, 1, 2, 3, 4, 5, 6, 7}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x mod 8 \<in> {0, 1, 2, 3, 4, 5, 6, 7}

goal (2 subgoals):
 1. (x mod 8)\<^sup>2 mod 8 = 1 \<Longrightarrow> x mod 8 \<in> {1, 3, 5, 7}
 2. x mod 8 \<in> {1, 3, 5, 7} \<Longrightarrow> (x mod 8)\<^sup>2 mod 8 = 1
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
(x mod 8)\<^sup>2 mod 8 = 1
[PROOF STEP]
have "x mod 8 \<notin> {0, 2, 4, 6}"
[PROOF STATE]
proof (prove)
using this:
(x mod 8)\<^sup>2 mod 8 = 1

goal (1 subgoal):
 1. x mod 8 \<notin> {0, 2, 4, 6}
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
(x mod 8)\<^sup>2 mod 8 = 1
(x mod 8)\<^sup>2 mod 8 = 1

goal (1 subgoal):
 1. x mod 8 \<notin> {0, 2, 4, 6}
[PROOF STEP]
by (auto intro: Nat.gr0I)
[PROOF STATE]
proof (state)
this:
x mod 8 \<notin> {0, 2, 4, 6}

goal (2 subgoals):
 1. (x mod 8)\<^sup>2 mod 8 = 1 \<Longrightarrow> x mod 8 \<in> {1, 3, 5, 7}
 2. x mod 8 \<in> {1, 3, 5, 7} \<Longrightarrow> (x mod 8)\<^sup>2 mod 8 = 1
[PROOF STEP]
with x_cases
[PROOF STATE]
proof (chain)
picking this:
x mod 8 \<in> {0, 1, 2, 3, 4, 5, 6, 7}
x mod 8 \<notin> {0, 2, 4, 6}
[PROOF STEP]
show "x mod 8 \<in> {1, 3, 5, 7}"
[PROOF STATE]
proof (prove)
using this:
x mod 8 \<in> {0, 1, 2, 3, 4, 5, 6, 7}
x mod 8 \<notin> {0, 2, 4, 6}

goal (1 subgoal):
 1. x mod 8 \<in> {1, 3, 5, 7}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x mod 8 \<in> {1, 3, 5, 7}

goal (1 subgoal):
 1. x mod 8 \<in> {1, 3, 5, 7} \<Longrightarrow> (x mod 8)\<^sup>2 mod 8 = 1
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
((x mod 8)\<^sup>2 mod 8 = 1) = (x mod 8 \<in> {1, 3, 5, 7})

goal (1 subgoal):
 1. [x\<^sup>2 = 1] (mod 8) = odd x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((x mod 8)\<^sup>2 mod 8 = 1) = (x mod 8 \<in> {1, 3, 5, 7})

goal (1 subgoal):
 1. [x\<^sup>2 = 1] (mod 8) = odd x
[PROOF STEP]
have "\<dots> \<longleftrightarrow> odd (x mod 8)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x mod 8 \<in> {1, 3, 5, 7}) = odd (x mod 8)
[PROOF STEP]
by (auto elim!: oddE)
[PROOF STATE]
proof (state)
this:
(x mod 8 \<in> {1, 3, 5, 7}) = odd (x mod 8)

goal (1 subgoal):
 1. [x\<^sup>2 = 1] (mod 8) = odd x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x mod 8 \<in> {1, 3, 5, 7}) = odd (x mod 8)

goal (1 subgoal):
 1. [x\<^sup>2 = 1] (mod 8) = odd x
[PROOF STEP]
have "\<dots> \<longleftrightarrow> odd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd (x mod 8) = odd x
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
odd (x mod 8) = odd x

goal (1 subgoal):
 1. [x\<^sup>2 = 1] (mod 8) = odd x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[x\<^sup>2 = 1] (mod 8) = odd x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[x\<^sup>2 = 1] (mod 8) = odd x

goal (1 subgoal):
 1. [x\<^sup>2 = 1] (mod 8) = odd x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
[x\<^sup>2 = 1] (mod 8) = odd x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_compact_projection:
  fixes S :: "'a::euclidean_space set"
    and T :: "('a * 'b::euclidean_space) set"
  assumes "compact S" and clo: "closed T"
    shows "closed {y. \<exists>x. x \<in> S \<and> (x, y) \<in> T}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {y. \<exists>x. x \<in> S \<and> (x, y) \<in> T}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed {y. \<exists>x. x \<in> S \<and> (x, y) \<in> T}
[PROOF STEP]
have *: "{y. \<exists>x. x \<in> S \<and> Pair x y \<in> T} = {y. \<exists>x. x \<in> S \<and> Pair x y \<in> ((S \<times> UNIV) \<inter> T)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>x. x \<in> S \<and> (x, y) \<in> T} = {y. \<exists>x. x \<in> S \<and> (x, y) \<in> S \<times> UNIV \<inter> T}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{y. \<exists>x. x \<in> S \<and> (x, y) \<in> T} = {y. \<exists>x. x \<in> S \<and> (x, y) \<in> S \<times> UNIV \<inter> T}

goal (1 subgoal):
 1. closed {y. \<exists>x. x \<in> S \<and> (x, y) \<in> T}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {y. \<exists>x. x \<in> S \<and> (x, y) \<in> T}
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {y. \<exists>x. x \<in> S \<and> (x, y) \<in> S \<times> UNIV \<inter> T}
[PROOF STEP]
by (intro clo closedin_closed_Int closedin_closed_trans [OF _ closed_UNIV] closedin_compact_projection [OF \<open>compact S\<close>])
[PROOF STATE]
proof (state)
this:
closed {y. \<exists>x. x \<in> S \<and> (x, y) \<in> T}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma absolutely_integrable_onI:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  shows "f integrable_on S \<Longrightarrow> (\<lambda>x. norm (f x)) integrable_on S \<Longrightarrow> f absolutely_integrable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f integrable_on S; (\<lambda>x. norm (f x)) integrable_on S\<rbrakk> \<Longrightarrow> f absolutely_integrable_on S
[PROOF STEP]
unfolding absolutely_integrable_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f integrable_on S; (\<lambda>x. norm (f x)) integrable_on S\<rbrakk> \<Longrightarrow> f integrable_on S \<and> (\<lambda>x. norm (f x)) integrable_on S
[PROOF STEP]
by auto


[STATEMENT]
theorem hbt_insert_auto: "hbt t \<Longrightarrow>
  hbt(insert x t) \<and> height (insert x t) \<in> {height t, height t + 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hbt t \<Longrightarrow> hbt (local.insert x t) \<and> height (local.insert x t) \<in> {height t, height t + 1}
[PROOF STEP]
apply (induction t rule: tree2_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. hbt \<langle>\<rangle> \<Longrightarrow> hbt (local.insert x \<langle>\<rangle>) \<and> height (local.insert x \<langle>\<rangle>) \<in> {height \<langle>\<rangle>, height \<langle>\<rangle> + 1}
 2. \<And>x1 a b x3. \<lbrakk>hbt x1 \<Longrightarrow> hbt (local.insert x x1) \<and> height (local.insert x x1) \<in> {height x1, height x1 + 1}; hbt x3 \<Longrightarrow> hbt (local.insert x x3) \<and> height (local.insert x x3) \<in> {height x3, height x3 + 1}; hbt \<langle>x1, (a, b), x3\<rangle>\<rbrakk> \<Longrightarrow> hbt (local.insert x \<langle>x1, (a, b), x3\<rangle>) \<and> height (local.insert x \<langle>x1, (a, b), x3\<rangle>) \<in> {height \<langle>x1, (a, b), x3\<rangle>, height \<langle>x1, (a, b), x3\<rangle> + 1}
[PROOF STEP]
apply (auto simp: balL_def balR_def node_def max_absorb1 max_absorb2 split!: if_split tree.split)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma to_fun_Fun_mult:
  assumes "x \<in> carrier P"
  assumes "y \<in> carrier P"
  shows "to_fun (x \<otimes>\<^bsub>P\<^esub> y) = to_fun x \<otimes>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun (x \<otimes>\<^bsub>P\<^esub> y) = to_fun x \<otimes>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y
[PROOF STEP]
apply(rule ring_functions.function_ring_car_eqI[of R _ "carrier R"])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. ring_functions R
 2. to_fun (x \<otimes>\<^bsub>P\<^esub> y) \<in> carrier (function_ring (carrier R) R)
 3. to_fun x \<otimes>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y \<in> carrier (function_ring (carrier R) R)
 4. \<And>a. a \<in> carrier R \<Longrightarrow> to_fun (x \<otimes>\<^bsub>P\<^esub> y) a = (to_fun x \<otimes>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y) a
[PROOF STEP]
apply (simp add: R.ring_axioms ring_functions_def)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. to_fun (x \<otimes>\<^bsub>P\<^esub> y) \<in> carrier (function_ring (carrier R) R)
 2. to_fun x \<otimes>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y \<in> carrier (function_ring (carrier R) R)
 3. \<And>a. a \<in> carrier R \<Longrightarrow> to_fun (x \<otimes>\<^bsub>P\<^esub> y) a = (to_fun x \<otimes>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y) a
[PROOF STEP]
apply (simp add: assms(1) assms(2) to_fun_is_Fun)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. to_fun x \<otimes>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y \<in> carrier (function_ring (carrier R) R)
 2. \<And>a. a \<in> carrier R \<Longrightarrow> to_fun (x \<otimes>\<^bsub>P\<^esub> y) a = (to_fun x \<otimes>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y) a
[PROOF STEP]
apply (simp add: R.ring_axioms assms(1) assms(2) ring_functions.fun_mult_closed ring_functions.intro to_fun_is_Fun)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. a \<in> carrier R \<Longrightarrow> to_fun (x \<otimes>\<^bsub>P\<^esub> y) a = (to_fun x \<otimes>\<^bsub>function_ring (carrier R) R\<^esub> to_fun y) a
[PROOF STEP]
by (simp add: R.ring_axioms assms(1) assms(2) ring_functions.function_mult_eval_car ring_functions.intro to_fun_is_Fun to_fun_mult)


[STATEMENT]
lemma collinear_scaleR_iff: "collinear {0, \<alpha> *\<^sub>R w, \<beta> *\<^sub>R z} \<longleftrightarrow> collinear {0,w,z} \<or> \<alpha>=0 \<or> \<beta>=0"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. collinear {0::'a, \<alpha> *\<^sub>R w, \<beta> *\<^sub>R z} = (collinear {0::'a, w, z} \<or> \<alpha> = 0 \<or> \<beta> = 0)
[PROOF STEP]
proof (cases "\<alpha>=0 \<or> \<beta>=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<alpha> = 0 \<or> \<beta> = 0 \<Longrightarrow> collinear {0::'a, \<alpha> *\<^sub>R w, \<beta> *\<^sub>R z} = (collinear {0::'a, w, z} \<or> \<alpha> = 0 \<or> \<beta> = 0)
 2. \<not> (\<alpha> = 0 \<or> \<beta> = 0) \<Longrightarrow> collinear {0::'a, \<alpha> *\<^sub>R w, \<beta> *\<^sub>R z} = (collinear {0::'a, w, z} \<or> \<alpha> = 0 \<or> \<beta> = 0)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (\<alpha> = 0 \<or> \<beta> = 0)

goal (2 subgoals):
 1. \<alpha> = 0 \<or> \<beta> = 0 \<Longrightarrow> collinear {0::'a, \<alpha> *\<^sub>R w, \<beta> *\<^sub>R z} = (collinear {0::'a, w, z} \<or> \<alpha> = 0 \<or> \<beta> = 0)
 2. \<not> (\<alpha> = 0 \<or> \<beta> = 0) \<Longrightarrow> collinear {0::'a, \<alpha> *\<^sub>R w, \<beta> *\<^sub>R z} = (collinear {0::'a, w, z} \<or> \<alpha> = 0 \<or> \<beta> = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (\<alpha> = 0 \<or> \<beta> = 0)
[PROOF STEP]
have "(\<exists>c. \<beta> *\<^sub>R z = (c * \<alpha>) *\<^sub>R w) = (\<exists>c. z = c *\<^sub>R w)"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<alpha> = 0 \<or> \<beta> = 0)

goal (1 subgoal):
 1. (\<exists>c. \<beta> *\<^sub>R z = (c * \<alpha>) *\<^sub>R w) = (\<exists>c. z = c *\<^sub>R w)
[PROOF STEP]
by (metis mult.commute scaleR_scaleR vector_fraction_eq_iff)
[PROOF STATE]
proof (state)
this:
(\<exists>c. \<beta> *\<^sub>R z = (c * \<alpha>) *\<^sub>R w) = (\<exists>c. z = c *\<^sub>R w)

goal (2 subgoals):
 1. \<alpha> = 0 \<or> \<beta> = 0 \<Longrightarrow> collinear {0::'a, \<alpha> *\<^sub>R w, \<beta> *\<^sub>R z} = (collinear {0::'a, w, z} \<or> \<alpha> = 0 \<or> \<beta> = 0)
 2. \<not> (\<alpha> = 0 \<or> \<beta> = 0) \<Longrightarrow> collinear {0::'a, \<alpha> *\<^sub>R w, \<beta> *\<^sub>R z} = (collinear {0::'a, w, z} \<or> \<alpha> = 0 \<or> \<beta> = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<exists>c. \<beta> *\<^sub>R z = (c * \<alpha>) *\<^sub>R w) = (\<exists>c. z = c *\<^sub>R w)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<exists>c. \<beta> *\<^sub>R z = (c * \<alpha>) *\<^sub>R w) = (\<exists>c. z = c *\<^sub>R w)

goal (1 subgoal):
 1. collinear {0::'a, \<alpha> *\<^sub>R w, \<beta> *\<^sub>R z} = (collinear {0::'a, w, z} \<or> \<alpha> = 0 \<or> \<beta> = 0)
[PROOF STEP]
by (auto simp add: collinear_lemma)
[PROOF STATE]
proof (state)
this:
collinear {0::'a, \<alpha> *\<^sub>R w, \<beta> *\<^sub>R z} = (collinear {0::'a, w, z} \<or> \<alpha> = 0 \<or> \<beta> = 0)

goal (1 subgoal):
 1. \<alpha> = 0 \<or> \<beta> = 0 \<Longrightarrow> collinear {0::'a, \<alpha> *\<^sub>R w, \<beta> *\<^sub>R z} = (collinear {0::'a, w, z} \<or> \<alpha> = 0 \<or> \<beta> = 0)
[PROOF STEP]
qed (auto simp: collinear_lemma)


[STATEMENT]
theorem "\<forall>(i::int). 8 \<le> i \<longrightarrow> (\<exists>x y. 0 \<le> x \<and> 0 \<le> y \<and> 3 * x + 5 * y = i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<ge>8. \<exists>x y. 0 \<le> x \<and> 0 \<le> y \<and> 3 * x + 5 * y = i
[PROOF STEP]
by cooper


[STATEMENT]
lemma frontier_ic_union_ci:
  assumes "a < (b::real)" "b < c"
  shows "b \<in> frontier ({a..<b} \<union> {b<..c})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> frontier ({a..<b} \<union> {b<..c})
[PROOF STEP]
using closure_ic_union_ci assms interior_ic_ci_union
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a < ?b; ?b < ?c\<rbrakk> \<Longrightarrow> closure ({?a..<?b} \<union> {?b<..?c}) = {?a..?c}
a < b
b < c
\<lbrakk>?a < ?b; ?b < ?c\<rbrakk> \<Longrightarrow> ?b \<notin> interior ({?a..<?b} \<union> {?b<..?c})

goal (1 subgoal):
 1. b \<in> frontier ({a..<b} \<union> {b<..c})
[PROOF STEP]
by(simp add: frontier_def)


[STATEMENT]
lemma totient_formula2:
  "real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
 2. n \<noteq> 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
 2. n \<noteq> 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
[PROOF STEP]
have "real (totient n) = (\<Prod>p\<in>prime_factors n. real
          (p ^ (multiplicity p n - 1) * (p - 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (totient n) = (\<Prod>p\<in>prime_factors n. real (p ^ (multiplicity p n - 1) * (p - 1)))
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. real (totient n) = (\<Prod>p\<in>prime_factors n. real (p ^ (multiplicity p n - 1) * (p - 1)))
[PROOF STEP]
by (subst totient_formula1) simp_all
[PROOF STATE]
proof (state)
this:
real (totient n) = (\<Prod>p\<in>prime_factors n. real (p ^ (multiplicity p n - 1) * (p - 1)))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
 2. n \<noteq> 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (totient n) = (\<Prod>p\<in>prime_factors n. real (p ^ (multiplicity p n - 1) * (p - 1)))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
 2. n \<noteq> 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
[PROOF STEP]
have "\<dots> = (\<Prod>p\<in>prime_factors n. real (p ^ multiplicity p n) * (1 - 1 / real p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors n. real (p ^ (multiplicity p n - 1) * (p - 1))) = (\<Prod>p\<in>prime_factors n. real (p ^ multiplicity p n) * (1 - 1 / real p))
[PROOF STEP]
by (intro prod.cong refl) (auto simp add: field_simps prime_factors_multiplicity
          prime_ge_Suc_0_nat of_nat_diff power_Suc [symmetric] simp del: power_Suc)
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors n. real (p ^ (multiplicity p n - 1) * (p - 1))) = (\<Prod>p\<in>prime_factors n. real (p ^ multiplicity p n) * (1 - 1 / real p))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
 2. n \<noteq> 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors n. real (p ^ (multiplicity p n - 1) * (p - 1))) = (\<Prod>p\<in>prime_factors n. real (p ^ multiplicity p n) * (1 - 1 / real p))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
 2. n \<noteq> 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
[PROOF STEP]
have "\<dots> = real (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) *
                    (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors n. real (p ^ multiplicity p n) * (1 - 1 / real p)) = real (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
[PROOF STEP]
by (subst prod.distrib) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors n. real (p ^ multiplicity p n) * (1 - 1 / real p)) = real (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
 2. n \<noteq> 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors n. real (p ^ multiplicity p n) * (1 - 1 / real p)) = real (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
 2. n \<noteq> 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
[PROOF STEP]
have "(\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) = n
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) = n
[PROOF STEP]
by (intro Primes.prime_factorization_nat [symmetric]) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) = n

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
 2. n \<noteq> 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)

goal (1 subgoal):
 1. real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> real (totient n) = real n * (\<Prod>p\<in>prime_factors n. 1 - 1 / real p)
[PROOF STEP]
qed auto


[STATEMENT]
lemma nat_of_ipv6addr_ipv6addr_of_nat_mod: "nat_of_ipv6addr (ipv6addr_of_nat n) = n mod 2^128"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_of_ipv6addr (ipv6addr_of_nat n) = n mod 2 ^ 128
[PROOF STEP]
by (simp add: ipv6addr_of_nat_def nat_of_ipv6addr_def unat_of_nat take_bit_eq_mod)


[STATEMENT]
lemma inj_on_add_mult:
  assumes coprime: "coprime x (q::nat)"
  shows "inj_on (\<lambda> b. (y + x*b) mod q) {..<q}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>b. (y + x * b) mod q) {..<q}
[PROOF STEP]
apply(auto simp add: inj_on_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa ya. \<lbrakk>xa < q; ya < q; (y + x * xa) mod q = (y + x * ya) mod q\<rbrakk> \<Longrightarrow> xa = ya
[PROOF STEP]
using coprime
[PROOF STATE]
proof (prove)
using this:
coprime x q

goal (1 subgoal):
 1. \<And>xa ya. \<lbrakk>xa < q; ya < q; (y + x * xa) mod q = (y + x * ya) mod q\<rbrakk> \<Longrightarrow> xa = ya
[PROOF STEP]
by(simp only: samp_uni_add_mult)


[STATEMENT]
lemma fact_mod: "m \<le> n \<Longrightarrow> fact n mod (fact m :: 'a::{semidom_modulo, linordered_semidom}) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n \<Longrightarrow> fact n mod fact m = (0::'a)
[PROOF STEP]
by (simp add: mod_eq_0_iff_dvd fact_dvd)


[STATEMENT]
lemma proots_within_card_zero_iff:
  assumes "p \<noteq> (0 :: 'a :: idom poly)"
  shows   "card (proots_within p A) = 0 \<longleftrightarrow> (\<forall>x\<in>A. poly p x \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (card (proots_within p A) = 0) = (\<forall>x\<in>A. poly p x \<noteq> (0::'a))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. (card (proots_within p A) = 0) = (\<forall>x\<in>A. poly p x \<noteq> (0::'a))
[PROOF STEP]
by (subst card_0_eq) (auto intro: finite_proots)