[STATEMENT]
lemma subspace_ideal: "phull.subspace (ideal (F::('b::comm_powerprod \<Rightarrow>\<^sub>0 'a::field) set))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. phull.subspace (ideal F)
[PROOF STEP]
using ideal.span_zero ideal.span_add
[PROOF STATE]
proof (prove)
using this:
(0::?'a) \<in> ideal ?S
\<lbrakk>?x \<in> ideal ?S; ?y \<in> ideal ?S\<rbrakk> \<Longrightarrow> ?x + ?y \<in> ideal ?S

goal (1 subgoal):
 1. phull.subspace (ideal F)
[PROOF STEP]
proof (rule phull.subspaceI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> ideal F; y \<in> ideal F\<rbrakk> \<Longrightarrow> x \<in> ideal F
 2. \<And>x y. \<lbrakk>x \<in> ideal F; y \<in> ideal F\<rbrakk> \<Longrightarrow> y \<in> ideal F
 3. \<And>c x. x \<in> ideal F \<Longrightarrow> c \<cdot> x \<in> ideal F
[PROOF STEP]
fix c p
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> ideal F; y \<in> ideal F\<rbrakk> \<Longrightarrow> x \<in> ideal F
 2. \<And>x y. \<lbrakk>x \<in> ideal F; y \<in> ideal F\<rbrakk> \<Longrightarrow> y \<in> ideal F
 3. \<And>c x. x \<in> ideal F \<Longrightarrow> c \<cdot> x \<in> ideal F
[PROOF STEP]
assume "p \<in> ideal F"
[PROOF STATE]
proof (state)
this:
p \<in> ideal F

goal (3 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> ideal F; y \<in> ideal F\<rbrakk> \<Longrightarrow> x \<in> ideal F
 2. \<And>x y. \<lbrakk>x \<in> ideal F; y \<in> ideal F\<rbrakk> \<Longrightarrow> y \<in> ideal F
 3. \<And>c x. x \<in> ideal F \<Longrightarrow> c \<cdot> x \<in> ideal F
[PROOF STEP]
thus "c \<cdot> p \<in> ideal F"
[PROOF STATE]
proof (prove)
using this:
p \<in> ideal F

goal (1 subgoal):
 1. c \<cdot> p \<in> ideal F
[PROOF STEP]
unfolding map_scale_eq_times
[PROOF STATE]
proof (prove)
using this:
p \<in> ideal F

goal (1 subgoal):
 1. monomial c (0::'b) * p \<in> ideal F
[PROOF STEP]
by (rule ideal.span_scale)
[PROOF STATE]
proof (state)
this:
c \<cdot> p \<in> ideal F

goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> ideal F; y \<in> ideal F\<rbrakk> \<Longrightarrow> x \<in> ideal F
 2. \<And>x y. \<lbrakk>x \<in> ideal F; y \<in> ideal F\<rbrakk> \<Longrightarrow> y \<in> ideal F
[PROOF STEP]
qed


[STATEMENT]
theorem gt_subst: "wary_subst \<rho> \<Longrightarrow> t >\<^sub>t s \<Longrightarrow> subst \<rho> t >\<^sub>t subst \<rho> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wary_subst \<rho>; t >\<^sub>t s\<rbrakk> \<Longrightarrow> subst \<rho> t >\<^sub>t subst \<rho> s
[PROOF STEP]
unfolding basic_gt_iff_gt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wary_subst \<rho>; local.kbo_std.gt t s\<rbrakk> \<Longrightarrow> local.kbo_std.gt (subst \<rho> t) (subst \<rho> s)
[PROOF STEP]
by (rule kbo_std.gt_subst[simplified])


[STATEMENT]
theorem assumes f: "f \<in> rv M" and g: "g \<in> rv M"
  shows rv_plus_rv: "(\<lambda>w. f w + g w) \<in> rv M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>w. f w + g w) \<in> rv M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>w. f w + g w) \<in> rv M
[PROOF STEP]
from g
[PROOF STATE]
proof (chain)
picking this:
g \<in> rv M
[PROOF STEP]
have ms: "measure_space M"
[PROOF STATE]
proof (prove)
using this:
g \<in> rv M

goal (1 subgoal):
 1. measure_space M
[PROOF STEP]
by (simp add: rv_def)
[PROOF STATE]
proof (state)
this:
measure_space M

goal (1 subgoal):
 1. (\<lambda>w. f w + g w) \<in> rv M
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
measure_space M

goal (1 subgoal):
 1. (\<lambda>w. f w + g w) \<in> rv M
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>w. f w + g w) \<in> rv M
[PROOF STEP]
have "{w. a \<le> f w + g w} = {w. a + (g w)*(-1) \<le> f w}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {w. a \<le> f w + g w} = {w. a + g w * - 1 \<le> f w}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{w. a \<le> f w + g w} = {w. a + g w * - 1 \<le> f w}

goal (1 subgoal):
 1. (\<lambda>w. f w + g w) \<in> rv M
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{w. a \<le> f w + g w} = {w. a + g w * - 1 \<le> f w}

goal (1 subgoal):
 1. (\<lambda>w. f w + g w) \<in> rv M
[PROOF STEP]
from g
[PROOF STATE]
proof (chain)
picking this:
g \<in> rv M
[PROOF STEP]
have "(\<lambda>w. a + (g w)*(-1)) \<in> rv M"
[PROOF STATE]
proof (prove)
using this:
g \<in> rv M

goal (1 subgoal):
 1. (\<lambda>w. a + g w * - 1) \<in> rv M
[PROOF STEP]
by (rule affine_rv)
[PROOF STATE]
proof (state)
this:
(\<lambda>w. a + g w * - 1) \<in> rv M

goal (1 subgoal):
 1. (\<lambda>w. f w + g w) \<in> rv M
[PROOF STEP]
with f
[PROOF STATE]
proof (chain)
picking this:
f \<in> rv M
(\<lambda>w. a + g w * - 1) \<in> rv M
[PROOF STEP]
have "{w. a + (g w)*(-1) \<le> f w} \<in> measurable_sets M"
[PROOF STATE]
proof (prove)
using this:
f \<in> rv M
(\<lambda>w. a + g w * - 1) \<in> rv M

goal (1 subgoal):
 1. {w. a + g w * - 1 \<le> f w} \<in> measurable_sets M
[PROOF STEP]
by (simp add: rv_le_rv_measurable)
[PROOF STATE]
proof (state)
this:
{w. a + g w * - 1 \<le> f w} \<in> measurable_sets M

goal (1 subgoal):
 1. (\<lambda>w. f w + g w) \<in> rv M
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{w. a \<le> f w + g w} = {w. a + g w * - 1 \<le> f w}
{w. a + g w * - 1 \<le> f w} \<in> measurable_sets M
[PROOF STEP]
have "{w. a \<le> f w + g w} \<in> measurable_sets M"
[PROOF STATE]
proof (prove)
using this:
{w. a \<le> f w + g w} = {w. a + g w * - 1 \<le> f w}
{w. a + g w * - 1 \<le> f w} \<in> measurable_sets M

goal (1 subgoal):
 1. {w. a \<le> f w + g w} \<in> measurable_sets M
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
{w. a \<le> f w + g w} \<in> measurable_sets M

goal (1 subgoal):
 1. (\<lambda>w. f w + g w) \<in> rv M
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
{w. ?a2 \<le> f w + g w} \<in> measurable_sets M

goal (1 subgoal):
 1. (\<lambda>w. f w + g w) \<in> rv M
[PROOF STEP]
with ms
[PROOF STATE]
proof (chain)
picking this:
measure_space M
{w. ?a2 \<le> f w + g w} \<in> measurable_sets M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
measure_space M
{w. ?a2 \<le> f w + g w} \<in> measurable_sets M

goal (1 subgoal):
 1. (\<lambda>w. f w + g w) \<in> rv M
[PROOF STEP]
by (simp add: rv_ge_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>w. f w + g w) \<in> rv M

goal:
No subgoals!
[PROOF STEP]
thm rv_ge_iff
[PROOF STATE]
proof (state)
this:
(\<lambda>w. f w + g w) \<in> rv M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma PrefixListHasTail:
fixes
  l1 :: "'a list" and
  l2 :: "'a list"
assumes
  "prefixList l1 l2"
shows
  "\<exists> l . l2 = l1 @ l \<and> l \<noteq> []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>l. l2 = l1 @ l \<and> l \<noteq> []
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prefixList l1 l2

goal (1 subgoal):
 1. \<exists>l. l2 = l1 @ l \<and> l \<noteq> []
[PROOF STEP]
by (induct rule: prefixList.induct, auto)


[STATEMENT]
lemma delta_min:
  assumes "\<forall> qd1 qd2. (qd1, qd2) \<in> set qd \<longrightarrow> qd1 \<le> qd2"
  shows "\<forall> \<epsilon>. \<epsilon> > 0 \<and> \<epsilon> \<le> \<delta>_min qd \<longrightarrow> (\<forall> qd1 qd2. (qd1, qd2) \<in> set qd \<longrightarrow> val qd1 \<epsilon> \<le> val qd2 \<epsilon>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<epsilon>. 0 < \<epsilon> \<and> \<epsilon> \<le> \<delta>_min qd \<longrightarrow> (\<forall>qd1 qd2. (qd1, qd2) \<in> set qd \<longrightarrow> val qd1 \<epsilon> \<le> val qd2 \<epsilon>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>qd1 qd2. (qd1, qd2) \<in> set qd \<longrightarrow> qd1 \<le> qd2

goal (1 subgoal):
 1. \<forall>\<epsilon>. 0 < \<epsilon> \<and> \<epsilon> \<le> \<delta>_min qd \<longrightarrow> (\<forall>qd1 qd2. (qd1, qd2) \<in> set qd \<longrightarrow> val qd1 \<epsilon> \<le> val qd2 \<epsilon>)
[PROOF STEP]
using delta0
[PROOF STATE]
proof (prove)
using this:
\<forall>qd1 qd2. (qd1, qd2) \<in> set qd \<longrightarrow> qd1 \<le> qd2
?qd1.0 \<le> ?qd2.0 \<Longrightarrow> \<forall>\<epsilon>. 0 < \<epsilon> \<and> \<epsilon> \<le> \<delta>0 ?qd1.0 ?qd2.0 \<longrightarrow> val ?qd1.0 \<epsilon> \<le> val ?qd2.0 \<epsilon>

goal (1 subgoal):
 1. \<forall>\<epsilon>. 0 < \<epsilon> \<and> \<epsilon> \<le> \<delta>_min qd \<longrightarrow> (\<forall>qd1 qd2. (qd1, qd2) \<in> set qd \<longrightarrow> val qd1 \<epsilon> \<le> val qd2 \<epsilon>)
[PROOF STEP]
by (induct qd, auto)


[STATEMENT]
lemma wfLexLessRestricted:
  assumes "finite Vbl"
  shows "wf (lexLessRestricted Vbl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf (lexLessRestricted Vbl)
[PROOF STEP]
proof (rule finite_acyclic_wf)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (lexLessRestricted Vbl)
 2. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
show "finite (lexLessRestricted Vbl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (lexLessRestricted Vbl)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (lexLessRestricted Vbl)
[PROOF STEP]
let ?X = "{(M1, M2).
      consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M1) \<subseteq> Vbl \<and>
      consistent (elements M2) \<and> uniq (elements M2) \<and> vars (elements M2) \<subseteq> Vbl}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (lexLessRestricted Vbl)
[PROOF STEP]
let ?Y = "{M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (lexLessRestricted Vbl)
[PROOF STEP]
have "?X = ?Y \<times> ?Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(M1, M2). consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> vars (elements M2) \<subseteq> Vbl} = {M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)} \<times> {M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{(M1, M2). consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> vars (elements M2) \<subseteq> Vbl} = {M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)} \<times> {M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)}

goal (1 subgoal):
 1. finite (lexLessRestricted Vbl)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{(M1, M2). consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> vars (elements M2) \<subseteq> Vbl} = {M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)} \<times> {M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)}

