[STATEMENT]
lemma summable_comparison_test_bigo:
  fixes f :: "nat \<Rightarrow> real"
  assumes "summable (\<lambda>n. norm (g n))" "f \<in> O(g)"
  shows   "summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable f
[PROOF STEP]
from \<open>f \<in> O(g)\<close>
[PROOF STATE]
proof (chain)
picking this:
f \<in> O(g)
[PROOF STEP]
obtain C where C: "eventually (\<lambda>x. norm (f x) \<le> C * norm (g x)) at_top"
[PROOF STATE]
proof (prove)
using this:
f \<in> O(g)

goal (1 subgoal):
 1. (\<And>C. \<forall>\<^sub>F x in sequentially. norm (f x) \<le> C * norm (g x) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim: landau_o.bigE)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in sequentially. norm (f x) \<le> C * norm (g x)

goal (1 subgoal):
 1. summable f
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in sequentially. norm (f x) \<le> C * norm (g x)

goal (1 subgoal):
 1. summable f
[PROOF STEP]
by (rule summable_comparison_test_ev) (insert assms, auto intro: summable_mult)
[PROOF STATE]
proof (state)
this:
summable f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in fin_digraph) trails_finite: "finite {p. \<exists>u v. trail u p v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {p. \<exists>u v. trail u p v}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {p. \<exists>u v. trail u p v}
[PROOF STEP]
have "{p. \<exists>u v. trail u p v} \<subseteq> {p. distinct p \<and> set p \<subseteq> arcs G}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {p. \<exists>u v. trail u p v} \<subseteq> {p. distinct p \<and> set p \<subseteq> arcs G}
[PROOF STEP]
by (auto simp: trail_def)
[PROOF STATE]
proof (state)
this:
{p. \<exists>u v. trail u p v} \<subseteq> {p. distinct p \<and> set p \<subseteq> arcs G}

goal (1 subgoal):
 1. finite {p. \<exists>u v. trail u p v}
[PROOF STEP]
with finite_arcs finite_distinct
[PROOF STATE]
proof (chain)
picking this:
finite (arcs G)
finite ?A \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> ?A}
{p. \<exists>u v. trail u p v} \<subseteq> {p. distinct p \<and> set p \<subseteq> arcs G}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (arcs G)
finite ?A \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> ?A}
{p. \<exists>u v. trail u p v} \<subseteq> {p. distinct p \<and> set p \<subseteq> arcs G}

goal (1 subgoal):
 1. finite {p. \<exists>u v. trail u p v}
[PROOF STEP]
by (blast intro: finite_subset)
[PROOF STATE]
proof (state)
this:
finite {p. \<exists>u v. trail u p v}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in is_functor) cf_op_cf_op_cf[cat_op_simps]: "op_cf (op_cf \<FF>) = \<FF>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_cf (op_cf \<FF>) = \<FF>
[PROOF STEP]
proof(rule cf_eqI[of \<alpha> \<AA> \<BB> _ \<AA> \<BB>], unfold cat_op_simps)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. op_cf (op_cf \<FF>) : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
 2. \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
 3. \<FF>\<lparr>ObjMap\<rparr> = \<FF>\<lparr>ObjMap\<rparr>
 4. \<FF>\<lparr>ArrMap\<rparr> = \<FF>\<lparr>ArrMap\<rparr>
 5. \<AA> = \<AA>
 6. \<BB> = \<BB>
[PROOF STEP]
show "op_cf (op_cf \<FF>) : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_cf (op_cf \<FF>) : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by
      (
        metis
          HomCod.cat_op_cat_op_cat
          HomDom.cat_op_cat_op_cat
          is_functor.is_functor_op
          is_functor_op
      )
[PROOF STATE]
proof (state)
this:
op_cf (op_cf \<FF>) : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>

goal (5 subgoals):
 1. \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
 2. \<FF>\<lparr>ObjMap\<rparr> = \<FF>\<lparr>ObjMap\<rparr>
 3. \<FF>\<lparr>ArrMap\<rparr> = \<FF>\<lparr>ArrMap\<rparr>
 4. \<AA> = \<AA>
 5. \<BB> = \<BB>
[PROOF STEP]
qed (auto simp: cat_cs_intros)


[STATEMENT]
lemma [bb_real_arith]:
  assumes "0 > g" and inv: "2 \<cdot> g \<cdot> x - 2 \<cdot> g \<cdot> h = v \<cdot> v"
  shows "(x::real) \<le> h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> h
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<le> h
[PROOF STEP]
have "v \<cdot> v = 2 \<cdot> g \<cdot> x - 2 \<cdot> g \<cdot> h \<and> 0 > g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<cdot> v = 2 \<cdot> g \<cdot> x - 2 \<cdot> g \<cdot> h \<and> g < 0
[PROOF STEP]
using inv and \<open>0 > g\<close>
[PROOF STATE]
proof (prove)
using this:
2 \<cdot> g \<cdot> x - 2 \<cdot> g \<cdot> h = v \<cdot> v
g < 0

goal (1 subgoal):
 1. v \<cdot> v = 2 \<cdot> g \<cdot> x - 2 \<cdot> g \<cdot> h \<and> g < 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<cdot> v = 2 \<cdot> g \<cdot> x - 2 \<cdot> g \<cdot> h \<and> g < 0

goal (1 subgoal):
 1. x \<le> h
[PROOF STEP]
hence obs:"v \<cdot> v = 2 \<cdot> g \<cdot> (x - h) \<and> 0 > g \<and> v \<cdot> v \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
v \<cdot> v = 2 \<cdot> g \<cdot> x - 2 \<cdot> g \<cdot> h \<and> g < 0

goal (1 subgoal):
 1. v \<cdot> v = 2 \<cdot> g \<cdot> (x - h) \<and> g < 0 \<and> 0 \<le> v \<cdot> v
[PROOF STEP]
using left_diff_distrib mult.commute
[PROOF STATE]
proof (prove)
using this:
v \<cdot> v = 2 \<cdot> g \<cdot> x - 2 \<cdot> g \<cdot> h \<and> g < 0
(?a - ?b) \<cdot> ?c = ?a \<cdot> ?c - ?b \<cdot> ?c
?a \<cdot> ?b = ?b \<cdot> ?a

goal (1 subgoal):
 1. v \<cdot> v = 2 \<cdot> g \<cdot> (x - h) \<and> g < 0 \<and> 0 \<le> v \<cdot> v
[PROOF STEP]
by (metis zero_le_square)
[PROOF STATE]
proof (state)
this:
v \<cdot> v = 2 \<cdot> g \<cdot> (x - h) \<and> g < 0 \<and> 0 \<le> v \<cdot> v

goal (1 subgoal):
 1. x \<le> h
[PROOF STEP]
hence "(v \<cdot> v)/(2 \<cdot> g) = (x - h)"
[PROOF STATE]
proof (prove)
using this:
v \<cdot> v = 2 \<cdot> g \<cdot> (x - h) \<and> g < 0 \<and> 0 \<le> v \<cdot> v

goal (1 subgoal):
 1. v \<cdot> v / (2 \<cdot> g) = x - h
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<cdot> v / (2 \<cdot> g) = x - h

goal (1 subgoal):
 1. x \<le> h
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
v \<cdot> v / (2 \<cdot> g) = x - h

goal (1 subgoal):
 1. x \<le> h
[PROOF STEP]
from obs
[PROOF STATE]
proof (chain)
picking this:
v \<cdot> v = 2 \<cdot> g \<cdot> (x - h) \<and> g < 0 \<and> 0 \<le> v \<cdot> v
[PROOF STEP]
have "(v \<cdot> v)/(2 \<cdot> g) \<le> 0"
[PROOF STATE]
proof (prove)
using this:
v \<cdot> v = 2 \<cdot> g \<cdot> (x - h) \<and> g < 0 \<and> 0 \<le> v \<cdot> v

goal (1 subgoal):
 1. v \<cdot> v / (2 \<cdot> g) \<le> 0
