[STATEMENT]
lemma fps_sin_cos_sum_of_squares: "(fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2 = 1"
  (is "?lhs = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2 = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2 = 1
[PROOF STEP]
have "fps_deriv ?lhs = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_deriv ((fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2) = 0
[PROOF STEP]
by (simp add:  fps_deriv_power fps_sin_deriv fps_cos_deriv field_simps flip: fps_const_neg)
[PROOF STATE]
proof (state)
this:
fps_deriv ((fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2) = 0

goal (1 subgoal):
 1. (fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2 = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fps_deriv ((fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2) = 0
[PROOF STEP]
have "?lhs = fps_const (?lhs $ 0)"
[PROOF STATE]
proof (prove)
using this:
fps_deriv ((fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2) = 0

goal (1 subgoal):
 1. (fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2 = fps_const (((fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2) $ 0)
[PROOF STEP]
unfolding fps_deriv_eq_0_iff
[PROOF STATE]
proof (prove)
using this:
(fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2 = fps_const (((fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2) $ 0)

goal (1 subgoal):
 1. (fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2 = fps_const (((fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2) $ 0)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2 = fps_const (((fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2) $ 0)

goal (1 subgoal):
 1. (fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2 = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2 = fps_const (((fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2) $ 0)

goal (1 subgoal):
 1. (fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2 = 1
[PROOF STEP]
have "\<dots> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_const (((fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2) $ 0) = 1
[PROOF STEP]
by (simp add: fps_eq_iff numeral_2_eq_2 fps_mult_nth fps_cos_def fps_sin_def)
[PROOF STATE]
proof (state)
this:
fps_const (((fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2) $ 0) = 1

goal (1 subgoal):
 1. (fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2 = 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2 = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2 = 1

goal (1 subgoal):
 1. (fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2 = 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(fps_cos c)\<^sup>2 + (fps_sin c)\<^sup>2 = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma take_bit_numeral_bit1:
  \<open>take_bit (numeral l) (numeral (Num.Bit1 k)) = take_bit (pred_numeral l) (numeral k) * 2 + 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (numeral l) (numeral (num.Bit1 k)) = take_bit (pred_numeral l) (numeral k) * (2::'a) + (1::'a)
[PROOF STEP]
by (simp add: take_bit_rec numeral_Bit1_div_2 mod_2_eq_odd)


[STATEMENT]
lemma has_derivative_within_alt:
  "(f has_derivative f') (at x within s) \<longleftrightarrow> bounded_linear f' \<and>
    (\<forall>e>0. \<exists>d>0. \<forall>y\<in>s. norm(y - x) < d \<longrightarrow> norm (f y - f x - f' (y - x)) \<le> e * norm (y - x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_derivative f') (at x within s) = (bounded_linear f' \<and> (\<forall>e>0. \<exists>d>0. \<forall>y\<in>s. norm (y - x) < d \<longrightarrow> norm (f y - f x - f' (y - x)) \<le> e * norm (y - x)))
[PROOF STEP]
unfolding has_derivative_within filterlim_def le_nhds_metric_le eventually_filtermap
    eventually_at dist_norm diff_diff_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (bounded_linear f' \<and> (\<forall>e>0. \<exists>d>0. \<forall>xa\<in>s. xa \<noteq> x \<and> norm (xa - x) < d \<longrightarrow> norm ((1 / norm (xa - x)) *\<^sub>R (f xa - (f x + f' (xa - x))) - (0::'b)) \<le> e)) = (bounded_linear f' \<and> (\<forall>e>0. \<exists>d>0. \<forall>y\<in>s. norm (y - x) < d \<longrightarrow> norm (f y - (f x + f' (y - x))) \<le> e * norm (y - x)))
[PROOF STEP]
by (force simp add: linear_0 bounded_linear.linear pos_divide_le_eq)


[STATEMENT]
lemma fps_inverse_deriv:
  fixes   a :: "'a::field fps"
  assumes "a$0 \<noteq> 0"
  shows   "fps_deriv (inverse a) = - fps_deriv a * (inverse a)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_deriv (inverse a) = - fps_deriv a * (inverse a)\<^sup>2
[PROOF STEP]
using   assms fps_deriv_lr_inverse_comm(2)[of "inverse (a$0)" a]
[PROOF STATE]
proof (prove)
using this:
a $ 0 \<noteq> (0::'a)
inverse (a $ 0) * a $ 0 = (1::'a) \<Longrightarrow> fps_deriv (fps_right_inverse a (inverse (a $ 0))) = - fps_deriv a * (fps_right_inverse a (inverse (a $ 0)))\<^sup>2

goal (1 subgoal):
 1. fps_deriv (inverse a) = - fps_deriv a * (inverse a)\<^sup>2
[PROOF STEP]
by      (simp add: fps_inverse_def)


[STATEMENT]
lemma Arcsin_0 [simp]: "Arcsin 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arcsin 0 = 0
[PROOF STEP]
by (metis Arcsin_sin norm_zero pi_half_gt_zero real_norm_def sin_zero zero_complex.simps(1))


[STATEMENT]
lemma ortho_scalprod0:
  assumes "z1 \<noteq> 0" and "z2 \<noteq> 0"
  shows "\<angle> z1 z2 = pi/2 \<or> \<angle> z1 z2 = -pi/2 \<longleftrightarrow> scalprod z1 z2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<angle> z1 z2 = pi / 2 \<or> \<angle> z1 z2 = - pi / 2) = (scalprod z1 z2 = 0)
[PROOF STEP]
using cos0_scalprod0[OF assms]
[PROOF STATE]
proof (prove)
using this:
(cos (\<angle> z1 z2) = 0) = (scalprod z1 z2 = 0)

goal (1 subgoal):
 1. (\<angle> z1 z2 = pi / 2 \<or> \<angle> z1 z2 = - pi / 2) = (scalprod z1 z2 = 0)
[PROOF STEP]
using ang_vec_bounded[of z1 z2]
[PROOF STATE]
proof (prove)
using this:
(cos (\<angle> z1 z2) = 0) = (scalprod z1 z2 = 0)
- pi < \<angle> z1 z2 \<and> \<angle> z1 z2 \<le> pi

goal (1 subgoal):
 1. (\<angle> z1 z2 = pi / 2 \<or> \<angle> z1 z2 = - pi / 2) = (scalprod z1 z2 = 0)
[PROOF STEP]
using cos_0_iff_canon[of "\<angle> z1 z2"]
[PROOF STATE]
proof (prove)
using this:
(cos (\<angle> z1 z2) = 0) = (scalprod z1 z2 = 0)
- pi < \<angle> z1 z2 \<and> \<angle> z1 z2 \<le> pi
\<lbrakk>cos (\<angle> z1 z2) = 0; - pi < \<angle> z1 z2; \<angle> z1 z2 \<le> pi\<rbrakk> \<Longrightarrow> \<angle> z1 z2 = pi / 2 \<or> \<angle> z1 z2 = - pi / 2

goal (1 subgoal):
 1. (\<angle> z1 z2 = pi / 2 \<or> \<angle> z1 z2 = - pi / 2) = (scalprod z1 z2 = 0)
[PROOF STEP]
by (metis cos_minus cos_pi_half divide_minus_left)


[STATEMENT]
lemma robdd_invar_idsI:
assumes "\<And>b1 b2. \<lbrakk>b1 \<in> (subrobdds_set bs); b2 \<in> (subrobdds_set bs)\<rbrakk> \<Longrightarrow>
                         (robdd_\<alpha> b1 = robdd_\<alpha> b2) \<longleftrightarrow> (robdd_get_id b1 = robdd_get_id b2)"
shows "robdd_invar_ids bs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. robdd_invar_ids bs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?b1.0 \<in> subrobdds_set bs; ?b2.0 \<in> subrobdds_set bs\<rbrakk> \<Longrightarrow> (robdd_\<alpha> ?b1.0 = robdd_\<alpha> ?b2.0) = (robdd_get_id ?b1.0 = robdd_get_id ?b2.0)

goal (1 subgoal):
 1. robdd_invar_ids bs
[PROOF STEP]
unfolding robdd_invar_ids_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?b1.0 \<in> subrobdds_set bs; ?b2.0 \<in> subrobdds_set bs\<rbrakk> \<Longrightarrow> (robdd_\<alpha> ?b1.0 = robdd_\<alpha> ?b2.0) = (robdd_get_id ?b1.0 = robdd_get_id ?b2.0)

goal (1 subgoal):
 1. \<forall>b1 b2. b1 \<in> subrobdds_set bs \<and> b2 \<in> subrobdds_set bs \<longrightarrow> (robdd_\<alpha> b1 = robdd_\<alpha> b2) = (robdd_get_id b1 = robdd_get_id b2)
[PROOF STEP]
by blast


[STATEMENT]
lemma PosOrd_ordering:
  shows "ordering (\<lambda>v1 v2. v1 :\<sqsubseteq>val v2) (\<lambda> v1 v2. v1 :\<sqsubset>val v2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordering PosOrd_ex_eq PosOrd_ex
[PROOF STEP]
unfolding ordering_def PosOrd_ex_eq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partial_preordering (\<lambda>v1 v2. v1 :\<sqsubset>val v2 \<or> v1 = v2) \<and> ordering_axioms (\<lambda>v1 v2. v1 :\<sqsubset>val v2 \<or> v1 = v2) PosOrd_ex
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. partial_preordering (\<lambda>v1 v2. v1 :\<sqsubset>val v2 \<or> v1 = v2)
 2. ordering_axioms (\<lambda>v1 v2. v1 :\<sqsubset>val v2 \<or> v1 = v2) PosOrd_ex
[PROOF STEP]
using PosOrd_trans partial_preordering_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v1.0 :\<sqsubset>val ?v2.0; ?v2.0 :\<sqsubset>val ?v3.0\<rbrakk> \<Longrightarrow> ?v1.0 :\<sqsubset>val ?v3.0
partial_preordering ?less_eq \<equiv> (\<forall>a. ?less_eq a a) \<and> (\<forall>a b c. ?less_eq a b \<longrightarrow> ?less_eq b c \<longrightarrow> ?less_eq a c)

goal (2 subgoals):
 1. partial_preordering (\<lambda>v1 v2. v1 :\<sqsubset>val v2 \<or> v1 = v2)
 2. ordering_axioms (\<lambda>v1 v2. v1 :\<sqsubset>val v2 \<or> v1 = v2) PosOrd_ex
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordering_axioms (\<lambda>v1 v2. v1 :\<sqsubset>val v2 \<or> v1 = v2) PosOrd_ex
[PROOF STEP]
using PosOrd_assym ordering_axioms_def
[PROOF STATE]
proof (prove)
using this:
?v1.0 :\<sqsubset>val ?v2.0 \<Longrightarrow> \<not> ?v2.0 :\<sqsubset>val ?v1.0
ordering_axioms ?less_eq ?less \<equiv> (\<forall>a b. ?less a b = (?less_eq a b \<and> a \<noteq> b)) \<and> (\<forall>a b. ?less_eq a b \<longrightarrow> ?less_eq b a \<longrightarrow> a = b)

goal (1 subgoal):
 1. ordering_axioms (\<lambda>v1 v2. v1 :\<sqsubset>val v2 \<or> v1 = v2) PosOrd_ex
[PROOF STEP]
by blast


[STATEMENT]
lemma Func_mono[simp]:
assumes "B1 \<subseteq> B2"
shows "Func A B1 \<subseteq> Func A B2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Func A B1 \<subseteq> Func A B2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
B1 \<subseteq> B2

goal (1 subgoal):
 1. Func A B1 \<subseteq> Func A B2
[PROOF STEP]
unfolding Func_def
[PROOF STATE]
proof (prove)
using this:
B1 \<subseteq> B2

goal (1 subgoal):
 1. {f. (\<forall>a\<in>A. f a \<in> B1) \<and> (\<forall>a. a \<notin> A \<longrightarrow> f a = undefined)} \<subseteq> {f. (\<forall>a\<in>A. f a \<in> B2) \<and> (\<forall>a. a \<notin> A \<longrightarrow> f a = undefined)}
[PROOF STEP]
by force


[STATEMENT]
lemma split_coeff_vec_index_sum:
  assumes "(x,y) = split_i_j_x (dim_vec (lpoly_to_vec v)) l X"
  shows "(\<Sum>i = 0..<dim_vec x. Abstract_Linear_Poly.coeff v i * \<langle>X\<rangle> i) =
         (\<Sum>i = 0..<dim_vec x. lpoly_to_vec v $ i * x $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec x. Abstract_Linear_Poly.coeff v i * \<langle>X\<rangle> i) = (\<Sum>i = 0..<dim_vec x. lpoly_to_vec v $ i * x $ i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec x. Abstract_Linear_Poly.coeff v i * \<langle>X\<rangle> i) = (\<Sum>i = 0..<dim_vec x. lpoly_to_vec v $ i * x $ i)
[PROOF STEP]
from valuate_with_dim_poly[of v "\<langle>X\<rangle>", symmetric]
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i = 0..<dim_poly v. Abstract_Linear_Poly.coeff v i * \<langle>X\<rangle> i) = v \<lbrace> \<langle>X\<rangle> \<rbrace>
[PROOF STEP]
have "(\<Sum>i = 0..<dim_vec x. (lpoly_to_vec v) $ i * \<langle>X\<rangle> i) =
        (\<Sum>i = 0..<dim_vec x. (lpoly_to_vec v) $ i * x $ i)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<dim_poly v. Abstract_Linear_Poly.coeff v i * \<langle>X\<rangle> i) = v \<lbrace> \<langle>X\<rangle> \<rbrace>

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec x. lpoly_to_vec v $ i * \<langle>X\<rangle> i) = (\<Sum>i = 0..<dim_vec x. lpoly_to_vec v $ i * x $ i)
[PROOF STEP]
by (metis (no_types, lifting) assms split_access_fst_1 split_vec_dims(1) sum.ivl_cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<dim_vec x. lpoly_to_vec v $ i * \<langle>X\<rangle> i) = (\<Sum>i = 0..<dim_vec x. lpoly_to_vec v $ i * x $ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec x. Abstract_Linear_Poly.coeff v i * \<langle>X\<rangle> i) = (\<Sum>i = 0..<dim_vec x. lpoly_to_vec v $ i * x $ i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i = 0..<dim_vec x. lpoly_to_vec v $ i * \<langle>X\<rangle> i) = (\<Sum>i = 0..<dim_vec x. lpoly_to_vec v $ i * x $ i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<dim_vec x. lpoly_to_vec v $ i * \<langle>X\<rangle> i) = (\<Sum>i = 0..<dim_vec x. lpoly_to_vec v $ i * x $ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec x. Abstract_Linear_Poly.coeff v i * \<langle>X\<rangle> i) = (\<Sum>i = 0..<dim_vec x. lpoly_to_vec v $ i * x $ i)
[PROOF STEP]
by (metis (no_types, lifting) assms dim_poly_dim_vec_equiv
        lin_poly_to_vec_coeff_access split_vec_dims(1) sum.ivl_cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<dim_vec x. Abstract_Linear_Poly.coeff v i * \<langle>X\<rangle> i) = (\<Sum>i = 0..<dim_vec x. lpoly_to_vec v $ i * x $ i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cos_arcsin:
  assumes "- 1 \<le> x" "x \<le> 1"
  shows "cos (arcsin x) = sqrt (1 - x\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (arcsin x) = sqrt (1 - x\<^sup>2)
[PROOF STEP]
proof (rule power2_eq_imp_eq)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (cos (arcsin x))\<^sup>2 = (sqrt (1 - x\<^sup>2))\<^sup>2
 2. 0 \<le> cos (arcsin x)
 3. 0 \<le> sqrt (1 - x\<^sup>2)
[PROOF STEP]
show "(cos (arcsin x))\<^sup>2 = (sqrt (1 - x\<^sup>2))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cos (arcsin x))\<^sup>2 = (sqrt (1 - x\<^sup>2))\<^sup>2
[PROOF STEP]
by (simp add: square_le_1 assms cos_squared_eq)
[PROOF STATE]
proof (state)
this:
(cos (arcsin x))\<^sup>2 = (sqrt (1 - x\<^sup>2))\<^sup>2

goal (2 subgoals):
 1. 0 \<le> cos (arcsin x)
 2. 0 \<le> sqrt (1 - x\<^sup>2)
[PROOF STEP]
show "0 \<le> cos (arcsin x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> cos (arcsin x)
[PROOF STEP]
using arcsin assms cos_ge_zero
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- 1 \<le> ?y; ?y \<le> 1\<rbrakk> \<Longrightarrow> - (pi / 2) \<le> arcsin ?y \<and> arcsin ?y \<le> pi / 2 \<and> sin (arcsin ?y) = ?y
- 1 \<le> x
x \<le> 1
\<lbrakk>- (pi / 2) \<le> ?x; ?x \<le> pi / 2\<rbrakk> \<Longrightarrow> 0 \<le> cos ?x

goal (1 subgoal):
 1. 0 \<le> cos (arcsin x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 \<le> cos (arcsin x)

goal (1 subgoal):
 1. 0 \<le> sqrt (1 - x\<^sup>2)
[PROOF STEP]
show "0 \<le> sqrt (1 - x\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> sqrt (1 - x\<^sup>2)
[PROOF STEP]
by (simp add: square_le_1 assms)
[PROOF STATE]
proof (state)
this:
0 \<le> sqrt (1 - x\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_rabs_zero_cancel: "((\<lambda>x. \<bar>f x\<bar>) \<longlongrightarrow> (0::real)) F \<Longrightarrow> (f \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<bar>f x\<bar>) \<longlongrightarrow> 0) F \<Longrightarrow> (f \<longlongrightarrow> 0) F
[PROOF STEP]
by (fold real_norm_def) (rule tendsto_norm_zero_cancel)


[STATEMENT]
lemma prod_rel_compp: "\<langle>A O B, C O D\<rangle>prod_rel = \<langle>A,C\<rangle>prod_rel O \<langle>B,D\<rangle>prod_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A O B \<times>\<^sub>r C O D = (A \<times>\<^sub>r C) O (B \<times>\<^sub>r D)
[PROOF STEP]
using prod.rel_compp[of "rel2p A" "rel2p B" "rel2p C" "rel2p D"]
[PROOF STATE]
proof (prove)
using this:
rel_prod (rel2p A OO rel2p B) (rel2p C OO rel2p D) = rel_prod (rel2p A) (rel2p C) OO rel_prod (rel2p B) (rel2p D)

goal (1 subgoal):
 1. A O B \<times>\<^sub>r C O D = (A \<times>\<^sub>r C) O (B \<times>\<^sub>r D)
[PROOF STEP]
by (auto simp: rel2p(2-)[symmetric] rel2p_comp)


[STATEMENT]
lemma rbt_lookup_rbt_unionwk:
  "\<lbrakk> rbt_sorted t1; rbt_sorted t2 \<rbrakk>
  \<Longrightarrow> rbt_lookup (rbt_union_with_key f t1 t2) k =
  (case rbt_lookup t1 k of None \<Rightarrow> rbt_lookup t2 k
   | Some v \<Rightarrow> case rbt_lookup t2 k of None \<Rightarrow> Some v
              | Some w \<Rightarrow> Some (f k v w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>rbt_sorted t1; rbt_sorted t2\<rbrakk> \<Longrightarrow> rbt_lookup (rbt_union_with_key f t1 t2) k = (case rbt_lookup t1 k of None \<Rightarrow> rbt_lookup t2 k | Some v \<Rightarrow> case rbt_lookup t2 k of None \<Rightarrow> Some v | Some w \<Rightarrow> Some (f k v w))
[PROOF STEP]
using rbt_lookup_union_rec
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>rbt_sorted ?t1.0; rbt_sorted ?t2.0\<rbrakk> \<Longrightarrow> rbt_sorted (rbt_union_rec ?f ?t1.0 ?t2.0) \<and> rbt_lookup (rbt_union_rec ?f ?t1.0 ?t2.0) ?k = (case rbt_lookup ?t1.0 ?k of None \<Rightarrow> rbt_lookup ?t2.0 ?k | Some v \<Rightarrow> case rbt_lookup ?t2.0 ?k of None \<Rightarrow> Some v | Some w \<Rightarrow> Some (?f ?k v w))

goal (1 subgoal):
 1. \<lbrakk>rbt_sorted t1; rbt_sorted t2\<rbrakk> \<Longrightarrow> rbt_lookup (rbt_union_with_key f t1 t2) k = (case rbt_lookup t1 k of None \<Rightarrow> rbt_lookup t2 k | Some v \<Rightarrow> case rbt_lookup t2 k of None \<Rightarrow> Some v | Some w \<Rightarrow> Some (f k v w))
[PROOF STEP]
by (auto simp: rbt_union_with_key_def rbt_union_swap_rec)


[STATEMENT]
lemma desargues_config_not_col_3:
  assumes "desargues_config A B C A' B' C' M N P R"
  shows "\<not> col C C' B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> col C C' B'
[PROOF STEP]
by (smt assms col_line_eq_1 col_rot_CW desargues_config_def desargues_config_not_col_2
      desargues_config_rot_CW distinct3_def meet_3_in_def meet_col_1 meet_col_2)


[STATEMENT]
theorem ln_fact_bounds:
  assumes "n > 0"
  shows   "ln (fact n :: real) \<ge> ln (2*pi*n)/2 + n * ln n - n" (is ?th1)
          "ln (fact n :: real) \<le> ln (2*pi*n)/2 + n * ln n - n + 1/(12*real n)" (is ?th2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (2 * pi * real n) / 2 + real n * ln (real n) - real n \<le> ln (fact n) &&& ln (fact n) \<le> ln (2 * pi * real n) / 2 + real n * ln (real n) - real n + 1 / (12 * real n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ln (2 * pi * real n) / 2 + real n * ln (real n) - real n \<le> ln (fact n)
 2. ln (fact n) \<le> ln (2 * pi * real n) / 2 + real n * ln (real n) - real n + 1 / (12 * real n)
[PROOF STEP]
have "ln (fact n :: real) \<ge> ln (sqrt (2*pi*real n)*(real n/exp 1)^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (sqrt (2 * pi * real n) * (real n / exp 1) ^ n) \<le> ln (fact n)
[PROOF STEP]
using fact_bounds(1)[OF assms] assms
[PROOF STATE]
proof (prove)
using this:
sqrt (2 * pi * real n) * (real n / exp 1) ^ n \<le> fact n
0 < n

goal (1 subgoal):
 1. ln (sqrt (2 * pi * real n) * (real n / exp 1) ^ n) \<le> ln (fact n)
[PROOF STEP]
by (subst ln_le_cancel_iff) auto
[PROOF STATE]
proof (state)
this:
ln (sqrt (2 * pi * real n) * (real n / exp 1) ^ n) \<le> ln (fact n)

goal (2 subgoals):
 1. ln (2 * pi * real n) / 2 + real n * ln (real n) - real n \<le> ln (fact n)
 2. ln (fact n) \<le> ln (2 * pi * real n) / 2 + real n * ln (real n) - real n + 1 / (12 * real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (sqrt (2 * pi * real n) * (real n / exp 1) ^ n) \<le> ln (fact n)

goal (2 subgoals):
 1. ln (2 * pi * real n) / 2 + real n * ln (real n) - real n \<le> ln (fact n)
 2. ln (fact n) \<le> ln (2 * pi * real n) / 2 + real n * ln (real n) - real n + 1 / (12 * real n)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "ln (sqrt (2*pi*real n)*(real n/exp 1)^n) = ln (2*pi*n)/2 + n * ln n - n"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. ln (sqrt (2 * pi * real n) * (real n / exp 1) ^ n) = ln (2 * pi * real n) / 2 + real n * ln (real n) - real n
[PROOF STEP]
by (simp add: ln_mult ln_div ln_realpow ln_sqrt field_simps)
[PROOF STATE]
proof (state)
this:
ln (sqrt (2 * pi * real n) * (real n / exp 1) ^ n) = ln (2 * pi * real n) / 2 + real n * ln (real n) - real n

goal (2 subgoals):
 1. ln (2 * pi * real n) / 2 + real n * ln (real n) - real n \<le> ln (fact n)
 2. ln (fact n) \<le> ln (2 * pi * real n) / 2 + real n * ln (real n) - real n + 1 / (12 * real n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ln (2 * pi * real n) / 2 + real n * ln (real n) - real n \<le> ln (fact n)
[PROOF STEP]
show ?th1
[PROOF STATE]
proof (prove)
using this:
ln (2 * pi * real n) / 2 + real n * ln (real n) - real n \<le> ln (fact n)

goal (1 subgoal):
 1. ln (2 * pi * real n) / 2 + real n * ln (real n) - real n \<le> ln (fact n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ln (2 * pi * real n) / 2 + real n * ln (real n) - real n \<le> ln (fact n)

goal (1 subgoal):
 1. ln (fact n) \<le> ln (2 * pi * real n) / 2 + real n * ln (real n) - real n + 1 / (12 * real n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln (fact n) \<le> ln (2 * pi * real n) / 2 + real n * ln (real n) - real n + 1 / (12 * real n)
[PROOF STEP]
have "ln (fact n :: real) \<le> ln (sqrt (2*pi*real n) * (real n/exp 1)^n * exp (1/(12*real n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (fact n) \<le> ln (sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n)))
[PROOF STEP]
using fact_bounds(2)[OF assms] assms
[PROOF STATE]
proof (prove)
using this:
fact n \<le> sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))
0 < n

goal (1 subgoal):
 1. ln (fact n) \<le> ln (sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n)))
[PROOF STEP]
by (subst ln_le_cancel_iff) auto
[PROOF STATE]
proof (state)
this:
ln (fact n) \<le> ln (sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n)))

goal (1 subgoal):
 1. ln (fact n) \<le> ln (2 * pi * real n) / 2 + real n * ln (real n) - real n + 1 / (12 * real n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (fact n) \<le> ln (sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n)))

goal (1 subgoal):
 1. ln (fact n) \<le> ln (2 * pi * real n) / 2 + real n * ln (real n) - real n + 1 / (12 * real n)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
have "\<dots> = ln (2*pi*n)/2 + n * ln n - n + 1/(12*real n)"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. ln (sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))) = ln (2 * pi * real n) / 2 + real n * ln (real n) - real n + 1 / (12 * real n)
[PROOF STEP]
by (simp add: ln_mult ln_div ln_realpow ln_sqrt field_simps)
[PROOF STATE]
proof (state)
this:
ln (sqrt (2 * pi * real n) * (real n / exp 1) ^ n * exp (1 / (12 * real n))) = ln (2 * pi * real n) / 2 + real n * ln (real n) - real n + 1 / (12 * real n)

goal (1 subgoal):
 1. ln (fact n) \<le> ln (2 * pi * real n) / 2 + real n * ln (real n) - real n + 1 / (12 * real n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ln (fact n) \<le> ln (2 * pi * real n) / 2 + real n * ln (real n) - real n + 1 / (12 * real n)
[PROOF STEP]
show ?th2
[PROOF STATE]
proof (prove)
using this:
ln (fact n) \<le> ln (2 * pi * real n) / 2 + real n * ln (real n) - real n + 1 / (12 * real n)

goal (1 subgoal):
 1. ln (fact n) \<le> ln (2 * pi * real n) / 2 + real n * ln (real n) - real n + 1 / (12 * real n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ln (fact n) \<le> ln (2 * pi * real n) / 2 + real n * ln (real n) - real n + 1 / (12 * real n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in padic_integers) val_Zp_ultrametric_diff:
  assumes "x \<in> carrier Zp"
  assumes "y \<in> carrier Zp"
  shows "val_Zp (x \<ominus> y) \<ge> min (val_Zp x) (val_Zp y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (val_Zp x) (val_Zp y) \<le> val_Zp (x \<ominus> y)
[PROOF STEP]
using assms val_Zp_ultrametric[of x "\<ominus>y"]
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier Zp
y \<in> carrier Zp
\<lbrakk>x \<in> carrier Zp; \<ominus> y \<in> carrier Zp\<rbrakk> \<Longrightarrow> min (val_Zp x) (val_Zp (\<ominus> y)) \<le> val_Zp (x \<oplus> \<ominus> y)

goal (1 subgoal):
 1. min (val_Zp x) (val_Zp y) \<le> val_Zp (x \<ominus> y)
[PROOF STEP]
unfolding a_minus_def
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier Zp
y \<in> carrier Zp
\<lbrakk>x \<in> carrier Zp; \<ominus> y \<in> carrier Zp\<rbrakk> \<Longrightarrow> min (val_Zp x) (val_Zp (\<ominus> y)) \<le> val_Zp (x \<oplus> \<ominus> y)

goal (1 subgoal):
 1. min (val_Zp x) (val_Zp y) \<le> val_Zp (x \<oplus> \<ominus> y)
[PROOF STEP]
by (metis R.add.inv_closed R.add.inv_eq_1_iff nonzero_memI ord_Zp_def ord_Zp_of_a_inv val_Zp_def)


[STATEMENT]
lemma span_sum: "(\<And>x. x \<in> A \<Longrightarrow> f x \<in> span S) \<Longrightarrow> sum f A \<in> span S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> f x \<in> span S) \<Longrightarrow> sum f A \<in> span S
[PROOF STEP]
by (rule subspace_sum, rule subspace_span)


[STATEMENT]
lemma calc_ideal_point2_sq:
  assumes "(z1, z2) = calc_ideal_point2_cvec A B" "is_real A" "(cmod B)\<^sup>2 > (cmod A)\<^sup>2"
  shows "z1 * cnj z1 + z2 * cnj z2 = 2 * (B * cnj B)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z1 * cnj z1 + z2 * cnj z2 = 2 * (B * cnj B)\<^sup>2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z1 * cnj z1 + z2 * cnj z2 = 2 * (B * cnj B)\<^sup>2
[PROOF STEP]
let ?discr = "Re ((cmod B)\<^sup>2 - (Re A)\<^sup>2)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z1 * cnj z1 + z2 * cnj z2 = 2 * (B * cnj B)\<^sup>2
[PROOF STEP]
have "?discr > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(z1, z2) = calc_ideal_point2_cvec A B
is_real A
(cmod A)\<^sup>2 < (cmod B)\<^sup>2

goal (1 subgoal):
 1. 0 < Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))
[PROOF STEP]
by (simp add: cmod_power2)
[PROOF STATE]
proof (state)
this:
0 < Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))

goal (1 subgoal):
 1. z1 * cnj z1 + z2 * cnj z2 = 2 * (B * cnj B)\<^sup>2
[PROOF STEP]
have "z1 * cnj z1 = (B * cnj B) * (-A + \<i>*sqrt(?discr))*(-A - \<i>*sqrt(?discr))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z1 * cnj z1 = B * cnj B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))
[PROOF STEP]
using assms eq_cnj_iff_real[of A]
[PROOF STATE]
proof (prove)
using this:
(z1, z2) = calc_ideal_point2_cvec A B
is_real A
(cmod A)\<^sup>2 < (cmod B)\<^sup>2
(cnj A = A) = is_real A

goal (1 subgoal):
 1. z1 * cnj z1 = B * cnj B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
z1 * cnj z1 = B * cnj B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))

goal (1 subgoal):
 1. z1 * cnj z1 + z2 * cnj z2 = 2 * (B * cnj B)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
z1 * cnj z1 = B * cnj B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)))))

goal (1 subgoal):
 1. z1 * cnj z1 + z2 * cnj z2 = 2 * (B * cnj B)\<^sup>2
[PROOF STEP]
have "... = (B * cnj B) * (A\<^sup>2 + ?discr)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B * cnj B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) = B * cnj B * (A\<^sup>2 + cor (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))
[PROOF STEP]
using complex_of_real_Re[of A] \<open>is_real A\<close> \<open>?discr > 0\<close>
[PROOF STATE]
proof (prove)
using this:
is_real A \<Longrightarrow> cor (Re A) = A
is_real A
0 < Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))

goal (1 subgoal):
 1. B * cnj B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) = B * cnj B * (A\<^sup>2 + cor (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))
[PROOF STEP]
by (simp add: power2_eq_square field_simps)
[PROOF STATE]
proof (state)
this:
B * cnj B * (- A + \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) * (- A - \<i> * cor (sqrt (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))) = B * cnj B * (A\<^sup>2 + cor (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))

goal (1 subgoal):
 1. z1 * cnj z1 + z2 * cnj z2 = 2 * (B * cnj B)\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
z1 * cnj z1 = B * cnj B * (A\<^sup>2 + cor (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))
[PROOF STEP]
have "z1 * cnj z1 = (B * cnj B)\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
z1 * cnj z1 = B * cnj B * (A\<^sup>2 + cor (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))

goal (1 subgoal):
 1. z1 * cnj z1 = (B * cnj B)\<^sup>2
[PROOF STEP]
using complex_of_real_Re[of "(cmod B)\<^sup>2 - (Re A)\<^sup>2"] complex_of_real_Re[of A] \<open>is_real A\<close>
[PROOF STATE]
proof (prove)
using this:
z1 * cnj z1 = B * cnj B * (A\<^sup>2 + cor (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))
is_real (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)) \<Longrightarrow> cor (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))) = cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)
is_real A \<Longrightarrow> cor (Re A) = A
is_real A

goal (1 subgoal):
 1. z1 * cnj z1 = (B * cnj B)\<^sup>2
[PROOF STEP]
using complex_mult_cnj_cmod[of B]
[PROOF STATE]
proof (prove)
using this:
z1 * cnj z1 = B * cnj B * (A\<^sup>2 + cor (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))))
is_real (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)) \<Longrightarrow> cor (Re (cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2))) = cor ((cmod B)\<^sup>2 - (Re A)\<^sup>2)
is_real A \<Longrightarrow> cor (Re A) = A
is_real A
B * cnj B = cor ((cmod B)\<^sup>2)

goal (1 subgoal):
 1. z1 * cnj z1 = (B * cnj B)\<^sup>2
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
z1 * cnj z1 = (B * cnj B)\<^sup>2

goal (1 subgoal):
 1. z1 * cnj z1 + z2 * cnj z2 = 2 * (B * cnj B)\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
z1 * cnj z1 = (B * cnj B)\<^sup>2

goal (1 subgoal):
 1. z1 * cnj z1 + z2 * cnj z2 = 2 * (B * cnj B)\<^sup>2
[PROOF STEP]
have "z2 * cnj z2 = (B * cnj B)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z2 * cnj z2 = (B * cnj B)\<^sup>2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(z1, z2) = calc_ideal_point2_cvec A B
is_real A
(cmod A)\<^sup>2 < (cmod B)\<^sup>2

goal (1 subgoal):
 1. z2 * cnj z2 = (B * cnj B)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
z2 * cnj z2 = (B * cnj B)\<^sup>2

goal (1 subgoal):
 1. z1 * cnj z1 + z2 * cnj z2 = 2 * (B * cnj B)\<^sup>2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
z1 * cnj z1 = (B * cnj B)\<^sup>2
z2 * cnj z2 = (B * cnj B)\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z1 * cnj z1 = (B * cnj B)\<^sup>2
z2 * cnj z2 = (B * cnj B)\<^sup>2

goal (1 subgoal):
 1. z1 * cnj z1 + z2 * cnj z2 = 2 * (B * cnj B)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
z1 * cnj z1 + z2 * cnj z2 = 2 * (B * cnj B)\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_inner[continuous_intros]:
  fixes g :: "'a::topological_space \<Rightarrow> 'b::real_inner"
  assumes "continuous_on s f"
    and "continuous_on s g"
  shows "continuous_on s (\<lambda>x. inner (f x) (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on s (\<lambda>x. f x \<bullet> g x)
[PROOF STEP]
using bounded_bilinear_inner assms
[PROOF STATE]
proof (prove)
using this:
bounded_bilinear (\<bullet>)
continuous_on s f
continuous_on s g

goal (1 subgoal):
 1. continuous_on s (\<lambda>x. f x \<bullet> g x)
[PROOF STEP]
by (rule bounded_bilinear.continuous_on)


[STATEMENT]
theorem birkhoff_theorem_L1_nonergodic:
  fixes f::"'a \<Rightarrow> real"
  assumes [measurable]: "integrable M f"
  shows "(\<lambda>n. \<integral>\<^sup>+x. norm(birkhoff_sum f n x / n - real_cond_exp M Invariants f x) \<partial>M) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
define g where "g = (\<lambda>x. max (f x) 0)"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>x. max (f x) 0)

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
have g_int [measurable]: "integrable M g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M g
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>x. max (f x) 0)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
integrable M f

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

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
define h where "h = (\<lambda>x. max (-f x) 0)"
[PROOF STATE]
proof (state)
this:
h = (\<lambda>x. max (- f x) 0)

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
have h_int [measurable]: "integrable M h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M h
[PROOF STEP]
unfolding h_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>x. max (- f x) 0)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
integrable M f

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

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
have "f = (\<lambda>x. g x - h x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = (\<lambda>x. g x - h x)
[PROOF STEP]
unfolding g_def h_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = (\<lambda>x. max (f x) 0 - max (- f x) 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x. g x - h x)

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x. g x - h x)

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
fix n::nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
assume "n > 0"
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
have "\<And>x. birkhoff_sum f n x = birkhoff_sum g n x - birkhoff_sum h n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. birkhoff_sum f n x = birkhoff_sum g n x - birkhoff_sum h n x
[PROOF STEP]
using birkhoff_sum_diff \<open>f = (\<lambda>x. g x - h x)\<close>
[PROOF STATE]
proof (prove)
using this:
birkhoff_sum (\<lambda>x. ?f x - ?g x) ?n ?x = birkhoff_sum ?f ?n ?x - birkhoff_sum ?g ?n ?x
f = (\<lambda>x. g x - h x)

