[STATEMENT]
lemma tensor_mat_scale2:
  assumes "m1 \<in> carrier_mat d1 d1"
    and "m2 \<in> carrier_mat d2 d2"
  shows "tensor_mat m1 (a \<cdot>\<^sub>m m2) = a \<cdot>\<^sub>m tensor_mat m1 m2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tensor_mat m1 (a \<cdot>\<^sub>m m2) = a \<cdot>\<^sub>m tensor_mat m1 m2
[PROOF STEP]
apply (rule eq_matI, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> tensor_mat m1 (a \<cdot>\<^sub>m m2) $$ (i, j) = a * tensor_mat m1 m2 $$ (i, j)
[PROOF STEP]
unfolding tensor_mat_eval
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> m1 $$ (encode1 i, encode1 j) * (a \<cdot>\<^sub>m m2) $$ (encode2 i, encode2 j) = a * (m1 $$ (encode1 i, encode1 j) * m2 $$ (encode2 i, encode2 j))
[PROOF STEP]
using assms comm_semiring_class.distrib
[PROOF STATE]
proof (prove)
using this:
m1 \<in> carrier_mat d1 d1
m2 \<in> carrier_mat d2 d2
(?a + ?b) * ?c = ?a * ?c + ?b * ?c

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> m1 $$ (encode1 i, encode1 j) * (a \<cdot>\<^sub>m m2) $$ (encode2 i, encode2 j) = a * (m1 $$ (encode1 i, encode1 j) * m2 $$ (encode2 i, encode2 j))
[PROOF STEP]
by force


[STATEMENT]
lemma isNSCont_isCont_iff: "isNSCont f a \<longleftrightarrow> isCont f a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isNSCont f a = isCont f a
[PROOF STEP]
by (simp add: isCont_def) (rule isNSCont_LIM_iff)


[STATEMENT]
lemma lm007:
  assumes "n \<in> N"
  shows "{(G,n)} \<in> totalRels {G} N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(G, n)} \<in> totalRels {G} N
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n \<in> N

goal (1 subgoal):
 1. {(G, n)} \<in> totalRels {G} N
[PROOF STEP]
by force


[STATEMENT]
lemma star_n_eq_iff: "star_n X = star_n Y \<longleftrightarrow> eventually (\<lambda>n. X n = Y n) \<U>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (star_n X = star_n Y) = (\<forall>\<^sub>F n in \<U>. X n = Y n)
[PROOF STEP]
by (simp add: star_n_def Abs_star_inject starrel_in_star equiv_starrel_iff)


[STATEMENT]
lemma next_step_step:
      fixes i l
      defines "j\<equiv>next_step_of l i"
      shows "j \<ge> i \<and> (\<not>can_step l (s j) \<or> rstep l s j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j)
[PROOF STEP]
using fair_run_is_fair'[OF FAIR]
[PROOF STATE]
proof (prove)
using this:
is_fair' s

goal (1 subgoal):
 1. i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j)
[PROOF STEP]
unfolding is_fair'_def
[PROOF STATE]
proof (prove)
using this:
\<forall>l i. \<exists>j\<ge>i. \<not> can_step l (s j) \<or> rstep l s j

goal (1 subgoal):
 1. i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j)
[PROOF STEP]
unfolding next_step_of_def j_def
[PROOF STATE]
proof (prove)
using this:
\<forall>l i. \<exists>j\<ge>i. \<not> can_step l (s j) \<or> rstep l s j

goal (1 subgoal):
 1. i \<le> (LEAST j. i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j)) \<and> (\<not> can_step l (s (LEAST j. i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j))) \<or> rstep l s (LEAST j. i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j)))
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>l i. \<exists>j\<ge>i. \<not> can_step l (s j) \<or> rstep l s j \<Longrightarrow> i \<le> (LEAST j. i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j)) \<and> (\<not> can_step l (s (LEAST j. i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j))) \<or> rstep l s (LEAST j. i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j)))
[PROOF STEP]
using LeastI_ex[where P="\<lambda>j. j\<ge>i \<and> (\<not>can_step l (s j) \<or> rstep l s j)"]
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<ge>i. \<not> can_step l (s x) \<or> rstep l s x \<Longrightarrow> i \<le> (LEAST j. i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j)) \<and> (\<not> can_step l (s (LEAST j. i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j))) \<or> rstep l s (LEAST j. i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j)))

goal (1 subgoal):
 1. \<forall>l i. \<exists>j\<ge>i. \<not> can_step l (s j) \<or> rstep l s j \<Longrightarrow> i \<le> (LEAST j. i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j)) \<and> (\<not> can_step l (s (LEAST j. i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j))) \<or> rstep l s (LEAST j. i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j)))
[PROOF STEP]
by (auto)


[STATEMENT]
lemma elem_in_image2: "\<lbrakk> f \<in> A \<rightarrow> B; A1 \<subseteq> A; x \<in> A1\<rbrakk> \<Longrightarrow> f x \<in> f` A1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; A1 \<subseteq> A; x \<in> A1\<rbrakk> \<Longrightarrow> f x \<in> f ` A1
[PROOF STEP]
apply (simp add:image_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; A1 \<subseteq> A; x \<in> A1\<rbrakk> \<Longrightarrow> \<exists>xa\<in>A1. f x = f xa
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in domain) var_pow_degree:
  fixes n :: nat
  assumes "subring K R"
  shows "degree (X\<^bsub>R\<^esub> [^]\<^bsub>K [X]\<^esub> n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (X [^]\<^bsub>K [X]\<^esub> n) = n
[PROOF STEP]
using var_carr[OF assms(1)] degree_var
[PROOF STATE]
proof (prove)
using this:
X \<in> carrier (K [X]) - {\<zero>\<^bsub>K [X]\<^esub>}
degree X = 1

goal (1 subgoal):
 1. degree (X [^]\<^bsub>K [X]\<^esub> n) = n
[PROOF STEP]
by (subst degree_pow[OF assms(1)], auto)


[STATEMENT]
lemma ex_in_list [iff]:
  "(\<exists>n. ST \<in> nlists n A \<and> n \<le> mxs) = (set ST \<subseteq> A \<and> size ST \<le> mxs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>n. ST \<in> nlists n A \<and> n \<le> mxs) = (set ST \<subseteq> A \<and> length ST \<le> mxs)
[PROOF STEP]
by (unfold nlists_def) auto


[STATEMENT]
lemma subs_trans: "\<lbrakk>subs L1 L2; subs L2 L3\<rbrakk> \<Longrightarrow> subs L1 L3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>subs L1 L2; subs L2 L3\<rbrakk> \<Longrightarrow> subs L1 L3
[PROOF STEP]
unfolding subs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>ts2\<in>L2. \<exists>ts1\<in>L1. ts1 \<subseteq> ts2; \<forall>ts2\<in>L3. \<exists>ts1\<in>L2. ts1 \<subseteq> ts2\<rbrakk> \<Longrightarrow> \<forall>ts2\<in>L3. \<exists>ts1\<in>L1. ts1 \<subseteq> ts2
[PROOF STEP]
by (metis subset_trans)


[STATEMENT]
lemma finite_support_one_oc:
  assumes "card outcomes = 1"
  shows "\<forall>l \<in> lotteries_on outcomes. finite (set_pmf l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>l\<in>lotteries_on outcomes. finite (set_pmf l)
[PROOF STEP]
by (metis assms card.infinite finite_subset lotteries_on_def mem_Collect_eq zero_neq_one)


[STATEMENT]
lemma nFAND_conjuncts: "nf_ACI \<psi> \<Longrightarrow> nFAND (conjuncts_list \<psi>) = \<psi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nf_ACI \<psi> \<Longrightarrow> nFAND (conjuncts_list \<psi>) = \<psi>
[PROOF STEP]
by (induct \<psi>) (auto simp: juncts_list_singleton nFAND_Cons)


