[STATEMENT]
lemma (in group) DirProd_iso_set_trans:
  assumes "g \<in> iso G G2"
    and "h \<in> iso H I"
  shows "(\<lambda>(x,y). (g x, h y)) \<in> iso (G \<times>\<times> H) (G2 \<times>\<times> I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). (g x, h y)) \<in> Group.iso (G \<times>\<times> H) (G2 \<times>\<times> I)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>(x, y). (g x, h y)) \<in> Group.iso (G \<times>\<times> H) (G2 \<times>\<times> I)
[PROOF STEP]
have "(\<lambda>(x,y). (g x, h y)) \<in> hom (G \<times>\<times> H) (G2 \<times>\<times> I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). (g x, h y)) \<in> hom (G \<times>\<times> H) (G2 \<times>\<times> I)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
g \<in> Group.iso G G2
h \<in> Group.iso H I

goal (1 subgoal):
 1. (\<lambda>(x, y). (g x, h y)) \<in> hom (G \<times>\<times> H) (G2 \<times>\<times> I)
[PROOF STEP]
unfolding iso_def hom_def
[PROOF STATE]
proof (prove)
using this:
g \<in> {h \<in> {h \<in> carrier G \<rightarrow> carrier G2. \<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h (x \<otimes> y) = h x \<otimes>\<^bsub>G2\<^esub> h y}. bij_betw h (carrier G) (carrier G2)}
h \<in> {h \<in> {h \<in> carrier H \<rightarrow> carrier I. \<forall>x\<in>carrier H. \<forall>y\<in>carrier H. h (x \<otimes>\<^bsub>H\<^esub> y) = h x \<otimes>\<^bsub>I\<^esub> h y}. bij_betw h (carrier H) (carrier I)}

goal (1 subgoal):
 1. (\<lambda>(x, y). (g x, h y)) \<in> {h \<in> carrier (G \<times>\<times> H) \<rightarrow> carrier (G2 \<times>\<times> I). \<forall>x\<in>carrier (G \<times>\<times> H). \<forall>y\<in>carrier (G \<times>\<times> H). h (x \<otimes>\<^bsub>G \<times>\<times> H\<^esub> y) = h x \<otimes>\<^bsub>G2 \<times>\<times> I\<^esub> h y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>(x, y). (g x, h y)) \<in> hom (G \<times>\<times> H) (G2 \<times>\<times> I)

goal (1 subgoal):
 1. (\<lambda>(x, y). (g x, h y)) \<in> Group.iso (G \<times>\<times> H) (G2 \<times>\<times> I)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>(x, y). (g x, h y)) \<in> hom (G \<times>\<times> H) (G2 \<times>\<times> I)

goal (1 subgoal):
 1. (\<lambda>(x, y). (g x, h y)) \<in> Group.iso (G \<times>\<times> H) (G2 \<times>\<times> I)
[PROOF STEP]
have " inj_on (\<lambda>(x,y). (g x, h y)) (carrier (G \<times>\<times> H))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>(x, y). (g x, h y)) (carrier (G \<times>\<times> H))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
g \<in> Group.iso G G2
h \<in> Group.iso H I

goal (1 subgoal):
 1. inj_on (\<lambda>(x, y). (g x, h y)) (carrier (G \<times>\<times> H))
[PROOF STEP]
unfolding iso_def DirProd_def bij_betw_def inj_on_def
[PROOF STATE]
proof (prove)
using this:
g \<in> {h \<in> hom G G2. (\<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h x = h y \<longrightarrow> x = y) \<and> h ` carrier G = carrier G2}
h \<in> {h \<in> hom H I. (\<forall>x\<in>carrier H. \<forall>y\<in>carrier H. h x = h y \<longrightarrow> x = y) \<and> h ` carrier H = carrier I}

goal (1 subgoal):
 1. \<forall>x\<in>carrier \<lparr>carrier = carrier G \<times> carrier H, mult = \<lambda>(g, h) (g', h'). (g \<otimes> g', h \<otimes>\<^bsub>H\<^esub> h'), one = (\<one>, \<one>\<^bsub>H\<^esub>)\<rparr>. \<forall>y\<in>carrier \<lparr>carrier = carrier G \<times> carrier H, mult = \<lambda>(g, h) (g', h'). (g \<otimes> g', h \<otimes>\<^bsub>H\<^esub> h'), one = (\<one>, \<one>\<^bsub>H\<^esub>)\<rparr>. (case x of (x, y) \<Rightarrow> (g x, h y)) = (case y of (x, y) \<Rightarrow> (g x, h y)) \<longrightarrow> x = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>(x, y). (g x, h y)) (carrier (G \<times>\<times> H))

goal (1 subgoal):
 1. (\<lambda>(x, y). (g x, h y)) \<in> Group.iso (G \<times>\<times> H) (G2 \<times>\<times> I)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>(x, y). (g x, h y)) (carrier (G \<times>\<times> H))

goal (1 subgoal):
 1. (\<lambda>(x, y). (g x, h y)) \<in> Group.iso (G \<times>\<times> H) (G2 \<times>\<times> I)
[PROOF STEP]
have "(\<lambda>(x, y). (g x, h y)) ` carrier (G \<times>\<times> H) = carrier (G2 \<times>\<times> I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). (g x, h y)) ` carrier (G \<times>\<times> H) = carrier (G2 \<times>\<times> I)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
g \<in> Group.iso G G2
h \<in> Group.iso H I

goal (1 subgoal):
 1. (\<lambda>(x, y). (g x, h y)) ` carrier (G \<times>\<times> H) = carrier (G2 \<times>\<times> I)
[PROOF STEP]
unfolding iso_def bij_betw_def image_def DirProd_def
[PROOF STATE]
proof (prove)
using this:
g \<in> {h \<in> hom G G2. inj_on h (carrier G) \<and> {y. \<exists>x\<in>carrier G. y = h x} = carrier G2}
h \<in> {h \<in> hom H I. inj_on h (carrier H) \<and> {y. \<exists>x\<in>carrier H. y = h x} = carrier I}

goal (1 subgoal):
 1. {y. \<exists>x\<in>carrier \<lparr>carrier = carrier G \<times> carrier H, mult = \<lambda>(g, h) (g', h'). (g \<otimes> g', h \<otimes>\<^bsub>H\<^esub> h'), one = (\<one>, \<one>\<^bsub>H\<^esub>)\<rparr>. y = (case x of (x, y) \<Rightarrow> (g x, h y))} = carrier \<lparr>carrier = carrier G2 \<times> carrier I, mult = \<lambda>(g, h) (g', h'). (g \<otimes>\<^bsub>G2\<^esub> g', h \<otimes>\<^bsub>I\<^esub> h'), one = (\<one>\<^bsub>G2\<^esub>, \<one>\<^bsub>I\<^esub>)\<rparr>
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<lambda>(x, y). (g x, h y)) ` carrier (G \<times>\<times> H) = carrier (G2 \<times>\<times> I)

goal (1 subgoal):
 1. (\<lambda>(x, y). (g x, h y)) \<in> Group.iso (G \<times>\<times> H) (G2 \<times>\<times> I)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>(x, y). (g x, h y)) \<in> hom (G \<times>\<times> H) (G2 \<times>\<times> I)
inj_on (\<lambda>(x, y). (g x, h y)) (carrier (G \<times>\<times> H))
(\<lambda>(x, y). (g x, h y)) ` carrier (G \<times>\<times> H) = carrier (G2 \<times>\<times> I)
[PROOF STEP]
show "(\<lambda>(x,y). (g x, h y)) \<in> iso (G \<times>\<times> H) (G2 \<times>\<times> I)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>(x, y). (g x, h y)) \<in> hom (G \<times>\<times> H) (G2 \<times>\<times> I)
inj_on (\<lambda>(x, y). (g x, h y)) (carrier (G \<times>\<times> H))
(\<lambda>(x, y). (g x, h y)) ` carrier (G \<times>\<times> H) = carrier (G2 \<times>\<times> I)

goal (1 subgoal):
 1. (\<lambda>(x, y). (g x, h y)) \<in> Group.iso (G \<times>\<times> H) (G2 \<times>\<times> I)
[PROOF STEP]
unfolding iso_def bij_betw_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>(x, y). (g x, h y)) \<in> hom (G \<times>\<times> H) (G2 \<times>\<times> I)
inj_on (\<lambda>(x, y). (g x, h y)) (carrier (G \<times>\<times> H))
(\<lambda>(x, y). (g x, h y)) ` carrier (G \<times>\<times> H) = carrier (G2 \<times>\<times> I)

goal (1 subgoal):
 1. (\<lambda>(x, y). (g x, h y)) \<in> {h \<in> hom (G \<times>\<times> H) (G2 \<times>\<times> I). inj_on h (carrier (G \<times>\<times> H)) \<and> h ` carrier (G \<times>\<times> H) = carrier (G2 \<times>\<times> I)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>(x, y). (g x, h y)) \<in> Group.iso (G \<times>\<times> H) (G2 \<times>\<times> I)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mod_plus_minus_range:
  assumes "b>0"
  shows "y mod+- b \<in> {-\<lfloor>b/2\<rfloor>..\<lfloor>b/2\<rfloor>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y mod+- b \<in> {- \<lfloor>real_of_int b / 2\<rfloor>..\<lfloor>real_of_int b / 2\<rfloor>}
[PROOF STEP]
unfolding mod_plus_minus_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y + \<lfloor>real_of_int b / 2\<rfloor>) mod b - \<lfloor>real_of_int b / 2\<rfloor> \<in> {- \<lfloor>real_of_int b / 2\<rfloor>..\<lfloor>real_of_int b / 2\<rfloor>}
[PROOF STEP]
using mod_range[OF assms, of "(y + \<lfloor>real_of_int b / 2\<rfloor>)"]
[PROOF STATE]
proof (prove)
using this:
(y + \<lfloor>real_of_int b / 2\<rfloor>) mod b \<in> {0..b - 1}

goal (1 subgoal):
 1. (y + \<lfloor>real_of_int b / 2\<rfloor>) mod b - \<lfloor>real_of_int b / 2\<rfloor> \<in> {- \<lfloor>real_of_int b / 2\<rfloor>..\<lfloor>real_of_int b / 2\<rfloor>}
[PROOF STEP]
by (auto)(linarith)


[STATEMENT]
lemma tan_double: "cos x \<noteq> 0 \<Longrightarrow> cos (2 * x) \<noteq> 0 \<Longrightarrow> tan (2 * x) = (2 * tan x) / (1 - (tan x)\<^sup>2)"
  for x :: "'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cos x \<noteq> (0::'a); cos ((2::'a) * x) \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> tan ((2::'a) * x) = (2::'a) * tan x / ((1::'a) - (tan x)\<^sup>2)