goal (1 subgoal):
 1. \<And>x. birkhoff_sum f n x = birkhoff_sum g n x - birkhoff_sum h n x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
birkhoff_sum f n ?x3 = birkhoff_sum g n ?x3 - birkhoff_sum h n ?x3

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
birkhoff_sum f n ?x3 = birkhoff_sum g n ?x3 - birkhoff_sum h n ?x3
[PROOF STEP]
have "\<And>x. birkhoff_sum f n x / n = birkhoff_sum g n x / n - birkhoff_sum h n x / n"
[PROOF STATE]
proof (prove)
using this:
birkhoff_sum f n ?x3 = birkhoff_sum g n ?x3 - birkhoff_sum h n ?x3

goal (1 subgoal):
 1. \<And>x. birkhoff_sum f n x / real n = birkhoff_sum g n x / real n - birkhoff_sum h n x / real n
[PROOF STEP]
using \<open>n > 0\<close>
[PROOF STATE]
proof (prove)
using this:
birkhoff_sum f n ?x3 = birkhoff_sum g n ?x3 - birkhoff_sum h n ?x3
0 < n

goal (1 subgoal):
 1. \<And>x. birkhoff_sum f n x / real n = birkhoff_sum g n x / real n - birkhoff_sum h n x / real n
[PROOF STEP]
by (simp add: diff_divide_distrib)
[PROOF STATE]
proof (state)
this:
birkhoff_sum f n ?x3 / real n = birkhoff_sum g n ?x3 / real n - birkhoff_sum h n ?x3 / real n

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
birkhoff_sum f n ?x3 / real n = birkhoff_sum g n ?x3 / real n - birkhoff_sum h n ?x3 / real n

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
have "AE x in M. real_cond_exp M Invariants g x - real_cond_exp M Invariants h x = real_cond_exp M Invariants f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. real_cond_exp M Invariants g x - real_cond_exp M Invariants h x = real_cond_exp M Invariants f x
[PROOF STEP]
using AE_symmetric[OF real_cond_exp_diff] g_int h_int \<open>f = (\<lambda>x. g x - h x)\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>integrable M ?f1; integrable M ?g1\<rbrakk> \<Longrightarrow> AE x in M. real_cond_exp M Invariants ?f1 x - real_cond_exp M Invariants ?g1 x = real_cond_exp M Invariants (\<lambda>x. ?f1 x - ?g1 x) x
integrable M g
integrable M h
f = (\<lambda>x. g x - h x)

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

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
birkhoff_sum f n ?x3 / real n = birkhoff_sum g n ?x3 / real n - birkhoff_sum h n ?x3 / real n
AE x in M. real_cond_exp M Invariants g x - real_cond_exp M Invariants h x = real_cond_exp M Invariants f x
[PROOF STEP]
have "AE x in M. birkhoff_sum f n x / n - real_cond_exp M Invariants f x =
        (birkhoff_sum g n x / n - real_cond_exp M Invariants g x) - (birkhoff_sum h n x / n - real_cond_exp M Invariants h x)"
