[STATEMENT]
lemma var_sum_all_indep:
  fixes f :: "'b \<Rightarrow> 'a \<Rightarrow> real"
  assumes "finite I"
  assumes "\<And>i. i \<in> I \<Longrightarrow> f i \<in> borel_measurable M"
  assumes "\<And>i. i \<in> I \<Longrightarrow> integrable M (\<lambda>\<omega>. f i \<omega>^2)"
  assumes "indep_vars (\<lambda> _. borel) f I"
  shows "variance (\<lambda>\<omega>. (\<Sum>i \<in> I. f i \<omega>)) = (\<Sum>i \<in> I. variance (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation (\<lambda>x. ((\<Sum>i\<in>I. f i x) - expectation (\<lambda>\<omega>. \<Sum>i\<in>I. f i \<omega>))\<^sup>2) = (\<Sum>i\<in>I. expectation (\<lambda>x. (f i x - expectation (f i))\<^sup>2))
[PROOF STEP]
by (intro var_sum_pairwise_indep_2[OF assms(1,2,3)] indep_vars_subset[OF assms(4)],  auto)


[STATEMENT]
lemma LCL200_1:
 "(\<forall>A. axiom(or(not(or(A,A)),A))) &
  (\<forall>B A. axiom(or(not(A),or(B,A)))) &
  (\<forall>B A. axiom(or(not(or(A,B)),or(B,A)))) &
  (\<forall>B A C. axiom(or(not(or(A,or(B,C))),or(B,or(A,C))))) &
  (\<forall>A C B. axiom(or(not(or(not(A),B)),or(not(or(C,A)),or(C,B))))) &
  (\<forall>X. axiom(X) --> theorem(X)) &
  (\<forall>X Y. axiom(or(not(Y),X)) & theorem(Y) --> theorem(X)) &
  (\<forall>X Y Z. axiom(or(not(X),Y)) & theorem(or(not(Y),Z)) --> theorem(or(not(X),Z))) &
  (~theorem(or(not(not(or(p,q))),not(q)))) --> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>A. axiom (or (not (or (A, A)), A))) \<and> (\<forall>B A. axiom (or (not A, or (B, A)))) \<and> (\<forall>B A. axiom (or (not (or (A, B)), or (B, A)))) \<and> (\<forall>B A C. axiom (or (not (or (A, or (B, C))), or (B, or (A, C))))) \<and> (\<forall>A C B. axiom (or (not (or (not A, B)), or (not (or (C, A)), or (C, B))))) \<and> (\<forall>X. axiom X \<longrightarrow> theorem X) \<and> (\<forall>X Y. axiom (or (not Y, X)) \<and> theorem Y \<longrightarrow> theorem X) \<and> (\<forall>X Y Z. axiom (or (not X, Y)) \<and> theorem (or (not Y, Z)) \<longrightarrow> theorem (or (not X, Z))) \<and> \<not> theorem (or (not (not (or (p, q))), not q)) \<longrightarrow> False
[PROOF STEP]
by meson


[STATEMENT]
lemma "encode (Odd_Succ (Even_Succ (Odd_Succ Even_Zero)))
  = [True, False, True, True, False, False]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. encode (Odd_Succ (Even_Succ (Odd_Succ Even_Zero))) = [True, False, True, True, False, False]
[PROOF STEP]
by eval


