[STATEMENT]
lemma (in edge_space) mean_k_cycles:
  assumes "3 \<le> k" "k < n"
  shows "(\<integral>es. card {c \<in> ucycles (edge_ugraph es). uwalk_length c = k} \<partial> P)
    = of_nat (fact n div fact (n - k)) * p ^ k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
let ?k_cycle = "\<lambda>es c k. c \<in> ucycles (edge_ugraph es) \<and> uwalk_length c = k"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
define C where "C k = {c. ?k_cycle S_edges c k}" for k
    \<comment> \<open>@{term "C k"} is the set of all possible cycles of size @{term k} in @{term "edge_ugraph S_edges"}\<close>
[PROOF STATE]
proof (state)
this:
C ?k = {c \<in> ucycles (edge_ugraph S_edges). uwalk_length c = ?k}

goal (1 subgoal):
 1. expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
define XG  where "XG es = {c. ?k_cycle es c k}" for es
    \<comment> \<open>@{term "XG es"} is the set of cycles contained in a @{term "edge_ugraph es"}\<close>
[PROOF STATE]
proof (state)
this:
XG ?es = {c \<in> ucycles (edge_ugraph ?es). uwalk_length c = k}

goal (1 subgoal):
 1. expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
define XC where "XC c = {es \<in> space P. ?k_cycle es c k}" for c
    \<comment> \<open>"@{term "XC c"} is the set of graphs (edge sets) containing a cycle c"\<close>
[PROOF STATE]
proof (state)
this:
XC ?c = {es \<in> space P. ?c \<in> ucycles (edge_ugraph es) \<and> uwalk_length ?c = k}

goal (1 subgoal):
 1. expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
XC ?c = {es \<in> space P. ?c \<in> ucycles (edge_ugraph es) \<and> uwalk_length ?c = k}
[PROOF STEP]
have XC_in_sets: "\<And>c. XC c \<in> sets P"
      and XC_cyl: "\<And>c. c \<in> C k \<Longrightarrow> XC c = cylinder S_edges (set (uwalk_edges c)) {}"
[PROOF STATE]
proof (prove)
using this:
XC ?c = {es \<in> space P. ?c \<in> ucycles (edge_ugraph es) \<and> uwalk_length ?c = k}

goal (1 subgoal):
 1. (\<And>c. XC c \<in> events) &&& (\<And>c. c \<in> C k \<Longrightarrow> XC c = cylinder S_edges (set (uwalk_edges c)) {})
[PROOF STEP]
by (auto simp: ucycles_def space_eq uwalks_def C_def cylinder_def sets_eq)
[PROOF STATE]
proof (state)
this:
XC ?c1 \<in> events
?c1 \<in> C k \<Longrightarrow> XC ?c1 = cylinder S_edges (set (uwalk_edges ?c1)) {}

goal (1 subgoal):
 1. expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
have "(\<integral>es. card {c \<in> ucycles (edge_ugraph es). uwalk_length c = k} \<partial> P)
      =  (\<Sum>x\<in>space P. card (XG x) * prob {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = (\<Sum>x\<in>space P. real (card (XG x)) * prob {x})
[PROOF STEP]
by (simp add: XG_def integral_finite_singleton space_eq)
[PROOF STATE]
proof (state)
this:
expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = (\<Sum>x\<in>space P. real (card (XG x)) * prob {x})

goal (1 subgoal):
 1. expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = (\<Sum>x\<in>space P. real (card (XG x)) * prob {x})

goal (1 subgoal):
 1. expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
have "\<dots> = (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {}))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {}))
[PROOF STEP]
have XG_Int_C: "\<And>s. s \<in> space P \<Longrightarrow> C k \<inter> XG s = XG s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s. s \<in> space P \<Longrightarrow> C k \<inter> XG s = XG s
[PROOF STEP]
unfolding XG_def C_def ucycles_def uwalks_def edge_ugraph_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s. s \<in> space P \<Longrightarrow> {c \<in> {p. 3 \<le> uwalk_length p \<and> p \<in> {p. set p \<subseteq> uverts (S_verts, S_edges \<inter> S_edges) \<and> set (uwalk_edges p) \<subseteq> uedges (S_verts, S_edges \<inter> S_edges) \<and> p \<noteq> []} \<and> distinct (tl p) \<and> hd p = last p}. uwalk_length c = k} \<inter> {c \<in> {p. 3 \<le> uwalk_length p \<and> p \<in> {p. set p \<subseteq> uverts (S_verts, s \<inter> S_edges) \<and> set (uwalk_edges p) \<subseteq> uedges (S_verts, s \<inter> S_edges) \<and> p \<noteq> []} \<and> distinct (tl p) \<and> hd p = last p}. uwalk_length c = k} = {c \<in> {p. 3 \<le> uwalk_length p \<and> p \<in> {p. set p \<subseteq> uverts (S_verts, s \<inter> S_edges) \<and> set (uwalk_edges p) \<subseteq> uedges (S_verts, s \<inter> S_edges) \<and> p \<noteq> []} \<and> distinct (tl p) \<and> hd p = last p}. uwalk_length c = k}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?s1 \<in> space P \<Longrightarrow> C k \<inter> XG ?s1 = XG ?s1

goal (1 subgoal):
 1. (\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {}))
[PROOF STEP]
have fin_XC: "\<And>k. finite (XC k)" and fin_C: "finite (C k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. finite (XC k)) &&& finite (C k)
[PROOF STEP]
unfolding C_def XC_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>ka. finite {es \<in> space P. ka \<in> ucycles (edge_ugraph es) \<and> uwalk_length ka = k}) &&& finite {c \<in> ucycles (edge_ugraph S_edges). uwalk_length c = k}
[PROOF STEP]
by (auto simp: finite_edges space_eq intro!: finite_ucycles)
[PROOF STATE]
proof (state)
this:
finite (XC ?k1)
finite (C k)

goal (1 subgoal):
 1. (\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {}))
[PROOF STEP]
have "(\<Sum>x\<in>space P. card (XG x) * prob {x}) = (\<Sum>x\<in>space P. (\<Sum>c \<in> XG x. prob {x}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>x\<in>space P. \<Sum>c\<in>XG x. prob {x})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>x\<in>space P. \<Sum>c\<in>XG x. prob {x})

goal (1 subgoal):
 1. (\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {}))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>x\<in>space P. \<Sum>c\<in>XG x. prob {x})

goal (1 subgoal):
 1. (\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {}))
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>space P. (\<Sum>c \<in> C k. if c \<in> XG x then prob {x} else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>space P. \<Sum>c\<in>XG x. prob {x}) = (\<Sum>x\<in>space P. \<Sum>c\<in>C k. if c \<in> XG x then prob {x} else 0)
[PROOF STEP]
using fin_C
[PROOF STATE]
proof (prove)
using this:
finite (C k)

goal (1 subgoal):
 1. (\<Sum>x\<in>space P. \<Sum>c\<in>XG x. prob {x}) = (\<Sum>x\<in>space P. \<Sum>c\<in>C k. if c \<in> XG x then prob {x} else 0)
[PROOF STEP]
by (simp add: sum.If_cases) (simp add: XG_Int_C)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>space P. \<Sum>c\<in>XG x. prob {x}) = (\<Sum>x\<in>space P. \<Sum>c\<in>C k. if c \<in> XG x then prob {x} else 0)

goal (1 subgoal):
 1. (\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {}))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>space P. \<Sum>c\<in>XG x. prob {x}) = (\<Sum>x\<in>space P. \<Sum>c\<in>C k. if c \<in> XG x then prob {x} else 0)

goal (1 subgoal):
 1. (\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {}))
[PROOF STEP]
have "\<dots> = (\<Sum>c \<in> C k. (\<Sum> x \<in> space P \<inter> XC c. prob {x}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>space P. \<Sum>c\<in>C k. if c \<in> XG x then prob {x} else 0) = (\<Sum>c\<in>C k. \<Sum>x\<in>space P \<inter> XC c. prob {x})
[PROOF STEP]
using finite_edges
[PROOF STATE]
proof (prove)
using this:
finite S_edges

goal (1 subgoal):
 1. (\<Sum>x\<in>space P. \<Sum>c\<in>C k. if c \<in> XG x then prob {x} else 0) = (\<Sum>c\<in>C k. \<Sum>x\<in>space P \<inter> XC c. prob {x})
[PROOF STEP]
by (subst sum.swap) (simp add: sum.inter_restrict XG_def XC_def space_eq)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>space P. \<Sum>c\<in>C k. if c \<in> XG x then prob {x} else 0) = (\<Sum>c\<in>C k. \<Sum>x\<in>space P \<inter> XC c. prob {x})

goal (1 subgoal):
 1. (\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {}))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>space P. \<Sum>c\<in>C k. if c \<in> XG x then prob {x} else 0) = (\<Sum>c\<in>C k. \<Sum>x\<in>space P \<inter> XC c. prob {x})

goal (1 subgoal):
 1. (\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {}))
[PROOF STEP]
have "\<dots> = (\<Sum>c \<in> C k. prob (XC c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>c\<in>C k. \<Sum>x\<in>space P \<inter> XC c. prob {x}) = (\<Sum>c\<in>C k. prob (XC c))
[PROOF STEP]
using fin_XC XC_in_sets
[PROOF STATE]
proof (prove)
using this:
finite (XC ?k1)
XC ?c1 \<in> events

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. \<Sum>x\<in>space P \<inter> XC c. prob {x}) = (\<Sum>c\<in>C k. prob (XC c))
[PROOF STEP]
by (auto simp add: prob_eq sets_eq space_eq intro!: sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>c\<in>C k. \<Sum>x\<in>space P \<inter> XC c. prob {x}) = (\<Sum>c\<in>C k. prob (XC c))

goal (1 subgoal):
 1. (\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {}))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (XC c))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (XC c))

goal (1 subgoal):
 1. (\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {}))
[PROOF STEP]
by (simp add: XC_cyl)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {}))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {}))

goal (1 subgoal):
 1. expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>space P. real (card (XG x)) * prob {x}) = (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {}))

goal (1 subgoal):
 1. expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
have "\<dots> = (\<Sum>c\<in>C k. p ^ k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {})) = (\<Sum>c\<in>C k. p ^ k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {})) = (\<Sum>c\<in>C k. p ^ k)
[PROOF STEP]
have "\<And>x. x \<in> C k \<Longrightarrow> card (set (uwalk_edges x)) = uwalk_length x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> C k \<Longrightarrow> card (set (uwalk_edges x)) = uwalk_length x
[PROOF STEP]
by (auto simp: uwalk_length_def C_def ucycles_distinct_edges intro: distinct_card)
[PROOF STATE]
proof (state)
this:
?x1 \<in> C k \<Longrightarrow> card (set (uwalk_edges ?x1)) = uwalk_length ?x1

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {})) = (\<Sum>c\<in>C k. p ^ k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x1 \<in> C k \<Longrightarrow> card (set (uwalk_edges ?x1)) = uwalk_length ?x1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?x1 \<in> C k \<Longrightarrow> card (set (uwalk_edges ?x1)) = uwalk_length ?x1

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {})) = (\<Sum>c\<in>C k. p ^ k)
[PROOF STEP]
by (auto simp: C_def ucycles_def uwalks_def cylinder_prob)
[PROOF STATE]
proof (state)
this:
(\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {})) = (\<Sum>c\<in>C k. p ^ k)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {})) = (\<Sum>c\<in>C k. p ^ k)

goal (1 subgoal):
 1. expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>c\<in>C k. prob (cylinder S_edges (set (uwalk_edges c)) {})) = (\<Sum>c\<in>C k. p ^ k)