[PROOF STATE]
proof (prove)
using this:
birkhoff_sum f n ?x3 / real n = birkhoff_sum g n ?x3 / real n - birkhoff_sum h n ?x3 / real n
AE x in M. real_cond_exp M Invariants g x - real_cond_exp M Invariants h x = real_cond_exp M Invariants f x

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

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
AE x in M. birkhoff_sum f n x / real n - real_cond_exp M Invariants f x = birkhoff_sum g n x / real n - real_cond_exp M Invariants g x - (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)
[PROOF STEP]
have *: "AE x in M. norm(birkhoff_sum f n x / n - real_cond_exp M Invariants f x) \<le>
      norm(birkhoff_sum g n x / n - real_cond_exp M Invariants g x) + norm(birkhoff_sum h n x / n - real_cond_exp M Invariants h x)"
[PROOF STATE]
proof (prove)
using this:
AE x in M. birkhoff_sum f n x / real n - real_cond_exp M Invariants f x = birkhoff_sum g n x / real n - real_cond_exp M Invariants g x - (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)

goal (1 subgoal):
 1. AE x in M. norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x) \<le> norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x) + norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in M. norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x) \<le> norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x) + norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
have "(\<integral>\<^sup>+ x. norm(birkhoff_sum f n x / n - real_cond_exp M Invariants f x) \<partial>M) \<le>
      (\<integral>\<^sup>+ x. ennreal(norm(birkhoff_sum g n x / n - real_cond_exp M Invariants g x)) + norm(birkhoff_sum h n x / n - real_cond_exp M Invariants h x) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) + ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M