[STATEMENT]
lemma nonzero_divide_divide_eq:
  "a \<in> carrier R \<Longrightarrow> b \<in> carrier R \<Longrightarrow> c \<in> carrier R \<Longrightarrow> d \<in> carrier R \<Longrightarrow>
    b \<noteq> \<zero> \<Longrightarrow> c \<noteq> \<zero> \<Longrightarrow> d \<noteq> \<zero> \<Longrightarrow> (a \<oslash> b) \<oslash> (c \<oslash> d) = (a \<otimes> d) \<oslash> (b \<otimes> c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; b \<in> carrier R; c \<in> carrier R; d \<in> carrier R; b \<noteq> \<zero>; c \<noteq> \<zero>; d \<noteq> \<zero>\<rbrakk> \<Longrightarrow> a \<oslash> b \<oslash> (c \<oslash> d) = a \<otimes> d \<oslash> (b \<otimes> c)
[PROOF STEP]
by (simp add: m_div_def nonzero_inverse_mult_distrib
    nonzero_imp_inverse_nonzero nonzero_inverse_inverse_eq m_ac integral_iff)


[STATEMENT]
theorem knapsack_correct:
  "OPT n W = knapsack n W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.OPT n W = local.knapsack n W
[PROOF STEP]
by (induction n arbitrary: W; auto simp: OPT_0 OPT_Suc)


[STATEMENT]
lemma tan_arctan: "tan (arctan y) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tan (arctan y) = y
[PROOF STEP]
by (simp add: arctan)


[STATEMENT]
lemma ltake_ldrop: "ltake n (ldrop m xs) = ldrop m (ltake (n + m) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ltake n (ldrop m xs) = ldrop m (ltake (n + m) xs)
[PROOF STEP]
by(induct xs arbitrary: n m)(simp_all add: ldrop_LCons iadd_Suc_right split: co.enat.split)


[STATEMENT]
lemma genPrefix_Cons:
     "((xs, y#ys) \<in> genPrefix r) =
      (xs=[] | (\<exists>z zs. xs=z#zs & (z,y) \<in> r & (zs,ys) \<in> genPrefix r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((xs, y # ys) \<in> genPrefix r) = (xs = [] \<or> (\<exists>z zs. xs = z # zs \<and> (z, y) \<in> r \<and> (zs, ys) \<in> genPrefix r))
[PROOF STEP]
by (cases xs) auto


[STATEMENT]
lemma (in prob_space) indep_sets_cong:
  "I = J \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> F i = G i) \<Longrightarrow> indep_sets F I \<longleftrightarrow> indep_sets G J"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I = J; \<And>i. i \<in> I \<Longrightarrow> F i = G i\<rbrakk> \<Longrightarrow> indep_sets F I = indep_sets G J
[PROOF STEP]
by (simp add: indep_sets_def, intro conj_cong all_cong imp_cong ball_cong) blast+


[STATEMENT]
lemma irreducible\<^sub>d_def_0:
  fixes f :: "'a :: {comm_semiring_1,semiring_no_zero_divisors} poly"
  shows "irreducible\<^sub>d f = (degree f \<noteq> 0 \<and>
  (\<forall> g h. degree g \<noteq> 0 \<longrightarrow> degree h \<noteq> 0 \<longrightarrow> f \<noteq> g * h))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irreducible\<^sub>d f = (degree f \<noteq> 0 \<and> (\<forall>g h. degree g \<noteq> 0 \<longrightarrow> degree h \<noteq> 0 \<longrightarrow> f \<noteq> g * h))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. irreducible\<^sub>d f = (degree f \<noteq> 0 \<and> (\<forall>g h. degree g \<noteq> 0 \<longrightarrow> degree h \<noteq> 0 \<longrightarrow> f \<noteq> g * h))
[PROOF STEP]
have "degree g \<noteq> 0 \<Longrightarrow> g \<noteq> 0" for g :: "'a poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree g \<noteq> 0 \<Longrightarrow> g \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree ?g \<noteq> 0 \<Longrightarrow> ?g \<noteq> 0

goal (1 subgoal):
 1. irreducible\<^sub>d f = (degree f \<noteq> 0 \<and> (\<forall>g h. degree g \<noteq> 0 \<longrightarrow> degree h \<noteq> 0 \<longrightarrow> f \<noteq> g * h))
[PROOF STEP]
note 1 = degree_mult_eq[OF this this, simplified]
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < degree ?p; 0 < degree ?q\<rbrakk> \<Longrightarrow> degree (?p * ?q) = degree ?p + degree ?q

goal (1 subgoal):
 1. irreducible\<^sub>d f = (degree f \<noteq> 0 \<and> (\<forall>g h. degree g \<noteq> 0 \<longrightarrow> degree h \<noteq> 0 \<longrightarrow> f \<noteq> g * h))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < degree ?p; 0 < degree ?q\<rbrakk> \<Longrightarrow> degree (?p * ?q) = degree ?p + degree ?q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < degree ?p; 0 < degree ?q\<rbrakk> \<Longrightarrow> degree (?p * ?q) = degree ?p + degree ?q

goal (1 subgoal):
 1. irreducible\<^sub>d f = (degree f \<noteq> 0 \<and> (\<forall>g h. degree g \<noteq> 0 \<longrightarrow> degree h \<noteq> 0 \<longrightarrow> f \<noteq> g * h))
[PROOF STEP]
by (force elim!: irreducible\<^sub>dE)
[PROOF STATE]
proof (state)
this:
irreducible\<^sub>d f = (degree f \<noteq> 0 \<and> (\<forall>g h. degree g \<noteq> 0 \<longrightarrow> degree h \<noteq> 0 \<longrightarrow> f \<noteq> g * h))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma canonical_separator_product_transitions_subset :
  assumes "q1 \<in> states M" and "q2 \<in> states M"
  shows "image shift_Inl (transitions (product (from_FSM M q1) (from_FSM M q2))) \<subseteq> (transitions (canonical_separator M q1 q2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. shift_Inl ` FSM.transitions (Product_FSM.product (from_FSM M q1) (from_FSM M q2)) \<subseteq> FSM.transitions (canonical_separator M q1 q2)
[PROOF STEP]
unfolding canonical_separator_simps[OF assms] shifted_transitions_def restrict_to_reachable_states_simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. shift_Inl ` FSM.transitions (Product_FSM.product (from_FSM M q1) (from_FSM M q2)) \<subseteq> shift_Inl ` FSM.transitions (Product_FSM.product (from_FSM M q1) (from_FSM M q2)) \<union> distinguishing_transitions (h_out M) q1 q2 (FSM.states (Product_FSM.product (from_FSM M q1) (from_FSM M q2))) (FSM.inputs (Product_FSM.product (from_FSM M q1) (from_FSM M q2)))
[PROOF STEP]
by blast


[STATEMENT]
lemma complex_Im_fact [simp]: "Im (fact n) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (fact n) = 0
[PROOF STEP]
by (subst of_nat_fact [symmetric]) (simp only: complex_Im_of_nat)


[STATEMENT]
lemma differentiable_on_inverse [simp, derivative_intros]:
  fixes f :: "'a :: real_normed_vector \<Rightarrow> 'b :: real_normed_field"
  shows "f differentiable_on S \<Longrightarrow> (\<And>x. x \<in> S \<Longrightarrow> f x \<noteq> 0) \<Longrightarrow> (\<lambda>x. inverse (f x)) differentiable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f differentiable_on S; \<And>x. x \<in> S \<Longrightarrow> f x \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> (\<lambda>x. inverse (f x)) differentiable_on S
[PROOF STEP]
by (simp add: differentiable_on_def)


[STATEMENT]
lemma Ball_atLeast0AtMost_doubleton:
  assumes "psi 0 \<le> 3 / 2 * ln 2 * real 0"
  assumes "psi 1 \<le> 3 / 2 * ln 2 * real 1"
  shows   "(\<forall>x\<in>{0..1}. psi x \<le> 3 / 2 * ln 2 * real x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{0..1}. psi x \<le> 3 / 2 * ln 2 * real x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
psi 0 \<le> 3 / 2 * ln 2 * real 0
psi 1 \<le> 3 / 2 * ln 2 * real 1

goal (1 subgoal):
 1. \<forall>x\<in>{0..1}. psi x \<le> 3 / 2 * ln 2 * real x
[PROOF STEP]
unfolding One_nat_def atLeast0_atMost_Suc ball_simps
[PROOF STATE]
proof (prove)
using this:
psi 0 \<le> 3 / 2 * ln 2 * real 0
psi (Suc 0) \<le> 3 / 2 * ln 2 * real (Suc 0)

goal (1 subgoal):
 1. psi (Suc 0) \<le> 3 / 2 * ln 2 * real (Suc 0) \<and> (\<forall>x\<in>{0..0}. psi x \<le> 3 / 2 * ln 2 * real x)
[PROOF STEP]
by auto


[STATEMENT]
lemma sorted_iff_nth_Suc:
  "sorted xs \<longleftrightarrow> (\<forall>i.  Suc i < length xs \<longrightarrow> xs!i \<le> xs!(Suc i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted xs = (\<forall>i. Suc i < length xs \<longrightarrow> xs ! i \<le> xs ! Suc i)
[PROOF STEP]
by(simp add: sorted_wrt_iff_nth_Suc_transp)


[STATEMENT]
lemma restriction_to_subgroup_is_module :
  fixes   H  :: "'g set"
  assumes subgrp: "Group.Subgroup G H"
  shows   "FGModule H smult V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FGModule H (\<cdot>) V
[PROOF STEP]
proof (rule FGModule.intro)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Group H
 2. RModule (aezfun_setspan H) (\<cdot>) V
[PROOF STEP]
from subgrp
[PROOF STATE]
proof (chain)
picking this:
ActingGroup.Subgroup H
[PROOF STEP]
show "Group H"
[PROOF STATE]
proof (prove)
using this:
ActingGroup.Subgroup H

goal (1 subgoal):
 1. Group H
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
Group H

goal (1 subgoal):
 1. RModule (aezfun_setspan H) (\<cdot>) V
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
ActingGroup.Subgroup H
[PROOF STEP]
show "RModule (Group.group_ring H) (\<cdot>) V"
[PROOF STATE]
proof (prove)
using this:
ActingGroup.Subgroup H

goal (1 subgoal):
 1. RModule (aezfun_setspan H) (\<cdot>) V
[PROOF STEP]
using ActingGroup.Subgroup_imp_Subring SModule_restrict_scalars
[PROOF STATE]
proof (prove)
using this:
ActingGroup.Subgroup H
ActingGroup.Subgroup ?H \<Longrightarrow> Ring1 (aezfun_setspan ?H) \<and> aezfun_setspan ?H \<subseteq> ActingGroup.group_ring
Ring1 ?S \<and> ?S \<subseteq> FG \<Longrightarrow> RModule ?S (\<cdot>) V

goal (1 subgoal):
 1. RModule (aezfun_setspan H) (\<cdot>) V
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
RModule (aezfun_setspan H) (\<cdot>) V

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_mapI[intro]:
  assumes "\<And>a b\<^sub>1 b\<^sub>2. (a, b\<^sub>1) \<in> M \<Longrightarrow> (a, b\<^sub>2) \<in> M \<Longrightarrow> b\<^sub>1 = b\<^sub>2"
  shows "is_map M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_map M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?a, ?b\<^sub>1) \<in> M; (?a, ?b\<^sub>2) \<in> M\<rbrakk> \<Longrightarrow> ?b\<^sub>1 = ?b\<^sub>2

goal (1 subgoal):
 1. is_map M
[PROOF STEP]
unfolding is_map_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?a, ?b\<^sub>1) \<in> M; (?a, ?b\<^sub>2) \<in> M\<rbrakk> \<Longrightarrow> ?b\<^sub>1 = ?b\<^sub>2

goal (1 subgoal):
 1. \<forall>(a\<^sub>1, b\<^sub>1)\<in>M. \<forall>(a\<^sub>2, b\<^sub>2)\<in>M. a\<^sub>1 = a\<^sub>2 \<longrightarrow> b\<^sub>1 = b\<^sub>2
[PROOF STEP]
by auto


[STATEMENT]
lemma conv_radius_add_ge:
  "min (conv_radius f) (conv_radius g) \<le>
       conv_radius (\<lambda>x. f x + g x :: 'a :: {banach,real_normed_div_algebra})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (conv_radius f) (conv_radius g) \<le> conv_radius (\<lambda>x. f x + g x)
[PROOF STEP]
by (rule conv_radius_geI_ex')
     (auto simp: algebra_simps intro!: summable_add summable_in_conv_radius)


[STATEMENT]
lemma corthogonalD[elim]:
  "corthogonal vs \<Longrightarrow> i < length vs \<Longrightarrow> j < length vs \<Longrightarrow>
   vs ! i \<bullet>c vs ! j = 0 \<longleftrightarrow> i \<noteq> j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>corthogonal vs; i < length vs; j < length vs\<rbrakk> \<Longrightarrow> (vs ! i \<bullet>c vs ! j = (0::'a)) = (i \<noteq> j)
[PROOF STEP]
unfolding corthogonal_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>i<length vs. \<forall>j<length vs. (vs ! i \<bullet>c vs ! j = (0::'a)) = (i \<noteq> j); i < length vs; j < length vs\<rbrakk> \<Longrightarrow> (vs ! i \<bullet>c vs ! j = (0::'a)) = (i \<noteq> j)
[PROOF STEP]
by auto


[STATEMENT]
lemma flat_ord_compat:
    fixes x y :: "'a :: complete_lattice"
    shows
    "flat_le x y \<Longrightarrow> x \<le> y"
    "flat_ge x y \<Longrightarrow> x \<ge> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (flat_le x y \<Longrightarrow> x \<le> y) &&& (flat_ge x y \<Longrightarrow> y \<le> x)
[PROOF STEP]
unfolding flat_ord_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x = bot \<or> x = y \<Longrightarrow> x \<le> y) &&& (x = top \<or> x = y \<Longrightarrow> y \<le> x)
[PROOF STEP]
by auto


[STATEMENT]
lemma less_eq_char_simp [simp, code]:
  \<open>Char b0 b1 b2 b3 b4 b5 b6 b7 \<le> Char c0 c1 c2 c3 c4 c5 c6 c7
    \<longleftrightarrow> lexordp_eq [b7, b6, b5, b4, b3, b2, b1, b0] [c7, c6, c5, c4, c3, c2, c1, c0]\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Char b0 b1 b2 b3 b4 b5 b6 b7 \<le> Char c0 c1 c2 c3 c4 c5 c6 c7) = lexordp_eq [b7, b6, b5, b4, b3, b2, b1, b0] [c7, c6, c5, c4, c3, c2, c1, c0]
[PROOF STEP]
by (simp only: less_eq_char_def of_char_def char.sel horner_sum_less_eq_iff_lexordp_eq list.size) simp


[STATEMENT]
theorem summatory_divisor_sum_asymptotics:
  "sum_upto divisor_sum =o (\<lambda>x. pi\<^sup>2 / 12 * x ^ 2) +o O(\<lambda>x. x * ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real (sum_upto divisor_sum x)) \<in> (\<lambda>x. pi\<^sup>2 / 12 * x\<^sup>2) +o O(\<lambda>x. x * ln x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. real (sum_upto divisor_sum x)) \<in> (\<lambda>x. pi\<^sup>2 / 12 * x\<^sup>2) +o O(\<lambda>x. x * ln x)
[PROOF STEP]
define \<zeta> where "\<zeta> = Re (zeta 2)"
[PROOF STATE]
proof (state)
this:
\<zeta> = Re (zeta 2)

goal (1 subgoal):
 1. (\<lambda>x. real (sum_upto divisor_sum x)) \<in> (\<lambda>x. pi\<^sup>2 / 12 * x\<^sup>2) +o O(\<lambda>x. x * ln x)
[PROOF STEP]
define R1 where "R1 = (\<lambda>x. sum_upto real x - x\<^sup>2 / 2)"
[PROOF STATE]
proof (state)
this:
R1 = (\<lambda>x. sum_upto real x - x\<^sup>2 / 2)

goal (1 subgoal):
 1. (\<lambda>x. real (sum_upto divisor_sum x)) \<in> (\<lambda>x. pi\<^sup>2 / 12 * x\<^sup>2) +o O(\<lambda>x. x * ln x)
[PROOF STEP]
define R2 where "R2 = (\<lambda>x. sum_upto (\<lambda>d. 1 / d\<^sup>2) x - (\<zeta> - 1 / x))"
[PROOF STATE]
proof (state)
this:
R2 = (\<lambda>x. sum_upto (\<lambda>d. 1 / real (d\<^sup>2)) x - (\<zeta> - 1 / x))

goal (1 subgoal):
 1. (\<lambda>x. real (sum_upto divisor_sum x)) \<in> (\<lambda>x. pi\<^sup>2 / 12 * x\<^sup>2) +o O(\<lambda>x. x * ln x)
[PROOF STEP]
obtain c1 where c1: "c1 > 0" "\<And>x. x \<ge> 1 \<Longrightarrow> \<bar>R1 x\<bar> \<le> c1 * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c1. \<lbrakk>0 < c1; \<And>x. 1 \<le> x \<Longrightarrow> \<bar>R1 x\<bar> \<le> c1 * x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using zeta_partial_sum_le_neg[of 1]
[PROOF STATE]
proof (prove)
using this:
0 < 1 \<Longrightarrow> \<exists>c>0. \<forall>x\<ge>1. \<bar>sum_upto (\<lambda>n. real n powr 1) x - x powr (1 + 1) / (1 + 1)\<bar> \<le> c * x powr 1

goal (1 subgoal):
 1. (\<And>c1. \<lbrakk>0 < c1; \<And>x. 1 \<le> x \<Longrightarrow> \<bar>R1 x\<bar> \<le> c1 * x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: R1_def)
[PROOF STATE]
proof (state)
this:
0 < c1
1 \<le> ?x \<Longrightarrow> \<bar>R1 ?x\<bar> \<le> c1 * ?x

goal (1 subgoal):
 1. (\<lambda>x. real (sum_upto divisor_sum x)) \<in> (\<lambda>x. pi\<^sup>2 / 12 * x\<^sup>2) +o O(\<lambda>x. x * ln x)
[PROOF STEP]
obtain c2 where c2: "c2 > 0" "\<And>x. x \<ge> 1 \<Longrightarrow> \<bar>R2 x\<bar> \<le> c2 / x\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c2. \<lbrakk>0 < c2; \<And>x. 1 \<le> x \<Longrightarrow> \<bar>R2 x\<bar> \<le> c2 / x\<^sup>2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using zeta_partial_sum_le_pos[of 2]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < 2; 2 \<noteq> 1\<rbrakk> \<Longrightarrow> \<exists>c>0. \<forall>x\<ge>1. \<bar>sum_upto (\<lambda>x. real x powr - 2) x - (x powr (1 - 2) / (1 - 2) + Re (zeta (complex_of_real 2)))\<bar> \<le> c * x powr - 2

goal (1 subgoal):
 1. (\<And>c2. \<lbrakk>0 < c2; \<And>x. 1 \<le> x \<Longrightarrow> \<bar>R2 x\<bar> \<le> c2 / x\<^sup>2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: \<zeta>_def R2_def powr_minus field_simps
              simp del: div_mult_self3 div_mult_self4 div_mult_self2 div_mult_self1)
[PROOF STATE]
proof (state)
this:
0 < c2
1 \<le> ?x \<Longrightarrow> \<bar>R2 ?x\<bar> \<le> c2 / ?x\<^sup>2

goal (1 subgoal):
 1. (\<lambda>x. real (sum_upto divisor_sum x)) \<in> (\<lambda>x. pi\<^sup>2 / 12 * x\<^sup>2) +o O(\<lambda>x. x * ln x)
[PROOF STEP]
have le: "\<bar>sum_upto divisor_sum x - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)"
    if x: "x \<ge> 1" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
have div_le: "real (a div b) \<le> x" if "a \<le> x" for a b :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (a div b) \<le> x
[PROOF STEP]
by (rule order.trans[OF _ that(1)]) auto
[PROOF STATE]
proof (state)
this:
real ?a \<le> x \<Longrightarrow> real (?a div ?b) \<le> x

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
have "real (sum_upto divisor_sum x) = sum_upto (dirichlet_prod real (\<lambda>_. 1)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (sum_upto divisor_sum x) = sum_upto (dirichlet_prod real (\<lambda>_. 1)) x
[PROOF STEP]
by (simp add: divisor_sigma_conv_dirichlet_prod [abs_def]
                    sum_upto_def divisor_sigma_1_left [symmetric])
[PROOF STATE]
proof (state)
this:
real (sum_upto divisor_sum x) = sum_upto (dirichlet_prod real (\<lambda>_. 1)) x

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (sum_upto divisor_sum x) = sum_upto (dirichlet_prod real (\<lambda>_. 1)) x

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
have "\<dots> = sum_upto (\<lambda>n. \<Sum>d | d dvd n. real d) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (dirichlet_prod real (\<lambda>_. 1)) x = sum_upto (\<lambda>n. sum real {d. d dvd n}) x
[PROOF STEP]
by (simp add: dirichlet_prod_def)
[PROOF STATE]
proof (state)
this:
sum_upto (dirichlet_prod real (\<lambda>_. 1)) x = sum_upto (\<lambda>n. sum real {d. d dvd n}) x

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (dirichlet_prod real (\<lambda>_. 1)) x = sum_upto (\<lambda>n. sum real {d. d dvd n}) x

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
have "\<dots> = (\<Sum>(n, d) \<in> (SIGMA n:{n. n > 0 \<and> real n \<le> x}. {d. d dvd n}). real d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. sum real {d. d dvd n}) x = (\<Sum>(n, y)\<in>(SIGMA n:{n. 0 < n \<and> real n \<le> x}. {d. d dvd n}). real y)
[PROOF STEP]
unfolding sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<in>{i. 0 < i \<and> real i \<le> x}. sum real {d. d dvd n}) = (\<Sum>(n, y)\<in>(SIGMA n:{n. 0 < n \<and> real n \<le> x}. {d. d dvd n}). real y)
[PROOF STEP]
by (subst sum.Sigma) auto
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. sum real {d. d dvd n}) x = (\<Sum>(n, y)\<in>(SIGMA n:{n. 0 < n \<and> real n \<le> x}. {d. d dvd n}). real y)

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. sum real {d. d dvd n}) x = (\<Sum>(n, y)\<in>(SIGMA n:{n. 0 < n \<and> real n \<le> x}. {d. d dvd n}). real y)

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
have "\<dots> = (\<Sum>(d, q) \<in> (SIGMA d:{d. d > 0 \<and> real d \<le> x}. {q. q > 0 \<and> real q \<le> x / d}). real q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(n, y)\<in>(SIGMA n:{n. 0 < n \<and> real n \<le> x}. {d. d dvd n}). real y) = (\<Sum>(d, y)\<in>(SIGMA xa:{d. 0 < d \<and> real d \<le> x}. {q. 0 < q \<and> real q \<le> x / real xa}). real y)
[PROOF STEP]
by (rule sum.reindex_bij_witness[of _ "\<lambda>(d, q). (d * q, q)" "\<lambda>(n, d). (n div d, d)"])
         (use div_le in \<open>auto simp: field_simps\<close>)