goal (1 subgoal):
 1. expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
have "\<dots> = of_nat (fact n div fact (n - k)) * p ^ k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
have inj_last_Cons: "\<And>A. inj_on (\<lambda>es. last es # es) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A. inj_on (\<lambda>es. last es # es) A
[PROOF STEP]
by (rule inj_onI) simp
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>es. last es # es) ?A1

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>es. last es # es) ?A1

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
fix xs A
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
assume "3 \<le> length xs - Suc 0" "hd xs = last xs"
[PROOF STATE]
proof (state)
this:
3 \<le> length xs - Suc 0
hd xs = last xs

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
3 \<le> length xs - Suc 0
hd xs = last xs
[PROOF STEP]
have "xs \<in> (\<lambda>xs. last xs # xs) ` A \<longleftrightarrow> tl xs \<in> A"
[PROOF STATE]
proof (prove)
using this:
3 \<le> length xs - Suc 0
hd xs = last xs

goal (1 subgoal):
 1. (xs \<in> (\<lambda>xs. last xs # xs) ` A) = (tl xs \<in> A)
[PROOF STEP]
by (cases xs) (auto simp: inj_image_mem_iff[OF inj_last_Cons] split: if_split_asm)
[PROOF STATE]
proof (state)
this:
(xs \<in> (\<lambda>xs. last xs # xs) ` A) = (tl xs \<in> A)

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>3 \<le> length ?xs4 - Suc 0; hd ?xs4 = last ?xs4\<rbrakk> \<Longrightarrow> (?xs4 \<in> (\<lambda>xs. last xs # xs) ` ?A4) = (tl ?xs4 \<in> ?A4)

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
note image_mem_iff_inst = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>3 \<le> length ?xs4 - Suc 0; hd ?xs4 = last ?xs4\<rbrakk> \<Longrightarrow> (?xs4 \<in> (\<lambda>xs. last xs # xs) ` ?A4) = (tl ?xs4 \<in> ?A4)

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>3 \<le> length ?xs4 - Suc 0; hd ?xs4 = last ?xs4\<rbrakk> \<Longrightarrow> (?xs4 \<in> (\<lambda>xs. last xs # xs) ` ?A4) = (tl ?xs4 \<in> ?A4)

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
fix xs
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
have "xs \<in> uwalks (edge_ugraph S_edges) \<Longrightarrow> set (tl xs) \<subseteq> S_verts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<in> uwalks (edge_ugraph S_edges) \<Longrightarrow> set (tl xs) \<subseteq> S_verts
[PROOF STEP]
unfolding uwalks_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<in> {p. set p \<subseteq> uverts (edge_ugraph S_edges) \<and> set (uwalk_edges p) \<subseteq> uedges (edge_ugraph S_edges) \<and> p \<noteq> []} \<Longrightarrow> set (tl xs) \<subseteq> S_verts
[PROOF STEP]
by (induct xs) auto
[PROOF STATE]
proof (state)
this:
xs \<in> uwalks (edge_ugraph S_edges) \<Longrightarrow> set (tl xs) \<subseteq> S_verts

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?xs4 \<in> uwalks (edge_ugraph S_edges) \<Longrightarrow> set (tl ?xs4) \<subseteq> S_verts

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?xs4 \<in> uwalks (edge_ugraph S_edges) \<Longrightarrow> set (tl ?xs4) \<subseteq> S_verts

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
?xs4 \<in> uwalks (edge_ugraph S_edges) \<Longrightarrow> set (tl ?xs4) \<subseteq> S_verts

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
fix xs
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
assume "set xs \<subseteq> S_verts" "2 \<le> length xs" "distinct xs"
[PROOF STATE]
proof (state)
this:
set xs \<subseteq> S_verts
2 \<le> length xs
distinct xs

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set xs \<subseteq> S_verts
2 \<le> length xs
distinct xs
[PROOF STEP]
have "(last xs # xs) \<in> uwalks (edge_ugraph S_edges)"
[PROOF STATE]
proof (prove)
using this:
set xs \<subseteq> S_verts
2 \<le> length xs
distinct xs

goal (1 subgoal):
 1. last xs # xs \<in> uwalks (edge_ugraph S_edges)
[PROOF STEP]
proof (induct xs rule: uwalk_edges.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<lbrakk>set [] \<subseteq> S_verts; 2 \<le> length []; distinct []\<rbrakk> \<Longrightarrow> [last []] \<in> uwalks (edge_ugraph S_edges)
 2. \<And>x. \<lbrakk>set [x] \<subseteq> S_verts; 2 \<le> length [x]; distinct [x]\<rbrakk> \<Longrightarrow> [last [x], x] \<in> uwalks (edge_ugraph S_edges)
 3. \<And>x y ys. \<lbrakk>\<lbrakk>set (y # ys) \<subseteq> S_verts; 2 \<le> length (y # ys); distinct (y # ys)\<rbrakk> \<Longrightarrow> last (y # ys) # y # ys \<in> uwalks (edge_ugraph S_edges); set (x # y # ys) \<subseteq> S_verts; 2 \<le> length (x # y # ys); distinct (x # y # ys)\<rbrakk> \<Longrightarrow> last (x # y # ys) # x # y # ys \<in> uwalks (edge_ugraph S_edges)
[PROOF STEP]
case (3 x y ys)
[PROOF STATE]
proof (state)
this:
\<lbrakk>set (y # ys) \<subseteq> S_verts; 2 \<le> length (y # ys); distinct (y # ys)\<rbrakk> \<Longrightarrow> last (y # ys) # y # ys \<in> uwalks (edge_ugraph S_edges)
set (x # y # ys) \<subseteq> S_verts
2 \<le> length (x # y # ys)
distinct (x # y # ys)

goal (3 subgoals):
 1. \<lbrakk>set [] \<subseteq> S_verts; 2 \<le> length []; distinct []\<rbrakk> \<Longrightarrow> [last []] \<in> uwalks (edge_ugraph S_edges)
 2. \<And>x. \<lbrakk>set [x] \<subseteq> S_verts; 2 \<le> length [x]; distinct [x]\<rbrakk> \<Longrightarrow> [last [x], x] \<in> uwalks (edge_ugraph S_edges)
 3. \<And>x y ys. \<lbrakk>\<lbrakk>set (y # ys) \<subseteq> S_verts; 2 \<le> length (y # ys); distinct (y # ys)\<rbrakk> \<Longrightarrow> last (y # ys) # y # ys \<in> uwalks (edge_ugraph S_edges); set (x # y # ys) \<subseteq> S_verts; 2 \<le> length (x # y # ys); distinct (x # y # ys)\<rbrakk> \<Longrightarrow> last (x # y # ys) # x # y # ys \<in> uwalks (edge_ugraph S_edges)
[PROOF STEP]
have S_edges_memI: "\<And>x y. x \<in> S_verts \<Longrightarrow> y \<in> S_verts \<Longrightarrow> x \<noteq> y \<Longrightarrow> {x, y} \<in> S_edges"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> S_verts; y \<in> S_verts; x \<noteq> y\<rbrakk> \<Longrightarrow> {x, y} \<in> S_edges
[PROOF STEP]
unfolding S_edges_def all_edges_def image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> S_verts; y \<in> S_verts; x \<noteq> y\<rbrakk> \<Longrightarrow> {x, y} \<in> {y. \<exists>x\<in>{uv \<in> S_verts \<times> S_verts. fst uv \<noteq> snd uv}. y = mk_uedge x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x2 \<in> S_verts; ?y2 \<in> S_verts; ?x2 \<noteq> ?y2\<rbrakk> \<Longrightarrow> {?x2, ?y2} \<in> S_edges

goal (3 subgoals):
 1. \<lbrakk>set [] \<subseteq> S_verts; 2 \<le> length []; distinct []\<rbrakk> \<Longrightarrow> [last []] \<in> uwalks (edge_ugraph S_edges)
 2. \<And>x. \<lbrakk>set [x] \<subseteq> S_verts; 2 \<le> length [x]; distinct [x]\<rbrakk> \<Longrightarrow> [last [x], x] \<in> uwalks (edge_ugraph S_edges)
 3. \<And>x y ys. \<lbrakk>\<lbrakk>set (y # ys) \<subseteq> S_verts; 2 \<le> length (y # ys); distinct (y # ys)\<rbrakk> \<Longrightarrow> last (y # ys) # y # ys \<in> uwalks (edge_ugraph S_edges); set (x # y # ys) \<subseteq> S_verts; 2 \<le> length (x # y # ys); distinct (x # y # ys)\<rbrakk> \<Longrightarrow> last (x # y # ys) # x # y # ys \<in> uwalks (edge_ugraph S_edges)
[PROOF STEP]
have "ys \<noteq> [] \<Longrightarrow> set ys \<subseteq> S_verts \<Longrightarrow> last ys \<in> S_verts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ys \<noteq> []; set ys \<subseteq> S_verts\<rbrakk> \<Longrightarrow> last ys \<in> S_verts
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>ys \<noteq> []; set ys \<subseteq> S_verts\<rbrakk> \<Longrightarrow> last ys \<in> S_verts

goal (3 subgoals):
 1. \<lbrakk>set [] \<subseteq> S_verts; 2 \<le> length []; distinct []\<rbrakk> \<Longrightarrow> [last []] \<in> uwalks (edge_ugraph S_edges)
 2. \<And>x. \<lbrakk>set [x] \<subseteq> S_verts; 2 \<le> length [x]; distinct [x]\<rbrakk> \<Longrightarrow> [last [x], x] \<in> uwalks (edge_ugraph S_edges)
 3. \<And>x y ys. \<lbrakk>\<lbrakk>set (y # ys) \<subseteq> S_verts; 2 \<le> length (y # ys); distinct (y # ys)\<rbrakk> \<Longrightarrow> last (y # ys) # y # ys \<in> uwalks (edge_ugraph S_edges); set (x # y # ys) \<subseteq> S_verts; 2 \<le> length (x # y # ys); distinct (x # y # ys)\<rbrakk> \<Longrightarrow> last (x # y # ys) # x # y # ys \<in> uwalks (edge_ugraph S_edges)
[PROOF STEP]
with 3
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>set (y # ys) \<subseteq> S_verts; 2 \<le> length (y # ys); distinct (y # ys)\<rbrakk> \<Longrightarrow> last (y # ys) # y # ys \<in> uwalks (edge_ugraph S_edges)
set (x # y # ys) \<subseteq> S_verts
2 \<le> length (x # y # ys)
distinct (x # y # ys)
\<lbrakk>ys \<noteq> []; set ys \<subseteq> S_verts\<rbrakk> \<Longrightarrow> last ys \<in> S_verts
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set (y # ys) \<subseteq> S_verts; 2 \<le> length (y # ys); distinct (y # ys)\<rbrakk> \<Longrightarrow> last (y # ys) # y # ys \<in> uwalks (edge_ugraph S_edges)
set (x # y # ys) \<subseteq> S_verts
2 \<le> length (x # y # ys)
distinct (x # y # ys)
\<lbrakk>ys \<noteq> []; set ys \<subseteq> S_verts\<rbrakk> \<Longrightarrow> last ys \<in> S_verts

goal (1 subgoal):
 1. last (x # y # ys) # x # y # ys \<in> uwalks (edge_ugraph S_edges)
[PROOF STEP]
by (auto simp add: uwalks_def Suc_le_eq intro: S_edges_memI)
[PROOF STATE]
proof (state)
this:
last (x # y # ys) # x # y # ys \<in> uwalks (edge_ugraph S_edges)

goal (2 subgoals):
 1. \<lbrakk>set [] \<subseteq> S_verts; 2 \<le> length []; distinct []\<rbrakk> \<Longrightarrow> [last []] \<in> uwalks (edge_ugraph S_edges)
 2. \<And>x. \<lbrakk>set [x] \<subseteq> S_verts; 2 \<le> length [x]; distinct [x]\<rbrakk> \<Longrightarrow> [last [x], x] \<in> uwalks (edge_ugraph S_edges)
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
last xs # xs \<in> uwalks (edge_ugraph S_edges)

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>set ?xs4 \<subseteq> S_verts; 2 \<le> length ?xs4; distinct ?xs4\<rbrakk> \<Longrightarrow> last ?xs4 # ?xs4 \<in> uwalks (edge_ugraph S_edges)

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>set ?xs4 \<subseteq> S_verts; 2 \<le> length ?xs4; distinct ?xs4\<rbrakk> \<Longrightarrow> last ?xs4 # ?xs4 \<in> uwalks (edge_ugraph S_edges)

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
note \<open>3 \<le> k\<close>
[PROOF STATE]
proof (state)
this:
3 \<le> k

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?xs4 \<in> uwalks (edge_ugraph S_edges) \<Longrightarrow> set (tl ?xs4) \<subseteq> S_verts
\<lbrakk>set ?xs4 \<subseteq> S_verts; 2 \<le> length ?xs4; distinct ?xs4\<rbrakk> \<Longrightarrow> last ?xs4 # ?xs4 \<in> uwalks (edge_ugraph S_edges)
3 \<le> k
[PROOF STEP]
have "C k = (\<lambda>xs. last xs # xs) ` {xs. length xs = k \<and> distinct xs \<and> set xs \<subseteq> S_verts}"
[PROOF STATE]
proof (prove)
using this:
?xs4 \<in> uwalks (edge_ugraph S_edges) \<Longrightarrow> set (tl ?xs4) \<subseteq> S_verts
\<lbrakk>set ?xs4 \<subseteq> S_verts; 2 \<le> length ?xs4; distinct ?xs4\<rbrakk> \<Longrightarrow> last ?xs4 # ?xs4 \<in> uwalks (edge_ugraph S_edges)
3 \<le> k

goal (1 subgoal):
 1. C k = (\<lambda>xs. last xs # xs) ` {xs. length xs = k \<and> distinct xs \<and> set xs \<subseteq> S_verts}
[PROOF STEP]
by (auto simp: C_def ucycles_def uwalk_length_conv image_mem_iff_inst)
[PROOF STATE]
proof (state)
this:
C k = (\<lambda>xs. last xs # xs) ` {xs. length xs = k \<and> distinct xs \<and> set xs \<subseteq> S_verts}

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
C k = (\<lambda>xs. last xs # xs) ` {xs. length xs = k \<and> distinct xs \<and> set xs \<subseteq> S_verts}

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
have "card S_verts = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card S_verts = n
[PROOF STEP]
by (simp add: S_verts_def)
[PROOF STATE]
proof (state)
this:
card S_verts = n

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
C k = (\<lambda>xs. last xs # xs) ` {xs. length xs = k \<and> distinct xs \<and> set xs \<subseteq> S_verts}
card S_verts = n
[PROOF STEP]
have "card (C k) = fact n div fact (n - k)"
[PROOF STATE]
proof (prove)
using this:
C k = (\<lambda>xs. last xs # xs) ` {xs. length xs = k \<and> distinct xs \<and> set xs \<subseteq> S_verts}
card S_verts = n

goal (1 subgoal):
 1. card (C k) = fact n div fact (n - k)
[PROOF STEP]
using \<open>k < n\<close>
[PROOF STATE]
proof (prove)
using this:
C k = (\<lambda>xs. last xs # xs) ` {xs. length xs = k \<and> distinct xs \<and> set xs \<subseteq> S_verts}
card S_verts = n
k < n

goal (1 subgoal):
 1. card (C k) = fact n div fact (n - k)
[PROOF STEP]
by (simp add: card_image[OF inj_last_Cons] card_lists_distinct_length_eq' fact_div_fact)
[PROOF STATE]
proof (state)
this:
card (C k) = fact n div fact (n - k)

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (C k) = fact n div fact (n - k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (C k) = fact n div fact (n - k)

goal (1 subgoal):
 1. (\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>c\<in>C k. p ^ k) = real (fact n div fact (n - k)) * p ^ k

goal (1 subgoal):
 1. expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k

goal (1 subgoal):
 1. expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
expectation (\<lambda>x. real (card {c \<in> ucycles (edge_ugraph x). uwalk_length c = k})) = real (fact n div fact (n - k)) * p ^ k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ennreal_mult_divide_eq:
  fixes a b :: ennreal
  shows "b \<noteq> 0 \<Longrightarrow> b \<noteq> top \<Longrightarrow> (a * b) / b = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b \<noteq> 0; b \<noteq> top\<rbrakk> \<Longrightarrow> a * b / b = a
[PROOF STEP]
by (fact mult_divide_eq_ennreal)


[STATEMENT]
lemma nat_term_compD3:
  assumes "nat_term_comp cmp" and "cmp u v = Lt"
  shows "cmp (splus t u) (splus t v) = Lt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmp (splus t u) (splus t v) = Lt
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
nat_term_comp cmp
cmp u v = Lt

goal (1 subgoal):
 1. cmp (splus t u) (splus t v) = Lt
[PROOF STEP]
unfolding nat_term_comp_def snd_conv
[PROOF STATE]
proof (prove)
using this:
(\<forall>u v. snd (rep_nat_term u) = snd (rep_nat_term v) \<longrightarrow> fst (rep_nat_term u) = 0 \<longrightarrow> cmp u v \<noteq> Gt) \<and> (\<forall>u v. fst (rep_nat_term u) = fst (rep_nat_term v) \<longrightarrow> snd (rep_nat_term u) < snd (rep_nat_term v) \<longrightarrow> cmp u v = Lt) \<and> (\<forall>t u v. cmp u v = Lt \<longrightarrow> cmp (splus t u) (splus t v) = Lt) \<and> (\<forall>u v a b. fst (rep_nat_term u) = fst (rep_nat_term a) \<longrightarrow> fst (rep_nat_term v) = fst (rep_nat_term b) \<longrightarrow> snd (rep_nat_term u) = snd (rep_nat_term v) \<longrightarrow> snd (rep_nat_term a) = snd (rep_nat_term b) \<longrightarrow> cmp a b = Lt \<longrightarrow> cmp u v = Lt)
cmp u v = Lt

goal (1 subgoal):
 1. cmp (splus t u) (splus t v) = Lt
[PROOF STEP]
by blast


[STATEMENT]
lemma acomp_succs [simp]:
  "succs (acomp a) n = {n + 1 .. n + size (acomp a)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. succs (acomp a) n = {n + 1..n + size (acomp a)}
[PROOF STEP]
by (induct a arbitrary: n) auto


[STATEMENT]
lemma (in order_topology) order_tendstoI:
  "(\<And>a. a < y \<Longrightarrow> eventually (\<lambda>x. a < f x) F) \<Longrightarrow> (\<And>a. y < a \<Longrightarrow> eventually (\<lambda>x. f x < a) F) \<Longrightarrow>
    (f \<longlongrightarrow> y) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>a. a < y \<Longrightarrow> \<forall>\<^sub>F x in F. a < f x; \<And>a. y < a \<Longrightarrow> \<forall>\<^sub>F x in F. f x < a\<rbrakk> \<Longrightarrow> (f \<longlongrightarrow> y) F
[PROOF STEP]
by (auto simp: order_tendsto_iff)


[STATEMENT]
lemma infsum_nonneg_is_SUPREMUM_ennreal:
  fixes f :: "'a \<Rightarrow> real"
  assumes summable: "f summable_on A"
    and fnn: "\<And>x. x\<in>A \<Longrightarrow> f x \<ge> 0"
  shows "ennreal (infsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. (ennreal (sum f F)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (infsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ennreal (infsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have \<open>ennreal (infsum f A) = infsum (ennreal o f) A\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (infsum f A) = infsum (ennreal \<circ> f) A
[PROOF STEP]
apply (rule infsum_comm_additive_general[symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>F. \<lbrakk>finite F; F \<subseteq> A\<rbrakk> \<Longrightarrow> sum (ennreal \<circ> f) F = ennreal (sum f F)
 2. isCont ennreal (infsum f A)
 3. f summable_on A
[PROOF STEP]
apply (subst sum_ennreal[symmetric])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>F i. \<lbrakk>finite F; F \<subseteq> A; i \<in> F\<rbrakk> \<Longrightarrow> 0 \<le> f i
 2. \<And>F. \<lbrakk>finite F; F \<subseteq> A\<rbrakk> \<Longrightarrow> sum (ennreal \<circ> f) F = (\<Sum>i\<in>F. ennreal (f i))
 3. isCont ennreal (infsum f A)
 4. f summable_on A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f summable_on A
?x \<in> A \<Longrightarrow> 0 \<le> f ?x

goal (4 subgoals):
 1. \<And>F i. \<lbrakk>finite F; F \<subseteq> A; i \<in> F\<rbrakk> \<Longrightarrow> 0 \<le> f i
 2. \<And>F. \<lbrakk>finite F; F \<subseteq> A\<rbrakk> \<Longrightarrow> sum (ennreal \<circ> f) F = (\<Sum>i\<in>F. ennreal (f i))
 3. isCont ennreal (infsum f A)
 4. f summable_on A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ennreal (infsum f A) = infsum (ennreal \<circ> f) A

goal (1 subgoal):
 1. ennreal (infsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (infsum f A) = infsum (ennreal \<circ> f) A

goal (1 subgoal):
 1. ennreal (infsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
have \<open>\<dots> = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. (ennreal (sum f F)))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infsum (ennreal \<circ> f) A = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
apply (subst nonneg_infsum_complete, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (sum (ennreal \<circ> f) ` {F. finite F \<and> F \<subseteq> A}) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
apply (rule SUP_cong, blast)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {F. finite F \<and> F \<subseteq> A} \<Longrightarrow> sum (ennreal \<circ> f) x = ennreal (sum f x)
[PROOF STEP]
apply (subst sum_ennreal[symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x i. \<lbrakk>x \<in> {F. finite F \<and> F \<subseteq> A}; i \<in> x\<rbrakk> \<Longrightarrow> 0 \<le> f i
 2. \<And>x. x \<in> {F. finite F \<and> F \<subseteq> A} \<Longrightarrow> sum (ennreal \<circ> f) x = (\<Sum>i\<in>x. ennreal (f i))
[PROOF STEP]
using fnn
[PROOF STATE]
proof (prove)
using this:
?x \<in> A \<Longrightarrow> 0 \<le> f ?x

goal (2 subgoals):
 1. \<And>x i. \<lbrakk>x \<in> {F. finite F \<and> F \<subseteq> A}; i \<in> x\<rbrakk> \<Longrightarrow> 0 \<le> f i
 2. \<And>x. x \<in> {F. finite F \<and> F \<subseteq> A} \<Longrightarrow> sum (ennreal \<circ> f) x = (\<Sum>i\<in>x. ennreal (f i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
infsum (ennreal \<circ> f) A = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))

goal (1 subgoal):
 1. ennreal (infsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ennreal (infsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ennreal (infsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))

goal (1 subgoal):
 1. ennreal (infsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ennreal (infsum f A) = (SUP F\<in>{F. finite F \<and> F \<subseteq> A}. ennreal (sum f F))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Brouwer_degree2_compose:
  assumes f: "continuous_map (nsphere p) (nsphere p) f" and g: "continuous_map (nsphere p) (nsphere p) g"
  shows "Brouwer_degree2 p (g \<circ> f) = Brouwer_degree2 p g * Brouwer_degree2 p f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Brouwer_degree2 p (g \<circ> f) = Brouwer_degree2 p g * Brouwer_degree2 p f
[PROOF STEP]
proof (rule Brouwer_degree2_unique)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. continuous_map (nsphere p) (nsphere p) (g \<circ> f)
 2. \<And>x. x \<in> carrier (reduced_homology_group (int p) (nsphere p)) \<Longrightarrow> hom_induced (int p) (nsphere p) {} (nsphere p) {} (g \<circ> f) x = x [^]\<^bsub>reduced_homology_group (int p) (nsphere p)\<^esub> (Brouwer_degree2 p g * Brouwer_degree2 p f)
[PROOF STEP]
show "continuous_map (nsphere p) (nsphere p) (g \<circ> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map (nsphere p) (nsphere p) (g \<circ> f)
[PROOF STEP]
by (meson continuous_map_compose f g)
[PROOF STATE]
proof (state)
this:
continuous_map (nsphere p) (nsphere p) (g \<circ> f)

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (reduced_homology_group (int p) (nsphere p)) \<Longrightarrow> hom_induced (int p) (nsphere p) {} (nsphere p) {} (g \<circ> f) x = x [^]\<^bsub>reduced_homology_group (int p) (nsphere p)\<^esub> (Brouwer_degree2 p g * Brouwer_degree2 p f)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (reduced_homology_group (int p) (nsphere p)) \<Longrightarrow> hom_induced (int p) (nsphere p) {} (nsphere p) {} (g \<circ> f) x = x [^]\<^bsub>reduced_homology_group (int p) (nsphere p)\<^esub> (Brouwer_degree2 p g * Brouwer_degree2 p f)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (reduced_homology_group (int p) (nsphere p)) \<Longrightarrow> hom_induced (int p) (nsphere p) {} (nsphere p) {} (g \<circ> f) x = x [^]\<^bsub>reduced_homology_group (int p) (nsphere p)\<^esub> (Brouwer_degree2 p g * Brouwer_degree2 p f)
[PROOF STEP]
assume x: "x \<in> carrier (reduced_homology_group (int p) (nsphere p))"
[PROOF STATE]
proof (state)
this:
x \<in> carrier (reduced_homology_group (int p) (nsphere p))

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (reduced_homology_group (int p) (nsphere p)) \<Longrightarrow> hom_induced (int p) (nsphere p) {} (nsphere p) {} (g \<circ> f) x = x [^]\<^bsub>reduced_homology_group (int p) (nsphere p)\<^esub> (Brouwer_degree2 p g * Brouwer_degree2 p f)
[PROOF STEP]
have "hom_induced (int p) (nsphere p) {} (nsphere p) {} (g \<circ> f) =
             hom_induced (int p) (nsphere p) {} (nsphere p) {} g \<circ>
             hom_induced (int p) (nsphere p) {} (nsphere p) {} f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_induced (int p) (nsphere p) {} (nsphere p) {} (g \<circ> f) = hom_induced (int p) (nsphere p) {} (nsphere p) {} g \<circ> hom_induced (int p) (nsphere p) {} (nsphere p) {} f
[PROOF STEP]
by (blast intro: hom_induced_compose [OF f _ g])
[PROOF STATE]
proof (state)
this:
hom_induced (int p) (nsphere p) {} (nsphere p) {} (g \<circ> f) = hom_induced (int p) (nsphere p) {} (nsphere p) {} g \<circ> hom_induced (int p) (nsphere p) {} (nsphere p) {} f

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (reduced_homology_group (int p) (nsphere p)) \<Longrightarrow> hom_induced (int p) (nsphere p) {} (nsphere p) {} (g \<circ> f) x = x [^]\<^bsub>reduced_homology_group (int p) (nsphere p)\<^esub> (Brouwer_degree2 p g * Brouwer_degree2 p f)
[PROOF STEP]
with x
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier (reduced_homology_group (int p) (nsphere p))
hom_induced (int p) (nsphere p) {} (nsphere p) {} (g \<circ> f) = hom_induced (int p) (nsphere p) {} (nsphere p) {} g \<circ> hom_induced (int p) (nsphere p) {} (nsphere p) {} f
[PROOF STEP]
show "hom_induced (int p) (nsphere p) {} (nsphere p) {} (g \<circ> f) x =
        x [^]\<^bsub>reduced_homology_group (int p) (nsphere p)\<^esub> (Brouwer_degree2 p g * Brouwer_degree2 p f)"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (reduced_homology_group (int p) (nsphere p))
hom_induced (int p) (nsphere p) {} (nsphere p) {} (g \<circ> f) = hom_induced (int p) (nsphere p) {} (nsphere p) {} g \<circ> hom_induced (int p) (nsphere p) {} (nsphere p) {} f

goal (1 subgoal):
 1. hom_induced (int p) (nsphere p) {} (nsphere p) {} (g \<circ> f) x = x [^]\<^bsub>reduced_homology_group (int p) (nsphere p)\<^esub> (Brouwer_degree2 p g * Brouwer_degree2 p f)
[PROOF STEP]
by (simp add: mult.commute hom_induced_reduced flip: Brouwer_degree2 group.int_pow_pow)
[PROOF STATE]
proof (state)
this:
hom_induced (int p) (nsphere p) {} (nsphere p) {} (g \<circ> f) x = x [^]\<^bsub>reduced_homology_group (int p) (nsphere p)\<^esub> (Brouwer_degree2 p g * Brouwer_degree2 p f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ord0_wf: "wf {(x,y::ord0). x < y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf {(x, y). x < y}
[PROOF STEP]
apply (subgoal_tac "{(x,y). x < y} = ord0_leq O ord0_prec\<^sup>+")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {(x, y). x < y} = ord0_leq O ord0_prec\<^sup>+ \<Longrightarrow> wf {(x, y). x < y}
 2. {(x, y). x < y} = ord0_leq O ord0_prec\<^sup>+
[PROOF STEP]
apply (simp add: wf_ord0_leq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(x, y). x < y} = ord0_leq O ord0_prec\<^sup>+
[PROOF STEP]
apply (auto simp add: ord0_less_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma prod_div_sub:
  fixes f :: "nat \<Rightarrow> complex"
  assumes "finite A" "B \<subseteq> A" "\<forall>b \<in> B. f b \<noteq> 0"
  shows "(\<Prod> i \<in> A - B. f i) = ((\<Prod> i \<in> A. f i) div (\<Prod> i \<in> B. f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f (A - B) = prod f A / prod f B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
B \<subseteq> A
\<forall>b\<in>B. f b \<noteq> 0

goal (1 subgoal):
 1. prod f (A - B) = prod f A / prod f B
[PROOF STEP]
proof (induction "card B" arbitrary: B)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>B. \<lbrakk>0 = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
 2. \<And>x B. \<lbrakk>\<And>B. \<lbrakk>x = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc x = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 = card B
finite A
B \<subseteq> A
\<forall>b\<in>B. f b \<noteq> 0

goal (2 subgoals):
 1. \<And>B. \<lbrakk>0 = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
 2. \<And>x B. \<lbrakk>\<And>B. \<lbrakk>x = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc x = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 = card B
finite A
B \<subseteq> A
\<forall>b\<in>B. f b \<noteq> 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 = card B
finite A
B \<subseteq> A
\<forall>b\<in>B. f b \<noteq> 0

goal (1 subgoal):
 1. prod f (A - B) = prod f A / prod f B
[PROOF STEP]
using infinite_super
[PROOF STATE]
proof (prove)
using this:
0 = card B
finite A
B \<subseteq> A
\<forall>b\<in>B. f b \<noteq> 0
\<lbrakk>?S \<subseteq> ?T; infinite ?S\<rbrakk> \<Longrightarrow> infinite ?T

goal (1 subgoal):
 1. prod f (A - B) = prod f A / prod f B
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
prod f (A - B) = prod f A / prod f B

goal (1 subgoal):
 1. \<And>x B. \<lbrakk>\<And>B. \<lbrakk>x = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc x = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x B. \<lbrakk>\<And>B. \<lbrakk>x = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc x = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>n = card ?B; finite A; ?B \<subseteq> A; \<forall>b\<in>?B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - ?B) = prod f A / prod f ?B
Suc n = card B
finite A
B \<subseteq> A
\<forall>b\<in>B. f b \<noteq> 0

goal (1 subgoal):
 1. \<And>x B. \<lbrakk>\<And>B. \<lbrakk>x = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc x = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>n = card ?B; finite A; ?B \<subseteq> A; \<forall>b\<in>?B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - ?B) = prod f A / prod f ?B
Suc n = card B
finite A
B \<subseteq> A
\<forall>b\<in>B. f b \<noteq> 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n = card ?B; finite A; ?B \<subseteq> A; \<forall>b\<in>?B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - ?B) = prod f A / prod f ?B
Suc n = card B
finite A
B \<subseteq> A
\<forall>b\<in>B. f b \<noteq> 0

goal (1 subgoal):
 1. prod f (A - B) = prod f A / prod f B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>B. \<lbrakk>n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
obtain B' x where decomp: "B = B' \<union> {x} \<and> x \<notin> B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B' x. B = B' \<union> {x} \<and> x \<notin> B' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using card_eq_SucD[OF Suc(2)[symmetric]] insert_is_Un
[PROOF STATE]
proof (prove)
using this:
\<exists>b B. B = insert b B \<and> b \<notin> B \<and> card B = n \<and> (n = 0 \<longrightarrow> B = {})
insert ?a ?A = {?a} \<union> ?A

goal (1 subgoal):
 1. (\<And>B' x. B = B' \<union> {x} \<and> x \<notin> B' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B = B' \<union> {x} \<and> x \<notin> B'

goal (1 subgoal):
 1. \<lbrakk>\<And>B. \<lbrakk>n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B = B' \<union> {x} \<and> x \<notin> B'
[PROOF STEP]
have B'card: "card B' = n"
[PROOF STATE]
proof (prove)
using this:
B = B' \<union> {x} \<and> x \<notin> B'

goal (1 subgoal):
 1. card B' = n
[PROOF STEP]
using Suc(2)
[PROOF STATE]
proof (prove)
using this:
B = B' \<union> {x} \<and> x \<notin> B'
Suc n = card B

goal (1 subgoal):
 1. card B' = n
[PROOF STEP]
using Suc.prems(2) assms(1) finite_subset
[PROOF STATE]
proof (prove)
using this:
B = B' \<union> {x} \<and> x \<notin> B'
Suc n = card B
B \<subseteq> A
finite A
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. card B' = n
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
card B' = n

goal (1 subgoal):
 1. \<lbrakk>\<And>B. \<lbrakk>n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
have "prod f (A - B) = prod f ((A-B') - {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f (A - B) = prod f (A - B' - {x})
[PROOF STEP]
by (simp add: decomp,subst Diff_insert,simp)
[PROOF STATE]
proof (state)
this:
prod f (A - B) = prod f (A - B' - {x})

goal (1 subgoal):
 1. \<lbrakk>\<And>B. \<lbrakk>n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod f (A - B) = prod f (A - B' - {x})

goal (1 subgoal):
 1. \<lbrakk>\<And>B. \<lbrakk>n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
have "\<dots> = (prod f (A-B')) div f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f (A - B' - {x}) = prod f (A - B') / f x
[PROOF STEP]
using prod_diff1[of "A-B'" f x] Suc decomp
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (A - B'); f x \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B' - {x}) = (if x \<in> A - B' then prod f (A - B') / f x else prod f (A - B'))
\<lbrakk>n = card ?B; finite A; ?B \<subseteq> A; \<forall>b\<in>?B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - ?B) = prod f A / prod f ?B
Suc n = card B
finite A
B \<subseteq> A
\<forall>b\<in>B. f b \<noteq> 0
B = B' \<union> {x} \<and> x \<notin> B'

goal (1 subgoal):
 1. prod f (A - B' - {x}) = prod f (A - B') / f x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prod f (A - B' - {x}) = prod f (A - B') / f x

goal (1 subgoal):
 1. \<lbrakk>\<And>B. \<lbrakk>n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod f (A - B' - {x}) = prod f (A - B') / f x

goal (1 subgoal):
 1. \<lbrakk>\<And>B. \<lbrakk>n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
have "\<dots> = (prod f A div prod f B') div f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f (A - B') / f x = prod f A / prod f B' / f x
[PROOF STEP]
using Suc(1)[of B'] Suc(3) B'card decomp
            Suc.prems(2) Suc.prems(3)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n = card B'; finite A; B' \<subseteq> A; \<forall>b\<in>B'. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B') = prod f A / prod f B'
finite A
card B' = n
B = B' \<union> {x} \<and> x \<notin> B'
B \<subseteq> A
\<forall>b\<in>B. f b \<noteq> 0

goal (1 subgoal):
 1. prod f (A - B') / f x = prod f A / prod f B' / f x
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
prod f (A - B') / f x = prod f A / prod f B' / f x

goal (1 subgoal):
 1. \<lbrakk>\<And>B. \<lbrakk>n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod f (A - B') / f x = prod f A / prod f B' / f x

goal (1 subgoal):
 1. \<lbrakk>\<And>B. \<lbrakk>n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
have "\<dots> = prod f A div (prod f B' * f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f A / prod f B' / f x = prod f A / (prod f B' * f x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prod f A / prod f B' / f x = prod f A / (prod f B' * f x)

goal (1 subgoal):
 1. \<lbrakk>\<And>B. \<lbrakk>n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod f A / prod f B' / f x = prod f A / (prod f B' * f x)

goal (1 subgoal):
 1. \<lbrakk>\<And>B. \<lbrakk>n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
have "\<dots> = prod f A div prod f B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f A / (prod f B' * f x) = prod f A / prod f B
[PROOF STEP]
using decomp Suc.prems(2) assms(1) finite_subset
[PROOF STATE]
proof (prove)
using this:
B = B' \<union> {x} \<and> x \<notin> B'
B \<subseteq> A
finite A
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. prod f A / (prod f B' * f x) = prod f A / prod f B
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
prod f A / (prod f B' * f x) = prod f A / prod f B

goal (1 subgoal):
 1. \<lbrakk>\<And>B. \<lbrakk>n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B; Suc n = card B; finite A; B \<subseteq> A; \<forall>b\<in>B. f b \<noteq> 0\<rbrakk> \<Longrightarrow> prod f (A - B) = prod f A / prod f B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prod f (A - B) = prod f A / prod f B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prod f (A - B) = prod f A / prod f B

goal (1 subgoal):
 1. prod f (A - B) = prod f A / prod f B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
prod f (A - B) = prod f A / prod f B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
prod f (A - B) = prod f A / prod f B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ordinal_times_strict_monoR:
"\<lbrakk>y < y'; 0 < x\<rbrakk> \<Longrightarrow> x * y < x * (y'::ordinal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y < y'; 0 < x\<rbrakk> \<Longrightarrow> x * y < x * y'
[PROOF STEP]
by (rule normal.strict_monoD[OF normal_times])


[STATEMENT]
lemma index_conv_takeWhile: "index xs x = size(takeWhile (\<lambda>y. x\<noteq>y) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. index xs x = length (takeWhile ((\<noteq>) x) xs)
[PROOF STEP]
by(induct xs) auto


[STATEMENT]
lemma induced_wellformed: "uwellformed G \<Longrightarrow> V \<subseteq> uverts G \<Longrightarrow> uwellformed (induced_subgraph V G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>uwellformed G; V \<subseteq> uverts G\<rbrakk> \<Longrightarrow> uwellformed (induced_subgraph V G)
[PROOF STEP]
unfolding uwellformed_def induced_subgraph_def all_edges_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>e\<in>uedges G. card e = 2 \<and> (\<forall>u\<in>e. u \<in> uverts G); V \<subseteq> uverts G\<rbrakk> \<Longrightarrow> \<forall>e\<in>uedges (V, uedges G \<inter> mk_uedge ` {uv \<in> V \<times> V. fst uv \<noteq> snd uv}). card e = 2 \<and> (\<forall>u\<in>e. u \<in> uverts (V, uedges G \<inter> mk_uedge ` {uv \<in> V \<times> V. fst uv \<noteq> snd uv}))
[PROOF STEP]
by force


[STATEMENT]
lemma approx_hcmod_approx_zero: "(x \<approx> y) = (hcmod (y - x) \<approx> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<approx> y) = (hcmod (y - x) \<approx> 0)
[PROOF STEP]
by (simp add: Infinitesimal_hcmod_iff approx_def hnorm_minus_commute)


[STATEMENT]
lemma has_bochner_integral_I0i_power_exp_m':
  "has_bochner_integral lborel (\<lambda>x. x^k * exp (-x) * indicator {0 ..} x::real) (fact k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_bochner_integral lborel (\<lambda>x. x ^ k * exp (- x) * indicat_real {0..} x) (fact k)
[PROOF STEP]
using nn_intergal_power_times_exp_Ici[of k]
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (x ^ k * exp (- x))\<partial>lborel = ennreal (real (fact k))

goal (1 subgoal):
 1. has_bochner_integral lborel (\<lambda>x. x ^ k * exp (- x) * indicat_real {0..} x) (fact k)
[PROOF STEP]
by (intro has_bochner_integral_nn_integral)
     (auto simp: nn_integral_set_ennreal split: split_indicator)


[STATEMENT]
lemma harm_expansion_bigo_simple1:
  "(\<lambda>n. harm n - (ln n + euler_mascheroni + 1 / (2 * n))) \<in> O(\<lambda>n. 1 / n ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. harm n - (ln (real n) + euler_mascheroni + 1 / real (2 * n))) \<in> O(\<lambda>n. 1 / real (n\<^sup>2))
[PROOF STEP]
using harm_expansion_bigo[of 0]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. harm n - (ln (real n) + euler_mascheroni + 1 / (2 * real n) - (\<Sum>i = 1..0. bernoulli (2 * i) / real (2 * i * n ^ (2 * i))))) \<in> O(\<lambda>n. 1 / real n ^ (2 * 0 + 2))

goal (1 subgoal):
 1. (\<lambda>n. harm n - (ln (real n) + euler_mascheroni + 1 / real (2 * n))) \<in> O(\<lambda>n. 1 / real (n\<^sup>2))
[PROOF STEP]
by (simp add: power2_eq_square)


[STATEMENT]
lemma sq_mtx_times_vec_assoc: "(A * B) *\<^sub>V x = A *\<^sub>V (B *\<^sub>V x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A * B) *\<^sub>V x = A *\<^sub>V (B *\<^sub>V x)
[PROOF STEP]
by (transfer, simp add: matrix_vector_mul_assoc)


[STATEMENT]
lemma remove1_mset: "t \<in> set q \<Longrightarrow>
  queue_to_multiset (remove1 t q) =
  queue_to_multiset q - tree_to_multiset t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> set q \<Longrightarrow> queue_to_multiset (remove1 t q) = queue_to_multiset q - tree_to_multiset t
[PROOF STEP]
by (induct q) (auto simp: qtm_in_set_subset)


[STATEMENT]
lemma times_complex_interval: "x \<in>\<^sub>c X \<Longrightarrow> y \<in>\<^sub>c Y \<Longrightarrow> x * y \<in>\<^sub>c X * Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in>\<^sub>c X; y \<in>\<^sub>c Y\<rbrakk> \<Longrightarrow> x * y \<in>\<^sub>c X * Y
[PROOF STEP]
unfolding in_complex_interval_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>case X of Complex_Interval r i \<Rightarrow> Re x \<in>\<^sub>i r \<and> Im x \<in>\<^sub>i i; case Y of Complex_Interval r i \<Rightarrow> Re y \<in>\<^sub>i r \<and> Im y \<in>\<^sub>i i\<rbrakk> \<Longrightarrow> case X * Y of Complex_Interval r i \<Rightarrow> Re (x * y) \<in>\<^sub>i r \<and> Im (x * y) \<in>\<^sub>i i
[PROOF STEP]
by (cases X, cases Y, auto intro: times_in_interval minus_in_interval plus_in_interval)


[STATEMENT]
lemma span_subspace: "A \<subseteq> B \<Longrightarrow> B \<subseteq> span A \<Longrightarrow> subspace B \<Longrightarrow> span A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> B; B \<subseteq> span A; subspace B\<rbrakk> \<Longrightarrow> span A = B
[PROOF STEP]
by (metis order_antisym span_def hull_minimal)


[STATEMENT]
lemma poly_of_pm_uminus [simp]: "poly_of_pm x (- p) = - poly_of_pm x p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_of_pm x (- p) = - poly_of_pm x p
[PROOF STEP]
unfolding Polynomial.uminus_poly.abs_eq coeff_poly_of_pm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_of_pm x (- p) = Abs_poly (\<lambda>n. - lookup p (monomial n x))
[PROOF STEP]
by (simp add: poly_of_pm_def)


[STATEMENT]
lemma rel_fun2:
  assumes "is_equality R0" "\<And>x. Rel R1 (f x) (g x)"
  shows "Rel (rel_fun R0 R1) f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rel (R0 ===> R1) f g
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_equality R0
Rel R1 (f ?x2) (g ?x2)

goal (1 subgoal):
 1. Rel (R0 ===> R1) f g
[PROOF STEP]
unfolding is_equality_def Rel_def
[PROOF STATE]
proof (prove)
using this:
R0 = (=)
R1 (f ?x2) (g ?x2)

goal (1 subgoal):
 1. (R0 ===> R1) f g
[PROOF STEP]
by auto


[STATEMENT]
lemma fresh_fv: "finite (fv e :: 'a set) \<Longrightarrow>  atom (x :: ('a::at_base)) \<sharp> (fv e :: 'a set) \<longleftrightarrow> atom x \<sharp> e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (fv e) \<Longrightarrow> atom x \<sharp> fv e = atom x \<sharp> e
[PROOF STEP]
unfolding fv_def fresh_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {v. atom v \<in> supp e} \<Longrightarrow> (atom x \<notin> supp {v. atom v \<in> supp e}) = (atom x \<notin> supp e)
[PROOF STEP]
by (auto simp add: supp_finite_set_at_base)


[STATEMENT]
lemma esssup_cmult: assumes "c > (0::real)" shows "esssup M (\<lambda>x. c * f x::ereal) = c * esssup M f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. esssup M (\<lambda>x. ereal c * f x) = ereal c * esssup M f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. esssup M (\<lambda>x. ereal c * f x) = ereal c * esssup M f
[PROOF STEP]
have "(\<lambda>x. ereal c * f x) \<in> M \<rightarrow>\<^sub>M borel \<Longrightarrow> f \<in> M \<rightarrow>\<^sub>M borel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ereal c * f x) \<in> borel_measurable M \<Longrightarrow> f \<in> borel_measurable M
[PROOF STEP]
proof (subst measurable_cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>w. \<lbrakk>(\<lambda>x. ereal c * f x) \<in> borel_measurable M; w \<in> space M\<rbrakk> \<Longrightarrow> f w = ?g w
 2. (\<lambda>x. ereal c * f x) \<in> borel_measurable M \<Longrightarrow> ?g \<in> borel_measurable M
[PROOF STEP]
fix \<omega>
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>w. \<lbrakk>(\<lambda>x. ereal c * f x) \<in> borel_measurable M; w \<in> space M\<rbrakk> \<Longrightarrow> f w = ?g w
 2. (\<lambda>x. ereal c * f x) \<in> borel_measurable M \<Longrightarrow> ?g \<in> borel_measurable M
[PROOF STEP]
show "f \<omega> = ereal (1/c) * (ereal c * f \<omega>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<omega> = ereal (1 / c) * (ereal c * f \<omega>)
[PROOF STEP]
using \<open>0 < c\<close>
[PROOF STATE]
proof (prove)
using this:
0 < c

goal (1 subgoal):
 1. f \<omega> = ereal (1 / c) * (ereal c * f \<omega>)
[PROOF STEP]
by (cases "f \<omega>") auto
[PROOF STATE]
proof (state)
this:
f \<omega> = ereal (1 / c) * (ereal c * f \<omega>)

goal (1 subgoal):
 1. (\<lambda>x. ereal c * f x) \<in> borel_measurable M \<Longrightarrow> (\<lambda>w. ereal (1 / c) * (ereal c * f w)) \<in> borel_measurable M
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ereal c * f x) \<in> borel_measurable M \<Longrightarrow> f \<in> borel_measurable M

goal (1 subgoal):
 1. esssup M (\<lambda>x. ereal c * f x) = ereal c * esssup M f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. ereal c * f x) \<in> borel_measurable M \<Longrightarrow> f \<in> borel_measurable M
[PROOF STEP]
have "(\<lambda>x. ereal c * f x) \<in> M \<rightarrow>\<^sub>M borel \<longleftrightarrow> f \<in> M \<rightarrow>\<^sub>M borel"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. ereal c * f x) \<in> borel_measurable M \<Longrightarrow> f \<in> borel_measurable M

goal (1 subgoal):
 1. ((\<lambda>x. ereal c * f x) \<in> borel_measurable M) = (f \<in> borel_measurable M)
[PROOF STEP]
by(safe intro!: borel_measurable_ereal_times borel_measurable_const)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. ereal c * f x) \<in> borel_measurable M) = (f \<in> borel_measurable M)

goal (1 subgoal):
 1. esssup M (\<lambda>x. ereal c * f x) = ereal c * esssup M f
[PROOF STEP]
with \<open>0<c\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < c
((\<lambda>x. ereal c * f x) \<in> borel_measurable M) = (f \<in> borel_measurable M)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < c
((\<lambda>x. ereal c * f x) \<in> borel_measurable M) = (f \<in> borel_measurable M)

goal (1 subgoal):
 1. esssup M (\<lambda>x. ereal c * f x) = ereal c * esssup M f
[PROOF STEP]
by (cases "ae_filter M = bot")
       (auto simp: esssup_def bot_ereal_def top_ereal_def Limsup_ereal_mult_left)
[PROOF STATE]
proof (state)
this:
esssup M (\<lambda>x. ereal c * f x) = ereal c * esssup M f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma val_ultrametric_noteq:
  assumes "x \<in> carrier Q\<^sub>p"
  assumes "y \<in> carrier Q\<^sub>p"
  assumes "val x > val y"
  shows "val (x \<oplus> y) = val y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val (x \<oplus> y) = val y
[PROOF STEP]
apply(cases "x = \<zero>")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x = \<zero> \<Longrightarrow> val (x \<oplus> y) = val y
 2. x \<noteq> \<zero> \<Longrightarrow> val (x \<oplus> y) = val y
[PROOF STEP]
apply (simp add: assms(2))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> \<zero> \<Longrightarrow> val (x \<oplus> y) = val y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier Q\<^sub>p
y \<in> carrier Q\<^sub>p
val y < val x

goal (1 subgoal):
 1. x \<noteq> \<zero> \<Longrightarrow> val (x \<oplus> y) = val y
[PROOF STEP]
unfolding val_def
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier Q\<^sub>p
y \<in> carrier Q\<^sub>p
(if y = \<zero> then \<infinity> else eint (ord y)) < (if x = \<zero> then \<infinity> else eint (ord x))

goal (1 subgoal):
 1. x \<noteq> \<zero> \<Longrightarrow> (if x \<oplus> y = \<zero> then \<infinity> else eint (ord (x \<oplus> y))) = (if y = \<zero> then \<infinity> else eint (ord y))
[PROOF STEP]
by (smt Qp.not_nonzero_memI diff_ord_nonzero eint_ord_simps(2) not_nonzero_Qp ord_ultrametric_noteq val_def val_nonzero)


[STATEMENT]
lemma proper_map_snd:
  assumes "compact S" "K \<subseteq> T" "compact K"
    shows "compact (S \<times> T \<inter> snd -` K)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact (S \<times> T \<inter> snd -` K)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. compact (S \<times> T \<inter> snd -` K)
[PROOF STEP]
have "(S \<times> T \<inter> snd -` K) = S \<times> K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<times> T \<inter> snd -` K = S \<times> K
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
compact S
K \<subseteq> T
compact K

goal (1 subgoal):
 1. S \<times> T \<inter> snd -` K = S \<times> K
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<times> T \<inter> snd -` K = S \<times> K

goal (1 subgoal):
 1. compact (S \<times> T \<inter> snd -` K)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<times> T \<inter> snd -` K = S \<times> K
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<times> T \<inter> snd -` K = S \<times> K

goal (1 subgoal):
 1. compact (S \<times> T \<inter> snd -` K)
[PROOF STEP]
by (simp add: assms compact_Times)
[PROOF STATE]
proof (state)
this:
compact (S \<times> T \<inter> snd -` K)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_compose_at:
  assumes f: "(f \<longlongrightarrow> y) F" and g: "(g \<longlongrightarrow> z) (at y)" and fg: "eventually (\<lambda>w. f w = y \<longrightarrow> g y = z) F"
  shows "((g \<circ> f) \<longlongrightarrow> z) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((g \<circ> f) \<longlongrightarrow> z) F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((g \<circ> f) \<longlongrightarrow> z) F
[PROOF STEP]
have "(\<forall>\<^sub>F a in F. f a \<noteq> y) \<or> g y = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>\<^sub>F a in F. f a \<noteq> y) \<or> g y = z
[PROOF STEP]
using fg
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F w in F. f w = y \<longrightarrow> g y = z

goal (1 subgoal):
 1. (\<forall>\<^sub>F a in F. f a \<noteq> y) \<or> g y = z
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<forall>\<^sub>F a in F. f a \<noteq> y) \<or> g y = z

goal (1 subgoal):
 1. ((g \<circ> f) \<longlongrightarrow> z) F
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<forall>\<^sub>F a in F. f a \<noteq> y) \<or> g y = z

goal (1 subgoal):
 1. ((g \<circ> f) \<longlongrightarrow> z) F
[PROOF STEP]
have "(g \<longlongrightarrow> z) (filtermap f F) \<or> \<not> (\<forall>\<^sub>F a in F. f a \<noteq> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g \<longlongrightarrow> z) (filtermap f F) \<or> \<not> (\<forall>\<^sub>F a in F. f a \<noteq> y)
[PROOF STEP]
by (metis (no_types) filterlim_atI filterlim_def tendsto_mono f g)
[PROOF STATE]
proof (state)
this:
(g \<longlongrightarrow> z) (filtermap f F) \<or> \<not> (\<forall>\<^sub>F a in F. f a \<noteq> y)

goal (1 subgoal):
 1. ((g \<circ> f) \<longlongrightarrow> z) F
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<forall>\<^sub>F a in F. f a \<noteq> y) \<or> g y = z
(g \<longlongrightarrow> z) (filtermap f F) \<or> \<not> (\<forall>\<^sub>F a in F. f a \<noteq> y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<forall>\<^sub>F a in F. f a \<noteq> y) \<or> g y = z
(g \<longlongrightarrow> z) (filtermap f F) \<or> \<not> (\<forall>\<^sub>F a in F. f a \<noteq> y)

goal (1 subgoal):
 1. ((g \<circ> f) \<longlongrightarrow> z) F
[PROOF STEP]
by (metis (no_types) f filterlim_compose filterlim_filtermap g tendsto_at_iff_tendsto_nhds tendsto_compose_filtermap)
[PROOF STATE]
proof (state)
this:
((g \<circ> f) \<longlongrightarrow> z) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_factorization_Gcd:
  assumes "Gcd A \<noteq> 0"
  shows   "prime_factorization (Gcd A) = Inf (prime_factorization ` (A - {0}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization (Gcd A) = Inf (prime_factorization ` (A - {0::'a}))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Gcd A \<noteq> (0::'a)

goal (1 subgoal):
 1. prime_factorization (Gcd A) = Inf (prime_factorization ` (A - {0::'a}))
[PROOF STEP]
by (simp add: prime_factorization_Gcd_factorial Gcd_eq_Gcd_factorial Gcd_factorial_eq_0_iff)


[STATEMENT]
lemma fct_gen_subalgebra_sigma_sets:
  assumes "X\<in> space M \<rightarrow> space N"
  shows "sets (fct_gen_subalgebra M N X) = {X -` B \<inter> space M |B. B \<in> sets N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (fct_gen_subalgebra M N X) = {X -` B \<inter> space M |B. B \<in> sets N}
[PROOF STEP]
by (simp add: assms fct_gen_subalgebra_sets fct_preimage_sigma_sets)


[STATEMENT]
lemma equiv_subst_right:
  "cmp x z = comp \<longleftrightarrow> cmp x y = comp" if "cmp z y = Equiv" for comp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmp x z = comp) = (cmp x y = comp)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (cmp x z = comp) = (cmp x y = comp)
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
cmp z y = Equiv
[PROOF STEP]
have "cmp y z = Equiv"
[PROOF STATE]
proof (prove)
using this:
cmp z y = Equiv

goal (1 subgoal):
 1. cmp y z = Equiv
[PROOF STEP]
by (simp add: sym)
[PROOF STATE]
proof (state)
this:
cmp y z = Equiv

goal (1 subgoal):
 1. (cmp x z = comp) = (cmp x y = comp)
[PROOF STEP]
with that
[PROOF STATE]
proof (chain)
picking this:
cmp z y = Equiv
cmp y z = Equiv
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cmp z y = Equiv
cmp y z = Equiv

goal (1 subgoal):
 1. (cmp x z = comp) = (cmp x y = comp)
[PROOF STEP]
by (cases comp) (auto intro: trans_equiv trans_less_equiv trans_greater_equiv)
[PROOF STATE]
proof (state)
this:
(cmp x z = comp) = (cmp x y = comp)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma h_observable_card :
  assumes "observable M"
  shows "card (snd ` Set.filter (\<lambda> (y',q') . y' = y) (h M (q,x))) \<le> 1"
  and "finite (snd ` Set.filter (\<lambda> (y',q') . y' = y) (h M (q,x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x))) \<le> 1 &&& finite (snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. card (snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x))) \<le> 1
 2. finite (snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x)))
[PROOF STEP]
have "snd ` Set.filter (\<lambda> (y',q') . y' = y) (h M (q,x)) = {q' . (q,x,y,q') \<in> transitions M}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x)) = {q'. (q, x, y, q') \<in> FSM.transitions M}
[PROOF STEP]
unfolding h.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x)) = {q'. (q, x, y, q') \<in> FSM.transitions M}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x)) = {q'. (q, x, y, q') \<in> FSM.transitions M}

goal (2 subgoals):
 1. card (snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x))) \<le> 1
 2. finite (snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x)) = {q'. (q, x, y, q') \<in> FSM.transitions M}

goal (2 subgoals):
 1. card (snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x))) \<le> 1
 2. finite (snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x)))
[PROOF STEP]
have "{q' . (q,x,y,q') \<in> transitions M} = {} \<or> (\<exists> q' . {q' . (q,x,y,q') \<in> transitions M} = {q'})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {q'. (q, x, y, q') \<in> FSM.transitions M} = {} \<or> (\<exists>q'. {q'. (q, x, y, q') \<in> FSM.transitions M} = {q'})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
observable M

goal (1 subgoal):
 1. {q'. (q, x, y, q') \<in> FSM.transitions M} = {} \<or> (\<exists>q'. {q'. (q, x, y, q') \<in> FSM.transitions M} = {q'})
[PROOF STEP]
unfolding observable_alt_def
[PROOF STATE]
proof (prove)
using this:
\<forall>q1 x y q1' q1''. (q1, x, y, q1') \<in> FSM.transitions M \<and> (q1, x, y, q1'') \<in> FSM.transitions M \<longrightarrow> q1' = q1''

goal (1 subgoal):
 1. {q'. (q, x, y, q') \<in> FSM.transitions M} = {} \<or> (\<exists>q'. {q'. (q, x, y, q') \<in> FSM.transitions M} = {q'})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{q'. (q, x, y, q') \<in> FSM.transitions M} = {} \<or> (\<exists>q'. {q'. (q, x, y, q') \<in> FSM.transitions M} = {q'})

goal (2 subgoals):
 1. card (snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x))) \<le> 1
 2. finite (snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x)) = {q'. (q, x, y, q') \<in> FSM.transitions M}
{q'. (q, x, y, q') \<in> FSM.transitions M} = {} \<or> (\<exists>q'. {q'. (q, x, y, q') \<in> FSM.transitions M} = {q'})
[PROOF STEP]
show "card (snd ` Set.filter (\<lambda> (y',q') . y' = y) (h M (q,x))) \<le> 1"
              and "finite (snd ` Set.filter (\<lambda> (y',q') . y' = y) (h M (q,x)))"
[PROOF STATE]
proof (prove)
using this:
snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x)) = {q'. (q, x, y, q') \<in> FSM.transitions M}
{q'. (q, x, y, q') \<in> FSM.transitions M} = {} \<or> (\<exists>q'. {q'. (q, x, y, q') \<in> FSM.transitions M} = {q'})

goal (1 subgoal):
 1. card (snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x))) \<le> 1 &&& finite (snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x))) \<le> 1
finite (snd ` Set.filter (\<lambda>(y', q'). y' = y) (FSM.h M (q, x)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cindex_pathE_reversepath: "cindex_pathE (reversepath g) z = -cindex_pathE g z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_pathE (reversepath g) z = - cindex_pathE g z
[PROOF STEP]
using cindexE_linear_comp[of "-1" 0 1 "\<lambda>t. (Im (g t) - Im z) / (Re (g t) - Re z)" 1]
[PROOF STATE]
proof (prove)
using this:
- 1 \<noteq> 0 \<Longrightarrow> cindexE 0 1 ((\<lambda>t. (Im (g t) - Im z) / (Re (g t) - Re z)) \<circ> (\<lambda>x. - 1 * x + 1)) = (if 0 < - 1 then cindexE (- 1 * 0 + 1) (- 1 * 1 + 1) (\<lambda>t. (Im (g t) - Im z) / (Re (g t) - Re z)) else - cindexE (- 1 * 1 + 1) (- 1 * 0 + 1) (\<lambda>t. (Im (g t) - Im z) / (Re (g t) - Re z)))

goal (1 subgoal):
 1. cindex_pathE (reversepath g) z = - cindex_pathE g z
[PROOF STEP]
by (simp add: cindex_pathE_def reversepath_def o_def)


[STATEMENT]
lemma set_spmf_of_set_finite [simp]: "finite A \<Longrightarrow> set_spmf (spmf_of_set A) = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> set_spmf (spmf_of_set A) = A
[PROOF STEP]
by(simp add: set_spmf_of_set)


[STATEMENT]
lemma Qp_ev_hom_ev:
  assumes "a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  shows "Qp_ev_hom n P a = Qp_ev P a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Qp_ev_hom n P a = eval_at_point Q\<^sub>p a P
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)

goal (1 subgoal):
 1. Qp_ev_hom n P a = eval_at_point Q\<^sub>p a P
[PROOF STEP]
unfolding Qp_ev_hom_def
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)

goal (1 subgoal):
 1. (\<lambda>q\<in>carrier (Q\<^sub>p\<^bsup>n\<^esup>). eval_at_point Q\<^sub>p q P) a = eval_at_point Q\<^sub>p a P
[PROOF STEP]
by (meson restrict_apply')


[STATEMENT]
lemma combine_pairs_prop:
  "(\<forall>P \<in> \<P>. accepting_pair\<^sub>R \<delta> q\<^sub>0 P w) = accepting_pair\<^sub>G\<^sub>R \<delta> q\<^sub>0 (combine_pairs \<P>) w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>P\<in>\<P>. accepting_pair\<^sub>R \<delta> q\<^sub>0 P w) = accepting_pair\<^sub>G\<^sub>R \<delta> q\<^sub>0 (local.combine_pairs \<P>) w
[PROOF STEP]
by auto


[STATEMENT]
lemma sup_compl: "x \<squnion> -x = \<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> - x = \<top>
[PROOF STEP]
by (simp add: top_eq towards_sup_compl)


[STATEMENT]
lemma bddh_binop: "bddh n (bdd_binop f l r) = (bddh n l \<and> bddh n r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bddh n (bdd_binop f l r) = (bddh n l \<and> bddh n r)
[PROOF STEP]
by (induct f l r arbitrary: n rule: bdd_binop.induct) (auto split: nat.split_asm)


[STATEMENT]
lemma older_seniors_card_le:
  "card (older_seniors x n) < card (older_seniors y n) \<longleftrightarrow> older_seniors x n \<subset> older_seniors y n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (card (older_seniors x n) < card (older_seniors y n)) = (older_seniors x n \<subset> older_seniors y n)
[PROOF STEP]
by (metis card_mono card_psubset not_le older_seniors_cases_subseteq older_seniors_finite psubset_card_mono)


[STATEMENT]
lemma sum_le_suminf:
  shows "summable f \<Longrightarrow> finite I \<Longrightarrow> (\<And>n. n \<in>- I \<Longrightarrow> 0 \<le> f n) \<Longrightarrow> sum f I \<le> suminf f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>summable f; finite I; \<And>n. n \<in> - I \<Longrightarrow> (0::'a) \<le> f n\<rbrakk> \<Longrightarrow> sum f I \<le> suminf f
[PROOF STEP]
by (rule sums_le[OF _ sums_If_finite_set summable_sums]) auto


[STATEMENT]
lemma ratfps_Lcm:
  assumes "A \<noteq> {}" "0 \<notin> A" "bdd_above (ratfps_subdegree`A)"
  shows   "Lcm A = ratfps_of_poly (monom 1 (SUP f\<in>A. ratfps_subdegree f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lcm A = ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
[PROOF STEP]
proof (rule sym, rule LcmI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>a. a \<in> A \<Longrightarrow> a dvd ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
 2. \<And>c. (\<And>a. a \<in> A \<Longrightarrow> a dvd c) \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd c
 3. normalize (ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))) = ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
[PROOF STEP]
fix f
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>a. a \<in> A \<Longrightarrow> a dvd ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
 2. \<And>c. (\<And>a. a \<in> A \<Longrightarrow> a dvd c) \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd c
 3. normalize (ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))) = ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
[PROOF STEP]
assume "f \<in> A"
[PROOF STATE]
proof (state)
this:
f \<in> A

goal (3 subgoals):
 1. \<And>a. a \<in> A \<Longrightarrow> a dvd ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
 2. \<And>c. (\<And>a. a \<in> A \<Longrightarrow> a dvd c) \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd c
 3. normalize (ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))) = ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f \<in> A

goal (3 subgoals):
 1. \<And>a. a \<in> A \<Longrightarrow> a dvd ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
 2. \<And>c. (\<And>a. a \<in> A \<Longrightarrow> a dvd c) \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd c
 3. normalize (ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))) = ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
[PROOF STEP]
from assms(3)
[PROOF STATE]
proof (chain)
picking this:
bdd_above (ratfps_subdegree ` A)
[PROOF STEP]
have "bdd_above (ratfps_subdegree ` A)"
[PROOF STATE]
proof (prove)
using this:
bdd_above (ratfps_subdegree ` A)

goal (1 subgoal):
 1. bdd_above (ratfps_subdegree ` A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bdd_above (ratfps_subdegree ` A)

goal (3 subgoals):
 1. \<And>a. a \<in> A \<Longrightarrow> a dvd ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
 2. \<And>c. (\<And>a. a \<in> A \<Longrightarrow> a dvd c) \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd c
 3. normalize (ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))) = ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f \<in> A
bdd_above (ratfps_subdegree ` A)
[PROOF STEP]
show "f dvd ratfps_of_poly (monom 1 (SUP f\<in>A. ratfps_subdegree f))"
[PROOF STATE]
proof (prove)
using this:
f \<in> A
bdd_above (ratfps_subdegree ` A)

goal (1 subgoal):
 1. f dvd ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
f \<in> A
bdd_above (ratfps_subdegree ` A)
0 \<notin> A

goal (1 subgoal):
 1. f dvd ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
[PROOF STEP]
by (cases "f = 0") (auto simp: ratfps_dvd_code ratfps_of_poly_eq_0_iff subdegree_fps_of_poly
                          ratfps_subdegree_altdef [abs_def] intro!: cSUP_upper)
[PROOF STATE]
proof (state)
this:
f dvd ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))

goal (2 subgoals):
 1. \<And>c. (\<And>a. a \<in> A \<Longrightarrow> a dvd c) \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd c
 2. normalize (ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))) = ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>c. (\<And>a. a \<in> A \<Longrightarrow> a dvd c) \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd c
 2. normalize (ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))) = ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
[PROOF STEP]
fix d
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>c. (\<And>a. a \<in> A \<Longrightarrow> a dvd c) \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd c
 2. normalize (ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))) = ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