[PROOF STEP]
apply (rule nn_integral_mono_AE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<le> ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) + ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x))
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
AE x in M. norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x) \<le> norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x) + norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)

goal (1 subgoal):
 1. AE x in M. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<le> ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) + ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x))
[PROOF STEP]
by (simp add: ennreal_plus[symmetric] del: ennreal_plus)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) + ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) + ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. norm(birkhoff_sum g n x / n - real_cond_exp M Invariants g x) \<partial>M) + (\<integral>\<^sup>+ x. norm(birkhoff_sum h n x / n - real_cond_exp M Invariants h x) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) + ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M = \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M
[PROOF STEP]
apply (rule nn_integral_add)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<lambda>x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x))) \<in> borel_measurable M
 2. (\<lambda>x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x))) \<in> borel_measurable M
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
using real_cond_exp_F_meas borel_measurable_cond_exp2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>integrable M ?f; ?f \<in> borel_measurable Invariants\<rbrakk> \<Longrightarrow> AE x in M. real_cond_exp M Invariants ?f x = ?f x
real_cond_exp ?M ?F ?f \<in> borel_measurable ?M

goal:
No subgoals!
[PROOF STEP]
by measurable
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) + ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M = \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M
[PROOF STEP]
have "(\<integral>\<^sup>+ x. norm(birkhoff_sum f n x / n - real_cond_exp M Invariants f x) \<partial>M) \<le>
      (\<integral>\<^sup>+ x. norm(birkhoff_sum g n x / n - real_cond_exp M Invariants g x) \<partial>M) + (\<integral>\<^sup>+ x. norm(birkhoff_sum h n x / n - real_cond_exp M Invariants h x) \<partial>M)"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