[STATEMENT]
lemma bl_and_aux_bin:
  "map2 (\<and>) (bin_to_bl_aux n v bs) (bin_to_bl_aux n w cs) =
    bin_to_bl_aux n (v AND w) (map2 (\<and>) bs cs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map2 (\<and>) (bin_to_bl_aux n v bs) (bin_to_bl_aux n w cs) = bin_to_bl_aux n (v AND w) (map2 (\<and>) bs cs)
[PROOF STEP]
by (induction n arbitrary: v w bs cs) simp_all


[STATEMENT]
lemma mset_add_plus:
  assumes "m = n + k"
  shows "add_mset x m = (add_mset x n) + k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add_mset x m = add_mset x n + k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m = n + k

goal (1 subgoal):
 1. add_mset x m = add_mset x n + k
[PROOF STEP]
by simp


[STATEMENT]
lemma dist_triangle_half_r: "dist y x1 < e / 2 \<Longrightarrow> dist y x2 < e / 2 \<Longrightarrow> dist x1 x2 < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>dist y x1 < e / 2; dist y x2 < e / 2\<rbrakk> \<Longrightarrow> dist x1 x2 < e
[PROOF STEP]
by (rule dist_triangle_half_l) (simp_all add: dist_commute)


[STATEMENT]
lemma equalityI':
  assumes "\<And>x. x \<in> A \<Longrightarrow> x \<in> B"
  assumes "\<And>x. x \<in> B \<Longrightarrow> x \<in> A"
  shows "A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> A \<Longrightarrow> ?x \<in> B
?x \<in> B \<Longrightarrow> ?x \<in> A

goal (1 subgoal):
 1. A = B
[PROOF STEP]
by blast


[STATEMENT]
lemma distinct_sorted_rev: "sorted (rev xs) \<Longrightarrow> distinct xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorted_Less.sorted (rev xs) \<Longrightarrow> distinct xs
[PROOF STEP]
by (induct xs) (auto simp add:sorted_wrt_append)


[STATEMENT]
lemma map_rev_lists_rev:  "map rev ` (lists (rev ` A)) = lists A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map rev ` lists (rev ` A) = lists A
[PROOF STEP]
unfolding lists_image[of rev] image_comp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (map rev \<circ> map rev) ` lists A = lists A
[PROOF STEP]
by (simp add: rev_involution')


[STATEMENT]
lemma atLeastAtMost_iff[simp]: "(i \<in> {l\<le>\<^sub>a..\<le>\<^sub>au}) = (l \<le>\<^sub>a i \<and> i \<le>\<^sub>a u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i \<in> {l\<le>\<^sub>a..\<le>\<^sub>au}) = (l \<le>\<^sub>a i \<and> i \<le>\<^sub>a u)
[PROOF STEP]
unfolding interval_def ray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i \<in> {x \<in> UNIV. l \<le>\<^sub>a x} \<inter> {x \<in> UNIV. x \<le>\<^sub>a u}) = (l \<le>\<^sub>a i \<and> i \<le>\<^sub>a u)
[PROOF STEP]
by simp


[STATEMENT]
theorem residue_hurwitz_zeta:
  assumes "a > 0"
  shows   "residue (hurwitz_zeta a) 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue (hurwitz_zeta a) 1 = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. residue (hurwitz_zeta a) 1 = 1
[PROOF STEP]
note holo = analytic_imp_holomorphic[OF analytic_pre_zeta]
[PROOF STATE]
proof (state)
this:
0 < ?a1 \<Longrightarrow> pre_zeta ?a1 holomorphic_on ?S

goal (1 subgoal):
 1. residue (hurwitz_zeta a) 1 = 1
[PROOF STEP]
have "residue (hurwitz_zeta a) 1 = residue (\<lambda>z. pre_zeta a z + a powr (1 - z) / (z - 1)) 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue (hurwitz_zeta a) 1 = residue (\<lambda>z. pre_zeta a z + complex_of_real a powr (1 - z) / (z - 1)) 1
[PROOF STEP]
by (intro residue_cong) (auto simp: eventually_at_filter hurwitz_zeta_def)
[PROOF STATE]
proof (state)
this:
residue (hurwitz_zeta a) 1 = residue (\<lambda>z. pre_zeta a z + complex_of_real a powr (1 - z) / (z - 1)) 1

goal (1 subgoal):
 1. residue (hurwitz_zeta a) 1 = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
residue (hurwitz_zeta a) 1 = residue (\<lambda>z. pre_zeta a z + complex_of_real a powr (1 - z) / (z - 1)) 1

goal (1 subgoal):
 1. residue (hurwitz_zeta a) 1 = 1
[PROOF STEP]
have "\<dots> = residue (\<lambda>z. a powr (1 - z) / (z - 1)) 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue (\<lambda>z. pre_zeta a z + complex_of_real a powr (1 - z) / (z - 1)) 1 = residue (\<lambda>z. complex_of_real a powr (1 - z) / (z - 1)) 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. residue (\<lambda>z. pre_zeta a z + complex_of_real a powr (1 - z) / (z - 1)) 1 = residue (\<lambda>z. complex_of_real a powr (1 - z) / (z - 1)) 1
[PROOF STEP]
by (subst residue_add [of UNIV])
       (auto intro!: holomorphic_intros holo intro: residue_holo[of UNIV, OF _ _ holo])
[PROOF STATE]
proof (state)
this:
residue (\<lambda>z. pre_zeta a z + complex_of_real a powr (1 - z) / (z - 1)) 1 = residue (\<lambda>z. complex_of_real a powr (1 - z) / (z - 1)) 1

goal (1 subgoal):
 1. residue (hurwitz_zeta a) 1 = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
residue (\<lambda>z. pre_zeta a z + complex_of_real a powr (1 - z) / (z - 1)) 1 = residue (\<lambda>z. complex_of_real a powr (1 - z) / (z - 1)) 1

goal (1 subgoal):
 1. residue (hurwitz_zeta a) 1 = 1
[PROOF STEP]
have "\<dots> = complex_of_real a powr (1 - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue (\<lambda>z. complex_of_real a powr (1 - z) / (z - 1)) 1 = complex_of_real a powr (1 - 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. residue (\<lambda>z. complex_of_real a powr (1 - z) / (z - 1)) 1 = complex_of_real a powr (1 - 1)
[PROOF STEP]
by (intro residue_simple [of UNIV]) (auto intro!: holomorphic_intros)
[PROOF STATE]
proof (state)
this:
residue (\<lambda>z. complex_of_real a powr (1 - z) / (z - 1)) 1 = complex_of_real a powr (1 - 1)

goal (1 subgoal):
 1. residue (hurwitz_zeta a) 1 = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
residue (\<lambda>z. complex_of_real a powr (1 - z) / (z - 1)) 1 = complex_of_real a powr (1 - 1)

goal (1 subgoal):
 1. residue (hurwitz_zeta a) 1 = 1
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < a
[PROOF STEP]
have "\<dots> = 1"
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. complex_of_real a powr (1 - 1) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
complex_of_real a powr (1 - 1) = 1

goal (1 subgoal):
 1. residue (hurwitz_zeta a) 1 = 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
residue (hurwitz_zeta a) 1 = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
residue (hurwitz_zeta a) 1 = 1

goal (1 subgoal):
 1. residue (hurwitz_zeta a) 1 = 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
residue (hurwitz_zeta a) 1 = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hmset_of_enat_le_\<omega>[simp]: "hmset_of_enat n \<le> \<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hmset_of_enat n \<le> \<omega>
[PROOF STEP]
using of_nat_lt_\<omega>[THEN less_imp_le]
[PROOF STATE]
proof (prove)
using this:
of_nat ?n1 \<le> \<omega>

goal (1 subgoal):
 1. hmset_of_enat n \<le> \<omega>
[PROOF STEP]
by (cases n) auto


[STATEMENT]
lemma set_integrable_scaleR_right [simp, intro]:
  shows "(a \<noteq> 0 \<Longrightarrow> set_integrable M A f) \<Longrightarrow> set_integrable M A (\<lambda>t. a *\<^sub>R f t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<noteq> 0 \<Longrightarrow> set_integrable M A f) \<Longrightarrow> set_integrable M A (\<lambda>t. a *\<^sub>R f t)
[PROOF STEP]
unfolding set_integrable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<noteq> 0 \<Longrightarrow> integrable M (\<lambda>x. indicat_real A x *\<^sub>R f x)) \<Longrightarrow> integrable M (\<lambda>x. indicat_real A x *\<^sub>R a *\<^sub>R f x)
[PROOF STEP]
unfolding scaleR_left_commute
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<noteq> 0 \<Longrightarrow> integrable M (\<lambda>x. indicat_real A x *\<^sub>R f x)) \<Longrightarrow> integrable M (\<lambda>x. a *\<^sub>R indicat_real A x *\<^sub>R f x)
[PROOF STEP]
by (rule integrable_scaleR_right)


[STATEMENT]
lemma partial_summation_sum_upto_strong:
  "((\<lambda>t. A t * f' t) has_integral (A x * f x - sum_upto (\<lambda>n. a n * f n) x)) {0..x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. A t * f' t) has_integral A x * f x - sum_upto (\<lambda>n. a n * f (real n)) x) {0..x}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>t. A t * f' t) has_integral A x * f x - sum_upto (\<lambda>n. a n * f (real n)) x) {0..x}
[PROOF STEP]
have "(\<Sum>n\<in>real -` {0<..x}. a n * f n) = sum_upto (\<lambda>n. a n * f n) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<in>real -` {0<..x}. a n * f (real n)) = sum_upto (\<lambda>n. a n * f (real n)) x
[PROOF STEP]
unfolding sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<in>real -` {0<..x}. a n * f (real n)) = (\<Sum>n\<in>{i. 0 < i \<and> real i \<le> x}. a n * f (real n))
[PROOF STEP]
by (intro sum.cong refl) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>real -` {0<..x}. a n * f (real n)) = sum_upto (\<lambda>n. a n * f (real n)) x

goal (1 subgoal):
 1. ((\<lambda>t. A t * f' t) has_integral A x * f x - sum_upto (\<lambda>n. a n * f (real n)) x) {0..x}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n\<in>real -` {0<..x}. a n * f (real n)) = sum_upto (\<lambda>n. a n * f (real n)) x

goal (1 subgoal):
 1. ((\<lambda>t. A t * f' t) has_integral A x * f x - sum_upto (\<lambda>n. a n * f (real n)) x) {0..x}
[PROOF STEP]
using partial_summation_strong[OF fin order.refl x deriv cont_f, of a]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n\<in>real -` {0<..x}. a n * f (real n)) = sum_upto (\<lambda>n. a n * f (real n)) x
(\<And>z. z \<in> {0..x} - X \<Longrightarrow> z \<in> {0..x} - X) \<Longrightarrow> ((\<lambda>t. sum_upto a t * f' t) has_integral sum_upto a x * f x - sum_upto a 0 * f 0 - (\<Sum>n\<in>real -` {0<..x}. a n * f (real n))) {0..x}