goal (1 subgoal):
 1. finite (lexLessRestricted Vbl)
[PROOF STEP]
have "finite ?Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
using finiteUniqAndConsistentTrailsWithGivenVariableSuperset[of "Vbl"]
        \<open>finite Vbl\<close>
[PROOF STATE]
proof (prove)
using this:
finite Vbl \<Longrightarrow> finite {M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)}
finite Vbl

goal (1 subgoal):
 1. finite {M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)}

goal (1 subgoal):
 1. finite (lexLessRestricted Vbl)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{(M1, M2). consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> vars (elements M2) \<subseteq> Vbl} = {M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)} \<times> {M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)}
finite {M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
have "finite ?X"
[PROOF STATE]
proof (prove)
using this:
{(M1, M2). consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> vars (elements M2) \<subseteq> Vbl} = {M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)} \<times> {M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)}
finite {M. vars (elements M) \<subseteq> Vbl \<and> uniq (elements M) \<and> consistent (elements M)}

goal (1 subgoal):
 1. finite {(M1, M2). consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> vars (elements M2) \<subseteq> Vbl}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {(M1, M2). consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> vars (elements M2) \<subseteq> Vbl}

goal (1 subgoal):
 1. finite (lexLessRestricted Vbl)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite {(M1, M2). consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> vars (elements M2) \<subseteq> Vbl}

goal (1 subgoal):
 1. finite (lexLessRestricted Vbl)
[PROOF STEP]
have "lexLessRestricted Vbl \<subseteq> ?X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lexLessRestricted Vbl \<subseteq> {(M1, M2). consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> vars (elements M2) \<subseteq> Vbl}
[PROOF STEP]
unfolding lexLessRestricted_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(M1, M2). vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M2) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> (M1, M2) \<in> lexLess} \<subseteq> {(M1, M2). consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> vars (elements M2) \<subseteq> Vbl}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lexLessRestricted Vbl \<subseteq> {(M1, M2). consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> vars (elements M2) \<subseteq> Vbl}

goal (1 subgoal):
 1. finite (lexLessRestricted Vbl)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite {(M1, M2). consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> vars (elements M2) \<subseteq> Vbl}
lexLessRestricted Vbl \<subseteq> {(M1, M2). consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> vars (elements M2) \<subseteq> Vbl}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite {(M1, M2). consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> vars (elements M2) \<subseteq> Vbl}
lexLessRestricted Vbl \<subseteq> {(M1, M2). consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> vars (elements M2) \<subseteq> Vbl}

goal (1 subgoal):
 1. finite (lexLessRestricted Vbl)
[PROOF STEP]
by (simp add: finite_subset)
[PROOF STATE]
proof (state)
this:
finite (lexLessRestricted Vbl)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
finite (lexLessRestricted Vbl)

goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
show "acyclic (lexLessRestricted Vbl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
assume "\<not> ?thesis"
[PROOF STATE]
proof (state)
this:
\<not> acyclic (lexLessRestricted Vbl)

goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> acyclic (lexLessRestricted Vbl)
[PROOF STEP]
obtain x where "(x, x) \<in> (lexLessRestricted Vbl)^+"
[PROOF STATE]
proof (prove)
using this:
\<not> acyclic (lexLessRestricted Vbl)

goal (1 subgoal):
 1. (\<And>x. (x, x) \<in> (lexLessRestricted Vbl)\<^sup>+ \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding acyclic_def
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>x. (x, x) \<notin> (lexLessRestricted Vbl)\<^sup>+)

goal (1 subgoal):
 1. (\<And>x. (x, x) \<in> (lexLessRestricted Vbl)\<^sup>+ \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x, x) \<in> (lexLessRestricted Vbl)\<^sup>+

goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
have "lexLessRestricted Vbl \<subseteq> lexLess"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lexLessRestricted Vbl \<subseteq> lexLess
[PROOF STEP]
unfolding lexLessRestricted_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(M1, M2). vars (elements M1) \<subseteq> Vbl \<and> consistent (elements M1) \<and> uniq (elements M1) \<and> vars (elements M2) \<subseteq> Vbl \<and> consistent (elements M2) \<and> uniq (elements M2) \<and> (M1, M2) \<in> lexLess} \<subseteq> lexLess
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lexLessRestricted Vbl \<subseteq> lexLess

goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
have "(lexLessRestricted Vbl)^+ \<subseteq> lexLess^+"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lexLessRestricted Vbl)\<^sup>+ \<subseteq> lexLess\<^sup>+
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> (lexLessRestricted Vbl)\<^sup>+ \<Longrightarrow> x \<in> lexLess\<^sup>+
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> (lexLessRestricted Vbl)\<^sup>+ \<Longrightarrow> x \<in> lexLess\<^sup>+
[PROOF STEP]
assume "a \<in> (lexLessRestricted Vbl)^+"
[PROOF STATE]
proof (state)
this:
a \<in> (lexLessRestricted Vbl)\<^sup>+

goal (1 subgoal):
 1. \<And>x. x \<in> (lexLessRestricted Vbl)\<^sup>+ \<Longrightarrow> x \<in> lexLess\<^sup>+
[PROOF STEP]
with \<open>lexLessRestricted Vbl \<subseteq> lexLess\<close>
[PROOF STATE]
proof (chain)
picking this:
lexLessRestricted Vbl \<subseteq> lexLess
a \<in> (lexLessRestricted Vbl)\<^sup>+
[PROOF STEP]
show "a \<in> lexLess^+"
[PROOF STATE]
proof (prove)
using this:
lexLessRestricted Vbl \<subseteq> lexLess
a \<in> (lexLessRestricted Vbl)\<^sup>+

goal (1 subgoal):
 1. a \<in> lexLess\<^sup>+
[PROOF STEP]
using trancl_mono[of "a" "lexLessRestricted Vbl" "lexLess"]
[PROOF STATE]
proof (prove)
using this:
lexLessRestricted Vbl \<subseteq> lexLess
a \<in> (lexLessRestricted Vbl)\<^sup>+
\<lbrakk>a \<in> (lexLessRestricted Vbl)\<^sup>+; lexLessRestricted Vbl \<subseteq> lexLess\<rbrakk> \<Longrightarrow> a \<in> lexLess\<^sup>+

goal (1 subgoal):
 1. a \<in> lexLess\<^sup>+
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a \<in> lexLess\<^sup>+

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(lexLessRestricted Vbl)\<^sup>+ \<subseteq> lexLess\<^sup>+

goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
with \<open>(x, x) \<in> (lexLessRestricted Vbl)^+\<close>
[PROOF STATE]
proof (chain)
picking this:
(x, x) \<in> (lexLessRestricted Vbl)\<^sup>+
(lexLessRestricted Vbl)\<^sup>+ \<subseteq> lexLess\<^sup>+
[PROOF STEP]
have "(x, x) \<in> lexLess^+"
[PROOF STATE]
proof (prove)
using this:
(x, x) \<in> (lexLessRestricted Vbl)\<^sup>+
(lexLessRestricted Vbl)\<^sup>+ \<subseteq> lexLess\<^sup>+

goal (1 subgoal):
 1. (x, x) \<in> lexLess\<^sup>+
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x, x) \<in> lexLess\<^sup>+

goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(x, x) \<in> lexLess\<^sup>+

goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
have "trans lexLess"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trans lexLess
[PROOF STEP]
using translexLess
[PROOF STATE]
proof (prove)
using this:
trans lexLess

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

goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
hence "lexLess^+ = lexLess"
[PROOF STATE]
proof (prove)
using this:
trans lexLess

goal (1 subgoal):
 1. lexLess\<^sup>+ = lexLess
[PROOF STEP]
by (rule trancl_id)
[PROOF STATE]
proof (state)
this:
lexLess\<^sup>+ = lexLess

goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(x, x) \<in> lexLess\<^sup>+
lexLess\<^sup>+ = lexLess
[PROOF STEP]
have "(x, x) \<in> lexLess"
[PROOF STATE]
proof (prove)
using this:
(x, x) \<in> lexLess\<^sup>+
lexLess\<^sup>+ = lexLess

goal (1 subgoal):
 1. (x, x) \<in> lexLess
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x, x) \<in> lexLess

goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
with irreflexiveLexLess[of "x"]
[PROOF STATE]
proof (chain)
picking this:
(x, x) \<notin> lexLess
(x, x) \<in> lexLess
[PROOF STEP]
have False
[PROOF STATE]
proof (prove)
using this:
(x, x) \<notin> lexLess
(x, x) \<in> lexLess

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

goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<not> acyclic (lexLessRestricted Vbl) \<Longrightarrow> False

goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> acyclic (lexLessRestricted Vbl) \<Longrightarrow> False

goal (1 subgoal):
 1. acyclic (lexLessRestricted Vbl)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
