[STATEMENT]
lemma Ln_1 [simp]: "ln 1 = (0::complex)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln 1 = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln 1 = 0
[PROOF STEP]
have "ln (exp 0) = (0::complex)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (exp 0) = 0
[PROOF STEP]
by (simp add: del: exp_zero)
[PROOF STATE]
proof (state)
this:
ln (exp 0) = 0

goal (1 subgoal):
 1. ln 1 = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ln (exp 0) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ln (exp 0) = 0

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma points_list_empty_iff: "\<V>s = [] \<longleftrightarrow> \<V> = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<V>s = []) = (\<V> = {})
[PROOF STEP]
using finite_sets points_indexing
[PROOF STATE]
proof (prove)
using this:
finite \<V>
\<V>s \<in> permutations_of_set \<V>

goal (1 subgoal):
 1. (\<V>s = []) = (\<V> = {})
[PROOF STEP]
by (simp add: elem_permutation_of_set_empty_iff)


[STATEMENT]
lemma const_is_pr: "(\<lambda> x. (n::nat)) \<in> PrimRec1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. n) \<in> PrimRec1
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>x. 0) \<in> PrimRec1
 2. \<And>n. (\<lambda>x. n) \<in> PrimRec1 \<Longrightarrow> (\<lambda>x. Suc n) \<in> PrimRec1
[PROOF STEP]
show "(\<lambda> x. 0) \<in> PrimRec1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. 0) \<in> PrimRec1
[PROOF STEP]
by (rule pr_zero)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. 0) \<in> PrimRec1

goal (1 subgoal):
 1. \<And>n. (\<lambda>x. n) \<in> PrimRec1 \<Longrightarrow> (\<lambda>x. Suc n) \<in> PrimRec1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (\<lambda>x. n) \<in> PrimRec1 \<Longrightarrow> (\<lambda>x. Suc n) \<in> PrimRec1
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (\<lambda>x. n) \<in> PrimRec1 \<Longrightarrow> (\<lambda>x. Suc n) \<in> PrimRec1
[PROOF STEP]
assume "(\<lambda> x. n) \<in> PrimRec1"
[PROOF STATE]
proof (state)
this:
(\<lambda>x. n) \<in> PrimRec1

goal (1 subgoal):
 1. \<And>n. (\<lambda>x. n) \<in> PrimRec1 \<Longrightarrow> (\<lambda>x. Suc n) \<in> PrimRec1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. n) \<in> PrimRec1
[PROOF STEP]
show "(\<lambda> x. Suc n) \<in> PrimRec1"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. n) \<in> PrimRec1

goal (1 subgoal):
 1. (\<lambda>x. Suc n) \<in> PrimRec1
[PROOF STEP]
by prec0
[PROOF STATE]
proof (state)
this:
(\<lambda>x. Suc n) \<in> PrimRec1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma blinfun_to_matrix_inverse:
  assumes "invertible\<^sub>L X"
  shows "invertible (blinfun_to_matrix (X :: ('b::finite \<Rightarrow>\<^sub>b real) \<Rightarrow>\<^sub>L 'c::finite \<Rightarrow>\<^sub>b real))"
    "blinfun_to_matrix (inv\<^sub>L X) = matrix_inv (blinfun_to_matrix X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (blinfun_to_matrix X) &&& blinfun_to_matrix (inv\<^sub>L X) = matrix_inv (blinfun_to_matrix X)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. invertible (blinfun_to_matrix X)
 2. blinfun_to_matrix (inv\<^sub>L X) = matrix_inv (blinfun_to_matrix X)
[PROOF STEP]
have "X o\<^sub>L inv\<^sub>L X = id_blinfun"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X o\<^sub>L inv\<^sub>L X = id_blinfun
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
X o\<^sub>L inv\<^sub>L X = id_blinfun

goal (2 subgoals):
 1. invertible (blinfun_to_matrix X)
 2. blinfun_to_matrix (inv\<^sub>L X) = matrix_inv (blinfun_to_matrix X)
[PROOF STEP]
hence 1: "blinfun_to_matrix X ** blinfun_to_matrix (inv\<^sub>L X) = mat 1"
[PROOF STATE]
proof (prove)
using this:
X o\<^sub>L inv\<^sub>L X = id_blinfun

goal (1 subgoal):
 1. blinfun_to_matrix X ** blinfun_to_matrix (inv\<^sub>L X) = mat 1
[PROOF STEP]
by (metis blinfun_to_matrix_comp blinfun_to_matrix_id)
[PROOF STATE]
proof (state)
this:
blinfun_to_matrix X ** blinfun_to_matrix (inv\<^sub>L X) = mat 1

goal (2 subgoals):
 1. invertible (blinfun_to_matrix X)
 2. blinfun_to_matrix (inv\<^sub>L X) = matrix_inv (blinfun_to_matrix X)
[PROOF STEP]
have "inv\<^sub>L X o\<^sub>L X = id_blinfun"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv\<^sub>L X o\<^sub>L X = id_blinfun
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
inv\<^sub>L X o\<^sub>L X = id_blinfun

goal (2 subgoals):
 1. invertible (blinfun_to_matrix X)
 2. blinfun_to_matrix (inv\<^sub>L X) = matrix_inv (blinfun_to_matrix X)
[PROOF STEP]
hence 2: "blinfun_to_matrix (inv\<^sub>L X) ** blinfun_to_matrix (X) = mat 1"
[PROOF STATE]
proof (prove)
using this:
inv\<^sub>L X o\<^sub>L X = id_blinfun

goal (1 subgoal):
 1. blinfun_to_matrix (inv\<^sub>L X) ** blinfun_to_matrix X = mat 1
[PROOF STEP]
by (metis blinfun_to_matrix_comp blinfun_to_matrix_id)
[PROOF STATE]
proof (state)
this:
blinfun_to_matrix (inv\<^sub>L X) ** blinfun_to_matrix X = mat 1

goal (2 subgoals):
 1. invertible (blinfun_to_matrix X)
 2. blinfun_to_matrix (inv\<^sub>L X) = matrix_inv (blinfun_to_matrix X)
[PROOF STEP]
thus "invertible (blinfun_to_matrix X)"
[PROOF STATE]
proof (prove)
using this:
blinfun_to_matrix (inv\<^sub>L X) ** blinfun_to_matrix X = mat 1

goal (1 subgoal):
 1. invertible (blinfun_to_matrix X)