[PROOF STATE]
proof (state)
this:
(\<Sum>(n, y)\<in>(SIGMA n:{n. 0 < n \<and> real n \<le> x}. {d. d dvd n}). real y) = (\<Sum>(d, y)\<in>(SIGMA xa:{d. 0 < d \<and> real d \<le> x}. {q. 0 < q \<and> real q \<le> x / real xa}). real y)

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(n, y)\<in>(SIGMA n:{n. 0 < n \<and> real n \<le> x}. {d. d dvd n}). real y) = (\<Sum>(d, y)\<in>(SIGMA xa:{d. 0 < d \<and> real d \<le> x}. {q. 0 < q \<and> real q \<le> x / real xa}). real y)

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
have "\<dots> = sum_upto (\<lambda>d. sum_upto real (x / d)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(d, y)\<in>(SIGMA xa:{d. 0 < d \<and> real d \<le> x}. {q. 0 < q \<and> real q \<le> x / real xa}). real y) = sum_upto (\<lambda>xa. sum_upto real (x / real xa)) x
[PROOF STEP]
by (simp add: sum_upto_def sum.Sigma)
[PROOF STATE]
proof (state)
this:
(\<Sum>(d, y)\<in>(SIGMA xa:{d. 0 < d \<and> real d \<le> x}. {q. 0 < q \<and> real q \<le> x / real xa}). real y) = sum_upto (\<lambda>xa. sum_upto real (x / real xa)) x

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(d, y)\<in>(SIGMA xa:{d. 0 < d \<and> real d \<le> x}. {q. 0 < q \<and> real q \<le> x / real xa}). real y) = sum_upto (\<lambda>xa. sum_upto real (x / real xa)) x

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
have "\<dots> = x\<^sup>2 * sum_upto (\<lambda>d. 1 / d\<^sup>2) x / 2 + sum_upto (\<lambda>d. R1 (x / d)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>xa. sum_upto real (x / real xa)) x = x\<^sup>2 * sum_upto (\<lambda>d. 1 / real (d\<^sup>2)) x / 2 + sum_upto (\<lambda>d. R1 (x / real d)) x
[PROOF STEP]
by (simp add: R1_def sum_upto_def sum.distrib sum_subtractf sum_divide_distrib
                    power_divide sum_distrib_left)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>xa. sum_upto real (x / real xa)) x = x\<^sup>2 * sum_upto (\<lambda>d. 1 / real (d\<^sup>2)) x / 2 + sum_upto (\<lambda>d. R1 (x / real d)) x

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>xa. sum_upto real (x / real xa)) x = x\<^sup>2 * sum_upto (\<lambda>d. 1 / real (d\<^sup>2)) x / 2 + sum_upto (\<lambda>d. R1 (x / real d)) x

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
have "sum_upto (\<lambda>d. 1 / d\<^sup>2) x = \<zeta> - 1 / x + R2 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>d. 1 / real (d\<^sup>2)) x = \<zeta> - 1 / x + R2 x
[PROOF STEP]
by (simp add: R2_def)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>d. 1 / real (d\<^sup>2)) x = \<zeta> - 1 / x + R2 x

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (sum_upto divisor_sum x) = x\<^sup>2 * (\<zeta> - 1 / x + R2 x) / 2 + sum_upto (\<lambda>d. R1 (x / real d)) x
[PROOF STEP]
have eq: "real (sum_upto divisor_sum x) =
                        x\<^sup>2 * (\<zeta> - 1 / x + R2 x) / 2 + sum_upto (\<lambda>d. R1 (x / real d)) x"
[PROOF STATE]
proof (prove)
using this:
real (sum_upto divisor_sum x) = x\<^sup>2 * (\<zeta> - 1 / x + R2 x) / 2 + sum_upto (\<lambda>d. R1 (x / real d)) x

goal (1 subgoal):
 1. real (sum_upto divisor_sum x) = x\<^sup>2 * (\<zeta> - 1 / x + R2 x) / 2 + sum_upto (\<lambda>d. R1 (x / real d)) x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real (sum_upto divisor_sum x) = x\<^sup>2 * (\<zeta> - 1 / x + R2 x) / 2 + sum_upto (\<lambda>d. R1 (x / real d)) x

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
have "real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2 =
            x\<^sup>2 / 2 * R2 x - x / 2 + sum_upto (\<lambda>d. R1 (x / real d)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2 = x\<^sup>2 / 2 * R2 x - x / 2 + sum_upto (\<lambda>d. R1 (x / real d)) x
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
1 \<le> x

goal (1 subgoal):
 1. real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2 = x\<^sup>2 / 2 * R2 x - x / 2 + sum_upto (\<lambda>d. R1 (x / real d)) x
[PROOF STEP]
by (subst eq)
         (simp add: field_simps power2_eq_square del: div_diff div_add
               del: div_mult_self3 div_mult_self4 div_mult_self2 div_mult_self1)
[PROOF STATE]
proof (state)
this:
real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2 = x\<^sup>2 / 2 * R2 x - x / 2 + sum_upto (\<lambda>d. R1 (x / real d)) x

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2 = x\<^sup>2 / 2 * R2 x - x / 2 + sum_upto (\<lambda>d. R1 (x / real d)) x

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
have "\<bar>\<dots>\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x\<^sup>2 / 2 * R2 x - x / 2 + sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
proof (rule order.trans[OF abs_triangle_ineq] order.trans[OF abs_triangle_ineq4] add_mono)+
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<bar>x\<^sup>2 / 2 * R2 x\<bar> \<le> c2 / 2
 2. \<bar>x / 2\<bar> \<le> x / 2
 3. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
have "\<bar>x\<^sup>2 / 2 * R2 x\<bar> = x\<^sup>2 / 2 * \<bar>R2 x\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x\<^sup>2 / 2 * R2 x\<bar> = x\<^sup>2 / 2 * \<bar>R2 x\<bar>
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
1 \<le> x

goal (1 subgoal):
 1. \<bar>x\<^sup>2 / 2 * R2 x\<bar> = x\<^sup>2 / 2 * \<bar>R2 x\<bar>
[PROOF STEP]
by (simp add: abs_mult)
[PROOF STATE]
proof (state)
this:
\<bar>x\<^sup>2 / 2 * R2 x\<bar> = x\<^sup>2 / 2 * \<bar>R2 x\<bar>

goal (3 subgoals):
 1. \<bar>x\<^sup>2 / 2 * R2 x\<bar> \<le> c2 / 2
 2. \<bar>x / 2\<bar> \<le> x / 2
 3. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>x\<^sup>2 / 2 * R2 x\<bar> = x\<^sup>2 / 2 * \<bar>R2 x\<bar>

goal (3 subgoals):
 1. \<bar>x\<^sup>2 / 2 * R2 x\<bar> \<le> c2 / 2
 2. \<bar>x / 2\<bar> \<le> x / 2
 3. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
have "\<dots> \<le> x\<^sup>2 / 2 * (c2 / x\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>2 / 2 * \<bar>R2 x\<bar> \<le> x\<^sup>2 / 2 * (c2 / x\<^sup>2)
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
1 \<le> x

goal (1 subgoal):
 1. x\<^sup>2 / 2 * \<bar>R2 x\<bar> \<le> x\<^sup>2 / 2 * (c2 / x\<^sup>2)
[PROOF STEP]
by (intro mult_left_mono c2) auto
[PROOF STATE]
proof (state)
this:
x\<^sup>2 / 2 * \<bar>R2 x\<bar> \<le> x\<^sup>2 / 2 * (c2 / x\<^sup>2)

goal (3 subgoals):
 1. \<bar>x\<^sup>2 / 2 * R2 x\<bar> \<le> c2 / 2
 2. \<bar>x / 2\<bar> \<le> x / 2
 3. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>x\<^sup>2 / 2 * R2 x\<bar> \<le> x\<^sup>2 / 2 * (c2 / x\<^sup>2)
[PROOF STEP]
show "\<bar>x\<^sup>2 / 2 * R2 x\<bar> \<le> c2 / 2"
[PROOF STATE]
proof (prove)
using this:
\<bar>x\<^sup>2 / 2 * R2 x\<bar> \<le> x\<^sup>2 / 2 * (c2 / x\<^sup>2)

goal (1 subgoal):
 1. \<bar>x\<^sup>2 / 2 * R2 x\<bar> \<le> c2 / 2
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
\<bar>x\<^sup>2 / 2 * R2 x\<bar> \<le> x\<^sup>2 / 2 * (c2 / x\<^sup>2)
1 \<le> x

goal (1 subgoal):
 1. \<bar>x\<^sup>2 / 2 * R2 x\<bar> \<le> c2 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>x\<^sup>2 / 2 * R2 x\<bar> \<le> c2 / 2

goal (2 subgoals):
 1. \<bar>x / 2\<bar> \<le> x / 2
 2. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<bar>x / 2\<bar> \<le> x / 2
 2. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
have "\<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> sum_upto (\<lambda>d. \<bar>R1 (x / real d)\<bar>) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> sum_upto (\<lambda>d. \<bar>R1 (x / real d)\<bar>) x
[PROOF STEP]
unfolding sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<Sum>d\<in>{i. 0 < i \<and> real i \<le> x}. R1 (x / real d)\<bar> \<le> (\<Sum>d\<in>{i. 0 < i \<and> real i \<le> x}. \<bar>R1 (x / real d)\<bar>)
[PROOF STEP]
by (rule sum_abs)
[PROOF STATE]
proof (state)
this:
\<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> sum_upto (\<lambda>d. \<bar>R1 (x / real d)\<bar>) x

goal (2 subgoals):
 1. \<bar>x / 2\<bar> \<le> x / 2
 2. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> sum_upto (\<lambda>d. \<bar>R1 (x / real d)\<bar>) x

goal (2 subgoals):
 1. \<bar>x / 2\<bar> \<le> x / 2
 2. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
have "\<dots> \<le> sum_upto (\<lambda>d. c1 * (x / real d)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>d. \<bar>R1 (x / real d)\<bar>) x \<le> sum_upto (\<lambda>d. c1 * (x / real d)) x
[PROOF STEP]
unfolding sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d\<in>{i. 0 < i \<and> real i \<le> x}. \<bar>R1 (x / real d)\<bar>) \<le> (\<Sum>d\<in>{i. 0 < i \<and> real i \<le> x}. c1 * (x / real d))
[PROOF STEP]
by (intro sum_mono c1) auto
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>d. \<bar>R1 (x / real d)\<bar>) x \<le> sum_upto (\<lambda>d. c1 * (x / real d)) x

goal (2 subgoals):
 1. \<bar>x / 2\<bar> \<le> x / 2
 2. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>d. \<bar>R1 (x / real d)\<bar>) x \<le> sum_upto (\<lambda>d. c1 * (x / real d)) x

goal (2 subgoals):
 1. \<bar>x / 2\<bar> \<le> x / 2
 2. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