acyclic (lexLessRestricted Vbl)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
acyclic (lexLessRestricted Vbl)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pmf_of_multiset_impl_code_alt:
  assumes "A \<noteq> {#}"
  shows   "pmf_of_multiset_impl A =
             (let p = 1 / real (size A)
              in  fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf_of_multiset_impl A = (let p = 1 / real (size A) in fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pmf_of_multiset_impl A = (let p = 1 / real (size A) in fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A)
[PROOF STEP]
define p where "p = 1 / real (size A)"
[PROOF STATE]
proof (state)
this:
p = 1 / real (size A)

goal (1 subgoal):
 1. pmf_of_multiset_impl A = (let p = 1 / real (size A) in fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A)
[PROOF STEP]
interpret comp_fun_commute "\<lambda>x. Mapping.map_default x 0 ((+) p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comp_fun_commute (\<lambda>x. Mapping.map_default x 0 ((+) p))
[PROOF STEP]
unfolding Mapping.map_default_def [abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comp_fun_commute (\<lambda>x m. Mapping.map_entry x ((+) p) (Mapping.default x 0 m))
[PROOF STEP]
by (standard, intro mapping_eqI ext)
       (simp_all add: o_def lookup_map_entry' lookup_default' lookup_default_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pmf_of_multiset_impl A = (let p = 1 / real (size A) in fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A)
[PROOF STEP]
let ?m = "fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pmf_of_multiset_impl A = (let p = 1 / real (size A) in fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A)
[PROOF STEP]
have keys: "Mapping.keys ?m = set_mset A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mapping.keys (fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A) = set_mset A
[PROOF STEP]
by (induction A) simp_all
[PROOF STATE]
proof (state)
this:
Mapping.keys (fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A) = set_mset A

goal (1 subgoal):
 1. pmf_of_multiset_impl A = (let p = 1 / real (size A) in fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A)
[PROOF STEP]
have lookup: "Mapping.lookup_default 0 ?m x = real (count A x) * p" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mapping.lookup_default 0 (fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A) x = real (count A x) * p
[PROOF STEP]
by (induction A)
       (simp_all add: lookup_map_default' lookup_default_def lookup_empty ring_distribs)
[PROOF STATE]
proof (state)
this:
Mapping.lookup_default 0 (fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A) ?x = real (count A ?x) * p

goal (1 subgoal):
 1. pmf_of_multiset_impl A = (let p = 1 / real (size A) in fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A)
[PROOF STEP]
from keys lookup assms
[PROOF STATE]
proof (chain)
picking this:
Mapping.keys (fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A) = set_mset A
Mapping.lookup_default 0 (fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A) ?x = real (count A ?x) * p
A \<noteq> {#}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Mapping.keys (fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A) = set_mset A
Mapping.lookup_default 0 (fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A) ?x = real (count A ?x) * p
A \<noteq> {#}

goal (1 subgoal):
 1. pmf_of_multiset_impl A = (let p = 1 / real (size A) in fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A)
[PROOF STEP]
unfolding pmf_of_multiset_impl_def
[PROOF STATE]
proof (prove)
using this:
Mapping.keys (fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A) = set_mset A
Mapping.lookup_default 0 (fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A) ?x = real (count A ?x) * p
A \<noteq> {#}

goal (1 subgoal):
 1. mapping_of_pmf (pmf_of_multiset A) = (let p = 1 / real (size A) in fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A)
[PROOF STEP]
by (intro mapping_of_pmfI') (simp_all add: Let_def p_def)
[PROOF STATE]
proof (state)
this:
pmf_of_multiset_impl A = (let p = 1 / real (size A) in fold_mset (\<lambda>x. Mapping.map_default x 0 ((+) p)) Mapping.empty A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_vec_right_diff_distrib: "r ** (p - q) = r ** p - r ** q"
  for r::"_ \<Rightarrow>\<^sub>0 'b::ring"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r ** (p - q) = r ** p - r ** q
[PROOF STEP]
using mult_vec_distrib_left [of r p "- q"]
[PROOF STATE]
proof (prove)
using this:
r ** (p + - q) = r ** p + r ** - q

goal (1 subgoal):
 1. r ** (p - q) = r ** p - r ** q
[PROOF STEP]
by (simp add: mult_vec_minus_mult_right)


[STATEMENT]
lemma oneof_length:
  assumes "oneof xs s = Inr (y, r)"
  shows "length s \<ge> length y + length r \<and> y \<in> set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length y + length r \<le> length s \<and> y \<in> set xs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length y + length r \<le> length s \<and> y \<in> set xs
[PROOF STEP]
from oneof_result [OF assms]
[PROOF STATE]
proof (chain)
picking this:
\<exists>w. s = y @ w @ r \<and> y \<in> set xs
[PROOF STEP]
obtain w where "s = y @ w @ r \<and> y \<in> set xs"
[PROOF STATE]
proof (prove)
using this:
\<exists>w. s = y @ w @ r \<and> y \<in> set xs

goal (1 subgoal):
 1. (\<And>w. s = y @ w @ r \<and> y \<in> set xs \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
s = y @ w @ r \<and> y \<in> set xs

goal (1 subgoal):
 1. length y + length r \<le> length s \<and> y \<in> set xs
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
s = y @ w @ r \<and> y \<in> set xs

goal (1 subgoal):
 1. length y + length r \<le> length s \<and> y \<in> set xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length y + length r \<le> length s \<and> y \<in> set xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma neg_minus_divideR_le_eq [field_simps]:
  "- (b /\<^sub>R c) \<le> a \<longleftrightarrow> c *\<^sub>R a \<le> - b" if "c < 0"
    for a b :: "'a :: ordered_real_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (b /\<^sub>R c) \<le> a) = (c *\<^sub>R a \<le> - b)
[PROOF STEP]
using that pos_minus_divideR_le_eq [of "- c" "- b" a]
[PROOF STATE]
proof (prove)
using this:
c < 0
0 < - c \<Longrightarrow> (- (- b /\<^sub>R - c) \<le> a) = (- (- b) \<le> - c *\<^sub>R a)

goal (1 subgoal):
 1. (- (b /\<^sub>R c) \<le> a) = (c *\<^sub>R a \<le> - b)
[PROOF STEP]
by (simp add: le_minus_iff)


[STATEMENT]
lemma four_block_zero_mat[simp]:
  "four_block_mat (0\<^sub>m nr1 nc1) (0\<^sub>m nr1 nc2) (0\<^sub>m nr2 nc1) (0\<^sub>m nr2 nc2) = 0\<^sub>m (nr1 + nr2) (nc1 + nc2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. four_block_mat (0\<^sub>m nr1 nc1) (0\<^sub>m nr1 nc2) (0\<^sub>m nr2 nc1) (0\<^sub>m nr2 nc2) = 0\<^sub>m (nr1 + nr2) (nc1 + nc2)
[PROOF STEP]
by (rule eq_matI, auto)


[STATEMENT]
lemma measure_pmf_posI: "x \<in> set_pmf p \<Longrightarrow> x \<in> A \<Longrightarrow> measure_pmf.prob p A > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> set_pmf p; x \<in> A\<rbrakk> \<Longrightarrow> 0 < measure_pmf.prob p A
[PROOF STEP]
using measure_measure_pmf_not_zero[of p A]
[PROOF STATE]
proof (prove)
using this:
set_pmf p \<inter> A \<noteq> {} \<Longrightarrow> measure_pmf.prob p A \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>x \<in> set_pmf p; x \<in> A\<rbrakk> \<Longrightarrow> 0 < measure_pmf.prob p A
[PROOF STEP]
by (subst zero_less_measure_iff) blast


[STATEMENT]
lemma index_eqI:
  assumes "i\<le>length xs"
  assumes "\<forall>j<i. xs!j \<noteq> x"
  assumes "i<length xs \<Longrightarrow> xs!i = x"
  shows "index xs x = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. index xs x = i
[PROOF STEP]
unfolding index_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. find_index (\<lambda>xa. xa = x) xs = i
[PROOF STEP]
by (simp add: find_index_eqI assms)


[STATEMENT]
lemma "max_ipv4_addr = 0b11111111111111111111111111111111"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_ipv4_addr = 4294967295
[PROOF STEP]
by(fact max_ipv4_addr_number)


[STATEMENT]
lemma euler_witness_exists_nat:
  assumes "odd n" "\<not>prime n" "2 < n"
  shows "\<exists>a. euler_witness (int a) n \<and> coprime a n \<and> 0 < a \<and> a < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a. euler_witness (int a) n \<and> coprime a n \<and> 0 < a \<and> a < n
[PROOF STEP]
using euler_witness_exists[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>a. euler_witness a n \<and> coprime a (int n) \<and> 0 < a \<and> a < int n

goal (1 subgoal):
 1. \<exists>a. euler_witness (int a) n \<and> coprime a n \<and> 0 < a \<and> a < n
[PROOF STEP]
using zero_less_imp_eq_int
[PROOF STATE]
proof (prove)
using this:
\<exists>a. euler_witness a n \<and> coprime a (int n) \<and> 0 < a \<and> a < int n
0 < ?k \<Longrightarrow> \<exists>n>0. ?k = int n

goal (1 subgoal):
 1. \<exists>a. euler_witness (int a) n \<and> coprime a n \<and> 0 < a \<and> a < n
[PROOF STEP]
by fastforce


[STATEMENT]
lemma (in domain) subring_polynomial_pow_not_zero:
  assumes "subring K R" and "p \<in> carrier (K[X])" and "p \<noteq> []"
  shows "p [^]\<^bsub>K[X]\<^esub> (n::nat) \<noteq> []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p [^]\<^bsub>K [X]\<^esub> n \<noteq> []
[PROOF STEP]
using domain.polynomial_pow_not_zero[OF subring_is_domain, of K p n] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>subring K R; p \<in> carrier (poly_ring (R\<lparr>carrier := K\<rparr>)); p \<noteq> []\<rbrakk> \<Longrightarrow> p [^]\<^bsub>poly_ring (R\<lparr>carrier := K\<rparr>)\<^esub> n \<noteq> []
subring K R
p \<in> carrier (K [X])
p \<noteq> []

goal (1 subgoal):
 1. p [^]\<^bsub>K [X]\<^esub> n \<noteq> []
[PROOF STEP]
unfolding univ_poly_consistent[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>subring K R; p \<in> carrier (carrier (R\<lparr>carrier := K\<rparr>) [X]); p \<noteq> []\<rbrakk> \<Longrightarrow> p [^]\<^bsub>carrier (R\<lparr>carrier := K\<rparr>) [X]\<^esub> n \<noteq> []
subring K R
p \<in> carrier (K [X])
p \<noteq> []

goal (1 subgoal):
 1. p [^]\<^bsub>K [X]\<^esub> n \<noteq> []
[PROOF STEP]
by simp


[STATEMENT]
lemma sqrt_nat_code[code]: "sqrt_nat x \<equiv> map nat (take 1 (sqrt_int (int x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt_nat x \<equiv> map nat (take 1 (sqrt_int (int x)))
[PROOF STEP]
unfolding sqrt_nat_def root_nat_def sqrt_int_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map nat (take 1 (root_int 2 (int x))) \<equiv> map nat (take 1 (root_int 2 (int x)))
[PROOF STEP]
by simp


[STATEMENT]
lemma irreducible_altdef:
  shows "irreducible x \<longleftrightarrow> x \<noteq> 0 \<and> \<not> x dvd 1 \<and> (\<forall>b. b dvd x \<longrightarrow> x dvd b \<or> b dvd 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irreducible x = (x \<noteq> (0::'a) \<and> \<not> x dvd (1::'a) \<and> (\<forall>b. b dvd x \<longrightarrow> x dvd b \<or> b dvd (1::'a)))
[PROOF STEP]
using irreducibleI'[of x] irreducibleD'[of x] irreducible_not_unit[of x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x \<noteq> (0::'a); \<not> x dvd (1::'a); \<And>b. b dvd x \<Longrightarrow> x dvd b \<or> b dvd (1::'a)\<rbrakk> \<Longrightarrow> irreducible x
\<lbrakk>irreducible x; ?b dvd x\<rbrakk> \<Longrightarrow> x dvd ?b \<or> ?b dvd (1::'a)
irreducible x \<Longrightarrow> \<not> x dvd (1::'a)

goal (1 subgoal):
 1. irreducible x = (x \<noteq> (0::'a) \<and> \<not> x dvd (1::'a) \<and> (\<forall>b. b dvd x \<longrightarrow> x dvd b \<or> b dvd (1::'a)))
[PROOF STEP]
by auto


[STATEMENT]
lemma matrix_to_iarray_column_add[code_unfold]:
  fixes A::"'a::{semiring_1}^'columns::{mod_type}^'rows::{mod_type}"
  shows "matrix_to_iarray (column_add A i j q) = column_add_iarray (matrix_to_iarray A) (to_nat i) (to_nat j) q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (column_add A i j q) = column_add_iarray (matrix_to_iarray A) (mod_type_class.to_nat i) (mod_type_class.to_nat j) q
[PROOF STEP]
unfolding column_add_def column_add_iarray_def o_def tabulate2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (\<chi>ia ja. if ja = i then A $ ia $ i + A $ ia $ j * q else A $ ia $ ja) = IArray.of_fun (\<lambda>ia. IArray.of_fun (\<lambda>ja. if ja = mod_type_class.to_nat i then matrix_to_iarray A !! ia !! mod_type_class.to_nat i + matrix_to_iarray A !! ia !! mod_type_class.to_nat j * q else matrix_to_iarray A !! ia !! ja) (ncols_iarray (matrix_to_iarray A))) (nrows_iarray (matrix_to_iarray A))
[PROOF STEP]
unfolding nrows_eq_card_rows ncols_eq_card_columns
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (\<chi>ia ja. if ja = i then A $ ia $ i + A $ ia $ j * q else A $ ia $ ja) = IArray.of_fun (\<lambda>ia. IArray.of_fun (\<lambda>ja. if ja = mod_type_class.to_nat i then matrix_to_iarray A !! ia !! mod_type_class.to_nat i + matrix_to_iarray A !! ia !! mod_type_class.to_nat j * q else matrix_to_iarray A !! ia !! ja) CARD('columns)) CARD('rows)
[PROOF STEP]
unfolding  matrix_to_iarray_def o_def vec_to_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray (map (\<lambda>x. IArray.of_fun (\<lambda>ia. (\<chi>ia ja. if ja = i then A $ ia $ i + A $ ia $ j * q else A $ ia $ ja) $ mod_type_class.from_nat x $ mod_type_class.from_nat ia) CARD('columns)) [0..<CARD('rows)]) = IArray.of_fun (\<lambda>ia. IArray.of_fun (\<lambda>ja. if ja = mod_type_class.to_nat i then IArray (map (\<lambda>x. IArray.of_fun (\<lambda>i. A $ mod_type_class.from_nat x $ mod_type_class.from_nat i) CARD('columns)) [0..<CARD('rows)]) !! ia !! mod_type_class.to_nat i + IArray (map (\<lambda>x. IArray.of_fun (\<lambda>i. A $ mod_type_class.from_nat x $ mod_type_class.from_nat i) CARD('columns)) [0..<CARD('rows)]) !! ia !! mod_type_class.to_nat j * q else IArray (map (\<lambda>x. IArray.of_fun (\<lambda>i. A $ mod_type_class.from_nat x $ mod_type_class.from_nat i) CARD('columns)) [0..<CARD('rows)]) !! ia !! ja) CARD('columns)) CARD('rows)
[PROOF STEP]
by (auto simp add: to_nat_from_nat_id to_nat_less_card[of i] to_nat_less_card[of j])


[STATEMENT]
lemma nth_prime_gt_zero[simp]:"nth_prime n >0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < nth_prime n
[PROOF STEP]
by (simp add: prime_gt_0_nat prime_nth_prime)


[STATEMENT]
lemma "trs r \<sqinter> trs r' = trs (\<lambda> x y . inpt r x \<and> inpt r' x \<and> (r x y \<or> r' x y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trs r \<sqinter> trs r' = trs (\<lambda>x y. inpt r x \<and> inpt r' x \<and> (r x y \<or> r' x y))
[PROOF STEP]
by (auto simp add: fun_eq_iff trs_def assert_def demonic_def inpt_def)


[STATEMENT]
lemma pt_ex_eqvt:
  fixes  pi :: "'x prm"
  and     x :: "'a"
  assumes pt: "pt TYPE('a) TYPE('x)"
  and     at: "at TYPE('x)"
  shows "pi\<bullet>(\<exists>(x::'a). P x) = (\<exists>(x::'a). pi\<bullet>(P ((rev pi)\<bullet>x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pi \<bullet> (\<exists>x. P x) = (\<exists>x. pi \<bullet> P (rev pi \<bullet> x))
[PROOF STEP]
apply(auto simp add: perm_bool perm_fun_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. P x \<Longrightarrow> \<exists>x. P (rev pi \<bullet> x)
[PROOF STEP]
apply(rule_tac x="pi\<bullet>x" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. P x \<Longrightarrow> P (rev pi \<bullet> pi \<bullet> x)
[PROOF STEP]
apply(simp add: pt_rev_pi[OF pt, OF at])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma smcf_cn_cov_comp_ObjMap_vdomain[smc_cn_cs_simps]:
  assumes "\<GG> : \<BB> \<^sub>S\<^sub>M\<^sub>C\<mapsto>\<mapsto>\<^bsub>\<alpha>\<^esub> \<CC>" and "\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>"
  shows "\<D>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) = \<AA>\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) = \<AA>\<lparr>Obj\<rparr>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) = \<AA>\<lparr>Obj\<rparr>
[PROOF STEP]
interpret L: is_semifunctor \<alpha> \<open>op_smc \<BB>\<close> \<CC> \<GG>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<GG> : op_smc \<BB> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule assms(1))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) = \<AA>\<lparr>Obj\<rparr>
[PROOF STEP]
interpret R: is_semifunctor \<alpha> \<AA> \<BB> \<FF>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (rule assms(2))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) = \<AA>\<lparr>Obj\<rparr>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) = \<AA>\<lparr>Obj\<rparr>
[PROOF STEP]
by
      (
        rule dghm_cn_cov_comp_ObjMap_vdomain
          [
            OF
              L.smcf_is_dghm[unfolded slicing_commute[symmetric]]
              R.smcf_is_dghm,
            unfolded slicing_commute slicing_simps
          ]
      )
[PROOF STATE]
proof (state)
this:
\<D>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) = \<AA>\<lparr>Obj\<rparr>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma basis_enum_of_vec_inverse[simp]:
  fixes v::"complex vec"
  defines "n \<equiv> length (canonical_basis :: 'a::basis_enum list)"
  assumes f1: "dim_vec v = n"
  shows "vec_of_basis_enum ((basis_enum_of_vec v)::'a) = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_basis_enum (basis_enum_of_vec v) = v
[PROOF STEP]
proof (rule eq_vecI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
 2. dim_vec (vec_of_basis_enum (basis_enum_of_vec v)) = dim_vec v
[PROOF STEP]
show \<open>dim_vec (vec_of_basis_enum (basis_enum_of_vec v :: 'a)) = dim_vec v\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (vec_of_basis_enum (basis_enum_of_vec v)) = dim_vec v
[PROOF STEP]
by (auto simp: vec_of_basis_enum_def f1 n_def)
[PROOF STATE]
proof (state)
this:
dim_vec (vec_of_basis_enum (basis_enum_of_vec v)) = dim_vec v

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
assume j_v: \<open>j < dim_vec v\<close>
[PROOF STATE]
proof (state)
this:
j < dim_vec v

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
define w where "w = list_of_vec v"
[PROOF STATE]
proof (state)
this:
w = list_of_vec v

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
define basis where "basis = (canonical_basis::'a list)"
[PROOF STATE]
proof (state)
this:
basis = canonical_basis

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
have [simp]: "length w = n" "length basis = n" \<open>dim_vec v = n\<close> \<open>length (canonical_basis::'a list) = n\<close>
    \<open>j < n\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (length w = n &&& length basis = n) &&& dim_vec v = n &&& length canonical_basis = n &&& j < n
[PROOF STEP]
using j_v
[PROOF STATE]
proof (prove)
using this:
j < dim_vec v

goal (1 subgoal):
 1. (length w = n &&& length basis = n) &&& dim_vec v = n &&& length canonical_basis = n &&& j < n
[PROOF STEP]
by (auto simp: f1 basis_def w_def n_def)
[PROOF STATE]
proof (state)
this:
length w = n
length basis = n
dim_vec v = n
length canonical_basis = n
j < n

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
have [simp]: \<open>cindependent (set basis)\<close> \<open>cspan (set basis) = UNIV\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindependent (set basis) &&& cspan (set basis) = UNIV
[PROOF STEP]
by (auto simp: basis_def is_cindependent_set is_generator_set)
[PROOF STATE]
proof (state)
this:
cindependent (set basis)
cspan (set basis) = UNIV

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
have \<open>vec_of_basis_enum ((basis_enum_of_vec v)::'a) $ j
       = map (crepresentation (set basis) (sum_list (map2 (*\<^sub>C) w basis))) basis ! j\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_basis_enum (basis_enum_of_vec v) $ j = map (crepresentation (set basis) (sum_list (map2 (*\<^sub>C) w basis))) basis ! j
[PROOF STEP]
by (auto simp: vec_of_list_index vec_of_basis_enum_def basis_enum_of_vec_def simp flip: w_def basis_def)
[PROOF STATE]
proof (state)
this:
vec_of_basis_enum (basis_enum_of_vec v) $ j = map (crepresentation (set basis) (sum_list (map2 (*\<^sub>C) w basis))) basis ! j

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vec_of_basis_enum (basis_enum_of_vec v) $ j = map (crepresentation (set basis) (sum_list (map2 (*\<^sub>C) w basis))) basis ! j

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
have \<open>\<dots> = crepresentation (set basis) (sum_list (map2 (*\<^sub>C) w basis)) (basis!j)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (crepresentation (set basis) (sum_list (map2 (*\<^sub>C) w basis))) basis ! j = crepresentation (set basis) (sum_list (map2 (*\<^sub>C) w basis)) (basis ! j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map (crepresentation (set basis) (sum_list (map2 (*\<^sub>C) w basis))) basis ! j = crepresentation (set basis) (sum_list (map2 (*\<^sub>C) w basis)) (basis ! j)

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map (crepresentation (set basis) (sum_list (map2 (*\<^sub>C) w basis))) basis ! j = crepresentation (set basis) (sum_list (map2 (*\<^sub>C) w basis)) (basis ! j)

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
have \<open>\<dots> = crepresentation (set basis) (\<Sum>i<n. (w!i) *\<^sub>C (basis!i)) (basis!j)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. crepresentation (set basis) (sum_list (map2 (*\<^sub>C) w basis)) (basis ! j) = crepresentation (set basis) (\<Sum>i<n. w ! i *\<^sub>C basis ! i) (basis ! j)
[PROOF STEP]
by (auto simp: sum_list_sum_nth atLeast0LessThan)
[PROOF STATE]
proof (state)
this:
crepresentation (set basis) (sum_list (map2 (*\<^sub>C) w basis)) (basis ! j) = crepresentation (set basis) (\<Sum>i<n. w ! i *\<^sub>C basis ! i) (basis ! j)

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
crepresentation (set basis) (sum_list (map2 (*\<^sub>C) w basis)) (basis ! j) = crepresentation (set basis) (\<Sum>i<n. w ! i *\<^sub>C basis ! i) (basis ! j)

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
have \<open>\<dots> = (\<Sum>i<n. (w!i) *\<^sub>C crepresentation (set basis) (basis!i) (basis!j))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. crepresentation (set basis) (\<Sum>i<n. w ! i *\<^sub>C basis ! i) (basis ! j) = (\<Sum>i<n. w ! i *\<^sub>C crepresentation (set basis) (basis ! i) (basis ! j))
[PROOF STEP]
by (auto simp: complex_vector.representation_sum complex_vector.representation_scale)
[PROOF STATE]
proof (state)
this:
crepresentation (set basis) (\<Sum>i<n. w ! i *\<^sub>C basis ! i) (basis ! j) = (\<Sum>i<n. w ! i *\<^sub>C crepresentation (set basis) (basis ! i) (basis ! j))

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
crepresentation (set basis) (\<Sum>i<n. w ! i *\<^sub>C basis ! i) (basis ! j) = (\<Sum>i<n. w ! i *\<^sub>C crepresentation (set basis) (basis ! i) (basis ! j))

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
have \<open>\<dots> = w!j\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. w ! i *\<^sub>C crepresentation (set basis) (basis ! i) (basis ! j)) = w ! j
[PROOF STEP]
apply (subst sum_single[where i=j])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite {..<n}
 2. \<And>ja. \<lbrakk>ja \<noteq> j; ja \<in> {..<n}\<rbrakk> \<Longrightarrow> w ! ja *\<^sub>C crepresentation (set basis) (basis ! ja) (basis ! j) = 0
 3. (if j \<in> {..<n} then w ! j *\<^sub>C crepresentation (set basis) (basis ! j) (basis ! j) else 0) = w ! j
[PROOF STEP]
apply (auto simp: complex_vector.representation_basis)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ja. \<lbrakk>ja \<noteq> j; ja < n; basis ! j = basis ! ja\<rbrakk> \<Longrightarrow> w ! ja = 0
[PROOF STEP]
using \<open>j < n\<close> \<open>length basis = n\<close> basis_def distinct_canonical_basis nth_eq_iff_index_eq
[PROOF STATE]
proof (prove)
using this:
j < n
length basis = n
basis = canonical_basis
distinct canonical_basis
\<lbrakk>distinct ?xs; ?i < length ?xs; ?j < length ?xs\<rbrakk> \<Longrightarrow> (?xs ! ?i = ?xs ! ?j) = (?i = ?j)

goal (1 subgoal):
 1. \<And>ja. \<lbrakk>ja \<noteq> j; ja < n; basis ! j = basis ! ja\<rbrakk> \<Longrightarrow> w ! ja = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. w ! i *\<^sub>C crepresentation (set basis) (basis ! i) (basis ! j)) = w ! j

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. w ! i *\<^sub>C crepresentation (set basis) (basis ! i) (basis ! j)) = w ! j

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
have \<open>\<dots> = v $ j\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w ! j = v $ j
[PROOF STEP]
by (simp add: w_def)
[PROOF STATE]
proof (state)
this:
w ! j = v $ j

goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec v) $ i = v $ i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
vec_of_basis_enum (basis_enum_of_vec v) $ j = v $ j
[PROOF STEP]
show \<open>vec_of_basis_enum (basis_enum_of_vec v :: 'a) $ j = v $ j\<close>
[PROOF STATE]
proof (prove)
using this:
vec_of_basis_enum (basis_enum_of_vec v) $ j = v $ j

goal (1 subgoal):
 1. vec_of_basis_enum (basis_enum_of_vec v) $ j = v $ j
[PROOF STEP]
by -
[PROOF STATE]
proof (state)
this:
vec_of_basis_enum (basis_enum_of_vec v) $ j = v $ j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma \<tau>_distr[simp]: "s \<in> S \<Longrightarrow> (\<Sum>t\<in>S. \<tau> s t) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<in> S \<Longrightarrow> sum (\<tau> s) S = 1
[PROOF STEP]
using prob_sum[of s "\<lambda>_. True"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>s \<in> S; Measurable.pred (stream_space (count_space UNIV)) (\<lambda>_. True)\<rbrakk> \<Longrightarrow> prob s (\<lambda>\<omega>. True) = (\<Sum>t\<in>S. \<tau> s t * prob t (\<lambda>\<omega>. True))

goal (1 subgoal):
 1. s \<in> S \<Longrightarrow> sum (\<tau> s) S = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma (in abelian_group) a_rcos_assoc_lcos:
     "\<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G; x \<in> carrier G\<rbrakk>
      \<Longrightarrow> (H +> x) <+> K = H <+> (x <+ K)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G; x \<in> carrier G\<rbrakk> \<Longrightarrow> H +> x <+> K = H <+> (x <+ K)
[PROOF STEP]
by (rule group.rcos_assoc_lcos [OF a_group,
     folded set_add_def a_r_coset_def a_l_coset_def, simplified monoid_record_simps])


[STATEMENT]
lemma permChainAppend:
  fixes xvec1 :: "name list"
  and   yvec1 :: "name list"
  and   xvec2 :: "name list"
  and   yvec2 :: "name list"
  and   p     :: "'a::pt_name"

  assumes "length xvec1 = length yvec1"

  shows "([(xvec1@xvec2) (yvec1@yvec2)] \<bullet>\<^sub>v p) = [xvec1 yvec1] \<bullet>\<^sub>v [xvec2 yvec2] \<bullet>\<^sub>v p"
  and   "([(xvec1@xvec2) (yvec1@yvec2)]\<^sup>- \<bullet>\<^sub>v p) = [xvec2 yvec2]\<^sup>- \<bullet>\<^sub>v [xvec1 yvec1]\<^sup>- \<bullet>\<^sub>v p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [(xvec1 @ xvec2) (yvec1 @ yvec2)] \<bullet>\<^sub>v p = [xvec1 yvec1] \<bullet>\<^sub>v [xvec2 yvec2] \<bullet>\<^sub>v p &&& [(xvec1 @ xvec2) (yvec1 @ yvec2)]\<^sup>- \<bullet>\<^sub>v p = [xvec2 yvec2]\<^sup>- \<bullet>\<^sub>v [xvec1 yvec1]\<^sup>- \<bullet>\<^sub>v p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xvec1 = length yvec1

goal (1 subgoal):
 1. [(xvec1 @ xvec2) (yvec1 @ yvec2)] \<bullet>\<^sub>v p = [xvec1 yvec1] \<bullet>\<^sub>v [xvec2 yvec2] \<bullet>\<^sub>v p &&& [(xvec1 @ xvec2) (yvec1 @ yvec2)]\<^sup>- \<bullet>\<^sub>v p = [xvec2 yvec2]\<^sup>- \<bullet>\<^sub>v [xvec1 yvec1]\<^sup>- \<bullet>\<^sub>v p
[PROOF STEP]
by(induct arbitrary: p rule: composePermInduct, auto) (simp add: pt2[OF pt_name_inst])


[STATEMENT]
lemma infinite_card_subsets:
  assumes "infinite A" "k > 0"
  shows   "infinite {X. X \<subseteq> A \<and> finite X \<and> card X = k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> finite X \<and> card X = k}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> finite X \<and> card X = k}
[PROOF STEP]
obtain B where B: "B \<subseteq> A" "finite B" "card B = k - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>B \<subseteq> A; finite B; card B = k - 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using infinite_arbitrarily_large[OF assms(1), of "k - 1"]
[PROOF STATE]
proof (prove)
using this:
\<exists>B. finite B \<and> card B = k - 1 \<and> B \<subseteq> A

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>B \<subseteq> A; finite B; card B = k - 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
B \<subseteq> A
finite B
card B = k - 1

goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> finite X \<and> card X = k}
[PROOF STEP]
define f where "f = (\<lambda>x. insert x B)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x. insert x B)

goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> finite X \<and> card X = k}
[PROOF STEP]
have "f ` (A - B) \<subseteq> {X. X \<subseteq> A \<and> finite X \<and> card X = k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` (A - B) \<subseteq> {X. X \<subseteq> A \<and> finite X \<and> card X = k}
[PROOF STEP]
using assms B
[PROOF STATE]
proof (prove)
using this:
infinite A
0 < k
B \<subseteq> A
finite B
card B = k - 1

goal (1 subgoal):
 1. f ` (A - B) \<subseteq> {X. X \<subseteq> A \<and> finite X \<and> card X = k}
[PROOF STEP]
by (auto simp: f_def)
[PROOF STATE]
proof (state)
this:
f ` (A - B) \<subseteq> {X. X \<subseteq> A \<and> finite X \<and> card X = k}

goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> finite X \<and> card X = k}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f ` (A - B) \<subseteq> {X. X \<subseteq> A \<and> finite X \<and> card X = k}

goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> finite X \<and> card X = k}
[PROOF STEP]
have "inj_on f (A - B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f (A - B)
[PROOF STEP]
by (auto intro!: inj_onI simp: f_def)
[PROOF STATE]
proof (state)
this:
inj_on f (A - B)

goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> finite X \<and> card X = k}
[PROOF STEP]
hence "infinite (f ` (A - B))"
[PROOF STATE]
proof (prove)
using this:
inj_on f (A - B)

goal (1 subgoal):
 1. infinite (f ` (A - B))
[PROOF STEP]
using assms B
[PROOF STATE]
proof (prove)
using this:
inj_on f (A - B)
infinite A
0 < k
B \<subseteq> A
finite B
card B = k - 1

goal (1 subgoal):
 1. infinite (f ` (A - B))
[PROOF STEP]
by (subst finite_image_iff) auto
[PROOF STATE]
proof (state)
this:
infinite (f ` (A - B))

goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> finite X \<and> card X = k}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f ` (A - B) \<subseteq> {X. X \<subseteq> A \<and> finite X \<and> card X = k}
infinite (f ` (A - B))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f ` (A - B) \<subseteq> {X. X \<subseteq> A \<and> finite X \<and> card X = k}
infinite (f ` (A - B))

goal (1 subgoal):
 1. infinite {X. X \<subseteq> A \<and> finite X \<and> card X = k}
[PROOF STEP]
by (rule infinite_super)
[PROOF STATE]
proof (state)
this:
infinite {X. X \<subseteq> A \<and> finite X \<and> card X = k}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inorder_node43: "height m > 0 \<Longrightarrow>
  inorder (tree\<^sub>d (node43 l a m b n c r)) = inorder l @ a # inorder m @ b # inorder(tree\<^sub>d n) @ c # inorder r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < height m \<Longrightarrow> inorder (tree\<^sub>d (node43 l a m b n c r)) = inorder l @ a # inorder m @ b # inorder (tree\<^sub>d n) @ c # inorder r
[PROOF STEP]
by(induct l a m b n c r rule: node43.induct) auto


[STATEMENT]
lemma real_zeta_ge_one_over_minus_one:
  fixes z :: real
  assumes z: "z > 1"
  shows "Re (zeta (complex_of_real z)) \<ge> 1 / (z - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / (z - 1) \<le> Re (zeta (complex_of_real z))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 / (z - 1) \<le> Re (zeta (complex_of_real z))
[PROOF STEP]
have ineq: "1 \<le> x - ln x" if "x \<in> {0<..<1}" for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> x - ln x
[PROOF STEP]
using ln_le_minus_one[of x] that
[PROOF STATE]
proof (prove)
using this:
0 < x \<Longrightarrow> ln x \<le> x - 1
x \<in> {0<..<1}

goal (1 subgoal):
 1. 1 \<le> x - ln x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?x \<in> {0<..<1} \<Longrightarrow> 1 \<le> ?x - ln ?x

goal (1 subgoal):
 1. 1 / (z - 1) \<le> Re (zeta (complex_of_real z))
[PROOF STEP]
have *: "((\<lambda>u. (- ln u) powr (z - 2) * (u - ln u - 1) / (1 - u)) has_integral
           Gamma z * (Re (zeta (complex_of_real z)) - 1 / (z - 1))) {0<..<1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>u. (- ln u) powr (z - 2) * (u - ln u - 1) / (1 - u)) has_integral Gamma z * (Re (zeta (complex_of_real z)) - 1 / (z - 1))) {0<..<1}
[PROOF STEP]
using Hadjicostas_Chapman_aux[of "z - 2"] z
[PROOF STATE]
proof (prove)
using this:
- 1 < z - 2 \<Longrightarrow> ((\<lambda>u. (- ln u) powr (z - 2) / (1 - u) * (- ln u + u - 1)) has_integral Gamma (z - 2 + 2) * (Re (zeta (complex_of_real (z - 2 + 2))) - 1 / (z - 2 + 1))) {0<..<1}
1 < z

goal (1 subgoal):
 1. ((\<lambda>u. (- ln u) powr (z - 2) * (u - ln u - 1) / (1 - u)) has_integral Gamma z * (Re (zeta (complex_of_real z)) - 1 / (z - 1))) {0<..<1}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>u. (- ln u) powr (z - 2) * (u - ln u - 1) / (1 - u)) has_integral Gamma z * (Re (zeta (complex_of_real z)) - 1 / (z - 1))) {0<..<1}

goal (1 subgoal):
 1. 1 / (z - 1) \<le> Re (zeta (complex_of_real z))
[PROOF STEP]
from ineq
[PROOF STATE]
proof (chain)
picking this:
?x \<in> {0<..<1} \<Longrightarrow> 1 \<le> ?x - ln ?x
[PROOF STEP]
have "Gamma z * (Re (zeta (complex_of_real z)) - 1 / (z - 1)) \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
?x \<in> {0<..<1} \<Longrightarrow> 1 \<le> ?x - ln ?x

goal (1 subgoal):
 1. 0 \<le> Gamma z * (Re (zeta (complex_of_real z)) - 1 / (z - 1))
[PROOF STEP]
by (intro has_integral_nonneg[OF *] z mult_nonneg_nonneg divide_nonneg_nonneg) auto
[PROOF STATE]
proof (state)
this:
0 \<le> Gamma z * (Re (zeta (complex_of_real z)) - 1 / (z - 1))

goal (1 subgoal):
 1. 1 / (z - 1) \<le> Re (zeta (complex_of_real z))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 \<le> Gamma z * (Re (zeta (complex_of_real z)) - 1 / (z - 1))

goal (1 subgoal):
 1. 1 / (z - 1) \<le> Re (zeta (complex_of_real z))
[PROOF STEP]
have "Gamma z > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Gamma z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < z

goal (1 subgoal):
 1. 0 < Gamma z
[PROOF STEP]
by (intro Gamma_real_pos) auto
[PROOF STATE]
proof (state)
this:
0 < Gamma z

goal (1 subgoal):
 1. 1 / (z - 1) \<le> Re (zeta (complex_of_real z))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 \<le> Gamma z * (Re (zeta (complex_of_real z)) - 1 / (z - 1))
0 < Gamma z
[PROOF STEP]
show "Re (zeta (complex_of_real z)) \<ge> 1 / (z - 1)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> Gamma z * (Re (zeta (complex_of_real z)) - 1 / (z - 1))
0 < Gamma z

goal (1 subgoal):
 1. 1 / (z - 1) \<le> Re (zeta (complex_of_real z))
[PROOF STEP]
by (subst (asm) zero_le_mult_iff) auto
[PROOF STATE]
proof (state)
this:
1 / (z - 1) \<le> Re (zeta (complex_of_real z))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_mat_mono:
  assumes A: "A \<in> carrier_mat nr nc" and B: "B \<in> carrier_mat nr nc"
  and AB: "A \<ge>\<^sub>m (B :: 'a :: ordered_semiring_0 mat)"
  shows "sum_mat A \<ge> sum_mat B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_mat B \<le> sum_mat A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_mat B \<le> sum_mat A
[PROOF STEP]
from A B
[PROOF STATE]
proof (chain)
picking this:
A \<in> carrier_mat nr nc
B \<in> carrier_mat nr nc
[PROOF STEP]
have id: "dim_row B = dim_row A" "dim_col B = dim_col A"
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr nc
B \<in> carrier_mat nr nc

goal (1 subgoal):
 1. dim_row B = dim_row A &&& dim_col B = dim_col A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row B = dim_row A
dim_col B = dim_col A

goal (1 subgoal):
 1. sum_mat B \<le> sum_mat A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_mat B \<le> sum_mat A
[PROOF STEP]
unfolding sum_mat_def id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (($$) B) ({0..<dim_row A} \<times> {0..<dim_col A}) \<le> sum (($$) A) ({0..<dim_row A} \<times> {0..<dim_col A})
[PROOF STEP]
by (rule sum_mono_ge, insert mat_geD[OF AB] id, auto)
[PROOF STATE]
proof (state)
this:
sum_mat B \<le> sum_mat A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma NR\<^sub>N_NR\<^sub>N_l_0:
  assumes n: "0 < n" and p: "p \<in> {0<..<1}" and "u \<ge> 1"
  shows "NR\<^sub>N n u 0 = (u * q / (u * q + l * p)) * NR\<^sub>N n u l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NR\<^sub>N n u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N n u l
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. NR\<^sub>N n u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N n u l
[PROOF STEP]
proof (induction n rule: less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 0 < y\<rbrakk> \<Longrightarrow> NR\<^sub>N y u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N y u l; 0 < x\<rbrakk> \<Longrightarrow> NR\<^sub>N x u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N x u l
[PROOF STEP]
case (less i)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?y3 < i; 0 < ?y3\<rbrakk> \<Longrightarrow> NR\<^sub>N ?y3 u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N ?y3 u l
0 < i

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 0 < y\<rbrakk> \<Longrightarrow> NR\<^sub>N y u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N y u l; 0 < x\<rbrakk> \<Longrightarrow> NR\<^sub>N x u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N x u l
[PROOF STEP]
have 1: "0 < u * q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < real u * q
[PROOF STEP]
unfolding q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < real u * (1 - p)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n
p \<in> {0<..<1}
1 \<le> u

goal (1 subgoal):
 1. 0 < real u * (1 - p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < real u * q

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 0 < y\<rbrakk> \<Longrightarrow> NR\<^sub>N y u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N y u l; 0 < x\<rbrakk> \<Longrightarrow> NR\<^sub>N x u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N x u l
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < real u * q

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 0 < y\<rbrakk> \<Longrightarrow> NR\<^sub>N y u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N y u l; 0 < x\<rbrakk> \<Longrightarrow> NR\<^sub>N x u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N x u l
[PROOF STEP]
have "0 \<le> l * p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> real l * p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n
p \<in> {0<..<1}
1 \<le> u

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

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 0 < y\<rbrakk> \<Longrightarrow> NR\<^sub>N y u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N y u l; 0 < x\<rbrakk> \<Longrightarrow> NR\<^sub>N x u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N x u l
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < real u * q
0 \<le> real l * p
[PROOF STEP]
have 2: "0 < u * q + l * p"
[PROOF STATE]
proof (prove)
using this:
0 < real u * q
0 \<le> real l * p

goal (1 subgoal):
 1. 0 < real u * q + real l * p
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
0 < real u * q + real l * p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 0 < y\<rbrakk> \<Longrightarrow> NR\<^sub>N y u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N y u l; 0 < x\<rbrakk> \<Longrightarrow> NR\<^sub>N x u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N x u l
[PROOF STEP]
define c where "c = ennreal (u * q / (u * q + l * p))"
[PROOF STATE]
proof (state)
this:
c = ennreal (real u * q / (real u * q + real l * p))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 0 < y\<rbrakk> \<Longrightarrow> NR\<^sub>N y u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N y u l; 0 < x\<rbrakk> \<Longrightarrow> NR\<^sub>N x u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N x u l
[PROOF STEP]
have [simp]: "c / c = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c / c = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c / c = 1
[PROOF STEP]
have "u * q / (u * q + l * p) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real u * q / (real u * q + real l * p) \<noteq> 0
[PROOF STEP]
using assms q_def 2
[PROOF STATE]
proof (prove)
using this:
0 < n
p \<in> {0<..<1}
1 \<le> u
q = 1 - p
0 < real u * q + real l * p

goal (1 subgoal):
 1. real u * q / (real u * q + real l * p) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real u * q / (real u * q + real l * p) \<noteq> 0

goal (1 subgoal):
 1. c / c = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real u * q / (real u * q + real l * p) \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real u * q / (real u * q + real l * p) \<noteq> 0

goal (1 subgoal):
 1. c / c = 1
[PROOF STEP]
unfolding c_def
[PROOF STATE]
proof (prove)
using this:
real u * q / (real u * q + real l * p) \<noteq> 0

goal (1 subgoal):
 1. ennreal (real u * q / (real u * q + real l * p)) / ennreal (real u * q / (real u * q + real l * p)) = 1
[PROOF STEP]
using p q_def
[PROOF STATE]
proof (prove)
using this:
real u * q / (real u * q + real l * p) \<noteq> 0
p \<in> {0<..<1}
q = 1 - p

goal (1 subgoal):
 1. ennreal (real u * q / (real u * q + real l * p)) / ennreal (real u * q / (real u * q + real l * p)) = 1
[PROOF STEP]
by (auto intro!: ennreal_divide_self)
[PROOF STATE]
proof (state)
this:
c / c = 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
c / c = 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>y. \<lbrakk>y < x; 0 < y\<rbrakk> \<Longrightarrow> NR\<^sub>N y u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N y u l; 0 < x\<rbrakk> \<Longrightarrow> NR\<^sub>N x u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N x u l
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
proof (cases "i = 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
 2. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
i = 1

goal (2 subgoals):
 1. i = 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
 2. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have "c * NR\<^sub>N i u l = c * ((u * q + l * p) / p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * NR\<^sub>N i u l = c * ennreal ((real u * q + real l * p) / p)
[PROOF STEP]
unfolding c_def True
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N 1 u l = ennreal (real u * q / (real u * q + real l * p)) * ennreal ((real u * q + real l * p) / p)
[PROOF STEP]
by (subst NR\<^sub>N_1[OF p]) auto
[PROOF STATE]
proof (state)
this:
c * NR\<^sub>N i u l = c * ennreal ((real u * q + real l * p) / p)

goal (2 subgoals):
 1. i = 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
 2. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
c * NR\<^sub>N i u l = c * ennreal ((real u * q + real l * p) / p)

goal (2 subgoals):
 1. i = 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
 2. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have "\<dots> = ennreal ((u * q / (u * q + l * p)) * ((u * q + l * p) / p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * ennreal ((real u * q + real l * p) / p) = ennreal (real u * q / (real u * q + real l * p) * ((real u * q + real l * p) / p))
[PROOF STEP]
unfolding c_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (real u * q / (real u * q + real l * p)) * ennreal ((real u * q + real l * p) / p) = ennreal (real u * q / (real u * q + real l * p) * ((real u * q + real l * p) / p))
[PROOF STEP]
using assms q_def
[PROOF STATE]
proof (prove)
using this:
0 < n
p \<in> {0<..<1}
1 \<le> u
q = 1 - p

goal (1 subgoal):
 1. ennreal (real u * q / (real u * q + real l * p)) * ennreal ((real u * q + real l * p) / p) = ennreal (real u * q / (real u * q + real l * p) * ((real u * q + real l * p) / p))
[PROOF STEP]
by (subst ennreal_mult'') auto
[PROOF STATE]
proof (state)
this:
c * ennreal ((real u * q + real l * p) / p) = ennreal (real u * q / (real u * q + real l * p) * ((real u * q + real l * p) / p))

goal (2 subgoals):
 1. i = 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
 2. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
c * ennreal ((real u * q + real l * p) / p) = ennreal (real u * q / (real u * q + real l * p) * ((real u * q + real l * p) / p))

goal (2 subgoals):
 1. i = 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
 2. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have "(u * q / (u * q + l * p)) * ((u * q + l * p) / p) = u * q / p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real u * q / (real u * q + real l * p) * ((real u * q + real l * p) / p) = real u * q / p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real u * q / (real u * q + real l * p) * ((real u * q + real l * p) / p) = real u * q / p
[PROOF STEP]
have I: "(a / b) * (b / c) = a / c" if "0 < b" for a b c::"real"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a / b * (b / c) = a / c
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 < b

goal (1 subgoal):
 1. a / b * (b / c) = a / c
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
0 < ?b3 \<Longrightarrow> ?a3 / ?b3 * (?b3 / ?c3) = ?a3 / ?c3

goal (1 subgoal):
 1. real u * q / (real u * q + real l * p) * ((real u * q + real l * p) / p) = real u * q / p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real u * q / (real u * q + real l * p) * ((real u * q + real l * p) / p) = real u * q / p
[PROOF STEP]
using 2 q_def
[PROOF STATE]
proof (prove)
using this:
0 < real u * q + real l * p
q = 1 - p

goal (1 subgoal):
 1. real u * q / (real u * q + real l * p) * ((real u * q + real l * p) / p) = real u * q / p
[PROOF STEP]
by (intro I) auto
[PROOF STATE]
proof (state)
this:
real u * q / (real u * q + real l * p) * ((real u * q + real l * p) / p) = real u * q / p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real u * q / (real u * q + real l * p) * ((real u * q + real l * p) / p) = real u * q / p

goal (2 subgoals):
 1. i = 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
 2. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real u * q / (real u * q + real l * p) * ((real u * q + real l * p) / p) = real u * q / p

goal (2 subgoals):
 1. i = 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
 2. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have "\<dots> = NR\<^sub>N i u 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (real u * q / p) = NR\<^sub>N i u 0
[PROOF STEP]
unfolding True c_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (real u * q / p) = NR\<^sub>N 1 u 0
[PROOF STEP]
by (subst NR\<^sub>N_1[OF p]) (auto)
[PROOF STATE]
proof (state)
this:
ennreal (real u * q / p) = NR\<^sub>N i u 0

goal (2 subgoals):
 1. i = 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
 2. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
c * NR\<^sub>N i u l = NR\<^sub>N i u 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c * NR\<^sub>N i u l = NR\<^sub>N i u 0

goal (1 subgoal):
 1. NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
unfolding c_def
[PROOF STATE]
proof (prove)
using this:
ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l = NR\<^sub>N i u 0

goal (1 subgoal):
 1. NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l = NR\<^sub>N i u 0
i = 1

goal (1 subgoal):
 1. NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
i \<noteq> 1

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<noteq> 1
[PROOF STEP]
have i: "i > 1"
[PROOF STATE]
proof (prove)
using this:
i \<noteq> 1

goal (1 subgoal):
 1. 1 < i
[PROOF STEP]
using less
[PROOF STATE]
proof (prove)
using this:
i \<noteq> 1
\<lbrakk>?y3 < i; 0 < ?y3\<rbrakk> \<Longrightarrow> NR\<^sub>N ?y3 u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N ?y3 u l
0 < i

goal (1 subgoal):
 1. 1 < i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 < i

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
define c where "c = ennreal (u * q / (u * q + l * p))"
[PROOF STATE]
proof (state)
this:
c = ennreal (real u * q / (real u * q + real l * p))

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
define B where "B = (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (i - 1) q) k))"
[PROOF STATE]
proof (state)
this:
B = (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (i - 1) q) k))

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have "NR\<^sub>N i u 0 = (p * NR\<^sub>N (i - 1) u 0 +
                     q * (u + (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * (pmf (binomial_pmf (i - 1) q) k))))
                     / (1 - (q ^ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NR\<^sub>N i u 0 = (ennreal p * NR\<^sub>N (i - 1) u 0 + ennreal q * (of_nat u + (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * ennreal (pmf (binomial_pmf (i - 1) q) k)))) / ennreal (1 - q ^ i)
[PROOF STEP]
using less assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y3 < i; 0 < ?y3\<rbrakk> \<Longrightarrow> NR\<^sub>N ?y3 u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N ?y3 u l
0 < i
0 < n
p \<in> {0<..<1}
1 \<le> u

goal (1 subgoal):
 1. NR\<^sub>N i u 0 = (ennreal p * NR\<^sub>N (i - 1) u 0 + ennreal q * (of_nat u + (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * ennreal (pmf (binomial_pmf (i - 1) q) k)))) / ennreal (1 - q ^ i)
[PROOF STEP]
by (subst NR\<^sub>N_l_0) auto
[PROOF STATE]
proof (state)
this:
NR\<^sub>N i u 0 = (ennreal p * NR\<^sub>N (i - 1) u 0 + ennreal q * (of_nat u + (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * ennreal (pmf (binomial_pmf (i - 1) q) k)))) / ennreal (1 - q ^ i)

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
NR\<^sub>N i u 0 = (ennreal p * NR\<^sub>N (i - 1) u 0 + ennreal q * (of_nat u + (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * ennreal (pmf (binomial_pmf (i - 1) q) k)))) / ennreal (1 - q ^ i)

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have "q * (u + (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * (pmf (binomial_pmf (i - 1) q) k))) =
             q * u + q * (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * (pmf (binomial_pmf (i - 1) q) k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal q * (of_nat u + (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * ennreal (pmf (binomial_pmf (i - 1) q) k))) = ennreal (q * real u) + ennreal q * (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * ennreal (pmf (binomial_pmf (i - 1) q) k))
[PROOF STEP]
using assms q_def
[PROOF STATE]
proof (prove)
using this:
0 < n
p \<in> {0<..<1}
1 \<le> u
q = 1 - p

goal (1 subgoal):
 1. ennreal q * (of_nat u + (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * ennreal (pmf (binomial_pmf (i - 1) q) k))) = ennreal (q * real u) + ennreal q * (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * ennreal (pmf (binomial_pmf (i - 1) q) k))
[PROOF STEP]
by (auto simp add: field_simps ennreal_of_nat_eq_real_of_nat ennreal_mult)
[PROOF STATE]
proof (state)
this:
ennreal q * (of_nat u + (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * ennreal (pmf (binomial_pmf (i - 1) q) k))) = ennreal (q * real u) + ennreal q * (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * ennreal (pmf (binomial_pmf (i - 1) q) k))

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal q * (of_nat u + (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * ennreal (pmf (binomial_pmf (i - 1) q) k))) = ennreal (q * real u) + ennreal q * (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * ennreal (pmf (binomial_pmf (i - 1) q) k))

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have "NR\<^sub>N (i - 1) u 0 = c * NR\<^sub>N (i - 1) u l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NR\<^sub>N (i - 1) u 0 = c * NR\<^sub>N (i - 1) u l
[PROOF STEP]
unfolding c_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NR\<^sub>N (i - 1) u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N (i - 1) u l
[PROOF STEP]
using less i
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y3 < i; 0 < ?y3\<rbrakk> \<Longrightarrow> NR\<^sub>N ?y3 u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N ?y3 u l
0 < i
1 < i

goal (1 subgoal):
 1. NR\<^sub>N (i - 1) u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N (i - 1) u l
[PROOF STEP]
by (intro less) (auto)
[PROOF STATE]
proof (state)
this:
NR\<^sub>N (i - 1) u 0 = c * NR\<^sub>N (i - 1) u l

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
NR\<^sub>N (i - 1) u 0 = c * NR\<^sub>N (i - 1) u l

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have "(\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * ennreal (pmf (binomial_pmf (i - 1) q) k)) =
             (\<Sum>k<i - 1. c * NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (i - 1) q) k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * ennreal (pmf (binomial_pmf (i - 1) q) k)) = (\<Sum>k<i - 1. c * NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (i - 1) q) k))
[PROOF STEP]
by (auto intro!: sum.cong simp add: less c_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * ennreal (pmf (binomial_pmf (i - 1) q) k)) = (\<Sum>k<i - 1. c * NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (i - 1) q) k))

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k<i - 1. NR\<^sub>N (k + 1) u 0 * ennreal (pmf (binomial_pmf (i - 1) q) k)) = (\<Sum>k<i - 1. c * NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (i - 1) q) k))

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have "\<dots> = c * B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<i - 1. c * NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (i - 1) q) k)) = c * B
[PROOF STEP]
unfolding B_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<i - 1. c * NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (i - 1) q) k)) = c * (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (i - 1) q) k))
[PROOF STEP]
by (subst sum_distrib_left) (auto intro!: sum.cong mult_ac)
[PROOF STATE]
proof (state)
this:
(\<Sum>k<i - 1. c * NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (i - 1) q) k)) = c * B

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k<i - 1. c * NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (i - 1) q) k)) = c * B

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have "q * (c * B) = c * (q * B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal q * (c * B) = c * (ennreal q * B)
[PROOF STEP]
by (simp add: mult_ac)
[PROOF STATE]
proof (state)
this:
ennreal q * (c * B) = c * (ennreal q * B)

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal q * (c * B) = c * (ennreal q * B)

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have "ennreal (q * real u) = q * u * ((u * q + l * p) / (u * q + l * p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (q * real u) = ennreal (q * real u * ((real u * q + real l * p) / (real u * q + real l * p)))
[PROOF STEP]
using assms 2
[PROOF STATE]
proof (prove)
using this:
0 < n
p \<in> {0<..<1}
1 \<le> u
0 < real u * q + real l * p

goal (1 subgoal):
 1. ennreal (q * real u) = ennreal (q * real u * ((real u * q + real l * p) / (real u * q + real l * p)))
[PROOF STEP]
by (auto simp add: field_simps q_def)
[PROOF STATE]
proof (state)
this:
ennreal (q * real u) = ennreal (q * real u * ((real u * q + real l * p) / (real u * q + real l * p)))

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (q * real u) = ennreal (q * real u * ((real u * q + real l * p) / (real u * q + real l * p)))

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have "\<dots> = c * (real u * q + real l * p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (q * real u * ((real u * q + real l * p) / (real u * q + real l * p))) = c * ennreal (real u * q + real l * p)
[PROOF STEP]
unfolding c_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (q * real u * ((real u * q + real l * p) / (real u * q + real l * p))) = ennreal (real u * q / (real u * q + real l * p)) * ennreal (real u * q + real l * p)
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
0 < real u * q + real l * p

goal (1 subgoal):
 1. ennreal (q * real u * ((real u * q + real l * p) / (real u * q + real l * p))) = ennreal (real u * q / (real u * q + real l * p)) * ennreal (real u * q + real l * p)
[PROOF STEP]
by (subst ennreal_mult''[symmetric]) (auto simp add: mult_ac)
[PROOF STATE]
proof (state)
this:
ennreal (q * real u * ((real u * q + real l * p) / (real u * q + real l * p))) = c * ennreal (real u * q + real l * p)

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (q * real u * ((real u * q + real l * p) / (real u * q + real l * p))) = c * ennreal (real u * q + real l * p)

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have "c * ennreal (real u * q + real l * p) + c * (ennreal q * B) =
             c * (ennreal (real u * q + real l * p) + (ennreal q * B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * ennreal (real u * q + real l * p) + c * (ennreal q * B) = c * (ennreal (real u * q + real l * p) + ennreal q * B)
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
c * ennreal (real u * q + real l * p) + c * (ennreal q * B) = c * (ennreal (real u * q + real l * p) + ennreal q * B)

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
c * ennreal (real u * q + real l * p) + c * (ennreal q * B) = c * (ennreal (real u * q + real l * p) + ennreal q * B)

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have "ennreal p * (c * NR\<^sub>N (i - 1) u l) = c * (ennreal p * NR\<^sub>N (i - 1) u l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal p * (c * NR\<^sub>N (i - 1) u l) = c * (ennreal p * NR\<^sub>N (i - 1) u l)
[PROOF STEP]
by (simp add: mult_ac)
[PROOF STATE]
proof (state)
this:
ennreal p * (c * NR\<^sub>N (i - 1) u l) = c * (ennreal p * NR\<^sub>N (i - 1) u l)

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal p * (c * NR\<^sub>N (i - 1) u l) = c * (ennreal p * NR\<^sub>N (i - 1) u l)

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have "(c * (ennreal p * NR\<^sub>N (i - 1) u l) + c * (ennreal (u * q + l * p) + ennreal q * B))
            = c * ((ennreal p * NR\<^sub>N (i - 1) u l) + (ennreal (u * q + l * p) + ennreal q * B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * (ennreal p * NR\<^sub>N (i - 1) u l) + c * (ennreal (real u * q + real l * p) + ennreal q * B) = c * (ennreal p * NR\<^sub>N (i - 1) u l + (ennreal (real u * q + real l * p) + ennreal q * B))
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
c * (ennreal p * NR\<^sub>N (i - 1) u l) + c * (ennreal (real u * q + real l * p) + ennreal q * B) = c * (ennreal p * NR\<^sub>N (i - 1) u l + (ennreal (real u * q + real l * p) + ennreal q * B))

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
c * (ennreal p * NR\<^sub>N (i - 1) u l) + c * (ennreal (real u * q + real l * p) + ennreal q * B) = c * (ennreal p * NR\<^sub>N (i - 1) u l + (ennreal (real u * q + real l * p) + ennreal q * B))

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have " c * (ennreal p * NR\<^sub>N (i - 1) u l + (ennreal (u * q + l * p) + ennreal q * B)) / ennreal (1 - q ^ i)
         =  c * ((ennreal p * NR\<^sub>N (i - 1) u l + (ennreal (u * q + l * p) + ennreal q * B)) / ennreal (1 - q ^ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * (ennreal p * NR\<^sub>N (i - 1) u l + (ennreal (real u * q + real l * p) + ennreal q * B)) / ennreal (1 - q ^ i) = c * ((ennreal p * NR\<^sub>N (i - 1) u l + (ennreal (real u * q + real l * p) + ennreal q * B)) / ennreal (1 - q ^ i))
[PROOF STEP]
by (auto simp add: ennreal_times_divide)
[PROOF STATE]
proof (state)
this:
c * (ennreal p * NR\<^sub>N (i - 1) u l + (ennreal (real u * q + real l * p) + ennreal q * B)) / ennreal (1 - q ^ i) = c * ((ennreal p * NR\<^sub>N (i - 1) u l + (ennreal (real u * q + real l * p) + ennreal q * B)) / ennreal (1 - q ^ i))

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
c * (ennreal p * NR\<^sub>N (i - 1) u l + (ennreal (real u * q + real l * p) + ennreal q * B)) / ennreal (1 - q ^ i) = c * ((ennreal p * NR\<^sub>N (i - 1) u l + (ennreal (real u * q + real l * p) + ennreal q * B)) / ennreal (1 - q ^ i))

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
have "(ennreal p * NR\<^sub>N (i - 1) u l + (ennreal (real u * q + real l * p) + ennreal q * B)) / ennreal (1 - q ^ i)
        = NR\<^sub>N i u l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ennreal p * NR\<^sub>N (i - 1) u l + (ennreal (real u * q + real l * p) + ennreal q * B)) / ennreal (1 - q ^ i) = NR\<^sub>N i u l
[PROOF STEP]
apply(subst (2) NR\<^sub>N_recurrence')
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 0 < i
 2. p \<in> {0<..<1}
 3. (ennreal p * NR\<^sub>N (i - 1) u l + (ennreal (real u * q + real l * p) + ennreal q * B)) / ennreal (1 - q ^ i) = (ennreal (p * real l) + ennreal p * NR\<^sub>N (i - 1) u l + ennreal (q * real u) + ennreal q * (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (i - 1) q) k))) / ennreal (1 - q ^ i)
[PROOF STEP]
using i assms q_def
[PROOF STATE]
proof (prove)
using this:
1 < i
0 < n
p \<in> {0<..<1}
1 \<le> u
q = 1 - p

goal (3 subgoals):
 1. 0 < i
 2. p \<in> {0<..<1}
 3. (ennreal p * NR\<^sub>N (i - 1) u l + (ennreal (real u * q + real l * p) + ennreal q * B)) / ennreal (1 - q ^ i) = (ennreal (p * real l) + ennreal p * NR\<^sub>N (i - 1) u l + ennreal (q * real u) + ennreal q * (\<Sum>k<i - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (i - 1) q) k))) / ennreal (1 - q ^ i)
[PROOF STEP]
by
        (auto simp add: field_simps B_def ennreal_of_nat_eq_real_of_nat ennreal_mult' ennreal_mult'')
[PROOF STATE]
proof (state)
this:
(ennreal p * NR\<^sub>N (i - 1) u l + (ennreal (real u * q + real l * p) + ennreal q * B)) / ennreal (1 - q ^ i) = NR\<^sub>N i u l

goal (1 subgoal):
 1. i \<noteq> 1 \<Longrightarrow> NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
NR\<^sub>N i u 0 = c * NR\<^sub>N i u l
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
NR\<^sub>N i u 0 = c * NR\<^sub>N i u l

goal (1 subgoal):
 1. NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
unfolding c_def
[PROOF STATE]
proof (prove)
using this:
NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l

goal (1 subgoal):
 1. NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
NR\<^sub>N i u 0 = ennreal (real u * q / (real u * q + real l * p)) * NR\<^sub>N i u l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_eq_conv[simp]: "(map f xs = map g xs) = (\<forall>x \<in> set xs. f x = g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (map f xs = map g xs) = (\<forall>x\<in>set xs. f x = g x)
[PROOF STEP]
by (induct xs) auto


[STATEMENT]
lemma factorize_polys_map_square_free_prod_list:
  assumes "factorize_polys ps = (fs,data)"
  assumes "fss =  map real_of_rat_poly fs"
  shows "square_free (prod_list fss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. square_free (prod_list fss)
[PROOF STEP]
using  factorize_polys_square_free_prod_list[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
square_free (prod_list fs)

goal (1 subgoal):
 1. square_free (prod_list fss)
[PROOF STEP]
unfolding assms(2)
[PROOF STATE]
proof (prove)
using this:
square_free (prod_list fs)

goal (1 subgoal):
 1. square_free (prod_list (map real_of_rat_poly fs))
[PROOF STEP]
by (simp add: of_rat_hom.square_free_map_poly)