[PROOF STEP]
using divide_nonneg_neg
[PROOF STATE]
proof (prove)
using this:
v \<cdot> v = 2 \<cdot> g \<cdot> (x - h) \<and> g < 0 \<and> 0 \<le> v \<cdot> v
\<lbrakk>(0::?'a) \<le> ?x; ?y < (0::?'a)\<rbrakk> \<Longrightarrow> ?x / ?y \<le> (0::?'a)

goal (1 subgoal):
 1. v \<cdot> v / (2 \<cdot> g) \<le> 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
v \<cdot> v / (2 \<cdot> g) \<le> 0

goal (1 subgoal):
 1. x \<le> h
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
v \<cdot> v / (2 \<cdot> g) = x - h
v \<cdot> v / (2 \<cdot> g) \<le> 0
[PROOF STEP]
have "h - x \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
v \<cdot> v / (2 \<cdot> g) = x - h
v \<cdot> v / (2 \<cdot> g) \<le> 0

goal (1 subgoal):
 1. 0 \<le> h - x
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
0 \<le> h - x

goal (1 subgoal):
 1. x \<le> h
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> h - x

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rtrancl3p_into_Rtrancl3p:
  "\<lbrakk> rtrancl3p trsys a bs a'; \<And>b a''. \<not> a' -b\<rightarrow> a'' \<rbrakk> \<Longrightarrow> Rtrancl3p a (tllist_of_llist a' (llist_of bs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a -bs\<rightarrow>* a'; \<And>b a''. \<not> a' -b\<rightarrow> a''\<rbrakk> \<Longrightarrow> Rtrancl3p a (tllist_of_llist a' (llist_of bs))
[PROOF STEP]
by(induct rule: rtrancl3p_converse_induct)(auto intro: Rtrancl3p.intros)


[STATEMENT]
lemma [simp]:
  "(binop_Mult v1 v2 = Some va) \<longleftrightarrow>
   (\<exists>i1 i2. v1 = Intg i1 \<and> v2 = Intg i2 \<and> va = Inl (Intg (i1 * i2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (binop_Mult v1 v2 = \<lfloor>va\<rfloor>) = (\<exists>i1 i2. v1 = Intg i1 \<and> v2 = Intg i2 \<and> va = Inl (Intg (i1 * i2)))
[PROOF STEP]
by(cases "(v1, v2)" rule: binop_Mult.cases) auto


[STATEMENT]
lemma card_a_I[simp]: "I \<subseteq> {0 ..< m} \<Longrightarrow> card (a ` I) = card I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<subseteq> {0..<m} \<Longrightarrow> card (a ` I) = card I
[PROOF STEP]
by (smt inj_a card_image inj_on_image_eq_iff subset_image_inj subset_refl subset_trans)


[STATEMENT]
lemma mix_pmf_comp_left_div:
  assumes "\<alpha> \<in> {0..(1::real)}"
    and "\<beta> \<in> {0..(1::real)}"
  assumes "\<alpha> > \<beta>"
  shows "pmf (mix_pmf (\<beta>/\<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + pmf q e - \<beta> * pmf q e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + pmf q e - \<beta> * pmf q e
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + pmf q e - \<beta> * pmf q e
[PROOF STEP]
let ?l = "(mix_pmf (\<beta>/\<alpha>) (mix_pmf \<alpha> p q) q)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + pmf q e - \<beta> * pmf q e
[PROOF STEP]
have fst: "pmf ?l e = (\<beta>/\<alpha>) * pmf (mix_pmf \<alpha> p q) e + (1-\<beta>/\<alpha>) * pmf q e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * pmf (mix_pmf \<alpha> p q) e + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
by (meson assms(1) assms(2) assms(3) atLeastAtMost_iff less_divide_eq_1
        less_eq_real_def not_less pmf_mix zero_le_divide_iff)
[PROOF STATE]
proof (state)
this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * pmf (mix_pmf \<alpha> p q) e + (1 - \<beta> / \<alpha>) * pmf q e

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + pmf q e - \<beta> * pmf q e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * pmf (mix_pmf \<alpha> p q) e + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
have "pmf (mix_pmf \<alpha> p q) e = \<alpha> * pmf p e + (1 - \<alpha>) * pmf q e"
[PROOF STATE]
proof (prove)
using this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * pmf (mix_pmf \<alpha> p q) e + (1 - \<beta> / \<alpha>) * pmf q e

goal (1 subgoal):
 1. pmf (mix_pmf \<alpha> p q) e = \<alpha> * pmf p e + (1 - \<alpha>) * pmf q e
[PROOF STEP]
using pmf_mix[of "\<alpha>" p q] assms(2) assms(3) assms(1)
[PROOF STATE]
proof (prove)
using this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * pmf (mix_pmf \<alpha> p q) e + (1 - \<beta> / \<alpha>) * pmf q e
\<alpha> \<in> {0..1} \<Longrightarrow> pmf (mix_pmf \<alpha> p q) ?x = \<alpha> * pmf p ?x + (1 - \<alpha>) * pmf q ?x
\<beta> \<in> {0..1}
\<beta> < \<alpha>
\<alpha> \<in> {0..1}

goal (1 subgoal):
 1. pmf (mix_pmf \<alpha> p q) e = \<alpha> * pmf p e + (1 - \<alpha>) * pmf q e
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
pmf (mix_pmf \<alpha> p q) e = \<alpha> * pmf p e + (1 - \<alpha>) * pmf q e

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + pmf q e - \<beta> * pmf q e
[PROOF STEP]
have "pmf ?l e = (\<beta>/\<alpha>) * (\<alpha> * pmf p e + (1 - \<alpha>) * pmf q e) + (1-\<beta>/\<alpha>) * pmf q e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * (\<alpha> * pmf p e + (1 - \<alpha>) * pmf q e) + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
using fst assms(1) pmf_mix
[PROOF STATE]
proof (prove)
using this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * pmf (mix_pmf \<alpha> p q) e + (1 - \<beta> / \<alpha>) * pmf q e
\<alpha> \<in> {0..1}
?a \<in> {0..1} \<Longrightarrow> pmf (mix_pmf ?a ?p ?q) ?x = ?a * pmf ?p ?x + (1 - ?a) * pmf ?q ?x

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * (\<alpha> * pmf p e + (1 - \<alpha>) * pmf q e) + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * (\<alpha> * pmf p e + (1 - \<alpha>) * pmf q e) + (1 - \<beta> / \<alpha>) * pmf q e

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + pmf q e - \<beta> * pmf q e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * (\<alpha> * pmf p e + (1 - \<alpha>) * pmf q e) + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
have "pmf ?l e = ((\<beta>/\<alpha>) *\<alpha> * pmf p e + (\<beta>/\<alpha>) *(1 - \<alpha>) * pmf q e) + (1-\<beta>/\<alpha>) * pmf q e"
[PROOF STATE]
proof (prove)
using this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * (\<alpha> * pmf p e + (1 - \<alpha>) * pmf q e) + (1 - \<beta> / \<alpha>) * pmf q e

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * \<alpha> * pmf p e + \<beta> / \<alpha> * (1 - \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
using fst assms(1)
[PROOF STATE]
proof (prove)
using this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * (\<alpha> * pmf p e + (1 - \<alpha>) * pmf q e) + (1 - \<beta> / \<alpha>) * pmf q e
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * pmf (mix_pmf \<alpha> p q) e + (1 - \<beta> / \<alpha>) * pmf q e
\<alpha> \<in> {0..1}

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * \<alpha> * pmf p e + \<beta> / \<alpha> * (1 - \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
by (metis  mult.assoc  ring_class.ring_distribs(1))
[PROOF STATE]
proof (state)
this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * \<alpha> * pmf p e + \<beta> / \<alpha> * (1 - \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + pmf q e - \<beta> * pmf q e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * \<alpha> * pmf p e + \<beta> / \<alpha> * (1 - \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
have *: "pmf ?l e = (\<beta> * pmf p e + (\<beta>/\<alpha>) *(1 - \<alpha>) * pmf q e) + (1-\<beta>/\<alpha>) * pmf q e"
[PROOF STATE]
proof (prove)
using this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * \<alpha> * pmf p e + \<beta> / \<alpha> * (1 - \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + \<beta> / \<alpha> * (1 - \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
using fst assms(1) assms(2) assms(3)
[PROOF STATE]
proof (prove)
using this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * \<alpha> * pmf p e + \<beta> / \<alpha> * (1 - \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * pmf (mix_pmf \<alpha> p q) e + (1 - \<beta> / \<alpha>) * pmf q e
\<alpha> \<in> {0..1}
\<beta> \<in> {0..1}
\<beta> < \<alpha>

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + \<beta> / \<alpha> * (1 - \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + \<beta> / \<alpha> * (1 - \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + pmf q e - \<beta> * pmf q e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + \<beta> / \<alpha> * (1 - \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
have "pmf ?l e = (\<beta> * pmf p e + ((\<beta>/\<alpha>) - (\<beta>/\<alpha>)*\<alpha>) * pmf q e) + (1-\<beta>/\<alpha>) * pmf q e"
[PROOF STATE]
proof (prove)
using this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + \<beta> / \<alpha> * (1 - \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + (\<beta> / \<alpha> - \<beta> / \<alpha> * \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
using fst assms(1) assms(2) assms(3)
[PROOF STATE]
proof (prove)
using this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + \<beta> / \<alpha> * (1 - \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * pmf (mix_pmf \<alpha> p q) e + (1 - \<beta> / \<alpha>) * pmf q e
\<alpha> \<in> {0..1}
\<beta> \<in> {0..1}
\<beta> < \<alpha>

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + (\<beta> / \<alpha> - \<beta> / \<alpha> * \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
by (simp add: * diff_divide_distrib right_diff_distrib')
[PROOF STATE]
proof (state)
this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + (\<beta> / \<alpha> - \<beta> / \<alpha> * \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + pmf q e - \<beta> * pmf q e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + (\<beta> / \<alpha> - \<beta> / \<alpha> * \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
have "pmf ?l e = (\<beta> * pmf p e + ((\<beta>/\<alpha>) - \<beta>) * pmf q e) + (1-\<beta>/\<alpha>) * pmf q e"
[PROOF STATE]
proof (prove)
using this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + (\<beta> / \<alpha> - \<beta> / \<alpha> * \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + (\<beta> / \<alpha> - \<beta>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
using fst assms(1) assms(2) assms(3)
[PROOF STATE]
proof (prove)
using this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + (\<beta> / \<alpha> - \<beta> / \<alpha> * \<alpha>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> / \<alpha> * pmf (mix_pmf \<alpha> p q) e + (1 - \<beta> / \<alpha>) * pmf q e
\<alpha> \<in> {0..1}
\<beta> \<in> {0..1}
\<beta> < \<alpha>

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + (\<beta> / \<alpha> - \<beta>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + (\<beta> / \<alpha> - \<beta>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + pmf q e - \<beta> * pmf q e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + (\<beta> / \<alpha> - \<beta>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e
[PROOF STEP]
have "pmf ?l e = (\<beta> * pmf p e + (\<beta>/\<alpha>) * pmf q e - \<beta> * pmf q e) + 1* pmf q e-\<beta>/\<alpha>* pmf q e"
[PROOF STATE]
proof (prove)
using this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + (\<beta> / \<alpha> - \<beta>) * pmf q e + (1 - \<beta> / \<alpha>) * pmf q e

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + \<beta> / \<alpha> * pmf q e - \<beta> * pmf q e + 1 * pmf q e - \<beta> / \<alpha> * pmf q e
[PROOF STEP]
by (simp add: left_diff_distrib)
[PROOF STATE]
proof (state)
this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + \<beta> / \<alpha> * pmf q e - \<beta> * pmf q e + 1 * pmf q e - \<beta> / \<alpha> * pmf q e

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + pmf q e - \<beta> * pmf q e
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + \<beta> / \<alpha> * pmf q e - \<beta> * pmf q e + 1 * pmf q e - \<beta> / \<alpha> * pmf q e

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + pmf q e - \<beta> * pmf q e
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + pmf q e - \<beta> * pmf q e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coeff_le_sq_norm:
  fixes f :: "'a :: {conjugatable_ring_1_abs_real_line} poly"
  shows "\<bar>coeff f i\<bar>\<^sup>2 \<le> \<parallel>f\<parallel>\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>coeff f i\<bar>\<^sup>2 \<le> \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
proof (induct f arbitrary: i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. \<bar>coeff 0 i\<bar>\<^sup>2 \<le> \<parallel>0\<parallel>\<^sup>2
 2. \<And>a f i. \<lbrakk>a \<noteq> (0::'a) \<or> f \<noteq> 0; \<And>i. \<bar>coeff f i\<bar>\<^sup>2 \<le> \<parallel>f\<parallel>\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2
[PROOF STEP]
case (pCons a f)
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'a) \<or> f \<noteq> 0
\<bar>coeff f ?i\<bar>\<^sup>2 \<le> \<parallel>f\<parallel>\<^sup>2

goal (2 subgoals):
 1. \<And>i. \<bar>coeff 0 i\<bar>\<^sup>2 \<le> \<parallel>0\<parallel>\<^sup>2
 2. \<And>a f i. \<lbrakk>a \<noteq> (0::'a) \<or> f \<noteq> 0; \<And>i. \<bar>coeff f i\<bar>\<^sup>2 \<le> \<parallel>f\<parallel>\<^sup>2\<rbrakk> \<Longrightarrow> \<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2
[PROOF STEP]
proof (cases i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = 0 \<Longrightarrow> \<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2
 2. \<And>nat. i = Suc nat \<Longrightarrow> \<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2
[PROOF STEP]
case (Suc ii)
[PROOF STATE]
proof (state)
this:
i = Suc ii

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> \<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2
 2. \<And>nat. i = Suc nat \<Longrightarrow> \<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2
[PROOF STEP]
note pCons(2)[of ii]
[PROOF STATE]
proof (state)
this:
\<bar>coeff f ii\<bar>\<^sup>2 \<le> \<parallel>f\<parallel>\<^sup>2

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> \<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2
 2. \<And>nat. i = Suc nat \<Longrightarrow> \<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>coeff f ii\<bar>\<^sup>2 \<le> \<parallel>f\<parallel>\<^sup>2

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> \<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2
 2. \<And>nat. i = Suc nat \<Longrightarrow> \<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2
[PROOF STEP]
have "\<parallel>f\<parallel>\<^sup>2 \<le> \<bar>a\<bar>\<^sup>2 + \<parallel>f\<parallel>\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>f\<parallel>\<^sup>2 \<le> \<bar>a\<bar>\<^sup>2 + \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<parallel>f\<parallel>\<^sup>2 \<le> \<bar>a\<bar>\<^sup>2 + \<parallel>f\<parallel>\<^sup>2

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> \<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2
 2. \<And>nat. i = Suc nat \<Longrightarrow> \<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>coeff f ii\<bar>\<^sup>2 \<le> \<bar>a\<bar>\<^sup>2 + \<parallel>f\<parallel>\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>coeff f ii\<bar>\<^sup>2 \<le> \<bar>a\<bar>\<^sup>2 + \<parallel>f\<parallel>\<^sup>2

goal (1 subgoal):
 1. \<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2
[PROOF STEP]
unfolding Suc
[PROOF STATE]
proof (prove)
using this:
\<bar>coeff f ii\<bar>\<^sup>2 \<le> \<bar>a\<bar>\<^sup>2 + \<parallel>f\<parallel>\<^sup>2

goal (1 subgoal):
 1. \<bar>coeff (pCons a f) (Suc ii)\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2

goal (1 subgoal):
 1. i = 0 \<Longrightarrow> \<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
\<bar>coeff (pCons a f) i\<bar>\<^sup>2 \<le> \<parallel>pCons a f\<parallel>\<^sup>2

goal (1 subgoal):
 1. \<And>i. \<bar>coeff 0 i\<bar>\<^sup>2 \<le> \<parallel>0\<parallel>\<^sup>2
[PROOF STEP]
qed simp


[STATEMENT]
lemma repeat_mset_not_empty: "n > 0 \<Longrightarrow> A \<noteq> {#} \<Longrightarrow> repeat_mset n A \<noteq> {#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; A \<noteq> {#}\<rbrakk> \<Longrightarrow> repeat_mset n A \<noteq> {#}
[PROOF STEP]
by (induction n) auto


[STATEMENT]
lemma complement_connected_components_of_Union:
   "C \<in> connected_components_of X
      \<Longrightarrow> topspace X - C = \<Union> (connected_components_of X - {C})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<in> connected_components_of X \<Longrightarrow> topspace X - C = \<Union> (connected_components_of X - {C})
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. C \<in> connected_components_of X \<Longrightarrow> topspace X - C \<subseteq> \<Union> (connected_components_of X - {C})
 2. C \<in> connected_components_of X \<Longrightarrow> \<Union> (connected_components_of X - {C}) \<subseteq> topspace X - C
[PROOF STEP]
using Union_connected_components_of
[PROOF STATE]
proof (prove)
using this:
\<Union> (connected_components_of ?X) = topspace ?X

goal (2 subgoals):
 1. C \<in> connected_components_of X \<Longrightarrow> topspace X - C \<subseteq> \<Union> (connected_components_of X - {C})
 2. C \<in> connected_components_of X \<Longrightarrow> \<Union> (connected_components_of X - {C}) \<subseteq> topspace X - C
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<in> connected_components_of X \<Longrightarrow> \<Union> (connected_components_of X - {C}) \<subseteq> topspace X - C
[PROOF STEP]
by (metis Diff_cancel Diff_subset Union_connected_components_of cSup_singleton diff_Union_pairwise_disjoint equalityE insert_subsetI pairwise_disjoint_connected_components_of)


[STATEMENT]
lemma deg_nzero_nzero:
  assumes deg_p_nzero: "deg R p \<noteq> 0"
  shows "p \<noteq> \<zero>\<^bsub>P\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> \<zero>\<^bsub>P\<^esub>
[PROOF STEP]
using deg_zero deg_p_nzero
[PROOF STATE]
proof (prove)
using this:
deg R \<zero>\<^bsub>P\<^esub> = 0
deg R p \<noteq> 0

goal (1 subgoal):
 1. p \<noteq> \<zero>\<^bsub>P\<^esub>
[PROOF STEP]
by auto


[STATEMENT]
lemma continuous_on_of_real_o_iff [simp]:
     "continuous_on S (\<lambda>x. complex_of_real (g x)) = continuous_on S g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on S (\<lambda>x. complex_of_real (g x)) = continuous_on S g
[PROOF STEP]
using continuous_on_Re continuous_on_of_real
[PROOF STATE]
proof (prove)
using this:
continuous_on ?s ?g \<Longrightarrow> continuous_on ?s (\<lambda>x. Re (?g x))
continuous_on ?s ?g \<Longrightarrow> continuous_on ?s (\<lambda>x. of_real (?g x))

goal (1 subgoal):
 1. continuous_on S (\<lambda>x. complex_of_real (g x)) = continuous_on S g
[PROOF STEP]
by fastforce


[STATEMENT]
lemma (in domain) properfactor_mult_imp_properfactor:
  "\<lbrakk> a \<in> carrier R; b \<in> carrier R \<rbrakk> \<Longrightarrow> properfactor (mult_of R) b a \<Longrightarrow> properfactor R b a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; b \<in> carrier R; properfactor (Ring_Divisibility.mult_of R) b a\<rbrakk> \<Longrightarrow> properfactor R b a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; b \<in> carrier R; properfactor (Ring_Divisibility.mult_of R) b a\<rbrakk> \<Longrightarrow> properfactor R b a
[PROOF STEP]
assume A: "a \<in> carrier R" "b \<in> carrier R" "properfactor (mult_of R) b a"
[PROOF STATE]
proof (state)
this:
a \<in> carrier R
b \<in> carrier R
properfactor (Ring_Divisibility.mult_of R) b a

goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; b \<in> carrier R; properfactor (Ring_Divisibility.mult_of R) b a\<rbrakk> \<Longrightarrow> properfactor R b a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> carrier R
b \<in> carrier R
properfactor (Ring_Divisibility.mult_of R) b a
[PROOF STEP]
obtain c where c: "c \<in> carrier (mult_of R)" "a = b \<otimes> c"
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
b \<in> carrier R
properfactor (Ring_Divisibility.mult_of R) b a

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<in> carrier (Ring_Divisibility.mult_of R); a = b \<otimes> c\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding properfactor_def factor_def
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
b \<in> carrier R
(\<exists>c\<in>carrier (Ring_Divisibility.mult_of R). a = b \<otimes>\<^bsub>Ring_Divisibility.mult_of R\<^esub> c) \<and> \<not> (\<exists>c\<in>carrier (Ring_Divisibility.mult_of R). b = a \<otimes>\<^bsub>Ring_Divisibility.mult_of R\<^esub> c)

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<in> carrier (Ring_Divisibility.mult_of R); a = b \<otimes> c\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c \<in> carrier (Ring_Divisibility.mult_of R)
a = b \<otimes> c

goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; b \<in> carrier R; properfactor (Ring_Divisibility.mult_of R) b a\<rbrakk> \<Longrightarrow> properfactor R b a
[PROOF STEP]
have "a \<noteq> \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> \<zero>
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> a \<noteq> \<zero> \<Longrightarrow> False
[PROOF STEP]
assume a: "\<not> a \<noteq> \<zero>"
[PROOF STATE]
proof (state)
this:
\<not> a \<noteq> \<zero>

goal (1 subgoal):
 1. \<not> a \<noteq> \<zero> \<Longrightarrow> False
[PROOF STEP]
hence "b = \<zero>"
[PROOF STATE]
proof (prove)
using this:
\<not> a \<noteq> \<zero>

goal (1 subgoal):
 1. b = \<zero>
[PROOF STEP]
using c A integral[of b c]
[PROOF STATE]
proof (prove)
using this:
\<not> a \<noteq> \<zero>
c \<in> carrier (Ring_Divisibility.mult_of R)
a = b \<otimes> c
a \<in> carrier R
b \<in> carrier R
properfactor (Ring_Divisibility.mult_of R) b a
\<lbrakk>b \<otimes> c = \<zero>; b \<in> carrier R; c \<in> carrier R\<rbrakk> \<Longrightarrow> b = \<zero> \<or> c = \<zero>

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

goal (1 subgoal):
 1. \<not> a \<noteq> \<zero> \<Longrightarrow> False
[PROOF STEP]
hence "b = a \<otimes> \<one>"
[PROOF STATE]
proof (prove)
using this:
b = \<zero>

goal (1 subgoal):
 1. b = a \<otimes> \<one>
[PROOF STEP]
using a A
[PROOF STATE]
proof (prove)
using this:
b = \<zero>
\<not> a \<noteq> \<zero>
a \<in> carrier R
b \<in> carrier R
properfactor (Ring_Divisibility.mult_of R) b a

goal (1 subgoal):
 1. b = a \<otimes> \<one>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b = a \<otimes> \<one>

goal (1 subgoal):
 1. \<not> a \<noteq> \<zero> \<Longrightarrow> False
[PROOF STEP]
hence "a divides\<^bsub>(mult_of R)\<^esub> b"
[PROOF STATE]
proof (prove)
using this:
b = a \<otimes> \<one>

goal (1 subgoal):
 1. a divides\<^bsub>Ring_Divisibility.mult_of R\<^esub> b
[PROOF STEP]
unfolding factor_def
[PROOF STATE]
proof (prove)
using this:
b = a \<otimes> \<one>

goal (1 subgoal):
 1. \<exists>c\<in>carrier (Ring_Divisibility.mult_of R). b = a \<otimes>\<^bsub>Ring_Divisibility.mult_of R\<^esub> c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a divides\<^bsub>Ring_Divisibility.mult_of R\<^esub> b

goal (1 subgoal):
 1. \<not> a \<noteq> \<zero> \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
a divides\<^bsub>Ring_Divisibility.mult_of R\<^esub> b

goal (1 subgoal):
 1. False
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
a divides\<^bsub>Ring_Divisibility.mult_of R\<^esub> b
a \<in> carrier R
b \<in> carrier R
properfactor (Ring_Divisibility.mult_of R) b a

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding properfactor_def
[PROOF STATE]
proof (prove)
using this:
a divides\<^bsub>Ring_Divisibility.mult_of R\<^esub> b
a \<in> carrier R
b \<in> carrier R
b divides\<^bsub>Ring_Divisibility.mult_of R\<^esub> a \<and> \<not> a divides\<^bsub>Ring_Divisibility.mult_of R\<^esub> b

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a \<noteq> \<zero>

goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; b \<in> carrier R; properfactor (Ring_Divisibility.mult_of R) b a\<rbrakk> \<Longrightarrow> properfactor R b a
[PROOF STEP]
hence "b \<noteq> \<zero>"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> \<zero>

goal (1 subgoal):
 1. b \<noteq> \<zero>
[PROOF STEP]
using c A integral_iff
[PROOF STATE]
proof (prove)
using this:
a \<noteq> \<zero>
c \<in> carrier (Ring_Divisibility.mult_of R)
a = b \<otimes> c
a \<in> carrier R
b \<in> carrier R
properfactor (Ring_Divisibility.mult_of R) b a
\<lbrakk>?a \<in> carrier R; ?b \<in> carrier R\<rbrakk> \<Longrightarrow> (?a \<otimes> ?b = \<zero>) = (?a = \<zero> \<or> ?b = \<zero>)

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

goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; b \<in> carrier R; properfactor (Ring_Divisibility.mult_of R) b a\<rbrakk> \<Longrightarrow> properfactor R b a
[PROOF STEP]
thus "properfactor R b a"
[PROOF STATE]
proof (prove)
using this:
b \<noteq> \<zero>

goal (1 subgoal):
 1. properfactor R b a
[PROOF STEP]
using A divides_imp_divides_mult[of a b]
[PROOF STATE]
proof (prove)
using this:
b \<noteq> \<zero>
a \<in> carrier R
b \<in> carrier R
properfactor (Ring_Divisibility.mult_of R) b a
\<lbrakk>a \<in> carrier R; b \<in> carrier R - {\<zero>}; a divides b\<rbrakk> \<Longrightarrow> a divides\<^bsub>Ring_Divisibility.mult_of R\<^esub> b

goal (1 subgoal):
 1. properfactor R b a
[PROOF STEP]
unfolding properfactor_def
[PROOF STATE]
proof (prove)
using this:
b \<noteq> \<zero>
a \<in> carrier R
b \<in> carrier R
b divides\<^bsub>Ring_Divisibility.mult_of R\<^esub> a \<and> \<not> a divides\<^bsub>Ring_Divisibility.mult_of R\<^esub> b
\<lbrakk>a \<in> carrier R; b \<in> carrier R - {\<zero>}; a divides b\<rbrakk> \<Longrightarrow> a divides\<^bsub>Ring_Divisibility.mult_of R\<^esub> b

goal (1 subgoal):
 1. b divides a \<and> \<not> a divides b
[PROOF STEP]
by (meson DiffI divides_mult_imp_divides empty_iff insert_iff)
[PROOF STATE]
proof (state)
this:
properfactor R b a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matricize_add:
assumes "dims A = dims B"
shows "matricize I A + matricize I B = matricize I (A+B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matricize I A + matricize I B = matricize I (A + B)
[PROOF STEP]
proof (rule eq_matI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (matricize I (A + B)); j < dim_col (matricize I (A + B))\<rbrakk> \<Longrightarrow> (matricize I A + matricize I B) $$ (i, j) = matricize I (A + B) $$ (i, j)
 2. dim_row (matricize I A + matricize I B) = dim_row (matricize I (A + B))
 3. dim_col (matricize I A + matricize I B) = dim_col (matricize I (A + B))
[PROOF STEP]
show "dim_row (matricize I A + matricize I B) = dim_row (matricize I (A + B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (matricize I A + matricize I B) = dim_row (matricize I (A + B))
[PROOF STEP]
by (simp add: assms dims_matricize(1))
[PROOF STATE]
proof (state)
this:
dim_row (matricize I A + matricize I B) = dim_row (matricize I (A + B))

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (matricize I (A + B)); j < dim_col (matricize I (A + B))\<rbrakk> \<Longrightarrow> (matricize I A + matricize I B) $$ (i, j) = matricize I (A + B) $$ (i, j)
 2. dim_col (matricize I A + matricize I B) = dim_col (matricize I (A + B))
[PROOF STEP]
show "dim_col (matricize I A + matricize I B) = dim_col (matricize I (A + B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (matricize I A + matricize I B) = dim_col (matricize I (A + B))
[PROOF STEP]
by (simp add: assms dims_matricize(2))
[PROOF STATE]
proof (state)
this:
dim_col (matricize I A + matricize I B) = dim_col (matricize I (A + B))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (matricize I (A + B)); j < dim_col (matricize I (A + B))\<rbrakk> \<Longrightarrow> (matricize I A + matricize I B) $$ (i, j) = matricize I (A + B) $$ (i, j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (matricize I (A + B)); j < dim_col (matricize I (A + B))\<rbrakk> \<Longrightarrow> (matricize I A + matricize I B) $$ (i, j) = matricize I (A + B) $$ (i, j)
[PROOF STEP]
assume ij_le1:"i < dim_row (matricize I (A + B))" "j < dim_col (matricize I (A + B))"
[PROOF STATE]
proof (state)
this:
i < dim_row (matricize I (A + B))
j < dim_col (matricize I (A + B))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (matricize I (A + B)); j < dim_col (matricize I (A + B))\<rbrakk> \<Longrightarrow> (matricize I A + matricize I B) $$ (i, j) = matricize I (A + B) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < dim_row (matricize I (A + B))
j < dim_col (matricize I (A + B))
[PROOF STEP]
have
    ij_le2:"i < prod_list (nths (Tensor.dims A) I)"  "j < prod_list (nths (Tensor.dims A) (-I))" and
    ij_le3:"i < prod_list (nths (Tensor.dims B) I)"  "j < prod_list (nths (Tensor.dims B) (-I))" and
    ij_le4:"i < prod_list (nths (Tensor.dims (A + B)) I)"  "j < prod_list (nths (Tensor.dims (A + B)) (-I))"
[PROOF STATE]
proof (prove)
using this:
i < dim_row (matricize I (A + B))
j < dim_col (matricize I (A + B))

goal (1 subgoal):
 1. (i < prod_list (nths (dims A) I) &&& j < prod_list (nths (dims A) (- I))) &&& (i < prod_list (nths (dims B) I) &&& j < prod_list (nths (dims B) (- I))) &&& i < prod_list (nths (dims (A + B)) I) &&& j < prod_list (nths (dims (A + B)) (- I))
[PROOF STEP]
by (simp_all add: assms dims_matricize)
[PROOF STATE]
proof (state)
this:
i < prod_list (nths (dims A) I)
j < prod_list (nths (dims A) (- I))
i < prod_list (nths (dims B) I)
j < prod_list (nths (dims B) (- I))
i < prod_list (nths (dims (A + B)) I)
j < prod_list (nths (dims (A + B)) (- I))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (matricize I (A + B)); j < dim_col (matricize I (A + B))\<rbrakk> \<Longrightarrow> (matricize I A + matricize I B) $$ (i, j) = matricize I (A + B) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < prod_list (nths (dims A) I)
j < prod_list (nths (dims A) (- I))
i < prod_list (nths (dims B) I)
j < prod_list (nths (dims B) (- I))
i < prod_list (nths (dims (A + B)) I)
j < prod_list (nths (dims (A + B)) (- I))
[PROOF STEP]
have ij_le5:"i < dim_row (matricize I B)" "j < dim_col (matricize I B)"
[PROOF STATE]
proof (prove)
using this:
i < prod_list (nths (dims A) I)
j < prod_list (nths (dims A) (- I))
i < prod_list (nths (dims B) I)
j < prod_list (nths (dims B) (- I))
i < prod_list (nths (dims (A + B)) I)
j < prod_list (nths (dims (A + B)) (- I))

goal (1 subgoal):
 1. i < dim_row (matricize I B) &&& j < dim_col (matricize I B)
[PROOF STEP]
by (simp_all add: assms dims_matricize)
[PROOF STATE]
proof (state)
this:
i < dim_row (matricize I B)
j < dim_col (matricize I B)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (matricize I (A + B)); j < dim_col (matricize I (A + B))\<rbrakk> \<Longrightarrow> (matricize I A + matricize I B) $$ (i, j) = matricize I (A + B) $$ (i, j)
[PROOF STEP]
show "(matricize I A + matricize I B) $$ (i, j) = matricize I (A + B) $$ (i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (matricize I A + matricize I B) $$ (i, j) = matricize I (A + B) $$ (i, j)
[PROOF STEP]
unfolding index_add_mat(1)[OF ij_le5]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matricize I A $$ (i, j) + matricize I B $$ (i, j) = matricize I (A + B) $$ (i, j)
[PROOF STEP]
unfolding matricize_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (prod_list (nths (dims A) I)) (prod_list (nths (dims A) (- I))) (\<lambda>(r, c). lookup A (weave I (digit_encode (nths (dims A) I) r) (digit_encode (nths (dims A) (- I)) c))) $$ (i, j) + mat (prod_list (nths (dims B) I)) (prod_list (nths (dims B) (- I))) (\<lambda>(r, c). lookup B (weave I (digit_encode (nths (dims B) I) r) (digit_encode (nths (dims B) (- I)) c))) $$ (i, j) = mat (prod_list (nths (dims (A + B)) I)) (prod_list (nths (dims (A + B)) (- I))) (\<lambda>(r, c). lookup (A + B) (weave I (digit_encode (nths (dims (A + B)) I) r) (digit_encode (nths (dims (A + B)) (- I)) c))) $$ (i, j)
[PROOF STEP]
unfolding index_mat[OF ij_le2] index_mat[OF ij_le3] index_mat[OF ij_le4]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case (i, j) of (r, c) \<Rightarrow> lookup A (weave I (digit_encode (nths (dims A) I) r) (digit_encode (nths (dims A) (- I)) c))) + (case (i, j) of (r, c) \<Rightarrow> lookup B (weave I (digit_encode (nths (dims B) I) r) (digit_encode (nths (dims B) (- I)) c))) = (case (i, j) of (r, c) \<Rightarrow> lookup (A + B) (weave I (digit_encode (nths (dims (A + B)) I) r) (digit_encode (nths (dims (A + B)) (- I)) c)))
[PROOF STEP]
using assms digit_encode_valid_index ij_le2(1) ij_le2(2) valid_index_weave(1)
[PROOF STATE]
proof (prove)
using this:
dims A = dims B
?a < prod_list ?ds \<Longrightarrow> digit_encode ?ds ?a \<lhd> ?ds
i < prod_list (nths (dims A) I)
j < prod_list (nths (dims A) (- I))
\<lbrakk>?is1.0 \<lhd> nths ?ds ?A; ?is2.0 \<lhd> nths ?ds (- ?A)\<rbrakk> \<Longrightarrow> weave ?A ?is1.0 ?is2.0 \<lhd> ?ds

goal (1 subgoal):
 1. (case (i, j) of (r, c) \<Rightarrow> lookup A (weave I (digit_encode (nths (dims A) I) r) (digit_encode (nths (dims A) (- I)) c))) + (case (i, j) of (r, c) \<Rightarrow> lookup B (weave I (digit_encode (nths (dims B) I) r) (digit_encode (nths (dims B) (- I)) c))) = (case (i, j) of (r, c) \<Rightarrow> lookup (A + B) (weave I (digit_encode (nths (dims (A + B)) I) r) (digit_encode (nths (dims (A + B)) (- I)) c)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(matricize I A + matricize I B) $$ (i, j) = matricize I (A + B) $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma decr_grading_term_le: "hom_grading d \<Longrightarrow> d (pp_of_term (decr_grading_term d n v)) \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_grading d \<Longrightarrow> d (pp_of_term (decr_grading_term d n v)) \<le> n
[PROOF STEP]
by (simp add: decr_grading_term_def term_simps decr_grading_le)


[STATEMENT]
lemma flatten_minus: "flatten (p - q) = flatten p - flatten (q::_ \<Rightarrow>\<^sub>0 _ \<Rightarrow>\<^sub>0 _::ring)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. flatten (p - q) = flatten p - flatten q
[PROOF STEP]
by (simp only: diff_conv_add_uminus flatten_plus flatten_uminus)


[STATEMENT]
lemma sur_map_epimorph: "\<lbrakk>is_sur x; is_map x\<rbrakk> \<Longrightarrow> (\<forall>y z. x ; y = x ; z \<longrightarrow> y = z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_sur x; is_map x\<rbrakk> \<Longrightarrow> \<forall>y z. x ; y = x ; z \<longrightarrow> y = z
[PROOF STEP]
by (metis order.eq_iff mult.assoc mult.left_neutral ss423 is_sur_def)


[STATEMENT]
lemma ins_list_length[simp]:
  assumes "sorted_less ks"
  shows "length (ins_list k ks) = length ks + (if k \<in> set ks then 0 else 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (ins_list k ks) = length ks + (if k \<in> set ks then 0 else 1)
[PROOF STEP]
using insert_list_length[of ks ins_list k]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>sorted_less ks; set (ins_list k ks) = set ks \<union> {k}; sorted_less ks \<Longrightarrow> sorted_less (ins_list k ks)\<rbrakk> \<Longrightarrow> length (ins_list k ks) = length ks + (if k \<in> set ks then 0 else 1)

goal (1 subgoal):
 1. length (ins_list k ks) = length ks + (if k \<in> set ks then 0 else 1)
[PROOF STEP]
by (simp add: assms set_ins_list sorted_ins_list)


[STATEMENT]
lemma rel_list_all2_Cons [iff]:
  "list_all2 (fun_of S) (x#xs) (y#ys) =
   ((x,y) \<in> S \<and> list_all2 (fun_of S) xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 (fun_of S) (x # xs) (y # ys) = ((x, y) \<in> S \<and> list_all2 (fun_of S) xs ys)
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 (fun_of S) (x # xs) (y # ys) = ((x, y) \<in> S \<and> list_all2 (fun_of S) xs ys)
[PROOF STEP]
by simp


[STATEMENT]
lemma summable_comparison_test_bigo:
  fixes f :: "nat \<Rightarrow> real"
  assumes "summable (\<lambda>n. norm (g n))" "f \<in> O(g)"
  shows   "summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable f
[PROOF STEP]
from \<open>f \<in> O(g)\<close>
[PROOF STATE]
proof (chain)
picking this:
f \<in> O(g)
[PROOF STEP]
obtain C where C: "eventually (\<lambda>x. norm (f x) \<le> C * norm (g x)) at_top"
[PROOF STATE]
proof (prove)
using this:
f \<in> O(g)

goal (1 subgoal):
 1. (\<And>C. \<forall>\<^sub>F x in sequentially. norm (f x) \<le> C * norm (g x) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim: landau_o.bigE)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in sequentially. norm (f x) \<le> C * norm (g x)

goal (1 subgoal):
 1. summable f
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in sequentially. norm (f x) \<le> C * norm (g x)

goal (1 subgoal):
 1. summable f
[PROOF STEP]
by (rule summable_comparison_test_ev) (insert assms, auto intro: summable_mult)
[PROOF STATE]
proof (state)
this:
summable f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pop_aux: "\<lbrakk> k<i\<^sub>0; i\<^sub>0<length xs; left_spec i\<^sub>0 \<le> Some k \<rbrakk> \<Longrightarrow> pop (k # der_stack k) (xs!i\<^sub>0) = der_stack i\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k < i\<^sub>0; i\<^sub>0 < length xs; local.left_spec i\<^sub>0 \<le> Some k\<rbrakk> \<Longrightarrow> local.pop (k # local.der_stack k) (xs ! i\<^sub>0) = local.der_stack i\<^sub>0
[PROOF STEP]
apply (induction k rule: nat_less_induct)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<forall>m<n. m < i\<^sub>0 \<longrightarrow> i\<^sub>0 < length xs \<longrightarrow> local.left_spec i\<^sub>0 \<le> Some m \<longrightarrow> local.pop (m # local.der_stack m) (xs ! i\<^sub>0) = local.der_stack i\<^sub>0; n < i\<^sub>0; i\<^sub>0 < length xs; local.left_spec i\<^sub>0 \<le> Some n\<rbrakk> \<Longrightarrow> local.pop (n # local.der_stack n) (xs ! i\<^sub>0) = local.der_stack i\<^sub>0
[PROOF STEP]
apply (clarsimp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<forall>m<n. local.left_spec i\<^sub>0 \<le> Some m \<longrightarrow> local.pop (m # local.der_stack m) (xs ! i\<^sub>0) = local.der_stack i\<^sub>0; n < i\<^sub>0; i\<^sub>0 < length xs; local.left_spec i\<^sub>0 \<le> Some n\<rbrakk> \<Longrightarrow> local.pop (n # local.der_stack n) (xs ! i\<^sub>0) = local.der_stack i\<^sub>0
[PROOF STEP]
by (smt der_stack.simps left_alt pop_def the_leftI dropWhile.simps(1) find_left_rl leD less_option_None_Some option.inject pop_cons)


[STATEMENT]
lemma lcm_mult_left: "lcm (c * a) (c * b) = normalize (c * lcm a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcm (c * a) (c * b) = normalize (c * lcm a b)
[PROOF STEP]
proof (cases "c = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c = (0::'a) \<Longrightarrow> lcm (c * a) (c * b) = normalize (c * lcm a b)
 2. c \<noteq> (0::'a) \<Longrightarrow> lcm (c * a) (c * b) = normalize (c * lcm a b)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
c = (0::'a)

goal (2 subgoals):
 1. c = (0::'a) \<Longrightarrow> lcm (c * a) (c * b) = normalize (c * lcm a b)
 2. c \<noteq> (0::'a) \<Longrightarrow> lcm (c * a) (c * b) = normalize (c * lcm a b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c = (0::'a)

goal (1 subgoal):
 1. lcm (c * a) (c * b) = normalize (c * lcm a b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lcm (c * a) (c * b) = normalize (c * lcm a b)

goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> lcm (c * a) (c * b) = normalize (c * lcm a b)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> lcm (c * a) (c * b) = normalize (c * lcm a b)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
c \<noteq> (0::'a)

goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> lcm (c * a) (c * b) = normalize (c * lcm a b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> (0::'a)
[PROOF STEP]
have *: "lcm (c * a) (c * b) dvd c * lcm a b"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)

goal (1 subgoal):
 1. lcm (c * a) (c * b) dvd c * lcm a b
[PROOF STEP]
by (auto intro: lcm_least)
[PROOF STATE]
proof (state)
this:
lcm (c * a) (c * b) dvd c * lcm a b

goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> lcm (c * a) (c * b) = normalize (c * lcm a b)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
lcm (c * a) (c * b) dvd c * lcm a b

goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> lcm (c * a) (c * b) = normalize (c * lcm a b)
[PROOF STEP]
have "lcm a b dvd lcm (c * a) (c * b) div c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcm a b dvd lcm (c * a) (c * b) div c
[PROOF STEP]
by (intro lcm_least) (auto intro!: dvd_mult_imp_div simp: mult_ac)
[PROOF STATE]
proof (state)
this:
lcm a b dvd lcm (c * a) (c * b) div c

goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> lcm (c * a) (c * b) = normalize (c * lcm a b)
[PROOF STEP]
hence "c * lcm a b dvd lcm (c * a) (c * b)"
[PROOF STATE]
proof (prove)
using this:
lcm a b dvd lcm (c * a) (c * b) div c

goal (1 subgoal):
 1. c * lcm a b dvd lcm (c * a) (c * b)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
lcm a b dvd lcm (c * a) (c * b) div c
c \<noteq> (0::'a)

goal (1 subgoal):
 1. c * lcm a b dvd lcm (c * a) (c * b)
[PROOF STEP]
by (subst (asm) dvd_div_iff_mult) (auto simp: mult_ac intro: dvd_lcmI1)
[PROOF STATE]
proof (state)
this:
c * lcm a b dvd lcm (c * a) (c * b)

goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> lcm (c * a) (c * b) = normalize (c * lcm a b)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
lcm (c * a) (c * b) dvd c * lcm a b
c * lcm a b dvd lcm (c * a) (c * b)
[PROOF STEP]
have "normalize (lcm (c * a) (c * b)) = normalize (c * lcm a b)"
[PROOF STATE]
proof (prove)
using this:
lcm (c * a) (c * b) dvd c * lcm a b
c * lcm a b dvd lcm (c * a) (c * b)

goal (1 subgoal):
 1. normalize (lcm (c * a) (c * b)) = normalize (c * lcm a b)
[PROOF STEP]
by (auto intro: associated_eqI)
[PROOF STATE]
proof (state)
this:
normalize (lcm (c * a) (c * b)) = normalize (c * lcm a b)

goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> lcm (c * a) (c * b) = normalize (c * lcm a b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
normalize (lcm (c * a) (c * b)) = normalize (c * lcm a b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
normalize (lcm (c * a) (c * b)) = normalize (c * lcm a b)

goal (1 subgoal):
 1. lcm (c * a) (c * b) = normalize (c * lcm a b)
[PROOF STEP]
by (simp add: normalize_mult)
[PROOF STATE]
proof (state)
this:
lcm (c * a) (c * b) = normalize (c * lcm a b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eval_Carmichael:
  assumes "prime_factorization n = A"
  shows     "Carmichael n = (LCM p \<in> set_mset A.
               let k = count A p in if p = 2 \<and> k > 2 then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Carmichael n = (LCM p\<in>set_mset A. let k = count A p in if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))
[PROOF STEP]
unfolding assms [symmetric] Carmichael_closed_formula
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LCM p\<in>prime_factors n. let k = multiplicity p n in if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1)) = (LCM p\<in>prime_factors n. let k = count (prime_factorization n) p in if p = 2 \<and> 2 < k then 2 ^ (k - 2) else p ^ (k - 1) * (p - 1))
[PROOF STEP]
by (intro arg_cong[where f = Lcm] image_cong) (auto simp: Let_def count_prime_factorization)


[STATEMENT]
lemma ucast_down_mult:
    "is_down (ucast:: 'a word \<Rightarrow> 'b word) \<Longrightarrow>  ucast ((a :: 'a::len word) * b) = (ucast a * ucast b :: 'b::len word)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_down UCAST('a \<rightarrow> 'b) \<Longrightarrow> UCAST('a \<rightarrow> 'b) (a * b) = UCAST('a \<rightarrow> 'b) a * UCAST('a \<rightarrow> 'b) b
[PROOF STEP]
apply (rule ucast_distrib [where L="(*)"], (clarsimp simp: uint_word_ariths)+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. is_down UCAST('a \<rightarrow> 'b) \<Longrightarrow> x mod 2 ^ LENGTH('b) * (y mod 2 ^ LENGTH('b)) mod 2 ^ LENGTH('b) = x * y mod 2 ^ LENGTH('b)
 2. is_down UCAST('a \<rightarrow> 'b) \<Longrightarrow> is_down UCAST('a \<rightarrow> 'b)
[PROOF STEP]
apply (metis mod_mult_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_down UCAST('a \<rightarrow> 'b) \<Longrightarrow> is_down UCAST('a \<rightarrow> 'b)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in finite_measure)  count_prod:
  fixes Y::"'a\<Rightarrow>'b"
  assumes "B\<subseteq> space N"
  and "point_measurable M (space N) Y"
  and "integrable M X"
  and "\<forall> w \<in> space M. 0 \<le> X w"
shows "\<forall>i. integral\<^sup>L M (\<lambda>y. (X y) * (indicator (countable_preimages B Y i \<inter> space M)) y) =
  integral\<^sup>L M (\<lambda>y. (expl_cond_expect M Y X y) * (indicator (countable_preimages B Y i \<inter> space M)) y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
show "integral\<^sup>L M (\<lambda>y. X y * indicator (countable_preimages B Y i \<inter> space M) y) =
         integral\<^sup>L M (\<lambda>y. expl_cond_expect M Y X y * indicator (countable_preimages B Y i \<inter> space M) y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
proof (cases "countable_preimages B Y i \<inter> space M = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. countable_preimages B Y i \<inter> space M = {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
 2. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
countable_preimages B Y i \<inter> space M = {}

goal (2 subgoals):
 1. countable_preimages B Y i \<inter> space M = {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
 2. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
countable_preimages B Y i \<inter> space M = {}

goal (1 subgoal):
 1. LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y

goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
countable_preimages B Y i \<inter> space M \<noteq> {}

goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
countable_preimages B Y i \<inter> space M \<noteq> {}
[PROOF STEP]
obtain w where "w\<in> countable_preimages B Y i"
[PROOF STATE]
proof (prove)
using this:
countable_preimages B Y i \<inter> space M \<noteq> {}

goal (1 subgoal):
 1. (\<And>w. w \<in> countable_preimages B Y i \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w \<in> countable_preimages B Y i

goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
hence "Y w = (from_nat_into B) i"
[PROOF STATE]
proof (prove)
using this:
w \<in> countable_preimages B Y i

goal (1 subgoal):
 1. Y w = from_nat_into B i
[PROOF STEP]
by (meson count_pre_img)
[PROOF STATE]
proof (state)
this:
Y w = from_nat_into B i

goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
hence "Y w \<in> B"
[PROOF STATE]
proof (prove)
using this:
Y w = from_nat_into B i

goal (1 subgoal):
 1. Y w \<in> B
[PROOF STEP]
proof (cases "infinite B")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>Y w = from_nat_into B i; infinite B\<rbrakk> \<Longrightarrow> Y w \<in> B
 2. \<lbrakk>Y w = from_nat_into B i; \<not> infinite B\<rbrakk> \<Longrightarrow> Y w \<in> B
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
infinite B

goal (2 subgoals):
 1. \<lbrakk>Y w = from_nat_into B i; infinite B\<rbrakk> \<Longrightarrow> Y w \<in> B
 2. \<lbrakk>Y w = from_nat_into B i; \<not> infinite B\<rbrakk> \<Longrightarrow> Y w \<in> B
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite B

goal (1 subgoal):
 1. Y w \<in> B
[PROOF STEP]
by (simp add: \<open>Y w = from_nat_into B i\<close> from_nat_into infinite_imp_nonempty)
[PROOF STATE]
proof (state)
this:
Y w \<in> B

goal (1 subgoal):
 1. \<lbrakk>Y w = from_nat_into B i; \<not> infinite B\<rbrakk> \<Longrightarrow> Y w \<in> B
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>Y w = from_nat_into B i; \<not> infinite B\<rbrakk> \<Longrightarrow> Y w \<in> B
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> infinite B

goal (1 subgoal):
 1. \<lbrakk>Y w = from_nat_into B i; \<not> infinite B\<rbrakk> \<Longrightarrow> Y w \<in> B
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> infinite B

goal (1 subgoal):
 1. Y w \<in> B
[PROOF STEP]
by (metis Finite_Set.card_0_eq \<open>Y w = from_nat_into B i\<close> \<open>w \<in> countable_preimages B Y i\<close> countable_preimages_def equals0D from_nat_into gr_implies_not0)
[PROOF STATE]
proof (state)
this:
Y w \<in> B

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

goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
let ?ind = "(indicator (Y -` {Y w} \<inter> space M))::'a\<Rightarrow>real"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
have "integral\<^sup>L M (\<lambda>y. (X y) * (indicator (countable_preimages B Y i \<inter> space M)) y) = integral\<^sup>L M (\<lambda>y. X y * ?ind y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
by (metis (no_types, opaque_lifting) \<open>Y w = from_nat_into B i\<close> \<open>\<And>thesis. (\<And>w. w \<in> countable_preimages B Y i \<Longrightarrow> thesis) \<Longrightarrow> thesis\<close> countable_preimages_def empty_iff)
[PROOF STATE]
proof (state)
this:
LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. X y * indicat_real (Y -` {Y w} \<inter> space M) y

goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. X y * indicat_real (Y -` {Y w} \<inter> space M) y

goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
have "... =
      expl_cond_expect M Y X w * measure M (Y -` {Y w} \<inter> space M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT y|M. X y * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X w * Sigma_Algebra.measure M (Y -` {Y w} \<inter> space M)
[PROOF STEP]
using dce_prod[of N Y X]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>point_measurable M (space N) Y; integrable M X; \<forall>w\<in>space M. 0 \<le> X w\<rbrakk> \<Longrightarrow> \<forall>w. Y w \<in> space N \<longrightarrow> expl_cond_expect M Y X w * Sigma_Algebra.measure M (Y -` {Y w} \<inter> space M) = LINT y|M. X y * indicat_real (Y -` {Y w} \<inter> space M) y

goal (1 subgoal):
 1. LINT y|M. X y * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X w * Sigma_Algebra.measure M (Y -` {Y w} \<inter> space M)
[PROOF STEP]
by (metis (no_types, lifting) \<open>Y w \<in> B\<close> assms subsetCE)
[PROOF STATE]
proof (state)
this:
LINT y|M. X y * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X w * Sigma_Algebra.measure M (Y -` {Y w} \<inter> space M)

goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
LINT y|M. X y * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X w * Sigma_Algebra.measure M (Y -` {Y w} \<inter> space M)

goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
have "... = expl_cond_expect M Y X w * (integral\<^sup>L M ?ind)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expl_cond_expect M Y X w * Sigma_Algebra.measure M (Y -` {Y w} \<inter> space M) = expl_cond_expect M Y X w * integral\<^sup>L M (indicat_real (Y -` {Y w} \<inter> space M))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
expl_cond_expect M Y X w * Sigma_Algebra.measure M (Y -` {Y w} \<inter> space M) = expl_cond_expect M Y X w * integral\<^sup>L M (indicat_real (Y -` {Y w} \<inter> space M))

goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
expl_cond_expect M Y X w * Sigma_Algebra.measure M (Y -` {Y w} \<inter> space M) = expl_cond_expect M Y X w * integral\<^sup>L M (indicat_real (Y -` {Y w} \<inter> space M))

goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
have "... = integral\<^sup>L M (\<lambda>y. expl_cond_expect M Y X w * ?ind y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expl_cond_expect M Y X w * integral\<^sup>L M (indicat_real (Y -` {Y w} \<inter> space M)) = LINT y|M. expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
expl_cond_expect M Y X w * integral\<^sup>L M (indicat_real (Y -` {Y w} \<inter> space M)) = LINT y|M. expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y

goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
expl_cond_expect M Y X w * integral\<^sup>L M (indicat_real (Y -` {Y w} \<inter> space M)) = LINT y|M. expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y

goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
have "... = integral\<^sup>L M (\<lambda>y. expl_cond_expect M Y X y * ?ind y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT y|M. expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. LINT y|M. expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
have "\<forall> y\<in> space M. expl_cond_expect M Y X w * ?ind y = expl_cond_expect M Y X y * ?ind y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y\<in>space M. expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. y \<in> space M \<Longrightarrow> expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. y \<in> space M \<Longrightarrow> expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
assume "y\<in> space M"
[PROOF STATE]
proof (state)
this:
y \<in> space M

goal (1 subgoal):
 1. \<And>y. y \<in> space M \<Longrightarrow> expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
show "expl_cond_expect M Y X w * ?ind y = expl_cond_expect M Y X y * ?ind y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
proof (cases "y\<in> Y -` {Y w} \<inter> space M")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. y \<in> Y -` {Y w} \<inter> space M \<Longrightarrow> expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
 2. y \<notin> Y -` {Y w} \<inter> space M \<Longrightarrow> expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
y \<notin> Y -` {Y w} \<inter> space M

goal (2 subgoals):
 1. y \<in> Y -` {Y w} \<inter> space M \<Longrightarrow> expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
 2. y \<notin> Y -` {Y w} \<inter> space M \<Longrightarrow> expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
y \<notin> Y -` {Y w} \<inter> space M

goal (1 subgoal):
 1. expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y

goal (1 subgoal):
 1. y \<in> Y -` {Y w} \<inter> space M \<Longrightarrow> expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<in> Y -` {Y w} \<inter> space M \<Longrightarrow> expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
y \<in> Y -` {Y w} \<inter> space M

goal (1 subgoal):
 1. y \<in> Y -` {Y w} \<inter> space M \<Longrightarrow> expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
hence "Y w = Y y"
[PROOF STATE]
proof (prove)
using this:
y \<in> Y -` {Y w} \<inter> space M

goal (1 subgoal):
 1. Y w = Y y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Y w = Y y

goal (1 subgoal):
 1. y \<in> Y -` {Y w} \<inter> space M \<Longrightarrow> expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
hence "expl_cond_expect M Y X w = expl_cond_expect M Y X y"
[PROOF STATE]
proof (prove)
using this:
Y w = Y y

goal (1 subgoal):
 1. expl_cond_expect M Y X w = expl_cond_expect M Y X y
[PROOF STEP]
using expl_cond_expect_const[of Y]
[PROOF STATE]
proof (prove)
using this:
Y w = Y y
Y ?w = Y ?y \<Longrightarrow> expl_cond_expect ?M Y ?X ?w = expl_cond_expect ?M Y ?X ?y

goal (1 subgoal):
 1. expl_cond_expect M Y X w = expl_cond_expect M Y X y
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
expl_cond_expect M Y X w = expl_cond_expect M Y X y

goal (1 subgoal):
 1. y \<in> Y -` {Y w} \<inter> space M \<Longrightarrow> expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
expl_cond_expect M Y X w = expl_cond_expect M Y X y

goal (1 subgoal):
 1. expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>y\<in>space M. expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y

goal (1 subgoal):
 1. LINT y|M. expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>y\<in>space M. expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y

goal (1 subgoal):
 1. LINT y|M. expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y
[PROOF STEP]
by (meson Bochner_Integration.integral_cong)
[PROOF STATE]
proof (state)
this:
LINT y|M. expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
LINT y|M. expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y

goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
LINT y|M. expl_cond_expect M Y X w * indicat_real (Y -` {Y w} \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y

goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
have "... = integral\<^sup>L M (\<lambda>y. expl_cond_expect M Y X y * indicator (countable_preimages B Y i \<inter> space M) y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT y|M. expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
by (metis (no_types, opaque_lifting) \<open>Y w = from_nat_into B i\<close> \<open>\<And>thesis. (\<And>w. w \<in> countable_preimages B Y i \<Longrightarrow> thesis) \<Longrightarrow> thesis\<close> countable_preimages_def empty_iff)
[PROOF STATE]
proof (state)
this:
LINT y|M. expl_cond_expect M Y X y * indicat_real (Y -` {Y w} \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y

goal (1 subgoal):
 1. countable_preimages B Y i \<inter> space M \<noteq> {} \<Longrightarrow> LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y

goal (1 subgoal):
 1. LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
LINT y|M. X y * indicat_real (countable_preimages B Y i \<inter> space M) y = LINT y|M. expl_cond_expect M Y X y * indicat_real (countable_preimages B Y i \<inter> space M) y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "((x::real) \<le> y \<and> y \<le> x) = (x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<le> y \<and> y \<le> x) = (x = y)
[PROOF STEP]
by arith


[STATEMENT]
lemma fold_matches_last_step_not_None:
  assumes
    "length xs = length ys"
    "fold (\<lambda>(T, U) subs . Option.bind subs (f T U)) (zip (xs@[x]) (ys@[y])) (Some subs) = Some subs'"
  obtains point where
    "fold (\<lambda>(T, U) subs . Option.bind subs (f T U)) (zip (xs) (ys)) (Some subs) = Some point"
    "f x y point = Some subs'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>point. \<lbrakk>fold (\<lambda>(T, U) subs. Option.bind subs (f T U)) (zip xs ys) (Some subs) = Some point; f x y point = Some subs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms fold_Option_bind_eq_Some_at_each_point_Some'[where xs="zip xs ys" and ys="[(x,y)]"
      and start="Some subs" and res="subs'" and f="f"]
[PROOF STATE]
proof (prove)
using this:
length xs = length ys
fold (\<lambda>(T, U) subs. Option.bind subs (f T U)) (zip (xs @ [x]) (ys @ [y])) (Some subs) = Some subs'
\<lbrakk>fold (\<lambda>(x, y) option. Option.bind option (f x y)) (zip xs ys @ [(x, y)]) (Some subs) = Some subs'; \<And>point. \<lbrakk>fold (\<lambda>(x, y) option. Option.bind option (f x y)) (zip xs ys) (Some subs) = Some point; fold (\<lambda>(x, y) option. Option.bind option (f x y)) [(x, y)] (Some point) = Some subs'\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>point. \<lbrakk>fold (\<lambda>(T, U) subs. Option.bind subs (f T U)) (zip xs ys) (Some subs) = Some point; f x y point = Some subs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto


[STATEMENT]
theorem sup_state_length [simp]:
  "G \<turnstile> s2 <=s s1 \<Longrightarrow>
   length (fst s2) = length (fst s1) \<and> length (snd s2) = length (snd s1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G \<turnstile> s2 <=s s1 \<Longrightarrow> length (fst s2) = length (fst s1) \<and> length (snd s2) = length (snd s1)
[PROOF STEP]
by (auto dest: sup_loc_length simp add: sup_state_def stk_convert lesub_def Product.le_def)