have "\<dots> = c1 * x * sum_upto (\<lambda>d. 1 / real d) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>d. c1 * (x / real d)) x = c1 * x * sum_upto (\<lambda>d. 1 / real d) x
[PROOF STEP]
by (simp add: sum_upto_def sum_distrib_left)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>d. c1 * (x / real d)) x = c1 * x * sum_upto (\<lambda>d. 1 / real d) x

goal (2 subgoals):
 1. \<bar>x / 2\<bar> \<le> x / 2
 2. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>d. c1 * (x / real d)) x = c1 * x * sum_upto (\<lambda>d. 1 / real d) x

goal (2 subgoals):
 1. \<bar>x / 2\<bar> \<le> x / 2
 2. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
have "sum_upto (\<lambda>d. 1 / real d) x = harm (nat \<lfloor>x\<rfloor>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>d. 1 / real d) x = harm (nat \<lfloor>x\<rfloor>)
[PROOF STEP]
unfolding sum_upto_altdef harm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d\<in>{0<..nat \<lfloor>x\<rfloor>}. 1 / real d) = (\<Sum>k = 1..nat \<lfloor>x\<rfloor>. inverse (real k))
[PROOF STEP]
by (intro sum.cong) (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>d. 1 / real d) x = harm (nat \<lfloor>x\<rfloor>)

goal (2 subgoals):
 1. \<bar>x / 2\<bar> \<le> x / 2
 2. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>d. 1 / real d) x = harm (nat \<lfloor>x\<rfloor>)

goal (2 subgoals):
 1. \<bar>x / 2\<bar> \<le> x / 2
 2. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
have "\<dots> \<le> ln (nat \<lfloor>x\<rfloor>) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harm (nat \<lfloor>x\<rfloor>) \<le> ln (real (nat \<lfloor>x\<rfloor>)) + 1
[PROOF STEP]
by (rule harm_le) (use x in \<open>auto simp: le_nat_iff\<close>)
[PROOF STATE]
proof (state)
this:
harm (nat \<lfloor>x\<rfloor>) \<le> ln (real (nat \<lfloor>x\<rfloor>)) + 1

goal (2 subgoals):
 1. \<bar>x / 2\<bar> \<le> x / 2
 2. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
harm (nat \<lfloor>x\<rfloor>) \<le> ln (real (nat \<lfloor>x\<rfloor>)) + 1

goal (2 subgoals):
 1. \<bar>x / 2\<bar> \<le> x / 2
 2. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
have "ln (nat \<lfloor>x\<rfloor>) \<le> ln x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real (nat \<lfloor>x\<rfloor>)) \<le> ln x
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
1 \<le> x

goal (1 subgoal):
 1. ln (real (nat \<lfloor>x\<rfloor>)) \<le> ln x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ln (real (nat \<lfloor>x\<rfloor>)) \<le> ln x

goal (2 subgoals):
 1. \<bar>x / 2\<bar> \<le> x / 2
 2. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>xa y. xa \<le> y \<Longrightarrow> c1 * x * xa \<le> c1 * x * y; \<And>xa y. xa \<le> y \<Longrightarrow> c1 * x * (xa + 1) \<le> c1 * x * (y + 1)\<rbrakk> \<Longrightarrow> \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
show "\<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>xa y. xa \<le> y \<Longrightarrow> c1 * x * xa \<le> c1 * x * y; \<And>xa y. xa \<le> y \<Longrightarrow> c1 * x * (xa + 1) \<le> c1 * x * (y + 1)\<rbrakk> \<Longrightarrow> \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)

goal (1 subgoal):
 1. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
using c1(1) x
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>xa y. xa \<le> y \<Longrightarrow> c1 * x * xa \<le> c1 * x * y; \<And>xa y. xa \<le> y \<Longrightarrow> c1 * x * (xa + 1) \<le> c1 * x * (y + 1)\<rbrakk> \<Longrightarrow> \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
0 < c1
1 \<le> x

goal (1 subgoal):
 1. \<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c1 * x * (ln x + 1)

goal (1 subgoal):
 1. \<bar>x / 2\<bar> \<le> x / 2
[PROOF STEP]
qed (use x in auto)
[PROOF STATE]
proof (state)
this:
\<bar>x\<^sup>2 / 2 * R2 x - x / 2 + sum_upto (\<lambda>d. R1 (x / real d)) x\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
show "\<bar>sum_upto divisor_sum x - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)"
[PROOF STATE]
proof (prove)
using this:
\<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)

goal (1 subgoal):
 1. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
1 \<le> ?x \<Longrightarrow> \<bar>real (sum_upto divisor_sum ?x) - \<zeta> / 2 * ?x\<^sup>2\<bar> \<le> c2 / 2 + ?x / 2 + c1 * ?x * (ln ?x + 1)

goal (1 subgoal):
 1. (\<lambda>x. real (sum_upto divisor_sum x)) \<in> (\<lambda>x. pi\<^sup>2 / 12 * x\<^sup>2) +o O(\<lambda>x. x * ln x)
[PROOF STEP]
have "eventually (\<lambda>x. \<bar>sum_upto divisor_sum x - \<zeta> / 2 * x\<^sup>2\<bar> \<le>
                            c2 / 2 + x / 2 + c1 * x * (ln x + 1)) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
using eventually_ge_at_top[of 1]
[PROOF STATE]
proof (prove)
using this:
eventually ((\<le>) (1::?'a1)) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)
[PROOF STEP]
by eventually_elim (use le in auto)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)

goal (1 subgoal):
 1. (\<lambda>x. real (sum_upto divisor_sum x)) \<in> (\<lambda>x. pi\<^sup>2 / 12 * x\<^sup>2) +o O(\<lambda>x. x * ln x)
[PROOF STEP]
hence "eventually (\<lambda>x. \<bar>sum_upto divisor_sum x - \<zeta> / 2 * x\<^sup>2\<bar> \<le>
                              \<bar>c2 / 2 + x / 2 + c1 * x * (ln x + 1)\<bar>) at_top"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> c2 / 2 + x / 2 + c1 * x * (ln x + 1)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> \<bar>c2 / 2 + x / 2 + c1 * x * (ln x + 1)\<bar>
[PROOF STEP]
by eventually_elim linarith
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> \<bar>c2 / 2 + x / 2 + c1 * x * (ln x + 1)\<bar>

goal (1 subgoal):
 1. (\<lambda>x. real (sum_upto divisor_sum x)) \<in> (\<lambda>x. pi\<^sup>2 / 12 * x\<^sup>2) +o O(\<lambda>x. x * ln x)
[PROOF STEP]
hence "(\<lambda>x. sum_upto divisor_sum x - \<zeta> / 2 * x\<^sup>2) \<in> O(\<lambda>x. c2 / 2 + x / 2 + c1 * x * (ln x + 1))"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. \<bar>real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2\<bar> \<le> \<bar>c2 / 2 + x / 2 + c1 * x * (ln x + 1)\<bar>

goal (1 subgoal):
 1. (\<lambda>x. real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2) \<in> O(\<lambda>x. c2 / 2 + x / 2 + c1 * x * (ln x + 1))
[PROOF STEP]
by (intro landau_o.bigI[of 1]) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2) \<in> O(\<lambda>x. c2 / 2 + x / 2 + c1 * x * (ln x + 1))

goal (1 subgoal):
 1. (\<lambda>x. real (sum_upto divisor_sum x)) \<in> (\<lambda>x. pi\<^sup>2 / 12 * x\<^sup>2) +o O(\<lambda>x. x * ln x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2) \<in> O(\<lambda>x. c2 / 2 + x / 2 + c1 * x * (ln x + 1))

goal (1 subgoal):
 1. (\<lambda>x. real (sum_upto divisor_sum x)) \<in> (\<lambda>x. pi\<^sup>2 / 12 * x\<^sup>2) +o O(\<lambda>x. x * ln x)
[PROOF STEP]
have "(\<lambda>x. c2 / 2 + x / 2 + c1 * x * (ln x + 1)) \<in> O(\<lambda>x. x * ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. c2 / 2 + x / 2 + c1 * x * (ln x + 1)) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
by real_asymp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. c2 / 2 + x / 2 + c1 * x * (ln x + 1)) \<in> O(\<lambda>x. x * ln x)

goal (1 subgoal):
 1. (\<lambda>x. real (sum_upto divisor_sum x)) \<in> (\<lambda>x. pi\<^sup>2 / 12 * x\<^sup>2) +o O(\<lambda>x. x * ln x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. real (sum_upto divisor_sum x) - \<zeta> / 2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)

goal (1 subgoal):
 1. (\<lambda>x. real (sum_upto divisor_sum x)) \<in> (\<lambda>x. pi\<^sup>2 / 12 * x\<^sup>2) +o O(\<lambda>x. x * ln x)