0 < ?n5 \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f ?n5 x / real ?n5 - real_cond_exp M Invariants f x)) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g ?n5 x / real ?n5 - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h ?n5 x / real ?n5 - real_cond_exp M Invariants h x)) \<partial>M

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < ?n5 \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f ?n5 x / real ?n5 - real_cond_exp M Invariants f x)) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g ?n5 x / real ?n5 - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h ?n5 x / real ?n5 - real_cond_exp M Invariants h x)) \<partial>M
[PROOF STEP]
have *: "eventually (\<lambda>n. (\<integral>\<^sup>+ x. norm(birkhoff_sum f n x / n - real_cond_exp M Invariants f x) \<partial>M) \<le>
      (\<integral>\<^sup>+ x. norm(birkhoff_sum g n x / n - real_cond_exp M Invariants g x) \<partial>M) + (\<integral>\<^sup>+ x. norm(birkhoff_sum h n x / n - real_cond_exp M Invariants h x) \<partial>M))
      sequentially"
[PROOF STATE]
proof (prove)
using this:
0 < ?n5 \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f ?n5 x / real ?n5 - real_cond_exp M Invariants f x)) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g ?n5 x / real ?n5 - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h ?n5 x / real ?n5 - real_cond_exp M Invariants h x)) \<partial>M

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M
[PROOF STEP]
using eventually_at_top_dense
[PROOF STATE]
proof (prove)
using this:
0 < ?n5 \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f ?n5 x / real ?n5 - real_cond_exp M Invariants f x)) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g ?n5 x / real ?n5 - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h ?n5 x / real ?n5 - real_cond_exp M Invariants h x)) \<partial>M
eventually ?P at_top = (\<exists>N. \<forall>n>N. ?P n)

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M \<le> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
have **: "eventually (\<lambda>n. (\<integral>\<^sup>+ x. norm(birkhoff_sum f n x / n - real_cond_exp M Invariants f x) \<partial>M) \<ge> 0) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. 0 \<le> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. 0 \<le> \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
have "(\<lambda>n. (\<integral>\<^sup>+ x. norm(birkhoff_sum g n x / n - real_cond_exp M Invariants g x) \<partial>M)) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
apply (rule birkhoff_lemma_L1, auto simp add: g_int)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 \<le> g x
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 \<le> max (f x) 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
have "(\<lambda>n. (\<integral>\<^sup>+ x. norm(birkhoff_sum h n x / n - real_cond_exp M Invariants h x) \<partial>M)) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
apply (rule birkhoff_lemma_L1, auto simp add: h_int)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 \<le> h x
[PROOF STEP]
unfolding h_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 \<le> max (- f x) 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M) \<longlonglongrightarrow> 0
(\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
have "(\<lambda>n. (\<integral>\<^sup>+ x. norm(birkhoff_sum g n x / n - real_cond_exp M Invariants g x) \<partial>M) + (\<integral>\<^sup>+ x. norm(birkhoff_sum h n x / n - real_cond_exp M Invariants h x) \<partial>M)) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M) \<longlonglongrightarrow> 0
(\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
using tendsto_add[of _ 0 _ _ 0]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M) \<longlonglongrightarrow> 0
(\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M) \<longlonglongrightarrow> 0
\<lbrakk>(?f \<longlongrightarrow> (0::?'b3)) ?F; (?g \<longlongrightarrow> (0::?'b3)) ?F\<rbrakk> \<Longrightarrow> ((\<lambda>x. ?f x + ?g x) \<longlongrightarrow> (0::?'b3) + (0::?'b3)) ?F

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
using tendsto_sandwich[OF ** *]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M) \<longlonglongrightarrow> 0
\<lbrakk>(\<lambda>n. 0) \<longlonglongrightarrow> ?c; (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum g n x / real n - real_cond_exp M Invariants g x)) \<partial>M + \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum h n x / real n - real_cond_exp M Invariants h x)) \<partial>M) \<longlonglongrightarrow> ?c\<rbrakk> \<Longrightarrow> (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> ?c

goal (1 subgoal):
 1. (\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<integral>\<^sup>+ x. ennreal (norm (birkhoff_sum f n x / real n - real_cond_exp M Invariants f x)) \<partial>M) \<longlonglongrightarrow> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma picard_lindeloef_add: "picard_lindeloef f1 T S t\<^sub>0 \<Longrightarrow> picard_lindeloef f2 T S t\<^sub>0 \<Longrightarrow>
  picard_lindeloef (\<lambda>t s. f1 t s + f2 t s) T S t\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>picard_lindeloef f1 T S t\<^sub>0; picard_lindeloef f2 T S t\<^sub>0\<rbrakk> \<Longrightarrow> picard_lindeloef (\<lambda>t s. f1 t s + f2 t s) T S t\<^sub>0
[PROOF STEP]
unfolding picard_lindeloef_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(open T \<and> open S \<and> is_interval T) \<and> t\<^sub>0 \<in> T \<and> (\<forall>s\<in>S. continuous_on T (\<lambda>t. f1 t s)) \<and> local_lipschitz T S f1; (open T \<and> open S \<and> is_interval T) \<and> t\<^sub>0 \<in> T \<and> (\<forall>s\<in>S. continuous_on T (\<lambda>t. f2 t s)) \<and> local_lipschitz T S f2\<rbrakk> \<Longrightarrow> (open T \<and> open S \<and> is_interval T) \<and> t\<^sub>0 \<in> T \<and> (\<forall>s\<in>S. continuous_on T (\<lambda>t. f1 t s + f2 t s)) \<and> local_lipschitz T S (\<lambda>t s. f1 t s + f2 t s)
[PROOF STEP]
apply(clarsimp, rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>s\<in>S. continuous_on T (\<lambda>t. f1 t s); local_lipschitz T S f1; open T; open S; is_interval T; t\<^sub>0 \<in> T; \<forall>s\<in>S. continuous_on T (\<lambda>t. f2 t s); local_lipschitz T S f2\<rbrakk> \<Longrightarrow> \<forall>s\<in>S. continuous_on T (\<lambda>t. f1 t s + f2 t s)
 2. \<lbrakk>\<forall>s\<in>S. continuous_on T (\<lambda>t. f1 t s); local_lipschitz T S f1; open T; open S; is_interval T; t\<^sub>0 \<in> T; \<forall>s\<in>S. continuous_on T (\<lambda>t. f2 t s); local_lipschitz T S f2\<rbrakk> \<Longrightarrow> local_lipschitz T S (\<lambda>t s. f1 t s + f2 t s)
[PROOF STEP]
using continuous_on_add
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>continuous_on ?s ?f; continuous_on ?s ?g\<rbrakk> \<Longrightarrow> continuous_on ?s (\<lambda>x. ?f x + ?g x)

goal (2 subgoals):
 1. \<lbrakk>\<forall>s\<in>S. continuous_on T (\<lambda>t. f1 t s); local_lipschitz T S f1; open T; open S; is_interval T; t\<^sub>0 \<in> T; \<forall>s\<in>S. continuous_on T (\<lambda>t. f2 t s); local_lipschitz T S f2\<rbrakk> \<Longrightarrow> \<forall>s\<in>S. continuous_on T (\<lambda>t. f1 t s + f2 t s)
 2. \<lbrakk>\<forall>s\<in>S. continuous_on T (\<lambda>t. f1 t s); local_lipschitz T S f1; open T; open S; is_interval T; t\<^sub>0 \<in> T; \<forall>s\<in>S. continuous_on T (\<lambda>t. f2 t s); local_lipschitz T S f2\<rbrakk> \<Longrightarrow> local_lipschitz T S (\<lambda>t s. f1 t s + f2 t s)
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>s\<in>S. continuous_on T (\<lambda>t. f1 t s); local_lipschitz T S f1; open T; open S; is_interval T; t\<^sub>0 \<in> T; \<forall>s\<in>S. continuous_on T (\<lambda>t. f2 t s); local_lipschitz T S f2\<rbrakk> \<Longrightarrow> local_lipschitz T S (\<lambda>t s. f1 t s + f2 t s)
[PROOF STEP]
using local_lipschitz_add
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>local_lipschitz ?T ?S ?f1.0; local_lipschitz ?T ?S ?f2.0\<rbrakk> \<Longrightarrow> local_lipschitz ?T ?S (\<lambda>t s. ?f1.0 t s + ?f2.0 t s)

goal (1 subgoal):
 1. \<lbrakk>\<forall>s\<in>S. continuous_on T (\<lambda>t. f1 t s); local_lipschitz T S f1; open T; open S; is_interval T; t\<^sub>0 \<in> T; \<forall>s\<in>S. continuous_on T (\<lambda>t. f2 t s); local_lipschitz T S f2\<rbrakk> \<Longrightarrow> local_lipschitz T S (\<lambda>t s. f1 t s + f2 t s)
[PROOF STEP]
by blast


[STATEMENT]
lemma geometric_pmf_prob_greaterThan:
  assumes "p \<in> {0<..1}"
  shows  "measure_pmf.prob (geometric_pmf p) {n<..} = (1 - p)^(n + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (geometric_pmf p) {n<..} = (1 - p) ^ (n + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. measure_pmf.prob (geometric_pmf p) {n<..} = (1 - p) ^ (n + 1)
[PROOF STEP]
have "(UNIV - {..n}) = {n<..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV - {..n} = {n<..}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
UNIV - {..n} = {n<..}

goal (1 subgoal):
 1. measure_pmf.prob (geometric_pmf p) {n<..} = (1 - p) ^ (n + 1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
UNIV - {..n} = {n<..}

goal (1 subgoal):
 1. measure_pmf.prob (geometric_pmf p) {n<..} = (1 - p) ^ (n + 1)
[PROOF STEP]
have "measure_pmf.prob (geometric_pmf p) (UNIV - {..n}) = (1 - p) ^ (n + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (geometric_pmf p) (UNIV - {..n}) = (1 - p) ^ (n + 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<in> {0<..1}

goal (1 subgoal):
 1. measure_pmf.prob (geometric_pmf p) (UNIV - {..n}) = (1 - p) ^ (n + 1)
[PROOF STEP]
by (subst measure_pmf.finite_measure_Diff)
                   (auto simp add: geometric_pmf_prob_atMost)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (geometric_pmf p) (UNIV - {..n}) = (1 - p) ^ (n + 1)

goal (1 subgoal):
 1. measure_pmf.prob (geometric_pmf p) {n<..} = (1 - p) ^ (n + 1)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
UNIV - {..n} = {n<..}
measure_pmf.prob (geometric_pmf p) (UNIV - {..n}) = (1 - p) ^ (n + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
UNIV - {..n} = {n<..}
measure_pmf.prob (geometric_pmf p) (UNIV - {..n}) = (1 - p) ^ (n + 1)

goal (1 subgoal):
 1. measure_pmf.prob (geometric_pmf p) {n<..} = (1 - p) ^ (n + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (geometric_pmf p) {n<..} = (1 - p) ^ (n + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mod_add_eq_mod_conv: "0 < (m::nat) \<Longrightarrow>
  ((x + a) mod m = b mod m ) =
  (x mod m = (m + b mod m - a mod m) mod m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> ((x + a) mod m = b mod m) = (x mod m = (m + b mod m - a mod m) mod m)
[PROOF STEP]
apply (simp only: mod_add_eq[symmetric, of x a])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> ((x mod m + a mod m) mod m = b mod m) = (x mod m = (m + b mod m - a mod m) mod m)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < m; (x mod m + a mod m) mod m = b mod m\<rbrakk> \<Longrightarrow> x mod m = (m + b mod m - a mod m) mod m
 2. \<lbrakk>0 < m; x mod m = (m + b mod m - a mod m) mod m\<rbrakk> \<Longrightarrow> (x mod m + a mod m) mod m = b mod m
[PROOF STEP]
apply (drule sym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < m; b mod m = (x mod m + a mod m) mod m\<rbrakk> \<Longrightarrow> x mod m = (m + b mod m - a mod m) mod m
 2. \<lbrakk>0 < m; x mod m = (m + b mod m - a mod m) mod m\<rbrakk> \<Longrightarrow> (x mod m + a mod m) mod m = b mod m
[PROOF STEP]
apply (simp add: mod_add_mod_if)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; x mod m = (m + b mod m - a mod m) mod m\<rbrakk> \<Longrightarrow> (x mod m + a mod m) mod m = b mod m
[PROOF STEP]
apply (simp add: mod_add_left_eq le_add_diff_inverse2[OF trans_le_add1[OF mod_le_divisor]])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ord_dvd_group_order:
  assumes "a \<in> carrier G" shows "(ord a) dvd (order G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord a dvd order G
[PROOF STEP]
using lagrange[OF generate_is_subgroup[of "{a}"]] assms
[PROOF STATE]
proof (prove)
using this:
{a} \<subseteq> carrier G \<Longrightarrow> card (rcosets generate G {a}) * card (generate G {a}) = order G
a \<in> carrier G

goal (1 subgoal):
 1. ord a dvd order G
[PROOF STEP]
unfolding generate_pow_card[OF assms]
[PROOF STATE]
proof (prove)
using this:
{a} \<subseteq> carrier G \<Longrightarrow> card (rcosets generate G {a}) * card (generate G {a}) = order G
a \<in> carrier G

goal (1 subgoal):
 1. card (generate G {a}) dvd order G
[PROOF STEP]
by (metis dvd_triv_right empty_subsetI insert_subset)


[STATEMENT]
lemma exp_eq_one_iff [simp]: "exp x = 1 \<longleftrightarrow> x = 0"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (exp x = 1) = (x = 0)
[PROOF STEP]
using exp_inj_iff [where x = x and y = 0]
[PROOF STATE]
proof (prove)
using this:
(exp x = exp 0) = (x = 0)

goal (1 subgoal):
 1. (exp x = 1) = (x = 0)
[PROOF STEP]
by simp


[STATEMENT]
lemma set_eq_rule: "(\<And>x. x \<in> a \<Longrightarrow> x \<in> b) \<Longrightarrow> (\<And>x. x \<in> b \<Longrightarrow> x \<in> a) \<Longrightarrow> a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. x \<in> a \<Longrightarrow> x \<in> b; \<And>x. x \<in> b \<Longrightarrow> x \<in> a\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
by(rule antisym[OF subsetI subsetI])


[STATEMENT]
lemma (in prob_space) AE_in_set_eq_1:
  assumes A[measurable]: "A \<in> events" shows "(AE x in M. x \<in> A) \<longleftrightarrow> prob A = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (AE x in M. x \<in> A) = (prob A = 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (AE x in M. x \<in> A) = (prob A = 1)
[PROOF STEP]
have *: "{x\<in>space M. x \<in> A} = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> space M. x \<in> A} = A
[PROOF STEP]
using A[THEN sets.sets_into_space]
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> space M

goal (1 subgoal):
 1. {x \<in> space M. x \<in> A} = A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x \<in> space M. x \<in> A} = A

goal (1 subgoal):
 1. (AE x in M. x \<in> A) = (prob A = 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (AE x in M. x \<in> A) = (prob A = 1)
[PROOF STEP]
by (subst AE_iff_emeasure_eq_1) (auto simp: emeasure_eq_measure *)
[PROOF STATE]
proof (state)
this:
(AE x in M. x \<in> A) = (prob A = 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cosh_real_nonneg_less_iff: "x \<ge> 0 \<Longrightarrow> y \<ge> 0 \<Longrightarrow> cosh x < cosh y \<longleftrightarrow> x < (y::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> (cosh x < cosh y) = (x < y)
[PROOF STEP]
using cosh_real_strict_mono[of x y] cosh_real_strict_mono[of y x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> x; x < y\<rbrakk> \<Longrightarrow> cosh x < cosh y
\<lbrakk>0 \<le> y; y < x\<rbrakk> \<Longrightarrow> cosh y < cosh x

goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> (cosh x < cosh y) = (x < y)
[PROOF STEP]
by (cases x y rule: linorder_cases) auto


[STATEMENT]
lemma cong_unique_inverse_prime:
  fixes p :: nat
  assumes "prime p" and "0 < x" and "x < p"
  shows "\<exists>!y. 0 < y \<and> y < p \<and> [x * y = 1] (mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!y. 0 < y \<and> y < p \<and> [x * y = 1] (mod p)
[PROOF STEP]
by (rule cong_solve_unique_nontrivial) (use assms in simp_all)


[STATEMENT]
lemma nn_integral_linear:
  assumes f: "f \<in> borel_measurable M" and g: "g \<in> borel_measurable M"
  shows "(\<integral>\<^sup>+ x. a * f x + g x \<partial>M) = a * integral\<^sup>N M f + integral\<^sup>N M g"
    (is "integral\<^sup>N M ?L = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. a * f x + g x \<partial>M = a * integral\<^sup>N M f + integral\<^sup>N M g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. a * f x + g x \<partial>M = a * integral\<^sup>N M f + integral\<^sup>N M g
[PROOF STEP]
obtain u
    where "\<And>i. simple_function M (u i)" "incseq u" "\<And>i x. u i x < top" "\<And>x. (SUP i. u i x) = f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>u. \<lbrakk>\<And>i. simple_function M (u i); incseq u; \<And>i x. u i x < top; \<And>x. (SUP i. u i x) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using borel_measurable_implies_simple_function_sequence' f(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?u \<in> borel_measurable ?M; \<And>f. \<lbrakk>\<And>i. simple_function ?M (f i); incseq f; \<And>i x. f i x < top; \<And>x. (SUP i. f i x) = ?u x\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
f \<in> borel_measurable M

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>\<And>i. simple_function M (u i); incseq u; \<And>i x. u i x < top; \<And>x. (SUP i. u i x) = f x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
simple_function M (u ?i)
incseq u
u ?i ?x < top
(SUP i. u i ?x) = f ?x

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. a * f x + g x \<partial>M = a * integral\<^sup>N M f + integral\<^sup>N M g
[PROOF STEP]
note u = nn_integral_monotone_convergence_simple[OF this(2,1)] this
[PROOF STATE]
proof (state)
this:
(SUP i. integral\<^sup>S M (u i)) = \<integral>\<^sup>+ x. (SUP i. u i x) \<partial>M
simple_function M (u ?i)
incseq u
u ?i ?x < top
(SUP i. u i ?x) = f ?x

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. a * f x + g x \<partial>M = a * integral\<^sup>N M f + integral\<^sup>N M g
[PROOF STEP]
obtain v where
    "\<And>i. simple_function M (v i)" "incseq v" "\<And>i x. v i x < top" "\<And>x. (SUP i. v i x) = g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>v. \<lbrakk>\<And>i. simple_function M (v i); incseq v; \<And>i x. v i x < top; \<And>x. (SUP i. v i x) = g x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using borel_measurable_implies_simple_function_sequence' g(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?u \<in> borel_measurable ?M; \<And>f. \<lbrakk>\<And>i. simple_function ?M (f i); incseq f; \<And>i x. f i x < top; \<And>x. (SUP i. f i x) = ?u x\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
g \<in> borel_measurable M

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>\<And>i. simple_function M (v i); incseq v; \<And>i x. v i x < top; \<And>x. (SUP i. v i x) = g x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
simple_function M (v ?i)
incseq v
v ?i ?x < top
(SUP i. v i ?x) = g ?x

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. a * f x + g x \<partial>M = a * integral\<^sup>N M f + integral\<^sup>N M g
[PROOF STEP]
note v = nn_integral_monotone_convergence_simple[OF this(2,1)] this
[PROOF STATE]
proof (state)
this:
(SUP i. integral\<^sup>S M (v i)) = \<integral>\<^sup>+ x. (SUP i. v i x) \<partial>M
simple_function M (v ?i)
incseq v
v ?i ?x < top
(SUP i. v i ?x) = g ?x

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. a * f x + g x \<partial>M = a * integral\<^sup>N M f + integral\<^sup>N M g
[PROOF STEP]
let ?L' = "\<lambda>i x. a * u i x + v i x"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. a * f x + g x \<partial>M = a * integral\<^sup>N M f + integral\<^sup>N M g
[PROOF STEP]
have "?L \<in> borel_measurable M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. a * f x + g x) \<in> borel_measurable M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable M
g \<in> borel_measurable M

goal (1 subgoal):
 1. (\<lambda>x. a * f x + g x) \<in> borel_measurable M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. a * f x + g x) \<in> borel_measurable M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. a * f x + g x \<partial>M = a * integral\<^sup>N M f + integral\<^sup>N M g
[PROOF STEP]
from borel_measurable_implies_simple_function_sequence'[OF this]
[PROOF STATE]
proof (chain)
picking this:
(\<And>fa. \<lbrakk>\<And>i. simple_function M (fa i); incseq fa; \<And>i x. fa i x < top; \<And>x. (SUP i. fa i x) = a * f x + g x\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain l where "\<And>i. simple_function M (l i)" "incseq l" "\<And>i x. l i x < top" "\<And>x. (SUP i. l i x) = a * f x + g x"
[PROOF STATE]
proof (prove)
using this:
(\<And>fa. \<lbrakk>\<And>i. simple_function M (fa i); incseq fa; \<And>i x. fa i x < top; \<And>x. (SUP i. fa i x) = a * f x + g x\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>l. \<lbrakk>\<And>i. simple_function M (l i); incseq l; \<And>i x. l i x < top; \<And>x. (SUP i. l i x) = a * f x + g x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
simple_function M (l ?i)
incseq l
l ?i ?x < top
(SUP i. l i ?x) = a * f ?x + g ?x

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. a * f x + g x \<partial>M = a * integral\<^sup>N M f + integral\<^sup>N M g
[PROOF STEP]
note l = nn_integral_monotone_convergence_simple[OF this(2,1)] this
[PROOF STATE]
proof (state)
this:
(SUP i. integral\<^sup>S M (l i)) = \<integral>\<^sup>+ x. (SUP i. l i x) \<partial>M
simple_function M (l ?i)
incseq l
l ?i ?x < top
(SUP i. l i ?x) = a * f ?x + g ?x

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. a * f x + g x \<partial>M = a * integral\<^sup>N M f + integral\<^sup>N M g
[PROOF STEP]
have inc: "incseq (\<lambda>i. a * integral\<^sup>S M (u i))" "incseq (\<lambda>i. integral\<^sup>S M (v i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. incseq (\<lambda>i. a * integral\<^sup>S M (u i)) &&& incseq (\<lambda>i. integral\<^sup>S M (v i))
[PROOF STEP]
using u v
[PROOF STATE]
proof (prove)
using this:
(SUP i. integral\<^sup>S M (u i)) = \<integral>\<^sup>+ x. (SUP i. u i x) \<partial>M
simple_function M (u ?i)
incseq u
u ?i ?x < top
(SUP i. u i ?x) = f ?x
(SUP i. integral\<^sup>S M (v i)) = \<integral>\<^sup>+ x. (SUP i. v i x) \<partial>M
simple_function M (v ?i)
incseq v
v ?i ?x < top
(SUP i. v i ?x) = g ?x

goal (1 subgoal):
 1. incseq (\<lambda>i. a * integral\<^sup>S M (u i)) &&& incseq (\<lambda>i. integral\<^sup>S M (v i))
[PROOF STEP]
by (auto simp: incseq_Suc_iff le_fun_def intro!: add_mono mult_left_mono simple_integral_mono)
[PROOF STATE]
proof (state)
this:
incseq (\<lambda>i. a * integral\<^sup>S M (u i))
incseq (\<lambda>i. integral\<^sup>S M (v i))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. a * f x + g x \<partial>M = a * integral\<^sup>N M f + integral\<^sup>N M g
[PROOF STEP]
have l': "(SUP i. integral\<^sup>S M (l i)) = (SUP i. integral\<^sup>S M (?L' i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i. integral\<^sup>S M (l i)) = (SUP i. \<integral>\<^sup>S x. a * u i x + v i x \<partial>M)
[PROOF STEP]
proof (rule SUP_simple_integral_sequences[OF l(3,2)])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. incseq (\<lambda>i x. a * u i x + v i x)
 2. \<And>i. simple_function M (\<lambda>x. a * u i x + v i x)
 3. AE x in M. (SUP i. l i x) = (SUP i. a * u i x + v i x)
[PROOF STEP]
show "incseq ?L'" "\<And>i. simple_function M (?L' i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. incseq (\<lambda>i x. a * u i x + v i x) &&& (\<And>i. simple_function M (\<lambda>x. a * u i x + v i x))
[PROOF STEP]
using u v
[PROOF STATE]
proof (prove)
using this:
(SUP i. integral\<^sup>S M (u i)) = \<integral>\<^sup>+ x. (SUP i. u i x) \<partial>M
simple_function M (u ?i)
incseq u
u ?i ?x < top
(SUP i. u i ?x) = f ?x
(SUP i. integral\<^sup>S M (v i)) = \<integral>\<^sup>+ x. (SUP i. v i x) \<partial>M
simple_function M (v ?i)
incseq v
v ?i ?x < top
(SUP i. v i ?x) = g ?x

goal (1 subgoal):
 1. incseq (\<lambda>i x. a * u i x + v i x) &&& (\<And>i. simple_function M (\<lambda>x. a * u i x + v i x))
[PROOF STEP]
unfolding incseq_Suc_iff le_fun_def
[PROOF STATE]
proof (prove)
using this:
(SUP i. integral\<^sup>S M (u i)) = \<integral>\<^sup>+ x. (SUP i. u i x) \<partial>M
simple_function M (u ?i)
\<forall>n x. u n x \<le> u (Suc n) x
u ?i ?x < top
(SUP i. u i ?x) = f ?x
(SUP i. integral\<^sup>S M (v i)) = \<integral>\<^sup>+ x. (SUP i. v i x) \<partial>M
simple_function M (v ?i)
\<forall>n x. v n x \<le> v (Suc n) x
v ?i ?x < top
(SUP i. v i ?x) = g ?x

goal (1 subgoal):
 1. \<forall>n x. a * u n x + v n x \<le> a * u (Suc n) x + v (Suc n) x &&& (\<And>i. simple_function M (\<lambda>x. a * u i x + v i x))
[PROOF STEP]
by (auto intro!: add_mono mult_left_mono)
[PROOF STATE]
proof (state)
this:
incseq (\<lambda>i x. a * u i x + v i x)
simple_function M (\<lambda>x. a * u ?i x + v ?i x)

goal (1 subgoal):
 1. AE x in M. (SUP i. l i x) = (SUP i. a * u i x + v i x)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
incseq (\<lambda>i x. a * u i x + v i x)
simple_function M (\<lambda>x. a * u ?i x + v ?i x)

goal (1 subgoal):
 1. AE x in M. (SUP i. l i x) = (SUP i. a * u i x + v i x)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. (SUP i. l i x) = (SUP i. a * u i x + v i x)
[PROOF STEP]
have "(SUP i. a * u i x + v i x) = a * (SUP i. u i x) + (SUP i. v i x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i. a * u i x + v i x) = a * (SUP i. u i x) + (SUP i. v i x)
[PROOF STEP]
using u(3) v(3) u(4)[of _ x] v(4)[of _ x]
[PROOF STATE]
proof (prove)
using this:
incseq u
incseq v
u ?i x < top
v ?i x < top

goal (1 subgoal):
 1. (SUP i. a * u i x + v i x) = a * (SUP i. u i x) + (SUP i. v i x)
[PROOF STEP]
unfolding SUP_mult_left_ennreal
[PROOF STATE]
proof (prove)
using this:
incseq u
incseq v
u ?i x < top
v ?i x < top

goal (1 subgoal):
 1. (SUP i. a * u i x + v i x) = (SUP i. a * u i x) + (SUP i. v i x)
[PROOF STEP]
by (auto intro!: ennreal_SUP_add simp: incseq_Suc_iff le_fun_def add_mono mult_left_mono)
[PROOF STATE]
proof (state)
this:
(SUP i. a * u i x + v i x) = a * (SUP i. u i x) + (SUP i. v i x)

goal (1 subgoal):
 1. AE x in M. (SUP i. l i x) = (SUP i. a * u i x + v i x)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(SUP i. a * u i ?x2 + v i ?x2) = a * (SUP i. u i ?x2) + (SUP i. v i ?x2)

goal (1 subgoal):
 1. AE x in M. (SUP i. l i x) = (SUP i. a * u i x + v i x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(SUP i. a * u i ?x2 + v i ?x2) = a * (SUP i. u i ?x2) + (SUP i. v i ?x2)
[PROOF STEP]
show "AE x in M. (SUP i. l i x) = (SUP i. ?L' i x)"
[PROOF STATE]
proof (prove)
using this:
(SUP i. a * u i ?x2 + v i ?x2) = a * (SUP i. u i ?x2) + (SUP i. v i ?x2)

goal (1 subgoal):
 1. AE x in M. (SUP i. l i x) = (SUP i. a * u i x + v i x)
[PROOF STEP]
unfolding l(5)
[PROOF STATE]
proof (prove)
using this:
(SUP i. a * u i ?x2 + v i ?x2) = a * (SUP i. u i ?x2) + (SUP i. v i ?x2)

goal (1 subgoal):
 1. AE x in M. a * f x + g x = (SUP i. a * u i x + v i x)
[PROOF STEP]
using u(5) v(5)
[PROOF STATE]
proof (prove)
using this:
(SUP i. a * u i ?x2 + v i ?x2) = a * (SUP i. u i ?x2) + (SUP i. v i ?x2)
(SUP i. u i ?x) = f ?x
(SUP i. v i ?x) = g ?x

goal (1 subgoal):
 1. AE x in M. a * f x + g x = (SUP i. a * u i x + v i x)
[PROOF STEP]
by (intro AE_I2) auto
[PROOF STATE]
proof (state)
this:
AE x in M. (SUP i. l i x) = (SUP i. a * u i x + v i x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(SUP i. integral\<^sup>S M (l i)) = (SUP i. \<integral>\<^sup>S x. a * u i x + v i x \<partial>M)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. a * f x + g x \<partial>M = a * integral\<^sup>N M f + integral\<^sup>N M g
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(SUP i. integral\<^sup>S M (l i)) = (SUP i. \<integral>\<^sup>S x. a * u i x + v i x \<partial>M)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. a * f x + g x \<partial>M = a * integral\<^sup>N M f + integral\<^sup>N M g
[PROOF STEP]
have "\<dots> = (SUP i. a * integral\<^sup>S M (u i) + integral\<^sup>S M (v i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i. \<integral>\<^sup>S x. a * u i x + v i x \<partial>M) = (SUP i. a * integral\<^sup>S M (u i) + integral\<^sup>S M (v i))
[PROOF STEP]
using u(2) v(2)
[PROOF STATE]
proof (prove)
using this:
simple_function M (u ?i)
simple_function M (v ?i)

goal (1 subgoal):
 1. (SUP i. \<integral>\<^sup>S x. a * u i x + v i x \<partial>M) = (SUP i. a * integral\<^sup>S M (u i) + integral\<^sup>S M (v i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(SUP i. \<integral>\<^sup>S x. a * u i x + v i x \<partial>M) = (SUP i. a * integral\<^sup>S M (u i) + integral\<^sup>S M (v i))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. a * f x + g x \<partial>M = a * integral\<^sup>N M f + integral\<^sup>N M g
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(SUP i. integral\<^sup>S M (l i)) = (SUP i. a * integral\<^sup>S M (u i) + integral\<^sup>S M (v i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(SUP i. integral\<^sup>S M (l i)) = (SUP i. a * integral\<^sup>S M (u i) + integral\<^sup>S M (v i))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. a * f x + g x \<partial>M = a * integral\<^sup>N M f + integral\<^sup>N M g
[PROOF STEP]
unfolding l(5)[symmetric] l(1)[symmetric]
[PROOF STATE]
proof (prove)
using this:
(SUP i. integral\<^sup>S M (l i)) = (SUP i. a * integral\<^sup>S M (u i) + integral\<^sup>S M (v i))

goal (1 subgoal):
 1. (SUP i. integral\<^sup>S M (l i)) = a * integral\<^sup>N M f + integral\<^sup>N M g
[PROOF STEP]
by (simp add: ennreal_SUP_add[OF inc] v u SUP_mult_left_ennreal[symmetric])
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. a * f x + g x \<partial>M = a * integral\<^sup>N M f + integral\<^sup>N M g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_less_floor [simp]: "0 < \<lfloor>x\<rfloor> \<longleftrightarrow> 1 \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < \<lfloor>x\<rfloor>) = ((1::'a) \<le> x)
[PROOF STEP]
by (simp add: less_floor_iff)


[STATEMENT]
lemma card_3_dist: "card {x,y,z} = 3 \<longleftrightarrow> x\<noteq>y \<and> x\<noteq>z \<and> y\<noteq>z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (card {x, y, z} = 3) = (x \<noteq> y \<and> x \<noteq> z \<and> y \<noteq> z)
[PROOF STEP]
by (simp add: eval_nat_numeral card_insert_if)


[STATEMENT]
lemma (in Ring) rMulLC:
     "\<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk>
        \<Longrightarrow> x \<cdot>\<^sub>r (y \<cdot>\<^sub>r z) = y \<cdot>\<^sub>r (x \<cdot>\<^sub>r z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r (y \<cdot>\<^sub>r z) = y \<cdot>\<^sub>r (x \<cdot>\<^sub>r z)
[PROOF STEP]
apply (subst ring_tOp_assoc [THEN sym], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r y \<cdot>\<^sub>r z = y \<cdot>\<^sub>r (x \<cdot>\<^sub>r z)
[PROOF STEP]
apply (subst ring_tOp_commute [of "x" "y"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> y \<cdot>\<^sub>r x \<cdot>\<^sub>r z = y \<cdot>\<^sub>r (x \<cdot>\<^sub>r z)
[PROOF STEP]
apply (subst ring_tOp_assoc, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> y \<cdot>\<^sub>r (x \<cdot>\<^sub>r z) = y \<cdot>\<^sub>r (x \<cdot>\<^sub>r z)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma face_of_Times_eq:
    fixes S :: "'a::euclidean_space set" and S' :: "'b::euclidean_space set"
    shows "(F \<times> F') face_of (S \<times> S') \<longleftrightarrow>
           F = {} \<or> F' = {} \<or> F face_of S \<and> F' face_of S'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F \<times> F' face_of S \<times> S') = (F = {} \<or> F' = {} \<or> F face_of S \<and> F' face_of S')
[PROOF STEP]
by (auto simp: face_of_Times_decomp times_eq_iff)


[STATEMENT]
lemma cauchy_filter_metric:
  fixes F :: "'a::{uniformity_dist,uniform_space} filter"
  shows "cauchy_filter F \<longleftrightarrow> (\<forall>e. e>0 \<longrightarrow> (\<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cauchy_filter F = (\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e))
[PROOF STEP]
proof (unfold cauchy_filter_def le_filter_def, auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>e. \<lbrakk>\<forall>P. eventually P uniformity \<longrightarrow> eventually P (F \<times>\<^sub>F F); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
 2. \<And>P. \<lbrakk>\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e); eventually P uniformity\<rbrakk> \<Longrightarrow> eventually P (F \<times>\<^sub>F F)
[PROOF STEP]
assume assm: \<open>\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)\<close>
[PROOF STATE]
proof (state)
this:
\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)

goal (2 subgoals):
 1. \<And>e. \<lbrakk>\<forall>P. eventually P uniformity \<longrightarrow> eventually P (F \<times>\<^sub>F F); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
 2. \<And>P. \<lbrakk>\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e); eventually P uniformity\<rbrakk> \<Longrightarrow> eventually P (F \<times>\<^sub>F F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
show \<open>eventually P uniformity \<Longrightarrow> eventually P (F \<times>\<^sub>F F)\<close> for P
[PROOF STATE]
proof (prove)
using this:
\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)

goal (1 subgoal):
 1. eventually P uniformity \<Longrightarrow> eventually P (F \<times>\<^sub>F F)
[PROOF STEP]
apply (auto simp: eventually_uniformity_metric)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e); 0 < e; \<forall>x y. dist x y < e \<longrightarrow> P (x, y)\<rbrakk> \<Longrightarrow> eventually P (F \<times>\<^sub>F F)
[PROOF STEP]
using eventually_prod_same
[PROOF STATE]
proof (prove)
using this:
eventually ?P (?F \<times>\<^sub>F ?F) = (\<exists>Q. eventually Q ?F \<and> (\<forall>x y. Q x \<longrightarrow> Q y \<longrightarrow> ?P (x, y)))

goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e); 0 < e; \<forall>x y. dist x y < e \<longrightarrow> P (x, y)\<rbrakk> \<Longrightarrow> eventually P (F \<times>\<^sub>F F)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
eventually ?P uniformity \<Longrightarrow> eventually ?P (F \<times>\<^sub>F F)

goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>P. eventually P uniformity \<longrightarrow> eventually P (F \<times>\<^sub>F F); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>P. eventually P uniformity \<longrightarrow> eventually P (F \<times>\<^sub>F F); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
fix e :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>P. eventually P uniformity \<longrightarrow> eventually P (F \<times>\<^sub>F F); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
assume \<open>e > 0\<close>
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>P. eventually P uniformity \<longrightarrow> eventually P (F \<times>\<^sub>F F); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
assume asm: \<open>\<forall>P. eventually P uniformity \<longrightarrow> eventually P (F \<times>\<^sub>F F)\<close>
[PROOF STATE]
proof (state)
this:
\<forall>P. eventually P uniformity \<longrightarrow> eventually P (F \<times>\<^sub>F F)

goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>P. eventually P uniformity \<longrightarrow> eventually P (F \<times>\<^sub>F F); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
define P where \<open>P \<equiv> \<lambda>(x,y :: 'a). dist x y < e\<close>
[PROOF STATE]
proof (state)
this:
P \<equiv> \<lambda>(x, y). dist x y < e

goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>P. eventually P uniformity \<longrightarrow> eventually P (F \<times>\<^sub>F F); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
with asm \<open>e > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
\<forall>P. eventually P uniformity \<longrightarrow> eventually P (F \<times>\<^sub>F F)
0 < e
P \<equiv> \<lambda>(x, y). dist x y < e
[PROOF STEP]
have \<open>eventually P (F \<times>\<^sub>F F)\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>P. eventually P uniformity \<longrightarrow> eventually P (F \<times>\<^sub>F F)
0 < e
P \<equiv> \<lambda>(x, y). dist x y < e

goal (1 subgoal):
 1. eventually P (F \<times>\<^sub>F F)
[PROOF STEP]
by (metis case_prod_conv eventually_uniformity_metric)
[PROOF STATE]
proof (state)
this:
eventually P (F \<times>\<^sub>F F)

goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>P. eventually P uniformity \<longrightarrow> eventually P (F \<times>\<^sub>F F); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eventually P (F \<times>\<^sub>F F)
[PROOF STEP]
show \<open>\<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)\<close>
[PROOF STATE]
proof (prove)
using this:
eventually P (F \<times>\<^sub>F F)

goal (1 subgoal):
 1. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
by (auto simp add: eventually_prod_same P_def)
[PROOF STATE]
proof (state)
this:
\<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_sum_le_infsum:
  fixes f :: "'a \<Rightarrow> 'b::{topological_ab_group_add, ordered_comm_monoid_add,linorder_topology}"
  assumes "f summable_on A" "finite B" "B \<subseteq> A"
  assumes "\<And>x. x \<in> A - B \<Longrightarrow> f x \<ge> 0"
  shows   "sum f B \<le> infsum f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f B \<le> infsum f A
[PROOF STEP]
by (rule finite_sum_le_has_sum[OF has_sum_infsum]) (use assms in auto)


[STATEMENT]
lemma SUP_enat_eq_0_iff [simp]: "\<Squnion> (f ` A) = (0 :: enat) \<longleftrightarrow> (\<forall>x\<in>A. f x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion> (f ` A) = 0) = (\<forall>x\<in>A. f x = 0)
[PROOF STEP]
by (simp add: bot_enat_def [symmetric])


[STATEMENT]
lemma card_eq_UNIV2[simp]: "card (UNIV::'a set) = card (S::'a::finite set) \<longleftrightarrow> S=UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (card UNIV = card S) = (S = UNIV)
[PROOF STEP]
using card_eq_UNIV[of S]
[PROOF STATE]
proof (prove)
using this:
(card S = card UNIV) = (S = UNIV)

goal (1 subgoal):
 1. (card UNIV = card S) = (S = UNIV)
[PROOF STEP]
by metis


[STATEMENT]
lemma comp_zimage_eq: "zimage g (zimage f A) = zimage (g o f) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zimage g (zimage f A) = zimage (g \<circ> f) A
[PROOF STEP]
apply (simp add: zimage_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs_zet (g ` Rep_zet (Abs_zet (f ` Rep_zet A))) = Abs_zet ((\<lambda>x. g (f x)) ` Rep_zet A)
[PROOF STEP]
apply (subst Abs_zet_inverse)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. f ` Rep_zet A \<in> zet
 2. Abs_zet (g ` f ` Rep_zet A) = Abs_zet ((\<lambda>x. g (f x)) ` Rep_zet A)
[PROOF STEP]
apply (simp_all add: image_comp zet_image_mem Rep_zet)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma zero_mem_mult_iff: "0 \<in> elts (x*y) \<longleftrightarrow> 0 \<in> elts x \<and> 0 \<in> elts y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<in> elts (x * y)) = (0 \<in> elts x \<and> 0 \<in> elts y)
[PROOF STEP]
by (metis Kirby.mult_zero_right mult_add_mem_0)


[STATEMENT]
lemma lim_1_over_ln: "((\<lambda>n. 1 / ln(real_of_nat n)) \<longlongrightarrow> 0) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 1 / ln (real n)) \<longlonglongrightarrow> 0
[PROOF STEP]
using lim_1_over_Ln [THEN filterlim_sequentially_Suc [THEN iffD2]]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. 1 / Ln (of_nat (Suc x))) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. 1 / ln (real n)) \<longlonglongrightarrow> 0
[PROOF STEP]
apply (subst filterlim_sequentially_Suc [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. 1 / Ln (of_nat (Suc x))) \<longlonglongrightarrow> 0 \<Longrightarrow> (\<lambda>x. 1 / ln (real (Suc x))) \<longlonglongrightarrow> 0
[PROOF STEP]
by (simp add: lim_sequentially dist_norm Ln_Reals_eq norm_powr_real_powr norm_divide)


[STATEMENT]
lemma interval_ne_empty_cart:
  fixes a :: "real^'n"
  shows "cbox a b \<noteq> {} \<longleftrightarrow> (\<forall>i. a$i \<le> b$i)"
    and "box a b \<noteq> {} \<longleftrightarrow> (\<forall>i. a$i < b$i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cbox a b \<noteq> {}) = (\<forall>i. a $ i \<le> b $ i) &&& (box a b \<noteq> {}) = (\<forall>i. a $ i < b $ i)
[PROOF STEP]
unfolding interval_eq_empty_cart[of a b]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>i. b $ i < a $ i) = (\<forall>i. a $ i \<le> b $ i) &&& (\<nexists>i. b $ i \<le> a $ i) = (\<forall>i. a $ i < b $ i)
[PROOF STEP]
by (auto simp add: not_less not_le)


[STATEMENT]
lemma nonzero_hnorm_inverse:
  "\<And>a::'a::real_normed_div_algebra star. a \<noteq> 0 \<Longrightarrow> hnorm (inverse a) = inverse (hnorm a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. a \<noteq> 0 \<Longrightarrow> hnorm (inverse a) = inverse (hnorm a)
[PROOF STEP]
by transfer (rule nonzero_norm_inverse)


[STATEMENT]
lemma powreal_inverse_of_nat_gt_one:
  "\<lbrakk> 1 < a; n \<noteq> 0\<rbrakk>  \<Longrightarrow> a pow\<^sub>\<real> (inverse (of_nat n)) > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 < a; n \<noteq> 0\<rbrakk> \<Longrightarrow> 1 < a pow\<^sub>\<real> inverse (real n)
[PROOF STEP]
by (metis inverse_positive_iff_positive neq0_conv of_nat_0_less_iff powreal_gt_one)