goal (1 subgoal):
 1. ((\<lambda>t. A t * f' t) has_integral A x * f x - sum_upto (\<lambda>n. a n * f (real n)) x) {0..x}
[PROOF STEP]
by (simp_all add: A_def)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. A t * f' t) has_integral A x * f x - sum_upto (\<lambda>n. a n * f (real n)) x) {0..x}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powrat_gt_zero:
  assumes "x > 0" shows "x pow\<^sub>\<rat> r > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x pow\<^sub>\<rat> r
[PROOF STEP]
proof (cases r)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>r = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> 0 < x pow\<^sub>\<rat> r
[PROOF STEP]
case (Fract a b)
[PROOF STATE]
proof (state)
this:
r = Fract a b
0 < b
coprime a b

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>r = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> 0 < x pow\<^sub>\<rat> r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r = Fract a b
0 < b
coprime a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r = Fract a b
0 < b
coprime a b

goal (1 subgoal):
 1. 0 < x pow\<^sub>\<rat> r
[PROOF STEP]
by (simp add: assms powrat_def)
[PROOF STATE]
proof (state)
this:
0 < x pow\<^sub>\<rat> r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eclose_sup [simp]: "eclose (a \<squnion> b) = eclose a \<squnion> eclose b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eclose (a \<squnion> b) = eclose a \<squnion> eclose b
[PROOF STEP]
proof (rule order_antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. eclose (a \<squnion> b) \<le> eclose a \<squnion> eclose b
 2. eclose a \<squnion> eclose b \<le> eclose (a \<squnion> b)
[PROOF STEP]
show "eclose (a \<squnion> b) \<le> eclose a \<squnion> eclose b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eclose (a \<squnion> b) \<le> eclose a \<squnion> eclose b
[PROOF STEP]
by (metis Transset_eclose Transset_sup eclose_minimal le_eclose sup_mono)
[PROOF STATE]
proof (state)
this:
eclose (a \<squnion> b) \<le> eclose a \<squnion> eclose b

goal (1 subgoal):
 1. eclose a \<squnion> eclose b \<le> eclose (a \<squnion> b)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eclose a \<squnion> eclose b \<le> eclose (a \<squnion> b)
[PROOF STEP]
show "eclose a \<squnion> eclose b \<le> eclose (a \<squnion> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eclose a \<squnion> eclose b \<le> eclose (a \<squnion> b)
[PROOF STEP]
by (metis Transset_eclose eclose_minimal le_eclose le_sup_iff)
[PROOF STATE]
proof (state)
this:
eclose a \<squnion> eclose b \<le> eclose (a \<squnion> b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_ex_and1:
  assumes "finite {b. \<exists>a. P a b}" (is "finite ?A")
  shows "finite {b. \<exists>a. P a b \<and> Q a b}" (is "finite ?B")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {b. \<exists>a. P a b \<and> Q a b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {b. \<exists>a. P a b \<and> Q a b}
[PROOF STEP]
have "?B \<subseteq> ?A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {b. \<exists>a. P a b \<and> Q a b} \<subseteq> {b. \<exists>a. P a b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{b. \<exists>a. P a b \<and> Q a b} \<subseteq> {b. \<exists>a. P a b}

goal (1 subgoal):
 1. finite {b. \<exists>a. P a b \<and> Q a b}
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite {b. \<exists>a. P a b}
{b. \<exists>a. P a b \<and> Q a b} \<subseteq> {b. \<exists>a. P a b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite {b. \<exists>a. P a b}
{b. \<exists>a. P a b \<and> Q a b} \<subseteq> {b. \<exists>a. P a b}

goal (1 subgoal):
 1. finite {b. \<exists>a. P a b \<and> Q a b}
[PROOF STEP]
by (blast intro: finite_subset)
[PROOF STATE]
proof (state)
this:
finite {b. \<exists>a. P a b \<and> Q a b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mix_pmf_comp_with_dif_equiv:
  assumes "\<alpha> \<in> {0..(1::real)}"
    and "\<beta> \<in> {0..(1::real)}"
  assumes "\<alpha> > \<beta>"
  shows "mix_pmf (\<beta>/\<alpha>) (mix_pmf \<alpha> p q) q = mix_pmf \<beta> p q" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q = mix_pmf \<beta> p q
[PROOF STEP]
proof (rule pmf_equiv_intro1[symmetric])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. e \<in> set_pmf (mix_pmf \<beta> p q) \<Longrightarrow> pmf (mix_pmf \<beta> p q) e = pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e
[PROOF STEP]
fix e
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. e \<in> set_pmf (mix_pmf \<beta> p q) \<Longrightarrow> pmf (mix_pmf \<beta> p q) e = pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e
[PROOF STEP]
assume a: "e \<in> set_pmf ?r"
[PROOF STATE]
proof (state)
this:
e \<in> set_pmf (mix_pmf \<beta> p q)

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

goal (1 subgoal):
 1. e \<in> set_pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q)
[PROOF STEP]
by (metis assms(1) assms(2) assms(3) mix_pmf_comp_left_div pmf_eq_0_set_pmf)
[PROOF STATE]
proof (state)
this:
e \<in> set_pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q)

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

goal (1 subgoal):
 1. pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e - \<beta> * pmf q e + pmf q e
[PROOF STEP]
using pmf_mix_deeper[of "\<beta>/\<alpha>" p q e] mix_pmf_comp_left_div[of \<alpha> \<beta> p q e] assms
[PROOF STATE]
proof (prove)
using this:
e \<in> set_pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q)
\<beta> / \<alpha> \<in> {0..1} \<Longrightarrow> pmf (mix_pmf (\<beta> / \<alpha>) p q) e = \<beta> / \<alpha> * pmf p e + pmf q e - \<beta> / \<alpha> * pmf q e
\<lbrakk>\<alpha> \<in> {0..1}; \<beta> \<in> {0..1}; \<beta> < \<alpha>\<rbrakk> \<Longrightarrow> pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e = \<beta> * pmf p e + pmf q e - \<beta> * pmf q e
\<alpha> \<in> {0..1}
\<beta> \<in> {0..1}
\<beta> < \<alpha>

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

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

goal (1 subgoal):
 1. pmf (mix_pmf \<beta> p q) e = pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e
[PROOF STEP]
by (metis (full_types) assms(1) assms(2) assms(3) mix_pmf_comp_left_div pmf_mix_deeper)
[PROOF STATE]
proof (state)
this:
pmf (mix_pmf \<beta> p q) e = pmf (mix_pmf (\<beta> / \<alpha>) (mix_pmf \<alpha> p q) q) e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cos_arctan_not_zero [simp]: "cos (arctan x) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (arctan x) \<noteq> 0
[PROOF STEP]
by (intro less_imp_neq [symmetric] cos_gt_zero_pi arctan_lbound arctan_ubound)


[STATEMENT]
lemma closed_Int [continuous_intros, intro]: "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<inter> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>closed S; closed T\<rbrakk> \<Longrightarrow> closed (S \<inter> T)
[PROOF STEP]
unfolding closed_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>open (- S); open (- T)\<rbrakk> \<Longrightarrow> open (- (S \<inter> T))
[PROOF STEP]
by auto


[STATEMENT]
lemma going_to_inf:
  "f going_to (inf F G) within A = inf (f going_to F within A) (f going_to G within A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f going_to inf F G within A = inf (f going_to F within A) (f going_to G within A)
[PROOF STEP]
by (simp add: going_to_within_def filtercomap_inf inf_assoc inf_commute inf_left_commute)


[STATEMENT]
lemma list_ex2_iff:
  "list_ex2 P xs ys \<longleftrightarrow> (\<not>list_all2 (-P) (take (length ys) xs) (take (length xs) ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_ex2 P xs ys = (\<not> list_all2 (- P) (take (length ys) xs) (take (length xs) ys))
[PROOF STEP]
by (induction P xs ys rule: list_ex2.induct) auto


[STATEMENT]
lemma TR_inj_inj:"\<lbrakk>\<forall>l\<le> (Suc n). f l \<le> (Suc n); inj_on f {i. i \<le> (Suc n)};
                    i \<le> (Suc n); j \<le> (Suc n); i < j \<rbrakk> \<Longrightarrow>
      inj_on (compose {i. i \<le> (Suc n)} (transpos i j) f) {i. i \<le> (Suc n)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>l\<le>Suc n. f l \<le> Suc n; inj_on f {i. i \<le> Suc n}; i \<le> Suc n; j \<le> Suc n; i < j\<rbrakk> \<Longrightarrow> inj_on (compose {i. i \<le> Suc n} (transpos i j) f) {i. i \<le> Suc n}
[PROOF STEP]
apply (frule transpos_inj[of i "Suc n" j], assumption+,
       simp )
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>l\<le>Suc n. f l \<le> Suc n; inj_on f {i. i \<le> Suc n}; i \<le> Suc n; j \<le> Suc n; i < j; inj_on (transpos i j) {i. i \<le> Suc n}\<rbrakk> \<Longrightarrow> inj_on (compose {i. i \<le> Suc n} (transpos i j) f) {i. i \<le> Suc n}
[PROOF STEP]
apply (rule  comp_inj [of f "{i. i \<le> (Suc n)}" "{i. i \<le> (Suc n)}"
             "transpos i j" "{i. i \<le> (Suc n)}"])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>\<forall>l\<le>Suc n. f l \<le> Suc n; inj_on f {i. i \<le> Suc n}; i \<le> Suc n; j \<le> Suc n; i < j; inj_on (transpos i j) {i. i \<le> Suc n}\<rbrakk> \<Longrightarrow> f \<in> {i. i \<le> Suc n} \<rightarrow> {i. i \<le> Suc n}
 2. \<lbrakk>\<forall>l\<le>Suc n. f l \<le> Suc n; inj_on f {i. i \<le> Suc n}; i \<le> Suc n; j \<le> Suc n; i < j; inj_on (transpos i j) {i. i \<le> Suc n}\<rbrakk> \<Longrightarrow> inj_on f {i. i \<le> Suc n}
 3. \<lbrakk>\<forall>l\<le>Suc n. f l \<le> Suc n; inj_on f {i. i \<le> Suc n}; i \<le> Suc n; j \<le> Suc n; i < j; inj_on (transpos i j) {i. i \<le> Suc n}\<rbrakk> \<Longrightarrow> transpos i j \<in> {i. i \<le> Suc n} \<rightarrow> {i. i \<le> Suc n}
 4. \<lbrakk>\<forall>l\<le>Suc n. f l \<le> Suc n; inj_on f {i. i \<le> Suc n}; i \<le> Suc n; j \<le> Suc n; i < j; inj_on (transpos i j) {i. i \<le> Suc n}\<rbrakk> \<Longrightarrow> inj_on (transpos i j) {i. i \<le> Suc n}
[PROOF STEP]
apply (simp, assumption,
        rule transpos_hom[of i "Suc n" j], simp+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in ergodic_pmpt) birkhoff_negative_average:
      fixes f::"'a \<Rightarrow> real"
  assumes [measurable]: "integrable M f" and "AE x in M. (\<lambda>n. birkhoff_sum f n x) \<longlonglongrightarrow> -\<infinity>"
  shows "(\<integral> x. f x \<partial>M) < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation f < 0
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
assume "\<not>((\<integral> x. f x \<partial>M) < 0)"
[PROOF STATE]
proof (state)
this:
\<not> expectation f < 0

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> expectation f < 0
[PROOF STEP]
have *: "(\<integral> x. f x \<partial>M) \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
\<not> expectation f < 0

goal (1 subgoal):
 1. 0 \<le> expectation f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> expectation f

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
have "AE x in M. (\<lambda>n. birkhoff_sum f n x) \<longlonglongrightarrow> -\<infinity> \<and> infinite {n. birkhoff_sum f n x \<in> {n * (\<integral>x. f x \<partial>M) .. n* (\<integral>x. f x \<partial>M) + 1}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. (\<lambda>xa. ereal (birkhoff_sum f xa x)) \<longlonglongrightarrow> - \<infinity> \<and> infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + 1}}
[PROOF STEP]
using assms(2) birkhoff_sum_small_asymp_pos[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
AE x in M. (\<lambda>xa. ereal (birkhoff_sum f xa x)) \<longlonglongrightarrow> - \<infinity>
0 < ?e \<Longrightarrow> AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + ?e}}

goal (1 subgoal):
 1. AE x in M. (\<lambda>xa. ereal (birkhoff_sum f xa x)) \<longlonglongrightarrow> - \<infinity> \<and> infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + 1}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in M. (\<lambda>xa. ereal (birkhoff_sum f xa x)) \<longlonglongrightarrow> - \<infinity> \<and> infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + 1}}

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
AE x in M. (\<lambda>xa. ereal (birkhoff_sum f xa x)) \<longlonglongrightarrow> - \<infinity> \<and> infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + 1}}
[PROOF STEP]
obtain x where x: "(\<lambda>n. birkhoff_sum f n x) \<longlonglongrightarrow> -\<infinity>" "infinite {n. birkhoff_sum f n x \<in> {n * (\<integral>x. f x \<partial>M) .. n* (\<integral>x. f x \<partial>M) + 1}}"
[PROOF STATE]
proof (prove)
using this:
AE x in M. (\<lambda>xa. ereal (birkhoff_sum f xa x)) \<longlonglongrightarrow> - \<infinity> \<and> infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + 1}}

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>(\<lambda>xa. ereal (birkhoff_sum f xa x)) \<longlonglongrightarrow> - \<infinity>; infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + 1}}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using AE_False eventually_elim2
[PROOF STATE]
proof (prove)
using this:
AE x in M. (\<lambda>xa. ereal (birkhoff_sum f xa x)) \<longlonglongrightarrow> - \<infinity> \<and> infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + 1}}
(AE x in M. False) = False
\<lbrakk>eventually ?P ?F; eventually ?Q ?F; \<And>i. \<lbrakk>?P i; ?Q i\<rbrakk> \<Longrightarrow> ?R i\<rbrakk> \<Longrightarrow> eventually ?R ?F

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>(\<lambda>xa. ereal (birkhoff_sum f xa x)) \<longlonglongrightarrow> - \<infinity>; infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + 1}}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>xa. ereal (birkhoff_sum f xa x)) \<longlonglongrightarrow> - \<infinity>
infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + 1}}

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(\<lambda>xa. ereal (birkhoff_sum f xa x)) \<longlonglongrightarrow> - \<infinity>
infinite {n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + 1}}

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
assume "birkhoff_sum f n x \<in> {n * (\<integral>x. f x \<partial>M) .. n * (\<integral>x. f x \<partial>M) + 1}"
[PROOF STATE]
proof (state)
this:
birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + 1}

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + 1}
[PROOF STEP]
have "birkhoff_sum f n x \<ge> n * (\<integral>x. f x \<partial>M)"
[PROOF STATE]
proof (prove)
using this:
birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + 1}