[PROOF STEP]
using "1" invertible_def
[PROOF STATE]
proof (prove)
using this:
blinfun_to_matrix (inv\<^sub>L X) ** blinfun_to_matrix X = mat 1
blinfun_to_matrix X ** blinfun_to_matrix (inv\<^sub>L X) = mat 1
invertible ?A = (\<exists>A'. ?A ** A' = mat (1::?'a) \<and> A' ** ?A = mat (1::?'a))

goal (1 subgoal):
 1. invertible (blinfun_to_matrix X)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
invertible (blinfun_to_matrix X)

goal (1 subgoal):
 1. blinfun_to_matrix (inv\<^sub>L X) = matrix_inv (blinfun_to_matrix X)
[PROOF STEP]
thus "blinfun_to_matrix (inv\<^sub>L X) = matrix_inv (blinfun_to_matrix X)"
[PROOF STATE]
proof (prove)
using this:
invertible (blinfun_to_matrix X)

goal (1 subgoal):
 1. blinfun_to_matrix (inv\<^sub>L X) = matrix_inv (blinfun_to_matrix X)
[PROOF STEP]
using 1 2 matrix_inv_right matrix_mul_assoc matrix_mul_lid
[PROOF STATE]
proof (prove)
using this:
invertible (blinfun_to_matrix X)
blinfun_to_matrix X ** blinfun_to_matrix (inv\<^sub>L X) = mat 1
blinfun_to_matrix (inv\<^sub>L X) ** blinfun_to_matrix X = mat 1
invertible ?M \<Longrightarrow> ?M ** matrix_inv ?M = mat (1::?'a)
?A ** (?B ** ?C) = ?A ** ?B ** ?C
mat (1::?'a) ** ?A = ?A

goal (1 subgoal):
 1. blinfun_to_matrix (inv\<^sub>L X) = matrix_inv (blinfun_to_matrix X)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
blinfun_to_matrix (inv\<^sub>L X) = matrix_inv (blinfun_to_matrix X)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma design_iso_point_rep_num_eq:
  assumes "p \<in> \<V>"
  shows "\<B> rep p = \<B>' rep (\<pi> p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<B> rep p = \<B>' rep \<pi> p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<B> rep p = \<B>' rep \<pi> p
[PROOF STEP]
have "{#b \<in># \<B> . p \<in> b#} = {#b \<in># \<B> . \<pi> p \<in> \<pi> ` b#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter_mset ((\<in>) p) \<B> = {#b \<in># \<B>. \<pi> p \<in> \<pi> ` b#}
[PROOF STEP]
using assms filter_mset_cong iso_point_in_block_img_iff assms
[PROOF STATE]
proof (prove)
using this:
p \<in> \<V>
\<lbrakk>?M = ?M'; \<And>a. a \<in># ?M \<Longrightarrow> ?P a = ?Q a\<rbrakk> \<Longrightarrow> filter_mset ?P ?M = filter_mset ?Q ?M
\<lbrakk>?p \<in> \<V>; ?bl \<in># \<B>\<rbrakk> \<Longrightarrow> (?p \<in> ?bl) = (\<pi> ?p \<in> \<pi> ` ?bl)
p \<in> \<V>

goal (1 subgoal):
 1. filter_mset ((\<in>) p) \<B> = {#b \<in># \<B>. \<pi> p \<in> \<pi> ` b#}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
filter_mset ((\<in>) p) \<B> = {#b \<in># \<B>. \<pi> p \<in> \<pi> ` b#}

goal (1 subgoal):
 1. \<B> rep p = \<B>' rep \<pi> p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
filter_mset ((\<in>) p) \<B> = {#b \<in># \<B>. \<pi> p \<in> \<pi> ` b#}
[PROOF STEP]
have "{#b \<in># \<B>' . \<pi> p \<in> b#} = image_mset ((`) \<pi>) {#b \<in># \<B> . p \<in> b#}"
[PROOF STATE]
proof (prove)
using this:
filter_mset ((\<in>) p) \<B> = {#b \<in># \<B>. \<pi> p \<in> \<pi> ` b#}

goal (1 subgoal):
 1. filter_mset ((\<in>) (\<pi> p)) \<B>' = image_mset ((`) \<pi>) (filter_mset ((\<in>) p) \<B>)
[PROOF STEP]
by (simp add: image_mset_filter_swap block_img)
[PROOF STATE]
proof (state)
this:
filter_mset ((\<in>) (\<pi> p)) \<B>' = image_mset ((`) \<pi>) (filter_mset ((\<in>) p) \<B>)

goal (1 subgoal):
 1. \<B> rep p = \<B>' rep \<pi> p
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
filter_mset ((\<in>) (\<pi> p)) \<B>' = image_mset ((`) \<pi>) (filter_mset ((\<in>) p) \<B>)

goal (1 subgoal):
 1. \<B> rep p = \<B>' rep \<pi> p
[PROOF STEP]
by (simp add: point_replication_number_def)
[PROOF STATE]
proof (state)
this:
\<B> rep p = \<B>' rep \<pi> p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma piecewise_C1_differentiable_add [derivative_intros]:
  assumes "f piecewise_C1_differentiable_on i"
          "g piecewise_C1_differentiable_on i"
    shows "(\<lambda>x. f x + g x) piecewise_C1_differentiable_on i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f x + g x) piecewise_C1_differentiable_on i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. f x + g x) piecewise_C1_differentiable_on i
[PROOF STEP]
obtain S t where st: "finite S" "finite t"
                       "f C1_differentiable_on (i-S)"
                       "g C1_differentiable_on (i-t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>S t. \<lbrakk>finite S; finite t; f C1_differentiable_on i - S; g C1_differentiable_on i - t\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f piecewise_C1_differentiable_on i
g piecewise_C1_differentiable_on i

goal (1 subgoal):
 1. (\<And>S t. \<lbrakk>finite S; finite t; f C1_differentiable_on i - S; g C1_differentiable_on i - t\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: piecewise_C1_differentiable_on_def)
[PROOF STATE]
proof (state)
this:
finite S
finite t
f C1_differentiable_on i - S
g C1_differentiable_on i - t

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) piecewise_C1_differentiable_on i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite S
finite t
f C1_differentiable_on i - S
g C1_differentiable_on i - t
[PROOF STEP]
have "finite (S \<union> t) \<and> (\<lambda>x. f x + g x) C1_differentiable_on i - (S \<union> t)"
[PROOF STATE]
proof (prove)
using this:
finite S
finite t
f C1_differentiable_on i - S
g C1_differentiable_on i - t

goal (1 subgoal):
 1. finite (S \<union> t) \<and> (\<lambda>x. f x + g x) C1_differentiable_on i - (S \<union> t)
[PROOF STEP]
by (auto intro: C1_differentiable_on_add elim!: C1_differentiable_on_subset)
[PROOF STATE]
proof (state)
this:
finite (S \<union> t) \<and> (\<lambda>x. f x + g x) C1_differentiable_on i - (S \<union> t)

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) piecewise_C1_differentiable_on i
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite (S \<union> t) \<and> (\<lambda>x. f x + g x) C1_differentiable_on i - (S \<union> t)

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) piecewise_C1_differentiable_on i
[PROOF STEP]
have "continuous_on i f" "continuous_on i g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on i f &&& continuous_on i g
[PROOF STEP]
using assms piecewise_C1_differentiable_on_def
[PROOF STATE]
proof (prove)
using this:
f piecewise_C1_differentiable_on i
g piecewise_C1_differentiable_on i
?f piecewise_C1_differentiable_on ?i \<equiv> continuous_on ?i ?f \<and> (\<exists>S. finite S \<and> ?f C1_differentiable_on ?i - S)

goal (1 subgoal):
 1. continuous_on i f &&& continuous_on i g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
continuous_on i f
continuous_on i g

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) piecewise_C1_differentiable_on i
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite (S \<union> t) \<and> (\<lambda>x. f x + g x) C1_differentiable_on i - (S \<union> t)
continuous_on i f
continuous_on i g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (S \<union> t) \<and> (\<lambda>x. f x + g x) C1_differentiable_on i - (S \<union> t)
continuous_on i f
continuous_on i g

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) piecewise_C1_differentiable_on i
[PROOF STEP]
by (auto simp: piecewise_C1_differentiable_on_def continuous_on_add)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f x + g x) piecewise_C1_differentiable_on i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_ereal_zero[simp]: "\<bar>0\<bar> = (0::ereal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>0\<bar> = 0
[PROOF STEP]
unfolding zero_ereal_def abs_ereal.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal \<bar>0\<bar> = ereal 0
[PROOF STEP]
by simp


[STATEMENT]
lemma nat_relprime_power_divisors:
  assumes n0: "0 < n" and abc: "(a::nat)*b = c^n" and relprime: "coprime a b"
  shows "\<exists> k. a = k^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k. a = k ^ n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n
a * b = c ^ n
coprime a b

goal (1 subgoal):
 1. \<exists>k. a = k ^ n
[PROOF STEP]
proof (induct c arbitrary: a b rule: nat_less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>na a b. \<lbrakk>\<forall>m<na. 0 < n \<longrightarrow> (\<forall>x xa. x * xa = m ^ n \<longrightarrow> coprime x xa \<longrightarrow> (\<exists>k. x = k ^ n)); 0 < n; a * b = na ^ n; coprime a b\<rbrakk> \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
case (1 c)
[PROOF STATE]
proof (state)
this:
\<forall>m<c. 0 < n \<longrightarrow> (\<forall>x xa. x * xa = m ^ n \<longrightarrow> coprime x xa \<longrightarrow> (\<exists>k. x = k ^ n))
0 < n
a * b = c ^ n
coprime a b

goal (1 subgoal):
 1. \<And>na a b. \<lbrakk>\<forall>m<na. 0 < n \<longrightarrow> (\<forall>x xa. x * xa = m ^ n \<longrightarrow> coprime x xa \<longrightarrow> (\<exists>k. x = k ^ n)); 0 < n; a * b = na ^ n; coprime a b\<rbrakk> \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k. a = k ^ n
[PROOF STEP]
proof (cases "a > 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
 2. \<not> 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 1 < a

goal (2 subgoals):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
 2. \<not> 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
hence "a = 0 \<or> a = 1"
[PROOF STATE]
proof (prove)
using this:
\<not> 1 < a

goal (1 subgoal):
 1. a = 0 \<or> a = 1
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
a = 0 \<or> a = 1

goal (2 subgoals):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
 2. \<not> 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
a = 0 \<or> a = 1

goal (1 subgoal):
 1. \<exists>k. a = k ^ n
[PROOF STEP]
using n0 power_one zero_power
[PROOF STATE]
proof (prove)
using this:
a = 0 \<or> a = 1
0 < n
(1::?'a) ^ ?n = (1::?'a)
0 < ?n \<Longrightarrow> (0::?'a) ^ ?n = (0::?'a)

goal (1 subgoal):
 1. \<exists>k. a = k ^ n
[PROOF STEP]
by (simp only: eq_sym_conv) blast
[PROOF STATE]
proof (state)
this:
\<exists>k. a = k ^ n

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
1 < a

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 < a
[PROOF STEP]
obtain p where p: "prime p" "p dvd a"
[PROOF STATE]
proof (prove)
using this:
1 < a

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>prime p; p dvd a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using prime_factor_nat[of a]
[PROOF STATE]
proof (prove)
using this:
1 < a
a \<noteq> 1 \<Longrightarrow> \<exists>p. prime p \<and> p dvd a

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>prime p; p dvd a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
prime p
p dvd a

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
hence h1: "p dvd (c^n)"
[PROOF STATE]
proof (prove)
using this:
prime p
p dvd a

goal (1 subgoal):
 1. p dvd c ^ n
[PROOF STEP]
using 1(3) dvd_mult2[of p a b]
[PROOF STATE]
proof (prove)
using this:
prime p
p dvd a
a * b = c ^ n
p dvd a \<Longrightarrow> p dvd a * b

goal (1 subgoal):
 1. p dvd c ^ n
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
p dvd c ^ n

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
hence "(p^n) dvd (c^n)"
[PROOF STATE]
proof (prove)
using this:
p dvd c ^ n

goal (1 subgoal):
 1. p ^ n dvd c ^ n
[PROOF STEP]
using p(1) prime_dvd_power_nat[of p c n] dvd_power_same[of p c n]
[PROOF STATE]
proof (prove)
using this:
p dvd c ^ n
prime p
\<lbrakk>prime p; p dvd c ^ n\<rbrakk> \<Longrightarrow> p dvd c
p dvd c \<Longrightarrow> p ^ n dvd c ^ n

goal (1 subgoal):
 1. p ^ n dvd c ^ n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
p ^ n dvd c ^ n

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p ^ n dvd c ^ n

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
have h2: "\<not> p dvd b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> p dvd b
[PROOF STEP]
using p \<open>coprime a b\<close> coprime_common_divisor_nat [of a b p]
[PROOF STATE]
proof (prove)
using this:
prime p
p dvd a
coprime a b
\<lbrakk>coprime a b; p dvd a; p dvd b\<rbrakk> \<Longrightarrow> p = 1

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

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
hence "\<not> (p^n) dvd b"
[PROOF STATE]
proof (prove)
using this:
\<not> p dvd b

goal (1 subgoal):
 1. \<not> p ^ n dvd b
[PROOF STEP]
using n0 p(1)
[PROOF STATE]
proof (prove)
using this:
\<not> p dvd b
0 < n
prime p

goal (1 subgoal):
 1. \<not> p ^ n dvd b
[PROOF STEP]
by (auto intro: dvd_trans dvd_power[of n p])
[PROOF STATE]
proof (state)
this:
\<not> p ^ n dvd b

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p ^ n dvd c ^ n
\<not> p ^ n dvd b
[PROOF STEP]
have "(p^n) dvd a"
[PROOF STATE]
proof (prove)
using this:
p ^ n dvd c ^ n
\<not> p ^ n dvd b

goal (1 subgoal):
 1. p ^ n dvd a
[PROOF STEP]
using "1.prems" p(1) prime_elem_divprod_pow [of p a b n]
[PROOF STATE]
proof (prove)
using this:
p ^ n dvd c ^ n
\<not> p ^ n dvd b
0 < n
a * b = c ^ n
coprime a b
prime p
\<lbrakk>prime_elem p; coprime a b; p ^ n dvd a * b\<rbrakk> \<Longrightarrow> p ^ n dvd a \<or> p ^ n dvd b

goal (1 subgoal):
 1. p ^ n dvd a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p ^ n dvd a

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p ^ n dvd a
[PROOF STEP]
obtain a' c' where ac: "a = p^n * a'" "c = p * c'"
[PROOF STATE]
proof (prove)
using this:
p ^ n dvd a

goal (1 subgoal):
 1. (\<And>a' c'. \<lbrakk>a = p ^ n * a'; c = p * c'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using h1 dvdE[of "p^n" a] dvdE[of p c] prime_dvd_power_nat[of p c n] p(1)
[PROOF STATE]
proof (prove)
using this:
p ^ n dvd a
p dvd c ^ n
\<lbrakk>p ^ n dvd a; \<And>k. a = p ^ n * k \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P
\<lbrakk>p dvd c; \<And>k. c = p * k \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P
\<lbrakk>prime p; p dvd c ^ n\<rbrakk> \<Longrightarrow> p dvd c
prime p

goal (1 subgoal):
 1. (\<And>a' c'. \<lbrakk>a = p ^ n * a'; c = p * c'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by meson
[PROOF STATE]
proof (state)
this:
a = p ^ n * a'
c = p * c'

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
hence "p^n * (a' * b) = p^n * c'^n"
[PROOF STATE]
proof (prove)
using this:
a = p ^ n * a'
c = p * c'

goal (1 subgoal):
 1. p ^ n * (a' * b) = p ^ n * c' ^ n
[PROOF STEP]
using 1(3)
[PROOF STATE]
proof (prove)
using this:
a = p ^ n * a'
c = p * c'
a * b = c ^ n

goal (1 subgoal):
 1. p ^ n * (a' * b) = p ^ n * c' ^ n
[PROOF STEP]
by (simp add: power_mult_distrib semiring_normalization_rules(18))
[PROOF STATE]
proof (state)
this:
p ^ n * (a' * b) = p ^ n * c' ^ n

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
hence "a' * b = c'^n"
[PROOF STATE]
proof (prove)
using this:
p ^ n * (a' * b) = p ^ n * c' ^ n

goal (1 subgoal):
 1. a' * b = c' ^ n
[PROOF STEP]
using p(1)
[PROOF STATE]
proof (prove)
using this:
p ^ n * (a' * b) = p ^ n * c' ^ n
prime p

goal (1 subgoal):
 1. a' * b = c' ^ n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a' * b = c' ^ n

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a' * b = c' ^ n

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
have "coprime a' b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime a' b
[PROOF STEP]
using 1(4) ac(1)
[PROOF STATE]
proof (prove)
using this:
coprime a b
a = p ^ n * a'

goal (1 subgoal):
 1. coprime a' b
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
coprime a' b

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
coprime a' b

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
have "0 < b" "0 < a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < b &&& 0 < a
[PROOF STEP]
using h2 dvd_0_right gr0I True
[PROOF STATE]
proof (prove)
using this:
\<not> p dvd b
?a dvd (0::?'a)
(?n = 0 \<Longrightarrow> False) \<Longrightarrow> 0 < ?n
1 < a

goal (1 subgoal):
 1. 0 < b &&& 0 < a
[PROOF STEP]
by fastforce+
[PROOF STATE]
proof (state)
this:
0 < b
0 < a

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < b
0 < a
[PROOF STEP]
have "0 < c" "1 < p"
[PROOF STATE]
proof (prove)
using this:
0 < b
0 < a

goal (1 subgoal):
 1. 0 < c &&& 1 < p
[PROOF STEP]
using p \<open>a * b = c ^ n\<close> n0 nat_0_less_mult_iff [of a b] n0
[PROOF STATE]
proof (prove)
using this:
0 < b
0 < a
prime p
p dvd a
a * b = c ^ n
0 < n
(0 < a * b) = (0 < a \<and> 0 < b)
0 < n

goal (1 subgoal):
 1. 0 < c &&& 1 < p
[PROOF STEP]
by (auto simp add: prime_gt_Suc_0_nat)
[PROOF STATE]
proof (state)
this:
0 < c
1 < p

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
hence "c' < c"
[PROOF STATE]
proof (prove)
using this:
0 < c
1 < p

goal (1 subgoal):
 1. c' < c
[PROOF STEP]
using ac(2)
[PROOF STATE]
proof (prove)
using this:
0 < c
1 < p
c = p * c'

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

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a' * b = c' ^ n
coprime a' b
c' < c
[PROOF STEP]
obtain k where "a' = k^n"
[PROOF STATE]
proof (prove)
using this:
a' * b = c' ^ n
coprime a' b
c' < c

goal (1 subgoal):
 1. (\<And>k. a' = k ^ n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using 1(1) n0
[PROOF STATE]
proof (prove)
using this:
a' * b = c' ^ n
coprime a' b
c' < c
\<forall>m<c. 0 < n \<longrightarrow> (\<forall>x xa. x * xa = m ^ n \<longrightarrow> coprime x xa \<longrightarrow> (\<exists>k. x = k ^ n))
0 < n

goal (1 subgoal):
 1. (\<And>k. a' = k ^ n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
a' = k ^ n

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
hence "a = (p*k)^n"
[PROOF STATE]
proof (prove)
using this:
a' = k ^ n

goal (1 subgoal):
 1. a = (p * k) ^ n
[PROOF STEP]
using ac(1)
[PROOF STATE]
proof (prove)
using this:
a' = k ^ n
a = p ^ n * a'

goal (1 subgoal):
 1. a = (p * k) ^ n
[PROOF STEP]
by (simp add: power_mult_distrib)
[PROOF STATE]
proof (state)
this:
a = (p * k) ^ n

goal (1 subgoal):
 1. 1 < a \<Longrightarrow> \<exists>k. a = k ^ n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
a = (p * k) ^ n

goal (1 subgoal):
 1. \<exists>k. a = k ^ n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>k. a = k ^ n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>k. a = k ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lm030:
  assumes "\<Union> P = X"
  shows "P \<subseteq> Pow X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<subseteq> Pow X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<Union> P = X

goal (1 subgoal):
 1. P \<subseteq> Pow X
[PROOF STEP]
by blast


[STATEMENT]
lemma is_path_undir_memb_edges:
    assumes "is_path_undir G v p v'"
    shows "\<forall>(a,w,b) \<in> set p. (a,w,b) \<in> E \<or> (b,w,a) \<in> E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>(a, w, b)\<in>set p. (a, w, b) \<in> E \<or> (b, w, a) \<in> E
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_path_undir G v p v'

goal (1 subgoal):
 1. \<forall>(a, w, b)\<in>set p. (a, w, b) \<in> E \<or> (b, w, a) \<in> E
[PROOF STEP]
by (induct p arbitrary: v) fastforce+


[STATEMENT]
lemma pred_pre_sigmaI:
  assumes T: "stopping_time F T"
  shows "(\<And>t. Measurable.pred (F t) (\<lambda>\<omega>. P \<omega> \<and> T \<omega> \<le> t)) \<Longrightarrow> Measurable.pred (pre_sigma T) P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>t. Measurable.pred (F t) (\<lambda>\<omega>. P \<omega> \<and> T \<omega> \<le> t)) \<Longrightarrow> Measurable.pred (pre_sigma T) P
[PROOF STEP]
unfolding pred_def space_F space_pre_sigma
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>t. {x \<in> \<Omega>. P x \<and> T x \<le> t} \<in> sets (F t)) \<Longrightarrow> {x \<in> \<Omega>. P x} \<in> sets (pre_sigma T)
[PROOF STEP]
by (intro sets_pre_sigmaI[OF T]) simp


[STATEMENT]
lemma unitary_mat_incr:
  "unitary (mat_incr n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary (mat_incr n)
[PROOF STEP]
unfolding unitary_def inverts_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_incr n \<in> carrier_mat (dim_row (mat_incr n)) (dim_row (mat_incr n)) \<and> mat_incr n * adjoint (mat_incr n) = 1\<^sub>m (dim_row (mat_incr n))
[PROOF STEP]
using carrier_matD[OF mat_incr_dim] mat_incr_mult_adjoint_mat_incr
[PROOF STATE]
proof (prove)
using this:
dim_row (mat_incr ?nc) = ?nc
dim_col (mat_incr ?nc) = ?nc
mat_incr ?n * adjoint (mat_incr ?n) = 1\<^sub>m ?n

goal (1 subgoal):
 1. mat_incr n \<in> carrier_mat (dim_row (mat_incr n)) (dim_row (mat_incr n)) \<and> mat_incr n * adjoint (mat_incr n) = 1\<^sub>m (dim_row (mat_incr n))
[PROOF STEP]
by auto


[STATEMENT]
lemma f_values: "\<forall>x \<in> {(i::nat). i < 2^n} . f x = 0 \<or> f x = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{i. i < 2 ^ n}. f x = 0 \<or> f x = 1
[PROOF STEP]
using dom
[PROOF STATE]
proof (prove)
using this:
f \<in> {i. i < 2 ^ n} \<rightarrow>\<^sub>E {0, 1}

goal (1 subgoal):
 1. \<forall>x\<in>{i. i < 2 ^ n}. f x = 0 \<or> f x = 1
[PROOF STEP]
by auto


[STATEMENT]
lemma floorlog_le_iff:
  "floorlog b x \<le> w \<longleftrightarrow> b \<le> 1 \<or> b > 1 \<and> 0 \<le> w \<and> x < b ^ w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (floorlog b x \<le> w) = (b \<le> 1 \<or> 1 < b \<and> 0 \<le> w \<and> x < b ^ w)
[PROOF STEP]
using floorlog_leD[of b x w] floorlog_leI[of x b w]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>floorlog b x \<le> w; 1 < b\<rbrakk> \<Longrightarrow> x < b ^ w
\<lbrakk>x < b ^ w; 0 \<le> w; 1 < b\<rbrakk> \<Longrightarrow> floorlog b x \<le> w

goal (1 subgoal):
 1. (floorlog b x \<le> w) = (b \<le> 1 \<or> 1 < b \<and> 0 \<le> w \<and> x < b ^ w)
[PROOF STEP]
by (auto simp: floorlog_eq_zero_iff[THEN iffD2])


[STATEMENT]
lemma fpsrel_iff [simp]: "(f, g) \<in> fpsmodrel p \<longleftrightarrow> (\<forall>n. (f $ n) mod p = (g $ n) mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((f, g) \<in> fpsmodrel p) = (\<forall>n. f $ n mod p = g $ n mod p)
[PROOF STEP]
by (simp add: fpsmodrel_def)


[STATEMENT]
lemma (in Group) s_top_mono:"\<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G; H1 \<subseteq> H; K1 \<subseteq> K\<rbrakk>
       \<Longrightarrow>  H1 \<diamondop>\<^bsub>G\<^esub> K1 \<subseteq> H \<diamondop>\<^bsub>G\<^esub> K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G; H1 \<subseteq> H; K1 \<subseteq> K\<rbrakk> \<Longrightarrow> H1 \<diamondop> K1 \<subseteq> H \<diamondop> K
[PROOF STEP]
by (rule subsetI, simp add:s_top_def, blast)


[STATEMENT]
lemma on_circline_cmat_cvec_circline_equation:
  "on_circline_cmat_cvec (A, B, C, D) (z1, z2) \<longleftrightarrow> circline_equation A B C D z1 z2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. on_circline_cmat_cvec (A, B, C, D) (z1, z2) = circline_equation A B C D z1 z2
[PROOF STEP]
by (simp add: vec_cnj_def field_simps)


[STATEMENT]
lemma finite_if_eq_beyond_finite: "finite S \<Longrightarrow> finite {s. s - S = s' - S}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S \<Longrightarrow> finite {s. s - S = s' - S}
[PROOF STEP]
proof (rule finite_subset[where B="(\<lambda>s. s \<union> (s' - S)) ` Pow S"], clarsimp)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>finite S; x - S = s' - S\<rbrakk> \<Longrightarrow> x \<in> (\<lambda>s. s \<union> (s' - S)) ` Pow S
 2. finite S \<Longrightarrow> finite ((\<lambda>s. s \<union> (s' - S)) ` Pow S)
[PROOF STEP]
fix s
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>finite S; x - S = s' - S\<rbrakk> \<Longrightarrow> x \<in> (\<lambda>s. s \<union> (s' - S)) ` Pow S
 2. finite S \<Longrightarrow> finite ((\<lambda>s. s \<union> (s' - S)) ` Pow S)
[PROOF STEP]
have "s = (s \<inter> S) \<union> (s - S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s = s \<inter> S \<union> (s - S)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s = s \<inter> S \<union> (s - S)

goal (2 subgoals):
 1. \<And>x. \<lbrakk>finite S; x - S = s' - S\<rbrakk> \<Longrightarrow> x \<in> (\<lambda>s. s \<union> (s' - S)) ` Pow S
 2. finite S \<Longrightarrow> finite ((\<lambda>s. s \<union> (s' - S)) ` Pow S)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
s = s \<inter> S \<union> (s - S)

goal (2 subgoals):
 1. \<And>x. \<lbrakk>finite S; x - S = s' - S\<rbrakk> \<Longrightarrow> x \<in> (\<lambda>s. s \<union> (s' - S)) ` Pow S
 2. finite S \<Longrightarrow> finite ((\<lambda>s. s \<union> (s' - S)) ` Pow S)
[PROOF STEP]
assume "s - S = s' - S"
[PROOF STATE]
proof (state)
this:
s - S = s' - S

goal (2 subgoals):
 1. \<And>x. \<lbrakk>finite S; x - S = s' - S\<rbrakk> \<Longrightarrow> x \<in> (\<lambda>s. s \<union> (s' - S)) ` Pow S
 2. finite S \<Longrightarrow> finite ((\<lambda>s. s \<union> (s' - S)) ` Pow S)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
