[STATEMENT]
lemma nn_integral_monotone_convergence_SUP_nat:
  fixes f :: "'a \<Rightarrow> nat \<Rightarrow> ennreal"
  assumes chain: "Complete_Partial_Order.chain (\<le>) (f ` Y)"
  and nonempty: "Y \<noteq> {}"
  shows "(\<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV) = (SUP i\<in>Y. (\<integral>\<^sup>+ x. f i x \<partial>count_space UNIV))"
  (is "?lhs = ?rhs" is "integral\<^sup>N ?M _ = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV = (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
proof (rule order_class.order.antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
 2. (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i)) \<le> \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV
[PROOF STEP]
show "?rhs \<le> ?lhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i)) \<le> \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV
[PROOF STEP]
by (auto intro!: SUP_least SUP_upper nn_integral_mono)
[PROOF STATE]
proof (state)
this:
(SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i)) \<le> \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
have "\<exists>g. incseq g \<and> range g \<subseteq> (\<lambda>i. f i x) ` Y \<and> (SUP i\<in>Y. f i x) = (SUP i. g i)" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. incseq g \<and> range g \<subseteq> (\<lambda>i. f i x) ` Y \<and> (SUP i\<in>Y. f i x) = Sup (range g)
[PROOF STEP]
by (rule ennreal_Sup_countable_SUP) (simp add: nonempty)
[PROOF STATE]
proof (state)
this:
\<exists>g. incseq g \<and> range g \<subseteq> (\<lambda>i. f i ?x) ` Y \<and> (SUP i\<in>Y. f i ?x) = Sup (range g)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>g. incseq g \<and> range g \<subseteq> (\<lambda>i. f i ?x) ` Y \<and> (SUP i\<in>Y. f i ?x) = Sup (range g)
[PROOF STEP]
obtain g where incseq: "\<And>x. incseq (g x)"
    and range: "\<And>x. range (g x) \<subseteq> (\<lambda>i. f i x) ` Y"
    and sup: "\<And>x. (SUP i\<in>Y. f i x) = (SUP i. g x i)"
[PROOF STATE]
proof (prove)
using this:
\<exists>g. incseq g \<and> range g \<subseteq> (\<lambda>i. f i ?x) ` Y \<and> (SUP i\<in>Y. f i ?x) = Sup (range g)

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>\<And>x. incseq (g x); \<And>x. range (g x) \<subseteq> (\<lambda>i. f i x) ` Y; \<And>x. (SUP i\<in>Y. f i x) = Sup (range (g x))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by moura
[PROOF STATE]
proof (state)
this:
incseq (g ?x)
range (g ?x) \<subseteq> (\<lambda>i. f i ?x) ` Y
(SUP i\<in>Y. f i ?x) = Sup (range (g ?x))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
from incseq
[PROOF STATE]
proof (chain)
picking this:
incseq (g ?x)
[PROOF STEP]
have incseq': "incseq (\<lambda>i x. g x i)"
[PROOF STATE]
proof (prove)
using this:
incseq (g ?x)

goal (1 subgoal):
 1. incseq (\<lambda>i x. g x i)
[PROOF STEP]
by(blast intro: incseq_SucI le_funI dest: incseq_SucD)
[PROOF STATE]
proof (state)
this:
incseq (\<lambda>i x. g x i)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
have "?lhs = \<integral>\<^sup>+ x. (SUP i. g x i) \<partial>?M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV = \<integral>\<^sup>+ x. Sup (range (g x)) \<partial>count_space UNIV
[PROOF STEP]
by(simp add: sup)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV = \<integral>\<^sup>+ x. Sup (range (g x)) \<partial>count_space UNIV

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV = \<integral>\<^sup>+ x. Sup (range (g x)) \<partial>count_space UNIV

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
have "\<dots> = (SUP i. \<integral>\<^sup>+ x. g x i \<partial>?M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. Sup (range (g x)) \<partial>count_space UNIV = (SUP i. \<integral>\<^sup>+ x. g x i \<partial>count_space UNIV)
[PROOF STEP]
using incseq'
[PROOF STATE]
proof (prove)
using this:
incseq (\<lambda>i x. g x i)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. Sup (range (g x)) \<partial>count_space UNIV = (SUP i. \<integral>\<^sup>+ x. g x i \<partial>count_space UNIV)
[PROOF STEP]
by(rule nn_integral_monotone_convergence_SUP) simp
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. Sup (range (g x)) \<partial>count_space UNIV = (SUP i. \<integral>\<^sup>+ x. g x i \<partial>count_space UNIV)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. Sup (range (g x)) \<partial>count_space UNIV = (SUP i. \<integral>\<^sup>+ x. g x i \<partial>count_space UNIV)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
have "\<dots> \<le> (SUP i\<in>Y. \<integral>\<^sup>+ x. f i x \<partial>?M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i. \<integral>\<^sup>+ x. g x i \<partial>count_space UNIV) \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
proof(rule SUP_least)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> \<integral>\<^sup>+ x. g x i \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> \<integral>\<^sup>+ x. g x i \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
have "\<And>x. \<exists>i. g x n = f i x \<and> i \<in> Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<exists>i. g x n = f i x \<and> i \<in> Y
[PROOF STEP]
using range
[PROOF STATE]
proof (prove)
using this:
range (g ?x) \<subseteq> (\<lambda>i. f i ?x) ` Y

goal (1 subgoal):
 1. \<And>x. \<exists>i. g x n = f i x \<and> i \<in> Y
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>i. g ?x n = f i ?x \<and> i \<in> Y

goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> \<integral>\<^sup>+ x. g x i \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>i. g ?x n = f i ?x \<and> i \<in> Y
[PROOF STEP]
obtain I where I: "\<And>x. g x n = f (I x) x" "\<And>x. I x \<in> Y"
[PROOF STATE]
proof (prove)
using this:
\<exists>i. g ?x n = f i ?x \<and> i \<in> Y

goal (1 subgoal):
 1. (\<And>I. \<lbrakk>\<And>x. g x n = f (I x) x; \<And>x. I x \<in> Y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by moura
[PROOF STATE]
proof (state)
this:
g ?x n = f (I ?x) ?x
I ?x \<in> Y

goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> \<integral>\<^sup>+ x. g x i \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
have "(\<integral>\<^sup>+ x. g x n \<partial>count_space UNIV) = (\<Sum>x. g x n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. g x n \<partial>count_space UNIV = (\<Sum>x. g x n)
[PROOF STEP]
by(rule nn_integral_count_space_nat)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. g x n \<partial>count_space UNIV = (\<Sum>x. g x n)

goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> \<integral>\<^sup>+ x. g x i \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. g x n \<partial>count_space UNIV = (\<Sum>x. g x n)

goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> \<integral>\<^sup>+ x. g x i \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
have "\<dots> = (SUP m. \<Sum>x<m. g x n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x. g x n) = (SUP m. \<Sum>x<m. g x n)
[PROOF STEP]
by(rule suminf_eq_SUP)
[PROOF STATE]
proof (state)
this:
(\<Sum>x. g x n) = (SUP m. \<Sum>x<m. g x n)

goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> \<integral>\<^sup>+ x. g x i \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x. g x n) = (SUP m. \<Sum>x<m. g x n)

goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> \<integral>\<^sup>+ x. g x i \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
have "\<dots> \<le> (SUP i\<in>Y. \<integral>\<^sup>+ x. f i x \<partial>?M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP m. \<Sum>x<m. g x n) \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
proof(rule SUP_mono)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. m \<in> UNIV \<Longrightarrow> \<exists>ma\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f ma)
[PROOF STEP]
fix m
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. m \<in> UNIV \<Longrightarrow> \<exists>ma\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f ma)
[PROOF STEP]
show "\<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> (\<integral>\<^sup>+ x. f m' x \<partial>?M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
proof(cases "m > 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
 2. \<not> 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 0 < m

goal (2 subgoals):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
 2. \<not> 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> 0 < m

goal (1 subgoal):
 1. \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
using nonempty
[PROOF STATE]
proof (prove)
using this:
\<not> 0 < m
Y \<noteq> {}

goal (1 subgoal):
 1. \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')

goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
0 < m

goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
let ?Y = "I ` {..<m}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
have "f ` ?Y \<subseteq> f ` Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` I ` {..<m} \<subseteq> f ` Y
[PROOF STEP]
using I
[PROOF STATE]
proof (prove)
using this:
g ?x n = f (I ?x) ?x
I ?x \<in> Y

goal (1 subgoal):
 1. f ` I ` {..<m} \<subseteq> f ` Y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f ` I ` {..<m} \<subseteq> f ` Y

goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
with chain
[PROOF STATE]
proof (chain)
picking this:
Complete_Partial_Order.chain (\<le>) (f ` Y)
f ` I ` {..<m} \<subseteq> f ` Y
[PROOF STEP]
have chain': "Complete_Partial_Order.chain (\<le>) (f ` ?Y)"
[PROOF STATE]
proof (prove)
using this:
Complete_Partial_Order.chain (\<le>) (f ` Y)
f ` I ` {..<m} \<subseteq> f ` Y

goal (1 subgoal):
 1. Complete_Partial_Order.chain (\<le>) (f ` I ` {..<m})
[PROOF STEP]
by(rule chain_subset)
[PROOF STATE]
proof (state)
this:
Complete_Partial_Order.chain (\<le>) (f ` I ` {..<m})

goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
hence "Sup (f ` ?Y) \<in> f ` ?Y"
[PROOF STATE]
proof (prove)
using this:
Complete_Partial_Order.chain (\<le>) (f ` I ` {..<m})

goal (1 subgoal):
 1. Sup (f ` I ` {..<m}) \<in> f ` I ` {..<m}
[PROOF STEP]
by(rule ccpo_class.in_chain_finite)(auto simp add: True lessThan_empty_iff)
[PROOF STATE]
proof (state)
this:
Sup (f ` I ` {..<m}) \<in> f ` I ` {..<m}

goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sup (f ` I ` {..<m}) \<in> f ` I ` {..<m}
[PROOF STEP]
obtain m' where "m' < m" and m': "(SUP i\<in>?Y. f i) = f (I m')"
[PROOF STATE]
proof (prove)
using this:
Sup (f ` I ` {..<m}) \<in> f ` I ` {..<m}

goal (1 subgoal):
 1. (\<And>m'. \<lbrakk>m' < m; Sup (f ` I ` {..<m}) = f (I m')\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m' < m
Sup (f ` I ` {..<m}) = f (I m')

goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
have "I m' \<in> Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I m' \<in> Y
[PROOF STEP]
using I
[PROOF STATE]
proof (prove)
using this:
g ?x n = f (I ?x) ?x
I ?x \<in> Y

goal (1 subgoal):
 1. I m' \<in> Y
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
I m' \<in> Y

goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
have "(\<Sum>x<m. g x n) \<le> (\<Sum>x<m. f (I m') x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x<m. g x n) \<le> sum (f (I m')) {..<m}
[PROOF STEP]
proof(rule sum_mono)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {..<m} \<Longrightarrow> g x n \<le> f (I m') x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {..<m} \<Longrightarrow> g x n \<le> f (I m') x
[PROOF STEP]
assume "x \<in> {..<m}"
[PROOF STATE]
proof (state)
this:
x \<in> {..<m}

goal (1 subgoal):
 1. \<And>x. x \<in> {..<m} \<Longrightarrow> g x n \<le> f (I m') x
[PROOF STEP]
hence "x < m"
[PROOF STATE]
proof (prove)
using this:
x \<in> {..<m}

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

goal (1 subgoal):
 1. \<And>x. x \<in> {..<m} \<Longrightarrow> g x n \<le> f (I m') x
[PROOF STEP]
have "g x n = f (I x) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g x n = f (I x) x
[PROOF STEP]
by(simp add: I)
[PROOF STATE]
proof (state)
this:
g x n = f (I x) x

goal (1 subgoal):
 1. \<And>x. x \<in> {..<m} \<Longrightarrow> g x n \<le> f (I m') x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
g x n = f (I x) x

goal (1 subgoal):
 1. \<And>x. x \<in> {..<m} \<Longrightarrow> g x n \<le> f (I m') x
[PROOF STEP]
have "\<dots> \<le> (SUP i\<in>?Y. f i) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (I x) x \<le> Sup (f ` I ` {..<m}) x
[PROOF STEP]
unfolding Sup_fun_def image_image
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (I x) x \<le> (SUP xa\<in>{..<m}. f (I xa) x)
[PROOF STEP]
using \<open>x \<in> {..<m}\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> {..<m}

goal (1 subgoal):
 1. f (I x) x \<le> (SUP xa\<in>{..<m}. f (I xa) x)
[PROOF STEP]
by (rule Sup_upper [OF imageI])
[PROOF STATE]
proof (state)
this:
f (I x) x \<le> Sup (f ` I ` {..<m}) x

goal (1 subgoal):
 1. \<And>x. x \<in> {..<m} \<Longrightarrow> g x n \<le> f (I m') x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f (I x) x \<le> Sup (f ` I ` {..<m}) x

goal (1 subgoal):
 1. \<And>x. x \<in> {..<m} \<Longrightarrow> g x n \<le> f (I m') x
[PROOF STEP]
have "\<dots> = f (I m') x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (f ` I ` {..<m}) x = f (I m') x
[PROOF STEP]
unfolding m'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (I m') x = f (I m') x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Sup (f ` I ` {..<m}) x = f (I m') x

goal (1 subgoal):
 1. \<And>x. x \<in> {..<m} \<Longrightarrow> g x n \<le> f (I m') x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
g x n \<le> f (I m') x
[PROOF STEP]
show "g x n \<le> f (I m') x"
[PROOF STATE]
proof (prove)
using this:
g x n \<le> f (I m') x

goal (1 subgoal):
 1. g x n \<le> f (I m') x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
g x n \<le> f (I m') x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>x<m. g x n) \<le> sum (f (I m')) {..<m}

goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x<m. g x n) \<le> sum (f (I m')) {..<m}

goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
have "\<dots> \<le> (SUP m. (\<Sum>x<m. f (I m') x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (f (I m')) {..<m} \<le> (SUP m. sum (f (I m')) {..<m})
[PROOF STEP]
by(rule SUP_upper) simp
[PROOF STATE]
proof (state)
this:
sum (f (I m')) {..<m} \<le> (SUP m. sum (f (I m')) {..<m})

goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (f (I m')) {..<m} \<le> (SUP m. sum (f (I m')) {..<m})

goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
have "\<dots> = (\<Sum>x. f (I m') x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP m. sum (f (I m')) {..<m}) = (\<Sum>x. f (I m') x)
[PROOF STEP]
by(rule suminf_eq_SUP[symmetric])
[PROOF STATE]
proof (state)
this:
(SUP m. sum (f (I m')) {..<m}) = (\<Sum>x. f (I m') x)

goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(SUP m. sum (f (I m')) {..<m}) = (\<Sum>x. f (I m') x)

goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
have "\<dots> = (\<integral>\<^sup>+ x. f (I m') x \<partial>?M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x. f (I m') x) = integral\<^sup>N (count_space UNIV) (f (I m'))
[PROOF STEP]
by(rule nn_integral_count_space_nat[symmetric])
[PROOF STATE]
proof (state)
this:
(\<Sum>x. f (I m') x) = integral\<^sup>N (count_space UNIV) (f (I m'))

goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f (I m'))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f (I m'))

goal (1 subgoal):
 1. \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
using \<open>I m' \<in> Y\<close>
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f (I m'))
I m' \<in> Y

goal (1 subgoal):
 1. \<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>m'\<in>Y. (\<Sum>x<m. g x n) \<le> integral\<^sup>N (count_space UNIV) (f m')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(SUP m. \<Sum>x<m. g x n) \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))

goal (1 subgoal):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> \<integral>\<^sup>+ x. g x i \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. g x n \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
show "(\<integral>\<^sup>+ x. g x n \<partial>count_space UNIV) \<le> \<dots>"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. g x n \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. g x n \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. g x n \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(SUP i. \<integral>\<^sup>+ x. g x i \<partial>count_space UNIV) \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
show "?lhs \<le> ?rhs"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space UNIV \<le> (SUP i\<in>Y. integral\<^sup>N (count_space UNIV) (f i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma towards_idem: "\<bottom> = \<bottom> \<squnion> \<bottom>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bottom> = \<bottom> \<squnion> \<bottom>
[PROOF STEP]
by (metis dbl_neg huntington inf_compl inf_eq sup_assoc sup_comm sup_compl)


[STATEMENT]
lemma sum_list_double_concat:
  fixes f :: "'b \<Rightarrow> 'c \<Rightarrow> 'a :: comm_monoid_add" and g as bs
  shows "sum_list (concat (map (\<lambda> i. map (\<lambda> j. f i j + g i j) as) bs))
      = sum_list (concat (map (\<lambda> i. map (\<lambda> j. f i j) as) bs)) +
        sum_list (concat (map (\<lambda> i. map (\<lambda> j. g i j) as) bs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) bs)) = sum_list (concat (map (\<lambda>i. map (f i) as) bs)) + sum_list (concat (map (\<lambda>i. map (g i) as) bs))
[PROOF STEP]
proof (induct bs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) [])) = sum_list (concat (map (\<lambda>i. map (f i) as) [])) + sum_list (concat (map (\<lambda>i. map (g i) as) []))
 2. \<And>a bs. sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) bs)) = sum_list (concat (map (\<lambda>i. map (f i) as) bs)) + sum_list (concat (map (\<lambda>i. map (g i) as) bs)) \<Longrightarrow> sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) (a # bs))) = sum_list (concat (map (\<lambda>i. map (f i) as) (a # bs))) + sum_list (concat (map (\<lambda>i. map (g i) as) (a # bs)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) [])) = sum_list (concat (map (\<lambda>i. map (f i) as) [])) + sum_list (concat (map (\<lambda>i. map (g i) as) []))
 2. \<And>a bs. sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) bs)) = sum_list (concat (map (\<lambda>i. map (f i) as) bs)) + sum_list (concat (map (\<lambda>i. map (g i) as) bs)) \<Longrightarrow> sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) (a # bs))) = sum_list (concat (map (\<lambda>i. map (f i) as) (a # bs))) + sum_list (concat (map (\<lambda>i. map (g i) as) (a # bs)))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) [])) = sum_list (concat (map (\<lambda>i. map (f i) as) [])) + sum_list (concat (map (\<lambda>i. map (g i) as) []))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) [])) = sum_list (concat (map (\<lambda>i. map (f i) as) [])) + sum_list (concat (map (\<lambda>i. map (g i) as) []))

goal (1 subgoal):
 1. \<And>a bs. sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) bs)) = sum_list (concat (map (\<lambda>i. map (f i) as) bs)) + sum_list (concat (map (\<lambda>i. map (g i) as) bs)) \<Longrightarrow> sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) (a # bs))) = sum_list (concat (map (\<lambda>i. map (f i) as) (a # bs))) + sum_list (concat (map (\<lambda>i. map (g i) as) (a # bs)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a bs. sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) bs)) = sum_list (concat (map (\<lambda>i. map (f i) as) bs)) + sum_list (concat (map (\<lambda>i. map (g i) as) bs)) \<Longrightarrow> sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) (a # bs))) = sum_list (concat (map (\<lambda>i. map (f i) as) (a # bs))) + sum_list (concat (map (\<lambda>i. map (g i) as) (a # bs)))
[PROOF STEP]
case (Cons b bs)
[PROOF STATE]
proof (state)
this:
sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) bs)) = sum_list (concat (map (\<lambda>i. map (f i) as) bs)) + sum_list (concat (map (\<lambda>i. map (g i) as) bs))