[PROOF STEP]
assume d: "\<And>f. f \<in> A \<Longrightarrow> f dvd d"
[PROOF STATE]
proof (state)
this:
?f \<in> A \<Longrightarrow> ?f dvd d

goal (2 subgoals):
 1. \<And>c. (\<And>a. a \<in> A \<Longrightarrow> a dvd c) \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd c
 2. normalize (ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))) = ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
A \<noteq> {}
0 \<notin> A
bdd_above (ratfps_subdegree ` A)
[PROOF STEP]
obtain f where f: "f \<in> A" "f \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}
0 \<notin> A
bdd_above (ratfps_subdegree ` A)

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>f \<in> A; f \<noteq> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f \<in> A
f \<noteq> 0

goal (2 subgoals):
 1. \<And>c. (\<And>a. a \<in> A \<Longrightarrow> a dvd c) \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd c
 2. normalize (ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))) = ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
[PROOF STEP]
show "ratfps_of_poly (monom 1 (SUP f\<in>A. ratfps_subdegree f)) dvd d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd d
[PROOF STEP]
proof (cases "d = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. d = 0 \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd d
 2. d \<noteq> 0 \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd d
[PROOF STEP]
assume "d \<noteq> 0"
[PROOF STATE]
proof (state)
this:
d \<noteq> 0

goal (2 subgoals):
 1. d = 0 \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd d
 2. d \<noteq> 0 \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd d
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
d \<noteq> 0

goal (2 subgoals):
 1. d = 0 \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd d
 2. d \<noteq> 0 \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd d
[PROOF STEP]
from d
[PROOF STATE]
proof (chain)
picking this:
?f \<in> A \<Longrightarrow> ?f dvd d
[PROOF STEP]
have "\<And>f. f \<in> A \<Longrightarrow> f \<noteq> 0 \<Longrightarrow> f dvd d"
[PROOF STATE]
proof (prove)
using this:
?f \<in> A \<Longrightarrow> ?f dvd d

goal (1 subgoal):
 1. \<And>f. \<lbrakk>f \<in> A; f \<noteq> 0\<rbrakk> \<Longrightarrow> f dvd d
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>?f \<in> A; ?f \<noteq> 0\<rbrakk> \<Longrightarrow> ?f dvd d

goal (2 subgoals):
 1. d = 0 \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd d
 2. d \<noteq> 0 \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd d
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
d \<noteq> 0
\<lbrakk>?f \<in> A; ?f \<noteq> 0\<rbrakk> \<Longrightarrow> ?f dvd d
[PROOF STEP]
have "ratfps_subdegree d \<ge> (SUP f\<in>A. ratfps_subdegree f)"
[PROOF STATE]
proof (prove)
using this:
d \<noteq> 0
\<lbrakk>?f \<in> A; ?f \<noteq> 0\<rbrakk> \<Longrightarrow> ?f dvd d

goal (1 subgoal):
 1. Sup (ratfps_subdegree ` A) \<le> ratfps_subdegree d
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
d \<noteq> 0
\<lbrakk>?f \<in> A; ?f \<noteq> 0\<rbrakk> \<Longrightarrow> ?f dvd d
A \<noteq> {}
0 \<notin> A
bdd_above (ratfps_subdegree ` A)

goal (1 subgoal):
 1. Sup (ratfps_subdegree ` A) \<le> ratfps_subdegree d
[PROOF STEP]
by (intro cSUP_least) (auto simp: ratfps_dvd_code)
[PROOF STATE]
proof (state)
this:
Sup (ratfps_subdegree ` A) \<le> ratfps_subdegree d

goal (2 subgoals):
 1. d = 0 \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd d
 2. d \<noteq> 0 \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd d
[PROOF STEP]
with \<open>d \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
d \<noteq> 0
Sup (ratfps_subdegree ` A) \<le> ratfps_subdegree d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
d \<noteq> 0
Sup (ratfps_subdegree ` A) \<le> ratfps_subdegree d

goal (1 subgoal):
 1. ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd d
[PROOF STEP]
by (simp add: ratfps_dvd_code ratfps_of_poly_eq_0_iff
          ratfps_subdegree_altdef subdegree_fps_of_poly)
[PROOF STATE]
proof (state)
this:
ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd d

goal (1 subgoal):
 1. d = 0 \<Longrightarrow> ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd d
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A))) dvd d

