[STATEMENT]
lemma real_affinity_le: "0 < m \<Longrightarrow> m * x + c \<le> y \<longleftrightarrow> x \<le> inverse m * y + - (c / m)"
  for m :: "'a::linordered_field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < m \<Longrightarrow> (m * x + c \<le> y) = (x \<le> inverse m * y + - (c / m))
[PROOF STEP]
by (simp add: field_simps)


[STATEMENT]
lemma powhr_powhr_swap: "\<And>a b x. (x powhr a) powhr b = (x powhr b) powhr a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b x. (x powhr a) powhr b = (x powhr b) powhr a
[PROOF STEP]
by transfer (rule powr_powr_swap)


[STATEMENT]
lemma lnth_lappend_llist_of:
  "lnth (lappend (llist_of xs) ys) n =
  (if n < length xs then xs ! n else lnth ys (n - length xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lnth (lappend (llist_of xs) ys) n = (if n < length xs then xs ! n else lnth ys (n - length xs))
[PROOF STEP]
proof(induct xs arbitrary: n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. lnth (lappend (llist_of []) ys) n = (if n < length [] then [] ! n else lnth ys (n - length []))
 2. \<And>a xs n. (\<And>n. lnth (lappend (llist_of xs) ys) n = (if n < length xs then xs ! n else lnth ys (n - length xs))) \<Longrightarrow> lnth (lappend (llist_of (a # xs)) ys) n = (if n < length (a # xs) then (a # xs) ! n else lnth ys (n - length (a # xs)))
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
lnth (lappend (llist_of xs) ys) ?n = (if ?n < length xs then xs ! ?n else lnth ys (?n - length xs))

goal (2 subgoals):
 1. \<And>n. lnth (lappend (llist_of []) ys) n = (if n < length [] then [] ! n else lnth ys (n - length []))
 2. \<And>a xs n. (\<And>n. lnth (lappend (llist_of xs) ys) n = (if n < length xs then xs ! n else lnth ys (n - length xs))) \<Longrightarrow> lnth (lappend (llist_of (a # xs)) ys) n = (if n < length (a # xs) then (a # xs) ! n else lnth ys (n - length (a # xs)))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
lnth (lappend (llist_of xs) ys) ?n = (if ?n < length xs then xs ! ?n else lnth ys (?n - length xs))

goal (1 subgoal):
 1. lnth (lappend (llist_of (x # xs)) ys) n = (if n < length (x # xs) then (x # xs) ! n else lnth ys (n - length (x # xs)))
[PROOF STEP]
by(cases n) auto
[PROOF STATE]
proof (state)
this:
lnth (lappend (llist_of (x # xs)) ys) n = (if n < length (x # xs) then (x # xs) ! n else lnth ys (n - length (x # xs)))

goal (1 subgoal):
 1. \<And>n. lnth (lappend (llist_of []) ys) n = (if n < length [] then [] ! n else lnth ys (n - length []))
[PROOF STEP]
qed simp


[STATEMENT]
lemma ladD:
  assumes "lad f"
  assumes "\<And>x. x \<in> C \<Longrightarrow> x \<in> B"
  shows "card (f C) \<le> card (f B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (f C) \<le> card (f B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
lad f
?x \<in> C \<Longrightarrow> ?x \<in> B

goal (1 subgoal):
 1. card (f C) \<le> card (f B)
[PROOF STEP]
unfolding lad_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>B\<subseteq>UNIV. \<forall>C\<subseteq>B. card (f C) \<le> card (f B)
?x \<in> C \<Longrightarrow> ?x \<in> B

goal (1 subgoal):
 1. card (f C) \<le> card (f B)
[PROOF STEP]
by (simp add: subsetI)


[STATEMENT]
lemma floor_le_round: "\<lfloor>x\<rfloor> \<le> round x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>x\<rfloor> \<le> round x
[PROOF STEP]
unfolding round_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>x\<rfloor> \<le> \<lfloor>x + (1::'a) / (2::'a)\<rfloor>
[PROOF STEP]
by (intro floor_mono) simp


[STATEMENT]
lemma exp_inv_limit_0_right_gen':
  "((\<lambda>(t::real). inverse (t ^ k) / exp(inverse t)) \<longlongrightarrow> 0) (at_right 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. inverse (t ^ k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
proof (induct k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ((\<lambda>t. inverse (t ^ 0) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)
 2. \<And>k. ((\<lambda>t. inverse (t ^ k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0) \<Longrightarrow> ((\<lambda>t. inverse (t ^ Suc k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. ((\<lambda>t. inverse (t ^ 0) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)
 2. \<And>k. ((\<lambda>t. inverse (t ^ k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0) \<Longrightarrow> ((\<lambda>t. inverse (t ^ Suc k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. inverse (t ^ 0) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
using exp_inv_limit_0_right
[PROOF STATE]
proof (prove)
using this:
((\<lambda>t. exp (- inverse t)) \<longlongrightarrow> 0) (at_right 0)

goal (1 subgoal):
 1. ((\<lambda>t. inverse (t ^ 0) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
by (auto simp: exp_minus inverse_eq_divide)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. inverse (t ^ 0) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)

goal (1 subgoal):
 1. \<And>k. ((\<lambda>t. inverse (t ^ k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0) \<Longrightarrow> ((\<lambda>t. inverse (t ^ Suc k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. ((\<lambda>t. inverse (t ^ k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0) \<Longrightarrow> ((\<lambda>t. inverse (t ^ Suc k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. inverse (t ^ k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)

goal (1 subgoal):
 1. \<And>k. ((\<lambda>t. inverse (t ^ k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0) \<Longrightarrow> ((\<lambda>t. inverse (t ^ Suc k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
have df: "\<forall>\<^sub>F t in at_right 0. ((\<lambda>x. inverse (x ^ Suc k)) has_real_derivative
    - (inverse (t ^ k) * ((1 + real k)) * (inverse t ^ 2))) (at t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F t in at_right 0. ((\<lambda>x. inverse (x ^ Suc k)) has_real_derivative - (inverse (t ^ k) * (1 + real k) * (inverse t)\<^sup>2)) (at t)
[PROOF STEP]
unfolding eventually_at_filter
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds 0. x \<noteq> 0 \<longrightarrow> x \<in> {0<..} \<longrightarrow> ((\<lambda>x. inverse (x ^ Suc k)) has_real_derivative - (inverse (x ^ k) * (1 + real k) * (inverse x)\<^sup>2)) (at x)
[PROOF STEP]
apply (auto simp del: power_Suc intro!: derivative_eq_intros eventuallyI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 < x \<Longrightarrow> inverse (x ^ Suc k) * (x ^ k * inverse (x ^ Suc k)) = inverse (x ^ k) * (inverse x)\<^sup>2
[PROOF STEP]
by (auto simp: power2_eq_square)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F t in at_right 0. ((\<lambda>x. inverse (x ^ Suc k)) has_real_derivative - (inverse (t ^ k) * (1 + real k) * (inverse t)\<^sup>2)) (at t)

goal (1 subgoal):
 1. \<And>k. ((\<lambda>t. inverse (t ^ k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0) \<Longrightarrow> ((\<lambda>t. inverse (t ^ Suc k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
have dg: "\<forall>\<^sub>F t in at_right 0. ((\<lambda>x. exp (inverse x)) has_real_derivative
    - (exp (inverse t) * (inverse t ^ 2))) (at t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F t in at_right 0. ((\<lambda>x. exp (inverse x)) has_real_derivative - (exp (inverse t) * (inverse t)\<^sup>2)) (at t)
[PROOF STEP]
unfolding eventually_at_filter
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds 0. x \<noteq> 0 \<longrightarrow> x \<in> {0<..} \<longrightarrow> ((\<lambda>x. exp (inverse x)) has_real_derivative - (exp (inverse x) * (inverse x)\<^sup>2)) (at x)
[PROOF STEP]
by (auto simp del: power_Suc intro!: derivative_eq_intros eventuallyI simp: power2_eq_square)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F t in at_right 0. ((\<lambda>x. exp (inverse x)) has_real_derivative - (exp (inverse t) * (inverse t)\<^sup>2)) (at t)

goal (1 subgoal):
 1. \<And>k. ((\<lambda>t. inverse (t ^ k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0) \<Longrightarrow> ((\<lambda>t. inverse (t ^ Suc k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. inverse (t ^ Suc k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
apply (rule lhopital_right_0_at_top [OF _ _ df dg])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. LIM t at_right 0. exp (inverse t) :> at_top
 2. \<forall>\<^sub>F t in at_right 0. - (exp (inverse t) * (inverse t)\<^sup>2) \<noteq> 0
 3. ((\<lambda>t. - (inverse (t ^ k) * (1 + real k) * (inverse t)\<^sup>2) / - (exp (inverse t) * (inverse t)\<^sup>2)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
apply (rule filterlim_compose[where g = exp])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. filterlim exp at_top ?F2.6
 2. filterlim inverse ?F2.6 (at_right 0)
 3. \<forall>\<^sub>F t in at_right 0. - (exp (inverse t) * (inverse t)\<^sup>2) \<noteq> 0
 4. ((\<lambda>t. - (inverse (t ^ k) * (1 + real k) * (inverse t)\<^sup>2) / - (exp (inverse t) * (inverse t)\<^sup>2)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
apply (rule exp_at_top)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. filterlim inverse at_top (at_right 0)
 2. \<forall>\<^sub>F t in at_right 0. - (exp (inverse t) * (inverse t)\<^sup>2) \<noteq> 0
 3. ((\<lambda>t. - (inverse (t ^ k) * (1 + real k) * (inverse t)\<^sup>2) / - (exp (inverse t) * (inverse t)\<^sup>2)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
apply (rule filterlim_inverse_at_top_right)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>\<^sub>F t in at_right 0. - (exp (inverse t) * (inverse t)\<^sup>2) \<noteq> 0
 2. ((\<lambda>t. - (inverse (t ^ k) * (1 + real k) * (inverse t)\<^sup>2) / - (exp (inverse t) * (inverse t)\<^sup>2)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F t in at_right 0. - (exp (inverse t) * (inverse t)\<^sup>2) \<noteq> 0
[PROOF STEP]
by (auto simp: eventually_at_filter)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. - (inverse (t ^ k) * (1 + real k) * (inverse t)\<^sup>2) / - (exp (inverse t) * (inverse t)\<^sup>2)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. - (inverse (t ^ k) * (1 + real k) * (inverse t)\<^sup>2) / - (exp (inverse t) * (inverse t)\<^sup>2)) \<longlongrightarrow> 0) (at_right 0)
[PROOF STEP]
apply (rule Lim_transform_eventually[where f = "\<lambda>x. (1 + real k) * (inverse (x ^ k) / exp (inverse x))"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((\<lambda>x. (1 + real k) * (inverse (x ^ k) / exp (inverse x))) \<longlongrightarrow> 0) (at_right 0)
 2. \<forall>\<^sub>F x in at_right 0. (1 + real k) * (inverse (x ^ k) / exp (inverse x)) = - (inverse (x ^ k) * (1 + real k) * (inverse x)\<^sup>2) / - (exp (inverse x) * (inverse x)\<^sup>2)
[PROOF STEP]
using Suc.hyps tendsto_mult_right_zero
[PROOF STATE]
proof (prove)
using this:
((\<lambda>t. inverse (t ^ k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)
(?f \<longlongrightarrow> (0::?'a)) ?F \<Longrightarrow> ((\<lambda>x. ?c * ?f x) \<longlongrightarrow> (0::?'a)) ?F

goal (2 subgoals):
 1. ((\<lambda>x. (1 + real k) * (inverse (x ^ k) / exp (inverse x))) \<longlongrightarrow> 0) (at_right 0)
 2. \<forall>\<^sub>F x in at_right 0. (1 + real k) * (inverse (x ^ k) / exp (inverse x)) = - (inverse (x ^ k) * (1 + real k) * (inverse x)\<^sup>2) / - (exp (inverse x) * (inverse x)\<^sup>2)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_right 0. (1 + real k) * (inverse (x ^ k) / exp (inverse x)) = - (inverse (x ^ k) * (1 + real k) * (inverse x)\<^sup>2) / - (exp (inverse x) * (inverse x)\<^sup>2)
[PROOF STEP]
by (auto simp: eventually_at_filter)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
((\<lambda>t. inverse (t ^ Suc k) / exp (inverse t)) \<longlongrightarrow> 0) (at_right 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reflexive_mult_closed:
  "reflexive x \<Longrightarrow> reflexive y \<Longrightarrow> reflexive (x * y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>reflexive x; reflexive y\<rbrakk> \<Longrightarrow> reflexive (x * y)
[PROOF STEP]
using mult_isotone
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?w \<le> ?y; ?x \<le> ?z\<rbrakk> \<Longrightarrow> ?w * ?x \<le> ?y * ?z

goal (1 subgoal):
 1. \<lbrakk>reflexive x; reflexive y\<rbrakk> \<Longrightarrow> reflexive (x * y)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma hyperpow_ge_zero: "\<And>r n. (0::'a::{linordered_semidom} star) \<le> r \<Longrightarrow> 0 \<le> r pow n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r n. 0 \<le> r \<Longrightarrow> 0 \<le> r pow n
[PROOF STEP]
by transfer (rule zero_le_power)


[STATEMENT]
lemma append_eq_append_conv2: "(xs @ ys = zs @ ts) =
  (\<exists>us. xs = zs @ us \<and> us @ ys = ts \<or> xs @ us = zs \<and> ys = us @ ts)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs @ ys = zs @ ts) = (\<exists>us. xs = zs @ us \<and> us @ ys = ts \<or> xs @ us = zs \<and> ys = us @ ts)
[PROOF STEP]
proof (induct xs arbitrary: ys zs ts)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ys zs ts. ([] @ ys = zs @ ts) = (\<exists>us. [] = zs @ us \<and> us @ ys = ts \<or> [] @ us = zs \<and> ys = us @ ts)
 2. \<And>a xs ys zs ts. (\<And>ys zs ts. (xs @ ys = zs @ ts) = (\<exists>us. xs = zs @ us \<and> us @ ys = ts \<or> xs @ us = zs \<and> ys = us @ ts)) \<Longrightarrow> ((a # xs) @ ys = zs @ ts) = (\<exists>us. a # xs = zs @ us \<and> us @ ys = ts \<or> (a # xs) @ us = zs \<and> ys = us @ ts)
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
(xs @ ?ys = ?zs @ ?ts) = (\<exists>us. xs = ?zs @ us \<and> us @ ?ys = ?ts \<or> xs @ us = ?zs \<and> ?ys = us @ ?ts)

goal (2 subgoals):
 1. \<And>ys zs ts. ([] @ ys = zs @ ts) = (\<exists>us. [] = zs @ us \<and> us @ ys = ts \<or> [] @ us = zs \<and> ys = us @ ts)
 2. \<And>a xs ys zs ts. (\<And>ys zs ts. (xs @ ys = zs @ ts) = (\<exists>us. xs = zs @ us \<and> us @ ys = ts \<or> xs @ us = zs \<and> ys = us @ ts)) \<Longrightarrow> ((a # xs) @ ys = zs @ ts) = (\<exists>us. a # xs = zs @ us \<and> us @ ys = ts \<or> (a # xs) @ us = zs \<and> ys = us @ ts)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(xs @ ?ys = ?zs @ ?ts) = (\<exists>us. xs = ?zs @ us \<and> us @ ?ys = ?ts \<or> xs @ us = ?zs \<and> ?ys = us @ ?ts)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(xs @ ?ys = ?zs @ ?ts) = (\<exists>us. xs = ?zs @ us \<and> us @ ?ys = ?ts \<or> xs @ us = ?zs \<and> ?ys = us @ ?ts)

goal (1 subgoal):
 1. ((x # xs) @ ys = zs @ ts) = (\<exists>us. x # xs = zs @ us \<and> us @ ys = ts \<or> (x # xs) @ us = zs \<and> ys = us @ ts)
[PROOF STEP]
by (cases zs) auto
[PROOF STATE]
proof (state)
this:
((x # xs) @ ys = zs @ ts) = (\<exists>us. x # xs = zs @ us \<and> us @ ys = ts \<or> (x # xs) @ us = zs \<and> ys = us @ ts)

goal (1 subgoal):
 1. \<And>ys zs ts. ([] @ ys = zs @ ts) = (\<exists>us. [] = zs @ us \<and> us @ ys = ts \<or> [] @ us = zs \<and> ys = us @ ts)
[PROOF STEP]
qed fastforce


[STATEMENT]
lemma rank_1_proj_adjoint:
  shows "Complex_Matrix.adjoint (rank_1_proj (v::complex Matrix.vec)) = rank_1_proj v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint (rank_1_proj v) = rank_1_proj v
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (rank_1_proj v); j < dim_col (rank_1_proj v)\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)
 2. dim_row (Complex_Matrix.adjoint (rank_1_proj v)) = dim_row (rank_1_proj v)
 3. dim_col (Complex_Matrix.adjoint (rank_1_proj v)) = dim_col (rank_1_proj v)
[PROOF STEP]
show "dim_row (Complex_Matrix.adjoint (rank_1_proj v)) = dim_row (rank_1_proj v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (Complex_Matrix.adjoint (rank_1_proj v)) = dim_row (rank_1_proj v)
[PROOF STEP]
using rank_1_proj_square_mat
[PROOF STATE]
proof (prove)
using this:
square_mat (rank_1_proj ?v)

goal (1 subgoal):
 1. dim_row (Complex_Matrix.adjoint (rank_1_proj v)) = dim_row (rank_1_proj v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row (Complex_Matrix.adjoint (rank_1_proj v)) = dim_row (rank_1_proj v)

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (rank_1_proj v); j < dim_col (rank_1_proj v)\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)
 2. dim_col (Complex_Matrix.adjoint (rank_1_proj v)) = dim_col (rank_1_proj v)
[PROOF STEP]
thus "dim_col (Complex_Matrix.adjoint (rank_1_proj v)) = dim_col (rank_1_proj v)"
[PROOF STATE]
proof (prove)
using this:
dim_row (Complex_Matrix.adjoint (rank_1_proj v)) = dim_row (rank_1_proj v)

goal (1 subgoal):
 1. dim_col (Complex_Matrix.adjoint (rank_1_proj v)) = dim_col (rank_1_proj v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_col (Complex_Matrix.adjoint (rank_1_proj v)) = dim_col (rank_1_proj v)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (rank_1_proj v); j < dim_col (rank_1_proj v)\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (rank_1_proj v); j < dim_col (rank_1_proj v)\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)
[PROOF STEP]
assume "i < dim_row (rank_1_proj v)" and "j < dim_col (rank_1_proj v)"
[PROOF STATE]
proof (state)
this:
i < dim_row (rank_1_proj v)
j < dim_col (rank_1_proj v)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (rank_1_proj v); j < dim_col (rank_1_proj v)\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)
[PROOF STEP]
note ij = this
[PROOF STATE]
proof (state)
this:
i < dim_row (rank_1_proj v)
j < dim_col (rank_1_proj v)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (rank_1_proj v); j < dim_col (rank_1_proj v)\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)
[PROOF STEP]
have "Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = conjugate ((rank_1_proj v) $$ (j, i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = conjugate (rank_1_proj v $$ (j, i))
[PROOF STEP]
using ij \<open>dim_col (Complex_Matrix.adjoint (rank_1_proj v)) = dim_col (rank_1_proj v)\<close>
      adjoint_eval
[PROOF STATE]
proof (prove)
using this:
i < dim_row (rank_1_proj v)
j < dim_col (rank_1_proj v)
dim_col (Complex_Matrix.adjoint (rank_1_proj v)) = dim_col (rank_1_proj v)
\<lbrakk>?i < dim_col ?A; ?j < dim_row ?A\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint ?A $$ (?i, ?j) = conjugate (?A $$ (?j, ?i))

goal (1 subgoal):
 1. Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = conjugate (rank_1_proj v $$ (j, i))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = conjugate (rank_1_proj v $$ (j, i))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (rank_1_proj v); j < dim_col (rank_1_proj v)\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = conjugate (rank_1_proj v $$ (j, i))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (rank_1_proj v); j < dim_col (rank_1_proj v)\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)
[PROOF STEP]
have "... = conjugate (Matrix.vec_index v j * (cnj (Matrix.vec_index v i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate (rank_1_proj v $$ (j, i)) = conjugate (v $ j * cnj (v $ i))
[PROOF STEP]
using rank_1_proj_coord ij
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < dim_vec ?v; ?j < dim_vec ?v\<rbrakk> \<Longrightarrow> rank_1_proj ?v $$ (?i, ?j) = ?v $ ?i * cnj (?v $ ?j)
i < dim_row (rank_1_proj v)
j < dim_col (rank_1_proj v)

goal (1 subgoal):
 1. conjugate (rank_1_proj v $$ (j, i)) = conjugate (v $ j * cnj (v $ i))
[PROOF STEP]
by (metis \<open>dim_col (Complex_Matrix.adjoint (rank_1_proj v)) = dim_col (rank_1_proj v)\<close>
        adjoint_dim_col rank_1_proj_dim)
[PROOF STATE]
proof (state)
this:
conjugate (rank_1_proj v $$ (j, i)) = conjugate (v $ j * cnj (v $ i))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (rank_1_proj v); j < dim_col (rank_1_proj v)\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
conjugate (rank_1_proj v $$ (j, i)) = conjugate (v $ j * cnj (v $ i))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (rank_1_proj v); j < dim_col (rank_1_proj v)\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)
[PROOF STEP]
have "... = Matrix.vec_index v i * (cnj (Matrix.vec_index v j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate (v $ j * cnj (v $ i)) = v $ i * cnj (v $ j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
conjugate (v $ j * cnj (v $ i)) = v $ i * cnj (v $ j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (rank_1_proj v); j < dim_col (rank_1_proj v)\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
conjugate (v $ j * cnj (v $ i)) = v $ i * cnj (v $ j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (rank_1_proj v); j < dim_col (rank_1_proj v)\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)
[PROOF STEP]
have "... = rank_1_proj v $$ (i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v $ i * cnj (v $ j) = rank_1_proj v $$ (i, j)
[PROOF STEP]
using ij rank_1_proj_coord
[PROOF STATE]
proof (prove)
using this:
i < dim_row (rank_1_proj v)
j < dim_col (rank_1_proj v)
\<lbrakk>?i < dim_vec ?v; ?j < dim_vec ?v\<rbrakk> \<Longrightarrow> rank_1_proj ?v $$ (?i, ?j) = ?v $ ?i * cnj (?v $ ?j)

goal (1 subgoal):
 1. v $ i * cnj (v $ j) = rank_1_proj v $$ (i, j)
[PROOF STEP]
by (metis \<open>dim_col (Complex_Matrix.adjoint (rank_1_proj v)) = dim_col (rank_1_proj v)\<close>
        adjoint_dim_col rank_1_proj_dim)
[PROOF STATE]
proof (state)
this:
v $ i * cnj (v $ j) = rank_1_proj v $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (rank_1_proj v); j < dim_col (rank_1_proj v)\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)
[PROOF STEP]
show "Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)

goal (1 subgoal):
 1. Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint (rank_1_proj v) $$ (i, j) = rank_1_proj v $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dirichlet_prod'_mangoldt_floor_asymptotics:
  "(\<lambda>x. dirichlet_prod' mangoldt floor x - x * ln x + x) \<in> O(ln)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x + x) \<in> O(ln)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x + x) \<in> O(ln)
[PROOF STEP]
have "dirichlet_prod' mangoldt floor = (\<lambda>x. sum_upto ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) = sum_upto (\<lambda>x. ln (real x))
[PROOF STEP]
unfolding sum_upto_ln_conv_sum_upto_mangoldt dirichlet_prod'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>m. mangoldt m * real_of_int \<lfloor>x / real m\<rfloor>) x) = (\<lambda>x. sum_upto (\<lambda>xa. mangoldt xa * real (nat \<lfloor>x / real xa\<rfloor>)) x)
[PROOF STEP]
by (intro sum_upto_cong' ext) auto
[PROOF STATE]
proof (state)
this:
dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) = sum_upto (\<lambda>x. ln (real x))

goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x + x) \<in> O(ln)
[PROOF STEP]
hence "(\<lambda>x. dirichlet_prod' mangoldt floor x - x * ln x + x) = (\<lambda>x. sum_upto ln x - x * ln x + x)"
[PROOF STATE]
proof (prove)
using this:
dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) = sum_upto (\<lambda>x. ln (real x))

goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x + x) = (\<lambda>x. sum_upto (\<lambda>x. ln (real x)) x - x * ln x + x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x + x) = (\<lambda>x. sum_upto (\<lambda>x. ln (real x)) x - x * ln x + x)

goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x + x) \<in> O(ln)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x + x) = (\<lambda>x. sum_upto (\<lambda>x. ln (real x)) x - x * ln x + x)

goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x + x) \<in> O(ln)
[PROOF STEP]
have "\<dots> \<in> O(ln)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>x. ln (real x)) x - x * ln x + x) \<in> O(ln)
[PROOF STEP]
by (rule sum_upto_ln_stirling_weak_bigo)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sum_upto (\<lambda>x. ln (real x)) x - x * ln x + x) \<in> O(ln)

goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x + x) \<in> O(ln)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x + x) \<in> O(ln)
[PROOF STEP]
show "(\<lambda>x. dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x + x) \<in> O(ln)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x + x) \<in> O(ln)

goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x + x) \<in> O(ln)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. dirichlet_prod' mangoldt (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x + x) \<in> O(ln)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Suc_0_eq_Suc_0_mod_iff:
  "Suc 0 = Suc 0 mod n \<longleftrightarrow> n \<noteq> Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Suc 0 = Suc 0 mod n) = (n \<noteq> Suc 0)
[PROOF STEP]
using Suc_0_mod_eq_Suc_0_iff
[PROOF STATE]
proof (prove)
using this:
(Suc 0 mod ?n = Suc 0) = (?n \<noteq> Suc 0)

goal (1 subgoal):
 1. (Suc 0 = Suc 0 mod n) = (n \<noteq> Suc 0)
[PROOF STEP]
by (simp add: eq_commute)


[STATEMENT]
theorem fact_bounds:
  assumes "n > 0"
  shows   "(fact n :: real) \<ge> sqrt (2*pi*n) * (n / exp 1) ^ n" (is ?th1)
          "(fact n :: real) \<le> sqrt (2*pi*n) * (n / exp 1) ^ n * exp (1 / (12 * n))" (is ?th2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n &&& fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have n: "real n \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
0 < n

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

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
from assms Gamma_plus1[of "real n"]
[PROOF STATE]
proof (chain)
picking this:
0 < n
real n \<notin> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Gamma (real n + 1) = real n * Gamma (real n)
[PROOF STEP]
have "real n * Gamma (real n) = Gamma (real (Suc n))"
[PROOF STATE]
proof (prove)
using this:
0 < n
real n \<notin> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Gamma (real n + 1) = real n * Gamma (real n)

goal (1 subgoal):
 1. real n * Gamma (real n) = Gamma (real (Suc n))
[PROOF STEP]
by (simp add: of_nat_in_nonpos_Ints_iff add_ac)
[PROOF STATE]
proof (state)
this:
real n * Gamma (real n) = Gamma (real (Suc n))

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real n * Gamma (real n) = Gamma (real (Suc n))

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
have "Gamma (real (Suc n)) = fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gamma (real (Suc n)) = fact n
[PROOF STEP]
by (subst Gamma_fact [symmetric]) simp
[PROOF STATE]
proof (state)
this:
Gamma (real (Suc n)) = fact n

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real n * Gamma (real n) = fact n
[PROOF STEP]
have *: "fact n = real n * Gamma (real n)"
[PROOF STATE]
proof (prove)
using this:
real n * Gamma (real n) = fact n

goal (1 subgoal):
 1. fact n = real n * Gamma (real n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fact n = real n * Gamma (real n)

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
have "2*pi/n = 2*pi*n / n^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * pi / real n = 2 * pi * real n / real (n\<^sup>2)
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
2 * pi / real n = 2 * pi * real n / real (n\<^sup>2)

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * pi / real n = 2 * pi * real n / real (n\<^sup>2)

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
have "sqrt \<dots> = sqrt (2*pi*n) / n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (2 * pi * real n / real (n\<^sup>2)) = sqrt (2 * pi * real n) / real n
[PROOF STEP]
by (subst real_sqrt_divide) simp_all
[PROOF STATE]
proof (state)
this:
sqrt (2 * pi * real n / real (n\<^sup>2)) = sqrt (2 * pi * real n) / real n

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt (2 * pi * real n / real (n\<^sup>2)) = sqrt (2 * pi * real n) / real n

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
have "real n * \<dots> = sqrt (2*pi*n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n * (sqrt (2 * pi * real n) / real n) = sqrt (2 * pi * real n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real n * (sqrt (2 * pi * real n) / real n) = sqrt (2 * pi * real n)

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real n * sqrt (2 * pi / real n) = sqrt (2 * pi * real n)
[PROOF STEP]
have **: "real n * sqrt (2*pi/real n) = sqrt (2*pi*real n)"
[PROOF STATE]
proof (prove)
using this:
real n * sqrt (2 * pi / real n) = sqrt (2 * pi * real n)

goal (1 subgoal):
 1. real n * sqrt (2 * pi / real n) = sqrt (2 * pi * real n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real n * sqrt (2 * pi / real n) = sqrt (2 * pi * real n)

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
note *
[PROOF STATE]
proof (state)
this:
fact n = real n * Gamma (real n)

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fact n = real n * Gamma (real n)

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
note Gamma_bounds(2)[OF n]
[PROOF STATE]
proof (state)
this:
Gamma (real n) \<le> sqrt (2 * pi / real n) * (real n / exp 1) powr real n * exp (1 / (12 * real n))

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Gamma (real n) \<le> sqrt (2 * pi / real n) * (real n / exp 1) powr real n * exp (1 / (12 * real n))

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
have "real n * (sqrt (2 * pi / real n) * (real n / exp 1) powr real n *
                  exp (1 / (12 * real n))) =
               (real n * sqrt (2*pi/n)) * (n / exp 1) powr n * exp (1 / (12 * n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n * (sqrt (2 * pi / real n) * (real n / exp 1) powr real n * exp (1 / (12 * real n))) = real n * sqrt (2 * pi / real n) * (real n / exp 1) powr real n * exp (1 / real (12 * n))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
real n * (sqrt (2 * pi / real n) * (real n / exp 1) powr real n * exp (1 / (12 * real n))) = real n * sqrt (2 * pi / real n) * (real n / exp 1) powr real n * exp (1 / real (12 * n))

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real n * (sqrt (2 * pi / real n) * (real n / exp 1) powr real n * exp (1 / (12 * real n))) = real n * sqrt (2 * pi / real n) * (real n / exp 1) powr real n * exp (1 / real (12 * n))

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
1 \<le> real n
[PROOF STEP]
have "(real n / exp 1) powr real n = (real n / exp 1) ^ n"
[PROOF STATE]
proof (prove)
using this:
1 \<le> real n

goal (1 subgoal):
 1. (real n / exp 1) powr real n = (real n / exp 1) ^ n
[PROOF STEP]
by (subst powr_realpow) simp_all
[PROOF STATE]
proof (state)
this:
(real n / exp 1) powr real n = (real n / exp 1) ^ n

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(real n / exp 1) powr real n = (real n / exp 1) ^ n

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
note **
[PROOF STATE]
proof (state)
this:
real n * sqrt (2 * pi / real n) = sqrt (2 * pi * real n)

goal (2 subgoals):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
 2. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> real n * x \<le> real n * y) \<Longrightarrow> fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / real (12 * n))
[PROOF STEP]
show ?th2
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> real n * x \<le> real n * y) \<Longrightarrow> fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / real (12 * n))

goal (1 subgoal):
 1. fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
[PROOF STEP]
by - (insert assms, simp_all)
[PROOF STATE]
proof (state)
this:
fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))

goal (1 subgoal):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
[PROOF STEP]
have "sqrt (2*pi*n) * (n / exp 1) powr n = n * (sqrt (2*pi/n) * (n / exp 1) powr n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (2 * pi * real n) * (real n / exp 1) powr real n = real n * (sqrt (2 * pi / real n) * (real n / exp 1) powr real n)
[PROOF STEP]
by (subst ** [symmetric]) (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
sqrt (2 * pi * real n) * (real n / exp 1) powr real n = real n * (sqrt (2 * pi / real n) * (real n / exp 1) powr real n)

goal (1 subgoal):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt (2 * pi * real n) * (real n / exp 1) powr real n = real n * (sqrt (2 * pi / real n) * (real n / exp 1) powr real n)

goal (1 subgoal):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "\<dots> \<le> real n * Gamma (real n)"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. real n * (sqrt (2 * pi / real n) * (real n / exp 1) powr real n) \<le> real n * Gamma (real n)
[PROOF STEP]
by (intro mult_left_mono Gamma_bounds(1)) simp_all
[PROOF STATE]
proof (state)
this:
real n * (sqrt (2 * pi / real n) * (real n / exp 1) powr real n) \<le> real n * Gamma (real n)

goal (1 subgoal):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real n * (sqrt (2 * pi / real n) * (real n / exp 1) powr real n) \<le> real n * Gamma (real n)

goal (1 subgoal):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
1 \<le> real n
[PROOF STEP]
have "(real n / exp 1) powr real n = (real n / exp 1) ^ n"
[PROOF STATE]
proof (prove)
using this:
1 \<le> real n

goal (1 subgoal):
 1. (real n / exp 1) powr real n = (real n / exp 1) ^ n
[PROOF STEP]
by (subst powr_realpow) simp_all
[PROOF STATE]
proof (state)
this:
(real n / exp 1) powr real n = (real n / exp 1) ^ n

goal (1 subgoal):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(real n / exp 1) powr real n = (real n / exp 1) ^ n

goal (1 subgoal):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
[PROOF STEP]
note * [symmetric]
[PROOF STATE]
proof (state)
this:
real n * Gamma (real n) = fact n

goal (1 subgoal):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
[PROOF STEP]
show ?th1
[PROOF STATE]
proof (prove)
using this:
sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n

goal (1 subgoal):
 1. sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "A \<and> B \<longrightarrow> B \<and> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<and> B \<longrightarrow> B \<and> A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<and> B \<Longrightarrow> B \<and> A
[PROOF STEP]
assume "A \<and> B"
[PROOF STATE]
proof (state)
this:
A \<and> B

goal (1 subgoal):
 1. A \<and> B \<Longrightarrow> B \<and> A
[PROOF STEP]
show "B \<and> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<and> A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. B
 2. A
[PROOF STEP]
from \<open>A \<and> B\<close>
[PROOF STATE]
proof (chain)
picking this:
A \<and> B
[PROOF STEP]
show B
[PROOF STATE]
proof (prove)
using this:
A \<and> B

goal (1 subgoal):
 1. B
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
B

goal (1 subgoal):
 1. A
[PROOF STEP]
from \<open>A \<and> B\<close>
[PROOF STATE]
proof (chain)
picking this:
A \<and> B
[PROOF STEP]
show A
[PROOF STATE]
proof (prove)
using this:
A \<and> B

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
B \<and> A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma non_empty_path_root_iff:
  "(\<exists>r . path_root r x \<and> r \<le> (x + x\<^sup>T);1) \<longleftrightarrow> path x \<and> x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>r. path_root r x \<and> r \<le> (x + x\<^sup>T) ; 1) = (path x \<and> x \<noteq> 0)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<exists>r. path_root r x \<and> r \<le> (x + x\<^sup>T) ; 1 \<Longrightarrow> path x \<and> x \<noteq> 0
 2. path x \<and> x \<noteq> 0 \<Longrightarrow> \<exists>r. path_root r x \<and> r \<le> (x + x\<^sup>T) ; 1
[PROOF STEP]
using non_empty_cycle_root_non_empty path_root_def zero_backward_terminating_path_root path_root_iff
[PROOF STATE]
proof (prove)
using this:
non_empty_cycle_root ?r ?x \<Longrightarrow> ?x \<noteq> 0
path_root ?r ?x \<equiv> ?r ; ?x \<le> ?x\<^sup>\<star> + ?x\<^sup>T\<^sup>\<star> \<and> is_inj ?x \<and> is_p_fun ?x \<and> point ?r
point ?r \<Longrightarrow> backward_terminating_path_root ?r 0
(\<exists>r. path_root r ?x) = path ?x

goal (2 subgoals):
 1. \<exists>r. path_root r x \<and> r \<le> (x + x\<^sup>T) ; 1 \<Longrightarrow> path x \<and> x \<noteq> 0
 2. path x \<and> x \<noteq> 0 \<Longrightarrow> \<exists>r. path_root r x \<and> r \<le> (x + x\<^sup>T) ; 1
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path x \<and> x \<noteq> 0 \<Longrightarrow> \<exists>r. path_root r x \<and> r \<le> (x + x\<^sup>T) ; 1
[PROOF STEP]
using path_root_iff non_empty_path_root_iff_aux
[PROOF STATE]
proof (prove)
using this:
(\<exists>r. path_root r ?x) = path ?x
\<lbrakk>path_root ?r ?x; ?x \<noteq> 0\<rbrakk> \<Longrightarrow> ?r \<le> (?x + ?x\<^sup>T) ; 1

goal (1 subgoal):
 1. path x \<and> x \<noteq> 0 \<Longrightarrow> \<exists>r. path_root r x \<and> r \<le> (x + x\<^sup>T) ; 1
[PROOF STEP]
by blast


[STATEMENT]
lemma mk_dimvec_eq_iff [simp]:
  assumes "length x = CARD('d)" "length y = CARD('d)"
  shows "((mk_dimvec x :: ('n::ring_1, 'd::enum) dimvec) = mk_dimvec y) \<longleftrightarrow> (x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mk_dimvec x = mk_dimvec y) = (x = y)
[PROOF STEP]
by (rule inj_on_eq_iff[OF mk_dimvec_inj], simp_all add: assms)


[STATEMENT]
lemma (in cpx_sq_mat) spectrum_to_pm_idx_lt_card:
assumes "A\<in> fc_mats"
  and "hermitian A"
and "a\<in> spectrum A"
shows "spectrum_to_pm_idx A a < card (spectrum A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. spectrum_to_pm_idx A a < card (spectrum A)
[PROOF STEP]
using spectrum_to_pm_idx_bij[of A] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>hermitian A; A \<in> fc_mats\<rbrakk> \<Longrightarrow> bij_betw (spectrum_to_pm_idx A) (spectrum A) {..<card (spectrum A)}
A \<in> fc_mats
hermitian A
a \<in> spectrum A

goal (1 subgoal):
 1. spectrum_to_pm_idx A a < card (spectrum A)
[PROOF STEP]
by (meson bij_betw_apply lessThan_iff)


[STATEMENT]
lemma Dirichlet_L_Re_gt_1_nonzero:
  assumes "Re s > 1"
  shows   "Dirichlet_L n \<chi> s \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Dirichlet_L n \<chi> s \<noteq> 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Dirichlet_L n \<chi> s \<noteq> 0
[PROOF STEP]
have "completely_multiplicative_function (fds_nth (fds \<chi>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. completely_multiplicative_function (fds_nth (fds \<chi>))
[PROOF STEP]
by (simp add: fds_nth_fds' mult.completely_multiplicative_function_axioms)
[PROOF STATE]
proof (state)
this:
completely_multiplicative_function (fds_nth (fds \<chi>))

goal (1 subgoal):
 1. Dirichlet_L n \<chi> s \<noteq> 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
completely_multiplicative_function (fds_nth (fds \<chi>))

goal (1 subgoal):
 1. Dirichlet_L n \<chi> s \<noteq> 0
[PROOF STEP]
have "fds_abs_converges (fds \<chi>) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_abs_converges (fds \<chi>) s
[PROOF STEP]
using abs_summable_Dirichlet_L[OF assms]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. cmod (\<chi> n * of_nat n powr - s))

goal (1 subgoal):
 1. fds_abs_converges (fds \<chi>) s
[PROOF STEP]
by (simp add: fds_abs_converges_def fds_nth_fds' powr_minus divide_simps)
[PROOF STATE]
proof (state)
this:
fds_abs_converges (fds \<chi>) s

goal (1 subgoal):
 1. Dirichlet_L n \<chi> s \<noteq> 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
completely_multiplicative_function (fds_nth (fds \<chi>))
fds_abs_converges (fds \<chi>) s
[PROOF STEP]
have "(eval_fds (fds \<chi>) s = 0) \<longleftrightarrow> (\<exists>p. prime p \<and> fds_nth (fds \<chi>) p = nat_power p s)"
[PROOF STATE]
proof (prove)
using this:
completely_multiplicative_function (fds_nth (fds \<chi>))
fds_abs_converges (fds \<chi>) s

goal (1 subgoal):
 1. (eval_fds (fds \<chi>) s = 0) = (\<exists>p. prime p \<and> fds_nth (fds \<chi>) p = nat_power p s)
[PROOF STEP]
by (rule fds_abs_convergent_zero_iff)
[PROOF STATE]
proof (state)
this:
(eval_fds (fds \<chi>) s = 0) = (\<exists>p. prime p \<and> fds_nth (fds \<chi>) p = nat_power p s)

goal (1 subgoal):
 1. Dirichlet_L n \<chi> s \<noteq> 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(eval_fds (fds \<chi>) s = 0) = (\<exists>p. prime p \<and> fds_nth (fds \<chi>) p = nat_power p s)

goal (1 subgoal):
 1. Dirichlet_L n \<chi> s \<noteq> 0
[PROOF STEP]
have "eval_fds (fds \<chi>) s = Dirichlet_L n \<chi> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fds (fds \<chi>) s = Dirichlet_L n \<chi> s
[PROOF STEP]
using Dirichlet_L_conv_eval_fds_weak[OF assms]
[PROOF STATE]
proof (prove)
using this:
Dirichlet_L n \<chi> s = eval_fds (fds \<chi>) s

goal (1 subgoal):
 1. eval_fds (fds \<chi>) s = Dirichlet_L n \<chi> s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval_fds (fds \<chi>) s = Dirichlet_L n \<chi> s

goal (1 subgoal):
 1. Dirichlet_L n \<chi> s \<noteq> 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
eval_fds (fds \<chi>) s = Dirichlet_L n \<chi> s

goal (1 subgoal):
 1. Dirichlet_L n \<chi> s \<noteq> 0
[PROOF STEP]
have "\<not>(\<exists>p. prime p \<and> fds_nth (fds \<chi>) p = nat_power p s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nexists>p. prime p \<and> fds_nth (fds \<chi>) p = nat_power p s
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>prime p; fds_nth (fds \<chi>) p = nat_power p s\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
fix p :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>prime p; fds_nth (fds \<chi>) p = nat_power p s\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume p: "prime p" "fds_nth (fds \<chi>) p = nat_power p s"
[PROOF STATE]
proof (state)
this:
prime p
fds_nth (fds \<chi>) p = nat_power p s

goal (1 subgoal):
 1. \<And>p. \<lbrakk>prime p; fds_nth (fds \<chi>) p = nat_power p s\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from p
[PROOF STATE]
proof (chain)
picking this:
prime p
fds_nth (fds \<chi>) p = nat_power p s
[PROOF STEP]
have "real 1 < real p"
[PROOF STATE]
proof (prove)
using this:
prime p
fds_nth (fds \<chi>) p = nat_power p s

goal (1 subgoal):
 1. real 1 < real p
[PROOF STEP]
by (subst of_nat_less_iff) (auto simp: prime_gt_Suc_0_nat)
[PROOF STATE]
proof (state)
this:
real 1 < real p

goal (1 subgoal):
 1. \<And>p. \<lbrakk>prime p; fds_nth (fds \<chi>) p = nat_power p s\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real 1 < real p

goal (1 subgoal):
 1. \<And>p. \<lbrakk>prime p; fds_nth (fds \<chi>) p = nat_power p s\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = real p powr 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real p = real p powr 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real p = real p powr 1

goal (1 subgoal):
 1. \<And>p. \<lbrakk>prime p; fds_nth (fds \<chi>) p = nat_power p s\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real p = real p powr 1

goal (1 subgoal):
 1. \<And>p. \<lbrakk>prime p; fds_nth (fds \<chi>) p = nat_power p s\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
from p and assms
[PROOF STATE]
proof (chain)
picking this:
prime p
fds_nth (fds \<chi>) p = nat_power p s
1 < Re s
[PROOF STEP]
have "real p powr 1 \<le> real p powr Re s"
[PROOF STATE]
proof (prove)
using this:
prime p
fds_nth (fds \<chi>) p = nat_power p s
1 < Re s

goal (1 subgoal):
 1. real p powr 1 \<le> real p powr Re s
[PROOF STEP]
by (intro powr_mono) (auto simp: real_of_nat_ge_one_iff prime_ge_Suc_0_nat)
[PROOF STATE]
proof (state)
this:
real p powr 1 \<le> real p powr Re s

goal (1 subgoal):
 1. \<And>p. \<lbrakk>prime p; fds_nth (fds \<chi>) p = nat_power p s\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real p powr 1 \<le> real p powr Re s

goal (1 subgoal):
 1. \<And>p. \<lbrakk>prime p; fds_nth (fds \<chi>) p = nat_power p s\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "\<dots> = norm (nat_power p s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real p powr Re s = cmod (nat_power p s)
[PROOF STEP]
by (simp add: norm_nat_power norm_powr_real_powr)
[PROOF STATE]
proof (state)
this:
real p powr Re s = cmod (nat_power p s)

goal (1 subgoal):
 1. \<And>p. \<lbrakk>prime p; fds_nth (fds \<chi>) p = nat_power p s\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real p powr Re s = cmod (nat_power p s)

goal (1 subgoal):
 1. \<And>p. \<lbrakk>prime p; fds_nth (fds \<chi>) p = nat_power p s\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "nat_power p s = fds_nth (fds \<chi>) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_power p s = fds_nth (fds \<chi>) p
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
prime p
fds_nth (fds \<chi>) p = nat_power p s

goal (1 subgoal):
 1. nat_power p s = fds_nth (fds \<chi>) p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nat_power p s = fds_nth (fds \<chi>) p

goal (1 subgoal):
 1. \<And>p. \<lbrakk>prime p; fds_nth (fds \<chi>) p = nat_power p s\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nat_power p s = fds_nth (fds \<chi>) p

goal (1 subgoal):
 1. \<And>p. \<lbrakk>prime p; fds_nth (fds \<chi>) p = nat_power p s\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "norm \<dots> \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (fds_nth (fds \<chi>) p) \<le> 1
[PROOF STEP]
by (auto simp: fds_nth_fds' norm)
[PROOF STATE]
proof (state)
this:
cmod (fds_nth (fds \<chi>) p) \<le> 1

goal (1 subgoal):
 1. \<And>p. \<lbrakk>prime p; fds_nth (fds \<chi>) p = nat_power p s\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real 1 < 1
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
real 1 < 1

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:
\<nexists>p. prime p \<and> fds_nth (fds \<chi>) p = nat_power p s

goal (1 subgoal):
 1. Dirichlet_L n \<chi> s \<noteq> 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Dirichlet_L n \<chi> s \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Dirichlet_L n \<chi> s \<noteq> 0

goal (1 subgoal):
 1. Dirichlet_L n \<chi> s \<noteq> 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Dirichlet_L n \<chi> s \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_laplace_uminus:
  assumes "(f has_laplace F) S"
  shows "((\<lambda>x. - f x) has_laplace - F) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. - f x) has_laplace - F) S
[PROOF STEP]
using has_laplace_cmul[OF assms, of "-1"]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. - 1 *\<^sub>R f x) has_laplace - 1 *\<^sub>R F) S

goal (1 subgoal):
 1. ((\<lambda>x. - f x) has_laplace - F) S
[PROOF STEP]
by auto


[STATEMENT]
lemma prime_nth_prime [intro]:    "prime (nth_prime n)"
  and card_less_nth_prime [simp]: "card {q. prime q \<and> q < nth_prime n} = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime (nth_prime n) &&& card {q. prime q \<and> q < nth_prime n} = n
[PROOF STEP]
using theI'[OF nth_prime_exists1[of n]]
[PROOF STATE]
proof (prove)
using this:
prime (THE x. prime x \<and> card {q. prime q \<and> q < x} = n) \<and> card {q. prime q \<and> q < (THE x. prime x \<and> card {q. prime q \<and> q < x} = n)} = n

goal (1 subgoal):
 1. prime (nth_prime n) &&& card {q. prime q \<and> q < nth_prime n} = n
[PROOF STEP]
by (simp_all add: nth_prime_def)


[STATEMENT]
lemma join_cont1:
  fixes y :: "'a :: Finite_Join_cpo"
  shows "cont (\<lambda>x. (x \<squnion> y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cont (\<lambda>x. x \<squnion> y)
[PROOF STEP]
apply (rule contI2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. monofun (\<lambda>x. x \<squnion> y)
 2. \<And>Y. \<lbrakk>chain Y; chain (\<lambda>i. Y i \<squnion> y)\<rbrakk> \<Longrightarrow> (\<Squnion>i. Y i) \<squnion> y \<sqsubseteq> (\<Squnion>i. Y i \<squnion> y)
[PROOF STEP]
apply (rule monofunI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x ya. x \<sqsubseteq> ya \<Longrightarrow> x \<squnion> y \<sqsubseteq> ya \<squnion> y
 2. \<And>Y. \<lbrakk>chain Y; chain (\<lambda>i. Y i \<squnion> y)\<rbrakk> \<Longrightarrow> (\<Squnion>i. Y i) \<squnion> y \<sqsubseteq> (\<Squnion>i. Y i \<squnion> y)
[PROOF STEP]
apply (metis below_refl join_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>Y. \<lbrakk>chain Y; chain (\<lambda>i. Y i \<squnion> y)\<rbrakk> \<Longrightarrow> (\<Squnion>i. Y i) \<squnion> y \<sqsubseteq> (\<Squnion>i. Y i \<squnion> y)
[PROOF STEP]
apply (rule eq_imp_below)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>Y. \<lbrakk>chain Y; chain (\<lambda>i. Y i \<squnion> y)\<rbrakk> \<Longrightarrow> (\<Squnion>i. Y i) \<squnion> y = (\<Squnion>i. Y i \<squnion> y)
[PROOF STEP]
apply (rule join_cont')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>Y. \<lbrakk>chain Y; chain (\<lambda>i. Y i \<squnion> y)\<rbrakk> \<Longrightarrow> chain Y
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem supplement1_Jacobi':
  "odd n \<Longrightarrow> 1 < n \<Longrightarrow> Jacobi (-1) n = (if n mod 4 = 1 then 1 else -1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>odd n; 1 < n\<rbrakk> \<Longrightarrow> Jacobi (- 1) n = (if n mod 4 = 1 then 1 else - 1)
[PROOF STEP]
by (simp add: even_nat_iff minus_one_power_iff supplement1_Jacobi)
     presburger?


[STATEMENT]
lemma
  one_in_unit_circle_set [simp]: "1\<^sub>h \<in> circline_set unit_circle" and
  ii_in_unit_circle_set [simp]: "ii\<^sub>h \<in> circline_set unit_circle" and
  zero_in_unit_circle_set [simp]: "0\<^sub>h \<notin> circline_set unit_circle"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1\<^sub>h \<in> circline_set unit_circle &&& ii\<^sub>h \<in> circline_set unit_circle &&& 0\<^sub>h \<notin> circline_set unit_circle
[PROOF STEP]
unfolding circline_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1\<^sub>h \<in> Collect (on_circline unit_circle) &&& ii\<^sub>h \<in> Collect (on_circline unit_circle) &&& 0\<^sub>h \<notin> Collect (on_circline unit_circle)
[PROOF STEP]
by simp_all


[STATEMENT]
lemma dvd_imp_poly_roots_subset:
  assumes "q \<noteq> 0" "p dvd q"
  shows   "poly_roots p \<subseteq># poly_roots q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots p \<subseteq># poly_roots q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_roots p \<subseteq># poly_roots q
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
q \<noteq> 0
p dvd q
[PROOF STEP]
have "p \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
q \<noteq> 0
p dvd q

goal (1 subgoal):
 1. p \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. poly_roots p \<subseteq># poly_roots q
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. poly_roots p \<subseteq># poly_roots q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
q \<noteq> 0
p dvd q

goal (1 subgoal):
 1. poly_roots p \<subseteq># poly_roots q
[PROOF STEP]
by (intro mset_subset_eqI) (auto intro: dvd_imp_order_le)
[PROOF STATE]
proof (state)
this:
poly_roots p \<subseteq># poly_roots q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma group_size_implies_group_existance: "x \<in> group_sizes \<Longrightarrow> \<exists>G. G \<in> \<G> \<and> card G = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> group_sizes \<Longrightarrow> \<exists>G. G \<in> \<G> \<and> card G = x
[PROOF STEP]
unfolding group_sizes_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> {card G |G. G \<in> \<G>} \<Longrightarrow> \<exists>G. G \<in> \<G> \<and> card G = x
[PROOF STEP]
by auto


[STATEMENT]
lemma Rep_mult_matrix:
  assumes
  "\<forall>a. fmul 0 a = 0"
  "\<forall>a. fmul a 0 = 0"
  "fadd 0 0 = 0"
  shows
  "Rep_matrix(mult_matrix fmul fadd A B) j i =
  foldseq fadd (% k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) (max (ncols A) (nrows B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_matrix (mult_matrix fmul fadd A B) j i = foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) (max (ncols A) (nrows B))
[PROOF STEP]
apply (simp add: mult_matrix_def mult_matrix_n_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_matrix (Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) (max (ncols A) (nrows B)))) j i = foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) (max (ncols A) (nrows B))
[PROOF STEP]
apply (subst RepAbs_matrix)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<exists>m. \<forall>j i. m \<le> j \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) (max (ncols A) (nrows B)) = (0::'b)
 2. \<exists>n. \<forall>j i. n \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) (max (ncols A) (nrows B)) = (0::'b)
 3. foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) (max (ncols A) (nrows B)) = foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) (max (ncols A) (nrows B))
[PROOF STEP]
apply (rule exI[of _ "nrows A"], insert assms, simp add: nrows foldseq_zero)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>a. fmul (0::'c) a = (0::'b); \<forall>a. fmul a (0::'a) = (0::'b); fadd (0::'b) (0::'b) = (0::'b)\<rbrakk> \<Longrightarrow> \<exists>n. \<forall>j i. n \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) (max (ncols A) (nrows B)) = (0::'b)
 2. \<lbrakk>\<forall>a. fmul (0::'c) a = (0::'b); \<forall>a. fmul a (0::'a) = (0::'b); fadd (0::'b) (0::'b) = (0::'b)\<rbrakk> \<Longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) (max (ncols A) (nrows B)) = foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) (max (ncols A) (nrows B))
[PROOF STEP]
apply (rule exI[of _ "ncols B"], insert assms, simp add: ncols foldseq_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>a. fmul (0::'c) a = (0::'b); \<forall>a. fmul a (0::'a) = (0::'b); fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul (0::'c) a = (0::'b); \<forall>a. fmul a (0::'a) = (0::'b); fadd (0::'b) (0::'b) = (0::'b)\<rbrakk> \<Longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) (max (ncols A) (nrows B)) = foldseq fadd (\<lambda>k. fmul (Rep_matrix A j k) (Rep_matrix B k i)) (max (ncols A) (nrows B))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lead_coeff_gcd_field:
  fixes p q::"'a::field_gcd poly"
  assumes "p\<noteq>0 \<or> q\<noteq>0"
  shows "lead_coeff (gcd p q) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (gcd p q) = (1::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0 \<or> q \<noteq> 0

goal (1 subgoal):
 1. lead_coeff (gcd p q) = (1::'a)
[PROOF STEP]
by (metis gcd.normalize_idem gcd_eq_0_iff lead_coeff_normalize_field)


[STATEMENT]
lemma zmset_frontier_zmset_pos: "zmset_frontier A \<subseteq>#\<^sub>z zmset_pos A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zmset_of (mset_set (set_antichain (frontier A))) \<subseteq>#\<^sub>z zmset_of (mset_pos A)
[PROOF STEP]
unfolding subseteq_zmset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a. zcount (zmset_of (mset_set (set_antichain (frontier A)))) a \<le> zcount (zmset_of (mset_pos A)) a
[PROOF STEP]
by transfer' (auto simp: count_mset_set_if minimal_antichain_def)


[STATEMENT]
lemma fdisjnt_union_left: "fdisjnt A M \<Longrightarrow> fdisjnt B M \<Longrightarrow> fdisjnt (A |\<union>| B) M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>fdisjnt A M; fdisjnt B M\<rbrakk> \<Longrightarrow> fdisjnt (A |\<union>| B) M
[PROOF STEP]
unfolding fdisjnt_alt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A |\<inter>| M = {||}; B |\<inter>| M = {||}\<rbrakk> \<Longrightarrow> A |\<union>| B |\<inter>| M = {||}
[PROOF STEP]
by auto


[STATEMENT]
lemma scaleR_left_mono_neg: "b \<le> a \<Longrightarrow> c \<le> 0 \<Longrightarrow> c *\<^sub>R a \<le> c *\<^sub>R b"
  for a b :: "'a::ordered_real_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b \<le> a; c \<le> 0\<rbrakk> \<Longrightarrow> c *\<^sub>R a \<le> c *\<^sub>R b
[PROOF STEP]
by (drule scaleR_left_mono [of _ _ "- c"], simp_all)


[STATEMENT]
lemma surj_on_Un_right: "surj_on f A (B1 \<union> B2) = (surj_on f A B1 \<and> surj_on f A B2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. surj_on f A (B1 \<union> B2) = (surj_on f A B1 \<and> surj_on f A B2)
[PROOF STEP]
unfolding surj_on_image_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (B1 \<union> B2 \<subseteq> f ` A) = (B1 \<subseteq> f ` A \<and> B2 \<subseteq> f ` A)
[PROOF STEP]
by blast


[STATEMENT]
lemma r_smult: assumes x: "x \<in> X"
  and a: "a > 0"
shows "r (a *s x) = r x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r (a *s x) = r x
[PROOF STEP]
unfolding r_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Min {(A *v (a *s x)) $h j / (a *s x) $h j |j. (a *s x) $h j \<noteq> 0} = Min {(A *v x) $h j / x $h j |j. x $h j \<noteq> 0}
[PROOF STEP]
by (rule arg_cong[of _ _ Min], unfold vector_smult_distrib, insert a, simp)


[STATEMENT]
theorem complement_closure:
  "\<exists>w. \<not> O w x \<Longrightarrow> (\<exists>z. \<forall>w. P w z \<longleftrightarrow> \<not> O w x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>w. \<not> O w x \<Longrightarrow> \<exists>z. \<forall>w. P w z = (\<not> O w x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>w. \<not> O w x \<Longrightarrow> \<exists>z. \<forall>w. P w z = (\<not> O w x)
[PROOF STEP]
assume "(\<exists>w. \<not> O w x)"
[PROOF STATE]
proof (state)
this:
\<exists>w. \<not> O w x

goal (1 subgoal):
 1. \<exists>w. \<not> O w x \<Longrightarrow> \<exists>z. \<forall>w. P w z = (\<not> O w x)
[PROOF STEP]
hence "\<forall>w. P w (\<sigma> z. \<not> O z x) \<longleftrightarrow> \<not> O w x"
[PROOF STATE]
proof (prove)
using this:
\<exists>w. \<not> O w x

goal (1 subgoal):
 1. \<forall>w. P w (\<sigma>z. \<not> O z x) = (\<not> O w x)
[PROOF STEP]
by (rule disjoint_fusion)
[PROOF STATE]
proof (state)
this:
\<forall>w. P w (\<sigma>z. \<not> O z x) = (\<not> O w x)

goal (1 subgoal):
 1. \<exists>w. \<not> O w x \<Longrightarrow> \<exists>z. \<forall>w. P w z = (\<not> O w x)
[PROOF STEP]
thus "\<exists>z. \<forall>w. P w z \<longleftrightarrow> \<not> O w x"
[PROOF STATE]
proof (prove)
using this:
\<forall>w. P w (\<sigma>z. \<not> O z x) = (\<not> O w x)

goal (1 subgoal):
 1. \<exists>z. \<forall>w. P w z = (\<not> O w x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>z. \<forall>w. P w z = (\<not> O w x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma weak_integer_composition_enum_sum_list:
  "xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> sum_list xs = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> sum_list xs = i
[PROOF STEP]
proof(induct l arbitrary: xs i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs i. xs \<in> set (weak_integer_composition_enum i 0) \<Longrightarrow> sum_list xs = i
 2. \<And>l xs i. \<lbrakk>\<And>xs i. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> sum_list xs = i; xs \<in> set (weak_integer_composition_enum i (Suc l))\<rbrakk> \<Longrightarrow> sum_list xs = i
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
xs \<in> set (weak_integer_composition_enum i 0)

goal (2 subgoals):
 1. \<And>xs i. xs \<in> set (weak_integer_composition_enum i 0) \<Longrightarrow> sum_list xs = i
 2. \<And>l xs i. \<lbrakk>\<And>xs i. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> sum_list xs = i; xs \<in> set (weak_integer_composition_enum i (Suc l))\<rbrakk> \<Longrightarrow> sum_list xs = i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xs \<in> set (weak_integer_composition_enum i 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
xs \<in> set (weak_integer_composition_enum i 0)

goal (1 subgoal):
 1. sum_list xs = i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list xs = i

goal (1 subgoal):
 1. \<And>l xs i. \<lbrakk>\<And>xs i. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> sum_list xs = i; xs \<in> set (weak_integer_composition_enum i (Suc l))\<rbrakk> \<Longrightarrow> sum_list xs = i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>l xs i. \<lbrakk>\<And>xs i. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> sum_list xs = i; xs \<in> set (weak_integer_composition_enum i (Suc l))\<rbrakk> \<Longrightarrow> sum_list xs = i
[PROOF STEP]
case (Suc l)
[PROOF STATE]
proof (state)
this:
?xs \<in> set (weak_integer_composition_enum ?i l) \<Longrightarrow> sum_list ?xs = ?i
xs \<in> set (weak_integer_composition_enum i (Suc l))

goal (1 subgoal):
 1. \<And>l xs i. \<lbrakk>\<And>xs i. xs \<in> set (weak_integer_composition_enum i l) \<Longrightarrow> sum_list xs = i; xs \<in> set (weak_integer_composition_enum i (Suc l))\<rbrakk> \<Longrightarrow> sum_list xs = i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?xs \<in> set (weak_integer_composition_enum ?i l) \<Longrightarrow> sum_list ?xs = ?i
xs \<in> set (weak_integer_composition_enum i (Suc l))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?xs \<in> set (weak_integer_composition_enum ?i l) \<Longrightarrow> sum_list ?xs = ?i
xs \<in> set (weak_integer_composition_enum i (Suc l))

goal (1 subgoal):
 1. sum_list xs = i
[PROOF STEP]
by(cases l) auto
[PROOF STATE]
proof (state)
this:
sum_list xs = i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ball_scale:
  assumes "a \<noteq> 0"
  shows   "(\<lambda>x. a *\<^sub>R x) ` ball c r = ball (a *\<^sub>R c :: 'a :: real_normed_vector) (\<bar>a\<bar> * r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*\<^sub>R) a ` ball c r = ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (*\<^sub>R) a ` ball c r = ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
have 1: "(\<lambda>x. a *\<^sub>R x) ` ball c r \<subseteq> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)" if "a \<noteq> 0" for a r and c :: 'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*\<^sub>R) a ` ball c r \<subseteq> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. xa \<in> ball c r \<Longrightarrow> a *\<^sub>R xa \<in> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. xa \<in> ball c r \<Longrightarrow> a *\<^sub>R xa \<in> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
assume x: "x \<in> ball c r"
[PROOF STATE]
proof (state)
this:
x \<in> ball c r

goal (1 subgoal):
 1. \<And>x xa. xa \<in> ball c r \<Longrightarrow> a *\<^sub>R xa \<in> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
have "dist (a *\<^sub>R c) (a *\<^sub>R x) = norm (a *\<^sub>R c - a *\<^sub>R x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (a *\<^sub>R c) (a *\<^sub>R x) = norm (a *\<^sub>R c - a *\<^sub>R x)
[PROOF STEP]
by (auto simp: dist_norm)
[PROOF STATE]
proof (state)
this:
dist (a *\<^sub>R c) (a *\<^sub>R x) = norm (a *\<^sub>R c - a *\<^sub>R x)

goal (1 subgoal):
 1. \<And>x xa. xa \<in> ball c r \<Longrightarrow> a *\<^sub>R xa \<in> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist (a *\<^sub>R c) (a *\<^sub>R x) = norm (a *\<^sub>R c - a *\<^sub>R x)

goal (1 subgoal):
 1. \<And>x xa. xa \<in> ball c r \<Longrightarrow> a *\<^sub>R xa \<in> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
have "a *\<^sub>R c - a *\<^sub>R x = a *\<^sub>R (c - x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a *\<^sub>R c - a *\<^sub>R x = a *\<^sub>R (c - x)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
a *\<^sub>R c - a *\<^sub>R x = a *\<^sub>R (c - x)

goal (1 subgoal):
 1. \<And>x xa. xa \<in> ball c r \<Longrightarrow> a *\<^sub>R xa \<in> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dist (a *\<^sub>R c) (a *\<^sub>R x) = norm (a *\<^sub>R (c - x))
[PROOF STEP]
show "a *\<^sub>R x \<in> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)"
[PROOF STATE]
proof (prove)
using this:
dist (a *\<^sub>R c) (a *\<^sub>R x) = norm (a *\<^sub>R (c - x))

goal (1 subgoal):
 1. a *\<^sub>R x \<in> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
using that x
[PROOF STATE]
proof (prove)
using this:
dist (a *\<^sub>R c) (a *\<^sub>R x) = norm (a *\<^sub>R (c - x))
a \<noteq> 0
x \<in> ball c r

goal (1 subgoal):
 1. a *\<^sub>R x \<in> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
by (auto simp: dist_norm)
[PROOF STATE]
proof (state)
this:
a *\<^sub>R x \<in> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?a \<noteq> 0 \<Longrightarrow> (*\<^sub>R) ?a ` ball ?c ?r \<subseteq> ball (?a *\<^sub>R ?c) (\<bar>?a\<bar> * ?r)

goal (1 subgoal):
 1. (*\<^sub>R) a ` ball c r = ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
have "ball (a *\<^sub>R c) (\<bar>a\<bar> * r) = (\<lambda>x. a *\<^sub>R x) ` (\<lambda>x. inverse a *\<^sub>R x) ` ball (a *\<^sub>R c) (\<bar>a\<bar> * r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ball (a *\<^sub>R c) (\<bar>a\<bar> * r) = (*\<^sub>R) a ` (\<lambda>x. x /\<^sub>R a) ` ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
unfolding image_image
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ball (a *\<^sub>R c) (\<bar>a\<bar> * r) = (\<lambda>x. a *\<^sub>R (x /\<^sub>R a)) ` ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. ball (a *\<^sub>R c) (\<bar>a\<bar> * r) = (\<lambda>x. a *\<^sub>R (x /\<^sub>R a)) ` ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ball (a *\<^sub>R c) (\<bar>a\<bar> * r) = (*\<^sub>R) a ` (\<lambda>x. x /\<^sub>R a) ` ball (a *\<^sub>R c) (\<bar>a\<bar> * r)

goal (1 subgoal):
 1. (*\<^sub>R) a ` ball c r = ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ball (a *\<^sub>R c) (\<bar>a\<bar> * r) = (*\<^sub>R) a ` (\<lambda>x. x /\<^sub>R a) ` ball (a *\<^sub>R c) (\<bar>a\<bar> * r)

goal (1 subgoal):
 1. (*\<^sub>R) a ` ball c r = ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
have "\<dots> \<subseteq> (\<lambda>x. a *\<^sub>R x) ` ball (inverse a *\<^sub>R (a *\<^sub>R c)) (\<bar>inverse a\<bar> * (\<bar>a\<bar> * r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*\<^sub>R) a ` (\<lambda>x. x /\<^sub>R a) ` ball (a *\<^sub>R c) (\<bar>a\<bar> * r) \<subseteq> (*\<^sub>R) a ` ball (a *\<^sub>R c /\<^sub>R a) (\<bar>inverse a\<bar> * (\<bar>a\<bar> * r))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. (*\<^sub>R) a ` (\<lambda>x. x /\<^sub>R a) ` ball (a *\<^sub>R c) (\<bar>a\<bar> * r) \<subseteq> (*\<^sub>R) a ` ball (a *\<^sub>R c /\<^sub>R a) (\<bar>inverse a\<bar> * (\<bar>a\<bar> * r))
[PROOF STEP]
by (intro image_mono 1) auto
[PROOF STATE]
proof (state)
this:
(*\<^sub>R) a ` (\<lambda>x. x /\<^sub>R a) ` ball (a *\<^sub>R c) (\<bar>a\<bar> * r) \<subseteq> (*\<^sub>R) a ` ball (a *\<^sub>R c /\<^sub>R a) (\<bar>inverse a\<bar> * (\<bar>a\<bar> * r))

goal (1 subgoal):
 1. (*\<^sub>R) a ` ball c r = ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(*\<^sub>R) a ` (\<lambda>x. x /\<^sub>R a) ` ball (a *\<^sub>R c) (\<bar>a\<bar> * r) \<subseteq> (*\<^sub>R) a ` ball (a *\<^sub>R c /\<^sub>R a) (\<bar>inverse a\<bar> * (\<bar>a\<bar> * r))

goal (1 subgoal):
 1. (*\<^sub>R) a ` ball c r = ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
have "\<dots> = (\<lambda>x. a *\<^sub>R x) ` ball c r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*\<^sub>R) a ` ball (a *\<^sub>R c /\<^sub>R a) (\<bar>inverse a\<bar> * (\<bar>a\<bar> * r)) = (*\<^sub>R) a ` ball c r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. (*\<^sub>R) a ` ball (a *\<^sub>R c /\<^sub>R a) (\<bar>inverse a\<bar> * (\<bar>a\<bar> * r)) = (*\<^sub>R) a ` ball c r
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(*\<^sub>R) a ` ball (a *\<^sub>R c /\<^sub>R a) (\<bar>inverse a\<bar> * (\<bar>a\<bar> * r)) = (*\<^sub>R) a ` ball c r

goal (1 subgoal):
 1. (*\<^sub>R) a ` ball c r = ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ball (a *\<^sub>R c) (\<bar>a\<bar> * r) \<subseteq> (*\<^sub>R) a ` ball c r
[PROOF STEP]
have "ball (a *\<^sub>R c) (\<bar>a\<bar> * r) \<subseteq> (\<lambda>x. a *\<^sub>R x) ` ball c r"
[PROOF STATE]
proof (prove)
using this:
ball (a *\<^sub>R c) (\<bar>a\<bar> * r) \<subseteq> (*\<^sub>R) a ` ball c r

goal (1 subgoal):
 1. ball (a *\<^sub>R c) (\<bar>a\<bar> * r) \<subseteq> (*\<^sub>R) a ` ball c r
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ball (a *\<^sub>R c) (\<bar>a\<bar> * r) \<subseteq> (*\<^sub>R) a ` ball c r

goal (1 subgoal):
 1. (*\<^sub>R) a ` ball c r = ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ball (a *\<^sub>R c) (\<bar>a\<bar> * r) \<subseteq> (*\<^sub>R) a ` ball c r

goal (1 subgoal):
 1. (*\<^sub>R) a ` ball c r = ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> 0
[PROOF STEP]
have "(\<lambda>x. a *\<^sub>R x) ` ball c r \<subseteq> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. (*\<^sub>R) a ` ball c r \<subseteq> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
by (intro 1) auto
[PROOF STATE]
proof (state)
this:
(*\<^sub>R) a ` ball c r \<subseteq> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)

goal (1 subgoal):
 1. (*\<^sub>R) a ` ball c r = ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ball (a *\<^sub>R c) (\<bar>a\<bar> * r) \<subseteq> (*\<^sub>R) a ` ball c r
(*\<^sub>R) a ` ball c r \<subseteq> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ball (a *\<^sub>R c) (\<bar>a\<bar> * r) \<subseteq> (*\<^sub>R) a ` ball c r
(*\<^sub>R) a ` ball c r \<subseteq> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)

goal (1 subgoal):
 1. (*\<^sub>R) a ` ball c r = ball (a *\<^sub>R c) (\<bar>a\<bar> * r)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(*\<^sub>R) a ` ball c r = ball (a *\<^sub>R c) (\<bar>a\<bar> * r)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma wf_trancl_conv:
  shows "wf (r\<^sup>+) \<longleftrightarrow> wf r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf (r\<^sup>+) = wf r
[PROOF STEP]
using wf_subset[of "r\<^sup>+" r]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>wf (r\<^sup>+); r \<subseteq> r\<^sup>+\<rbrakk> \<Longrightarrow> wf r

goal (1 subgoal):
 1. wf (r\<^sup>+) = wf r
[PROOF STEP]
by (force simp: wf_trancl)


[STATEMENT]
lemma list_symp:
  assumes "symp R"
  shows "symp (list_all2 R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. symp (list_all2 R)
[PROOF STEP]
proof (rule sympI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. list_all2 R a b \<Longrightarrow> list_all2 R b a
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
symp R
[PROOF STEP]
have *: "\<And>xs ys. R xs ys \<Longrightarrow> R ys xs"
[PROOF STATE]
proof (prove)
using this:
symp R

goal (1 subgoal):
 1. \<And>xs ys. R xs ys \<Longrightarrow> R ys xs
[PROOF STEP]
by (rule sympE)
[PROOF STATE]
proof (state)
this:
R ?xs ?ys \<Longrightarrow> R ?ys ?xs

goal (1 subgoal):
 1. \<And>a b. list_all2 R a b \<Longrightarrow> list_all2 R b a
[PROOF STEP]
fix xs ys
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. list_all2 R a b \<Longrightarrow> list_all2 R b a
[PROOF STEP]
assume "list_all2 R xs ys"
[PROOF STATE]
proof (state)
this:
list_all2 R xs ys

goal (1 subgoal):
 1. \<And>a b. list_all2 R a b \<Longrightarrow> list_all2 R b a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
list_all2 R xs ys
[PROOF STEP]
show "list_all2 R ys xs"
[PROOF STATE]
proof (prove)
using this:
list_all2 R xs ys

goal (1 subgoal):
 1. list_all2 R ys xs
[PROOF STEP]
by (induct xs ys rule: list_induct2') (simp_all add: *)
[PROOF STATE]
proof (state)
this:
list_all2 R ys xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_of_vimage:
assumes "B \<subseteq> range f"
shows "|B| \<le>o |f -` B|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |B| \<le>o |f -` B|
[PROOF STEP]
apply(rule surj_imp_ordLeq[of _ f])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<subseteq> f ` f -` B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> range f

goal (1 subgoal):
 1. B \<subseteq> f ` f -` B
[PROOF STEP]
by (metis Int_absorb2 image_vimage_eq order_refl)


[STATEMENT]
lemma fds_zeta_times_moebius_mu: "fds_zeta * fds moebius_mu = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_zeta * fds moebius_mu = 1
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> fds_nth (fds_zeta * fds moebius_mu) n = fds_nth 1 n
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> fds_nth (fds_zeta * fds moebius_mu) n = fds_nth 1 n
[PROOF STEP]
assume n: "n > 0"
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> fds_nth (fds_zeta * fds moebius_mu) n = fds_nth 1 n
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "fds_nth (fds_zeta * fds moebius_mu :: 'a fds) n = (\<Sum>d | d dvd n. moebius_mu d)"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. fds_nth (fds_zeta * fds moebius_mu) n = (\<Sum>d | d dvd n. moebius_mu d)
[PROOF STEP]
unfolding fds_nth_mult dirichlet_prod_altdef1
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. fds_nth fds_zeta (n div d) * fds_nth (fds moebius_mu) d) = (\<Sum>d | d dvd n. moebius_mu d)
[PROOF STEP]
by (intro sum.cong refl) (auto simp: fds_nth_fds elim: dvdE)
[PROOF STATE]
proof (state)
this:
fds_nth (fds_zeta * fds moebius_mu) n = (\<Sum>d | d dvd n. moebius_mu d)

goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> fds_nth (fds_zeta * fds moebius_mu) n = fds_nth 1 n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fds_nth (fds_zeta * fds moebius_mu) n = (\<Sum>d | d dvd n. moebius_mu d)

goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> fds_nth (fds_zeta * fds moebius_mu) n = fds_nth 1 n
[PROOF STEP]
have "\<dots> = fds_nth 1 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d) = fds_nth 1 n
[PROOF STEP]
by (simp add: sum_moebius_mu_divisors')
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. moebius_mu d) = fds_nth 1 n

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

goal (1 subgoal):
 1. fds_nth (fds_zeta * fds moebius_mu) n = fds_nth 1 n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fds_nth (fds_zeta * fds moebius_mu) n = fds_nth 1 n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mod_eq_imp_diff_mod_0:"
  (a::nat) mod m = b mod m \<Longrightarrow> (b - a) mod m = 0"
  (is "?P \<Longrightarrow> ?Q")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
assume as1: ?P
[PROOF STATE]
proof (state)
this:
a mod m = b mod m

goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
have "b - a = b div m * m + b mod m - (a div m * m + a mod m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b - a = b div m * m + b mod m - (a div m * m + a mod m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b - a = b div m * m + b mod m - (a div m * m + a mod m)

goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
b - a = b div m * m + b mod m - (a div m * m + a mod m)

goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
have "\<dots> = b div m * m + b mod m - (a mod m + a div m * m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b div m * m + b mod m - (a div m * m + a mod m) = b div m * m + b mod m - (a mod m + a div m * m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b div m * m + b mod m - (a div m * m + a mod m) = b div m * m + b mod m - (a mod m + a div m * m)

goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
b div m * m + b mod m - (a div m * m + a mod m) = b div m * m + b mod m - (a mod m + a div m * m)

goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
have "\<dots> = b div m * m + b mod m - a mod m - a div m * m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b div m * m + b mod m - (a mod m + a div m * m) = b div m * m + b mod m - a mod m - a div m * m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b div m * m + b mod m - (a mod m + a div m * m) = b div m * m + b mod m - a mod m - a div m * m

goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
b div m * m + b mod m - (a mod m + a div m * m) = b div m * m + b mod m - a mod m - a div m * m

goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
have "\<dots> = b div m * m + b mod m - b mod m - a div m * m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b div m * m + b mod m - a mod m - a div m * m = b div m * m + b mod m - b mod m - a div m * m
[PROOF STEP]
using as1
[PROOF STATE]
proof (prove)
using this:
a mod m = b mod m

goal (1 subgoal):
 1. b div m * m + b mod m - a mod m - a div m * m = b div m * m + b mod m - b mod m - a div m * m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b div m * m + b mod m - a mod m - a div m * m = b div m * m + b mod m - b mod m - a div m * m

goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
b div m * m + b mod m - a mod m - a div m * m = b div m * m + b mod m - b mod m - a div m * m

goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
have "\<dots> = b div m * m - a div m * m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b div m * m + b mod m - b mod m - a div m * m = b div m * m - a div m * m
[PROOF STEP]
by (simp only: diff_add_inverse2)
[PROOF STATE]
proof (state)
this:
b div m * m + b mod m - b mod m - a div m * m = b div m * m - a div m * m

goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
b div m * m + b mod m - b mod m - a div m * m = b div m * m - a div m * m

goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
have "\<dots> = (b div m - a div m) * m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b div m * m - a div m * m = (b div m - a div m) * m
[PROOF STEP]
by (simp only: diff_mult_distrib)
[PROOF STATE]
proof (state)
this:
b div m * m - a div m * m = (b div m - a div m) * m

goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
b - a = (b div m - a div m) * m
[PROOF STEP]
have "b - a = (b div m - a div m) * m"
[PROOF STATE]
proof (prove)
using this:
b - a = (b div m - a div m) * m

goal (1 subgoal):
 1. b - a = (b div m - a div m) * m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
b - a = (b div m - a div m) * m

goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
hence "(b - a) mod m = (b div m - a div m) * m mod m"
[PROOF STATE]
proof (prove)
using this:
b - a = (b div m - a div m) * m

goal (1 subgoal):
 1. (b - a) mod m = (b div m - a div m) * m mod m
[PROOF STEP]
by (rule arg_cong)
[PROOF STATE]
proof (state)
this:
(b - a) mod m = (b div m - a div m) * m mod m

goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(b - a) mod m = (b div m - a div m) * m mod m

goal (1 subgoal):
 1. (b - a) mod m = 0
[PROOF STEP]
by (simp only: mod_mult_self2_is_0)
[PROOF STATE]
proof (state)
this:
(b - a) mod m = 0

goal:
No subgoals!
[PROOF STEP]
qed