goal (1 subgoal):
 1. real n * expectation f \<le> birkhoff_sum f n x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real n * expectation f \<le> birkhoff_sum f n x

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real n * expectation f \<le> birkhoff_sum f n x

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
have "n * (\<integral>x. f x \<partial>M) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> real n * expectation f
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
0 \<le> expectation f

goal (1 subgoal):
 1. 0 \<le> real n * expectation f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> real n * expectation f

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real n * expectation f \<le> birkhoff_sum f n x
0 \<le> real n * expectation f
[PROOF STEP]
have "birkhoff_sum f n x \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
real n * expectation f \<le> birkhoff_sum f n x
0 \<le> real n * expectation f

goal (1 subgoal):
 1. 0 \<le> birkhoff_sum f n x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> birkhoff_sum f n x

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
birkhoff_sum f ?n14 x \<in> {real ?n14 * expectation f..real ?n14 * expectation f + 1} \<Longrightarrow> 0 \<le> birkhoff_sum f ?n14 x

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
birkhoff_sum f ?n14 x \<in> {real ?n14 * expectation f..real ?n14 * expectation f + 1} \<Longrightarrow> 0 \<le> birkhoff_sum f ?n14 x
[PROOF STEP]
have "{n. birkhoff_sum f n x \<in> {n * (\<integral>x. f x \<partial>M) .. n* (\<integral>x. f x \<partial>M) + 1}} \<subseteq> {n. birkhoff_sum f n x \<ge> 0}"
[PROOF STATE]
proof (prove)
using this:
birkhoff_sum f ?n14 x \<in> {real ?n14 * expectation f..real ?n14 * expectation f + 1} \<Longrightarrow> 0 \<le> birkhoff_sum f ?n14 x

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

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + 1}} \<subseteq> {n. 0 \<le> birkhoff_sum f n x}
[PROOF STEP]
have inf: "infinite {n. birkhoff_sum f n x \<ge> 0}"
[PROOF STATE]
proof (prove)
using this:
{n. birkhoff_sum f n x \<in> {real n * expectation f..real n * expectation f + 1}} \<subseteq> {n. 0 \<le> birkhoff_sum f n x}

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

goal (1 subgoal):
 1. infinite {n. 0 \<le> birkhoff_sum f n x}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
infinite {n. 0 \<le> birkhoff_sum f n x}

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
have "0 > (-\<infinity>::ereal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - \<infinity> < 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- \<infinity> < 0

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- \<infinity> < 0
[PROOF STEP]
have "eventually (\<lambda>n. birkhoff_sum f n x < (0::ereal)) sequentially"
[PROOF STATE]
proof (prove)
using this:
- \<infinity> < 0

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. ereal (birkhoff_sum f n x) < 0
[PROOF STEP]
using x(1) order_tendsto_iff
[PROOF STATE]
proof (prove)
using this:
- \<infinity> < 0
(\<lambda>xa. ereal (birkhoff_sum f xa x)) \<longlonglongrightarrow> - \<infinity>
(?f \<longlongrightarrow> ?x) ?F = ((\<forall>l<?x. \<forall>\<^sub>F x in ?F. l < ?f x) \<and> (\<forall>u>?x. \<forall>\<^sub>F x in ?F. ?f x < u))

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. ereal (birkhoff_sum f n x) < 0
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. ereal (birkhoff_sum f n x) < 0

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. ereal (birkhoff_sum f n x) < 0
[PROOF STEP]
obtain N where "\<And>n. n \<ge> N \<Longrightarrow> birkhoff_sum f n x < (0::ereal)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. ereal (birkhoff_sum f n x) < 0

goal (1 subgoal):
 1. (\<And>N. (\<And>n. N \<le> n \<Longrightarrow> ereal (birkhoff_sum f n x) < 0) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson eventually_at_top_linorder)
[PROOF STATE]
proof (state)
this:
N \<le> ?n12 \<Longrightarrow> ereal (birkhoff_sum f ?n12 x) < 0

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
N \<le> ?n12 \<Longrightarrow> ereal (birkhoff_sum f ?n12 x) < 0
[PROOF STEP]
have "\<And>n. n \<ge> N \<Longrightarrow> birkhoff_sum f n x < 0"
[PROOF STATE]
proof (prove)
using this:
N \<le> ?n12 \<Longrightarrow> ereal (birkhoff_sum f ?n12 x) < 0

goal (1 subgoal):
 1. \<And>n. N \<le> n \<Longrightarrow> birkhoff_sum f n x < 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
N \<le> ?n12 \<Longrightarrow> birkhoff_sum f ?n12 x < 0

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
N \<le> ?n12 \<Longrightarrow> birkhoff_sum f ?n12 x < 0
[PROOF STEP]
have "{n. birkhoff_sum f n x \<ge> 0} \<subseteq> {..<N}"
[PROOF STATE]
proof (prove)
using this:
N \<le> ?n12 \<Longrightarrow> birkhoff_sum f ?n12 x < 0

goal (1 subgoal):
 1. {n. 0 \<le> birkhoff_sum f n x} \<subseteq> {..<N}
[PROOF STEP]
by (metis (mono_tags, lifting) lessThan_iff linorder_not_less mem_Collect_eq subsetI)
[PROOF STATE]
proof (state)
this:
{n. 0 \<le> birkhoff_sum f n x} \<subseteq> {..<N}

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{n. 0 \<le> birkhoff_sum f n x} \<subseteq> {..<N}
[PROOF STEP]
have "finite {n. birkhoff_sum f n x \<ge> 0}"
[PROOF STATE]
proof (prove)
using this:
{n. 0 \<le> birkhoff_sum f n x} \<subseteq> {..<N}

goal (1 subgoal):
 1. finite {n. 0 \<le> birkhoff_sum f n x}
[PROOF STEP]
using finite_nat_iff_bounded
[PROOF STATE]
proof (prove)
using this:
{n. 0 \<le> birkhoff_sum f n x} \<subseteq> {..<N}
finite ?S = (\<exists>k. ?S \<subseteq> {..<k})

goal (1 subgoal):
 1. finite {n. 0 \<le> birkhoff_sum f n x}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite {n. 0 \<le> birkhoff_sum f n x}

goal (1 subgoal):
 1. \<not> expectation f < 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite {n. 0 \<le> birkhoff_sum f n x}
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
finite {n. 0 \<le> birkhoff_sum f n x}

goal (1 subgoal):
 1. False
[PROOF STEP]
using inf
[PROOF STATE]
proof (prove)
using this:
finite {n. 0 \<le> birkhoff_sum f n x}
infinite {n. 0 \<le> birkhoff_sum f n x}

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cycle_free_altI:
  assumes "\<And>u v. \<lbrakk> (u,v)\<in>edges g; (u,v)\<in>(edges g - {(u,v),(v,u)})\<^sup>* \<rbrakk> \<Longrightarrow> False"
  shows "cycle_free g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cycle_free g
[PROOF STEP]
unfolding cycle_free_alt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>e\<in>edges g. e \<notin> (edges (restrict_edges g (- {e, prod.swap e})))\<^sup>*
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?u, ?v) \<in> edges g; (?u, ?v) \<in> (edges g - {(?u, ?v), (?v, ?u)})\<^sup>*\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. \<forall>e\<in>edges g. e \<notin> (edges (restrict_edges g (- {e, prod.swap e})))\<^sup>*
[PROOF STEP]
by (force)


[STATEMENT]
lemma of_nat_0: "of_nat m = (0::'a::len word) \<longleftrightarrow> (\<exists>q. m = q * 2 ^ LENGTH('a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (word_of_nat m = 0) = (\<exists>q. m = q * 2 ^ LENGTH('a))
[PROOF STEP]
by (simp add: of_nat_eq)


[STATEMENT]
lemma Ord_odiff_less_imp_less: "\<lbrakk>odiff x \<alpha> < odiff y \<alpha>; Ord x; Ord y\<rbrakk> \<Longrightarrow> x < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>odiff x \<alpha> < odiff y \<alpha>; Ord x; Ord y\<rbrakk> \<Longrightarrow> x < y
[PROOF STEP]
by (meson Ord_linear2 leD odiff_le_odiff vle_iff_le_Ord)


[STATEMENT]
lemma trans_iless_iadd2: "i < (j::enat) \<Longrightarrow> i < m + j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < j \<Longrightarrow> i < m + j
[PROOF STEP]
by (rule order_less_le_trans[OF _ ile_add2])


[STATEMENT]
lemma (in idom) irreducible_mult:
  shows "irreducible (a*b) \<longleftrightarrow> a dvd 1 \<and> irreducible b \<or> b dvd 1 \<and> irreducible a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irreducible (a * b) = (a dvd (1::'a) \<and> irreducible b \<or> b dvd (1::'a) \<and> irreducible a)
[PROOF STEP]
by (auto dest: irreducible_multD simp: irreducible_mult_unit_left irreducible_mult_unit_right)


[STATEMENT]
lemma (in finite_measure) integral_less_AE_space:
  fixes X Y :: "'a \<Rightarrow> real"
  assumes int: "integrable M X" "integrable M Y"
  assumes gt: "AE x in M. X x < Y x" "emeasure M (space M) \<noteq> 0"
  shows "integral\<^sup>L M X < integral\<^sup>L M Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L M X < integral\<^sup>L M Y
[PROOF STEP]
using gt
[PROOF STATE]
proof (prove)
using this:
AE x in M. X x < Y x
emeasure M (space M) \<noteq> 0

goal (1 subgoal):
 1. integral\<^sup>L M X < integral\<^sup>L M Y
[PROOF STEP]
by (intro integral_less_AE[OF int, where A="space M"]) auto


[STATEMENT]
lemma subdivide_lipschitz_lemma:
  assumes st: "s \<in> {a -- b}" "t \<in> {a -- b}"
  assumes "abs (b - a) \<le> abs (t1 - t0) / Suc subdivide_count"
  shows "\<bar>s - t\<bar> * L < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>s - t\<bar> * L < 1