s = s \<inter> S \<union> (s' - S)
[PROOF STEP]
show "s \<in> (\<lambda>s. s \<union> (s' - S)) ` Pow S"
[PROOF STATE]
proof (prove)
using this:
s = s \<inter> S \<union> (s' - S)

goal (1 subgoal):
 1. s \<in> (\<lambda>s. s \<union> (s' - S)) ` Pow S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
s \<in> (\<lambda>s. s \<union> (s' - S)) ` Pow S

goal (1 subgoal):
 1. finite S \<Longrightarrow> finite ((\<lambda>s. s \<union> (s' - S)) ` Pow S)
[PROOF STEP]
qed blast


[STATEMENT]
lemma set_unset_bit_preserves_len:
  assumes "x div 2 ^ m = 2 * q" "m < len x"
  shows "x + 2 ^ m < 2 ^ len x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + 2 ^ m < 2 ^ len x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x div 2 ^ m = 2 * q
m < len x

goal (1 subgoal):
 1. x + 2 ^ m < 2 ^ len x
[PROOF STEP]
proof (induct m arbitrary: x)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>x div 2 ^ 0 = 2 * q; 0 < len x\<rbrakk> \<Longrightarrow> x + 2 ^ 0 < 2 ^ len x
 2. \<And>m x. \<lbrakk>\<And>x. \<lbrakk>x div 2 ^ m = 2 * q; m < len x\<rbrakk> \<Longrightarrow> x + 2 ^ m < 2 ^ len x; x div 2 ^ Suc m = 2 * q; Suc m < len x\<rbrakk> \<Longrightarrow> x + 2 ^ Suc m < 2 ^ len x
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
x div 2 ^ 0 = 2 * q
0 < len x

goal (2 subgoals):
 1. \<And>x. \<lbrakk>x div 2 ^ 0 = 2 * q; 0 < len x\<rbrakk> \<Longrightarrow> x + 2 ^ 0 < 2 ^ len x
 2. \<And>m x. \<lbrakk>\<And>x. \<lbrakk>x div 2 ^ m = 2 * q; m < len x\<rbrakk> \<Longrightarrow> x + 2 ^ m < 2 ^ len x; x div 2 ^ Suc m = 2 * q; Suc m < len x\<rbrakk> \<Longrightarrow> x + 2 ^ Suc m < 2 ^ len x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x div 2 ^ 0 = 2 * q
0 < len x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
x div 2 ^ 0 = 2 * q
0 < len x

goal (1 subgoal):
 1. x + 2 ^ 0 < 2 ^ len x
[PROOF STEP]
by (auto simp: div_mult2_eq len_Suc_mult2[symmetric]
      simp del: len_Suc_mult2 power_Suc split: if_splits)
[PROOF STATE]
proof (state)
this:
x + 2 ^ 0 < 2 ^ len x

goal (1 subgoal):
 1. \<And>m x. \<lbrakk>\<And>x. \<lbrakk>x div 2 ^ m = 2 * q; m < len x\<rbrakk> \<Longrightarrow> x + 2 ^ m < 2 ^ len x; x div 2 ^ Suc m = 2 * q; Suc m < len x\<rbrakk> \<Longrightarrow> x + 2 ^ Suc m < 2 ^ len x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m x. \<lbrakk>\<And>x. \<lbrakk>x div 2 ^ m = 2 * q; m < len x\<rbrakk> \<Longrightarrow> x + 2 ^ m < 2 ^ len x; x div 2 ^ Suc m = 2 * q; Suc m < len x\<rbrakk> \<Longrightarrow> x + 2 ^ Suc m < 2 ^ len x
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x div 2 ^ m = 2 * q; m < len ?x\<rbrakk> \<Longrightarrow> ?x + 2 ^ m < 2 ^ len ?x
x div 2 ^ Suc m = 2 * q
Suc m < len x

goal (1 subgoal):
 1. \<And>m x. \<lbrakk>\<And>x. \<lbrakk>x div 2 ^ m = 2 * q; m < len x\<rbrakk> \<Longrightarrow> x + 2 ^ m < 2 ^ len x; x div 2 ^ Suc m = 2 * q; Suc m < len x\<rbrakk> \<Longrightarrow> x + 2 ^ Suc m < 2 ^ len x
[PROOF STEP]
with Suc(1)[of "x div 2"]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>x div 2 div 2 ^ m = 2 * q; m < len (x div 2)\<rbrakk> \<Longrightarrow> x div 2 + 2 ^ m < 2 ^ len (x div 2)
\<lbrakk>?x div 2 ^ m = 2 * q; m < len ?x\<rbrakk> \<Longrightarrow> ?x + 2 ^ m < 2 ^ len ?x
x div 2 ^ Suc m = 2 * q
Suc m < len x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x div 2 div 2 ^ m = 2 * q; m < len (x div 2)\<rbrakk> \<Longrightarrow> x div 2 + 2 ^ m < 2 ^ len (x div 2)
\<lbrakk>?x div 2 ^ m = 2 * q; m < len ?x\<rbrakk> \<Longrightarrow> ?x + 2 ^ m < 2 ^ len ?x
x div 2 ^ Suc m = 2 * q
Suc m < len x

goal (1 subgoal):
 1. x + 2 ^ Suc m < 2 ^ len x
[PROOF STEP]
by (cases "len x") (auto simp: div_mult2_eq)
[PROOF STATE]
proof (state)
this:
x + 2 ^ Suc m < 2 ^ len x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_split_unfold: "(\<Union>(ys, zs) \<in> list_split (x # xs). f ys zs) =
  f [] (x # xs) \<union> (\<Union>(ys, zs) \<in> list_split xs. f (x # ys) zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>(ys, zs)\<in>list_split (x # xs). f ys zs) = f [] (x # xs) \<union> (\<Union>(ys, zs)\<in>list_split xs. f (x # ys) zs)
[PROOF STEP]
by (induction xs) auto


[STATEMENT]
lemma \<pi>_less_self:
  includes prime_counting_notation
  assumes "x > 0"
  shows   "\<pi> x < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> x < x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<pi> x < x
[PROOF STEP]
have "\<pi> x \<le> (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> x \<le> (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1)
[PROOF STEP]
unfolding \<pi>_def prime_sum_upto_altdef2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>x\<rfloor>. 1) \<le> (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1)
[PROOF STEP]
by (intro sum_mono2) (auto dest: prime_gt_1_nat)
[PROOF STATE]
proof (state)
this:
\<pi> x \<le> (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1)

goal (1 subgoal):
 1. \<pi> x < x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<pi> x \<le> (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1)

goal (1 subgoal):
 1. \<pi> x < x
[PROOF STEP]
have "\<dots> = real (nat \<lfloor>x\<rfloor> - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1) = real (nat \<lfloor>x\<rfloor> - 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1) = real (nat \<lfloor>x\<rfloor> - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1) = real (nat \<lfloor>x\<rfloor> - 1)

goal (1 subgoal):
 1. \<pi> x < x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1) = real (nat \<lfloor>x\<rfloor> - 1)

goal (1 subgoal):
 1. \<pi> x < x
[PROOF STEP]
have "\<dots> < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (nat \<lfloor>x\<rfloor> - 1) < x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x

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

goal (1 subgoal):
 1. \<pi> x < x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<pi> x < x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<pi> x < x

goal (1 subgoal):
 1. \<pi> x < x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<pi> x < x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bounded_linear_linepath:
  assumes "bounded_linear f"
  shows   "f (linepath a b x) = linepath (f a) (f b) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (linepath a b x) = linepath (f a) (f b) x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f (linepath a b x) = linepath (f a) (f b) x
[PROOF STEP]
interpret f: bounded_linear f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear f
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f (linepath a b x) = linepath (f a) (f b) x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (linepath a b x) = linepath (f a) (f b) x
[PROOF STEP]
by (simp add: linepath_def f.add f.scale)
[PROOF STATE]
proof (state)
this:
f (linepath a b x) = linepath (f a) (f b) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Order) le_trans:"\<lbrakk>a \<in> carrier D; b \<in> carrier D; c \<in> carrier D;
      a \<preceq> b; b \<preceq> c \<rbrakk> \<Longrightarrow> a \<preceq> c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier D; b \<in> carrier D; c \<in> carrier D; a \<preceq> b; b \<preceq> c\<rbrakk> \<Longrightarrow> a \<preceq> c
[PROOF STEP]
apply (unfold ole_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier D; b \<in> carrier D; c \<in> carrier D; (a, b) \<in> rel D; (b, c) \<in> rel D\<rbrakk> \<Longrightarrow> (a, c) \<in> rel D
[PROOF STEP]
apply (rule_tac a = a and b = b and c = c in trans)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<lbrakk>a \<in> carrier D; b \<in> carrier D; c \<in> carrier D; (a, b) \<in> rel D; (b, c) \<in> rel D\<rbrakk> \<Longrightarrow> a \<in> carrier D
 2. \<lbrakk>a \<in> carrier D; b \<in> carrier D; c \<in> carrier D; (a, b) \<in> rel D; (b, c) \<in> rel D\<rbrakk> \<Longrightarrow> b \<in> carrier D
 3. \<lbrakk>a \<in> carrier D; b \<in> carrier D; c \<in> carrier D; (a, b) \<in> rel D; (b, c) \<in> rel D\<rbrakk> \<Longrightarrow> c \<in> carrier D
 4. \<lbrakk>a \<in> carrier D; b \<in> carrier D; c \<in> carrier D; (a, b) \<in> rel D; (b, c) \<in> rel D\<rbrakk> \<Longrightarrow> (a, b) \<in> rel D
 5. \<lbrakk>a \<in> carrier D; b \<in> carrier D; c \<in> carrier D; (a, b) \<in> rel D; (b, c) \<in> rel D\<rbrakk> \<Longrightarrow> (b, c) \<in> rel D
[PROOF STEP]
apply assumption+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma tendsto_norm_bound:
  "\<forall>x. \<parallel>G x - L\<parallel> \<le> \<parallel>F x - L\<parallel> \<Longrightarrow> (F \<longlongrightarrow> L) net \<Longrightarrow> (G \<longlongrightarrow> L) net"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. \<parallel>G x - L\<parallel> \<le> \<parallel>F x - L\<parallel>; (F \<longlongrightarrow> L) net\<rbrakk> \<Longrightarrow> (G \<longlongrightarrow> L) net
[PROOF STEP]
apply(unfold tendsto_iff dist_norm, clarsimp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>x. \<parallel>G x - L\<parallel> \<le> \<parallel>F x - L\<parallel>; \<forall>e>0. \<forall>\<^sub>F x in net. \<parallel>F x - L\<parallel> < e; 0 < e\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in net. \<parallel>G x - L\<parallel> < e
[PROOF STEP]
apply(rule_tac P="\<lambda>x. \<parallel>F x - L\<parallel> < e" in eventually_mono, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e x. \<lbrakk>\<forall>x. \<parallel>G x - L\<parallel> \<le> \<parallel>F x - L\<parallel>; \<forall>e>0. \<forall>\<^sub>F x in net. \<parallel>F x - L\<parallel> < e; 0 < e; \<parallel>F x - L\<parallel> < e\<rbrakk> \<Longrightarrow> \<parallel>G x - L\<parallel> < e
[PROOF STEP]
by (rename_tac e z) (erule_tac x=z in allE, simp)


[STATEMENT]
lemma sturm_firsttwo_signs:
  fixes ps :: "real poly list"
  assumes squarefree: "rsquarefree p"
  assumes p_0: "poly p (x\<^sub>0::real) = 0"
  shows "eventually (\<lambda>x. sgn (poly (p * sturm p ! 1) x) =
             (if x > x\<^sub>0 then 1 else -1)) (at x\<^sub>0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at x\<^sub>0. sgn (poly (p * sturm p ! 1) x) = (if x\<^sub>0 < x then 1 else - 1)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at x\<^sub>0. sgn (poly (p * sturm p ! 1) x) = (if x\<^sub>0 < x then 1 else - 1)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
rsquarefree p
poly p x\<^sub>0 = 0
[PROOF STEP]
have [simp]: "p \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
rsquarefree p
poly p x\<^sub>0 = 0

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

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at x\<^sub>0. sgn (poly (p * sturm p ! 1) x) = (if x\<^sub>0 < x then 1 else - 1)
[PROOF STEP]
with squarefree p_0
[PROOF STATE]
proof (chain)
picking this:
rsquarefree p
poly p x\<^sub>0 = 0
p \<noteq> 0
[PROOF STEP]
have [simp]: "pderiv p \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
rsquarefree p
poly p x\<^sub>0 = 0
p \<noteq> 0

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

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at x\<^sub>0. sgn (poly (p * sturm p ! 1) x) = (if x\<^sub>0 < x then 1 else - 1)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
rsquarefree p
poly p x\<^sub>0 = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rsquarefree p
poly p x\<^sub>0 = 0

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at x\<^sub>0. sgn (poly (p * sturm p ! 1) x) = (if x\<^sub>0 < x then 1 else - 1)
[PROOF STEP]
by (intro sturm_firsttwo_signs_aux,
          simp_all add: rsquarefree_roots)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at x\<^sub>0. sgn (poly (p * sturm p ! 1) x) = (if x\<^sub>0 < x then 1 else - 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gso_cong: assumes "\<And> i. i \<le> x \<Longrightarrow> f1 ! i = f2 ! i"
   "x < length f1" "x < length f2"
  shows "gso f1 x = gso f2 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gram_schmidt_fs.gso n (map of_int_hom.vec_hom f1) x = gram_schmidt_fs.gso n (map of_int_hom.vec_hom f2) x
[PROOF STEP]
by (rule gs.gso_cong, insert assms, auto)


[STATEMENT]
lemma integral_lborel_f:
assumes "f \<in> borel_measurable (lborel_f (Suc n))"
shows "integral\<^sup>N (lborel_f (Suc n)) f = \<integral>\<^sup>+ y. \<integral>\<^sup>+ x. f (x(n := y)) \<partial>lborel_f n \<partial>lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (lborel_f (Suc n)) f = \<integral>\<^sup>+ y. \<integral>\<^sup>+ x. f (x(n := y)) \<partial>lborel_f n \<partial>lborel
[PROOF STEP]
unfolding lborel_f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (Pi\<^sub>M {..<Suc n} (\<lambda>b. lborel)) f = \<integral>\<^sup>+ y. \<integral>\<^sup>+ x. f (x(n := y)) \<partial>Pi\<^sub>M {..<n} (\<lambda>b. lborel) \<partial>lborel
[PROOF STEP]
using product_sigma_finite.product_nn_integral_insert_rev[OF product_sigma_finite_interval, of "{..<n}", OF finite_lessThan _]
  assms[unfolded lborel_f_def] lborel_eq_real
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i \<notin> {..<n}; ?f \<in> borel_measurable (Pi\<^sub>M (insert ?i {..<n}) (\<lambda>b. interval_measure (\<lambda>x. x)))\<rbrakk> \<Longrightarrow> integral\<^sup>N (Pi\<^sub>M (insert ?i {..<n}) (\<lambda>b. interval_measure (\<lambda>x. x))) ?f = \<integral>\<^sup>+ y. \<integral>\<^sup>+ x. ?f (x(?i := y)) \<partial>Pi\<^sub>M {..<n} (\<lambda>b. interval_measure (\<lambda>x. x)) \<partial>interval_measure (\<lambda>x. x)
f \<in> borel_measurable (Pi\<^sub>M {..<Suc n} (\<lambda>b. lborel))
lborel = interval_measure (\<lambda>x. x)

goal (1 subgoal):
 1. integral\<^sup>N (Pi\<^sub>M {..<Suc n} (\<lambda>b. lborel)) f = \<integral>\<^sup>+ y. \<integral>\<^sup>+ x. f (x(n := y)) \<partial>Pi\<^sub>M {..<n} (\<lambda>b. lborel) \<partial>lborel
[PROOF STEP]
by (simp add: lessThan_Suc)


[STATEMENT]
lemma ennexp_mono2 [mono_intros]:
  assumes "x \<le> y"
  shows "ennexp x \<le> ennexp y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennexp x \<le> ennexp y
[PROOF STEP]
using ennexp_mono assms
[PROOF STATE]
proof (prove)
using this:
mono ennexp
x \<le> y

goal (1 subgoal):
 1. ennexp x \<le> ennexp y
[PROOF STEP]
unfolding mono_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. x \<le> y \<longrightarrow> ennexp x \<le> ennexp y
x \<le> y

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


[STATEMENT]
lemma base_repeats_or_shares:
  "\<lbrakk>B \<in> set Bs; D = getbase B\<rbrakk>
\<Longrightarrow> Repeats D \<in> set Bs \<or> Shares D \<in> set Bs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>B \<in> set Bs; D = getbase B\<rbrakk> \<Longrightarrow> Repeats D \<in> set Bs \<or> Shares D \<in> set Bs
[PROOF STEP]
by(induct B rule:base.induct) simp+


[STATEMENT]
lemma psi_split: "psi n = theta n + psi_even n + psi_odd n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. psi n = theta n + psi_even n + psi_odd n
[PROOF STEP]
by (induction n)
     (simp_all add: psi_def theta_def psi_even_def psi_odd_def mangoldt_1_def mangoldt_split)


[STATEMENT]
lemma (in finite_measure) finite_measure_Diff':
  "A \<in> sets M \<Longrightarrow> B \<in> sets M \<Longrightarrow> measure M (A - B) = measure M A - measure M (A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> sets M; B \<in> sets M\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (A - B) = Sigma_Algebra.measure M A - Sigma_Algebra.measure M (A \<inter> B)
[PROOF STEP]
using finite_measure_Diff[of A "A \<inter> B"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A \<in> sets M; A \<inter> B \<in> sets M; A \<inter> B \<subseteq> A\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (A - A \<inter> B) = Sigma_Algebra.measure M A - Sigma_Algebra.measure M (A \<inter> B)

goal (1 subgoal):
 1. \<lbrakk>A \<in> sets M; B \<in> sets M\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (A - B) = Sigma_Algebra.measure M A - Sigma_Algebra.measure M (A \<inter> B)
[PROOF STEP]
by (auto simp: Diff_Int)


[STATEMENT]
lemma harm_pos: "n > 0 \<Longrightarrow> harm n > (0 :: 'a :: {real_normed_field,linordered_field})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> (0::'a) < harm n
[PROOF STEP]
unfolding harm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> (0::'a) < (\<Sum>k = 1..n. inverse (of_nat k))
[PROOF STEP]
by (intro sum_pos) simp_all


[STATEMENT]
lemma vector_sub_project_orthogonal_proj:
  shows "inner b (x - proj x b) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner b (x - proj x b) = (0::'a)
[PROOF STEP]
using vector_sub_project_orthogonal
[PROOF STATE]
proof (prove)
using this:
inner ?b (?x - scale (inner ?x ?b / inner ?b ?b) ?b) = (0::'a)

goal (1 subgoal):
 1. inner b (x - proj x b) = (0::'a)
[PROOF STEP]
unfolding proj_def
[PROOF STATE]
proof (prove)
using this:
inner ?b (?x - scale (inner ?x ?b / inner ?b ?b) ?b) = (0::'a)

goal (1 subgoal):
 1. inner b (x - scale (inner x b / inner b b) b) = (0::'a)
[PROOF STEP]
by simp


[STATEMENT]
lemma sqrt_lower_bound_id:
  assumes "0 \<le> x" "x \<le> 1"
    shows "x \<le> sqrt x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> sqrt x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<le> sqrt x
[PROOF STEP]
have "x^2 \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>2 \<le> x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
x \<le> 1

goal (1 subgoal):
 1. x\<^sup>2 \<le> x
[PROOF STEP]
by (metis one_le_numeral power_decreasing power_one_right)
[PROOF STATE]
proof (state)
this:
x\<^sup>2 \<le> x

goal (1 subgoal):
 1. x \<le> sqrt x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x\<^sup>2 \<le> x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x\<^sup>2 \<le> x

goal (1 subgoal):
 1. x \<le> sqrt x
[PROOF STEP]
by (metis real_le_rsqrt)
[PROOF STATE]
proof (state)
this:
x \<le> sqrt x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma refl_relcl: "lattice L ==> refl (relcl L)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lattice L \<Longrightarrow> refl (relcl L)
[PROOF STEP]
by (simp add: refl_onI relcl_def subset_cl [THEN subsetD])


[STATEMENT]
lemma ennreal_of_enat_le_iff[simp]: "ennreal_of_enat m \<le> ennreal_of_enat n \<longleftrightarrow> m \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ennreal_of_enat m \<le> ennreal_of_enat n) = (m \<le> n)
[PROOF STEP]
by (auto simp: ennreal_of_enat_def top_unique split: enat.split)


[STATEMENT]
lemma function_factors_left:
  "(\<forall>x y. (g x = g y) \<longrightarrow> (f x = f y)) \<longleftrightarrow> (\<exists>h. f = h \<circ> g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y. g x = g y \<longrightarrow> f x = f y) = (\<exists>h. f = h \<circ> g)
[PROOF STEP]
using function_factors_left_gen [of "\<lambda>x. True" g f]
[PROOF STATE]
proof (prove)
using this:
(\<forall>x y. True \<and> True \<and> g x = g y \<longrightarrow> f x = f y) = (\<exists>h. \<forall>x. True \<longrightarrow> f x = h (g x))

goal (1 subgoal):
 1. (\<forall>x y. g x = g y \<longrightarrow> f x = f y) = (\<exists>h. f = h \<circ> g)
[PROOF STEP]
unfolding o_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>x y. True \<and> True \<and> g x = g y \<longrightarrow> f x = f y) = (\<exists>h. \<forall>x. True \<longrightarrow> f x = h (g x))

goal (1 subgoal):
 1. (\<forall>x y. g x = g y \<longrightarrow> f x = f y) = (\<exists>h. f = (\<lambda>x. h (g x)))
[PROOF STEP]
by blast


[STATEMENT]
lemma convergent_add:
  fixes X Y :: "nat \<Rightarrow> 'a::topological_monoid_add"
  assumes "convergent (\<lambda>n. X n)"
    and "convergent (\<lambda>n. Y n)"
  shows "convergent (\<lambda>n. X n + Y n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>n. X n + Y n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
convergent X
convergent Y

goal (1 subgoal):
 1. convergent (\<lambda>n. X n + Y n)
[PROOF STEP]
unfolding convergent_def
[PROOF STATE]
proof (prove)
using this:
\<exists>L. X \<longlonglongrightarrow> L
\<exists>L. Y \<longlonglongrightarrow> L

goal (1 subgoal):
 1. \<exists>L. (\<lambda>n. X n + Y n) \<longlonglongrightarrow> L
[PROOF STEP]
by (blast intro: tendsto_add)


[STATEMENT]
lemma (in domain) rupture_surj_hom:
  assumes "subring K R" and "p \<in> carrier (K[X])"
  shows "(rupture_surj K p) \<in> ring_hom (K[X]) (Rupt K p)"
    and "ring_hom_ring (K[X]) (Rupt K p) (rupture_surj K p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rupture_surj K p \<in> ring_hom (K [X]) (Rupt K p) &&& ring_hom_ring (K [X]) (Rupt K p) (rupture_surj K p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rupture_surj K p \<in> ring_hom (K [X]) (Rupt K p)
 2. ring_hom_ring (K [X]) (Rupt K p) (rupture_surj K p)
[PROOF STEP]
interpret UP: domain "K[X]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. domain (K [X])
[PROOF STEP]
using univ_poly_is_domain[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
domain (K [X])

goal (1 subgoal):
 1. domain (K [X])
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rupture_surj K p \<in> ring_hom (K [X]) (Rupt K p)
 2. ring_hom_ring (K [X]) (Rupt K p) (rupture_surj K p)
[PROOF STEP]
interpret I: ideal "PIdl\<^bsub>K[X]\<^esub> p" "K[X]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ideal (PIdl\<^bsub>K [X]\<^esub> p) (K [X])
[PROOF STEP]
using UP.cgenideal_ideal[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
ideal (PIdl\<^bsub>K [X]\<^esub> p) (K [X])

goal (1 subgoal):
 1. ideal (PIdl\<^bsub>K [X]\<^esub> p) (K [X])
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rupture_surj K p \<in> ring_hom (K [X]) (Rupt K p)
 2. ring_hom_ring (K [X]) (Rupt K p) (rupture_surj K p)
[PROOF STEP]
show "(rupture_surj K p) \<in> ring_hom (K[X]) (Rupt K p)"
   and "ring_hom_ring (K[X]) (Rupt K p) (rupture_surj K p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rupture_surj K p \<in> ring_hom (K [X]) (Rupt K p) &&& ring_hom_ring (K [X]) (Rupt K p) (rupture_surj K p)
[PROOF STEP]
using ring_hom_ring.intro[OF UP.ring_axioms I.quotient_is_ring] I.rcos_ring_hom
[PROOF STATE]
proof (prove)
using this:
ring_hom_ring_axioms (K [X]) (K [X] Quot PIdl\<^bsub>K [X]\<^esub> p) ?h \<Longrightarrow> ring_hom_ring (K [X]) (K [X] Quot PIdl\<^bsub>K [X]\<^esub> p) ?h
rupture_surj K p \<in> ring_hom (K [X]) (K [X] Quot PIdl\<^bsub>K [X]\<^esub> p)

goal (1 subgoal):
 1. rupture_surj K p \<in> ring_hom (K [X]) (Rupt K p) &&& ring_hom_ring (K [X]) (Rupt K p) (rupture_surj K p)
[PROOF STEP]
unfolding symmetric[OF ring_hom_ring_axioms_def] rupture_def
[PROOF STATE]
proof (prove)
using this:
ring_hom_ring_axioms (K [X]) (K [X] Quot PIdl\<^bsub>K [X]\<^esub> p) ?h \<Longrightarrow> ring_hom_ring (K [X]) (K [X] Quot PIdl\<^bsub>K [X]\<^esub> p) ?h
ring_hom_ring_axioms (K [X]) (K [X] Quot PIdl\<^bsub>K [X]\<^esub> p) (rupture_surj K p)

goal (1 subgoal):
 1. ring_hom_ring_axioms (K [X]) (K [X] Quot PIdl\<^bsub>K [X]\<^esub> p) (rupture_surj K p) &&& ring_hom_ring (K [X]) (K [X] Quot PIdl\<^bsub>K [X]\<^esub> p) (rupture_surj K p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rupture_surj K p \<in> ring_hom (K [X]) (Rupt K p)
ring_hom_ring (K [X]) (Rupt K p) (rupture_surj K p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_scc_connected:
  assumes SCC: "is_scc E U"
  assumes MEM: "x\<in>U" "y\<in>U"
  shows "(x,y)\<in>E\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, y) \<in> E\<^sup>*
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_scc E U
x \<in> U
y \<in> U

goal (1 subgoal):
 1. (x, y) \<in> E\<^sup>*
[PROOF STEP]
unfolding is_scc_def
[PROOF STATE]
proof (prove)
using this:
U \<times> U \<subseteq> E\<^sup>* \<and> (\<forall>V. U \<subset> V \<longrightarrow> \<not> V \<times> V \<subseteq> E\<^sup>*)
x \<in> U
y \<in> U

goal (1 subgoal):
 1. (x, y) \<in> E\<^sup>*
[PROOF STEP]
by auto


[STATEMENT]
lemma singular_chain_sum:
   "(\<And>i. i \<in> I \<Longrightarrow> singular_chain p X (f i)) \<Longrightarrow> singular_chain p X (\<Sum>i\<in>I. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> singular_chain p X (f i)) \<Longrightarrow> singular_chain p X (sum f I)
[PROOF STEP]
unfolding singular_chain_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> Poly_Mapping.keys (f i) \<subseteq> singular_simplex_set p X) \<Longrightarrow> Poly_Mapping.keys (sum f I) \<subseteq> singular_simplex_set p X
[PROOF STEP]
using keys_sum [of f I]
[PROOF STATE]
proof (prove)
using this:
Poly_Mapping.keys (sum f I) \<subseteq> (\<Union>i\<in>I. Poly_Mapping.keys (f i))

goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> Poly_Mapping.keys (f i) \<subseteq> singular_simplex_set p X) \<Longrightarrow> Poly_Mapping.keys (sum f I) \<subseteq> singular_simplex_set p X
[PROOF STEP]
by blast


[STATEMENT]
lemma power_by_mult: "VARS a b c
 {a=A & b=B}
 c := (1::nat);
 WHILE b ~= 0
 INV {A^B = c * a^b}
 DO  WHILE b mod 2 = 0
     INV {A^B = c * a^b}
     DO  a := a*a; b := b div 2 OD;
     c := c*a; b := b - 1
 OD
 {c = A^B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a = A \<and> b = B}
c := 1; WHILE b \<noteq> 0 INV {A ^ B = c * a ^ b}  VAR {0}
DO WHILE b mod 2 = 0 INV {A ^ B = c * a ^ b}  VAR {0}
DO a := a * a; b := b div 2 OD; c := c * a; b := b - 1 OD
{c = A ^ B}
[PROOF STEP]
apply vcg_simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b c. A ^ B = c * a ^ b \<and> b mod 2 = Suc 0 \<Longrightarrow> c = 0 \<or> a ^ b = a * a ^ (b - Suc 0)
[PROOF STEP]
apply(case_tac "b")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b c. \<lbrakk>A ^ B = c * a ^ b \<and> b mod 2 = Suc 0; b = 0\<rbrakk> \<Longrightarrow> c = 0 \<or> a ^ b = a * a ^ (b - Suc 0)
 2. \<And>a b c nat. \<lbrakk>A ^ B = c * a ^ b \<and> b mod 2 = Suc 0; b = Suc nat\<rbrakk> \<Longrightarrow> c = 0 \<or> a ^ b = a * a ^ (b - Suc 0)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b c nat. \<lbrakk>A ^ B = c * a ^ b \<and> b mod 2 = Suc 0; b = Suc nat\<rbrakk> \<Longrightarrow> c = 0 \<or> a ^ b = a * a ^ (b - Suc 0)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma l_borel_f_1: "distr (lborel_f 1) lborel (\<lambda>x. x 0) = lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (lborel_f 1) lborel (\<lambda>x. x 0) = lborel
[PROOF STEP]
unfolding lborel_f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr (Pi\<^sub>M {..<1} (\<lambda>b. lborel)) lborel (\<lambda>x. x 0) = lborel
[PROOF STEP]
using product_sigma_finite.distr_singleton[OF product_sigma_finite_interval, of 0]
    lborel_eq_real lessThan_Suc
[PROOF STATE]
proof (prove)
using this:
distr (Pi\<^sub>M {0::?'a1} (\<lambda>b. interval_measure (\<lambda>x. x))) (interval_measure (\<lambda>x. x)) (\<lambda>x. x (0::?'a1)) = interval_measure (\<lambda>x. x)
lborel = interval_measure (\<lambda>x. x)
{..<Suc ?k} = insert ?k {..<?k}

goal (1 subgoal):
 1. distr (Pi\<^sub>M {..<1} (\<lambda>b. lborel)) lborel (\<lambda>x. x 0) = lborel
[PROOF STEP]
by auto


[STATEMENT]
lemma vector_derivative_add_at [simp]:
  "\<lbrakk>f differentiable at a; g differentiable at a\<rbrakk>
   \<Longrightarrow> vector_derivative (\<lambda>x. f x + g x) (at a) = vector_derivative f (at a) + vector_derivative g (at a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f differentiable at a; g differentiable at a\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. f x + g x) (at a) = vector_derivative f (at a) + vector_derivative g (at a)
[PROOF STEP]
by (simp add: vector_derivative_at has_vector_derivative_add vector_derivative_works [symmetric])


[STATEMENT]
lemma matrix_matrix_mul_diag_matr: "A ** diag_mat f = (\<chi> i j. A$i$j * f j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A ** diag_mat f = (\<chi>i j. A $ i $ j * f j)
[PROOF STEP]
unfolding diag_mat_def matrix_matrix_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i j. \<Sum>k\<in>UNIV. A $ i $ k * (\<chi>i j. if i = j then f i else (0::'a)) $ k $ j) = (\<chi>i j. A $ i $ j * f j)
[PROOF STEP]
apply(clarsimp simp: fun_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. (\<Sum>k\<in>UNIV. A $ x $ k * (if k = xa then f k else (0::'a))) = A $ x $ xa * f xa
[PROOF STEP]
subgoal for i j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>UNIV. A $ i $ k * (if k = j then f k else (0::'a))) = A $ i $ j * f j
[PROOF STEP]
by (auto simp: finite_sum_univ_singleton[of _ j])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in domain) degree_mult:
  assumes "subring K R"
  assumes "f \<in> carrier (K[X]) - {\<zero>\<^bsub>K[X]\<^esub>}"
  assumes "g \<in> carrier (K[X]) - {\<zero>\<^bsub>K[X]\<^esub>}"
  shows "degree (f \<otimes>\<^bsub>K[X]\<^esub> g) = degree f + degree g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (f \<otimes>\<^bsub>K [X]\<^esub> g) = degree f + degree g
[PROOF STEP]
unfolding univ_poly_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (poly_mult f g) = degree f + degree g
[PROOF STEP]
using assms(2,3)
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (K [X]) - {\<zero>\<^bsub>K [X]\<^esub>}
g \<in> carrier (K [X]) - {\<zero>\<^bsub>K [X]\<^esub>}

goal (1 subgoal):
 1. degree (poly_mult f g) = degree f + degree g
[PROOF STEP]
by (subst poly_mult_degree_eq[OF assms(1)])
    (auto simp:univ_poly_carrier univ_poly_zero)


[STATEMENT]
lemma prime_multiplicity_gt_zero_iff:
  "prime_elem p \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> multiplicity p x > 0 \<longleftrightarrow> p dvd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime_elem p; x \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> (0 < multiplicity p x) = (p dvd x)
[PROOF STEP]
by (rule multiplicity_gt_zero_iff) simp_all


[STATEMENT]
lemma mult_vec_minus_mult_right: "p ** (- q) = - (p ** q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ** - q = - (p ** q)
[PROOF STEP]
by (rule sym, rule minus_unique, simp add: mult_vec_distrib_left [symmetric] mult_vec_zero_right)


[STATEMENT]
lemma vec_mset_img_map: "image_mset f (mset (xs)) = vec_mset (map_vec f (vec_of_list xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset f (mset xs) = vec_mset (map_vec f (vec_of_list xs))
[PROOF STEP]
by (metis list_vec mset_map mset_vec_eq_mset_list vec_of_list_map)


[STATEMENT]
lemma compute_float_divl[code]:
  "float_divl prec (Float m1 s1) (Float m2 s2) = lapprox_rat prec m1 m2 * Float 1 (s1 - s2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. float_divl prec (Float m1 s1) (Float m2 s2) = lapprox_rat prec m1 m2 * Float 1 (s1 - s2)
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>prec m1 s1 m2 s2. real_divl prec (real_of_int m1 * 2 powr real_of_int s1) (real_of_int m2 * 2 powr real_of_int s2) = truncate_down prec (real_of_int m1 / real_of_int m2) * (real_of_int 1 * 2 powr real_of_int (s1 - s2))
[PROOF STEP]
unfolding real_divl_def of_int_1 mult_1 truncate_down_shift_int[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>prec m1 s1 m2 s2. truncate_down prec (real_of_int m1 * 2 powr real_of_int s1 / (real_of_int m2 * 2 powr real_of_int s2)) = truncate_down prec (real_of_int m1 / real_of_int m2 * 2 powr real_of_int (s1 - s2))
[PROOF STEP]
apply (simp add: powr_diff powr_minus)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma result_exp_1:
  assumes "as \<noteq> []"
  shows "expectation result = real_of_rat (F k as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation local.result = real_of_rat (F k as)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. expectation local.result = real_of_rat (F k as)
[PROOF STEP]
have "expectation result = (\<Sum>a\<in>M\<^sub>1. result a * pmf (pmf_of_set M\<^sub>1) a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation local.result = (\<Sum>a\<in>local.M\<^sub>1. local.result a * pmf (pmf_of_set local.M\<^sub>1) a)
[PROOF STEP]
unfolding \<Omega>\<^sub>1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.expectation (pmf_of_set local.M\<^sub>1) local.result = (\<Sum>a\<in>local.M\<^sub>1. local.result a * pmf (pmf_of_set local.M\<^sub>1) a)
[PROOF STEP]
using non_empty_space assms fin_space
[PROOF STATE]
proof (prove)
using this:
as \<noteq> [] \<Longrightarrow> local.M\<^sub>1 \<noteq> {}
as \<noteq> []
as \<noteq> [] \<Longrightarrow> finite local.M\<^sub>1

goal (1 subgoal):
 1. measure_pmf.expectation (pmf_of_set local.M\<^sub>1) local.result = (\<Sum>a\<in>local.M\<^sub>1. local.result a * pmf (pmf_of_set local.M\<^sub>1) a)
[PROOF STEP]
by (subst integral_measure_pmf_real) auto
[PROOF STATE]
proof (state)
this:
expectation local.result = (\<Sum>a\<in>local.M\<^sub>1. local.result a * pmf (pmf_of_set local.M\<^sub>1) a)

goal (1 subgoal):
 1. expectation local.result = real_of_rat (F k as)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
expectation local.result = (\<Sum>a\<in>local.M\<^sub>1. local.result a * pmf (pmf_of_set local.M\<^sub>1) a)

goal (1 subgoal):
 1. expectation local.result = real_of_rat (F k as)
[PROOF STEP]
have "... = (\<Sum>a\<in>M\<^sub>1. result a / real (length as))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>local.M\<^sub>1. local.result a * pmf (pmf_of_set local.M\<^sub>1) a) = (\<Sum>a\<in>local.M\<^sub>1. local.result a / real (length as))
[PROOF STEP]
using non_empty_space assms fin_space card_space
[PROOF STATE]
proof (prove)
using this:
as \<noteq> [] \<Longrightarrow> local.M\<^sub>1 \<noteq> {}
as \<noteq> []
as \<noteq> [] \<Longrightarrow> finite local.M\<^sub>1
as \<noteq> [] \<Longrightarrow> card local.M\<^sub>1 = length as

goal (1 subgoal):
 1. (\<Sum>a\<in>local.M\<^sub>1. local.result a * pmf (pmf_of_set local.M\<^sub>1) a) = (\<Sum>a\<in>local.M\<^sub>1. local.result a / real (length as))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>local.M\<^sub>1. local.result a * pmf (pmf_of_set local.M\<^sub>1) a) = (\<Sum>a\<in>local.M\<^sub>1. local.result a / real (length as))

goal (1 subgoal):
 1. expectation local.result = real_of_rat (F k as)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>local.M\<^sub>1. local.result a * pmf (pmf_of_set local.M\<^sub>1) a) = (\<Sum>a\<in>local.M\<^sub>1. local.result a / real (length as))

goal (1 subgoal):
 1. expectation local.result = real_of_rat (F k as)
[PROOF STEP]
have "... = (\<Sum>a\<in>M\<^sub>1. real (Suc (snd a) ^ k - snd a ^ k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>local.M\<^sub>1. local.result a / real (length as)) = (\<Sum>a\<in>local.M\<^sub>1. real (Suc (snd a) ^ k - snd a ^ k))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
as \<noteq> []

goal (1 subgoal):
 1. (\<Sum>a\<in>local.M\<^sub>1. local.result a / real (length as)) = (\<Sum>a\<in>local.M\<^sub>1. real (Suc (snd a) ^ k - snd a ^ k))
[PROOF STEP]
by (simp add:result_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>local.M\<^sub>1. local.result a / real (length as)) = (\<Sum>a\<in>local.M\<^sub>1. real (Suc (snd a) ^ k - snd a ^ k))

goal (1 subgoal):
 1. expectation local.result = real_of_rat (F k as)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>local.M\<^sub>1. local.result a / real (length as)) = (\<Sum>a\<in>local.M\<^sub>1. real (Suc (snd a) ^ k - snd a ^ k))

goal (1 subgoal):
 1. expectation local.result = real_of_rat (F k as)
[PROOF STEP]
have "... = (\<Sum>u\<in>set as. \<Sum>v = 0..<count_list as u. real (Suc v ^ k) - real (v ^ k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>local.M\<^sub>1. real (Suc (snd a) ^ k - snd a ^ k)) = (\<Sum>u\<in>set as. \<Sum>v = 0..<count_list as u. real (Suc v ^ k) - real (v ^ k))
[PROOF STEP]
using k_ge_1
[PROOF STATE]
proof (prove)
using this:
1 \<le> k

goal (1 subgoal):
 1. (\<Sum>a\<in>local.M\<^sub>1. real (Suc (snd a) ^ k - snd a ^ k)) = (\<Sum>u\<in>set as. \<Sum>v = 0..<count_list as u. real (Suc v ^ k) - real (v ^ k))
[PROOF STEP]
by (subst split_space, simp add:of_nat_diff)
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>local.M\<^sub>1. real (Suc (snd a) ^ k - snd a ^ k)) = (\<Sum>u\<in>set as. \<Sum>v = 0..<count_list as u. real (Suc v ^ k) - real (v ^ k))

goal (1 subgoal):
 1. expectation local.result = real_of_rat (F k as)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>local.M\<^sub>1. real (Suc (snd a) ^ k - snd a ^ k)) = (\<Sum>u\<in>set as. \<Sum>v = 0..<count_list as u. real (Suc v ^ k) - real (v ^ k))

goal (1 subgoal):
 1. expectation local.result = real_of_rat (F k as)
[PROOF STEP]
have "... = (\<Sum>u\<in>set as. real (count_list as u)^k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>u\<in>set as. \<Sum>v = 0..<count_list as u. real (Suc v ^ k) - real (v ^ k)) = (\<Sum>u\<in>set as. real (count_list as u) ^ k)
[PROOF STEP]
using k_ge_1
[PROOF STATE]
proof (prove)
using this:
1 \<le> k

goal (1 subgoal):
 1. (\<Sum>u\<in>set as. \<Sum>v = 0..<count_list as u. real (Suc v ^ k) - real (v ^ k)) = (\<Sum>u\<in>set as. real (count_list as u) ^ k)
[PROOF STEP]
by (subst sum_Suc_diff') (auto simp add:zero_power)
[PROOF STATE]
proof (state)
this:
(\<Sum>u\<in>set as. \<Sum>v = 0..<count_list as u. real (Suc v ^ k) - real (v ^ k)) = (\<Sum>u\<in>set as. real (count_list as u) ^ k)

goal (1 subgoal):
 1. expectation local.result = real_of_rat (F k as)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>u\<in>set as. \<Sum>v = 0..<count_list as u. real (Suc v ^ k) - real (v ^ k)) = (\<Sum>u\<in>set as. real (count_list as u) ^ k)

goal (1 subgoal):
 1. expectation local.result = real_of_rat (F k as)
[PROOF STEP]
have "... = of_rat (F k as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>u\<in>set as. real (count_list as u) ^ k) = real_of_rat (F k as)
[PROOF STEP]
by (simp add:F_def of_rat_sum of_rat_power)
[PROOF STATE]
proof (state)
this:
(\<Sum>u\<in>set as. real (count_list as u) ^ k) = real_of_rat (F k as)

goal (1 subgoal):
 1. expectation local.result = real_of_rat (F k as)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
expectation local.result = real_of_rat (F k as)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
expectation local.result = real_of_rat (F k as)

goal (1 subgoal):
 1. expectation local.result = real_of_rat (F k as)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
expectation local.result = real_of_rat (F k as)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma to_fun_X_pow:
  assumes "x \<in> carrier R"
  shows "to_fun (X[^]\<^bsub>P\<^esub>(n::nat)) x = x [^] n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun (X_poly R [^]\<^bsub>P\<^esub> n) x = x [^] n
[PROOF STEP]
using to_fun_monom'[of \<one> x n] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<one> \<in> carrier R; \<one> \<noteq> \<zero>; x \<in> carrier R\<rbrakk> \<Longrightarrow> to_fun (\<one> \<odot>\<^bsub>P\<^esub> X_poly R [^]\<^bsub>P\<^esub> n) x = \<one> \<otimes> x [^] n
x \<in> carrier R

goal (1 subgoal):
 1. to_fun (X_poly R [^]\<^bsub>P\<^esub> n) x = x [^] n
[PROOF STEP]
by (metis P.nat_pow_closed R.l_one R.nat_pow_closed R.one_closed R.r_null R.r_one
      UP_one_closed X_closed to_fun_to_poly ring_hom_one smult_l_null smult_one to_poly_is_ring_hom)


[STATEMENT]
lemma lookup_someD: "lookup T x = Some y \<Longrightarrow> \<exists>p. p \<in> set (inorder T) \<and> p = (x, y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup T x = Some y \<Longrightarrow> \<exists>p. p \<in> set (Tree2.inorder T) \<and> p = (x, y)
[PROOF STEP]
by (induction T) (auto split: if_splits)


[STATEMENT]
lemma inv_sum_rel_eq[simp]: "(\<langle>P,Q\<rangle>sum_rel)\<inverse> = \<langle>P\<inverse>,Q\<inverse>\<rangle>sum_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<langle>P, Q\<rangle>sum_rel)\<inverse> = \<langle>P\<inverse>, Q\<inverse>\<rangle>sum_rel
[PROOF STEP]
by (auto simp: sum_rel_def)