goal (1 subgoal):
 1. normalize (ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))) = ratfps_of_poly (monom (1::'a) (Sup (ratfps_subdegree ` A)))
[PROOF STEP]
qed (simp_all add: ratfps_subdegree_altdef subdegree_fps_of_poly normalize_ratfps_def)


[STATEMENT]
lemma span_subspace: "A \<subseteq> B \<Longrightarrow> B \<subseteq> span A \<Longrightarrow> subspace B \<Longrightarrow> span A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> B; B \<subseteq> span A; subspace B\<rbrakk> \<Longrightarrow> span A = B
[PROOF STEP]
by (metis order_antisym span_def hull_minimal)


[STATEMENT]
lemma path_component_of_set:
   "path_component_of X x y \<longleftrightarrow> (\<exists>g. pathin X g \<and> g 0 = x \<and> g 1 = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_component_of X x y = (\<exists>g. pathin X g \<and> g 0 = x \<and> g 1 = y)
[PROOF STEP]
by (auto simp: path_component_of_def)


[STATEMENT]
lemma inheritedPropagateEq[rule_format]: assumes a: "inherited subs P"
  and b: "fans subs"
  and c: "~(terminal subs delta)"
  shows "P(tree subs delta) = (!sigma:subs delta. P(tree subs sigma))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (tree subs delta) = (\<forall>sigma\<in>subs delta. P (tree subs sigma))
[PROOF STEP]
apply(insert fansD[OF b])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A. finite (subs A)) \<Longrightarrow> P (tree subs delta) = (\<forall>sigma\<in>subs delta. P (tree subs sigma))
[PROOF STEP]
apply(subst treeEquation [of _ delta])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A. finite (subs A)) \<Longrightarrow> P (insert (0, delta) (\<Union>delta\<in>subs delta. incLevel ` tree subs delta)) = (\<forall>sigma\<in>subs delta. P (tree subs sigma))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
inherited subs P
fans subs
\<not> terminal subs delta

goal (1 subgoal):
 1. (\<And>A. finite (subs A)) \<Longrightarrow> P (insert (0, delta) (\<Union>delta\<in>subs delta. incLevel ` tree subs delta)) = (\<forall>sigma\<in>subs delta. P (tree subs sigma))