[PROOF STEP]
apply (rule subdivide_lipschitz)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>s - t\<bar> \<le> \<bar>t1 - t0\<bar> / real (Suc subdivide_count)
[PROOF STEP]
apply (rule order_trans[where y="abs (b - a)"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<bar>s - t\<bar> \<le> \<bar>b - a\<bar>
 2. \<bar>b - a\<bar> \<le> \<bar>t1 - t0\<bar> / real (Suc subdivide_count)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
s \<in> {a--b}
t \<in> {a--b}
\<bar>b - a\<bar> \<le> \<bar>t1 - t0\<bar> / real (Suc subdivide_count)

goal (2 subgoals):
 1. \<bar>s - t\<bar> \<le> \<bar>b - a\<bar>
 2. \<bar>b - a\<bar> \<le> \<bar>t1 - t0\<bar> / real (Suc subdivide_count)
[PROOF STEP]
by (auto simp: closed_segment_eq_real_ivl split: if_splits)


[STATEMENT]
lemma rtrancl_last_visit': "\<lbrakk> (q,q')\<in>R\<^sup>*; (q,q')\<in>(R-UNIV\<times>S)\<^sup>* \<Longrightarrow> P; !!qt. \<lbrakk> qt\<in>S; (q,qt)\<in>R\<^sup>*; (qt,q')\<in>(R-UNIV\<times>S)\<^sup>* \<rbrakk> \<Longrightarrow> P \<rbrakk> \<Longrightarrow> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(q, q') \<in> R\<^sup>*; (q, q') \<in> (R - UNIV \<times> S)\<^sup>* \<Longrightarrow> P; \<And>qt. \<lbrakk>qt \<in> S; (q, qt) \<in> R\<^sup>*; (qt, q') \<in> (R - UNIV \<times> S)\<^sup>*\<rbrakk> \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P
[PROOF STEP]
by (induct rule: converse_rtrancl_induct) (auto intro: converse_rtrancl_into_rtrancl)


[STATEMENT]
lemma biQuots_rQuots_lQuots: "biQuots x y A = rQuots y (lQuots x A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. biQuots x y A = rQuots y (lQuots x A)
[PROOF STEP]
unfolding biQuots_def rQuots_def lQuots_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {zs. x @ zs @ rev y \<in> A} = {ys. ys @ rev y \<in> {ys. x @ ys \<in> A}}
[PROOF STEP]
by auto


[STATEMENT]
lemma atoms_PLUS: "atoms (PLUS xs) = (\<Union>r \<in> set xs. atoms r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. atoms (PLUS xs) = \<Union> (atoms ` set xs)
[PROOF STEP]
by (induct xs rule: list_singleton_induct) auto


[STATEMENT]
lemma gcd_diff1: "gcd (m - n) n = gcd m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (m - n) n = gcd m n
[PROOF STEP]
by (subst diff_conv_add_uminus, subst gcd_neg2[symmetric], subst gcd_add1, simp)


[STATEMENT]
lemma cUnion_cinsert: "cUnion (cinsert x A) = cUn x (cUnion A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cUnion (cinsert x A) = cUn x (cUnion A)
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma to_nat_eq_0: "(to_nat x = 0) = (x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mod_type_class.to_nat x = 0) = (x = (0::'a))
[PROOF STEP]
by (auto simp add: to_nat_0 from_nat_0 dest: to_nat_from_nat)


[STATEMENT]
lemma normal_form_plus_normal_form:
  "normal_form F (normal_form F p + normal_form F q) = normal_form F p + normal_form F q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normal_form F (normal_form F p + normal_form F q) = normal_form F p + normal_form F q
[PROOF STEP]
by (intro normal_form_unique rtranclp.rtrancl_refl punit.is_irred_plus normal_form)


[STATEMENT]
lemma one_minus_const_fps_X_neg_power'':
  fixes c :: "'a :: field_char_0"
  assumes n: "n > 0"
  shows "fps_const d / ((1 - fps_const (c :: 'a :: field_char_0) * fps_X) ^ n) =
           Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c^k)" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_const d / (1 - fps_const c * fps_X) ^ n = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k)
[PROOF STEP]
proof (rule fps_ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
include fps_notation
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
fix k :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
let ?p = "smult (d / (fact (n - 1))) (pcompose (pochhammer_poly (n - 1)) [:1,1:])"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "?lhs = fps_const d * inverse ((1 - fps_const c * fps_X) ^ n)"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. fps_const d / (1 - fps_const c * fps_X) ^ n = fps_const d * inverse ((1 - fps_const c * fps_X) ^ n)
[PROOF STEP]
by (subst fps_divide_unit) auto
[PROOF STATE]
proof (state)
this:
fps_const d / (1 - fps_const c * fps_X) ^ n = fps_const d * inverse ((1 - fps_const c * fps_X) ^ n)

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fps_const d / (1 - fps_const c * fps_X) ^ n = fps_const d * inverse ((1 - fps_const c * fps_X) ^ n)

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
have "inverse ((1 - fps_const c * fps_X) ^ n) =
                 Abs_fps (\<lambda>k. of_nat ((n + k - 1) choose k) * c^k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse ((1 - fps_const c * fps_X) ^ n) = Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k)
[PROOF STEP]
by (intro one_minus_const_fps_X_neg_power' n)
[PROOF STATE]
proof (state)
this:
inverse ((1 - fps_const c * fps_X) ^ n) = Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k)

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inverse ((1 - fps_const c * fps_X) ^ n) = Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k)

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
have "(fps_const d * \<dots>) $ k  = d * of_nat ((n + k - 1) choose k) * c^k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fps_const d * Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k)) $ k = d * of_nat (n + k - 1 choose k) * c ^ k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(fps_const d * Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k)) $ k = d * of_nat (n + k - 1 choose k) * c ^ k

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(fps_const d * Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k)) $ k = d * of_nat (n + k - 1 choose k) * c ^ k

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "(n + k - 1 choose k) = (n + k - 1 choose (n - 1))"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. n + k - 1 choose k = n + k - 1 choose (n - 1)
[PROOF STEP]
by (subst binomial_symmetric) simp_all
[PROOF STATE]
proof (state)
this:
n + k - 1 choose k = n + k - 1 choose (n - 1)

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n + k - 1 choose k = n + k - 1 choose (n - 1)

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "of_nat \<dots> = (pochhammer (of_nat k + 1) (n - 1) / fact (n - 1) :: 'a)"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. of_nat (n + k - 1 choose (n - 1)) = pochhammer (of_nat k + (1::'a)) (n - 1) / fact (n - 1)
[PROOF STEP]
by (simp_all add: binomial_gbinomial gbinomial_pochhammer' of_nat_diff)
[PROOF STATE]
proof (state)
this:
of_nat (n + k - 1 choose (n - 1)) = pochhammer (of_nat k + (1::'a)) (n - 1) / fact (n - 1)

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_nat (n + k - 1 choose (n - 1)) = pochhammer (of_nat k + (1::'a)) (n - 1) / fact (n - 1)

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
have "d * \<dots> = poly ?p (of_nat k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d * (pochhammer (of_nat k + (1::'a)) (n - 1) / fact (n - 1)) = poly (smult (d / fact (n - 1)) (pochhammer_poly (n - 1) \<circ>\<^sub>p [:1::'a, 1::'a:])) (of_nat k)
[PROOF STEP]
by (simp add: divide_inverse eval_pochhammer_poly poly_pcompose add_ac)
[PROOF STATE]
proof (state)
this:
d * (pochhammer (of_nat k + (1::'a)) (n - 1) / fact (n - 1)) = poly (smult (d / fact (n - 1)) (pochhammer_poly (n - 1) \<circ>\<^sub>p [:1::'a, 1::'a:])) (of_nat k)

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
d * (pochhammer (of_nat k + (1::'a)) (n - 1) / fact (n - 1)) = poly (smult (d / fact (n - 1)) (pochhammer_poly (n - 1) \<circ>\<^sub>p [:1::'a, 1::'a:])) (of_nat k)

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
d * (pochhammer (of_nat k + (1::'a)) (n - 1) / fact (n - 1)) = poly (smult (d / fact (n - 1)) (pochhammer_poly (n - 1) \<circ>\<^sub>p [:1::'a, 1::'a:])) (of_nat k)

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "pCons 0 (pcompose (pochhammer_poly (n-1)) [:1,1::'a:]) = pochhammer_poly n"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. pCons (0::'a) (pochhammer_poly (n - 1) \<circ>\<^sub>p [:1::'a, 1::'a:]) = pochhammer_poly n
[PROOF STEP]
by (subst pochhammer_poly_Suc' [symmetric]) simp
[PROOF STATE]
proof (state)
this:
pCons (0::'a) (pochhammer_poly (n - 1) \<circ>\<^sub>p [:1::'a, 1::'a:]) = pochhammer_poly n

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pCons (0::'a) (pochhammer_poly (n - 1) \<circ>\<^sub>p [:1::'a, 1::'a:]) = pochhammer_poly n

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "\<dots> = pCons 0 (Poly [of_nat (stirling n (k+1)). k \<leftarrow> [0..<Suc n]])"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. pochhammer_poly n = pCons (0::'a) (Poly (map (\<lambda>k. of_nat (stirling n (k + 1))) [0..<Suc n]))
[PROOF STEP]
unfolding pochhammer_poly_def
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. Poly (map (\<lambda>k. of_nat (stirling n k)) [0..<Suc n]) = pCons (0::'a) (Poly (map (\<lambda>k. of_nat (stirling n (k + 1))) [0..<Suc n]))
[PROOF STEP]
by (auto simp add: poly_eq_iff nth_default_def coeff_pCons
               split: nat.split simp del: upt_Suc )
[PROOF STATE]
proof (state)
this:
pochhammer_poly n = pCons (0::'a) (Poly (map (\<lambda>k. of_nat (stirling n (k + 1))) [0..<Suc n]))

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
pCons (0::'a) (pochhammer_poly (n - 1) \<circ>\<^sub>p [:1::'a, 1::'a:]) = pCons (0::'a) (Poly (map (\<lambda>k. of_nat (stirling n (k + 1))) [0..<Suc n]))
[PROOF STEP]
have "pcompose (pochhammer_poly (n-1)) [:1,1::'a:] =
                      Poly [of_nat (stirling n (k+1)). k \<leftarrow> [0..<Suc n]]"
[PROOF STATE]
proof (prove)
using this:
pCons (0::'a) (pochhammer_poly (n - 1) \<circ>\<^sub>p [:1::'a, 1::'a:]) = pCons (0::'a) (Poly (map (\<lambda>k. of_nat (stirling n (k + 1))) [0..<Suc n]))

goal (1 subgoal):
 1. pochhammer_poly (n - 1) \<circ>\<^sub>p [:1::'a, 1::'a:] = Poly (map (\<lambda>k. of_nat (stirling n (k + 1))) [0..<Suc n])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pochhammer_poly (n - 1) \<circ>\<^sub>p [:1::'a, 1::'a:] = Poly (map (\<lambda>k. of_nat (stirling n (k + 1))) [0..<Suc n])

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
pochhammer_poly (n - 1) \<circ>\<^sub>p [:1::'a, 1::'a:] = Poly (map (\<lambda>k. of_nat (stirling n (k + 1))) [0..<Suc n])

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pochhammer_poly (n - 1) \<circ>\<^sub>p [:1::'a, 1::'a:] = Poly (map (\<lambda>k. of_nat (stirling n (k + 1))) [0..<Suc n])

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
have "smult (d / fact (n - 1)) (Poly [of_nat (stirling n (k+1)). k \<leftarrow> [0..<Suc n]]) =
               inverse_irred_power_poly d n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (d / fact (n - 1)) (Poly (map (\<lambda>k. of_nat (stirling n (k + 1))) [0..<Suc n])) = inverse_irred_power_poly d n
[PROOF STEP]
by (auto simp: poly_eq_iff inverse_irred_power_poly_def nth_default_def)
[PROOF STATE]
proof (state)
this:
smult (d / fact (n - 1)) (Poly (map (\<lambda>k. of_nat (stirling n (k + 1))) [0..<Suc n])) = inverse_irred_power_poly d n

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
smult (d / fact (n - 1)) (Poly (map (\<lambda>k. of_nat (stirling n (k + 1))) [0..<Suc n])) = inverse_irred_power_poly d n

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
have "poly \<dots> (of_nat k) * c ^ k = ?rhs $ k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ k

goal (1 subgoal):
 1. \<And>na. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ na
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(fps_const d / (1 - fps_const c * fps_X) ^ n) $ k = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ k
[PROOF STEP]
show "?lhs $ k = ?rhs $ k"
[PROOF STATE]
proof (prove)
using this:
(fps_const d / (1 - fps_const c * fps_X) ^ n) $ k = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ k

goal (1 subgoal):
 1. (fps_const d / (1 - fps_const c * fps_X) ^ n) $ k = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ k
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(fps_const d / (1 - fps_const c * fps_X) ^ n) $ k = Abs_fps (\<lambda>k. poly (inverse_irred_power_poly d n) (of_nat k) * c ^ k) $ k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat_vec_as_mat_mat_mult: assumes A: "A \<in> carrier_mat nr nc"
  and v: "v \<in> carrier_vec nc"
shows "A *\<^sub>v v = col (A * mat_of_cols nc [v]) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>v v = col (A * mat_of_cols nc [v]) 0
[PROOF STEP]
by (subst col_mult2[OF A], insert v, auto)


[STATEMENT]
lemma eSuc_eint: "(eint n) + 1 = eint (n + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eint n + 1 = eint (n + 1)
[PROOF STEP]
by (simp add: one_eint_def)


[STATEMENT]
lemma in_mk_uedge_img_iff: "{a,b} \<in> mk_uedge ` A \<longleftrightarrow> (a,b) \<in> A \<or> (b,a) \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({a, b} \<in> mk_uedge ` A) = ((a, b) \<in> A \<or> (b, a) \<in> A)
[PROOF STEP]
by (auto simp: doubleton_eq_iff intro: rev_image_eqI)


[STATEMENT]
lemma max_list_mono: \<open>set xs \<subseteq> set ys \<Longrightarrow> max_list xs \<le> max_list ys\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set xs \<subseteq> set ys \<Longrightarrow> max_list xs \<le> max_list ys
[PROOF STEP]
using max_list_max max_list_in_Cons
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set ?xs. x \<le> max_list ?xs
?xs \<noteq> [] \<Longrightarrow> max_list ?xs \<in> set ?xs

goal (1 subgoal):
 1. set xs \<subseteq> set ys \<Longrightarrow> max_list xs \<le> max_list ys
[PROOF STEP]
by (metis less_nat_zero_code linorder_not_le max_list.simps(1) subset_code(1))


[STATEMENT]
lemma inf_closed_cl_op_var: "x \<in> range cl_op \<Longrightarrow> y \<in> range cl_op \<Longrightarrow> x \<sqinter> y \<in> range cl_op"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> range cl_op; y \<in> range cl_op\<rbrakk> \<Longrightarrow> x \<sqinter> y \<in> range cl_op
[PROOF STEP]
by (smt Inf_closed_cl_op_var UnI1 insert_iff insert_is_Un inf_Inf)


[STATEMENT]
lemma bij_domain_PiE:
  assumes "bij_betw f A1 A2"
    and "g \<in> A2 \<rightarrow>\<^sub>E B"
  shows "(restrict (g \<circ> f) A1) \<in> A1 \<rightarrow>\<^sub>E B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. restrict (g \<circ> f) A1 \<in> A1 \<rightarrow>\<^sub>E B
[PROOF STEP]
using bij_betwE assms
[PROOF STATE]
proof (prove)
using this:
bij_betw ?f ?A ?B \<Longrightarrow> \<forall>a\<in>?A. ?f a \<in> ?B
bij_betw f A1 A2
g \<in> A2 \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. restrict (g \<circ> f) A1 \<in> A1 \<rightarrow>\<^sub>E B
[PROOF STEP]
by fastforce


[STATEMENT]
lemma subdivision_comb_planar:
  assumes "subdivision (G, rev_G) (H, rev_H)" "comb_planar H" shows "comb_planar G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comb_planar G
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
subdivision (G, rev_G) (H, rev_H)
comb_planar H

goal (1 subgoal):
 1. comb_planar G
[PROOF STEP]
unfolding comb_planar_def
[PROOF STATE]
proof (prove)
using this:
subdivision (G, rev_G) (H, rev_H)
\<exists>M. digraph_map H M \<and> pre_digraph_map.euler_genus H M = 0

goal (1 subgoal):
 1. \<exists>M. digraph_map G M \<and> pre_digraph_map.euler_genus G M = 0
[PROOF STEP]
by (metis subdivision_genus)


[STATEMENT]
lemma (in domain) is_root_poly_mult_imp_is_root:
  assumes "p \<in> carrier (poly_ring R)" and "q \<in> carrier (poly_ring R)"
  shows "is_root (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x \<Longrightarrow> (is_root p x) \<or> (is_root q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_root (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x \<Longrightarrow> is_root p x \<or> is_root q x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_root (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x \<Longrightarrow> is_root p x \<or> is_root q x
[PROOF STEP]
interpret UP: domain "poly_ring R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. domain (poly_ring R)
[PROOF STEP]
using univ_poly_is_domain[OF carrier_is_subring]
[PROOF STATE]
proof (prove)
using this:
domain (poly_ring R)

goal (1 subgoal):
 1. domain (poly_ring R)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_root (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x \<Longrightarrow> is_root p x \<or> is_root q x
[PROOF STEP]
assume is_root: "is_root (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x"
[PROOF STATE]
proof (state)
this:
is_root (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x

goal (1 subgoal):
 1. is_root (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x \<Longrightarrow> is_root p x \<or> is_root q x
[PROOF STEP]
hence "p \<noteq> []" and "q \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
is_root (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x

goal (1 subgoal):
 1. p \<noteq> [] &&& q \<noteq> []
[PROOF STEP]
unfolding is_root_def sym[OF univ_poly_zero[of R "carrier R"]]
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R \<and> local.eval (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x = \<zero> \<and> p \<otimes>\<^bsub>poly_ring R\<^esub> q \<noteq> \<zero>\<^bsub>poly_ring R\<^esub>

goal (1 subgoal):
 1. p \<noteq> \<zero>\<^bsub>poly_ring R\<^esub> &&& q \<noteq> \<zero>\<^bsub>poly_ring R\<^esub>
[PROOF STEP]
using UP.l_null[OF assms(2)] UP.r_null[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R \<and> local.eval (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x = \<zero> \<and> p \<otimes>\<^bsub>poly_ring R\<^esub> q \<noteq> \<zero>\<^bsub>poly_ring R\<^esub>
\<zero>\<^bsub>poly_ring R\<^esub> \<otimes>\<^bsub>poly_ring R\<^esub> q = \<zero>\<^bsub>poly_ring R\<^esub>
p \<otimes>\<^bsub>poly_ring R\<^esub> \<zero>\<^bsub>poly_ring R\<^esub> = \<zero>\<^bsub>poly_ring R\<^esub>

goal (1 subgoal):
 1. p \<noteq> \<zero>\<^bsub>poly_ring R\<^esub> &&& q \<noteq> \<zero>\<^bsub>poly_ring R\<^esub>
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
p \<noteq> []
q \<noteq> []

goal (1 subgoal):
 1. is_root (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x \<Longrightarrow> is_root p x \<or> is_root q x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p \<noteq> []
q \<noteq> []

goal (1 subgoal):
 1. is_root (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x \<Longrightarrow> is_root p x \<or> is_root q x
[PROOF STEP]
have x: "x \<in> carrier R" and "eval (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x = \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier R &&& local.eval (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x = \<zero>
[PROOF STEP]
using is_root
[PROOF STATE]
proof (prove)
using this:
is_root (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x

goal (1 subgoal):
 1. x \<in> carrier R &&& local.eval (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x = \<zero>
[PROOF STEP]
unfolding is_root_def
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R \<and> local.eval (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x = \<zero> \<and> p \<otimes>\<^bsub>poly_ring R\<^esub> q \<noteq> []

goal (1 subgoal):
 1. x \<in> carrier R &&& local.eval (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x = \<zero>
[PROOF STEP]
by simp+
[PROOF STATE]
proof (state)
this:
x \<in> carrier R
local.eval (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x = \<zero>

goal (1 subgoal):
 1. is_root (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x \<Longrightarrow> is_root p x \<or> is_root q x
[PROOF STEP]
hence "eval p x = \<zero> \<or> eval q x = \<zero>"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R
local.eval (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x = \<zero>

goal (1 subgoal):
 1. local.eval p x = \<zero> \<or> local.eval q x = \<zero>
[PROOF STEP]
using ring_hom_memE[OF eval_is_hom[OF carrier_is_subring], of x] assms integral
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R
local.eval (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x = \<zero>
\<lbrakk>x \<in> carrier R; ?x \<in> carrier (poly_ring R)\<rbrakk> \<Longrightarrow> local.eval ?x x \<in> carrier R
\<lbrakk>x \<in> carrier R; ?x \<in> carrier (poly_ring R); ?y \<in> carrier (poly_ring R)\<rbrakk> \<Longrightarrow> local.eval (?x \<otimes>\<^bsub>poly_ring R\<^esub> ?y) x = local.eval ?x x \<otimes> local.eval ?y x
\<lbrakk>x \<in> carrier R; ?x \<in> carrier (poly_ring R); ?y \<in> carrier (poly_ring R)\<rbrakk> \<Longrightarrow> local.eval (?x \<oplus>\<^bsub>poly_ring R\<^esub> ?y) x = local.eval ?x x \<oplus> local.eval ?y x
x \<in> carrier R \<Longrightarrow> local.eval \<one>\<^bsub>poly_ring R\<^esub> x = \<one>
p \<in> carrier (poly_ring R)
q \<in> carrier (poly_ring R)
\<lbrakk>?a \<otimes> ?b = \<zero>; ?a \<in> carrier R; ?b \<in> carrier R\<rbrakk> \<Longrightarrow> ?a = \<zero> \<or> ?b = \<zero>

goal (1 subgoal):
 1. local.eval p x = \<zero> \<or> local.eval q x = \<zero>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.eval p x = \<zero> \<or> local.eval q x = \<zero>

goal (1 subgoal):
 1. is_root (p \<otimes>\<^bsub>poly_ring R\<^esub> q) x \<Longrightarrow> is_root p x \<or> is_root q x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> []
q \<noteq> []
local.eval p x = \<zero> \<or> local.eval q x = \<zero>
[PROOF STEP]
show "(is_root p x) \<or> (is_root q x)"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> []
q \<noteq> []
local.eval p x = \<zero> \<or> local.eval q x = \<zero>

goal (1 subgoal):
 1. is_root p x \<or> is_root q x
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
p \<noteq> []
q \<noteq> []
local.eval p x = \<zero> \<or> local.eval q x = \<zero>
x \<in> carrier R

goal (1 subgoal):
 1. is_root p x \<or> is_root q x
[PROOF STEP]
unfolding is_root_def
[PROOF STATE]
proof (prove)
using this:
p \<noteq> []
q \<noteq> []
local.eval p x = \<zero> \<or> local.eval q x = \<zero>
x \<in> carrier R

goal (1 subgoal):
 1. x \<in> carrier R \<and> local.eval p x = \<zero> \<and> p \<noteq> [] \<or> x \<in> carrier R \<and> local.eval q x = \<zero> \<and> q \<noteq> []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_root p x \<or> is_root q x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Maclaurin_sin_expansion3:
  assumes "n > 0" "x > 0"
    shows "\<exists>t. 0 < t \<and> t < x \<and>
          sin x = (\<Sum>m<n. sin_coeff m * x ^ m) + (sin (t + 1/2 * real n * pi) / fact n) * x ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t>0. t < x \<and> sin x = (\<Sum>m<n. sin_coeff m * x ^ m) + sin (t + 1 / 2 * real n * pi) / fact n * x ^ n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>t>0. t < x \<and> sin x = (\<Sum>m<n. sin_coeff m * x ^ m) + sin (t + 1 / 2 * real n * pi) / fact n * x ^ n
[PROOF STEP]
let ?diff = "\<lambda>n x. sin (x + 1/2 * real n * pi)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>t>0. t < x \<and> sin x = (\<Sum>m<n. sin_coeff m * x ^ m) + sin (t + 1 / 2 * real n * pi) / fact n * x ^ n
[PROOF STEP]
have "\<exists>t. 0 < t \<and> t < x \<and> sin x = (\<Sum>m<n. ?diff m 0 / (fact m) * x ^ m) + ?diff n t / fact n * x ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t>0. t < x \<and> sin x = (\<Sum>m<n. sin (0 + 1 / 2 * real m * pi) / fact m * x ^ m) + sin (t + 1 / 2 * real n * pi) / fact n * x ^ n
[PROOF STEP]
proof (rule Maclaurin)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. 0 < x
 2. 0 < n
 3. (\<lambda>a. sin (a + 1 / 2 * real 0 * pi)) = sin
 4. \<forall>m t. m < n \<and> 0 \<le> t \<and> t \<le> x \<longrightarrow> ((\<lambda>a. sin (a + 1 / 2 * real m * pi)) has_real_derivative sin (t + 1 / 2 * real (Suc m) * pi)) (at t)
[PROOF STEP]
show "\<forall>m t. m < n \<and> 0 \<le> t \<and> t \<le> x \<longrightarrow>
                ((\<lambda>u. sin (u + 1/2 * real m * pi)) has_real_derivative
                 sin (t + 1/2 * real (Suc m) * pi)) (at t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>m t. m < n \<and> 0 \<le> t \<and> t \<le> x \<longrightarrow> ((\<lambda>u. sin (u + 1 / 2 * real m * pi)) has_real_derivative sin (t + 1 / 2 * real (Suc m) * pi)) (at t)
[PROOF STEP]
apply (simp add: sin_expansion_lemma del: of_nat_Suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>m t. m < n \<and> 0 \<le> t \<and> t \<le> x \<longrightarrow> ((\<lambda>u. sin (u + real m * pi / 2)) has_real_derivative cos (t + real m * pi / 2)) (at t)
[PROOF STEP]
apply (force intro!: derivative_eq_intros)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<forall>m t. m < n \<and> 0 \<le> t \<and> t \<le> x \<longrightarrow> ((\<lambda>u. sin (u + 1 / 2 * real m * pi)) has_real_derivative sin (t + 1 / 2 * real (Suc m) * pi)) (at t)

goal (3 subgoals):
 1. 0 < x
 2. 0 < n
 3. (\<lambda>a. sin (a + 1 / 2 * real 0 * pi)) = sin
[PROOF STEP]
qed (use assms in auto)
[PROOF STATE]
proof (state)
this:
\<exists>t>0. t < x \<and> sin x = (\<Sum>m<n. sin (0 + 1 / 2 * real m * pi) / fact m * x ^ m) + sin (t + 1 / 2 * real n * pi) / fact n * x ^ n

goal (1 subgoal):
 1. \<exists>t>0. t < x \<and> sin x = (\<Sum>m<n. sin_coeff m * x ^ m) + sin (t + 1 / 2 * real n * pi) / fact n * x ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>t>0. t < x \<and> sin x = (\<Sum>m<n. sin (0 + 1 / 2 * real m * pi) / fact m * x ^ m) + sin (t + 1 / 2 * real n * pi) / fact n * x ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>t>0. t < x \<and> sin x = (\<Sum>m<n. sin (0 + 1 / 2 * real m * pi) / fact m * x ^ m) + sin (t + 1 / 2 * real n * pi) / fact n * x ^ n

goal (1 subgoal):
 1. \<exists>t>0. t < x \<and> sin x = (\<Sum>m<n. sin_coeff m * x ^ m) + sin (t + 1 / 2 * real n * pi) / fact n * x ^ n
[PROOF STEP]
apply (rule ex_forward, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t. \<lbrakk>0 < t \<and> t < x \<and> sin x = (\<Sum>m<n. sin (real m * pi / 2) * x ^ m / fact m) + sin (t + real n * pi / 2) * x ^ n / fact n; \<exists>ta>0. ta < x \<and> sin (t + real n * pi / 2) = sin (ta + real n * pi / 2)\<rbrakk> \<Longrightarrow> (\<Sum>m<n. sin (real m * pi / 2) * x ^ m / fact m) = (\<Sum>m<n. sin_coeff m * x ^ m)
[PROOF STEP]
apply (rule sum.cong[OF refl])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t xa. \<lbrakk>0 < t \<and> t < x \<and> sin x = (\<Sum>m<n. sin (real m * pi / 2) * x ^ m / fact m) + sin (t + real n * pi / 2) * x ^ n / fact n; \<exists>ta>0. ta < x \<and> sin (t + real n * pi / 2) = sin (ta + real n * pi / 2); xa \<in> {..<n}\<rbrakk> \<Longrightarrow> sin (real xa * pi / 2) * x ^ xa / fact xa = sin_coeff xa * x ^ xa
[PROOF STEP]
apply (auto simp: sin_coeff_def sin_zero_iff elim: oddE simp del: of_nat_Suc)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<exists>t>0. t < x \<and> sin x = (\<Sum>m<n. sin_coeff m * x ^ m) + sin (t + 1 / 2 * real n * pi) / fact n * x ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in cpx_sq_mat) meas_outcome_prob_pos:
  assumes "R\<in> fc_mats"
  and "density_operator R"
  and "proj_measurement n M"
  and "i < n"
shows "0 \<le> meas_outcome_prob R M i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> meas_outcome_prob R M i
[PROOF STEP]
unfolding meas_outcome_prob_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> Complex_Matrix.trace (R * meas_outcome_prj (M i))
[PROOF STEP]
proof (rule positive_proj_trace)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. projector (meas_outcome_prj (M i))
 2. Complex_Matrix.positive R
 3. meas_outcome_prj (M i) \<in> carrier_mat ?n ?n
 4. R \<in> carrier_mat ?n ?n
[PROOF STEP]
show "R \<in> carrier_mat dimR dimR"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R \<in> carrier_mat dimR dimR
[PROOF STEP]
using assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
R \<in> fc_mats
density_operator R
proj_measurement n M
i < n
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. R \<in> carrier_mat dimR dimR
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
R \<in> carrier_mat dimR dimR

goal (3 subgoals):
 1. projector (meas_outcome_prj (M i))
 2. Complex_Matrix.positive R
 3. meas_outcome_prj (M i) \<in> carrier_mat dimR dimR
[PROOF STEP]
show "Complex_Matrix.positive R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.positive R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
R \<in> fc_mats
density_operator R
proj_measurement n M
i < n

goal (1 subgoal):
 1. Complex_Matrix.positive R
[PROOF STEP]
unfolding density_operator_def
[PROOF STATE]
proof (prove)
using this:
R \<in> fc_mats
Complex_Matrix.positive R \<and> Complex_Matrix.trace R = 1
proj_measurement n M
i < n

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

goal (2 subgoals):
 1. projector (meas_outcome_prj (M i))
 2. meas_outcome_prj (M i) \<in> carrier_mat dimR dimR
[PROOF STEP]
show "projector (meas_outcome_prj (M i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. projector (meas_outcome_prj (M i))
[PROOF STEP]
using assms proj_measurement_proj
[PROOF STATE]
proof (prove)
using this:
R \<in> fc_mats
density_operator R
proj_measurement n M
i < n
\<lbrakk>proj_measurement ?p ?M; ?i < ?p\<rbrakk> \<Longrightarrow> projector (meas_outcome_prj (?M ?i))

goal (1 subgoal):
 1. projector (meas_outcome_prj (M i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
projector (meas_outcome_prj (M i))

goal (1 subgoal):
 1. meas_outcome_prj (M i) \<in> carrier_mat dimR dimR
[PROOF STEP]
show "meas_outcome_prj (M i) \<in> carrier_mat dimR dimR"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. meas_outcome_prj (M i) \<in> carrier_mat dimR dimR
[PROOF STEP]
using assms proj_measurement_carrier
      fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
R \<in> fc_mats
density_operator R
proj_measurement n M
i < n
\<lbrakk>proj_measurement ?p ?M; ?i < ?p\<rbrakk> \<Longrightarrow> meas_outcome_prj (?M ?i) \<in> fc_mats
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. meas_outcome_prj (M i) \<in> carrier_mat dimR dimR
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
meas_outcome_prj (M i) \<in> carrier_mat dimR dimR

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finsert_equiv: "(finsert e f = f') = (insert e (fset f) = (fset f'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (finsert e f = f') = (insert e (fset f) = fset f')
[PROOF STEP]
by (simp add: finsert_def fset_both_sides Abs_fset_inverse)


[STATEMENT]
lemma mndet_chainpreserving: "chain Y \<Longrightarrow> chain (\<lambda>i. (\<sqinter> z \<in> A \<rightarrow> Y i z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. chain Y \<Longrightarrow> chain (\<lambda>i. mndet A (Y i))
[PROOF STEP]
apply(rule chainI, rename_tac i)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. chain Y \<Longrightarrow> mndet A (Y i) \<sqsubseteq> mndet A (Y (Suc i))
[PROOF STEP]
apply(frule_tac i="i" in chainE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>chain Y; Y i \<sqsubseteq> Y (Suc i)\<rbrakk> \<Longrightarrow> mndet A (Y i) \<sqsubseteq> mndet A (Y (Suc i))
[PROOF STEP]
by (simp add: below_fun_def mono_Mprefix0 write0_def monofunE)


[STATEMENT]
lemma complex_split : "Complex a b = c \<longleftrightarrow> (a = Re c \<and> b = Im c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Complex a b = c) = (a = Re c \<and> b = Im c)
[PROOF STEP]
using complex_surj
[PROOF STATE]
proof (prove)
using this:
Complex (Re ?z) (Im ?z) = ?z

goal (1 subgoal):
 1. (Complex a b = c) = (a = Re c \<and> b = Im c)
[PROOF STEP]
by auto


[STATEMENT]
lemma equiintegrable_on_Un:
  assumes "F equiintegrable_on I" "G equiintegrable_on I"
  shows "(F \<union> G) equiintegrable_on I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F \<union> G equiintegrable_on I
[PROOF STEP]
unfolding equiintegrable_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>f\<in>F \<union> G. f integrable_on I) \<and> (\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < e))
[PROOF STEP]
proof (intro conjI impI allI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>f\<in>F \<union> G. f integrable_on I
 2. \<And>e. 0 < e \<Longrightarrow> \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < e)
[PROOF STEP]
show "\<forall>f\<in>F \<union> G. f integrable_on I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>f\<in>F \<union> G. f integrable_on I
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
F equiintegrable_on I
G equiintegrable_on I

goal (1 subgoal):
 1. \<forall>f\<in>F \<union> G. f integrable_on I
[PROOF STEP]
unfolding equiintegrable_on_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>f\<in>F. f integrable_on I) \<and> (\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < e))
(\<forall>f\<in>G. f integrable_on I) \<and> (\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> G \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < e))

goal (1 subgoal):
 1. \<forall>f\<in>F \<union> G. f integrable_on I
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>f\<in>F \<union> G. f integrable_on I

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < e)
[PROOF STEP]
show "\<exists>\<gamma>. gauge \<gamma> \<and>
            (\<forall>f \<D>. f \<in> F \<union> G \<and>
                   \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow>
                   norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>)"
         if "\<epsilon> > 0" for \<epsilon>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>)
[PROOF STEP]
obtain \<gamma>1 where "gauge \<gamma>1"
      and \<gamma>1: "\<And>f \<D>. f \<in> F \<and> \<D> tagged_division_of I \<and> \<gamma>1 fine \<D>
                    \<Longrightarrow> norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<gamma>1. \<lbrakk>gauge \<gamma>1; \<And>f \<D>. f \<in> F \<and> \<D> tagged_division_of I \<and> \<gamma>1 fine \<D> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms \<open>\<epsilon> > 0\<close>
[PROOF STATE]
proof (prove)
using this:
F equiintegrable_on I
G equiintegrable_on I
0 < \<epsilon>

goal (1 subgoal):
 1. (\<And>\<gamma>1. \<lbrakk>gauge \<gamma>1; \<And>f \<D>. f \<in> F \<and> \<D> tagged_division_of I \<and> \<gamma>1 fine \<D> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding equiintegrable_on_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>f\<in>F. f integrable_on I) \<and> (\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < e))
(\<forall>f\<in>G. f integrable_on I) \<and> (\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> G \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < e))
0 < \<epsilon>

goal (1 subgoal):
 1. (\<And>\<gamma>1. \<lbrakk>gauge \<gamma>1; \<And>f \<D>. f \<in> F \<and> \<D> tagged_division_of I \<and> \<gamma>1 fine \<D> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gauge \<gamma>1
?f \<in> F \<and> ?\<D> tagged_division_of I \<and> \<gamma>1 fine ?\<D> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>. content K *\<^sub>R ?f x) - integral I ?f) < \<epsilon>

goal (1 subgoal):
 1. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>)
[PROOF STEP]
obtain \<gamma>2 where  "gauge \<gamma>2"
      and \<gamma>2: "\<And>f \<D>. f \<in> G \<and> \<D> tagged_division_of I \<and> \<gamma>2 fine \<D>
                    \<Longrightarrow> norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<gamma>2. \<lbrakk>gauge \<gamma>2; \<And>f \<D>. f \<in> G \<and> \<D> tagged_division_of I \<and> \<gamma>2 fine \<D> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms \<open>\<epsilon> > 0\<close>
[PROOF STATE]
proof (prove)
using this:
F equiintegrable_on I
G equiintegrable_on I
0 < \<epsilon>

goal (1 subgoal):
 1. (\<And>\<gamma>2. \<lbrakk>gauge \<gamma>2; \<And>f \<D>. f \<in> G \<and> \<D> tagged_division_of I \<and> \<gamma>2 fine \<D> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding equiintegrable_on_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>f\<in>F. f integrable_on I) \<and> (\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < e))
(\<forall>f\<in>G. f integrable_on I) \<and> (\<forall>e>0. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> G \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < e))
0 < \<epsilon>

goal (1 subgoal):
 1. (\<And>\<gamma>2. \<lbrakk>gauge \<gamma>2; \<And>f \<D>. f \<in> G \<and> \<D> tagged_division_of I \<and> \<gamma>2 fine \<D> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gauge \<gamma>2
?f \<in> G \<and> ?\<D> tagged_division_of I \<and> \<gamma>2 fine ?\<D> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>. content K *\<^sub>R ?f x) - integral I ?f) < \<epsilon>

goal (1 subgoal):
 1. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>)
[PROOF STEP]
have "gauge (\<lambda>x. \<gamma>1 x \<inter> \<gamma>2 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gauge (\<lambda>x. \<gamma>1 x \<inter> \<gamma>2 x)
[PROOF STEP]
using \<open>gauge \<gamma>1\<close> \<open>gauge \<gamma>2\<close>
[PROOF STATE]
proof (prove)
using this:
gauge \<gamma>1
gauge \<gamma>2

goal (1 subgoal):
 1. gauge (\<lambda>x. \<gamma>1 x \<inter> \<gamma>2 x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
gauge (\<lambda>x. \<gamma>1 x \<inter> \<gamma>2 x)

goal (1 subgoal):
 1. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
gauge (\<lambda>x. \<gamma>1 x \<inter> \<gamma>2 x)

goal (1 subgoal):
 1. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>)
[PROOF STEP]
have "\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> (\<lambda>x. \<gamma>1 x \<inter> \<gamma>2 x) fine \<D> \<longrightarrow>
          norm ((\<Sum>(x,K) \<in> \<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> (\<lambda>x. \<gamma>1 x \<inter> \<gamma>2 x) fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>
[PROOF STEP]
using \<gamma>1 \<gamma>2
[PROOF STATE]
proof (prove)
using this:
?f \<in> F \<and> ?\<D> tagged_division_of I \<and> \<gamma>1 fine ?\<D> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>. content K *\<^sub>R ?f x) - integral I ?f) < \<epsilon>
?f \<in> G \<and> ?\<D> tagged_division_of I \<and> \<gamma>2 fine ?\<D> \<Longrightarrow> norm ((\<Sum>(x, K)\<in>?\<D>. content K *\<^sub>R ?f x) - integral I ?f) < \<epsilon>

goal (1 subgoal):
 1. \<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> (\<lambda>x. \<gamma>1 x \<inter> \<gamma>2 x) fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>
[PROOF STEP]
by (auto simp: fine_Int)
[PROOF STATE]
proof (state)
this:
\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> (\<lambda>x. \<gamma>1 x \<inter> \<gamma>2 x) fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>

goal (1 subgoal):
 1. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
gauge (\<lambda>x. \<gamma>1 x \<inter> \<gamma>2 x)
\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> (\<lambda>x. \<gamma>1 x \<inter> \<gamma>2 x) fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
gauge (\<lambda>x. \<gamma>1 x \<inter> \<gamma>2 x)
\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> (\<lambda>x. \<gamma>1 x \<inter> \<gamma>2 x) fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>

goal (1 subgoal):
 1. \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>)
[PROOF STEP]
by (intro exI conjI) assumption+
[PROOF STATE]
proof (state)
this:
\<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < \<epsilon>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < ?\<epsilon> \<Longrightarrow> \<exists>\<gamma>. gauge \<gamma> \<and> (\<forall>f \<D>. f \<in> F \<union> G \<and> \<D> tagged_division_of I \<and> \<gamma> fine \<D> \<longrightarrow> norm ((\<Sum>(x, K)\<in>\<D>. content K *\<^sub>R f x) - integral I f) < ?\<epsilon>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LIM_compose_eventually:
  assumes "f \<midarrow>a\<rightarrow> b"
    and "g \<midarrow>b\<rightarrow> c"
    and "eventually (\<lambda>x. f x \<noteq> b) (at a)"
  shows "(\<lambda>x. g (f x)) \<midarrow>a\<rightarrow> c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. g (f x)) \<midarrow>a\<rightarrow> c
[PROOF STEP]
using assms(2,1,3)
[PROOF STATE]
proof (prove)
using this:
g \<midarrow>b\<rightarrow> c
f \<midarrow>a\<rightarrow> b
\<forall>\<^sub>F x in at a. f x \<noteq> b

goal (1 subgoal):
 1. (\<lambda>x. g (f x)) \<midarrow>a\<rightarrow> c
[PROOF STEP]
by (rule tendsto_compose_eventually)


[STATEMENT]
lemma INF_ereal_minus_right:
  assumes "I \<noteq> {}" and "\<bar>c\<bar> \<noteq> \<infinity>"
  shows "(INF i\<in>I. c - f i) = c - (SUP i\<in>I. f i::ereal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF i\<in>I. c - f i) = c - Sup (f ` I)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (INF i\<in>I. c - f i) = c - Sup (f ` I)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (INF i\<in>I. c - f i) = c - Sup (f ` I)
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (INF i\<in>I. c - f i) = c - Sup (f ` I)
[PROOF STEP]
have "(-c) + b = - (c - b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - c + b = - (c - b)
[PROOF STEP]
using \<open>\<bar>c\<bar> \<noteq> \<infinity>\<close>
[PROOF STATE]
proof (prove)
using this:
\<bar>c\<bar> \<noteq> \<infinity>

goal (1 subgoal):
 1. - c + b = - (c - b)
[PROOF STEP]
by (cases c b rule: ereal2_cases) auto
[PROOF STATE]
proof (state)
this:
- c + b = - (c - b)

goal (1 subgoal):
 1. (INF i\<in>I. c - f i) = c - Sup (f ` I)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
- c + ?b2 = - (c - ?b2)

goal (1 subgoal):
 1. (INF i\<in>I. c - f i) = c - Sup (f ` I)
[PROOF STEP]
note * = this
[PROOF STATE]
proof (state)
this:
- c + ?b2 = - (c - ?b2)

goal (1 subgoal):
 1. (INF i\<in>I. c - f i) = c - Sup (f ` I)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF i\<in>I. c - f i) = c - Sup (f ` I)
[PROOF STEP]
using SUP_ereal_add_right[OF \<open>I \<noteq> {}\<close>, of "-c" f] \<open>\<bar>c\<bar> \<noteq> \<infinity>\<close>
[PROOF STATE]
proof (prove)
using this:
- c \<noteq> - \<infinity> \<Longrightarrow> (SUP i\<in>I. - c + f i) = - c + Sup (f ` I)
\<bar>c\<bar> \<noteq> \<infinity>

goal (1 subgoal):
 1. (INF i\<in>I. c - f i) = c - Sup (f ` I)
[PROOF STEP]
by (auto simp add: * ereal_SUP_uminus_eq)
[PROOF STATE]
proof (state)
this:
(INF i\<in>I. c - f i) = c - Sup (f ` I)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Ring) npMulEleL: "\<And> n. x \<in> carrier R
        \<Longrightarrow> (npow R x n) \<cdot>\<^sub>r x =  npow R x (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. x \<in> carrier R \<Longrightarrow> x^\<^bsup>R n\<^esup> \<cdot>\<^sub>r x = x^\<^bsup>R Suc n\<^esup>
[PROOF STEP]
by (simp add:npMulElmL[THEN sym])