[PROOF STEP]
by (subst set_minus_plus [symmetric])
       (simp_all add: fun_diff_def algebra_simps \<zeta>_def zeta_even_numeral)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real (sum_upto divisor_sum x)) \<in> (\<lambda>x. pi\<^sup>2 / 12 * x\<^sup>2) +o O(\<lambda>x. x * ln x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma conefield_scaleR: "conefield (r *\<^sub>R x) y = conefield x y" if "r > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conefield (r *\<^sub>R x) y = conefield x y
[PROOF STEP]
using conefield_scaleRD conefield_scaleRI that
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> conefield (?r *\<^sub>R ?x) ?y; 0 < ?r\<rbrakk> \<Longrightarrow> ?v \<in> conefield ?x ?y
\<lbrakk>?v \<in> conefield ?x ?y; 0 < ?r\<rbrakk> \<Longrightarrow> ?v \<in> conefield (?r *\<^sub>R ?x) ?y
0 < r

goal (1 subgoal):
 1. conefield (r *\<^sub>R x) y = conefield x y
[PROOF STEP]
by blast


[STATEMENT]
lemma (in inj_comm_ring_hom) resultant_hom: "resultant (map_poly hom p) (map_poly hom q) = hom (resultant p q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. resultant (map_poly hom p) (map_poly hom q) = hom (resultant p q)
[PROOF STEP]
by (rule resultant_map_poly, auto)


[STATEMENT]
lemma isometry_onI [intro?]:
  assumes "\<And>x y. x \<in> X \<Longrightarrow> y \<in> X \<Longrightarrow> dist (f x) (f y) = dist x y"
  shows "isometry_on X f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isometry_on X f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> X; ?y \<in> X\<rbrakk> \<Longrightarrow> dist (f ?x) (f ?y) = dist ?x ?y

goal (1 subgoal):
 1. isometry_on X f
[PROOF STEP]
unfolding isometry_on_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> X; ?y \<in> X\<rbrakk> \<Longrightarrow> dist (f ?x) (f ?y) = dist ?x ?y

goal (1 subgoal):
 1. \<forall>x\<in>X. \<forall>y\<in>X. dist (f x) (f y) = dist x y
[PROOF STEP]
by auto


[STATEMENT]
lemma finite_varsC: "finite (varsC c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (varsC c)
[PROOF STEP]
using finite_varsL
[PROOF STATE]
proof (prove)
using this:
finite (varsL ?l)

goal (1 subgoal):
 1. finite (varsC c)
[PROOF STEP]
unfolding varsC_def
[PROOF STATE]
proof (prove)
using this:
finite (varsL ?l)

goal (1 subgoal):
 1. finite (\<Union> (set (map varsL c)))
[PROOF STEP]
by (induct c, auto)


[STATEMENT]
lemma Norm_triangular_ineq:
  assumes "x \<in> space\<^sub>N N"
  shows "Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
proof (cases "y \<in> space\<^sub>N N")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. y \<in> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
 2. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
y \<in> space\<^sub>N N

goal (2 subgoals):
 1. y \<in> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
 2. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
have *: "defect N * Norm N x + defect N * Norm N y \<ge> 1 * 0 + 1 * 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 * 0 + 1 * 0 \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
apply (rule add_mono)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 1 * 0 \<le> defect N * Norm N x
 2. 1 * 0 \<le> defect N * Norm N y
[PROOF STEP]
by (rule mult_mono'[OF defect_ge_1 Norm_nonneg], simp, simp)+
[PROOF STATE]
proof (state)
this:
1 * 0 + 1 * 0 \<le> defect N * Norm N x + defect N * Norm N y

goal (2 subgoals):
 1. y \<in> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
 2. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
have "ennreal (Norm N (x + y)) = eNorm N (x+y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (Norm N (x + y)) = eNorm N (x + y)
[PROOF STEP]
using eNorm_Norm[OF spaceN_add[OF assms True]]
[PROOF STATE]
proof (prove)
using this:
eNorm N (x + y) = ennreal (Norm N (x + y))

goal (1 subgoal):
 1. ennreal (Norm N (x + y)) = eNorm N (x + y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ennreal (Norm N (x + y)) = eNorm N (x + y)

goal (2 subgoals):
 1. y \<in> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
 2. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (Norm N (x + y)) = eNorm N (x + y)

goal (2 subgoals):
 1. y \<in> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
 2. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
have "... \<le> defect N * eNorm N x + defect N * eNorm N y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eNorm N (x + y) \<le> ennreal (defect N) * eNorm N x + ennreal (defect N) * eNorm N y
[PROOF STEP]
using eNorm_triangular_ineq[of N x y]
[PROOF STATE]
proof (prove)
using this:
eNorm N (x + y) \<le> ennreal (defect N) * eNorm N x + ennreal (defect N) * eNorm N y

goal (1 subgoal):
 1. eNorm N (x + y) \<le> ennreal (defect N) * eNorm N x + ennreal (defect N) * eNorm N y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
eNorm N (x + y) \<le> ennreal (defect N) * eNorm N x + ennreal (defect N) * eNorm N y

goal (2 subgoals):
 1. y \<in> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
 2. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
eNorm N (x + y) \<le> ennreal (defect N) * eNorm N x + ennreal (defect N) * eNorm N y

goal (2 subgoals):
 1. y \<in> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
 2. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
have "... = defect N * ennreal(Norm N x) + defect N * ennreal(Norm N y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (defect N) * eNorm N x + ennreal (defect N) * eNorm N y = ennreal (defect N) * ennreal (Norm N x) + ennreal (defect N) * ennreal (Norm N y)
[PROOF STEP]
using eNorm_Norm assms True
[PROOF STATE]
proof (prove)
using this:
?x \<in> space\<^sub>N ?N \<Longrightarrow> eNorm ?N ?x = ennreal (Norm ?N ?x)
x \<in> space\<^sub>N N
y \<in> space\<^sub>N N

goal (1 subgoal):
 1. ennreal (defect N) * eNorm N x + ennreal (defect N) * eNorm N y = ennreal (defect N) * ennreal (Norm N x) + ennreal (defect N) * ennreal (Norm N y)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
ennreal (defect N) * eNorm N x + ennreal (defect N) * eNorm N y = ennreal (defect N) * ennreal (Norm N x) + ennreal (defect N) * ennreal (Norm N y)

goal (2 subgoals):
 1. y \<in> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
 2. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (defect N) * eNorm N x + ennreal (defect N) * eNorm N y = ennreal (defect N) * ennreal (Norm N x) + ennreal (defect N) * ennreal (Norm N y)

goal (2 subgoals):
 1. y \<in> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
 2. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
have "... = ennreal(defect N * Norm N x + defect N * Norm N y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (defect N) * ennreal (Norm N x) + ennreal (defect N) * ennreal (Norm N y) = ennreal (defect N * Norm N x + defect N * Norm N y)
[PROOF STEP]
using ennreal_mult ennreal_plus Norm_nonneg defect_ge_1
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> ?a; 0 \<le> ?b\<rbrakk> \<Longrightarrow> ennreal (?a * ?b) = ennreal ?a * ennreal ?b
\<lbrakk>0 \<le> ?a; 0 \<le> ?b\<rbrakk> \<Longrightarrow> ennreal (?a + ?b) = ennreal ?a + ennreal ?b
0 \<le> Norm ?N ?x
1 \<le> defect ?N

goal (1 subgoal):
 1. ennreal (defect N) * ennreal (Norm N x) + ennreal (defect N) * ennreal (Norm N y) = ennreal (defect N * Norm N x + defect N * Norm N y)
[PROOF STEP]
by (metis (no_types, opaque_lifting) ennreal_eq_0_iff less_le ennreal_ge_1 ennreal_mult' le_less_linear not_one_le_zero semiring_normalization_rules(34))
[PROOF STATE]
proof (state)
this:
ennreal (defect N) * ennreal (Norm N x) + ennreal (defect N) * ennreal (Norm N y) = ennreal (defect N * Norm N x + defect N * Norm N y)

goal (2 subgoals):
 1. y \<in> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
 2. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ennreal (Norm N (x + y)) \<le> ennreal (defect N * Norm N x + defect N * Norm N y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ennreal (Norm N (x + y)) \<le> ennreal (defect N * Norm N x + defect N * Norm N y)

goal (1 subgoal):
 1. Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
apply (subst ennreal_le_iff[symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ennreal (Norm N (x + y)) \<le> ennreal (defect N * Norm N x + defect N * Norm N y) \<Longrightarrow> 0 \<le> defect N * Norm N x + defect N * Norm N y
 2. ennreal (Norm N (x + y)) \<le> ennreal (defect N * Norm N x + defect N * Norm N y) \<Longrightarrow> ennreal (Norm N (x + y)) \<le> ennreal (defect N * Norm N x + defect N * Norm N y)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
1 * 0 + 1 * 0 \<le> defect N * Norm N x + defect N * Norm N y

goal (2 subgoals):
 1. ennreal (Norm N (x + y)) \<le> ennreal (defect N * Norm N x + defect N * Norm N y) \<Longrightarrow> 0 \<le> defect N * Norm N x + defect N * Norm N y
 2. ennreal (Norm N (x + y)) \<le> ennreal (defect N * Norm N x + defect N * Norm N y) \<Longrightarrow> ennreal (Norm N (x + y)) \<le> ennreal (defect N * Norm N x + defect N * Norm N y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y

goal (1 subgoal):
 1. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
y \<notin> space\<^sub>N N

goal (1 subgoal):
 1. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
have "x + y \<notin> space\<^sub>N N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + y \<notin> space\<^sub>N N
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> x + y \<notin> space\<^sub>N N \<Longrightarrow> False
[PROOF STEP]
assume "\<not> (x + y \<notin> space\<^sub>N N)"
[PROOF STATE]
proof (state)
this:
\<not> x + y \<notin> space\<^sub>N N

goal (1 subgoal):
 1. \<not> x + y \<notin> space\<^sub>N N \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> x + y \<notin> space\<^sub>N N
[PROOF STEP]
have "x + y \<in> space\<^sub>N N"
[PROOF STATE]
proof (prove)
using this:
\<not> x + y \<notin> space\<^sub>N N

goal (1 subgoal):
 1. x + y \<in> space\<^sub>N N
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x + y \<in> space\<^sub>N N

goal (1 subgoal):
 1. \<not> x + y \<notin> space\<^sub>N N \<Longrightarrow> False
[PROOF STEP]
have "y \<in> space\<^sub>N N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> space\<^sub>N N
[PROOF STEP]
using spaceN_diff[OF \<open>x + y \<in> space\<^sub>N N\<close> assms]
[PROOF STATE]
proof (prove)
using this:
x + y - x \<in> space\<^sub>N N

goal (1 subgoal):
 1. y \<in> space\<^sub>N N
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> space\<^sub>N N

goal (1 subgoal):
 1. \<not> x + y \<notin> space\<^sub>N N \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> space\<^sub>N N
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
y \<in> space\<^sub>N N

goal (1 subgoal):
 1. False
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
y \<in> space\<^sub>N N
y \<notin> space\<^sub>N N

goal (1 subgoal):
 1. False
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x + y \<notin> space\<^sub>N N

goal (1 subgoal):
 1. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x + y \<notin> space\<^sub>N N
[PROOF STEP]
have "Norm N (x+y) = 0"
[PROOF STATE]
proof (prove)
using this:
x + y \<notin> space\<^sub>N N

goal (1 subgoal):
 1. Norm N (x + y) = 0
[PROOF STEP]
unfolding Norm_def
[PROOF STATE]
proof (prove)
using this:
x + y \<notin> space\<^sub>N N

goal (1 subgoal):
 1. enn2real (eNorm N (x + y)) = 0
[PROOF STEP]
using spaceN_iff top.not_eq_extremum
[PROOF STATE]
proof (prove)
using this:
x + y \<notin> space\<^sub>N N
(?x \<in> space\<^sub>N ?N) = (eNorm ?N ?x < \<infinity>)
(?a \<noteq> \<top>) = (?a < \<top>)

goal (1 subgoal):
 1. enn2real (eNorm N (x + y)) = 0
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
Norm N (x + y) = 0

goal (1 subgoal):
 1. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Norm N (x + y) = 0

goal (1 subgoal):
 1. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
have "defect N * Norm N x + defect N * Norm N y \<ge> 1 * 0 + 1 * 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 * 0 + 1 * 0 \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
apply (rule add_mono)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 1 * 0 \<le> defect N * Norm N x
 2. 1 * 0 \<le> defect N * Norm N y
[PROOF STEP]
by (rule mult_mono'[OF defect_ge_1 Norm_nonneg], simp, simp)+
[PROOF STATE]
proof (state)
this:
1 * 0 + 1 * 0 \<le> defect N * Norm N x + defect N * Norm N y

goal (1 subgoal):
 1. y \<notin> space\<^sub>N N \<Longrightarrow> Norm N (x + y) \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Norm N (x + y) = 0
1 * 0 + 1 * 0 \<le> defect N * Norm N x + defect N * Norm N y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Norm N (x + y) = 0
1 * 0 + 1 * 0 \<le> defect N * Norm N x + defect N * Norm N y

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma face_of_linear_image:
  assumes "linear f" "inj f"
    shows "(f ` c face_of f ` S) \<longleftrightarrow> c face_of S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f ` c face_of f ` S) = (c face_of S)
[PROOF STEP]
by (simp add: face_of_def inj_image_subset_iff inj_image_mem_iff open_segment_linear_image assms)


[STATEMENT]
lemma distr_bst_of_list_random_bst: "
  distr (random_perm xs) (count_space (trees A)) bst_of_list =
    restrict_space (random_bst (set xs)) (trees A)" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (random_perm xs) (count_space (trees A)) bst_of_list = restrict_space (measure_pmf (random_bst (set xs))) (trees A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distr (random_perm xs) (count_space (trees A)) bst_of_list = restrict_space (measure_pmf (random_bst (set xs))) (trees A)
[PROOF STEP]
have "?rhs = restrict_space (distr (uniform_measure (count_space UNIV)
                 (permutations_of_set (set xs))) (count_space UNIV) bst_of_list) (trees A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. restrict_space (measure_pmf (random_bst (set xs))) (trees A) = restrict_space (distr (uniform_measure (count_space UNIV) (permutations_of_set (set xs))) (count_space UNIV) bst_of_list) (trees A)
[PROOF STEP]
by (auto simp: random_bst_altdef measure_pmf_of_set map_pmf_rep_eq)
[PROOF STATE]
proof (state)
this:
restrict_space (measure_pmf (random_bst (set xs))) (trees A) = restrict_space (distr (uniform_measure (count_space UNIV) (permutations_of_set (set xs))) (count_space UNIV) bst_of_list) (trees A)

goal (1 subgoal):
 1. distr (random_perm xs) (count_space (trees A)) bst_of_list = restrict_space (measure_pmf (random_bst (set xs))) (trees A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
restrict_space (measure_pmf (random_bst (set xs))) (trees A) = restrict_space (distr (uniform_measure (count_space UNIV) (permutations_of_set (set xs))) (count_space UNIV) bst_of_list) (trees A)

goal (1 subgoal):
 1. distr (random_perm xs) (count_space (trees A)) bst_of_list = restrict_space (measure_pmf (random_bst (set xs))) (trees A)
[PROOF STEP]
have "distr (uniform_measure (count_space UNIV) (permutations_of_set (set xs)))
                   (count_space UNIV) bst_of_list =
               distr (random_perm xs) (count_space UNIV) bst_of_list"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (uniform_measure (count_space UNIV) (permutations_of_set (set xs))) (count_space UNIV) bst_of_list = distr (random_perm xs) (count_space UNIV) bst_of_list
[PROOF STEP]
by (intro distr_restrict) (auto simp: random_perm_def)
[PROOF STATE]
proof (state)
this:
distr (uniform_measure (count_space UNIV) (permutations_of_set (set xs))) (count_space UNIV) bst_of_list = distr (random_perm xs) (count_space UNIV) bst_of_list

goal (1 subgoal):
 1. distr (random_perm xs) (count_space (trees A)) bst_of_list = restrict_space (measure_pmf (random_bst (set xs))) (trees A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
distr (uniform_measure (count_space UNIV) (permutations_of_set (set xs))) (count_space UNIV) bst_of_list = distr (random_perm xs) (count_space UNIV) bst_of_list

goal (1 subgoal):
 1. distr (random_perm xs) (count_space (trees A)) bst_of_list = restrict_space (measure_pmf (random_bst (set xs))) (trees A)
[PROOF STEP]
have "restrict_space \<dots> (trees A) =
               distr (random_perm xs) (count_space (trees A)) bst_of_list"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. restrict_space (distr (random_perm xs) (count_space UNIV) bst_of_list) (trees A) = distr (random_perm xs) (count_space (trees A)) bst_of_list
[PROOF STEP]
using con_assms
[PROOF STATE]
proof (prove)
using this:
countable A
set xs \<subseteq> A
distinct xs

goal (1 subgoal):
 1. restrict_space (distr (random_perm xs) (count_space UNIV) bst_of_list) (trees A) = distr (random_perm xs) (count_space (trees A)) bst_of_list
[PROOF STEP]
by (subst restrict_distr)
       (auto simp: random_perm_def bst_of_list_trees restrict_count_space permutations_of_setD)
[PROOF STATE]
proof (state)
this:
restrict_space (distr (random_perm xs) (count_space UNIV) bst_of_list) (trees A) = distr (random_perm xs) (count_space (trees A)) bst_of_list

goal (1 subgoal):
 1. distr (random_perm xs) (count_space (trees A)) bst_of_list = restrict_space (measure_pmf (random_bst (set xs))) (trees A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
restrict_space (measure_pmf (random_bst (set xs))) (trees A) = distr (random_perm xs) (count_space (trees A)) bst_of_list
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
restrict_space (measure_pmf (random_bst (set xs))) (trees A) = distr (random_perm xs) (count_space (trees A)) bst_of_list

goal (1 subgoal):
 1. distr (random_perm xs) (count_space (trees A)) bst_of_list = restrict_space (measure_pmf (random_bst (set xs))) (trees A)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
distr (random_perm xs) (count_space (trees A)) bst_of_list = restrict_space (measure_pmf (random_bst (set xs))) (trees A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in ring) univ_poly_units:
  assumes "subfield K R" shows "Units (K[X]) = { [ k ] | k. k \<in> K - { \<zero> } }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Units (K [X]) = {[k] |k. k \<in> K - {\<zero>}}
[PROOF STEP]
using field.univ_poly_carrier_units[OF subfield_iff(2)[OF assms]]
        univ_poly_consistent[OF subfieldE(1)[OF assms]]
[PROOF STATE]
proof (prove)
using this:
Units (poly_ring (R\<lparr>carrier := K\<rparr>)) = {[k] |k. k \<in> carrier (R\<lparr>carrier := K\<rparr>) - {\<zero>\<^bsub>R\<lparr>carrier := K\<rparr>\<^esub>}}
univ_poly (R\<lparr>carrier := K\<rparr>) = univ_poly R

goal (1 subgoal):
 1. Units (K [X]) = {[k] |k. k \<in> K - {\<zero>}}
[PROOF STEP]
by auto


[STATEMENT]
lemma transpose_scalar: "transpose (k *\<^sub>R A) = k *\<^sub>R transpose A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose (k *\<^sub>R A) = k *\<^sub>R Finite_Cartesian_Product.transpose A
[PROOF STEP]
unfolding transpose_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i j. (k *\<^sub>R A) $ j $ i) = k *\<^sub>R (\<chi>i j. A $ j $ i)
[PROOF STEP]
by (simp add: vec_eq_iff)


[STATEMENT]
lemma ncols_diagonal_to_Smith[simp]: "ncols (diagonal_to_Smith A bezout) = ncols A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ncols (diagonal_to_Smith A bezout) = ncols A
[PROOF STEP]
unfolding diagonal_to_Smith_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ncols (diagonal_to_Smith_aux A [0..<min (nrows A) (ncols A) - 1] bezout) = ncols A
[PROOF STEP]
by auto


[STATEMENT]
lemma setdist_le_dist: "\<lbrakk>x \<in> s; y \<in> t\<rbrakk> \<Longrightarrow> setdist s t \<le> dist x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> s; y \<in> t\<rbrakk> \<Longrightarrow> setdist s t \<le> dist x y
[PROOF STEP]
unfolding setdist_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> s; y \<in> t\<rbrakk> \<Longrightarrow> (if s = {} \<or> t = {} then 0 else Inf {dist x y |x y. x \<in> s \<and> y \<in> t}) \<le> dist x y
[PROOF STEP]
by (auto intro!: bdd_belowI [where m=0] cInf_lower)


[STATEMENT]
theorem awp_iff_constrains: "(A <= awp F B) = (F \<in> A co B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<subseteq> awp F B) = (F \<in> A co B)
[PROOF STEP]
by (simp add: awp_def constrains_def wp_iff INT_subset_iff)


[STATEMENT]
lemma polyadd_different_degree:
  "isnpolyh p n0 \<Longrightarrow> isnpolyh q n1 \<Longrightarrow> degree p \<noteq> degree q \<Longrightarrow>
    degree (polyadd p q) = max (degree p) (degree q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>isnpolyh p n0; isnpolyh q n1; Reflected_Multivariate_Polynomial.degree p \<noteq> Reflected_Multivariate_Polynomial.degree q\<rbrakk> \<Longrightarrow> Reflected_Multivariate_Polynomial.degree (p +\<^sub>p q) = max (Reflected_Multivariate_Polynomial.degree p) (Reflected_Multivariate_Polynomial.degree q)
[PROOF STEP]
using polyadd_different_degreen degree_eq_degreen0
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>isnpolyh ?p ?n0.0; isnpolyh ?q ?n1.0; degreen ?p ?m \<noteq> degreen ?q ?m; ?m \<le> min ?n0.0 ?n1.0\<rbrakk> \<Longrightarrow> degreen (?p +\<^sub>p ?q) ?m = max (degreen ?p ?m) (degreen ?q ?m)
Reflected_Multivariate_Polynomial.degree ?p = degreen ?p 0

goal (1 subgoal):
 1. \<lbrakk>isnpolyh p n0; isnpolyh q n1; Reflected_Multivariate_Polynomial.degree p \<noteq> Reflected_Multivariate_Polynomial.degree q\<rbrakk> \<Longrightarrow> Reflected_Multivariate_Polynomial.degree (p +\<^sub>p q) = max (Reflected_Multivariate_Polynomial.degree p) (Reflected_Multivariate_Polynomial.degree q)
[PROOF STEP]
by simp


[STATEMENT]
lemma interior_closure: "interior S = - (closure (- S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interior S = - closure (- S)
[PROOF STEP]
by (auto simp: interior_def closure_def islimpt_def)


[STATEMENT]
lemma hash_prob_single:
  assumes "field F \<and> finite (carrier F)"
  assumes "x \<in> carrier F"
  assumes "1 \<le> n"
  assumes "y \<in> carrier F"
  shows
    "\<P>(\<omega> in pmf_of_set (bounded_degree_polynomials F n). ring.hash F x \<omega> = y)
      = 1/(real (card (carrier F)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (pmf_of_set (bounded_degree_polynomials F n)) {\<omega> \<in> space (measure_pmf (pmf_of_set (bounded_degree_polynomials F n))). ring.hash F x \<omega> = y} = 1 / real (card (carrier F))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. measure_pmf.prob (pmf_of_set (bounded_degree_polynomials F n)) {\<omega> \<in> space (measure_pmf (pmf_of_set (bounded_degree_polynomials F n))). ring.hash F x \<omega> = y} = 1 / real (card (carrier F))
[PROOF STEP]
interpret carter_wegman_hash_family "F" "n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carter_wegman_hash_family F n
[PROOF STEP]
using assms carter_wegman_hash_familyI
[PROOF STATE]
proof (prove)
using this:
field F \<and> finite (carrier F)
x \<in> carrier F
1 \<le> n
y \<in> carrier F
\<lbrakk>field ?F; finite (carrier ?F); 0 < ?k\<rbrakk> \<Longrightarrow> carter_wegman_hash_family ?F ?k

goal (1 subgoal):
 1. carter_wegman_hash_family F n
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. measure_pmf.prob (pmf_of_set (bounded_degree_polynomials F n)) {\<omega> \<in> Sigma_Algebra.space (measure_pmf (pmf_of_set (bounded_degree_polynomials F n))). hash x \<omega> = y} = 1 / real field_size
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (pmf_of_set (bounded_degree_polynomials F n)) {\<omega> \<in> Sigma_Algebra.space (measure_pmf (pmf_of_set (bounded_degree_polynomials F n))). hash x \<omega> = y} = 1 / real field_size
[PROOF STEP]
using prob_single[OF assms(2,4)]
[PROOF STATE]
proof (prove)
using this:
prob {\<omega>. hash x \<omega> = y} = 1 / real field_size

goal (1 subgoal):
 1. measure_pmf.prob (pmf_of_set (bounded_degree_polynomials F n)) {\<omega> \<in> Sigma_Algebra.space (measure_pmf (pmf_of_set (bounded_degree_polynomials F n))). hash x \<omega> = y} = 1 / real field_size
[PROOF STEP]
by (simp add:M_def space_def)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (pmf_of_set (bounded_degree_polynomials F n)) {\<omega> \<in> Sigma_Algebra.space (measure_pmf (pmf_of_set (bounded_degree_polynomials F n))). hash x \<omega> = y} = 1 / real field_size

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arccos_minus: "-1 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> arccos (- x) = pi - arccos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- 1 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> arccos (- x) = pi - arccos x
[PROOF STEP]
by (metis arccos_cos arccos_cos2 cos_minus_pi cos_total diff_le_0_iff_le le_add_same_cancel1
      minus_diff_eq uminus_add_conv_diff)


[STATEMENT]
lemma mirror_elem_less_conv: "
  \<lbrakk> finite I; a \<in> I; b \<in> I \<rbrakk> \<Longrightarrow>
  (mirror_elem b I < mirror_elem a I) = (a < b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; a \<in> I; b \<in> I\<rbrakk> \<Longrightarrow> (mirror_elem b I < mirror_elem a I) = (a < b)
[PROOF STEP]
unfolding mirror_elem_def nat_mirror_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; a \<in> I; b \<in> I\<rbrakk> \<Longrightarrow> (iMin I + Max I - b < iMin I + Max I - a) = (a < b)
[PROOF STEP]
by (metis diff_less_mono2 nat_diff_left_cancel_less nat_ex_greater_infinite_finite_Max_conv' trans_less_add2)


[STATEMENT]
lemma prefixes_rev: "prefixes (rev xs) = map rev (suffixes xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prefixes (rev xs) = map rev (suffixes xs)
[PROOF STEP]
by (induction xs) auto


[STATEMENT]
lemma eNorm_eq_lnorm: "\<lbrakk>f \<in> lspace M p; p > 0\<rbrakk> \<Longrightarrow> eNorm (\<LL> (ennreal p) M) f = ennreal (lnorm M p f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> lspace M (ennreal p); 0 < p\<rbrakk> \<Longrightarrow> eNorm (\<LL> (ennreal p) M) f = ennreal (lnorm M p f)
[PROOF STEP]
by (simp add: Lp_D(4) lnorm_def)


[STATEMENT]
lemma (in information_space) mutual_information_eq_entropy_conditional_entropy:
  assumes sf_X: "simple_function M X" and sf_Y: "simple_function M Y"
  shows  "\<I>(X ; Y) = \<H>(X) - \<H>(X | Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<I>(X ; Y) = \<H>(X) - \<H>(X | Y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<I>(X ; Y) = \<H>(X) - \<H>(X | Y)
[PROOF STEP]
have X: "simple_distributed M X (\<lambda>x. measure M (X -` {x} \<inter> space M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simple_distributed M X (\<lambda>x. prob (X -` {x} \<inter> space M))
[PROOF STEP]
using sf_X
[PROOF STATE]
proof (prove)
using this:
simple_function M X

goal (1 subgoal):
 1. simple_distributed M X (\<lambda>x. prob (X -` {x} \<inter> space M))
[PROOF STEP]
by (rule simple_distributedI) (auto simp: measure_nonneg)
[PROOF STATE]
proof (state)
this:
simple_distributed M X (\<lambda>x. prob (X -` {x} \<inter> space M))

goal (1 subgoal):
 1. \<I>(X ; Y) = \<H>(X) - \<H>(X | Y)
[PROOF STEP]
have Y: "simple_distributed M Y (\<lambda>x. measure M (Y -` {x} \<inter> space M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simple_distributed M Y (\<lambda>x. prob (Y -` {x} \<inter> space M))
[PROOF STEP]
using sf_Y
[PROOF STATE]
proof (prove)
using this:
simple_function M Y

goal (1 subgoal):
 1. simple_distributed M Y (\<lambda>x. prob (Y -` {x} \<inter> space M))
[PROOF STEP]
by (rule simple_distributedI) (auto simp: measure_nonneg)
[PROOF STATE]
proof (state)
this:
simple_distributed M Y (\<lambda>x. prob (Y -` {x} \<inter> space M))

goal (1 subgoal):
 1. \<I>(X ; Y) = \<H>(X) - \<H>(X | Y)
[PROOF STEP]
have sf_XY: "simple_function M (\<lambda>x. (X x, Y x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simple_function M (\<lambda>x. (X x, Y x))
[PROOF STEP]
using sf_X sf_Y
[PROOF STATE]
proof (prove)
using this:
simple_function M X
simple_function M Y

goal (1 subgoal):
 1. simple_function M (\<lambda>x. (X x, Y x))
[PROOF STEP]
by (rule simple_function_Pair)
[PROOF STATE]
proof (state)
this:
simple_function M (\<lambda>x. (X x, Y x))

goal (1 subgoal):
 1. \<I>(X ; Y) = \<H>(X) - \<H>(X | Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
simple_function M (\<lambda>x. (X x, Y x))
[PROOF STEP]
have XY: "simple_distributed M (\<lambda>x. (X x, Y x)) (\<lambda>x. measure M ((\<lambda>x. (X x, Y x)) -` {x} \<inter> space M))"
[PROOF STATE]
proof (prove)
using this:
simple_function M (\<lambda>x. (X x, Y x))

goal (1 subgoal):
 1. simple_distributed M (\<lambda>x. (X x, Y x)) (\<lambda>x. prob ((\<lambda>x. (X x, Y x)) -` {x} \<inter> space M))
[PROOF STEP]
by (rule simple_distributedI) (auto simp: measure_nonneg)
[PROOF STATE]
proof (state)
this:
simple_distributed M (\<lambda>x. (X x, Y x)) (\<lambda>x. prob ((\<lambda>x. (X x, Y x)) -` {x} \<inter> space M))

goal (1 subgoal):
 1. \<I>(X ; Y) = \<H>(X) - \<H>(X | Y)
[PROOF STEP]
from simple_distributed_joint_finite[OF this, simp]
[PROOF STATE]
proof (chain)
picking this:
finite (X ` space M)
finite (Y ` space M)
[PROOF STEP]
have eq: "count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) = count_space (X ` space M \<times> Y ` space M)"
[PROOF STATE]
proof (prove)
using this:
finite (X ` space M)
finite (Y ` space M)

goal (1 subgoal):
 1. count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) = count_space (X ` space M \<times> Y ` space M)
[PROOF STEP]
by (simp add: pair_measure_count_space)
[PROOF STATE]
proof (state)
this:
count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) = count_space (X ` space M \<times> Y ` space M)

goal (1 subgoal):
 1. \<I>(X ; Y) = \<H>(X) - \<H>(X | Y)
[PROOF STEP]
have "\<I>(X ; Y) = \<H>(X) + \<H>(Y) - entropy b (count_space (X`space M) \<Otimes>\<^sub>M count_space (Y`space M)) (\<lambda>x. (X x, Y x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<I>(X ; Y) = \<H>(X) + \<H>(Y) - entropy b (count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)) (\<lambda>x. (X x, Y x))
[PROOF STEP]
using sigma_finite_measure_count_space_finite
      sigma_finite_measure_count_space_finite
      simple_distributed[OF X] measure_nonneg simple_distributed[OF Y] measure_nonneg simple_distributed_joint[OF XY]
[PROOF STATE]
proof (prove)
using this:
finite ?A \<Longrightarrow> sigma_finite_measure (count_space ?A)
finite ?A \<Longrightarrow> sigma_finite_measure (count_space ?A)
distributed M (count_space (X ` space M)) X (\<lambda>x. ennreal (prob (X -` {x} \<inter> space M)))
0 \<le> Sigma_Algebra.measure ?M ?A
distributed M (count_space (Y ` space M)) Y (\<lambda>x. ennreal (prob (Y -` {x} \<inter> space M)))
0 \<le> Sigma_Algebra.measure ?M ?A
distributed M (count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)) (\<lambda>x. (X x, Y x)) (\<lambda>x. ennreal (if x \<in> (\<lambda>x. (X x, Y x)) ` space M then prob ((\<lambda>x. (X x, Y x)) -` {x} \<inter> space M) else 0))

goal (1 subgoal):
 1. \<I>(X ; Y) = \<H>(X) + \<H>(Y) - entropy b (count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)) (\<lambda>x. (X x, Y x))
[PROOF STEP]
by (rule mutual_information_eq_entropy_conditional_entropy_distr)
       (auto simp: eq integrable_count_space measure_nonneg)
[PROOF STATE]
proof (state)
this:
\<I>(X ; Y) = \<H>(X) + \<H>(Y) - entropy b (count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)) (\<lambda>x. (X x, Y x))

goal (1 subgoal):
 1. \<I>(X ; Y) = \<H>(X) - \<H>(X | Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<I>(X ; Y) = \<H>(X) + \<H>(Y) - entropy b (count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)) (\<lambda>x. (X x, Y x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<I>(X ; Y) = \<H>(X) + \<H>(Y) - entropy b (count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)) (\<lambda>x. (X x, Y x))

goal (1 subgoal):
 1. \<I>(X ; Y) = \<H>(X) - \<H>(X | Y)
[PROOF STEP]
unfolding conditional_entropy_eq_entropy_simple[OF sf_X sf_Y]
[PROOF STATE]
proof (prove)
using this:
\<I>(X ; Y) = \<H>(X) + \<H>(Y) - entropy b (count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)) (\<lambda>x. (X x, Y x))

goal (1 subgoal):
 1. \<I>(X ; Y) = \<H>(X) - (entropy b (count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)) (\<lambda>x. (X x, Y x)) - \<H>(Y))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<I>(X ; Y) = \<H>(X) - \<H>(X | Y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma radius_diameter_singleton_eq: assumes "card V = 1" shows "radius = diameter"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. radius = diameter
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. radius = diameter
[PROOF STEP]
obtain v where "V = {v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>v. V = {v} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms card_1_singletonE
[PROOF STATE]
proof (prove)
using this:
order = 1
\<lbrakk>card ?A = 1; \<And>x. ?A = {x} \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>v. V = {v} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V = {v}

goal (1 subgoal):
 1. radius = diameter
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
V = {v}

goal (1 subgoal):
 1. radius = diameter
[PROOF STEP]
unfolding radius_def diameter_def
[PROOF STATE]
proof (prove)
using this:
V = {v}

goal (1 subgoal):
 1. Inf (eccentricity ` V) = Sup (eccentricity ` V)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
radius = diameter

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma basis_orthogonal':
  fixes xs::"('a::{real_inner}^'b) list"
  shows "length (Gram_Schmidt xs) = length (xs) \<and>
        span (set (Gram_Schmidt xs)) = span (set xs) \<and>
        pairwise orthogonal (set (Gram_Schmidt xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (Gram_Schmidt xs) = length xs \<and> span (set (Gram_Schmidt xs)) = span (set xs) \<and> pairwise orthogonal (set (Gram_Schmidt xs))
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length (Gram_Schmidt []) = length [] \<and> span (set (Gram_Schmidt [])) = span (set []) \<and> pairwise orthogonal (set (Gram_Schmidt []))
 2. \<And>a xs. length (Gram_Schmidt xs) = length xs \<and> span (set (Gram_Schmidt xs)) = span (set xs) \<and> pairwise orthogonal (set (Gram_Schmidt xs)) \<Longrightarrow> length (Gram_Schmidt (a # xs)) = length (a # xs) \<and> span (set (Gram_Schmidt (a # xs))) = span (set (a # xs)) \<and> pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. length (Gram_Schmidt []) = length [] \<and> span (set (Gram_Schmidt [])) = span (set []) \<and> pairwise orthogonal (set (Gram_Schmidt []))
 2. \<And>a xs. length (Gram_Schmidt xs) = length xs \<and> span (set (Gram_Schmidt xs)) = span (set xs) \<and> pairwise orthogonal (set (Gram_Schmidt xs)) \<Longrightarrow> length (Gram_Schmidt (a # xs)) = length (a # xs) \<and> span (set (Gram_Schmidt (a # xs))) = span (set (a # xs)) \<and> pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (Gram_Schmidt []) = length [] \<and> span (set (Gram_Schmidt [])) = span (set []) \<and> pairwise orthogonal (set (Gram_Schmidt []))
[PROOF STEP]
unfolding Gram_Schmidt_def pairwise_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (foldr Gram_Schmidt_step [] []) = length [] \<and> span (set (foldr Gram_Schmidt_step [] [])) = span (set []) \<and> (\<forall>x\<in>set (foldr Gram_Schmidt_step [] []). \<forall>y\<in>set (foldr Gram_Schmidt_step [] []). x \<noteq> y \<longrightarrow> orthogonal x y)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
length (Gram_Schmidt []) = length [] \<and> span (set (Gram_Schmidt [])) = span (set []) \<and> pairwise orthogonal (set (Gram_Schmidt []))

goal (1 subgoal):
 1. \<And>a xs. length (Gram_Schmidt xs) = length xs \<and> span (set (Gram_Schmidt xs)) = span (set xs) \<and> pairwise orthogonal (set (Gram_Schmidt xs)) \<Longrightarrow> length (Gram_Schmidt (a # xs)) = length (a # xs) \<and> span (set (Gram_Schmidt (a # xs))) = span (set (a # xs)) \<and> pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. length (Gram_Schmidt xs) = length xs \<and> span (set (Gram_Schmidt xs)) = span (set xs) \<and> pairwise orthogonal (set (Gram_Schmidt xs)) \<Longrightarrow> length (Gram_Schmidt (a # xs)) = length (a # xs) \<and> span (set (Gram_Schmidt (a # xs))) = span (set (a # xs)) \<and> pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
case (Cons a xs)
[PROOF STATE]
proof (state)
this:
length (Gram_Schmidt xs) = length xs \<and> span (set (Gram_Schmidt xs)) = span (set xs) \<and> pairwise orthogonal (set (Gram_Schmidt xs))

goal (1 subgoal):
 1. \<And>a xs. length (Gram_Schmidt xs) = length xs \<and> span (set (Gram_Schmidt xs)) = span (set xs) \<and> pairwise orthogonal (set (Gram_Schmidt xs)) \<Longrightarrow> length (Gram_Schmidt (a # xs)) = length (a # xs) \<and> span (set (Gram_Schmidt (a # xs))) = span (set (a # xs)) \<and> pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
have l: "length (Gram_Schmidt xs) = length xs"
    and s: "span (set (Gram_Schmidt xs)) = span (set xs)"
    and p: "pairwise orthogonal (set (Gram_Schmidt xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (Gram_Schmidt xs) = length xs &&& span (set (Gram_Schmidt xs)) = span (set xs) &&& pairwise orthogonal (set (Gram_Schmidt xs))
[PROOF STEP]
using Cons.hyps
[PROOF STATE]
proof (prove)
using this:
length (Gram_Schmidt xs) = length xs \<and> span (set (Gram_Schmidt xs)) = span (set xs) \<and> pairwise orthogonal (set (Gram_Schmidt xs))

goal (1 subgoal):
 1. length (Gram_Schmidt xs) = length xs &&& span (set (Gram_Schmidt xs)) = span (set xs) &&& pairwise orthogonal (set (Gram_Schmidt xs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (Gram_Schmidt xs) = length xs
span (set (Gram_Schmidt xs)) = span (set xs)
pairwise orthogonal (set (Gram_Schmidt xs))

goal (1 subgoal):
 1. \<And>a xs. length (Gram_Schmidt xs) = length xs \<and> span (set (Gram_Schmidt xs)) = span (set xs) \<and> pairwise orthogonal (set (Gram_Schmidt xs)) \<Longrightarrow> length (Gram_Schmidt (a # xs)) = length (a # xs) \<and> span (set (Gram_Schmidt (a # xs))) = span (set (a # xs)) \<and> pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
show "length (Gram_Schmidt (a # xs)) = length (a # xs) \<and>
    span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))
    \<and> pairwise orthogonal (set (Gram_Schmidt (a # xs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (Gram_Schmidt (a # xs)) = length (a # xs) \<and> span (set (Gram_Schmidt (a # xs))) = span (set (a # xs)) \<and> pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length (Gram_Schmidt (a # xs)) = length (a # xs)
 2. span (set (Gram_Schmidt (a # xs))) = span (set (a # xs)) \<and> pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
show "length (Gram_Schmidt (a # xs)) = length (a # xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (Gram_Schmidt (a # xs)) = length (a # xs)
[PROOF STEP]
unfolding Gram_Schmidt_cons
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (Gram_Schmidt_step a (Gram_Schmidt xs)) = length (a # xs)
[PROOF STEP]
unfolding Gram_Schmidt_step_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (Gram_Schmidt xs @ [a - proj_onto a (set (Gram_Schmidt xs))]) = length (a # xs)
[PROOF STEP]
using l
[PROOF STATE]
proof (prove)
using this:
length (Gram_Schmidt xs) = length xs

goal (1 subgoal):
 1. length (Gram_Schmidt xs @ [a - proj_onto a (set (Gram_Schmidt xs))]) = length (a # xs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (Gram_Schmidt (a # xs)) = length (a # xs)

goal (1 subgoal):
 1. span (set (Gram_Schmidt (a # xs))) = span (set (a # xs)) \<and> pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
show "span (set (Gram_Schmidt (a # xs)))
      = span (set (a # xs)) \<and> pairwise orthogonal (set (Gram_Schmidt (a # xs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span (set (Gram_Schmidt (a # xs))) = span (set (a # xs)) \<and> pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))
 2. pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
have set_rw1: "set (a # xs) = insert a (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (a # xs) = insert a (set xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (a # xs) = insert a (set xs)

goal (2 subgoals):
 1. span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))
 2. pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
have set_rw2: "set (Gram_Schmidt (a # xs))
        = (insert (a - (\<Sum>x\<in>set (Gram_Schmidt xs). (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x)) (set (Gram_Schmidt xs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (Gram_Schmidt (a # xs)) = insert (a - (\<Sum>x\<in>set (Gram_Schmidt xs). (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x)) (set (Gram_Schmidt xs))
[PROOF STEP]
unfolding Gram_Schmidt_cons Gram_Schmidt_step_def proj_onto_def proj_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (Gram_Schmidt xs @ [a - (\<Sum>u\<in>set (Gram_Schmidt xs). (a \<bullet> u / (u \<bullet> u)) *\<^sub>R u)]) = insert (a - (\<Sum>x\<in>set (Gram_Schmidt xs). (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x)) (set (Gram_Schmidt xs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (Gram_Schmidt (a # xs)) = insert (a - (\<Sum>x\<in>set (Gram_Schmidt xs). (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x)) (set (Gram_Schmidt xs))

goal (2 subgoals):
 1. span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))
 2. pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
define C where "C = set (Gram_Schmidt xs)"
[PROOF STATE]
proof (state)
this:
C = set (Gram_Schmidt xs)

goal (2 subgoals):
 1. span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))
 2. pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
have finite_C: "finite C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite C
[PROOF STEP]
unfolding C_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (set (Gram_Schmidt xs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite C

goal (2 subgoals):
 1. span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))
 2. pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
finite C

goal (2 subgoals):
 1. span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))
 2. pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
fix x k
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))
 2. pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
have th0: "!!(a::'a^'b) b c. a - (b - c) = c + (a - b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b c. a - (b - c) = c + (a - b)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
?a - (?b - ?c) = ?c + (?a - ?b)

goal (2 subgoals):
 1. span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))
 2. pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
have "x - k *\<^sub>R (a - (\<Sum>x\<in>C. (a \<bullet> x / (x \<bullet>  x)) *\<^sub>R x)) \<in> span C
          \<longleftrightarrow> x - k *\<^sub>R a \<in> span C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - k *\<^sub>R (a - (\<Sum>x\<in>C. (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x)) \<in> span C) = (x - k *\<^sub>R a \<in> span C)
[PROOF STEP]
apply (simp only: scaleR_right_diff_distrib th0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (k *\<^sub>R (\<Sum>x\<in>C. (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x) + (x - k *\<^sub>R a) \<in> span C) = (x - k *\<^sub>R a \<in> span C)
[PROOF STEP]
apply (rule span_add_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k *\<^sub>R (\<Sum>x\<in>C. (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x) \<in> span C
[PROOF STEP]
apply (rule span_mul)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>C. (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x) \<in> span C
[PROOF STEP]
apply (rule span_sum)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> C \<Longrightarrow> (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x \<in> span C
[PROOF STEP]
apply (rule span_mul)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> C \<Longrightarrow> x \<in> span C
[PROOF STEP]
apply (rule span_base)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> C \<Longrightarrow> x \<in> C
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(x - k *\<^sub>R (a - (\<Sum>x\<in>C. (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x)) \<in> span C) = (x - k *\<^sub>R a \<in> span C)

goal (2 subgoals):
 1. span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))
 2. pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(?x2 - ?k2 *\<^sub>R (a - (\<Sum>x\<in>C. (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x)) \<in> span C) = (?x2 - ?k2 *\<^sub>R a \<in> span C)

goal (2 subgoals):
 1. span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))
 2. pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(?x2 - ?k2 *\<^sub>R (a - (\<Sum>x\<in>C. (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x)) \<in> span C) = (?x2 - ?k2 *\<^sub>R a \<in> span C)
[PROOF STEP]
show "span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))"
[PROOF STATE]
proof (prove)
using this:
(?x2 - ?k2 *\<^sub>R (a - (\<Sum>x\<in>C. (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x)) \<in> span C) = (?x2 - ?k2 *\<^sub>R a \<in> span C)

goal (1 subgoal):
 1. span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))
[PROOF STEP]
unfolding set_eq_iff set_rw2 set_rw1 span_breakdown_eq C_def s[symmetric]
[PROOF STATE]
proof (prove)
using this:
(?x2 - ?k2 *\<^sub>R (a - (\<Sum>x\<in>set (Gram_Schmidt xs). (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x)) \<in> span (set (Gram_Schmidt xs))) = (?x2 - ?k2 *\<^sub>R a \<in> span (set (Gram_Schmidt xs)))

goal (1 subgoal):
 1. \<forall>x. (\<exists>k. x - k *\<^sub>R (a - (\<Sum>x\<in>set (Gram_Schmidt xs). (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x)) \<in> span (set (Gram_Schmidt xs))) = (\<exists>k. x - k *\<^sub>R a \<in> span (set (Gram_Schmidt xs)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))

goal (1 subgoal):
 1. pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
with p
[PROOF STATE]
proof (chain)
picking this:
pairwise orthogonal (set (Gram_Schmidt xs))
span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))
[PROOF STEP]
show "pairwise orthogonal (set (Gram_Schmidt (a # xs)))"
[PROOF STATE]
proof (prove)
using this:
pairwise orthogonal (set (Gram_Schmidt xs))
span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))

goal (1 subgoal):
 1. pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
using pairwise_orthogonal_proj_set[OF finite_C]
[PROOF STATE]
proof (prove)
using this:
pairwise orthogonal (set (Gram_Schmidt xs))
span (set (Gram_Schmidt (a # xs))) = span (set (a # xs))
pairwise orthogonal C \<Longrightarrow> pairwise orthogonal (insert (?a - proj_onto ?a C) C)

goal (1 subgoal):
 1. pairwise orthogonal (set (Gram_Schmidt (a # xs)))
[PROOF STEP]
unfolding set_rw2
[PROOF STATE]
proof (prove)
using this:
pairwise orthogonal (set (Gram_Schmidt xs))
span (insert (a - (\<Sum>x\<in>set (Gram_Schmidt xs). (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x)) (set (Gram_Schmidt xs))) = span (set (a # xs))
pairwise orthogonal C \<Longrightarrow> pairwise orthogonal (insert (?a - proj_onto ?a C) C)

goal (1 subgoal):
 1. pairwise orthogonal (insert (a - (\<Sum>x\<in>set (Gram_Schmidt xs). (a \<bullet> x / (x \<bullet> x)) *\<^sub>R x)) (set (Gram_Schmidt xs)))
[PROOF STEP]
unfolding C_def proj_def[symmetric] proj_onto_def[symmetric]
[PROOF STATE]
proof (prove)
using this:
pairwise orthogonal (set (Gram_Schmidt xs))
span (insert (a - proj_onto a (set (Gram_Schmidt xs))) (set (Gram_Schmidt xs))) = span (set (a # xs))
pairwise orthogonal (set (Gram_Schmidt xs)) \<Longrightarrow> pairwise orthogonal (insert (?a - proj_onto ?a (set (Gram_Schmidt xs))) (set (Gram_Schmidt xs)))

goal (1 subgoal):
 1. pairwise orthogonal (insert (a - proj_onto a (set (Gram_Schmidt xs))) (set (Gram_Schmidt xs)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pairwise orthogonal (set (Gram_Schmidt (a # xs)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
span (set (Gram_Schmidt (a # xs))) = span (set (a # xs)) \<and> pairwise orthogonal (set (Gram_Schmidt (a # xs)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
length (Gram_Schmidt (a # xs)) = length (a # xs) \<and> span (set (Gram_Schmidt (a # xs))) = span (set (a # xs)) \<and> pairwise orthogonal (set (Gram_Schmidt (a # xs)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma filtermap_nhds_shift: "filtermap (\<lambda>x. x - d) (nhds a) = nhds (a - d)"
  for a d :: "'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap (\<lambda>x. x - d) (nhds a) = nhds (a - d)
[PROOF STEP]
by (rule filtermap_fun_inverse[where g="\<lambda>x. x + d"])
    (auto intro!: tendsto_eq_intros filterlim_ident)


[STATEMENT]
lemma bigo_lesso4:
  "f <o g =o O(k::'a=>'b::{linordered_field}) \<Longrightarrow>
   g =o h +o O(k) \<Longrightarrow> f <o h =o O(k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f <o g \<in> O(k); g \<in> h +o O(k)\<rbrakk> \<Longrightarrow> f <o h \<in> O(k)
[PROOF STEP]
apply (unfold lesso_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(k); g \<in> h +o O(k)\<rbrakk> \<Longrightarrow> (\<lambda>x. max (f x - h x) (0::'b)) \<in> O(k)
[PROOF STEP]
apply (drule set_plus_imp_minus)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(k); g - h \<in> O(k)\<rbrakk> \<Longrightarrow> (\<lambda>x. max (f x - h x) (0::'b)) \<in> O(k)
[PROOF STEP]
apply (drule bigo_abs5)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g - h \<in> O(k); (\<lambda>x. \<bar>max (f x - g x) (0::'b)\<bar>) \<in> O(k)\<rbrakk> \<Longrightarrow> (\<lambda>x. max (f x - h x) (0::'b)) \<in> O(k)
[PROOF STEP]
back
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(k); (\<lambda>x. \<bar>(g - h) x\<bar>) \<in> O(k)\<rbrakk> \<Longrightarrow> (\<lambda>x. max (f x - h x) (0::'b)) \<in> O(k)
[PROOF STEP]
apply (simp add: fun_diff_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>x. max (f x - g x) (0::'b)) \<in> O(k); (\<lambda>x. \<bar>g x - h x\<bar>) \<in> O(k)\<rbrakk> \<Longrightarrow> (\<lambda>x. max (f x - h x) (0::'b)) \<in> O(k)
[PROOF STEP]
apply (drule bigo_useful_add, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>x. \<bar>g x - h x\<bar>) \<in> O(k); (\<lambda>x. max (f x - g x) (0::'b)) + (\<lambda>x. \<bar>g x - h x\<bar>) \<in> O(k)\<rbrakk> \<Longrightarrow> (\<lambda>x. max (f x - h x) (0::'b)) \<in> O(k)
[PROOF STEP]
apply (erule bigo_lesseq2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. max (f x - g x) (0::'b)) + (\<lambda>x. \<bar>g x - h x\<bar>) \<in> O(k) \<Longrightarrow> \<forall>x. \<bar>max (f x - h x) (0::'b)\<bar> \<le> \<bar>g x - h x\<bar>
[PROOF STEP]
back
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<bar>g x - h x\<bar>) \<in> O(k) \<Longrightarrow> \<forall>x. \<bar>max (f x - h x) (0::'b)\<bar> \<le> ((\<lambda>x. max (f x - g x) (0::'b)) + (\<lambda>x. \<bar>g x - h x\<bar>)) x
[PROOF STEP]
apply (rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (\<lambda>x. \<bar>g x - h x\<bar>) \<in> O(k) \<Longrightarrow> \<bar>max (f x - h x) (0::'b)\<bar> \<le> ((\<lambda>x. max (f x - g x) (0::'b)) + (\<lambda>x. \<bar>g x - h x\<bar>)) x
[PROOF STEP]
by (auto simp add: func_plus fun_diff_def algebra_simps
    split: split_max abs_split)