goal (1 subgoal):
 1. \<And>a bs. sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) bs)) = sum_list (concat (map (\<lambda>i. map (f i) as) bs)) + sum_list (concat (map (\<lambda>i. map (g i) as) bs)) \<Longrightarrow> sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) (a # bs))) = sum_list (concat (map (\<lambda>i. map (f i) as) (a # bs))) + sum_list (concat (map (\<lambda>i. map (g i) as) (a # bs)))
[PROOF STEP]
have id: "(\<Sum>j\<leftarrow>as. f b j + g b j) = sum_list (map (f b) as) + sum_list (map (g b) as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>as. f b j + g b j) = sum_list (map (f b) as) + sum_list (map (g b) as)
[PROOF STEP]
by (induct as, auto simp: ac_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<leftarrow>as. f b j + g b j) = sum_list (map (f b) as) + sum_list (map (g b) as)

goal (1 subgoal):
 1. \<And>a bs. sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) bs)) = sum_list (concat (map (\<lambda>i. map (f i) as) bs)) + sum_list (concat (map (\<lambda>i. map (g i) as) bs)) \<Longrightarrow> sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) (a # bs))) = sum_list (concat (map (\<lambda>i. map (f i) as) (a # bs))) + sum_list (concat (map (\<lambda>i. map (g i) as) (a # bs)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) (b # bs))) = sum_list (concat (map (\<lambda>i. map (f i) as) (b # bs))) + sum_list (concat (map (\<lambda>i. map (g i) as) (b # bs)))
[PROOF STEP]
unfolding list.map concat.simps sum_list_append
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>as. f b j + g b j) + sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) bs)) = sum_list (map (f b) as) + sum_list (concat (map (\<lambda>i. map (f i) as) bs)) + (sum_list (map (g b) as) + sum_list (concat (map (\<lambda>i. map (g i) as) bs)))
[PROOF STEP]
unfolding Cons
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<leftarrow>as. f b j + g b j) + (sum_list (concat (map (\<lambda>i. map (f i) as) bs)) + sum_list (concat (map (\<lambda>i. map (g i) as) bs))) = sum_list (map (f b) as) + sum_list (concat (map (\<lambda>i. map (f i) as) bs)) + (sum_list (map (g b) as) + sum_list (concat (map (\<lambda>i. map (g i) as) bs)))
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map (f b) as) + sum_list (map (g b) as) + (sum_list (concat (map (\<lambda>i. map (f i) as) bs)) + sum_list (concat (map (\<lambda>i. map (g i) as) bs))) = sum_list (map (f b) as) + sum_list (concat (map (\<lambda>i. map (f i) as) bs)) + (sum_list (map (g b) as) + sum_list (concat (map (\<lambda>i. map (g i) as) bs)))
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
sum_list (concat (map (\<lambda>i. map (\<lambda>j. f i j + g i j) as) (b # bs))) = sum_list (concat (map (\<lambda>i. map (f i) as) (b # bs))) + sum_list (concat (map (\<lambda>i. map (g i) as) (b # bs)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma topological_sort_inv_termination:
  assumes "v \<noteq> 1"
      and "topological_sort_inv q v R W"
    shows "card {z . z \<le> -(v + choose_point (minimum R (-v)))} < card { z . z \<le> -v }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {z. z \<le> - (v + choose_point (minimum R (- v)))} < card {z. z \<le> - v}
[PROOF STEP]
proof (rule decrease_variant)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. - (v + choose_point (minimum R (- v))) \<le> - v
 2. ?w \<le> - v
 3. \<not> ?w \<le> - (v + choose_point (minimum R (- v)))
[PROOF STEP]
let ?p = "choose_point (minimum R (-v))"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. - (v + choose_point (minimum R (- v))) \<le> - v
 2. ?w \<le> - v
 3. \<not> ?w \<le> - (v + choose_point (minimum R (- v)))
[PROOF STEP]
let ?v = "v + ?p"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. - (v + choose_point (minimum R (- v))) \<le> - v
 2. ?w \<le> - v
 3. \<not> ?w \<le> - (v + choose_point (minimum R (- v)))
[PROOF STEP]
show "-?v \<le> -v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (v + choose_point (minimum R (- v))) \<le> - v
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- (v + choose_point (minimum R (- v))) \<le> - v

goal (2 subgoals):
 1. ?w \<le> - v
 2. \<not> ?w \<le> - (v + choose_point (minimum R (- v)))
[PROOF STEP]
show "?p \<le> -v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. choose_point (minimum R (- v)) \<le> - v
[PROOF STEP]
using choose_point_decreasing inf.boundedE
[PROOF STATE]
proof (prove)
using this:
choose_point ?x \<le> ?x
\<lbrakk>?a \<le> ?b \<cdot> ?c; \<lbrakk>?a \<le> ?b; ?a \<le> ?c\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. choose_point (minimum R (- v)) \<le> - v
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
choose_point (minimum R (- v)) \<le> - v

goal (1 subgoal):
 1. \<not> choose_point (minimum R (- v)) \<le> - (v + choose_point (minimum R (- v)))
[PROOF STEP]
have "point ?p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. point (choose_point (minimum R (- v)))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v \<noteq> 1
topological_sort_inv q v R W

goal (1 subgoal):
 1. point (choose_point (minimum R (- v)))
[PROOF STEP]
by (metis choose_point_point compl_bot_eq double_compl galois_aux2 comp_assoc is_vector_def
              vector_compl vector_mult)
[PROOF STATE]
proof (state)
this:
point (choose_point (minimum R (- v)))

goal (1 subgoal):
 1. \<not> choose_point (minimum R (- v)) \<le> - (v + choose_point (minimum R (- v)))
[PROOF STEP]
thus "\<not> (?p \<le> -?v)"
[PROOF STATE]
proof (prove)
using this:
point (choose_point (minimum R (- v)))

goal (1 subgoal):
 1. \<not> choose_point (minimum R (- v)) \<le> - (v + choose_point (minimum R (- v)))
[PROOF STEP]
by (metis annir compl_sup inf.absorb1 inf_compl_bot_right maddux_20 no_end_point_char)
[PROOF STATE]
proof (state)
this:
\<not> choose_point (minimum R (- v)) \<le> - (v + choose_point (minimum R (- v)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma DERIV_pow: "((\<lambda>x. x ^ n) has_field_derivative real n * (x ^ (n - Suc 0))) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x ^ n) has_real_derivative real n * x ^ (n - Suc 0)) (at x within s)
[PROOF STEP]
using DERIV_power [OF DERIV_ident]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. x ^ ?n) has_field_derivative of_nat ?n * ((1::?'a) * ?x ^ (?n - Suc 0))) (at ?x within ?s)

goal (1 subgoal):
 1. ((\<lambda>x. x ^ n) has_real_derivative real n * x ^ (n - Suc 0)) (at x within s)
[PROOF STEP]
by simp


[STATEMENT]
lemma (in deutsch) deutsch_algo_eval_is_sum_mod_2:
  shows "deutsch_algo_eval = (f 0 + f 1) mod 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deutsch_algo_eval = real ((f 0 + f 1) mod 2)
[PROOF STEP]
using deutsch_algo_eval_def f_cases is_const_sum_mod_2 is_balanced_sum_mod_2
prob1_deutsch_algo_const prob1_deutsch_algo_balanced
[PROOF STATE]
proof (prove)
using this:
deutsch_algo_eval \<equiv> prob1 2 deutsch_algo 0
is_const \<or> is_balanced
is_const \<Longrightarrow> (f 0 + f 1) mod 2 = 0
is_balanced \<Longrightarrow> (f 0 + f 1) mod 2 = 1
is_const \<Longrightarrow> prob1 2 deutsch_algo 0 = 0
is_balanced \<Longrightarrow> prob1 2 deutsch_algo 0 = 1

goal (1 subgoal):
 1. deutsch_algo_eval = real ((f 0 + f 1) mod 2)
[PROOF STEP]
by auto


[STATEMENT]
lemma convex_polychain_appendI:
  assumes cxs: "convex_polychain xs"
  assumes cys: "convex_polychain ys"
  assumes pxy: "polychain (xs @ ys)"
  assumes "xs \<noteq> [] \<Longrightarrow> ys \<noteq> [] \<Longrightarrow> det3 (fst (last xs)) (snd (last xs)) (snd (hd ys)) > 0"
  shows "convex_polychain (xs @ ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_polychain (xs @ ys)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex_polychain (xs @ ys)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex_polychain (xs @ ys)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex_polychain (xs @ ys)
[PROOF STEP]
assume "i < length xs" "length xs \<le> Suc i" "Suc i < length xs + length ys"
[PROOF STATE]
proof (state)
this:
i < length xs
length xs \<le> Suc i
Suc i < length xs + length ys

goal (1 subgoal):
 1. convex_polychain (xs @ ys)
[PROOF STEP]
hence "xs \<noteq> []" "ys \<noteq> []" "i = length xs - 1"
[PROOF STATE]
proof (prove)
using this:
i < length xs
length xs \<le> Suc i
Suc i < length xs + length ys

goal (1 subgoal):
 1. xs \<noteq> [] &&& ys \<noteq> [] &&& i = length xs - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xs \<noteq> []
ys \<noteq> []
i = length xs - 1

goal (1 subgoal):
 1. convex_polychain (xs @ ys)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i2 < length xs; length xs \<le> Suc ?i2; Suc ?i2 < length xs + length ys\<rbrakk> \<Longrightarrow> xs \<noteq> []
\<lbrakk>?i2 < length xs; length xs \<le> Suc ?i2; Suc ?i2 < length xs + length ys\<rbrakk> \<Longrightarrow> ys \<noteq> []
\<lbrakk>?i2 < length xs; length xs \<le> Suc ?i2; Suc ?i2 < length xs + length ys\<rbrakk> \<Longrightarrow> ?i2 = length xs - 1

goal (1 subgoal):
 1. convex_polychain (xs @ ys)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i2 < length xs; length xs \<le> Suc ?i2; Suc ?i2 < length xs + length ys\<rbrakk> \<Longrightarrow> xs \<noteq> []
\<lbrakk>?i2 < length xs; length xs \<le> Suc ?i2; Suc ?i2 < length xs + length ys\<rbrakk> \<Longrightarrow> ys \<noteq> []
\<lbrakk>?i2 < length xs; length xs \<le> Suc ?i2; Suc ?i2 < length xs + length ys\<rbrakk> \<Longrightarrow> ?i2 = length xs - 1

goal (1 subgoal):
 1. convex_polychain (xs @ ys)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i2 < length xs; length xs \<le> Suc ?i2; Suc ?i2 < length xs + length ys\<rbrakk> \<Longrightarrow> xs \<noteq> []
\<lbrakk>?i2 < length xs; length xs \<le> Suc ?i2; Suc ?i2 < length xs + length ys\<rbrakk> \<Longrightarrow> ys \<noteq> []
\<lbrakk>?i2 < length xs; length xs \<le> Suc ?i2; Suc ?i2 < length xs + length ys\<rbrakk> \<Longrightarrow> ?i2 = length xs - 1
convex_polychain xs
convex_polychain ys
polychain (xs @ ys)
\<lbrakk>xs \<noteq> []; ys \<noteq> []\<rbrakk> \<Longrightarrow> 0 < det3 (fst (last xs)) (snd (last xs)) (snd (hd ys))

goal (1 subgoal):
 1. convex_polychain (xs @ ys)
[PROOF STEP]
by (auto simp: hd_conv_nth convex_polychain_def nth_append Suc_diff_le last_conv_nth )
[PROOF STATE]
proof (state)
this:
convex_polychain (xs @ ys)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powr_smallo_one: "e < (0::real) \<Longrightarrow> (\<lambda>x. x powr e) \<in> o(\<lambda>_. 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e < 0 \<Longrightarrow> (\<lambda>x. x powr e) \<in> o(\<lambda>_. 1)
[PROOF STEP]
by (intro smalloI_tendsto) (auto intro!: tendsto_neg_powr filterlim_ident)


[STATEMENT]
lemma fls_integral_fls_deriv:
  fixes a :: "'a::{division_ring,ring_char_0} fls"
  shows "fls_integral (fls_deriv a) + fls_const (a$$0) = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_integral (fls_deriv a) + fls_const (a $$ 0) = a
[PROOF STEP]
by    (intro fls_eqI) (simp add: mult.assoc[symmetric])


[STATEMENT]
lemma istopology_subbase:
   "istopology (arbitrary union_of (finite intersection_of P relative_to S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. istopology (arbitrary union_of (finite intersection_of P relative_to S))
[PROOF STEP]
by (simp add: finite_intersection_of_Int istopology_base relative_to_Int)


[STATEMENT]
lemma qbs_prob_var_affine:
  assumes "qbs_integrable s f"
  shows "qbs_prob_var s (\<lambda>x. a * f x + b) = a\<^sup>2 * qbs_prob_var s f"
        (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. qbs_prob_var s (\<lambda>x. a * f x + b) = a\<^sup>2 * qbs_prob_var s f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. qbs_prob_var s (\<lambda>x. a * f x + b) = a\<^sup>2 * qbs_prob_var s f
[PROOF STEP]
have "?lhs = qbs_prob_integral s (\<lambda>x. (a * f x + b - (a * qbs_prob_integral s f + b))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. qbs_prob_var s (\<lambda>x. a * f x + b) = \<integral>\<^sub>Q x. (a * f x + b - (a * qbs_prob_integral s f + b))\<^sup>2 \<partial>s
[PROOF STEP]
using qbs_prob_integral_add[OF qbs_integrable_mult[OF assms,of a] qbs_integrable_const[of s b]]
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sub>Q x. a * f x + b \<partial>s = \<integral>\<^sub>Q x. a * f x \<partial>s + \<integral>\<^sub>Q x. b \<partial>s

goal (1 subgoal):
 1. qbs_prob_var s (\<lambda>x. a * f x + b) = \<integral>\<^sub>Q x. (a * f x + b - (a * qbs_prob_integral s f + b))\<^sup>2 \<partial>s
[PROOF STEP]
by (simp add: qbs_prob_integral_cmult qbs_prob_integral_const qbs_prob_var_def)
[PROOF STATE]
proof (state)
this:
qbs_prob_var s (\<lambda>x. a * f x + b) = \<integral>\<^sub>Q x. (a * f x + b - (a * qbs_prob_integral s f + b))\<^sup>2 \<partial>s

goal (1 subgoal):
 1. qbs_prob_var s (\<lambda>x. a * f x + b) = a\<^sup>2 * qbs_prob_var s f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
qbs_prob_var s (\<lambda>x. a * f x + b) = \<integral>\<^sub>Q x. (a * f x + b - (a * qbs_prob_integral s f + b))\<^sup>2 \<partial>s

goal (1 subgoal):
 1. qbs_prob_var s (\<lambda>x. a * f x + b) = a\<^sup>2 * qbs_prob_var s f
[PROOF STEP]
have "... = qbs_prob_integral s (\<lambda>x. (a * f x - a * qbs_prob_integral s f)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sub>Q x. (a * f x + b - (a * qbs_prob_integral s f + b))\<^sup>2 \<partial>s = \<integral>\<^sub>Q x. (a * f x - a * qbs_prob_integral s f)\<^sup>2 \<partial>s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<integral>\<^sub>Q x. (a * f x + b - (a * qbs_prob_integral s f + b))\<^sup>2 \<partial>s = \<integral>\<^sub>Q x. (a * f x - a * qbs_prob_integral s f)\<^sup>2 \<partial>s

goal (1 subgoal):
 1. qbs_prob_var s (\<lambda>x. a * f x + b) = a\<^sup>2 * qbs_prob_var s f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sub>Q x. (a * f x + b - (a * qbs_prob_integral s f + b))\<^sup>2 \<partial>s = \<integral>\<^sub>Q x. (a * f x - a * qbs_prob_integral s f)\<^sup>2 \<partial>s

goal (1 subgoal):
 1. qbs_prob_var s (\<lambda>x. a * f x + b) = a\<^sup>2 * qbs_prob_var s f
[PROOF STEP]
have "... = qbs_prob_integral s (\<lambda>x. a\<^sup>2 * (f x - qbs_prob_integral s f)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sub>Q x. (a * f x - a * qbs_prob_integral s f)\<^sup>2 \<partial>s = \<integral>\<^sub>Q x. a\<^sup>2 * (f x - qbs_prob_integral s f)\<^sup>2 \<partial>s
[PROOF STEP]
by (metis power_mult_distrib right_diff_distrib)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sub>Q x. (a * f x - a * qbs_prob_integral s f)\<^sup>2 \<partial>s = \<integral>\<^sub>Q x. a\<^sup>2 * (f x - qbs_prob_integral s f)\<^sup>2 \<partial>s

goal (1 subgoal):
 1. qbs_prob_var s (\<lambda>x. a * f x + b) = a\<^sup>2 * qbs_prob_var s f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sub>Q x. (a * f x - a * qbs_prob_integral s f)\<^sup>2 \<partial>s = \<integral>\<^sub>Q x. a\<^sup>2 * (f x - qbs_prob_integral s f)\<^sup>2 \<partial>s

goal (1 subgoal):
 1. qbs_prob_var s (\<lambda>x. a * f x + b) = a\<^sup>2 * qbs_prob_var s f
[PROOF STEP]
have "... = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sub>Q x. a\<^sup>2 * (f x - qbs_prob_integral s f)\<^sup>2 \<partial>s = a\<^sup>2 * qbs_prob_var s f
[PROOF STEP]
by(simp add: qbs_prob_var_def qbs_prob_integral_cmult[of s "a\<^sup>2"])
[PROOF STATE]
proof (state)
this:
\<integral>\<^sub>Q x. a\<^sup>2 * (f x - qbs_prob_integral s f)\<^sup>2 \<partial>s = a\<^sup>2 * qbs_prob_var s f

goal (1 subgoal):
 1. qbs_prob_var s (\<lambda>x. a * f x + b) = a\<^sup>2 * qbs_prob_var s f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
qbs_prob_var s (\<lambda>x. a * f x + b) = a\<^sup>2 * qbs_prob_var s f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
qbs_prob_var s (\<lambda>x. a * f x + b) = a\<^sup>2 * qbs_prob_var s f

goal (1 subgoal):
 1. qbs_prob_var s (\<lambda>x. a * f x + b) = a\<^sup>2 * qbs_prob_var s f
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
qbs_prob_var s (\<lambda>x. a * f x + b) = a\<^sup>2 * qbs_prob_var s f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma count_buildup': "cnt (vebt_buildup n) \<le> 2 * (2::nat)^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnt (vebt_buildup n) \<le> real (2 * 2 ^ n)
[PROOF STEP]
by (simp add: VEBT_internal.count_buildup)


[STATEMENT]
lemma (in Corps) distinct_p_divisors:"\<lbrakk> P \<in> Pds\<^bsub>K\<^esub>; P' \<in> Pds\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow>
          (\<not> P = P') =  (\<not> v_equiv K (\<nu>\<^bsub>K P\<^esub>) (\<nu>\<^bsub>K P'\<^esub>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P \<in> Pds; P' \<in> Pds\<rbrakk> \<Longrightarrow> (P \<noteq> P') = (\<not> v_equiv K (\<nu>\<^bsub>K P\<^esub>) (\<nu>\<^bsub>K P'\<^esub>))
[PROOF STEP]
apply (rule iffI,
       rule contrapos_pp, simp+,
       frule val_equiv_eq_pdiv[of "P" "P'" "\<nu>\<^bsub>K P\<^esub>" "\<nu>\<^bsub>K P'\<^esub>"], assumption+,
       simp add: representative_of_pd_valuation,
       simp add: representative_of_pd_valuation, assumption)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>P \<in> Pds; P' \<in> Pds; P \<noteq> P'; v_equiv K (\<nu>\<^bsub>K P\<^esub>) (\<nu>\<^bsub>K P'\<^esub>)\<rbrakk> \<Longrightarrow> \<nu>\<^bsub>K P\<^esub> \<in> P
 2. \<lbrakk>P \<in> Pds; P' \<in> Pds; P \<noteq> P'; v_equiv K (\<nu>\<^bsub>K P\<^esub>) (\<nu>\<^bsub>K P'\<^esub>)\<rbrakk> \<Longrightarrow> \<nu>\<^bsub>K P'\<^esub> \<in> P'
 3. \<lbrakk>P \<in> Pds; P' \<in> Pds; P \<noteq> P'; v_equiv K (\<nu>\<^bsub>K P\<^esub>) (\<nu>\<^bsub>K P'\<^esub>); P = P'\<rbrakk> \<Longrightarrow> False
 4. \<lbrakk>P \<in> Pds; P' \<in> Pds; \<not> v_equiv K (\<nu>\<^bsub>K P\<^esub>) (\<nu>\<^bsub>K P'\<^esub>)\<rbrakk> \<Longrightarrow> P \<noteq> P'
[PROOF STEP]
apply (rule n_val_representative[of "P"], assumption,
       rule n_val_representative[of "P'"], assumption,
       simp,
       rule contrapos_pp, simp+, frule sym, thin_tac "P = P'",
       simp,
       frule representative_of_pd_valuation[of P],
       frule val_equiv_axiom1[of "\<nu>\<^bsub>K P\<^esub>"], simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cart_product_add_1_filter_eq_mirror: "{#m \<in># M \<times># (add_mset b N) . (fst m \<in> snd m) #} =
    {#m \<in># (M \<times># N) . (fst m \<in> snd m) #} + ({# n \<in># M . n \<in> b #} \<times># {#b#})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {#m \<in># M \<times># add_mset b N. fst m \<in> snd m#} = {#m \<in># M \<times># N. fst m \<in> snd m#} + {#n \<in># M. n \<in> b#} \<times># {#b#}
[PROOF STEP]
unfolding add_mset_add_single [of b N] Sigma_mset_plus_distrib1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {#m \<in># M \<times># (N + {#b#}). fst m \<in> snd m#} = {#m \<in># M \<times># N. fst m \<in> snd m#} + {#n \<in># M. n \<in> b#} \<times># {#b#}
[PROOF STEP]
(* longish *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {#m \<in># M \<times># (N + {#b#}). fst m \<in> snd m#} = {#m \<in># M \<times># N. fst m \<in> snd m#} + {#n \<in># M. n \<in> b#} \<times># {#b#}
[PROOF STEP]
by (metis (no_types) add_mset_add_single cart_product_add_1_filter2 cart_product_singleton_right)


[STATEMENT]
lemma star_denest_var_6: "(x + y)\<^sup>\<star> = x\<^sup>\<star> \<cdot> y\<^sup>\<star> \<cdot> (x + y)\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y)\<^sup>\<star> = x\<^sup>\<star> \<cdot> y\<^sup>\<star> \<cdot> (x + y)\<^sup>\<star>
[PROOF STEP]
by (metis mult.assoc star_denest star_denest_var_3)


[STATEMENT]
lemma denote_while_n_iter_assoc:
  "denote_while_n_iter M0 M1 DS (Suc n) \<rho> = DS (M1 * (denote_while_n_iter M0 M1 DS n \<rho>) * adjoint M1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. denote_while_n_iter M0 M1 DS (Suc n) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS n \<rho> * adjoint M1)
[PROOF STEP]
proof (induct n arbitrary: \<rho>)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>\<rho>. denote_while_n_iter M0 M1 DS (Suc 0) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS 0 \<rho> * adjoint M1)
 2. \<And>n \<rho>. (\<And>\<rho>. denote_while_n_iter M0 M1 DS (Suc n) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS n \<rho> * adjoint M1)) \<Longrightarrow> denote_while_n_iter M0 M1 DS (Suc (Suc n)) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS (Suc n) \<rho> * adjoint M1)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>\<rho>. denote_while_n_iter M0 M1 DS (Suc 0) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS 0 \<rho> * adjoint M1)
 2. \<And>n \<rho>. (\<And>\<rho>. denote_while_n_iter M0 M1 DS (Suc n) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS n \<rho> * adjoint M1)) \<Longrightarrow> denote_while_n_iter M0 M1 DS (Suc (Suc n)) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS (Suc n) \<rho> * adjoint M1)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. denote_while_n_iter M0 M1 DS (Suc 0) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS 0 \<rho> * adjoint M1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
denote_while_n_iter M0 M1 DS (Suc 0) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS 0 \<rho> * adjoint M1)

goal (1 subgoal):
 1. \<And>n \<rho>. (\<And>\<rho>. denote_while_n_iter M0 M1 DS (Suc n) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS n \<rho> * adjoint M1)) \<Longrightarrow> denote_while_n_iter M0 M1 DS (Suc (Suc n)) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS (Suc n) \<rho> * adjoint M1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n \<rho>. (\<And>\<rho>. denote_while_n_iter M0 M1 DS (Suc n) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS n \<rho> * adjoint M1)) \<Longrightarrow> denote_while_n_iter M0 M1 DS (Suc (Suc n)) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS (Suc n) \<rho> * adjoint M1)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
denote_while_n_iter M0 M1 DS (Suc n) ?\<rho> = DS (M1 * denote_while_n_iter M0 M1 DS n ?\<rho> * adjoint M1)

goal (1 subgoal):
 1. \<And>n \<rho>. (\<And>\<rho>. denote_while_n_iter M0 M1 DS (Suc n) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS n \<rho> * adjoint M1)) \<Longrightarrow> denote_while_n_iter M0 M1 DS (Suc (Suc n)) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS (Suc n) \<rho> * adjoint M1)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. denote_while_n_iter M0 M1 DS (Suc (Suc n)) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS (Suc n) \<rho> * adjoint M1)
[PROOF STEP]
apply (subst denote_while_n_iter.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. denote_while_n_iter M0 M1 DS (Suc n) (DS (M1 * \<rho> * adjoint M1)) = DS (M1 * denote_while_n_iter M0 M1 DS (Suc n) \<rho> * adjoint M1)
[PROOF STEP]
apply (subst Suc, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
denote_while_n_iter M0 M1 DS (Suc (Suc n)) \<rho> = DS (M1 * denote_while_n_iter M0 M1 DS (Suc n) \<rho> * adjoint M1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Re_image_cbox:
  assumes "Re a \<le> Re b" "Im a \<le> Im b"
  shows   "Re ` cbox a b = {Re a..Re b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re ` cbox a b = {Re a..Re b}
[PROOF STEP]
using inner_image_cbox[of "1::complex" a b] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 \<in> Basis; \<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i\<rbrakk> \<Longrightarrow> (\<lambda>x. x \<bullet> 1) ` cbox a b = {a \<bullet> 1..b \<bullet> 1}
Re a \<le> Re b
Im a \<le> Im b

goal (1 subgoal):
 1. Re ` cbox a b = {Re a..Re b}
[PROOF STEP]
by (auto simp: Basis_complex_def)


[STATEMENT]
theorem birkhoff_sum_small_asymp_pos_nonergodic:
  assumes [measurable]: "integrable M f" and "e > (0::real)"
  shows "AE x in M. infinite {n. birkhoff_sum f n x \<in> {n * real_cond_exp M Invariants f x .. n * real_cond_exp M Invariants f x + e}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
define g where "g = (\<lambda>x. f x - real_cond_exp M Invariants f x)"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>x. f x - real_cond_exp M Invariants f x)

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
have g_meas [measurable]: "integrable M g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M g
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>x. f x - real_cond_exp M Invariants f x)
[PROOF STEP]
using real_cond_exp_int(1)[OF assms(1)] assms(1)
[PROOF STATE]
proof (prove)
using this:
integrable M (real_cond_exp M Invariants f)
integrable M f

goal (1 subgoal):
 1. integrable M (\<lambda>x. f x - real_cond_exp M Invariants f x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integrable M g

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
have "AE x in M. real_cond_exp M Invariants (real_cond_exp M Invariants f) x = real_cond_exp M Invariants f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. real_cond_exp M Invariants (real_cond_exp M Invariants f) x = real_cond_exp M Invariants f x
[PROOF STEP]
by (rule real_cond_exp_F_meas, auto simp add: real_cond_exp_int(1)[OF assms(1)])
[PROOF STATE]
proof (state)
this:
AE x in M. real_cond_exp M Invariants (real_cond_exp M Invariants f) x = real_cond_exp M Invariants f x

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
AE x in M. real_cond_exp M Invariants (real_cond_exp M Invariants f) x = real_cond_exp M Invariants f x
[PROOF STEP]
have *: "AE x in M. real_cond_exp M Invariants g x = 0"
[PROOF STATE]
proof (prove)
using this:
AE x in M. real_cond_exp M Invariants (real_cond_exp M Invariants f) x = real_cond_exp M Invariants f x

goal (1 subgoal):
 1. AE x in M. real_cond_exp M Invariants g x = 0
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
using this:
AE x in M. real_cond_exp M Invariants (real_cond_exp M Invariants f) x = real_cond_exp M Invariants f x

goal (1 subgoal):
 1. AE x in M. real_cond_exp M Invariants (\<lambda>x. f x - real_cond_exp M Invariants f x) x = 0
[PROOF STEP]
using real_cond_exp_diff[OF assms(1) real_cond_exp_int(1)[OF assms(1)]]
[PROOF STATE]
proof (prove)
using this:
AE x in M. real_cond_exp M Invariants (real_cond_exp M Invariants f) x = real_cond_exp M Invariants f x
AE x in M. real_cond_exp M Invariants (\<lambda>x. f x - real_cond_exp M Invariants f x) x = real_cond_exp M Invariants f x - real_cond_exp M Invariants (real_cond_exp M Invariants f) x

goal (1 subgoal):
 1. AE x in M. real_cond_exp M Invariants (\<lambda>x. f x - real_cond_exp M Invariants f x) x = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in M. real_cond_exp M Invariants g x = 0

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
have "AE x in M. infinite {n. birkhoff_sum g n x \<in> {0..e}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum g n x \<in> {0..e}}
[PROOF STEP]
by (rule birkhoff_sum_small_asymp_lemma, auto simp add: \<open>e>0\<close> * g_meas)
[PROOF STATE]
proof (state)
this:
AE x in M. infinite {n. birkhoff_sum g n x \<in> {0..e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
AE x in M. infinite {n. birkhoff_sum g n x \<in> {0..e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
AE x in M. infinite {n. birkhoff_sum g n x \<in> {0..e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
assume "x \<in> space M" "infinite {n. birkhoff_sum g n x \<in> {0..e}}"
[PROOF STATE]
proof (state)
this:
x \<in> space M
infinite {n. birkhoff_sum g n x \<in> {0..e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
x \<in> space M
infinite {n. birkhoff_sum g n x \<in> {0..e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
assume H: "birkhoff_sum g n x \<in> {0..e}"
[PROOF STATE]
proof (state)
this:
birkhoff_sum g n x \<in> {0..e}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
have "birkhoff_sum g n x = birkhoff_sum f n x - birkhoff_sum (real_cond_exp M Invariants f) n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. birkhoff_sum g n x = birkhoff_sum f n x - birkhoff_sum (real_cond_exp M Invariants f) n x
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. birkhoff_sum (\<lambda>x. f x - real_cond_exp M Invariants f x) n x = birkhoff_sum f n x - birkhoff_sum (real_cond_exp M Invariants f) n x
[PROOF STEP]
using birkhoff_sum_diff
[PROOF STATE]
proof (prove)
using this:
birkhoff_sum (\<lambda>x. ?f x - ?g x) ?n ?x = birkhoff_sum ?f ?n ?x - birkhoff_sum ?g ?n ?x

goal (1 subgoal):
 1. birkhoff_sum (\<lambda>x. f x - real_cond_exp M Invariants f x) n x = birkhoff_sum f n x - birkhoff_sum (real_cond_exp M Invariants f) n x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
birkhoff_sum g n x = birkhoff_sum f n x - birkhoff_sum (real_cond_exp M Invariants f) n x

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
birkhoff_sum g n x = birkhoff_sum f n x - birkhoff_sum (real_cond_exp M Invariants f) n x

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
have "... = birkhoff_sum f n x - n * real_cond_exp M Invariants f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. birkhoff_sum f n x - birkhoff_sum (real_cond_exp M Invariants f) n x = birkhoff_sum f n x - real n * real_cond_exp M Invariants f x
[PROOF STEP]
using birkhoff_sum_of_invariants \<open>x \<in> space M\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f \<in> borel_measurable Invariants; ?x \<in> space M\<rbrakk> \<Longrightarrow> birkhoff_sum ?f ?n ?x = real ?n * ?f ?x
x \<in> space M

goal (1 subgoal):
 1. birkhoff_sum f n x - birkhoff_sum (real_cond_exp M Invariants f) n x = birkhoff_sum f n x - real n * real_cond_exp M Invariants f x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
birkhoff_sum f n x - birkhoff_sum (real_cond_exp M Invariants f) n x = birkhoff_sum f n x - real n * real_cond_exp M Invariants f x

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
birkhoff_sum g n x = birkhoff_sum f n x - real n * real_cond_exp M Invariants f x
[PROOF STEP]
have "birkhoff_sum f n x \<in> {n * real_cond_exp M Invariants f x .. n * real_cond_exp M Invariants f x + e}"
[PROOF STATE]
proof (prove)
using this:
birkhoff_sum g n x = birkhoff_sum f n x - real n * real_cond_exp M Invariants f x

goal (1 subgoal):
 1. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}
[PROOF STEP]
using H
[PROOF STATE]
proof (prove)
using this:
birkhoff_sum g n x = birkhoff_sum f n x - real n * real_cond_exp M Invariants f x
birkhoff_sum g n x \<in> {0..e}

goal (1 subgoal):
 1. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
birkhoff_sum g ?n5 x \<in> {0..e} \<Longrightarrow> birkhoff_sum f ?n5 x \<in> {real ?n5 * real_cond_exp M Invariants f x..real ?n5 * real_cond_exp M Invariants f x + e}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
birkhoff_sum g ?n5 x \<in> {0..e} \<Longrightarrow> birkhoff_sum f ?n5 x \<in> {real ?n5 * real_cond_exp M Invariants f x..real ?n5 * real_cond_exp M Invariants f x + e}
[PROOF STEP]
have "{n. birkhoff_sum g n x \<in> {0..e}} \<subseteq> {n. birkhoff_sum f n x \<in> {n * real_cond_exp M Invariants f x .. n * real_cond_exp M Invariants f x + e}}"
[PROOF STATE]
proof (prove)
using this:
birkhoff_sum g ?n5 x \<in> {0..e} \<Longrightarrow> birkhoff_sum f ?n5 x \<in> {real ?n5 * real_cond_exp M Invariants f x..real ?n5 * real_cond_exp M Invariants f x + e}

goal (1 subgoal):
 1. {n. birkhoff_sum g n x \<in> {0..e}} \<subseteq> {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{n. birkhoff_sum g n x \<in> {0..e}} \<subseteq> {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{n. birkhoff_sum g n x \<in> {0..e}} \<subseteq> {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
have "infinite {n. birkhoff_sum f n x \<in> {n * real_cond_exp M Invariants f x .. n * real_cond_exp M Invariants f x + e}}"
[PROOF STATE]
proof (prove)
using this:
{n. birkhoff_sum g n x \<in> {0..e}} \<subseteq> {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}

goal (1 subgoal):
 1. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
using \<open>infinite {n. birkhoff_sum g n x \<in> {0..e}}\<close> finite_subset
[PROOF STATE]
proof (prove)
using this:
{n. birkhoff_sum g n x \<in> {0..e}} \<subseteq> {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
infinite {n. birkhoff_sum g n x \<in> {0..e}}
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x5 \<in> space M; infinite {n. birkhoff_sum g n ?x5 \<in> {0..e}}\<rbrakk> \<Longrightarrow> infinite {n. birkhoff_sum f n ?x5 \<in> {real n * real_cond_exp M Invariants f ?x5..real n * real_cond_exp M Invariants f ?x5 + e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
AE x in M. infinite {n. birkhoff_sum g n x \<in> {0..e}}
\<lbrakk>?x5 \<in> space M; infinite {n. birkhoff_sum g n ?x5 \<in> {0..e}}\<rbrakk> \<Longrightarrow> infinite {n. birkhoff_sum f n ?x5 \<in> {real n * real_cond_exp M Invariants f ?x5..real n * real_cond_exp M Invariants f ?x5 + e}}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
AE x in M. infinite {n. birkhoff_sum g n x \<in> {0..e}}
\<lbrakk>?x5 \<in> space M; infinite {n. birkhoff_sum g n ?x5 \<in> {0..e}}\<rbrakk> \<Longrightarrow> infinite {n. birkhoff_sum f n ?x5 \<in> {real n * real_cond_exp M Invariants f ?x5..real n * real_cond_exp M Invariants f ?x5 + e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x..real n * real_cond_exp M Invariants f x + e}}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cf_list_length:
"length (cf_list R p) = Suc (deg R p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (cf_list R p) = Suc (deg R p)
[PROOF STEP]
unfolding cf_list_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (map p [0..<Suc (deg R p)]) = Suc (deg R p)
[PROOF STEP]
by simp


[STATEMENT]
lemma size_bst_insert: "x \<notin> set_tree t \<Longrightarrow> size (Tree_Set.insert x t) = Suc (size t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<notin> set_tree t \<Longrightarrow> size (Tree_Set.insert x t) = Suc (size t)
[PROOF STEP]
by (induction t) auto


[STATEMENT]
lemma path_image_sym:
    "\<lbrakk>pathfinish p = pathstart q; pathfinish q = pathstart p\<rbrakk>
     \<Longrightarrow> path_image(p +++ q) = path_image(q +++ p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pathfinish p = pathstart q; pathfinish q = pathstart p\<rbrakk> \<Longrightarrow> path_image (p +++ q) = path_image (q +++ p)
[PROOF STEP]
by (simp add: path_image_join sup_commute)


[STATEMENT]
lemma vrange_vconverse[simp]: "\<R>\<^sub>\<circ> (r\<inverse>\<^sub>\<circ>) = \<D>\<^sub>\<circ> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (r\<inverse>\<^sub>\<circ>) = \<D>\<^sub>\<circ> r
[PROOF STEP]
by (auto intro!: vsubset_antisym)


[STATEMENT]
lemma CHORun_induct:
  assumes run: "CHORun A rho HOs coords"
  and init: "CHOinitConfig A (rho 0) (coords 0) \<Longrightarrow> P 0"
  and step: "\<And>r. \<lbrakk> P r; CHOnextConfig A r (rho r) (HOs r) (coords (Suc r))
                                      (rho (Suc r)) \<rbrakk> \<Longrightarrow> P (Suc r)"
  shows "P n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P n
[PROOF STEP]
using run
[PROOF STATE]
proof (prove)
using this:
CHORun A rho HOs coords

goal (1 subgoal):
 1. P n
[PROOF STEP]
unfolding CHORun_eq
[PROOF STATE]
proof (prove)
using this:
CHOinitConfig A (rho 0) (coords 0) \<and> (\<forall>r. CHOnextConfig A r (rho r) (HOs r) (coords (Suc r)) (rho (Suc r)))

goal (1 subgoal):
 1. P n
[PROOF STEP]
by (induct n, auto elim: init step)


[STATEMENT]
lemma conv_radius_inftyI:
  fixes f :: "nat \<Rightarrow> 'a :: {banach,real_normed_div_algebra}"
  assumes "\<And>r. \<exists>z. norm z = r \<and> summable (\<lambda>n. f n * z^n)"
  shows   "conv_radius f = \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conv_radius f = \<infinity>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<exists>z. norm z = ?r \<and> summable (\<lambda>n. f n * z ^ n)

goal (1 subgoal):
 1. conv_radius f = \<infinity>
[PROOF STEP]
by (rule conv_radius_inftyI')


[STATEMENT]
lemma interleave_tl: "xs \<in> ys \<otimes> zs \<Longrightarrow> tl xs \<in> tl ys \<otimes> zs \<or> tl xs \<in> ys \<otimes> (tl zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<in> ys \<otimes> zs \<Longrightarrow> tl xs \<in> tl ys \<otimes> zs \<or> tl xs \<in> ys \<otimes> tl zs
[PROOF STEP]
by(induction rule:interleave_induct) auto


[STATEMENT]
lemma nonzero_numer_imp_nonzero_fraction:
  assumes "a \<in> nonzero Z\<^sub>p"
  assumes "b \<in> nonzero Z\<^sub>p"
  shows "frac a b \<noteq> \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fraction Z\<^sub>p a b \<noteq> \<zero>
[PROOF STEP]
by (simp add: Q\<^sub>p_def assms(1) assms(2) nonzero_fraction)


[STATEMENT]
lemma to_fun_to_poly:
  assumes "a \<in> carrier R"
  assumes "b \<in> carrier R"
  shows "to_fun (to_poly a) b = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun (to_polynomial R a) b = a
[PROOF STEP]
unfolding to_function_def to_fun_def to_polynomial_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>s\<in>carrier R. eval R R (\<lambda>x. x) s (monom (UP R) a 0)) b = a
[PROOF STEP]
by (simp add: UP_pre_univ_prop.eval_const UP_pre_univ_prop_fact assms(1) assms(2))


[STATEMENT]
lemma ordertype_WW_1: "ordertype WW (lenlex less_than) \<le> ordertype UNIV (lenlex less_than)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordertype WW (lenlex less_than) \<le> ordertype UNIV (lenlex less_than)
[PROOF STEP]
by (rule ordertype_mono) auto


[STATEMENT]
lemma nat_mirror_nat_mirror_ident: "
  n \<le> l + r \<Longrightarrow> nat_mirror (nat_mirror n l r) l r = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> l + r \<Longrightarrow> nat_mirror (nat_mirror n l r) l r = n
[PROOF STEP]
unfolding nat_mirror_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> l + r \<Longrightarrow> l + r - (l + r - n) = n
[PROOF STEP]
by simp


[STATEMENT]
lemma termdiffs:
  fixes K x :: "'a::{real_normed_field,banach}"
  assumes 1: "summable (\<lambda>n. c n * K ^ n)"
    and 2: "summable (\<lambda>n. (diffs c) n * K ^ n)"
    and 3: "summable (\<lambda>n. (diffs (diffs c)) n * K ^ n)"
    and 4: "norm x < norm K"
  shows "DERIV (\<lambda>x. \<Sum>n. c n * x^n) x :> (\<Sum>n. (diffs c) n * x^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>n. c n * x ^ n) has_field_derivative (\<Sum>n. diffs c n * x ^ n)) (at x)
[PROOF STEP]
unfolding DERIV_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>h. ((\<Sum>n. c n * (x + h) ^ n) - (\<Sum>n. c n * x ^ n)) / h) \<midarrow>0::'a\<rightarrow> (\<Sum>n. diffs c n * x ^ n)
[PROOF STEP]
proof (rule LIM_zero_cancel)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>xa. ((\<Sum>n. c n * (x + xa) ^ n) - (\<Sum>n. c n * x ^ n)) / xa - (\<Sum>n. diffs c n * x ^ n)) \<midarrow>0::'a\<rightarrow> (0::'a)
[PROOF STEP]
show "(\<lambda>h. (suminf (\<lambda>n. c n * (x + h) ^ n) - suminf (\<lambda>n. c n * x^n)) / h
            - suminf (\<lambda>n. diffs c n * x^n)) \<midarrow>0\<rightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>h. ((\<Sum>n. c n * (x + h) ^ n) - (\<Sum>n. c n * x ^ n)) / h - (\<Sum>n. diffs c n * x ^ n)) \<midarrow>0::'a\<rightarrow> (0::'a)
[PROOF STEP]
proof (rule LIM_equal2)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 0 < ?R
 2. \<And>xa. \<lbrakk>xa \<noteq> (0::'a); norm (xa - (0::'a)) < ?R\<rbrakk> \<Longrightarrow> ((\<Sum>n. c n * (x + xa) ^ n) - (\<Sum>n. c n * x ^ n)) / xa - (\<Sum>n. diffs c n * x ^ n) = ?g xa
 3. ?g \<midarrow>0::'a\<rightarrow> (0::'a)
[PROOF STEP]
show "0 < norm K - norm x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < norm K - norm x
[PROOF STEP]
using 4
[PROOF STATE]
proof (prove)
using this:
norm x < norm K

goal (1 subgoal):
 1. 0 < norm K - norm x
[PROOF STEP]
by (simp add: less_diff_eq)
[PROOF STATE]
proof (state)
this:
0 < norm K - norm x

goal (2 subgoals):
 1. \<And>xa. \<lbrakk>xa \<noteq> (0::'a); norm (xa - (0::'a)) < norm K - norm x\<rbrakk> \<Longrightarrow> ((\<Sum>n. c n * (x + xa) ^ n) - (\<Sum>n. c n * x ^ n)) / xa - (\<Sum>n. diffs c n * x ^ n) = ?g xa
 2. ?g \<midarrow>0::'a\<rightarrow> (0::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>xa \<noteq> (0::'a); norm (xa - (0::'a)) < norm K - norm x\<rbrakk> \<Longrightarrow> ((\<Sum>n. c n * (x + xa) ^ n) - (\<Sum>n. c n * x ^ n)) / xa - (\<Sum>n. diffs c n * x ^ n) = ?g xa
 2. ?g \<midarrow>0::'a\<rightarrow> (0::'a)
[PROOF STEP]
fix h :: 'a
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>xa \<noteq> (0::'a); norm (xa - (0::'a)) < norm K - norm x\<rbrakk> \<Longrightarrow> ((\<Sum>n. c n * (x + xa) ^ n) - (\<Sum>n. c n * x ^ n)) / xa - (\<Sum>n. diffs c n * x ^ n) = ?g xa
 2. ?g \<midarrow>0::'a\<rightarrow> (0::'a)
[PROOF STEP]
assume "norm (h - 0) < norm K - norm x"
[PROOF STATE]
proof (state)
this:
norm (h - (0::'a)) < norm K - norm x

goal (2 subgoals):
 1. \<And>xa. \<lbrakk>xa \<noteq> (0::'a); norm (xa - (0::'a)) < norm K - norm x\<rbrakk> \<Longrightarrow> ((\<Sum>n. c n * (x + xa) ^ n) - (\<Sum>n. c n * x ^ n)) / xa - (\<Sum>n. diffs c n * x ^ n) = ?g xa
 2. ?g \<midarrow>0::'a\<rightarrow> (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
norm (h - (0::'a)) < norm K - norm x
[PROOF STEP]
have "norm x + norm h < norm K"
[PROOF STATE]
proof (prove)
using this:
norm (h - (0::'a)) < norm K - norm x

goal (1 subgoal):
 1. norm x + norm h < norm K
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm x + norm h < norm K

goal (2 subgoals):
 1. \<And>xa. \<lbrakk>xa \<noteq> (0::'a); norm (xa - (0::'a)) < norm K - norm x\<rbrakk> \<Longrightarrow> ((\<Sum>n. c n * (x + xa) ^ n) - (\<Sum>n. c n * x ^ n)) / xa - (\<Sum>n. diffs c n * x ^ n) = ?g xa
 2. ?g \<midarrow>0::'a\<rightarrow> (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
norm x + norm h < norm K
[PROOF STEP]
have 5: "norm (x + h) < norm K"
[PROOF STATE]
proof (prove)
using this:
norm x + norm h < norm K

goal (1 subgoal):
 1. norm (x + h) < norm K
[PROOF STEP]
by (rule norm_triangle_ineq [THEN order_le_less_trans])
[PROOF STATE]
proof (state)
this:
norm (x + h) < norm K

goal (2 subgoals):
 1. \<And>xa. \<lbrakk>xa \<noteq> (0::'a); norm (xa - (0::'a)) < norm K - norm x\<rbrakk> \<Longrightarrow> ((\<Sum>n. c n * (x + xa) ^ n) - (\<Sum>n. c n * x ^ n)) / xa - (\<Sum>n. diffs c n * x ^ n) = ?g xa
 2. ?g \<midarrow>0::'a\<rightarrow> (0::'a)
[PROOF STEP]
have "summable (\<lambda>n. c n * x^n)"
      and "summable (\<lambda>n. c n * (x + h) ^ n)"
      and "summable (\<lambda>n. diffs c n * x^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. c n * x ^ n) &&& summable (\<lambda>n. c n * (x + h) ^ n) &&& summable (\<lambda>n. diffs c n * x ^ n)
[PROOF STEP]
using 1 2 4 5
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. c n * K ^ n)
summable (\<lambda>n. diffs c n * K ^ n)
norm x < norm K
norm (x + h) < norm K

goal (1 subgoal):
 1. summable (\<lambda>n. c n * x ^ n) &&& summable (\<lambda>n. c n * (x + h) ^ n) &&& summable (\<lambda>n. diffs c n * x ^ n)
[PROOF STEP]
by (auto elim: powser_inside)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. c n * x ^ n)
summable (\<lambda>n. c n * (x + h) ^ n)
summable (\<lambda>n. diffs c n * x ^ n)

goal (2 subgoals):
 1. \<And>xa. \<lbrakk>xa \<noteq> (0::'a); norm (xa - (0::'a)) < norm K - norm x\<rbrakk> \<Longrightarrow> ((\<Sum>n. c n * (x + xa) ^ n) - (\<Sum>n. c n * x ^ n)) / xa - (\<Sum>n. diffs c n * x ^ n) = ?g xa
 2. ?g \<midarrow>0::'a\<rightarrow> (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
summable (\<lambda>n. c n * x ^ n)
summable (\<lambda>n. c n * (x + h) ^ n)
summable (\<lambda>n. diffs c n * x ^ n)
[PROOF STEP]
have "((\<Sum>n. c n * (x + h) ^ n) - (\<Sum>n. c n * x^n)) / h - (\<Sum>n. diffs c n * x^n) =
          (\<Sum>n. (c n * (x + h) ^ n - c n * x^n) / h - of_nat n * c n * x ^ (n - Suc 0))"
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. c n * x ^ n)
summable (\<lambda>n. c n * (x + h) ^ n)
summable (\<lambda>n. diffs c n * x ^ n)

goal (1 subgoal):
 1. ((\<Sum>n. c n * (x + h) ^ n) - (\<Sum>n. c n * x ^ n)) / h - (\<Sum>n. diffs c n * x ^ n) = (\<Sum>n. (c n * (x + h) ^ n - c n * x ^ n) / h - of_nat n * c n * x ^ (n - Suc 0))
[PROOF STEP]
by (intro sums_unique sums_diff sums_divide diffs_equiv summable_sums)
[PROOF STATE]
proof (state)
this:
((\<Sum>n. c n * (x + h) ^ n) - (\<Sum>n. c n * x ^ n)) / h - (\<Sum>n. diffs c n * x ^ n) = (\<Sum>n. (c n * (x + h) ^ n - c n * x ^ n) / h - of_nat n * c n * x ^ (n - Suc 0))

goal (2 subgoals):
 1. \<And>xa. \<lbrakk>xa \<noteq> (0::'a); norm (xa - (0::'a)) < norm K - norm x\<rbrakk> \<Longrightarrow> ((\<Sum>n. c n * (x + xa) ^ n) - (\<Sum>n. c n * x ^ n)) / xa - (\<Sum>n. diffs c n * x ^ n) = ?g xa
 2. ?g \<midarrow>0::'a\<rightarrow> (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<Sum>n. c n * (x + h) ^ n) - (\<Sum>n. c n * x ^ n)) / h - (\<Sum>n. diffs c n * x ^ n) = (\<Sum>n. (c n * (x + h) ^ n - c n * x ^ n) / h - of_nat n * c n * x ^ (n - Suc 0))
[PROOF STEP]
show "((\<Sum>n. c n * (x + h) ^ n) - (\<Sum>n. c n * x^n)) / h - (\<Sum>n. diffs c n * x^n) =
          (\<Sum>n. c n * (((x + h) ^ n - x^n) / h - of_nat n * x ^ (n - Suc 0)))"
[PROOF STATE]
proof (prove)
using this:
((\<Sum>n. c n * (x + h) ^ n) - (\<Sum>n. c n * x ^ n)) / h - (\<Sum>n. diffs c n * x ^ n) = (\<Sum>n. (c n * (x + h) ^ n - c n * x ^ n) / h - of_nat n * c n * x ^ (n - Suc 0))

goal (1 subgoal):
 1. ((\<Sum>n. c n * (x + h) ^ n) - (\<Sum>n. c n * x ^ n)) / h - (\<Sum>n. diffs c n * x ^ n) = (\<Sum>n. c n * (((x + h) ^ n - x ^ n) / h - of_nat n * x ^ (n - Suc 0)))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
((\<Sum>n. c n * (x + h) ^ n) - (\<Sum>n. c n * x ^ n)) / h - (\<Sum>n. diffs c n * x ^ n) = (\<Sum>n. c n * (((x + h) ^ n - x ^ n) / h - of_nat n * x ^ (n - Suc 0)))

goal (1 subgoal):
 1. (\<lambda>xa. \<Sum>n. c n * (((x + xa) ^ n - x ^ n) / xa - of_nat n * x ^ (n - Suc 0))) \<midarrow>0::'a\<rightarrow> (0::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>xa. \<Sum>n. c n * (((x + xa) ^ n - x ^ n) / xa - of_nat n * x ^ (n - Suc 0))) \<midarrow>0::'a\<rightarrow> (0::'a)
[PROOF STEP]
show "(\<lambda>h. \<Sum>n. c n * (((x + h) ^ n - x^n) / h - of_nat n * x ^ (n - Suc 0))) \<midarrow>0\<rightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>h. \<Sum>n. c n * (((x + h) ^ n - x ^ n) / h - of_nat n * x ^ (n - Suc 0))) \<midarrow>0::'a\<rightarrow> (0::'a)
[PROOF STEP]
by (rule termdiffs_aux [OF 3 4])
[PROOF STATE]
proof (state)
this:
(\<lambda>h. \<Sum>n. c n * (((x + h) ^ n - x ^ n) / h - of_nat n * x ^ (n - Suc 0))) \<midarrow>0::'a\<rightarrow> (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>h. ((\<Sum>n. c n * (x + h) ^ n) - (\<Sum>n. c n * x ^ n)) / h - (\<Sum>n. diffs c n * x ^ n)) \<midarrow>0::'a\<rightarrow> (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma induced_modulus_dvd: "induced_modulus d \<Longrightarrow> d dvd n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. induced_modulus d \<Longrightarrow> d dvd n
[PROOF STEP]
unfolding induced_modulus_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d dvd n \<and> (\<forall>a. coprime a n \<and> [a = 1] (mod d) \<longrightarrow> \<chi> a = 1) \<Longrightarrow> d dvd n
[PROOF STEP]
by blast


[STATEMENT]
lemma connected_components_of_subset_sing:
   "connected_components_of X \<subseteq> {S} \<longleftrightarrow> connected_space X \<and> (topspace X = {} \<or> topspace X = S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (connected_components_of X \<subseteq> {S}) = (connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
proof (cases "topspace X = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. topspace X = {} \<Longrightarrow> (connected_components_of X \<subseteq> {S}) = (connected_space X \<and> (topspace X = {} \<or> topspace X = S))
 2. topspace X \<noteq> {} \<Longrightarrow> (connected_components_of X \<subseteq> {S}) = (connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
topspace X = {}

goal (2 subgoals):
 1. topspace X = {} \<Longrightarrow> (connected_components_of X \<subseteq> {S}) = (connected_space X \<and> (topspace X = {} \<or> topspace X = S))
 2. topspace X \<noteq> {} \<Longrightarrow> (connected_components_of X \<subseteq> {S}) = (connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
topspace X = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
topspace X = {}

goal (1 subgoal):
 1. (connected_components_of X \<subseteq> {S}) = (connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
by (simp add: connected_components_of_empty_space connected_space_topspace_empty)
[PROOF STATE]
proof (state)
this:
(connected_components_of X \<subseteq> {S}) = (connected_space X \<and> (topspace X = {} \<or> topspace X = S))

goal (1 subgoal):
 1. topspace X \<noteq> {} \<Longrightarrow> (connected_components_of X \<subseteq> {S}) = (connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. topspace X \<noteq> {} \<Longrightarrow> (connected_components_of X \<subseteq> {S}) = (connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
topspace X \<noteq> {}

goal (1 subgoal):
 1. topspace X \<noteq> {} \<Longrightarrow> (connected_components_of X \<subseteq> {S}) = (connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
topspace X \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
topspace X \<noteq> {}

goal (1 subgoal):
 1. (connected_components_of X \<subseteq> {S}) = (connected_space X \<and> (topspace X = {} \<or> topspace X = S))
[PROOF STEP]
by (metis (no_types, opaque_lifting) Union_connected_components_of ccpo_Sup_singleton
        connected_components_of_eq_empty connected_space_iff_components_eq insertI1 singletonD
        subsetI subset_singleton_iff)
[PROOF STATE]
proof (state)
this:
(connected_components_of X \<subseteq> {S}) = (connected_space X \<and> (topspace X = {} \<or> topspace X = S))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma atom_map_minus_pres: "atom_map (x - y) = atom_map x - atom_map y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. atom_map (x - y) = atom_map x - atom_map y
[PROOF STEP]
using atom_map_compl_pres atom_map_def diff_eq
[PROOF STATE]
proof (prove)
using this:
atom_map (- ?x) = Collect atom - atom_map ?x
atom_map ?x = {y. atom y \<and> y \<le> ?x}
?x - ?y = ?x \<sqinter> - ?y

goal (1 subgoal):
 1. atom_map (x - y) = atom_map x - atom_map y
[PROOF STEP]
by auto


[STATEMENT]
lemma inext_lessThan: "Suc t < n \<Longrightarrow> inext t {..<n} = Suc t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc t < n \<Longrightarrow> inext t {..<n} = Suc t
[PROOF STEP]
apply (rule subst[OF Suc_pred, of n], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc t < n \<Longrightarrow> inext t {..<Suc (n - Suc 0)} = Suc t
[PROOF STEP]
apply (subst lessThan_Suc_atMost)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc t < n \<Longrightarrow> inext t {..n - Suc 0} = Suc t
[PROOF STEP]
apply (simp add: inext_atMost)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma \<Delta>\<Phi>_pass1: assumes "hs \<noteq> []"
  shows "\<Phi>_hps (pass\<^sub>1 hs) - \<Phi>_hps hs \<le> 2 * log 2 (size_hps hs) - length hs + 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Phi>_hps (pass\<^sub>1 hs) - \<Phi>_hps hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Phi>_hps (pass\<^sub>1 hs) - \<Phi>_hps hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2
[PROOF STEP]
have "sum_ub hs \<le> 2 * log 2 (size_hps hs) - length hs + 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_ub hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
hs \<noteq> []

goal (1 subgoal):
 1. sum_ub hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2
[PROOF STEP]
by (induct hs rule: sum_ub.induct) (simp_all)
[PROOF STATE]
proof (state)
this:
sum_ub hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2

goal (1 subgoal):
 1. \<Phi>_hps (pass\<^sub>1 hs) - \<Phi>_hps hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
sum_ub hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2

goal (1 subgoal):
 1. \<Phi>_hps (pass\<^sub>1 hs) - \<Phi>_hps hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2
[PROOF STEP]
using \<Delta>\<Phi>_pass1_sum_ub[of hs]
[PROOF STATE]
proof (prove)
using this:
sum_ub hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2
\<Phi>_hps (pass\<^sub>1 hs) - \<Phi>_hps hs \<le> sum_ub hs

goal (1 subgoal):
 1. \<Phi>_hps (pass\<^sub>1 hs) - \<Phi>_hps hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<Phi>_hps (pass\<^sub>1 hs) - \<Phi>_hps hs \<le> 2 * log 2 (real (size_hps hs)) - real (length hs) + 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bin_nth_ops:
  "\<And>x y. (bit :: int \<Rightarrow> nat \<Rightarrow> bool) (x AND y) n \<longleftrightarrow> (bit :: int \<Rightarrow> nat \<Rightarrow> bool) x n \<and> (bit :: int \<Rightarrow> nat \<Rightarrow> bool) y n"
  "\<And>x y. (bit :: int \<Rightarrow> nat \<Rightarrow> bool) (x OR y) n \<longleftrightarrow> (bit :: int \<Rightarrow> nat \<Rightarrow> bool) x n \<or> (bit :: int \<Rightarrow> nat \<Rightarrow> bool) y n"
  "\<And>x y. (bit :: int \<Rightarrow> nat \<Rightarrow> bool) (x XOR y) n \<longleftrightarrow> (bit :: int \<Rightarrow> nat \<Rightarrow> bool) x n \<noteq> (bit :: int \<Rightarrow> nat \<Rightarrow> bool) y n"
  "\<And>x. (bit :: int \<Rightarrow> nat \<Rightarrow> bool) (NOT x) n \<longleftrightarrow> \<not> (bit :: int \<Rightarrow> nat \<Rightarrow> bool) x n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<And>x y. bit (x AND y) n = (bit x n \<and> bit y n)) &&& (\<And>x y. bit (x OR y) n = (bit x n \<or> bit y n))) &&& (\<And>x y. bit (x XOR y) n = (bit x n \<noteq> bit y n)) &&& (\<And>x. bit (NOT x) n = (\<not> bit x n))
[PROOF STEP]
by (simp_all add: bit_and_iff bit_or_iff bit_xor_iff bit_not_iff)


[STATEMENT]
lemma iMODb_div_mod_gr0_not_ex__arith_aux1: "
  \<lbrakk> (0::nat) < k; k < m; 0 < x1 \<rbrakk> \<Longrightarrow>
  x1 * m + x2 - x mod k + x3 + x mod k = x1 * m + x2 + x3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; k < m; 0 < x1\<rbrakk> \<Longrightarrow> x1 * m + x2 - x mod k + x3 + x mod k = x1 * m + x2 + x3
[PROOF STEP]
apply (drule Suc_leI[of _ x1])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; k < m; Suc 0 \<le> x1\<rbrakk> \<Longrightarrow> x1 * m + x2 - x mod k + x3 + x mod k = x1 * m + x2 + x3
[PROOF STEP]
apply (drule mult_le_mono1[of "Suc 0" _ m])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; k < m; Suc 0 * m \<le> x1 * m\<rbrakk> \<Longrightarrow> x1 * m + x2 - x mod k + x3 + x mod k = x1 * m + x2 + x3
[PROOF STEP]
apply (subgoal_tac "x mod k \<le> x1 * m")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < k; k < m; Suc 0 * m \<le> x1 * m; x mod k \<le> x1 * m\<rbrakk> \<Longrightarrow> x1 * m + x2 - x mod k + x3 + x mod k = x1 * m + x2 + x3
 2. \<lbrakk>0 < k; k < m; Suc 0 * m \<le> x1 * m\<rbrakk> \<Longrightarrow> x mod k \<le> x1 * m
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < k; k < m; Suc 0 * m \<le> x1 * m\<rbrakk> \<Longrightarrow> x mod k \<le> x1 * m
 2. \<lbrakk>0 < k; k < m; Suc 0 * m \<le> x1 * m; x mod k \<le> x1 * m\<rbrakk> \<Longrightarrow> x1 * m + x2 - x mod k + x3 + x mod k = x1 * m + x2 + x3
[PROOF STEP]
apply (rule order_trans[OF mod_le_divisor], assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < k; k < m; Suc 0 * m \<le> x1 * m\<rbrakk> \<Longrightarrow> k \<le> x1 * m
 2. \<lbrakk>0 < k; k < m; Suc 0 * m \<le> x1 * m; x mod k \<le> x1 * m\<rbrakk> \<Longrightarrow> x1 * m + x2 - x mod k + x3 + x mod k = x1 * m + x2 + x3
[PROOF STEP]
apply (rule order_less_imp_le)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < k; k < m; Suc 0 * m \<le> x1 * m\<rbrakk> \<Longrightarrow> k < x1 * m
 2. \<lbrakk>0 < k; k < m; Suc 0 * m \<le> x1 * m; x mod k \<le> x1 * m\<rbrakk> \<Longrightarrow> x1 * m + x2 - x mod k + x3 + x mod k = x1 * m + x2 + x3
[PROOF STEP]
apply (rule order_less_le_trans)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>0 < k; k < m; Suc 0 * m \<le> x1 * m\<rbrakk> \<Longrightarrow> k < ?y11
 2. \<lbrakk>0 < k; k < m; Suc 0 * m \<le> x1 * m\<rbrakk> \<Longrightarrow> ?y11 \<le> x1 * m
 3. \<lbrakk>0 < k; k < m; Suc 0 * m \<le> x1 * m; x mod k \<le> x1 * m\<rbrakk> \<Longrightarrow> x1 * m + x2 - x mod k + x3 + x mod k = x1 * m + x2 + x3
[PROOF STEP]
apply simp+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma coeff_mpoly_to_poly[simp]: "Polynomial.coeff (mpoly_to_poly v p) k = MPoly_Type.coeff p (Poly_Mapping.single v k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly.coeff (mpoly_to_poly v p) k = MPoly_Type.coeff p (Poly_Mapping.single v k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly.coeff (mpoly_to_poly v p) k = MPoly_Type.coeff p (Poly_Mapping.single v k)
[PROOF STEP]
have 0:"Poly_Mapping.single v ` {x. Poly_Mapping.lookup (mapping_of p) (Poly_Mapping.single v x) \<noteq> 0}
          \<subseteq> {k. Poly_Mapping.lookup (mapping_of p) k \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Poly_Mapping.single v ` {x. lookup (mapping_of p) (Poly_Mapping.single v x) \<noteq> (0::'a)} \<subseteq> {k. lookup (mapping_of p) k \<noteq> (0::'a)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Poly_Mapping.single v ` {x. lookup (mapping_of p) (Poly_Mapping.single v x) \<noteq> (0::'a)} \<subseteq> {k. lookup (mapping_of p) k \<noteq> (0::'a)}

goal (1 subgoal):
 1. poly.coeff (mpoly_to_poly v p) k = MPoly_Type.coeff p (Poly_Mapping.single v k)
[PROOF STEP]
have "\<forall>\<^sub>\<infinity> k. MPoly_Type.coeff p (Poly_Mapping.single v k) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>\<infinity>k. MPoly_Type.coeff p (Poly_Mapping.single v k) = (0::'a)
[PROOF STEP]
unfolding coeff_def eventually_cofinite
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {x. lookup (mapping_of p) (Poly_Mapping.single v x) \<noteq> (0::'a)}
[PROOF STEP]
using  finite_imageD[OF finite_subset[OF 0 Poly_Mapping.finite_lookup]] inj_single
[PROOF STATE]
proof (prove)
using this:
inj_on (Poly_Mapping.single v) {x. lookup (mapping_of p) (Poly_Mapping.single v x) \<noteq> (0::'a)} \<Longrightarrow> finite {x. lookup (mapping_of p) (Poly_Mapping.single v x) \<noteq> (0::'a)}
inj (Poly_Mapping.single ?k)

goal (1 subgoal):
 1. finite {x. lookup (mapping_of p) (Poly_Mapping.single v x) \<noteq> (0::'a)}
[PROOF STEP]
by (metis inj_eq inj_onI)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>\<infinity>k. MPoly_Type.coeff p (Poly_Mapping.single v k) = (0::'a)

goal (1 subgoal):
 1. poly.coeff (mpoly_to_poly v p) k = MPoly_Type.coeff p (Poly_Mapping.single v k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>\<infinity>k. MPoly_Type.coeff p (Poly_Mapping.single v k) = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>\<infinity>k. MPoly_Type.coeff p (Poly_Mapping.single v k) = (0::'a)

goal (1 subgoal):
 1. poly.coeff (mpoly_to_poly v p) k = MPoly_Type.coeff p (Poly_Mapping.single v k)
[PROOF STEP]
unfolding mpoly_to_poly_def
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>\<infinity>k. MPoly_Type.coeff p (Poly_Mapping.single v k) = (0::'a)

goal (1 subgoal):
 1. poly.coeff (Abs_poly (\<lambda>k. MPoly_Type.coeff p (Poly_Mapping.single v k))) k = MPoly_Type.coeff p (Poly_Mapping.single v k)
[PROOF STEP]
by (simp add: Abs_poly_inverse)
[PROOF STATE]
proof (state)
this:
poly.coeff (mpoly_to_poly v p) k = MPoly_Type.coeff p (Poly_Mapping.single v k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma spectrum_eigenvalues:
  fixes A::"complex Matrix.mat"
  assumes "A\<in> carrier_mat n n"
and "k\<in> spectrum A"
shows "eigenvalue A k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eigenvalue A k
[PROOF STEP]
using eigenvalue_root_char_poly[of A n k]
    spectrum_char_poly_root[of A n k] assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n \<Longrightarrow> eigenvalue A k = (poly (char_poly A) k = 0)
\<lbrakk>A \<in> carrier_mat n n; k \<in> spectrum A\<rbrakk> \<Longrightarrow> poly (char_poly A) k = 0
A \<in> carrier_mat n n
k \<in> spectrum A

goal (1 subgoal):
 1. eigenvalue A k
[PROOF STEP]
by simp


[STATEMENT]
lemma product_two_squares_nat: "is_sum2sq_nat m \<Longrightarrow> is_sum2sq_nat n \<Longrightarrow> is_sum2sq_nat (m*n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_sum2sq_nat m; is_sum2sq_nat n\<rbrakk> \<Longrightarrow> is_sum2sq_nat (m * n)
[PROOF STEP]
using product_two_squares_int is_sum2sq_int_nat_eq
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_sum2sq_int ?m; is_sum2sq_int ?n\<rbrakk> \<Longrightarrow> is_sum2sq_int (?m * ?n)
is_sum2sq_nat ?n = is_sum2sq_int (int ?n)

goal (1 subgoal):
 1. \<lbrakk>is_sum2sq_nat m; is_sum2sq_nat n\<rbrakk> \<Longrightarrow> is_sum2sq_nat (m * n)
[PROOF STEP]
by simp


[STATEMENT]
lemma unit_factor_monom [simp]: "unit_factor (monom a n) = [:unit_factor a:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_factor (monom a n) = [:unit_factor a:]
[PROOF STEP]
by (cases "a = 0") (simp_all add: unit_factor_poly_def degree_monom_eq)


[STATEMENT]
lemma powreal_le_cancel_iff [simp]:
  "1 < a \<Longrightarrow> (a pow\<^sub>\<real> r \<le> a pow\<^sub>\<real> s) = (r \<le> s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < a \<Longrightarrow> (a pow\<^sub>\<real> r \<le> a pow\<^sub>\<real> s) = (r \<le> s)
[PROOF STEP]
by (simp add: linorder_not_less [symmetric])