[PROOF STEP]
apply(simp add: inheritedInsertEq inheritedUNEq[symmetric] inheritedIncLevelEq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "\<And>s. (\<forall>l. I (l(x:=Suc (l x))) s) = (\<forall>l. (\<exists>n. l x = Suc n) \<longrightarrow> I l s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s. (\<forall>l. I (l(x := Suc (l x))) s) = (\<forall>l. (\<exists>n. l x = Suc n) \<longrightarrow> I l s)
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s l n. \<lbrakk>\<forall>l. I (l(x := Suc (l x))) s; l x = Suc n\<rbrakk> \<Longrightarrow> I l s
[PROOF STEP]
proof (goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s l n. \<lbrakk>\<forall>l. I (l(x := Suc (l x))) s; l x = Suc n\<rbrakk> \<Longrightarrow> I l s
[PROOF STEP]
case (1 s l n)
[PROOF STATE]
proof (state)
this:
\<forall>l. I (l(x := Suc (l x))) s
l x = Suc n

goal (1 subgoal):
 1. \<And>s l n. \<lbrakk>\<forall>l. I (l(x := Suc (l x))) s; l x = Suc n\<rbrakk> \<Longrightarrow> I l s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>l. I (l(x := Suc (l x))) s
l x = Suc n
[PROOF STEP]
have "\<And>l. I (l(x := Suc (l x))) s"
[PROOF STATE]
proof (prove)
using this:
\<forall>l. I (l(x := Suc (l x))) s
l x = Suc n

goal (1 subgoal):
 1. \<And>l. I (l(x := Suc (l x))) s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
I (?l(x := Suc (?l x))) s

goal (1 subgoal):
 1. \<And>s l n. \<lbrakk>\<forall>l. I (l(x := Suc (l x))) s; l x = Suc n\<rbrakk> \<Longrightarrow> I l s
[PROOF STEP]
from this[where l="l(x:=n)"]
[PROOF STATE]
proof (chain)
picking this:
I (l(x := n, x := Suc ((l(x := n)) x))) s
[PROOF STEP]
have "I ((l(x:=n))(x := Suc ((l(x:=n)) x))) s"
[PROOF STATE]
proof (prove)
using this:
I (l(x := n, x := Suc ((l(x := n)) x))) s

goal (1 subgoal):
 1. I (l(x := n, x := Suc ((l(x := n)) x))) s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
I (l(x := n, x := Suc ((l(x := n)) x))) s

goal (1 subgoal):
 1. \<And>s l n. \<lbrakk>\<forall>l. I (l(x := Suc (l x))) s; l x = Suc n\<rbrakk> \<Longrightarrow> I l s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
I (l(x := n, x := Suc ((l(x := n)) x))) s
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
I (l(x := n, x := Suc ((l(x := n)) x))) s

goal (1 subgoal):
 1. I l s
[PROOF STEP]
using 1(2)
[PROOF STATE]
proof (prove)
using this:
I (l(x := n, x := Suc ((l(x := n)) x))) s
l x = Suc n

goal (1 subgoal):
 1. I l s
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I (l(x := Suc n)) s; l x = Suc n\<rbrakk> \<Longrightarrow> I l s
[PROOF STEP]
by (metis fun_upd_triv)
[PROOF STATE]
proof (state)
this:
I l s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_swap: "i < length xs \<Longrightarrow> j < length xs \<Longrightarrow> map f (swap xs i j) = swap (map f xs) i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < length xs; j < length xs\<rbrakk> \<Longrightarrow> map f (swap xs i j) = swap (map f xs) i j
[PROOF STEP]
by (simp add: swap_def map_update map_nth)


[STATEMENT]
lemma density_discrete:
  "countable A \<Longrightarrow> sets N = Set.Pow A \<Longrightarrow> (\<And>x. f x \<ge> 0) \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> f x = emeasure N {x}) \<Longrightarrow>
    density (count_space A) f = N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>countable A; sets N = Pow A; \<And>x. 0 \<le> f x; \<And>x. x \<in> A \<Longrightarrow> f x = emeasure N {x}\<rbrakk> \<Longrightarrow> density (count_space A) f = N
[PROOF STEP]
by (rule measure_eqI_countable[of _ A]) (auto simp: emeasure_density)


[STATEMENT]
lemma powr_float_interval_eqI:
  "x powr y \<in>\<^sub>r IVL"
  if "powr_float_interval p X Y = Some IVL" "x \<in>\<^sub>r X" "y \<in>\<^sub>r Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x powr y \<in>\<^sub>r IVL
[PROOF STEP]
using powr_float_intervalI[of x X y Y p] that
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x \<in>\<^sub>r X; y \<in>\<^sub>r Y\<rbrakk> \<Longrightarrow> x powr y \<in> set_of' (powr_float_interval p X Y)
powr_float_interval p X Y = Some IVL
x \<in>\<^sub>r X
y \<in>\<^sub>r Y

goal (1 subgoal):
 1. x powr y \<in>\<^sub>r IVL
[PROOF STEP]
by (auto simp: set_of'_def split: option.splits)


[STATEMENT]
lemma delete_index_altdef: "delete_index n xs = take n xs @ drop (Suc n) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. delete_index n xs = take n xs @ drop (Suc n) xs
[PROOF STEP]
by (induction n xs rule: delete_index.induct) simp_all


[STATEMENT]
lemma suntil_iff_sdrop: "(p suntil q) \<omega> = (\<exists>j. q (sdrop j \<omega>) \<and> (\<forall>k < j. p (sdrop k \<omega>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p suntil q) \<omega> = (\<exists>j. q (sdrop j \<omega>) \<and> (\<forall>k<j. p (sdrop k \<omega>)))
[PROOF STEP]
using sdrop_if_suntil sdrop_suntil
[PROOF STATE]
proof (prove)
using this:
(?p suntil ?q) ?\<omega> \<Longrightarrow> \<exists>j. ?q (sdrop j ?\<omega>) \<and> (\<forall>k<j. ?p (sdrop k ?\<omega>))
\<lbrakk>?q (sdrop ?j ?\<omega>); \<forall>k<?j. ?p (sdrop k ?\<omega>)\<rbrakk> \<Longrightarrow> (?p suntil ?q) ?\<omega>

goal (1 subgoal):
 1. (p suntil q) \<omega> = (\<exists>j. q (sdrop j \<omega>) \<and> (\<forall>k<j. p (sdrop k \<omega>)))
[PROOF STEP]
by blast


[STATEMENT]
lemma length_word_rsplit_even_size:
  "n = LENGTH('a::len) \<Longrightarrow> size w = m * n \<Longrightarrow>
    length (word_rsplit w :: 'a word list) = m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n = LENGTH('a); size w = m * n\<rbrakk> \<Longrightarrow> length (word_rsplit w) = m
[PROOF STEP]
by (cases \<open>LENGTH('a)\<close>) (simp_all add: length_word_rsplit_exp_size div_nat_eqI)