[PROOF STEP]
using tan_add [of x x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>cos x \<noteq> (0::'a); cos x \<noteq> (0::'a); cos (x + x) \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> tan (x + x) = (tan x + tan x) / ((1::'a) - tan x * tan x)

goal (1 subgoal):
 1. \<lbrakk>cos x \<noteq> (0::'a); cos ((2::'a) * x) \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> tan ((2::'a) * x) = (2::'a) * tan x / ((1::'a) - (tan x)\<^sup>2)
[PROOF STEP]
by (simp add: power2_eq_square)


[STATEMENT]
lemma prod_id_cancel_nat:
  \<comment> \<open>Contributed by Manuel Eberl\<close>
  fixes A::"nat set"
  assumes "B \<subseteq> A" and "finite A" and "0 \<notin> B"
  shows "\<Prod>A / \<Prod>B = \<Prod>(A-B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (\<Prod>A) / real (\<Prod>B) = real (\<Prod>(A - B))
[PROOF STEP]
using assms(1-2)
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> A
finite A

goal (1 subgoal):
 1. real (\<Prod>A) / real (\<Prod>B) = real (\<Prod>(A - B))
[PROOF STEP]
by (rule prod_cancel_nat) (metis assms(3))


[STATEMENT]
lemma dist_riemann_sphere_r3_inner:
  assumes "M1 \<in> unit_sphere" and "M2 \<in> unit_sphere"
  shows  "(dist_riemann_sphere_r3 M1 M2)\<^sup>2 = 2 - 2 * inner M1 M2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist_riemann_sphere_r3 M1 M2)\<^sup>2 = 2 - 2 * inner M1 M2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
M1 \<in> unit_sphere
M2 \<in> unit_sphere

goal (1 subgoal):
 1. (dist_riemann_sphere_r3 M1 M2)\<^sup>2 = 2 - 2 * inner M1 M2
[PROOF STEP]
apply (cases M1, cases M2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x a b c. \<lbrakk>M2 \<in> unit_sphere; M1 = Rep_riemann_sphere x; M1 \<in> unit_sphere; M2 \<in> unit_sphere; M2 = (a, b, c)\<rbrakk> \<Longrightarrow> (dist_riemann_sphere_r3 M1 M2)\<^sup>2 = 2 - 2 * inner M1 M2
[PROOF STEP]
apply (auto simp add: norm_prod_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x a b c xa aa ba. \<lbrakk>a * a + b * b + c * c = 1; M1 = (xa, aa, ba); M2 = (a, b, c); Rep_riemann_sphere x = (xa, aa, ba); xa * xa + aa * aa + ba * ba = 1\<rbrakk> \<Longrightarrow> (xa - a)\<^sup>2 + ((aa - b)\<^sup>2 + (ba - c)\<^sup>2) = 2 - (2 * (xa * a) + (2 * (aa * b) + 2 * (ba * c)))
[PROOF STEP]
apply (simp add: power2_eq_square field_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma DDH_bound2:
  shows "\<bar>spmf (ddh.DDH0 \<G> \<A>) True - spmf (ddh.DDH1 \<G> \<A>) True\<bar>
               \<le> ddh.advantage \<G> \<A> + \<bar>spmf (ddh.ddh_1 \<G> \<A>) True - spmf (ddh.DDH1 \<G> \<A>) True\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>spmf (DDH0 \<A>) True - spmf (DDH1 \<A>) True\<bar> \<le> advantage \<A> + \<bar>spmf (ddh_1 \<A>) True - spmf (DDH1 \<A>) True\<bar>
[PROOF STEP]
using advantage_def DDH_bound1
[PROOF STATE]
proof (prove)
using this:
advantage ?\<A> = \<bar>spmf (ddh_0 ?\<A>) True - spmf (ddh_1 ?\<A>) True\<bar>
\<bar>spmf (DDH0 ?\<A>) True - spmf (DDH1 ?\<A>) True\<bar> \<le> \<bar>spmf (ddh_0 ?\<A>) True - spmf (ddh_1 ?\<A>) True\<bar> + \<bar>spmf (ddh_1 ?\<A>) True - spmf (DDH1 ?\<A>) True\<bar>

goal (1 subgoal):
 1. \<bar>spmf (DDH0 \<A>) True - spmf (DDH1 \<A>) True\<bar> \<le> advantage \<A> + \<bar>spmf (ddh_1 \<A>) True - spmf (DDH1 \<A>) True\<bar>
[PROOF STEP]
by simp


[STATEMENT]
lemma sum_list_map_power2_poly:
  shows "poly (sum_list (map power2 (ls::real poly list))) x \<ge> (0::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> poly (sum_list (map power2 ls)) x
[PROOF STEP]
apply (induct ls)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 \<le> poly (sum_list (map power2 [])) x
 2. \<And>a ls. 0 \<le> poly (sum_list (map power2 ls)) x \<Longrightarrow> 0 \<le> poly (sum_list (map power2 (a # ls))) x
[PROOF STEP]
by auto


[STATEMENT]
lemma mult_adjugate_det: "A * adjugate A = diag (det A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * adjugate A = diag (Square_Matrix.det A)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A * adjugate A = diag (Square_Matrix.det A)
[PROOF STEP]
have "transpose (transpose (A * adjugate A)) = transpose (diag (det A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Square_Matrix.transpose (Square_Matrix.transpose (A * adjugate A)) = Square_Matrix.transpose (diag (Square_Matrix.det A))
[PROOF STEP]
unfolding transpose_mult adjugate_transpose[symmetric] adjugate_mult_det det_transpose
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Square_Matrix.transpose (diag (Square_Matrix.det A)) = Square_Matrix.transpose (diag (Square_Matrix.det A))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
Square_Matrix.transpose (Square_Matrix.transpose (A * adjugate A)) = Square_Matrix.transpose (diag (Square_Matrix.det A))

goal (1 subgoal):
 1. A * adjugate A = diag (Square_Matrix.det A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Square_Matrix.transpose (Square_Matrix.transpose (A * adjugate A)) = Square_Matrix.transpose (diag (Square_Matrix.det A))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Square_Matrix.transpose (Square_Matrix.transpose (A * adjugate A)) = Square_Matrix.transpose (diag (Square_Matrix.det A))

goal (1 subgoal):
 1. A * adjugate A = diag (Square_Matrix.det A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A * adjugate A = diag (Square_Matrix.det A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closest_point_exists:
  assumes "closed S"
    and "S \<noteq> {}"
  shows closest_point_in_set: "closest_point S a \<in> S"
    and "\<forall>y\<in>S. dist a (closest_point S a) \<le> dist a y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closest_point S a \<in> S &&& \<forall>y\<in>S. dist a (closest_point S a) \<le> dist a y
[PROOF STEP]
unfolding closest_point_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SOME x. x \<in> S \<and> (\<forall>y\<in>S. dist a x \<le> dist a y)) \<in> S &&& \<forall>y\<in>S. dist a (SOME x. x \<in> S \<and> (\<forall>y\<in>S. dist a x \<le> dist a y)) \<le> dist a y
[PROOF STEP]
by (rule_tac someI2_ex, auto intro: distance_attains_inf[OF assms(1,2), of a])+


[STATEMENT]
lemma "(a::int) ^ 10 - b ^ 10 =
  (a - b) * (a ^ 9 + a ^ 8 * b + a ^ 7 * b ^ 2 + a ^ 6 * b ^ 3 + a ^ 5 * b ^ 4 +
    a ^ 4 * b ^ 5 + a ^ 3 * b ^ 6 + a ^ 2 * b ^ 7 + a * b ^ 8 + b ^ 9)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a ^ 10 - b ^ 10 = (a - b) * (a ^ 9 + a ^ 8 * b + a ^ 7 * b\<^sup>2 + a ^ 6 * b ^ 3 + a ^ 5 * b ^ 4 + a ^ 4 * b ^ 5 + a ^ 3 * b ^ 6 + a\<^sup>2 * b ^ 7 + a * b ^ 8 + b ^ 9)
[PROOF STEP]
by ring


[STATEMENT]
lemma DERIV_quotient:
  "(f has_field_derivative d) (at x within s) \<Longrightarrow>
    (g has_field_derivative e) (at x within s)\<Longrightarrow> g x \<noteq> 0 \<Longrightarrow>
    ((\<lambda>y. f y / g y) has_field_derivative (d * g x - (e * f x)) / (g x ^ Suc (Suc 0))) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative d) (at x within s); (g has_field_derivative e) (at x within s); g x \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> ((\<lambda>y. f y / g y) has_field_derivative (d * g x - e * f x) / g x ^ Suc (Suc 0)) (at x within s)
[PROOF STEP]
by (drule (2) DERIV_divide) (simp add: mult.commute)


[STATEMENT]
lemma nth_weave:
assumes "i < length (weave A xs ys)"
shows "weave A xs ys ! i = (if i\<in>A then xs!(card {a\<in>A. a<i}) else ys!(card {a\<in>-A. a<i}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. weave A xs ys ! i = (if i \<in> A then xs ! card {a \<in> A. a < i} else ys ! card {a \<in> - A. a < i})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. weave A xs ys ! i = (if i \<in> A then xs ! card {a \<in> A. a < i} else ys ! card {a \<in> - A. a < i})
[PROOF STEP]
have "i < length xs + length ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length xs + length ys
[PROOF STEP]
using length_weave
[PROOF STATE]
proof (prove)
using this:
length (weave ?A ?xs ?ys) = length ?xs + length ?ys

goal (1 subgoal):
 1. i < length xs + length ys
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length (weave ?A ?xs ?ys) = length ?xs + length ?ys
i < length (weave A xs ys)

goal (1 subgoal):
 1. i < length xs + length ys
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
i < length xs + length ys

goal (1 subgoal):
 1. weave A xs ys ! i = (if i \<in> A then xs ! card {a \<in> A. a < i} else ys ! card {a \<in> - A. a < i})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < length xs + length ys
[PROOF STEP]
have "i < length [0..<length xs + length ys]"
[PROOF STATE]
proof (prove)
using this:
i < length xs + length ys

goal (1 subgoal):
 1. i < length [0..<length xs + length ys]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length [0..<length xs + length ys]

goal (1 subgoal):
 1. weave A xs ys ! i = (if i \<in> A then xs ! card {a \<in> A. a < i} else ys ! card {a \<in> - A. a < i})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < length [0..<length xs + length ys]
[PROOF STEP]
have "[0..<length xs + length ys] ! i = i"
[PROOF STATE]
proof (prove)
using this:
i < length [0..<length xs + length ys]

goal (1 subgoal):
 1. [0..<length xs + length ys] ! i = i
[PROOF STEP]
by (metis \<open>i < length xs + length ys\<close> add.left_neutral nth_upt)
[PROOF STATE]
proof (state)
this:
[0..<length xs + length ys] ! i = i

goal (1 subgoal):
 1. weave A xs ys ! i = (if i \<in> A then xs ! card {a \<in> A. a < i} else ys ! card {a \<in> - A. a < i})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[0..<length xs + length ys] ! i = i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[0..<length xs + length ys] ! i = i

goal (1 subgoal):
 1. weave A xs ys ! i = (if i \<in> A then xs ! card {a \<in> A. a < i} else ys ! card {a \<in> - A. a < i})
[PROOF STEP]
unfolding weave_def nth_map[OF \<open>i < length [0..<length xs + length ys]\<close>]
[PROOF STATE]
proof (prove)
using this:
[0..<length xs + length ys] ! i = i

goal (1 subgoal):
 1. (if [0..<length xs + length ys] ! i \<in> A then xs ! card {a \<in> A. a < [0..<length xs + length ys] ! i} else ys ! card {a \<in> - A. a < [0..<length xs + length ys] ! i}) = (if i \<in> A then xs ! card {a \<in> A. a < i} else ys ! card {a \<in> - A. a < i})
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
weave A xs ys ! i = (if i \<in> A then xs ! card {a \<in> A. a < i} else ys ! card {a \<in> - A. a < i})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_closed_iff_infdist_zero:
  assumes "closed A" "A \<noteq> {}"
  shows "x \<in> A \<longleftrightarrow> infdist x A = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> A) = (infdist x A = 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x \<in> A) = (infdist x A = 0)
[PROOF STEP]
have "x \<in> closure A \<longleftrightarrow> infdist x A = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> closure A) = (infdist x A = 0)
[PROOF STEP]
by (rule in_closure_iff_infdist_zero) fact
[PROOF STATE]
proof (state)
this:
(x \<in> closure A) = (infdist x A = 0)

goal (1 subgoal):
 1. (x \<in> A) = (infdist x A = 0)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
closed A
A \<noteq> {}
(x \<in> closure A) = (infdist x A = 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
closed A
A \<noteq> {}
(x \<in> closure A) = (infdist x A = 0)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem rtl_inter_closed:
  "\<lbrakk>L1\<in>regular_languages A; L2\<in>regular_languages A\<rbrakk> \<Longrightarrow>
    L1\<inter>L2 \<in> regular_languages A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>L1 \<in> regular_languages A; L2 \<in> regular_languages A\<rbrakk> \<Longrightarrow> L1 \<inter> L2 \<in> regular_languages A
[PROOF STEP]
proof (elim rtlE, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>TA TAa. \<lbrakk>L1 = ta_lang TA; ranked_tree_automaton TA A; L2 = ta_lang TAa; ranked_tree_automaton TAa A\<rbrakk> \<Longrightarrow> L1 \<inter> L2 \<in> regular_languages A
[PROOF STEP]
case (1 TA1 TA2)
[PROOF STATE]
proof (state)
this:
L1 = ta_lang TA1
ranked_tree_automaton TA1 A
L2 = ta_lang TA2
ranked_tree_automaton TA2 A

goal (1 subgoal):
 1. \<And>TA TAa. \<lbrakk>L1 = ta_lang TA; ranked_tree_automaton TA A; L2 = ta_lang TAa; ranked_tree_automaton TAa A\<rbrakk> \<Longrightarrow> L1 \<inter> L2 \<in> regular_languages A
[PROOF STEP]
with ta_prod_correct[of TA1 TA2] ta_prod_rta[of TA1 A TA2]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>tree_automaton TA1; tree_automaton TA2\<rbrakk> \<Longrightarrow> ta_lang (ta_prod TA1 TA2) = ta_lang TA1 \<inter> ta_lang TA2
\<lbrakk>tree_automaton TA1; tree_automaton TA2\<rbrakk> \<Longrightarrow> tree_automaton (ta_prod TA1 TA2)
\<lbrakk>ranked_tree_automaton TA1 A; ranked_tree_automaton TA2 A\<rbrakk> \<Longrightarrow> ranked_tree_automaton (ta_prod TA1 TA2) A
L1 = ta_lang TA1
ranked_tree_automaton TA1 A
L2 = ta_lang TA2
ranked_tree_automaton TA2 A
[PROOF STEP]
have
     L: "ta_lang (ta_prod TA1 TA2) = L1\<inter>L2"  and
     A: "ranked_tree_automaton (ta_prod TA1 TA2) A"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>tree_automaton TA1; tree_automaton TA2\<rbrakk> \<Longrightarrow> ta_lang (ta_prod TA1 TA2) = ta_lang TA1 \<inter> ta_lang TA2
\<lbrakk>tree_automaton TA1; tree_automaton TA2\<rbrakk> \<Longrightarrow> tree_automaton (ta_prod TA1 TA2)
\<lbrakk>ranked_tree_automaton TA1 A; ranked_tree_automaton TA2 A\<rbrakk> \<Longrightarrow> ranked_tree_automaton (ta_prod TA1 TA2) A
L1 = ta_lang TA1
ranked_tree_automaton TA1 A
L2 = ta_lang TA2
ranked_tree_automaton TA2 A

goal (1 subgoal):
 1. ta_lang (ta_prod TA1 TA2) = L1 \<inter> L2 &&& ranked_tree_automaton (ta_prod TA1 TA2) A
[PROOF STEP]
by (simp_all add: ranked_tree_automaton.axioms)
[PROOF STATE]
proof (state)
this:
ta_lang (ta_prod TA1 TA2) = L1 \<inter> L2
ranked_tree_automaton (ta_prod TA1 TA2) A

goal (1 subgoal):
 1. \<And>TA TAa. \<lbrakk>L1 = ta_lang TA; ranked_tree_automaton TA A; L2 = ta_lang TAa; ranked_tree_automaton TAa A\<rbrakk> \<Longrightarrow> L1 \<inter> L2 \<in> regular_languages A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L1 \<inter> L2 \<in> regular_languages A
[PROOF STEP]
using ranked_tree_automaton.rtlI[OF A]
[PROOF STATE]
proof (prove)
using this:
ta_lang (ta_prod TA1 TA2) \<in> regular_languages A

goal (1 subgoal):
 1. L1 \<inter> L2 \<in> regular_languages A
[PROOF STEP]
by (simp add: L)
[PROOF STATE]
proof (state)
this:
L1 \<inter> L2 \<in> regular_languages A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mod_add_eq_imp_mod_0: "
  ((n + k) mod (m::nat) = n mod m) = (k mod m = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((n + k) mod m = n mod m) = (k mod m = 0)
[PROOF STEP]
by (metis add_eq_if mod_add mod_add_self1 mod_self add.commute)


[STATEMENT]
lemma consistentD:
  assumes "consistent x t T B p incr"
  assumes "h \<ge> 0" "t + h \<le> T"
  shows "dist (x (t + h)) (discrete_evolution incr (t + h) t (x t)) \<le> B * h ^ (p + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (x (t + h)) (discrete_evolution incr (t + h) t (x t)) \<le> B * h ^ (p + 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
consistent x t T B p incr
0 \<le> h
t + h \<le> T

goal (1 subgoal):
 1. dist (x (t + h)) (discrete_evolution incr (t + h) t (x t)) \<le> B * h ^ (p + 1)
[PROOF STEP]
unfolding consistent_def
[PROOF STATE]
proof (prove)
using this:
\<forall>h\<ge>0. t + h \<le> T \<longrightarrow> dist (x (t + h)) (discrete_evolution incr (t + h) t (x t)) \<le> B * h ^ (p + 1)
0 \<le> h
t + h \<le> T

goal (1 subgoal):
 1. dist (x (t + h)) (discrete_evolution incr (t + h) t (x t)) \<le> B * h ^ (p + 1)
[PROOF STEP]
by auto


[STATEMENT]
theorem hoare_fixpoint_complete_mbt:
  "F x = x
     \<Longrightarrow> (!! w f . hoare (Sup_less p w) f q \<Longrightarrow> hoare (p w) (F f) q)
     \<Longrightarrow> hoare (Sup (range p)) x q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F x = x; \<And>w f. hoare (Sup_less p w) f q \<Longrightarrow> hoare (p w) (F f) q\<rbrakk> \<Longrightarrow> hoare (\<Squnion> range p) x q
[PROOF STEP]
apply (simp add: hoare_Sup Sup_less_def, safe)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>pa. \<lbrakk>F x = x; \<And>w f. \<forall>pa. (\<exists>v<w. pa = p v) \<longrightarrow> hoare pa f q \<Longrightarrow> hoare (p w) (F f) q\<rbrakk> \<Longrightarrow> hoare (p pa) x q
[PROOF STEP]
apply (rule_tac F = F in hoare_fixpoint_mbt)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>pa. \<lbrakk>F x = x; \<And>w f. \<forall>pa. (\<exists>v<w. pa = p v) \<longrightarrow> hoare pa f q \<Longrightarrow> hoare (p w) (F f) q\<rbrakk> \<Longrightarrow> F x = x
 2. \<And>pa w f. \<lbrakk>F x = x; \<And>w f. \<forall>pa. (\<exists>v<w. pa = p v) \<longrightarrow> hoare pa f q \<Longrightarrow> hoare (p w) (F f) q; \<And>v. v < w \<Longrightarrow> hoare (p v) f q\<rbrakk> \<Longrightarrow> hoare (p w) (F f) q
[PROOF STEP]
by auto


[STATEMENT]
theorem NonnegFirstPrices:
   assumes "\<forall> X. b (n, X) \<ge> 0"
   shows "firstPriceP N \<Omega> b r n \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> firstPriceP N \<Omega> b r n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>X. 0 \<le> b (n, X)

goal (1 subgoal):
 1. 0 \<le> firstPriceP N \<Omega> b r n
[PROOF STEP]
by blast


[STATEMENT]
lemma filtermap_times_pos_at_right:
  fixes c::"'a::{linordered_field, linorder_topology}"
  assumes "c > 0"
  shows "filtermap (times c) (at_right p) = at_right (c * p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap ((*) c) (at_right p) = at_right (c * p)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(0::'a) < c

goal (1 subgoal):
 1. filtermap ((*) c) (at_right p) = at_right (c * p)
[PROOF STEP]
by (intro filtermap_fun_inverse[where g="\<lambda>x. inverse c * x"])
    (auto intro!: filterlim_ident filterlim_times_pos)


[STATEMENT]
lemma hom_component_minus: "hom_component (p - q) n = hom_component p n - hom_component q n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_component (p - q) n = hom_component p n - hom_component q n
[PROOF STEP]
by (rule poly_mapping_eqI) (simp add: hom_component_def lookup_except lookup_minus)


[STATEMENT]
lemma divideC_field_simps[field_simps]: (* In Real_Vector_Spaces, these lemmas are unnamed *)
  "c \<noteq> 0 \<Longrightarrow> a = b /\<^sub>C c \<longleftrightarrow> c *\<^sub>C a = b"
  "c \<noteq> 0 \<Longrightarrow> b /\<^sub>C c = a \<longleftrightarrow> b = c *\<^sub>C a"
  "c \<noteq> 0 \<Longrightarrow> a + b /\<^sub>C c = (c *\<^sub>C a + b) /\<^sub>C c"
  "c \<noteq> 0 \<Longrightarrow> a /\<^sub>C c + b = (a + c *\<^sub>C b) /\<^sub>C c"
  "c \<noteq> 0 \<Longrightarrow> a - b /\<^sub>C c = (c *\<^sub>C a - b) /\<^sub>C c"
  "c \<noteq> 0 \<Longrightarrow> a /\<^sub>C c - b = (a - c *\<^sub>C b) /\<^sub>C c"
  "c \<noteq> 0 \<Longrightarrow> - (a /\<^sub>C c) + b = (- a + c *\<^sub>C b) /\<^sub>C c"
  "c \<noteq> 0 \<Longrightarrow> - (a /\<^sub>C c) - b = (- a - c *\<^sub>C b) /\<^sub>C c"
  for a b :: "'a :: complex_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((c \<noteq> 0 \<Longrightarrow> (a = b /\<^sub>C c) = (c *\<^sub>C a = b)) &&& (c \<noteq> 0 \<Longrightarrow> (b /\<^sub>C c = a) = (b = c *\<^sub>C a))) &&& (c \<noteq> 0 \<Longrightarrow> a + b /\<^sub>C c = (c *\<^sub>C a + b) /\<^sub>C c) &&& (c \<noteq> 0 \<Longrightarrow> a /\<^sub>C c + b = (a + c *\<^sub>C b) /\<^sub>C c)) &&& ((c \<noteq> 0 \<Longrightarrow> a - b /\<^sub>C c = (c *\<^sub>C a - b) /\<^sub>C c) &&& (c \<noteq> 0 \<Longrightarrow> a /\<^sub>C c - b = (a - c *\<^sub>C b) /\<^sub>C c)) &&& (c \<noteq> 0 \<Longrightarrow> - (a /\<^sub>C c) + b = (- a + c *\<^sub>C b) /\<^sub>C c) &&& (c \<noteq> 0 \<Longrightarrow> - (a /\<^sub>C c) - b = (- a - c *\<^sub>C b) /\<^sub>C c)
[PROOF STEP]
by (auto simp add: scaleC_add_right scaleC_add_left scaleC_diff_right scaleC_diff_left)


[STATEMENT]
lemma dist_triangle_eq:
  fixes a b c :: "'a :: real_inner"
  shows "(dist a c = dist a b + dist b c) \<longleftrightarrow> dist a b *\<^sub>R (c - b) + dist b c *\<^sub>R (a - b) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist a c = dist a b + dist b c) = (dist a b *\<^sub>R (c - b) + dist b c *\<^sub>R (a - b) = (0::'a))
[PROOF STEP]
using norm_triangle_eq[of "b - a" "c - b"]
[PROOF STATE]
proof (prove)
using this:
(norm (b - a + (c - b)) = norm (b - a) + norm (c - b)) = (norm (b - a) *\<^sub>R (c - b) = norm (c - b) *\<^sub>R (b - a))

goal (1 subgoal):
 1. (dist a c = dist a b + dist b c) = (dist a b *\<^sub>R (c - b) + dist b c *\<^sub>R (a - b) = (0::'a))
[PROOF STEP]
by (simp add: dist_norm norm_minus_commute algebra_simps)


[STATEMENT]
lemma ocU_is_expected_utility_bernoulli:
  shows "\<forall>x \<in> \<P>. \<forall>y \<in> \<P>. x \<succeq>[\<R>] y \<longleftrightarrow>
  measure_pmf.expectation x ocU \<ge> measure_pmf.expectation y ocU"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>local.\<P>. \<forall>y\<in>local.\<P>. x \<succeq>[\<R>] y = (measure_pmf.expectation y ocU \<le> measure_pmf.expectation x ocU)
[PROOF STEP]
using ordinal_utility_expected_value
[PROOF STATE]
proof (prove)
using this:
ordinal_utility local.\<P> \<R> (\<lambda>x. measure_pmf.expectation x ocU)

goal (1 subgoal):
 1. \<forall>x\<in>local.\<P>. \<forall>y\<in>local.\<P>. x \<succeq>[\<R>] y = (measure_pmf.expectation y ocU \<le> measure_pmf.expectation x ocU)
[PROOF STEP]
by (meson ordinal_utility.util_def)


[STATEMENT]
lemma Leaf_in_set_random_bst_iff:
  assumes "finite A"
  shows   "Leaf \<in> set_pmf (random_bst A) \<longleftrightarrow> A = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<langle>\<rangle> \<in> set_pmf (random_bst A)) = (A = {})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<langle>\<rangle> \<in> set_pmf (random_bst A) \<Longrightarrow> A = {}
 2. A = {} \<Longrightarrow> \<langle>\<rangle> \<in> set_pmf (random_bst A)
[PROOF STEP]
assume "Leaf \<in> set_pmf (random_bst A)"
[PROOF STATE]
proof (state)
this:
\<langle>\<rangle> \<in> set_pmf (random_bst A)

goal (2 subgoals):
 1. \<langle>\<rangle> \<in> set_pmf (random_bst A) \<Longrightarrow> A = {}
 2. A = {} \<Longrightarrow> \<langle>\<rangle> \<in> set_pmf (random_bst A)
[PROOF STEP]
from size_random_bst[OF this] and assms
[PROOF STATE]
proof (chain)
picking this:
finite A \<Longrightarrow> size \<langle>\<rangle> = card A
finite A
[PROOF STEP]
show "A = {}"
[PROOF STATE]
proof (prove)
using this:
finite A \<Longrightarrow> size \<langle>\<rangle> = card A
finite A

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

goal (1 subgoal):
 1. A = {} \<Longrightarrow> \<langle>\<rangle> \<in> set_pmf (random_bst A)
[PROOF STEP]
qed auto


[STATEMENT]
lemma lead_coeff_p: "lead_coeff (p s) = (\<Prod>i = 0..<s. 1 / (of_nat s - of_nat i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (p s) = (\<Prod>i = 0..<s. 1 / (real s - real i))
[PROOF STEP]
unfolding p_def lead_coeff_prod
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x = 0..<s. lead_coeff [:- real x / real (s - x), 1 / real (s - x):]) = (\<Prod>i = 0..<s. 1 / (real s - real i))
[PROOF STEP]
by (rule prod.cong[OF refl], auto)


[STATEMENT]
lemma sum_inverse_squares_tail_bound:
  assumes "d > 0"
  shows   "summable (\<lambda>n. 1 / (real (Suc n) + d) ^ 2)"
          "(\<Sum>n. 1 / (real (Suc n) + d) ^ 2) \<le> 1 / d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. 1 / (real (Suc n) + d)\<^sup>2) &&& (\<Sum>n. 1 / (real (Suc n) + d)\<^sup>2) \<le> 1 / d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. summable (\<lambda>n. 1 / (real (Suc n) + d)\<^sup>2)
 2. (\<Sum>n. 1 / (real (Suc n) + d)\<^sup>2) \<le> 1 / d
[PROOF STEP]
show *: "summable (\<lambda>n. 1 / (real (Suc n) + d) ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. 1 / (real (Suc n) + d)\<^sup>2)
[PROOF STEP]
proof (rule summable_comparison_test, intro allI exI impI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. ?N3 \<le> n \<Longrightarrow> norm (1 / (real (Suc n) + d)\<^sup>2) \<le> ?g n
 2. summable ?g
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. ?N3 \<le> n \<Longrightarrow> norm (1 / (real (Suc n) + d)\<^sup>2) \<le> ?g n
 2. summable ?g
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < d
[PROOF STEP]
show "norm (1 / (real (Suc n) + d) ^ 2) \<le> 1 / real (Suc n) ^ 2"
[PROOF STATE]
proof (prove)
using this:
0 < d

goal (1 subgoal):
 1. norm (1 / (real (Suc n) + d)\<^sup>2) \<le> 1 / (real (Suc n))\<^sup>2
[PROOF STEP]
unfolding norm_divide norm_one norm_power
[PROOF STATE]
proof (prove)
using this:
0 < d

goal (1 subgoal):
 1. 1 / (norm (real (Suc n) + d))\<^sup>2 \<le> 1 / (real (Suc n))\<^sup>2
[PROOF STEP]
by (intro divide_left_mono power_mono) simp_all
[PROOF STATE]
proof (state)
this:
norm (1 / (real (Suc n) + d)\<^sup>2) \<le> 1 / (real (Suc n))\<^sup>2

goal (1 subgoal):
 1. summable (\<lambda>n. 1 / (real (Suc n))\<^sup>2)
[PROOF STEP]
qed (insert inverse_squares_sums, simp add: sums_iff)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. 1 / (real (Suc n) + d)\<^sup>2)

goal (1 subgoal):
 1. (\<Sum>n. 1 / (real (Suc n) + d)\<^sup>2) \<le> 1 / d
[PROOF STEP]
show "(\<Sum>n. 1 / (real (Suc n) + d) ^ 2) \<le> 1 / d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. 1 / (real (Suc n) + d)\<^sup>2) \<le> 1 / d
[PROOF STEP]
proof (rule sums_le)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>n. ?f n \<le> ?g n
 2. ?f sums (\<Sum>n. 1 / (real (Suc n) + d)\<^sup>2)
 3. ?g sums (1 / d)
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>n. ?f n \<le> ?g n
 2. ?f sums (\<Sum>n. 1 / (real (Suc n) + d)\<^sup>2)
 3. ?g sums (1 / d)
[PROOF STEP]
have "1 / (real (Suc n) + d) ^ 2 \<le> 1 / ((real n + d) * (real (Suc n) + d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / (real (Suc n) + d)\<^sup>2 \<le> 1 / ((real n + d) * (real (Suc n) + d))
[PROOF STEP]
unfolding power2_eq_square
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / ((real (Suc n) + d) * (real (Suc n) + d)) \<le> 1 / ((real n + d) * (real (Suc n) + d))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < d

goal (1 subgoal):
 1. 1 / ((real (Suc n) + d) * (real (Suc n) + d)) \<le> 1 / ((real n + d) * (real (Suc n) + d))
[PROOF STEP]
by (intro divide_left_mono mult_mono mult_pos_pos add_nonneg_pos) simp_all
[PROOF STATE]
proof (state)
this:
1 / (real (Suc n) + d)\<^sup>2 \<le> 1 / ((real n + d) * (real (Suc n) + d))

goal (3 subgoals):
 1. \<And>n. ?f n \<le> ?g n
 2. ?f sums (\<Sum>n. 1 / (real (Suc n) + d)\<^sup>2)
 3. ?g sums (1 / d)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 / (real (Suc n) + d)\<^sup>2 \<le> 1 / ((real n + d) * (real (Suc n) + d))

goal (3 subgoals):
 1. \<And>n. ?f n \<le> ?g n
 2. ?f sums (\<Sum>n. 1 / (real (Suc n) + d)\<^sup>2)
 3. ?g sums (1 / d)
[PROOF STEP]
have "\<dots> = 1 / (real n + d) - 1 / (real (Suc n) + d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / ((real n + d) * (real (Suc n) + d)) = 1 / (real n + d) - 1 / (real (Suc n) + d)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < d

goal (1 subgoal):
 1. 1 / ((real n + d) * (real (Suc n) + d)) = 1 / (real n + d) - 1 / (real (Suc n) + d)
[PROOF STEP]
by (simp add: divide_simps)
[PROOF STATE]
proof (state)
this:
1 / ((real n + d) * (real (Suc n) + d)) = 1 / (real n + d) - 1 / (real (Suc n) + d)

goal (3 subgoals):
 1. \<And>n. ?f n \<le> ?g n
 2. ?f sums (\<Sum>n. 1 / (real (Suc n) + d)\<^sup>2)
 3. ?g sums (1 / d)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
1 / (real (Suc n) + d)\<^sup>2 \<le> 1 / (real n + d) - 1 / (real (Suc n) + d)
[PROOF STEP]
show "1 / (real (Suc n) + d)\<^sup>2 \<le> 1 / (real n + d) - 1 / (real (Suc n) + d)"
[PROOF STATE]
proof (prove)
using this:
1 / (real (Suc n) + d)\<^sup>2 \<le> 1 / (real n + d) - 1 / (real (Suc n) + d)

goal (1 subgoal):
 1. 1 / (real (Suc n) + d)\<^sup>2 \<le> 1 / (real n + d) - 1 / (real (Suc n) + d)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
1 / (real (Suc n) + d)\<^sup>2 \<le> 1 / (real n + d) - 1 / (real (Suc n) + d)

goal (2 subgoals):
 1. (\<lambda>n. 1 / (real (Suc (?n7 n)) + d)\<^sup>2) sums (\<Sum>n. 1 / (real (Suc n) + d)\<^sup>2)
 2. (\<lambda>n. 1 / (real (?n7 n) + d) - 1 / (real (Suc (?n7 n)) + d)) sums (1 / d)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>n. 1 / (real (Suc (?n7 n)) + d)\<^sup>2) sums (\<Sum>n. 1 / (real (Suc n) + d)\<^sup>2)
 2. (\<lambda>n. 1 / (real (?n7 n) + d) - 1 / (real (Suc (?n7 n)) + d)) sums (1 / d)
[PROOF STEP]
show "(\<lambda>n. 1 / (real (Suc n) + d)\<^sup>2) sums (\<Sum>n. 1 / (real (Suc n) + d)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 1 / (real (Suc n) + d)\<^sup>2) sums (\<Sum>n. 1 / (real (Suc n) + d)\<^sup>2)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. 1 / (real (Suc n) + d)\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>n. 1 / (real (Suc n) + d)\<^sup>2) sums (\<Sum>n. 1 / (real (Suc n) + d)\<^sup>2)
[PROOF STEP]
by (simp add: sums_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 1 / (real (Suc n) + d)\<^sup>2) sums (\<Sum>n. 1 / (real (Suc n) + d)\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>n. 1 / (real n + d) - 1 / (real (Suc n) + d)) sums (1 / d)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. 1 / (real n + d) - 1 / (real (Suc n) + d)) sums (1 / d)
[PROOF STEP]
have "(\<lambda>n. 1 / (real n + d) - 1 / (real (Suc n) + d)) sums (1 / (real 0 + d) - 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 1 / (real n + d) - 1 / (real (Suc n) + d)) sums (1 / (real 0 + d) - 0)
[PROOF STEP]
by (intro telescope_sums' real_tendsto_divide_at_top[OF tendsto_const],
          subst add.commute, rule filterlim_tendsto_add_at_top[OF tendsto_const
            filterlim_real_sequentially])
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 1 / (real n + d) - 1 / (real (Suc n) + d)) sums (1 / (real 0 + d) - 0)

goal (1 subgoal):
 1. (\<lambda>n. 1 / (real n + d) - 1 / (real (Suc n) + d)) sums (1 / d)
[PROOF STEP]
thus "(\<lambda>n. 1 / (real n + d) - 1 / (real (Suc n) + d)) sums (1 / d)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. 1 / (real n + d) - 1 / (real (Suc n) + d)) sums (1 / (real 0 + d) - 0)

goal (1 subgoal):
 1. (\<lambda>n. 1 / (real n + d) - 1 / (real (Suc n) + d)) sums (1 / d)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 1 / (real n + d) - 1 / (real (Suc n) + d)) sums (1 / d)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>n. 1 / (real (Suc n) + d)\<^sup>2) \<le> 1 / d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma valid_pratt_tree_imp_prime:
  assumes "valid_pratt_tree t"
  shows   "prime (pratt_tree_number t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime (pratt_tree_number t)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
valid_pratt_tree t

goal (1 subgoal):
 1. prime (pratt_tree_number t)
[PROOF STEP]
proof (induction t rule: valid_pratt_tree.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n a ts. \<lbrakk>\<And>x. \<lbrakk>x \<in> set ts; valid_pratt_tree x\<rbrakk> \<Longrightarrow> prime (pratt_tree_number x); valid_pratt_tree (Pratt_Node (n, a, ts))\<rbrakk> \<Longrightarrow> prime (pratt_tree_number (Pratt_Node (n, a, ts)))
[PROOF STEP]
case (1 n a ts)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> set ts; valid_pratt_tree ?x\<rbrakk> \<Longrightarrow> prime (pratt_tree_number ?x)
valid_pratt_tree (Pratt_Node (n, a, ts))

goal (1 subgoal):
 1. \<And>n a ts. \<lbrakk>\<And>x. \<lbrakk>x \<in> set ts; valid_pratt_tree x\<rbrakk> \<Longrightarrow> prime (pratt_tree_number x); valid_pratt_tree (Pratt_Node (n, a, ts))\<rbrakk> \<Longrightarrow> prime (pratt_tree_number (Pratt_Node (n, a, ts)))
[PROOF STEP]
from 1
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x \<in> set ts; valid_pratt_tree ?x\<rbrakk> \<Longrightarrow> prime (pratt_tree_number ?x)
valid_pratt_tree (Pratt_Node (n, a, ts))
[PROOF STEP]
have "prime_factors (n - 1) \<subseteq> set (map pratt_tree_number ts)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> set ts; valid_pratt_tree ?x\<rbrakk> \<Longrightarrow> prime (pratt_tree_number ?x)
valid_pratt_tree (Pratt_Node (n, a, ts))

goal (1 subgoal):
 1. prime_factors (n - 1) \<subseteq> set (map pratt_tree_number ts)
[PROOF STEP]
by (intro check_prime_factors_subset_correct) (auto simp: list.pred_set)
[PROOF STATE]
proof (state)
this:
prime_factors (n - 1) \<subseteq> set (map pratt_tree_number ts)

goal (1 subgoal):
 1. \<And>n a ts. \<lbrakk>\<And>x. \<lbrakk>x \<in> set ts; valid_pratt_tree x\<rbrakk> \<Longrightarrow> prime (pratt_tree_number x); valid_pratt_tree (Pratt_Node (n, a, ts))\<rbrakk> \<Longrightarrow> prime (pratt_tree_number (Pratt_Node (n, a, ts)))
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x \<in> set ts; valid_pratt_tree ?x\<rbrakk> \<Longrightarrow> prime (pratt_tree_number ?x)
valid_pratt_tree (Pratt_Node (n, a, ts))
prime_factors (n - 1) \<subseteq> set (map pratt_tree_number ts)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> set ts; valid_pratt_tree ?x\<rbrakk> \<Longrightarrow> prime (pratt_tree_number ?x)
valid_pratt_tree (Pratt_Node (n, a, ts))
prime_factors (n - 1) \<subseteq> set (map pratt_tree_number ts)

goal (1 subgoal):
 1. prime (pratt_tree_number (Pratt_Node (n, a, ts)))
[PROOF STEP]
by (intro lehmers_theorem[where a = a]) auto
[PROOF STATE]
proof (state)
this:
prime (pratt_tree_number (Pratt_Node (n, a, ts)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in equivalence) set_eq_trans_aux:
  assumes "A \<subseteq> carrier S" "B \<subseteq> carrier S" "C \<subseteq> carrier S"
    and "A {.=} B" "B {.=} C"
  shows "\<And>a. a \<in> A \<Longrightarrow> a .\<in> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. a \<in> A \<Longrightarrow> a .\<in> C
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> carrier S
B \<subseteq> carrier S
C \<subseteq> carrier S
A {.=} B
B {.=} C

goal (1 subgoal):
 1. \<And>a. a \<in> A \<Longrightarrow> a .\<in> C
[PROOF STEP]
by (simp add: eq_elem_cong_r subset_iff)


[STATEMENT]
lemma finite_nonempty_carrier_has_maximum:
  assumes "carrier \<noteq> {}"
  shows "\<exists>e \<in> carrier. \<forall>m \<in> carrier. e \<succeq>[relation] m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>e\<in>carrier. \<forall>m\<in>carrier. e \<succeq> m
[PROOF STEP]
using finite_nempty_preorder_has_max[of carrier relation] assms
     \<open>finite carrier\<close> reflexivity total transitivity
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite carrier; carrier \<noteq> {}; refl_on carrier relation; trans relation; total_on carrier relation\<rbrakk> \<Longrightarrow> \<exists>x\<in>carrier. \<forall>y\<in>carrier. x \<succeq> y
carrier \<noteq> {}
finite carrier
refl_on carrier relation
total_on carrier relation
trans relation

goal (1 subgoal):
 1. \<exists>e\<in>carrier. \<forall>m\<in>carrier. e \<succeq> m
[PROOF STEP]
by blast


[STATEMENT]
lemma Least_imp_disj_eq: "
  \<lbrakk> \<exists>x. P x; \<And>x. P x \<Longrightarrow> Q x \<rbrakk> \<Longrightarrow>
  (LEAST (x::'a::wellorder). P x \<or> Q x) = (LEAST x. Q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. P x; \<And>x. P x \<Longrightarrow> Q x\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = (LEAST x. Q x)
[PROOF STEP]
apply (subst Least_disj, assumption, blast)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. P x; \<And>x. P x \<Longrightarrow> Q x\<rbrakk> \<Longrightarrow> min (Least P) (Least Q) = Least Q
[PROOF STEP]
apply (subst min.commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. P x; \<And>x. P x \<Longrightarrow> Q x\<rbrakk> \<Longrightarrow> min (Least Q) (Least P) = Least Q
[PROOF STEP]
apply (rule min.absorb_iff1[THEN iffD1])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. P x; \<And>x. P x \<Longrightarrow> Q x\<rbrakk> \<Longrightarrow> Least Q \<le> Least P
[PROOF STEP]
apply (rule Least_imp_le, assumption, blast)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma conefield_right_vangleI:
  assumes ij: "i \<in> Basis" "j \<in> Basis" and ij_neq: "i \<noteq> j"
  assumes "y \<in> {y1 .. y2}" "y1 < y2"
  shows "(i + y *\<^sub>R j) \<in> conefield (i + y1 *\<^sub>R j) (i + y2 *\<^sub>R j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i + y *\<^sub>R j \<in> conefield (i + y1 *\<^sub>R j) (i + y2 *\<^sub>R j)
[PROOF STEP]
unfolding conefield_alt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i + y *\<^sub>R j \<in> cone hull {i + y1 *\<^sub>R j--i + y2 *\<^sub>R j}
[PROOF STEP]
apply (rule hull_inc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i + y *\<^sub>R j \<in> {i + y1 *\<^sub>R j--i + y2 *\<^sub>R j}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<in> Basis
j \<in> Basis
i \<noteq> j
y \<in> {y1..y2}
y1 < y2

goal (1 subgoal):
 1. i + y *\<^sub>R j \<in> {i + y1 *\<^sub>R j--i + y2 *\<^sub>R j}
[PROOF STEP]
by (auto simp: in_segment divide_simps inner_Basis algebra_simps
      intro!: exI[where x="(y - y1) / (y2 - y1)"] euclidean_eqI[where 'a='a] )


[STATEMENT]
lemma "finite (A:: nat set) \<Longrightarrow> A \<noteq> {}\<Longrightarrow> Max A \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Max A \<in> A
[PROOF STEP]
proof(induction A rule: finite.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {} \<noteq> {} \<Longrightarrow> Max {} \<in> {}
 2. \<And>A a. \<lbrakk>finite A; A \<noteq> {} \<Longrightarrow> Max A \<in> A; insert a A \<noteq> {}\<rbrakk> \<Longrightarrow> Max (insert a A) \<in> insert a A
[PROOF STEP]
case emptyI
[PROOF STATE]
proof (state)
this:
{} \<noteq> {}

goal (2 subgoals):
 1. {} \<noteq> {} \<Longrightarrow> Max {} \<in> {}
 2. \<And>A a. \<lbrakk>finite A; A \<noteq> {} \<Longrightarrow> Max A \<in> A; insert a A \<noteq> {}\<rbrakk> \<Longrightarrow> Max (insert a A) \<in> insert a A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{} \<noteq> {}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
{} \<noteq> {}

goal (1 subgoal):
 1. Max {} \<in> {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Max {} \<in> {}

goal (1 subgoal):
 1. \<And>A a. \<lbrakk>finite A; A \<noteq> {} \<Longrightarrow> Max A \<in> A; insert a A \<noteq> {}\<rbrakk> \<Longrightarrow> Max (insert a A) \<in> insert a A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A a. \<lbrakk>finite A; A \<noteq> {} \<Longrightarrow> Max A \<in> A; insert a A \<noteq> {}\<rbrakk> \<Longrightarrow> Max (insert a A) \<in> insert a A
[PROOF STEP]
case (insertI A a)
[PROOF STATE]
proof (state)
this:
finite A
A \<noteq> {} \<Longrightarrow> Max A \<in> A
insert a A \<noteq> {}

goal (1 subgoal):
 1. \<And>A a. \<lbrakk>finite A; A \<noteq> {} \<Longrightarrow> Max A \<in> A; insert a A \<noteq> {}\<rbrakk> \<Longrightarrow> Max (insert a A) \<in> insert a A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<noteq> {} \<Longrightarrow> Max A \<in> A
insert a A \<noteq> {}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {} \<Longrightarrow> Max A \<in> A
insert a A \<noteq> {}

goal (1 subgoal):
 1. Max (insert a A) \<in> insert a A
[PROOF STEP]
by (meson Max_in finite_insert)
[PROOF STATE]
proof (state)
this:
Max (insert a A) \<in> insert a A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gamma_inverse:
  assumes "\<alpha> \<in> {0<..<1}"
    and "\<beta> \<in> {0<..<1}"
  shows "(1::real) - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<alpha>) / (1 - \<beta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<alpha>) / (1 - \<beta>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<alpha>) / (1 - \<beta>)
[PROOF STEP]
have "1 - (\<alpha> - \<beta>) / (1 - \<beta>) =  (1 - \<beta>)/(1 - \<beta>) - (\<alpha> - \<beta>) / (1 - \<beta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<beta>) / (1 - \<beta>) - (\<alpha> - \<beta>) / (1 - \<beta>)
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
\<beta> \<in> {0<..<1}

goal (1 subgoal):
 1. 1 - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<beta>) / (1 - \<beta>) - (\<alpha> - \<beta>) / (1 - \<beta>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<beta>) / (1 - \<beta>) - (\<alpha> - \<beta>) / (1 - \<beta>)

goal (1 subgoal):
 1. 1 - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<alpha>) / (1 - \<beta>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<beta>) / (1 - \<beta>) - (\<alpha> - \<beta>) / (1 - \<beta>)

goal (1 subgoal):
 1. 1 - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<alpha>) / (1 - \<beta>)
[PROOF STEP]
have "... = (1 - \<beta> - (\<alpha> - \<beta>)) / (1 - \<beta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - \<beta>) / (1 - \<beta>) - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<beta> - (\<alpha> - \<beta>)) / (1 - \<beta>)
[PROOF STEP]
by (metis diff_divide_distrib)
[PROOF STATE]
proof (state)
this:
(1 - \<beta>) / (1 - \<beta>) - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<beta> - (\<alpha> - \<beta>)) / (1 - \<beta>)

goal (1 subgoal):
 1. 1 - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<alpha>) / (1 - \<beta>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 - \<beta>) / (1 - \<beta>) - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<beta> - (\<alpha> - \<beta>)) / (1 - \<beta>)

goal (1 subgoal):
 1. 1 - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<alpha>) / (1 - \<beta>)
[PROOF STEP]
have "... = (1 - \<alpha>) / (1 - \<beta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - \<beta> - (\<alpha> - \<beta>)) / (1 - \<beta>) = (1 - \<alpha>) / (1 - \<beta>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1 - \<beta> - (\<alpha> - \<beta>)) / (1 - \<beta>) = (1 - \<alpha>) / (1 - \<beta>)

goal (1 subgoal):
 1. 1 - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<alpha>) / (1 - \<beta>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
1 - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<alpha>) / (1 - \<beta>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<alpha>) / (1 - \<beta>)

goal (1 subgoal):
 1. 1 - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<alpha>) / (1 - \<beta>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
1 - (\<alpha> - \<beta>) / (1 - \<beta>) = (1 - \<alpha>) / (1 - \<beta>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infsum_cmult_left:
  fixes f :: "'a \<Rightarrow> 'b :: {t2_space, topological_semigroup_mult, semiring_0}"
  assumes \<open>c \<noteq> 0 \<Longrightarrow> f summable_on A\<close>
  shows "infsum (\<lambda>x. f x * c) A = infsum f A * c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. f x * c) = infsum f A * c
[PROOF STEP]
proof (cases \<open>c=0\<close>)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c = (0::'b) \<Longrightarrow> (\<Sum>\<^sub>\<infinity>x\<in>A. f x * c) = infsum f A * c
 2. c \<noteq> (0::'b) \<Longrightarrow> (\<Sum>\<^sub>\<infinity>x\<in>A. f x * c) = infsum f A * c
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
c = (0::'b)

goal (2 subgoals):
 1. c = (0::'b) \<Longrightarrow> (\<Sum>\<^sub>\<infinity>x\<in>A. f x * c) = infsum f A * c
 2. c \<noteq> (0::'b) \<Longrightarrow> (\<Sum>\<^sub>\<infinity>x\<in>A. f x * c) = infsum f A * c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c = (0::'b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c = (0::'b)

goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. f x * c) = infsum f A * c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>\<infinity>x\<in>A. f x * c) = infsum f A * c

goal (1 subgoal):
 1. c \<noteq> (0::'b) \<Longrightarrow> (\<Sum>\<^sub>\<infinity>x\<in>A. f x * c) = infsum f A * c
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c \<noteq> (0::'b) \<Longrightarrow> (\<Sum>\<^sub>\<infinity>x\<in>A. f x * c) = infsum f A * c
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
c \<noteq> (0::'b)

goal (1 subgoal):
 1. c \<noteq> (0::'b) \<Longrightarrow> (\<Sum>\<^sub>\<infinity>x\<in>A. f x * c) = infsum f A * c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> (0::'b)
[PROOF STEP]
have \<open>has_sum f A (infsum f A)\<close>
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'b)

goal (1 subgoal):
 1. has_sum f A (infsum f A)
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
has_sum f A (infsum f A)

goal (1 subgoal):
 1. c \<noteq> (0::'b) \<Longrightarrow> (\<Sum>\<^sub>\<infinity>x\<in>A. f x * c) = infsum f A * c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
has_sum f A (infsum f A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
has_sum f A (infsum f A)

goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. f x * c) = infsum f A * c
[PROOF STEP]
by (auto intro!: infsumI has_sum_cmult_left)
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>\<infinity>x\<in>A. f x * c) = infsum f A * c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Stewart':
  fixes A B C D :: "'a::euclidean_space"
  assumes "between (B, C) D"
  shows "(dist A C)\<^sup>2 * dist B D + (dist B A)\<^sup>2 * dist C D = dist B C * ((dist A D)\<^sup>2 + dist B D * dist C D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist A C)\<^sup>2 * dist B D + (dist B A)\<^sup>2 * dist C D = dist B C * ((dist A D)\<^sup>2 + dist B D * dist C D)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
between (B, C) D

goal (1 subgoal):
 1. (dist A C)\<^sup>2 * dist B D + (dist B A)\<^sup>2 * dist C D = dist B C * ((dist A D)\<^sup>2 + dist B D * dist C D)
[PROOF STEP]
by (auto intro: Stewart)


[STATEMENT]
lemma totient_double: "totient (2 * n) = (if even n then 2 * totient n else totient n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient (2 * n) = (if even n then 2 * totient n else totient n)
[PROOF STEP]
by (simp add: totient_mult ac_simps odd_imp_coprime_nat)


[STATEMENT]
lemma mat_mult [code abstract]: "vec_nth (m ** m') = mat_mult_row m m'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (m ** m') = mat_mult_row m m'
[PROOF STEP]
unfolding matrix_matrix_mult_def mat_mult_row_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (\<chi>i j. \<Sum>k\<in>UNIV. m $ i $ k * m' $ k $ j) = (\<lambda>f. \<chi>c. \<Sum>k\<in>UNIV. m $ f $ k * m' $ k $ c)
[PROOF STEP]
using vec_lambda_beta
[PROOF STATE]
proof (prove)
using this:
vec_lambda ?g $ ?i = ?g ?i

goal (1 subgoal):
 1. ($) (\<chi>i j. \<Sum>k\<in>UNIV. m $ i $ k * m' $ k $ j) = (\<lambda>f. \<chi>c. \<Sum>k\<in>UNIV. m $ f $ k * m' $ k $ c)
[PROOF STEP]
by auto


[STATEMENT]
lemma exp_first_two_terms: "exp x = 1 + x + (\<Sum>n. inverse (fact (n + 2)) *\<^sub>R (x ^ (n + 2)))"
  for x :: "'a::{real_normed_algebra_1,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp x = (1::'a) + x + (\<Sum>n. x ^ (n + 2) /\<^sub>R fact (n + 2))
[PROOF STEP]
using exp_first_terms[of x 2]
[PROOF STATE]
proof (prove)
using this:
exp x = (\<Sum>n<2. x ^ n /\<^sub>R fact n) + (\<Sum>n. x ^ (n + 2) /\<^sub>R fact (n + 2))

goal (1 subgoal):
 1. exp x = (1::'a) + x + (\<Sum>n. x ^ (n + 2) /\<^sub>R fact (n + 2))
[PROOF STEP]
by (simp add: eval_nat_numeral)


[STATEMENT]
lemma sum_of_2_powers: "(\<Sum>i=0..<n. 2^i) = 2^n - (1::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((^) 2) {0..<n} = 2 ^ n - 1
[PROOF STEP]
by (induct n) auto


[STATEMENT]
lemma nth_prime_lower_bound: "nth_prime n \<ge> Suc (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (Suc n) \<le> nth_prime n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Suc (Suc n) \<le> nth_prime n
[PROOF STEP]
have "n = card {q. prime q \<and> q < nth_prime n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = card {q. prime q \<and> q < nth_prime n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n = card {q. prime q \<and> q < nth_prime n}

goal (1 subgoal):
 1. Suc (Suc n) \<le> nth_prime n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n = card {q. prime q \<and> q < nth_prime n}

goal (1 subgoal):
 1. Suc (Suc n) \<le> nth_prime n
[PROOF STEP]
have "\<dots> \<le> card {2..<nth_prime n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {q. prime q \<and> q < nth_prime n} \<le> card {2..<nth_prime n}
[PROOF STEP]
by (intro card_mono) (auto dest: prime_gt_1_nat)
[PROOF STATE]
proof (state)
this:
card {q. prime q \<and> q < nth_prime n} \<le> card {2..<nth_prime n}

goal (1 subgoal):
 1. Suc (Suc n) \<le> nth_prime n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {q. prime q \<and> q < nth_prime n} \<le> card {2..<nth_prime n}

goal (1 subgoal):
 1. Suc (Suc n) \<le> nth_prime n
[PROOF STEP]
have "\<dots> = nth_prime n - 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {2..<nth_prime n} = nth_prime n - 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {2..<nth_prime n} = nth_prime n - 2

goal (1 subgoal):
 1. Suc (Suc n) \<le> nth_prime n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
n \<le> nth_prime n - 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n \<le> nth_prime n - 2

goal (1 subgoal):
 1. Suc (Suc n) \<le> nth_prime n
[PROOF STEP]
using nth_prime_ge_2[of n]
[PROOF STATE]
proof (prove)
using this:
n \<le> nth_prime n - 2
2 \<le> nth_prime n

goal (1 subgoal):
 1. Suc (Suc n) \<le> nth_prime n
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
Suc (Suc n) \<le> nth_prime n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_of_Func_squared:
  fixes A :: "'a set"
  shows "|Func (UNIV :: bool set) A| =o |A \<times> A|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |Func UNIV A| =o |A \<times> A|
[PROOF STEP]
proof (rule ordIso_symmetric)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |A \<times> A| =o |Func UNIV A|
[PROOF STEP]
define f where "f = (\<lambda>(x::'a,y) b. if A = {} then undefined else if b then x else y)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>(x, y) b. if A = {} then undefined else if b then x else y)

goal (1 subgoal):
 1. |A \<times> A| =o |Func UNIV A|
[PROOF STEP]
have "Func (UNIV :: bool set) A \<subseteq> f ` (A \<times> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Func UNIV A \<subseteq> f ` (A \<times> A)
[PROOF STEP]
unfolding f_def Func_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f. (\<forall>a\<in>UNIV. f a \<in> A) \<and> (\<forall>a. a \<notin> UNIV \<longrightarrow> f a = undefined)} \<subseteq> (\<lambda>(x, y) b. if A = {} then undefined else if b then x else y) ` (A \<times> A)
[PROOF STEP]
by (auto simp: image_iff fun_eq_iff split: option.splits if_split_asm) blast
[PROOF STATE]
proof (state)
this:
Func UNIV A \<subseteq> f ` (A \<times> A)

goal (1 subgoal):
 1. |A \<times> A| =o |Func UNIV A|
[PROOF STEP]
hence "bij_betw f (A \<times> A) (Func (UNIV :: bool set) A)"
[PROOF STATE]
proof (prove)
using this:
Func UNIV A \<subseteq> f ` (A \<times> A)

goal (1 subgoal):
 1. bij_betw f (A \<times> A) (Func UNIV A)
[PROOF STEP]
unfolding bij_betw_def inj_on_def f_def Func_def
[PROOF STATE]
proof (prove)
using this:
{f. (\<forall>a\<in>UNIV. f a \<in> A) \<and> (\<forall>a. a \<notin> UNIV \<longrightarrow> f a = undefined)} \<subseteq> (\<lambda>(x, y) b. if A = {} then undefined else if b then x else y) ` (A \<times> A)

goal (1 subgoal):
 1. (\<forall>x\<in>A \<times> A. \<forall>y\<in>A \<times> A. (case x of (x, y) \<Rightarrow> \<lambda>b. if A = {} then undefined else if b then x else y) = (case y of (x, y) \<Rightarrow> \<lambda>b. if A = {} then undefined else if b then x else y) \<longrightarrow> x = y) \<and> (\<lambda>(x, y) b. if A = {} then undefined else if b then x else y) ` (A \<times> A) = {f. (\<forall>a\<in>UNIV. f a \<in> A) \<and> (\<forall>a. a \<notin> UNIV \<longrightarrow> f a = undefined)}
[PROOF STEP]
by (auto simp: fun_eq_iff)
[PROOF STATE]
proof (state)
this:
bij_betw f (A \<times> A) (Func UNIV A)

goal (1 subgoal):
 1. |A \<times> A| =o |Func UNIV A|
[PROOF STEP]
thus "|A \<times> A| =o |Func (UNIV :: bool set) A|"
[PROOF STATE]
proof (prove)
using this:
bij_betw f (A \<times> A) (Func UNIV A)

goal (1 subgoal):
 1. |A \<times> A| =o |Func UNIV A|
[PROOF STEP]
using card_of_ordIso
[PROOF STATE]
proof (prove)
using this:
bij_betw f (A \<times> A) (Func UNIV A)
(\<exists>f. bij_betw f ?A ?B) = (|?A| =o |?B|)

goal (1 subgoal):
 1. |A \<times> A| =o |Func UNIV A|
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
|A \<times> A| =o |Func UNIV A|

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bitwise_inner_prod_with_zero:
  assumes "m < 2^n"
  shows "(0 \<cdot>\<^bsub>n\<^esub>  m) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<cdot>\<^bsub>n\<^esub>  m = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<cdot>\<^bsub>n\<^esub>  m = 0
[PROOF STEP]
have "(0 \<cdot>\<^bsub>n\<^esub>  m) = (\<Sum>j\<in>{0..<n}. bin_rep n 0 ! j * bin_rep n m ! j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<cdot>\<^bsub>n\<^esub>  m = (\<Sum>j = 0..<n. bin_rep n 0 ! j * bin_rep n m ! j)
[PROOF STEP]
using bitwise_inner_prod_def
[PROOF STATE]
proof (prove)
using this:
?i \<cdot>\<^bsub>?n\<^esub>  ?j = (\<Sum>k = 0..<?n. bin_rep ?n ?i ! k * bin_rep ?n ?j ! k)

goal (1 subgoal):
 1. 0 \<cdot>\<^bsub>n\<^esub>  m = (\<Sum>j = 0..<n. bin_rep n 0 ! j * bin_rep n m ! j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<cdot>\<^bsub>n\<^esub>  m = (\<Sum>j = 0..<n. bin_rep n 0 ! j * bin_rep n m ! j)

goal (1 subgoal):
 1. 0 \<cdot>\<^bsub>n\<^esub>  m = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 \<cdot>\<^bsub>n\<^esub>  m = (\<Sum>j = 0..<n. bin_rep n 0 ! j * bin_rep n m ! j)

goal (1 subgoal):
 1. 0 \<cdot>\<^bsub>n\<^esub>  m = 0
[PROOF STEP]
have "(\<Sum>j\<in>{0..<n}. bin_rep n 0 ! j * bin_rep n m ! j)
               = (\<Sum>j\<in>{0..<n}. 0 * (bin_rep n m) ! j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<n. bin_rep n 0 ! j * bin_rep n m ! j) = (\<Sum>j = 0..<n. 0 * bin_rep n m ! j)
[PROOF STEP]
by (simp add: bin_rep_index)
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<n. bin_rep n 0 ! j * bin_rep n m ! j) = (\<Sum>j = 0..<n. 0 * bin_rep n m ! j)

goal (1 subgoal):
 1. 0 \<cdot>\<^bsub>n\<^esub>  m = 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 \<cdot>\<^bsub>n\<^esub>  m = (\<Sum>j = 0..<n. bin_rep n 0 ! j * bin_rep n m ! j)
(\<Sum>j = 0..<n. bin_rep n 0 ! j * bin_rep n m ! j) = (\<Sum>j = 0..<n. 0 * bin_rep n m ! j)
[PROOF STEP]
show "?thesis"
[PROOF STATE]
proof (prove)
using this:
0 \<cdot>\<^bsub>n\<^esub>  m = (\<Sum>j = 0..<n. bin_rep n 0 ! j * bin_rep n m ! j)
(\<Sum>j = 0..<n. bin_rep n 0 ! j * bin_rep n m ! j) = (\<Sum>j = 0..<n. 0 * bin_rep n m ! j)

goal (1 subgoal):
 1. 0 \<cdot>\<^bsub>n\<^esub>  m = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<cdot>\<^bsub>n\<^esub>  m = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in lower_semilattice) meet_assoc_lemma:
  assumes L: "x \<in> carrier L"  "y \<in> carrier L"  "z \<in> carrier L"
  shows "x \<sqinter> (y \<sqinter> z) = \<Sqinter>{x, y, z}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter> (y \<sqinter> z) = \<Sqinter>{x, y, z}
[PROOF STEP]
using weak_meet_assoc_lemma L
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier L; ?y \<in> carrier L; ?z \<in> carrier L\<rbrakk> \<Longrightarrow> ?x \<sqinter> (?y \<sqinter> ?z) .= \<Sqinter>{?x, ?y, ?z}
x \<in> carrier L
y \<in> carrier L
z \<in> carrier L

goal (1 subgoal):
 1. x \<sqinter> (y \<sqinter> z) = \<Sqinter>{x, y, z}
[PROOF STEP]
unfolding eq_is_equal
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier L; ?y \<in> carrier L; ?z \<in> carrier L\<rbrakk> \<Longrightarrow> ?x \<sqinter> (?y \<sqinter> ?z) = \<Sqinter>{?x, ?y, ?z}
x \<in> carrier L
y \<in> carrier L
z \<in> carrier L

goal (1 subgoal):
 1. x \<sqinter> (y \<sqinter> z) = \<Sqinter>{x, y, z}
[PROOF STEP]
.


[STATEMENT]
lemma ell2_norm_finite:
  "ell2_norm (x::'a::finite\<Rightarrow>complex) = sqrt (sum (\<lambda>i. (norm(x i))^2) UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ell2_norm x = sqrt (\<Sum>i\<in>UNIV. (cmod (x i))\<^sup>2)
[PROOF STEP]
by (simp add: ell2_norm_def)


[STATEMENT]
theorem ln_lower_5_eq: "0<x \<Longrightarrow>
    ln_lower_5 x = (1/3)*(10*x^2 + 19*x + 1)*(x - 1) / (x*(x^2 + 6*x + 3))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> ln_lower_5 x = 1 / 3 * (10 * x\<^sup>2 + 19 * x + 1) * (x - 1) / (x * (x\<^sup>2 + 6 * x + 3))
[PROOF STEP]
unfolding ln_lower_5_def ln_upper_5_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> - (((inverse x)\<^sup>2 + 19 * inverse x + 10) * (inverse x - 1) / (3 * (3 * (inverse x)\<^sup>2 + 6 * inverse x + 1))) = 1 / 3 * (10 * x\<^sup>2 + 19 * x + 1) * (x - 1) / (x * (x\<^sup>2 + 6 * x + 3))
[PROOF STEP]
by (simp add: zero_less_mult_iff add_pos_pos dual_order.strict_implies_not_eq divide_simps)
     algebra


[STATEMENT]
lemma totient_4 [simp]: "totient 4 = 2"
  and totient_8 [simp]: "totient 8 = 4"
  and totient_9 [simp]: "totient 9 = 6"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient 4 = 2 &&& totient 8 = 4 &&& totient 9 = 6
[PROOF STEP]
using totient_prime_power[of 2 2] totient_prime_power[of 2 3] totient_prime_power[of 3 2]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>prime 2; 0 < 2\<rbrakk> \<Longrightarrow> totient (2\<^sup>2) = 2 ^ (2 - 1) * (2 - 1)
\<lbrakk>prime 2; 0 < 3\<rbrakk> \<Longrightarrow> totient (2 ^ 3) = 2 ^ (3 - 1) * (2 - 1)
\<lbrakk>prime 3; 0 < 2\<rbrakk> \<Longrightarrow> totient (3\<^sup>2) = 3 ^ (2 - 1) * (3 - 1)

goal (1 subgoal):
 1. totient 4 = 2 &&& totient 8 = 4 &&& totient 9 = 6
[PROOF STEP]
by simp_all


[STATEMENT]
lemma smult_diff_right: "smult a (p - q) = smult a p - smult a q"
  for a :: "'a::comm_ring"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult a (p - q) = smult a p - smult a q
[PROOF STEP]
by (rule poly_eqI) (simp add: algebra_simps)


[STATEMENT]
lemma image_mset_mono_pos:
  "\<forall>b. 0 \<le> zcount A b \<Longrightarrow> \<forall>b. 0 \<le> zcount B b \<Longrightarrow> A \<subseteq>#\<^sub>z B \<Longrightarrow> image_zmset f A \<subseteq>#\<^sub>z image_zmset f B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>b. 0 \<le> zcount A b; \<forall>b. 0 \<le> zcount B b; A \<subseteq>#\<^sub>z B\<rbrakk> \<Longrightarrow> Auxiliary.image_zmset f A \<subseteq>#\<^sub>z Auxiliary.image_zmset f B
[PROOF STEP]
unfolding subseteq_zmset_def zcount_image_zmset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>b. 0 \<le> zcount A b; \<forall>b. 0 \<le> zcount B b; \<forall>a. zcount A a \<le> zcount B a\<rbrakk> \<Longrightarrow> \<forall>a. sum (zcount A) (f -` {a} \<inter> set_zmset A) \<le> sum (zcount B) (f -` {a} \<inter> set_zmset B)
[PROOF STEP]
apply (intro allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>\<forall>b. 0 \<le> zcount A b; \<forall>b. 0 \<le> zcount B b; \<forall>a. zcount A a \<le> zcount B a\<rbrakk> \<Longrightarrow> sum (zcount A) (f -` {a} \<inter> set_zmset A) \<le> sum (zcount B) (f -` {a} \<inter> set_zmset B)
[PROOF STEP]
apply (rule order_trans[OF sum_mono sum_mono2])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>a i. \<lbrakk>\<forall>b. 0 \<le> zcount A b; \<forall>b. 0 \<le> zcount B b; \<forall>a. zcount A a \<le> zcount B a; i \<in> f -` {a} \<inter> set_zmset A\<rbrakk> \<Longrightarrow> zcount A i \<le> zcount B i
 2. \<And>a. \<lbrakk>\<forall>b. 0 \<le> zcount A b; \<forall>b. 0 \<le> zcount B b; \<forall>a. zcount A a \<le> zcount B a\<rbrakk> \<Longrightarrow> finite (f -` {a} \<inter> set_zmset B)
 3. \<And>a. \<lbrakk>\<forall>b. 0 \<le> zcount A b; \<forall>b. 0 \<le> zcount B b; \<forall>a. zcount A a \<le> zcount B a\<rbrakk> \<Longrightarrow> f -` {a} \<inter> set_zmset A \<subseteq> f -` {a} \<inter> set_zmset B
 4. \<And>a b. \<lbrakk>\<forall>b. 0 \<le> zcount A b; \<forall>b. 0 \<le> zcount B b; \<forall>a. zcount A a \<le> zcount B a; b \<in> f -` {a} \<inter> set_zmset B - f -` {a} \<inter> set_zmset A\<rbrakk> \<Longrightarrow> 0 \<le> zcount B b
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>\<forall>b. 0 \<le> zcount A b; \<forall>b. 0 \<le> zcount B b; \<forall>a. zcount A a \<le> zcount B a\<rbrakk> \<Longrightarrow> f -` {a} \<inter> set_zmset A \<subseteq> set_zmset B
[PROOF STEP]
by (metis Int_subset_iff antisym subsetI zcount_ne_zero_iff)


[STATEMENT]
lemma equivalentFormulaeTransitivity:
  fixes formula1 :: Formula and formula2 :: Formula and formula3 :: Formula
  assumes "equivalentFormulae formula1 formula2" and "equivalentFormulae formula2 formula3"
  shows "equivalentFormulae formula1 formula3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. equivalentFormulae formula1 formula3
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
equivalentFormulae formula1 formula2
equivalentFormulae formula2 formula3

goal (1 subgoal):
 1. equivalentFormulae formula1 formula3
[PROOF STEP]
unfolding equivalentFormulae_def
[PROOF STATE]
proof (prove)
using this:
\<forall>valuation. model valuation formula1 = model valuation formula2
\<forall>valuation. model valuation formula2 = model valuation formula3

goal (1 subgoal):
 1. \<forall>valuation. model valuation formula1 = model valuation formula3
[PROOF STEP]
by auto


[STATEMENT]
lemma epi_compose:
   "\<lbrakk>f \<in> epi G H; g \<in> epi H K\<rbrakk> \<Longrightarrow> (g \<circ> f) \<in> epi G K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> epi G H; g \<in> epi H K\<rbrakk> \<Longrightarrow> g \<circ> f \<in> epi G K
[PROOF STEP]
using hom_compose
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f \<in> hom ?G ?H; ?g \<in> hom ?H ?I\<rbrakk> \<Longrightarrow> ?g \<circ> ?f \<in> hom ?G ?I

goal (1 subgoal):
 1. \<lbrakk>f \<in> epi G H; g \<in> epi H K\<rbrakk> \<Longrightarrow> g \<circ> f \<in> epi G K
[PROOF STEP]
by (force simp: epi_def hom_compose simp flip: image_image)


[STATEMENT]
lemma det_swaprows:
  assumes *: "k < n" "l < n" and k: "k \<noteq> l" and A: "A \<in> carrier_mat n n"
  shows "det (swaprows k l A) = - det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (swaprows k l A) = - det A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (swaprows k l A) = - det A
[PROOF STEP]
have "swaprows k l A = swaprows_mat n k l * A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swaprows k l A = swaprows_mat n k l * A
[PROOF STEP]
by (rule swaprows_mat[OF A *])
[PROOF STATE]
proof (state)
this:
swaprows k l A = swaprows_mat n k l * A

goal (1 subgoal):
 1. det (swaprows k l A) = - det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
swaprows k l A = swaprows_mat n k l * A

goal (1 subgoal):
 1. det (swaprows k l A) = - det A
[PROOF STEP]
have "det (swaprows_mat n k l * A) = det (swaprows_mat n k l) * det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (swaprows_mat n k l * A) = det (swaprows_mat n k l) * det A
[PROOF STEP]
by (rule det_mult[OF _ A], insert A, auto)
[PROOF STATE]
proof (state)
this:
det (swaprows_mat n k l * A) = det (swaprows_mat n k l) * det A

goal (1 subgoal):
 1. det (swaprows k l A) = - det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (swaprows_mat n k l * A) = det (swaprows_mat n k l) * det A

goal (1 subgoal):
 1. det (swaprows k l A) = - det A
[PROOF STEP]
have "det (swaprows_mat n k l) = - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (swaprows_mat n k l) = - (1::'b)
[PROOF STEP]
by (rule det_swaprows_mat[OF * k])
[PROOF STATE]
proof (state)
this:
det (swaprows_mat n k l) = - (1::?'b1)

goal (1 subgoal):
 1. det (swaprows k l A) = - det A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (swaprows k l A) = - (1::'a) * det A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
det (swaprows k l A) = - (1::'a) * det A

goal (1 subgoal):
 1. det (swaprows k l A) = - det A
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
det (swaprows k l A) = - (1::'a) * det A
A \<in> carrier_mat n n

goal (1 subgoal):
 1. det (swaprows k l A) = - det A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (swaprows k l A) = - det A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Read_Show_nat_id: \<open>Read\<^sub>n\<^sub>a\<^sub>t(Show\<^sub>n\<^sub>a\<^sub>t n) = n\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Read\<^sub>n\<^sub>a\<^sub>t (Show\<^sub>n\<^sub>a\<^sub>t n) = n
[PROOF STEP]
apply(unfold Read\<^sub>n\<^sub>a\<^sub>t_def Show\<^sub>n\<^sub>a\<^sub>t_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_implode (map nat_of_digit (map digit_of_nat (nat_explode n))) = n
[PROOF STEP]
using bar' nat_of_digit_digit_of_nat_id nat_explode_digits
[PROOF STATE]
proof (prove)
using this:
\<forall>d\<in>set ?l. d < 10 \<Longrightarrow> map nat_of_digit (map digit_of_nat ?l) = ?l
?x < 10 \<Longrightarrow> nat_of_digit (digit_of_nat ?x) = ?x
\<forall>d\<in>set (nat_explode ?n). d < 10

goal (1 subgoal):
 1. nat_implode (map nat_of_digit (map digit_of_nat (nat_explode n))) = n
[PROOF STEP]
using nat_implode_explode_id
[PROOF STATE]
proof (prove)
using this:
\<forall>d\<in>set ?l. d < 10 \<Longrightarrow> map nat_of_digit (map digit_of_nat ?l) = ?l
?x < 10 \<Longrightarrow> nat_of_digit (digit_of_nat ?x) = ?x
\<forall>d\<in>set (nat_explode ?n). d < 10
nat_implode (nat_explode ?n) = ?n

goal (1 subgoal):
 1. nat_implode (map nat_of_digit (map digit_of_nat (nat_explode n))) = n
[PROOF STEP]
by presburger


[STATEMENT]
lemma complex_roots_unity:
  assumes "1 \<le> n"
    shows "{z::complex. z^n = 1} = {exp(2 * of_real pi * \<i> * of_nat j / of_nat n) | j. j < n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {z. z ^ n = 1} = {exp (2 * complex_of_real pi * \<i> * of_nat j / of_nat n) |j. j < n}
[PROOF STEP]
apply (rule Finite_Set.card_seteq [symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite {z. z ^ n = 1}
 2. {exp (2 * complex_of_real pi * \<i> * of_nat j / of_nat n) |j. j < n} \<subseteq> {z. z ^ n = 1}
 3. card {z. z ^ n = 1} \<le> card {exp (2 * complex_of_real pi * \<i> * of_nat j / of_nat n) |j. j < n}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> n

goal (3 subgoals):
 1. finite {z. z ^ n = 1}
 2. {exp (2 * complex_of_real pi * \<i> * of_nat j / of_nat n) |j. j < n} \<subseteq> {z. z ^ n = 1}
 3. card {z. z ^ n = 1} \<le> card {exp (2 * complex_of_real pi * \<i> * of_nat j / of_nat n) |j. j < n}
[PROOF STEP]
apply (auto simp: card_complex_roots_unity_explicit finite_roots_unity complex_root_unity card_roots_unity)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma distinct_seteq_set_Cons':
  "\<lbrakk>Finite_Set.card xs = Suc n; x \<in> {ys. set ys = xs \<and> distinct ys}\<rbrakk>
    \<Longrightarrow> \<exists>y ys zs. y # ys = x \<and> Finite_Set.card zs = n \<and> distinct ys \<and> set ys = zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Finite_Set.card xs = Suc n; x \<in> {ys. set ys = xs \<and> distinct ys}\<rbrakk> \<Longrightarrow> \<exists>y ys zs. y # ys = x \<and> Finite_Set.card zs = n \<and> distinct ys \<and> set ys = zs
[PROOF STEP]
using distinct_seteq_set_length_eq[of x] Suc_length_conv[of n x]
[PROOF STATE]
proof (prove)
using this:
x \<in> {ys. set ys = ?xs \<and> distinct ys} \<Longrightarrow> length x = Finite_Set.card ?xs
(Suc n = length x) = (\<exists>y ys. x = y # ys \<and> length ys = n)

goal (1 subgoal):
 1. \<lbrakk>Finite_Set.card xs = Suc n; x \<in> {ys. set ys = xs \<and> distinct ys}\<rbrakk> \<Longrightarrow> \<exists>y ys zs. y # ys = x \<and> Finite_Set.card zs = n \<and> distinct ys \<and> set ys = zs
[PROOF STEP]
by force


[STATEMENT]
lemma upper_triangular_invertible:
  fixes A :: "real^'n::{finite,wellorder}^'n::{finite,wellorder}"
  assumes u: "upper_triangular A"
  and d: "\<forall>i. A $ i $ i \<noteq> 0"
  shows "invertible A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. invertible A
[PROOF STEP]
have det_R: "det A = (prod (\<lambda>i. A$i$i) (UNIV::'n set))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
using det_upperdiagonal u
[PROOF STATE]
proof (prove)
using this:
(\<And>i j. j < i \<Longrightarrow> ?A $ i $ j = (0::?'a)) \<Longrightarrow> det ?A = (\<Prod>i\<in>UNIV. ?A $ i $ i)
upper_triangular A

goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
unfolding upper_triangular_def
[PROOF STATE]
proof (prove)
using this:
(\<And>i j. j < i \<Longrightarrow> ?A $ i $ j = (0::?'a)) \<Longrightarrow> det ?A = (\<Prod>i\<in>UNIV. ?A $ i $ i)
\<forall>i j. j < i \<longrightarrow> A $ i $ j = 0

goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
det A = (\<Prod>i\<in>UNIV. A $ i $ i)

goal (1 subgoal):
 1. invertible A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det A = (\<Prod>i\<in>UNIV. A $ i $ i)

goal (1 subgoal):
 1. invertible A
[PROOF STEP]
have "... \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i\<in>UNIV. A $ i $ i) \<noteq> 0
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
\<forall>i. A $ i $ i \<noteq> 0

goal (1 subgoal):
 1. (\<Prod>i\<in>UNIV. A $ i $ i) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<in>UNIV. A $ i $ i) \<noteq> 0

goal (1 subgoal):
 1. invertible A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det A \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
det A \<noteq> 0

goal (1 subgoal):
 1. invertible A
[PROOF STEP]
by (metis invertible_det_nz)
[PROOF STATE]
proof (state)
this:
invertible A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma periodic_arithmetic_homothecy:
  assumes "periodic_arithmetic f k"
  shows   "periodic_arithmetic (\<lambda>l. f (l*a)) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. periodic_arithmetic (\<lambda>l. f (l * a)) k
[PROOF STEP]
unfolding periodic_arithmetic_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. f ((n + k) * a) = f (n * a)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. f ((n + k) * a) = f (n * a)
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. f ((n + k) * a) = f (n * a)
[PROOF STEP]
have "f ((n + k) * a) = f(n*a+k*a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ((n + k) * a) = f (n * a + k * a)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
f ((n + k) * a) = f (n * a + k * a)

goal (1 subgoal):
 1. \<And>n. f ((n + k) * a) = f (n * a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f ((n + k) * a) = f (n * a + k * a)

goal (1 subgoal):
 1. \<And>n. f ((n + k) * a) = f (n * a)
[PROOF STEP]
have "\<dots> = f(n*a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (n * a + k * a) = f (n * a)
[PROOF STEP]
using mult_period[OF assms]
[PROOF STATE]
proof (prove)
using this:
periodic_arithmetic f (k * ?q)

goal (1 subgoal):
 1. f (n * a + k * a) = f (n * a)
[PROOF STEP]
unfolding periodic_arithmetic_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n. f (n + k * ?q) = f n

goal (1 subgoal):
 1. f (n * a + k * a) = f (n * a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f (n * a + k * a) = f (n * a)

goal (1 subgoal):
 1. \<And>n. f ((n + k) * a) = f (n * a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f ((n + k) * a) = f (n * a)
[PROOF STEP]
show "f ((n + k) * a) = f (n * a)"
[PROOF STATE]
proof (prove)
using this:
f ((n + k) * a) = f (n * a)

goal (1 subgoal):
 1. f ((n + k) * a) = f (n * a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f ((n + k) * a) = f (n * a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma proots_sphere_pos_interval:
  fixes a b::real
  defines "q1\<equiv>[:a,b:]" and "q2\<equiv>[:1,1:]"
  assumes "p\<noteq>0" "a<b"
  shows "proots_count p {x. a < x \<and> x < b} = proots_count (fcompose p q1 q2) {x. 0 < x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count p {x. a < x \<and> x < b} = proots_count (fcompose p q1 q2) {x. 0 < x}
[PROOF STEP]
apply (rule proots_fcompose_bij_eq[OF _ \<open>p\<noteq>0\<close>])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. bij_betw (\<lambda>x. poly q1 x / poly q2 x) {x. 0 < x} {x. a < x \<and> x < b}
 2. \<forall>x\<in>{x. 0 < x}. poly q2 x \<noteq> 0
 3. max (degree q1) (degree q2) \<le> 1
 4. \<forall>c. q1 \<noteq> smult c q2
 5. infinite UNIV
[PROOF STEP]
unfolding q1_def q2_def
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. bij_betw (\<lambda>x. poly [:a, b:] x / poly [:1, 1:] x) {x. 0 < x} {x. a < x \<and> x < b}
 2. \<forall>x\<in>{x. 0 < x}. poly [:1, 1:] x \<noteq> 0
 3. max (degree [:a, b:]) (degree [:1, 1:]) \<le> 1
 4. \<forall>c. [:a, b:] \<noteq> smult c [:1, 1:]
 5. infinite UNIV
[PROOF STEP]
using bij_betw_pos_interval[OF \<open>a<b\<close>] \<open>a<b\<close>
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>x. (a + b * x) / (1 + x)) {x. 0 < x} {x. a < x \<and> x < b}
a < b

goal (5 subgoals):
 1. bij_betw (\<lambda>x. poly [:a, b:] x / poly [:1, 1:] x) {x. 0 < x} {x. a < x \<and> x < b}
 2. \<forall>x\<in>{x. 0 < x}. poly [:1, 1:] x \<noteq> 0
 3. max (degree [:a, b:]) (degree [:1, 1:]) \<le> 1
 4. \<forall>c. [:a, b:] \<noteq> smult c [:1, 1:]
 5. infinite UNIV
[PROOF STEP]
by (auto simp add:algebra_simps infinite_UNIV_char_0)


[STATEMENT]
lemma ceiling_log_nat_eq_if: fixes b n k :: nat
  assumes "b^n < k" "k \<le> b^(n+1)" "b \<ge> 2"
  shows "ceiling (log b (real k)) = int n + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>log (real b) (real k)\<rceil> = int n + 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lceil>log (real b) (real k)\<rceil> = int n + 1
[PROOF STEP]
have "k \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> k
[PROOF STEP]
using assms(1,3) one_le_power[of b n]
[PROOF STATE]
proof (prove)
using this:
b ^ n < k
2 \<le> b
1 \<le> b \<Longrightarrow> 1 \<le> b ^ n

goal (1 subgoal):
 1. 1 \<le> k
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
1 \<le> k

goal (1 subgoal):
 1. \<lceil>log (real b) (real k)\<rceil> = int n + 1
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
b ^ n < k
k \<le> b ^ (n + 1)
2 \<le> b
1 \<le> k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b ^ n < k
k \<le> b ^ (n + 1)
2 \<le> b
1 \<le> k

goal (1 subgoal):
 1. \<lceil>log (real b) (real k)\<rceil> = int n + 1
[PROOF STEP]
by(simp add: ceiling_log_nat_eq_powr_iff)
[PROOF STATE]
proof (state)
this:
\<lceil>log (real b) (real k)\<rceil> = int n + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma INF_of_enat_nat_conv2:
  assumes "finite A"
  shows "enat d = (INF x \<in> A. enat (f x)) \<longleftrightarrow> (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (enat d = (INF x\<in>A. enat (f x))) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))
[PROOF STEP]
using INF_of_enat_nat_conv1[OF assms]
[PROOF STATE]
proof (prove)
using this:
((INF x\<in>A. enat (?f x)) = enat ?d) = (\<exists>x\<in>A. ?d = ?f x \<and> (\<forall>y\<in>A. ?f x \<le> ?f y))

goal (1 subgoal):
 1. (enat d = (INF x\<in>A. enat (f x))) = (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))
[PROOF STEP]
by metis


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


[STATEMENT]
lemma INF_eq_zero_iff_ennreal: "((\<Sqinter>i\<in>A. f i) = (0::ennreal)) = (\<forall>x>0. \<exists>i\<in>A. f i < x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sqinter> (f ` A) = 0) = (\<forall>x>0. \<exists>i\<in>A. f i < x)
[PROOF STEP]
using INF_eq_bot_iff[where 'a=ennreal]
[PROOF STATE]
proof (prove)
using this:
(\<Sqinter> (?f ` ?A) = \<bottom>) = (\<forall>x>\<bottom>. \<exists>i\<in>?A. ?f i < x)

goal (1 subgoal):
 1. (\<Sqinter> (f ` A) = 0) = (\<forall>x>0. \<exists>i\<in>A. f i < x)
[PROOF STEP]
unfolding bot_ennreal_def zero_ennreal_def
[PROOF STATE]
proof (prove)
using this:
(\<Sqinter> (?f ` ?A) = e2ennreal 0) = (\<forall>x>e2ennreal 0. \<exists>i\<in>?A. ?f i < x)

goal (1 subgoal):
 1. (\<Sqinter> (f ` A) = e2ennreal 0) = (\<forall>x>e2ennreal 0. \<exists>i\<in>A. f i < x)
[PROOF STEP]
by auto


[STATEMENT]
lemma cosh_complex:
  fixes z :: complex
  shows "(exp z + inverse (exp z)) / 2 = cos(\<i> * z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (exp z + inverse (exp z)) / 2 = cos (\<i> * z)
[PROOF STEP]
by (simp add: cos_exp_eq field_split_simps exp_minus exp_of_real)


[STATEMENT]
lemma ind_in_set_less:
  fixes x :: nat and A :: "nat set"
  assumes "finite A" "x \<in> A"
  shows "ind_in_set A x < card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ind_in_set A x < card A
[PROOF STEP]
unfolding ind_in_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i \<in> A. i < x} < card A
[PROOF STEP]
apply (rule psubset_card_mono)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite A
 2. {i \<in> A. i < x} \<subset> A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
x \<in> A

goal (2 subgoals):
 1. finite A
 2. {i \<in> A. i < x} \<subset> A
[PROOF STEP]
by auto


[STATEMENT]
lemma fds_totient_times_zeta:
  "fds (\<lambda>n. of_nat (totient n) :: 'a :: comm_semiring_1) * fds_zeta = fds of_nat"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds (\<lambda>n. of_nat (totient n)) * fds_zeta = fds of_nat
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> fds_nth (fds (\<lambda>n. of_nat (totient n)) * fds_zeta) n = fds_nth (fds of_nat) n
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> fds_nth (fds (\<lambda>n. of_nat (totient n)) * fds_zeta) n = fds_nth (fds of_nat) n
[PROOF STEP]
assume n: "n > 0"
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> fds_nth (fds (\<lambda>n. of_nat (totient n)) * fds_zeta) n = fds_nth (fds of_nat) n
[PROOF STEP]
have "fds_nth (fds (\<lambda>n. of_nat (totient n)) * fds_zeta) n =
          dirichlet_prod (\<lambda>n. of_nat (totient n)) (\<lambda>_. 1) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_nth (fds (\<lambda>n. of_nat (totient n)) * fds_zeta) n = dirichlet_prod (\<lambda>n. of_nat (totient n)) (\<lambda>_. 1::'b) n
[PROOF STEP]
by (simp add: fds_nth_mult)
[PROOF STATE]
proof (state)
this:
fds_nth (fds (\<lambda>n. of_nat (totient n)) * fds_zeta) n = dirichlet_prod (\<lambda>n. of_nat (totient n)) (\<lambda>_. 1::?'b1) n

goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> fds_nth (fds (\<lambda>n. of_nat (totient n)) * fds_zeta) n = fds_nth (fds of_nat) n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fds_nth (fds (\<lambda>n. of_nat (totient n)) * fds_zeta) n = dirichlet_prod (\<lambda>n. of_nat (totient n)) (\<lambda>_. 1::?'b1) n

goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> fds_nth (fds (\<lambda>n. of_nat (totient n)) * fds_zeta) n = fds_nth (fds of_nat) n
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "\<dots> = fds_nth (fds of_nat) n"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. dirichlet_prod (\<lambda>n. of_nat (totient n)) (\<lambda>_. 1::'b) n = fds_nth (fds of_nat) n
[PROOF STEP]
by (simp add: fds_nth_fds dirichlet_prod_def totient_divisor_sum of_nat_sum [symmetric]
             del: of_nat_sum)
[PROOF STATE]
proof (state)
this:
dirichlet_prod (\<lambda>n. of_nat (totient n)) (\<lambda>_. 1::?'b2) n = fds_nth (fds of_nat) n

goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> fds_nth (fds (\<lambda>n. of_nat (totient n)) * fds_zeta) n = fds_nth (fds of_nat) n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fds_nth (fds (\<lambda>n. of_nat (totient n)) * fds_zeta) n = fds_nth (fds of_nat) n
[PROOF STEP]
show "fds_nth (fds (\<lambda>n. of_nat (totient n)) * fds_zeta) n = fds_nth (fds of_nat) n"
[PROOF STATE]
proof (prove)
using this:
fds_nth (fds (\<lambda>n. of_nat (totient n)) * fds_zeta) n = fds_nth (fds of_nat) n

goal (1 subgoal):
 1. fds_nth (fds (\<lambda>n. of_nat (totient n)) * fds_zeta) n = fds_nth (fds of_nat) n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fds_nth (fds (\<lambda>n. of_nat (totient n)) * fds_zeta) n = fds_nth (fds of_nat) n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_zero_norm_cos_one:
  fixes x :: "'a::{real_normed_field,banach}"
  assumes "sin x = 0"
  shows "norm (cos x) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (cos x) = 1
[PROOF STEP]
using sin_cos_squared_add [of x, unfolded assms]
[PROOF STATE]
proof (prove)
using this:
(0::'a)\<^sup>2 + (cos x)\<^sup>2 = (1::'a)

goal (1 subgoal):
 1. norm (cos x) = 1
[PROOF STEP]
by (simp add: square_norm_one)


[STATEMENT]
lemma adjuster_in_span:
  assumes w: "(w :: 'a vec) : carrier_vec n"
    and us: "set (us :: 'a vec list) \<subseteq> carrier_vec n"
    and dist: "distinct us"
  shows "adjuster n w us : span (set us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjuster n w us \<in> local.span (set us)
[PROOF STEP]
using adjuster_lincomb[OF assms]
[PROOF STATE]
proof (prove)
using this:
adjuster n w us = lincomb (\<lambda>u. - (w \<bullet>c u) / (u \<bullet>c u)) (set us)

goal (1 subgoal):
 1. adjuster n w us \<in> local.span (set us)
[PROOF STEP]
unfolding finite_span[OF finite_set us]
[PROOF STATE]
proof (prove)
using this:
adjuster n w us = lincomb (\<lambda>u. - (w \<bullet>c u) / (u \<bullet>c u)) (set us)

goal (1 subgoal):
 1. adjuster n w us \<in> {uu_. \<exists>a. uu_ = lincomb a (set us)}
[PROOF STEP]
by auto


[STATEMENT]
lemma ladder_stepdown_length:
  assumes "length L > 1"
  shows "length (ladder_stepdown L) = length L - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (ladder_stepdown L) = length L - 1
[PROOF STEP]
apply (subst ladder_stepdown_prepare[OF assms(1)])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (ladder_stepdown ((ladder_n L 0, ladder_j L 0, ladder_i L 0) # (ladder_n L 1, ladder_j L 1, ladder_ix L 1) # drop 2 L)) = length L - 1
[PROOF STEP]
apply (simp add: ladder_shift_n_length)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (length L - 2) = length L - Suc 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < length L

goal (1 subgoal):
 1. Suc (length L - 2) = length L - Suc 0
[PROOF STEP]
apply arith
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Im_Arccos_of_real:
  assumes "\<bar>x\<bar> \<le> 1"
    shows "Im (Arccos (of_real x)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (Arccos (complex_of_real x)) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Im (Arccos (complex_of_real x)) = 0
[PROOF STEP]
have "csqrt (1 - (of_real x)\<^sup>2) = (if x^2 \<le> 1 then sqrt (1 - x^2) else \<i> * sqrt (x^2 - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. csqrt (1 - (complex_of_real x)\<^sup>2) = (if x\<^sup>2 \<le> 1 then complex_of_real (sqrt (1 - x\<^sup>2)) else \<i> * complex_of_real (sqrt (x\<^sup>2 - 1)))
[PROOF STEP]
by (simp add: of_real_sqrt del: csqrt_of_real_nonneg)
[PROOF STATE]
proof (state)
this:
csqrt (1 - (complex_of_real x)\<^sup>2) = (if x\<^sup>2 \<le> 1 then complex_of_real (sqrt (1 - x\<^sup>2)) else \<i> * complex_of_real (sqrt (x\<^sup>2 - 1)))

goal (1 subgoal):
 1. Im (Arccos (complex_of_real x)) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
csqrt (1 - (complex_of_real x)\<^sup>2) = (if x\<^sup>2 \<le> 1 then complex_of_real (sqrt (1 - x\<^sup>2)) else \<i> * complex_of_real (sqrt (x\<^sup>2 - 1)))
[PROOF STEP]
have "cmod (of_real x + \<i> * csqrt (1 - (of_real x)\<^sup>2))^2 = 1"
[PROOF STATE]
proof (prove)
using this:
csqrt (1 - (complex_of_real x)\<^sup>2) = (if x\<^sup>2 \<le> 1 then complex_of_real (sqrt (1 - x\<^sup>2)) else \<i> * complex_of_real (sqrt (x\<^sup>2 - 1)))

goal (1 subgoal):
 1. (cmod (complex_of_real x + \<i> * csqrt (1 - (complex_of_real x)\<^sup>2)))\<^sup>2 = 1
[PROOF STEP]
using assms abs_square_le_1
[PROOF STATE]
proof (prove)
using this:
csqrt (1 - (complex_of_real x)\<^sup>2) = (if x\<^sup>2 \<le> 1 then complex_of_real (sqrt (1 - x\<^sup>2)) else \<i> * complex_of_real (sqrt (x\<^sup>2 - 1)))
\<bar>x\<bar> \<le> 1
(?x\<^sup>2 \<le> (1::?'a)) = (\<bar>?x\<bar> \<le> (1::?'a))

goal (1 subgoal):
 1. (cmod (complex_of_real x + \<i> * csqrt (1 - (complex_of_real x)\<^sup>2)))\<^sup>2 = 1
[PROOF STEP]
by (force simp add: Complex.cmod_power2)
[PROOF STATE]
proof (state)
this:
(cmod (complex_of_real x + \<i> * csqrt (1 - (complex_of_real x)\<^sup>2)))\<^sup>2 = 1

goal (1 subgoal):
 1. Im (Arccos (complex_of_real x)) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(cmod (complex_of_real x + \<i> * csqrt (1 - (complex_of_real x)\<^sup>2)))\<^sup>2 = 1
[PROOF STEP]
have "cmod (of_real x + \<i> * csqrt (1 - (of_real x)\<^sup>2)) = 1"
[PROOF STATE]
proof (prove)
using this:
(cmod (complex_of_real x + \<i> * csqrt (1 - (complex_of_real x)\<^sup>2)))\<^sup>2 = 1

goal (1 subgoal):
 1. cmod (complex_of_real x + \<i> * csqrt (1 - (complex_of_real x)\<^sup>2)) = 1
[PROOF STEP]
by (simp add: norm_complex_def)
[PROOF STATE]
proof (state)
this:
cmod (complex_of_real x + \<i> * csqrt (1 - (complex_of_real x)\<^sup>2)) = 1

goal (1 subgoal):
 1. Im (Arccos (complex_of_real x)) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cmod (complex_of_real x + \<i> * csqrt (1 - (complex_of_real x)\<^sup>2)) = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cmod (complex_of_real x + \<i> * csqrt (1 - (complex_of_real x)\<^sup>2)) = 1

goal (1 subgoal):
 1. Im (Arccos (complex_of_real x)) = 0
[PROOF STEP]
by (simp add: Im_Arccos exp_minus)
[PROOF STATE]
proof (state)
this:
Im (Arccos (complex_of_real x)) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_vect_scaleR: "(A :: 'a :: real_normed_algebra_1 ^ 'n ^ 'k) *v (a *\<^sub>R v) = a *\<^sub>R (A *v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v a *\<^sub>R v = a *\<^sub>R (A *v v)
[PROOF STEP]
unfolding vec_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. (A *v a *\<^sub>R v) $h i = (a *\<^sub>R (A *v v)) $h i
[PROOF STEP]
by (auto simp: matrix_vector_mult_def scaleR_vec_def scaleR_sum_right
  intro!: sum.cong)


[STATEMENT]
lemma card_less_if_surj_not_inj:
  "\<lbrakk> finite A; f ` A = B; \<not> inj_on f A \<rbrakk> \<Longrightarrow> card B < card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; f ` A = B; \<not> inj_on f A\<rbrakk> \<Longrightarrow> card B < card A
[PROOF STEP]
by (metis card_image_le inj_on_iff_eq_card order_le_neq_trans)


[STATEMENT]
lemma is_norm_1[simp]: "is_norm_1 x = (norm x = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_norm_1 x = (cmod x = 1)
[PROOF STEP]
unfolding is_norm_1_def norm_complex_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((Re x)\<^sup>2 + (Im x)\<^sup>2 = 1) = (sqrt ((Re x)\<^sup>2 + (Im x)\<^sup>2) = 1)
[PROOF STEP]
by simp