[STATEMENT]
theorem (in prob_space) central_limit_theorem_zero_mean:
  fixes X :: "nat \<Rightarrow> 'a \<Rightarrow> real"
    and \<mu> :: "real measure"
    and \<sigma> :: real
    and S :: "nat \<Rightarrow> 'a \<Rightarrow> real"
  assumes X_indep: "indep_vars (\<lambda>i. borel) X UNIV"
    and X_mean_0: "\<And>n. expectation (X n) = 0"
    and \<sigma>_pos: "\<sigma> > 0"
    and X_square_integrable: "\<And>n. integrable M (\<lambda>x. (X n x)\<^sup>2)"
    and X_variance: "\<And>n. variance (X n) = \<sigma>\<^sup>2"
    and X_distrib: "\<And>n. distr M borel (X n) = \<mu>"
  defines "S n \<equiv> \<lambda>x. \<Sum>i<n. X i x"
  shows "weak_conv_m (\<lambda>n. distr M borel (\<lambda>x. S n x / sqrt (n * \<sigma>\<^sup>2))) std_normal_distribution"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. weak_conv_m (\<lambda>n. distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) std_normal_distribution
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. weak_conv_m (\<lambda>n. distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) std_normal_distribution
[PROOF STEP]
let ?S' = "\<lambda>n x. S n x / sqrt (real n * \<sigma>\<^sup>2)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. weak_conv_m (\<lambda>n. distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) std_normal_distribution
[PROOF STEP]
define \<phi> where "\<phi> n = char (distr M borel (?S' n))" for n
[PROOF STATE]
proof (state)
this:
\<phi> ?n = char (distr M borel (\<lambda>x. S ?n x / sqrt (real ?n * \<sigma>\<^sup>2)))

goal (1 subgoal):
 1. weak_conv_m (\<lambda>n. distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) std_normal_distribution
[PROOF STEP]
define \<psi> where "\<psi> n t = char \<mu> (t / sqrt (\<sigma>\<^sup>2 * n))" for n t
[PROOF STATE]
proof (state)
this:
\<psi> ?n ?t = char \<mu> (?t / sqrt (\<sigma>\<^sup>2 * ?n))

goal (1 subgoal):
 1. weak_conv_m (\<lambda>n. distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) std_normal_distribution
[PROOF STEP]
have X_rv [simp, measurable]: "random_variable borel (X n)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. random_variable borel (X n)
[PROOF STEP]
using X_indep
[PROOF STATE]
proof (prove)
using this:
indep_vars (\<lambda>i. borel) X UNIV

goal (1 subgoal):
 1. random_variable borel (X n)
[PROOF STEP]
unfolding indep_vars_def2
[PROOF STATE]
proof (prove)
using this:
(\<forall>i\<in>UNIV. random_variable borel (X i)) \<and> indep_sets (\<lambda>i. {X i -` A \<inter> space M |A. A \<in> sets borel}) UNIV

goal (1 subgoal):
 1. random_variable borel (X n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
random_variable borel (X ?n12)

goal (1 subgoal):
 1. weak_conv_m (\<lambda>n. distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) std_normal_distribution
[PROOF STEP]
have X_integrable [simp, intro]: "integrable M (X n)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (X n)
[PROOF STEP]
by (rule square_integrable_imp_integrable[OF _ X_square_integrable]) simp_all
[PROOF STATE]
proof (state)
this:
integrable M (X ?n12)

goal (1 subgoal):
 1. weak_conv_m (\<lambda>n. distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) std_normal_distribution
[PROOF STEP]
interpret \<mu>: real_distribution \<mu>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_distribution \<mu>
[PROOF STEP]
by (subst X_distrib [symmetric, of 0], rule real_distribution_distr, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. weak_conv_m (\<lambda>n. distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) std_normal_distribution
[PROOF STEP]
have \<mu>_integrable [simp]: "integrable \<mu> (\<lambda>x. x)"
    and \<mu>_mean_integrable [simp]: "\<mu>.expectation (\<lambda>x. x) = 0"
    and \<mu>_square_integrable [simp]: "integrable \<mu> (\<lambda>x. x^2)"
    and \<mu>_variance [simp]: "\<mu>.expectation (\<lambda>x. x^2) = \<sigma>\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (integrable \<mu> (\<lambda>x. x) &&& \<mu>.expectation (\<lambda>x. x) = 0) &&& integrable \<mu> power2 &&& \<mu>.expectation power2 = \<sigma>\<^sup>2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
indep_vars (\<lambda>i. borel) X UNIV
expectation (X ?n12) = 0
0 < \<sigma>
integrable M (\<lambda>x. (X ?n12 x)\<^sup>2)
expectation (\<lambda>x. (X ?n12 x - expectation (X ?n12))\<^sup>2) = \<sigma>\<^sup>2
distr M borel (X ?n12) = \<mu>
S ?n12 \<equiv> \<lambda>x. \<Sum>i<?n12. X i x

goal (1 subgoal):
 1. (integrable \<mu> (\<lambda>x. x) &&& \<mu>.expectation (\<lambda>x. x) = 0) &&& integrable \<mu> power2 &&& \<mu>.expectation power2 = \<sigma>\<^sup>2
[PROOF STEP]
by (simp_all add: X_distrib [symmetric, of 0] integrable_distr_eq integral_distr)
[PROOF STATE]
proof (state)
this:
integrable \<mu> (\<lambda>x. x)
\<mu>.expectation (\<lambda>x. x) = 0
integrable \<mu> power2
\<mu>.expectation power2 = \<sigma>\<^sup>2

goal (1 subgoal):
 1. weak_conv_m (\<lambda>n. distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) std_normal_distribution
[PROOF STEP]
have main: "\<forall>\<^sub>F n in sequentially.
      cmod (\<phi> n t - (1 + (-(t^2) / 2) / n)^n) \<le>
      t\<^sup>2 / (6 * \<sigma>\<^sup>2) * (LINT x|\<mu>. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * n)\<bar> * \<bar>x\<bar> ^ 3))" for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. cmod (\<phi> n t - complex_of_real ((1 + - t\<^sup>2 / 2 / real n) ^ n)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))
[PROOF STEP]
proof (rule eventually_sequentiallyI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
assume "n \<ge> nat (ceiling (t^2 / 4))"
[PROOF STATE]
proof (state)
this:
nat \<lceil>t\<^sup>2 / 4\<rceil> \<le> n

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
hence n: "n \<ge> t^2 / 4"
[PROOF STATE]
proof (prove)
using this:
nat \<lceil>t\<^sup>2 / 4\<rceil> \<le> n

goal (1 subgoal):
 1. t\<^sup>2 / 4 \<le> real n
[PROOF STEP]
by (subst nat_ceiling_le_eq [symmetric])
[PROOF STATE]
proof (state)
this:
t\<^sup>2 / 4 \<le> real n

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
let ?t = "t / sqrt (\<sigma>\<^sup>2 * n)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
define \<psi>' where "\<psi>' n i = char (distr M borel (\<lambda>x. X i x / sqrt (\<sigma>\<^sup>2 * n)))" for n i
[PROOF STATE]
proof (state)
this:
\<psi>' ?n ?i = char (distr M borel (\<lambda>x. X ?i x / sqrt (\<sigma>\<^sup>2 * ?n)))

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
have *: "\<And>n i t. \<psi>' n i t = \<psi> n t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n i t. \<psi>' n i t = \<psi> n t
[PROOF STEP]
unfolding \<psi>_def \<psi>'_def char_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n i t. CLINT x|distr M borel (\<lambda>x. X i x / sqrt (\<sigma>\<^sup>2 * n)). iexp (t * x) = \<mu>.expectation (\<lambda>x. iexp (t / sqrt (\<sigma>\<^sup>2 * n) * x))
[PROOF STEP]
by (subst X_distrib [symmetric]) (auto simp: integral_distr)
[PROOF STATE]
proof (state)
this:
\<psi>' ?n12 ?i12 ?t12 = \<psi> ?n12 ?t12

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
have "\<phi> n t = char (distr M borel (\<lambda>x. \<Sum>i<n. X i x / sqrt (\<sigma>\<^sup>2 * real n))) t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<phi> n t = char (distr M borel (\<lambda>x. \<Sum>i<n. X i x / sqrt (\<sigma>\<^sup>2 * real n))) t
[PROOF STEP]
by (auto simp: \<phi>_def S_def sum_divide_distrib ac_simps)
[PROOF STATE]
proof (state)
this:
\<phi> n t = char (distr M borel (\<lambda>x. \<Sum>i<n. X i x / sqrt (\<sigma>\<^sup>2 * real n))) t

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<phi> n t = char (distr M borel (\<lambda>x. \<Sum>i<n. X i x / sqrt (\<sigma>\<^sup>2 * real n))) t

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
have "\<dots> = (\<Prod> i < n. \<psi>' n i t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char (distr M borel (\<lambda>x. \<Sum>i<n. X i x / sqrt (\<sigma>\<^sup>2 * real n))) t = (\<Prod>i<n. \<psi>' (real n) i t)
[PROOF STEP]
unfolding \<psi>'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char (distr M borel (\<lambda>x. \<Sum>i<n. X i x / sqrt (\<sigma>\<^sup>2 * real n))) t = (\<Prod>i<n. char (distr M borel (\<lambda>x. X i x / sqrt (\<sigma>\<^sup>2 * real n))) t)
[PROOF STEP]
apply (rule char_distr_sum)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_vars (\<lambda>i. borel) (\<lambda>i \<omega>. X i \<omega> / sqrt (\<sigma>\<^sup>2 * real n)) {..<n}
[PROOF STEP]
apply (rule indep_vars_compose2[where X=X])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. indep_vars ?M'2 X {..<n}
 2. \<And>i. i \<in> {..<n} \<Longrightarrow> (\<lambda>a. a / sqrt (\<sigma>\<^sup>2 * real n)) \<in> borel_measurable (?M'2 i)
[PROOF STEP]
apply (rule indep_vars_subset)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. indep_vars ?M'2 X ?I5
 2. {..<n} \<subseteq> ?I5
 3. \<And>i. i \<in> {..<n} \<Longrightarrow> (\<lambda>a. a / sqrt (\<sigma>\<^sup>2 * real n)) \<in> borel_measurable (?M'2 i)
[PROOF STEP]
apply (rule X_indep)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {..<n} \<subseteq> UNIV
 2. \<And>i. i \<in> {..<n} \<Longrightarrow> (\<lambda>a. a / sqrt (\<sigma>\<^sup>2 * real n)) \<in> borel_measurable borel
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
char (distr M borel (\<lambda>x. \<Sum>i<n. X i x / sqrt (\<sigma>\<^sup>2 * real n))) t = (\<Prod>i<n. \<psi>' (real n) i t)

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
char (distr M borel (\<lambda>x. \<Sum>i<n. X i x / sqrt (\<sigma>\<^sup>2 * real n))) t = (\<Prod>i<n. \<psi>' (real n) i t)

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
have "\<dots> = (\<psi> n t)^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i<n. \<psi>' (real n) i t) = \<psi> (real n) t ^ n
[PROOF STEP]
by (auto simp add: * prod_constant)
[PROOF STATE]
proof (state)
this:
(\<Prod>i<n. \<psi>' (real n) i t) = \<psi> (real n) t ^ n

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<phi> n t = \<psi> (real n) t ^ n
[PROOF STEP]
have \<phi>_eq: "\<phi> n t =(\<psi> n t)^n"
[PROOF STATE]
proof (prove)
using this:
\<phi> n t = \<psi> (real n) t ^ n

goal (1 subgoal):
 1. \<phi> n t = \<psi> (real n) t ^ n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<phi> n t = \<psi> (real n) t ^ n

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
have "norm (\<psi> n t - (1 - ?t^2 * \<sigma>\<^sup>2 / 2)) \<le> ?t\<^sup>2 / 6 * (LINT x|\<mu>. min (6 * x\<^sup>2) (\<bar>?t\<bar> * \<bar>x\<bar> ^ 3))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (\<psi> (real n) t - complex_of_real (1 - (t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 * \<sigma>\<^sup>2 / 2)) \<le> (t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 / 6 * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))
[PROOF STEP]
unfolding \<psi>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (char \<mu> (t / sqrt (\<sigma>\<^sup>2 * real n)) - complex_of_real (1 - (t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 * \<sigma>\<^sup>2 / 2)) \<le> (t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 / 6 * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))
[PROOF STEP]
by (rule \<mu>.char_approx3, auto)
[PROOF STATE]
proof (state)
this:
cmod (\<psi> (real n) t - complex_of_real (1 - (t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 * \<sigma>\<^sup>2 / 2)) \<le> (t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 / 6 * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (\<psi> (real n) t - complex_of_real (1 - (t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 * \<sigma>\<^sup>2 / 2)) \<le> (t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 / 6 * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
have "?t^2 * \<sigma>\<^sup>2 = t^2 / n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 * \<sigma>\<^sup>2 = t\<^sup>2 / real n
[PROOF STEP]
using \<sigma>_pos
[PROOF STATE]
proof (prove)
using this:
0 < \<sigma>

goal (1 subgoal):
 1. (t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 * \<sigma>\<^sup>2 = t\<^sup>2 / real n
[PROOF STEP]
by (simp add: power_divide)
[PROOF STATE]
proof (state)
this:
(t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 * \<sigma>\<^sup>2 = t\<^sup>2 / real n

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 * \<sigma>\<^sup>2 = t\<^sup>2 / real n

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
have "t^2 / n / 2 = (t^2 / 2) / n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t\<^sup>2 / real n / 2 = t\<^sup>2 / 2 / real n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
t\<^sup>2 / real n / 2 = t\<^sup>2 / 2 / real n

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (\<psi> (real n) t - complex_of_real (1 - t\<^sup>2 / 2 / real n)) \<le> (t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 / 6 * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))
[PROOF STEP]
have **: "norm (\<psi> n t - (1 + (-(t^2) / 2) / n)) \<le>
      ?t\<^sup>2 / 6 * (LINT x|\<mu>. min (6 * x\<^sup>2) (\<bar>?t\<bar> * \<bar>x\<bar> ^ 3))"
[PROOF STATE]
proof (prove)
using this:
cmod (\<psi> (real n) t - complex_of_real (1 - t\<^sup>2 / 2 / real n)) \<le> (t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 / 6 * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))

goal (1 subgoal):
 1. cmod (\<psi> (real n) t - complex_of_real (1 + - t\<^sup>2 / 2 / real n)) \<le> (t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 / 6 * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cmod (\<psi> (real n) t - complex_of_real (1 + - t\<^sup>2 / 2 / real n)) \<le> (t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 / 6 * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
have "norm (\<phi> n t - (complex_of_real (1 + (-(t^2) / 2) / n))^n) \<le>
         n * norm (\<psi> n t - (complex_of_real (1 + (-(t^2) / 2) / n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (\<phi> n t - complex_of_real (1 + - t\<^sup>2 / 2 / real n) ^ n) \<le> real n * cmod (\<psi> (real n) t - complex_of_real (1 + - t\<^sup>2 / 2 / real n))
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
t\<^sup>2 / 4 \<le> real n

goal (1 subgoal):
 1. cmod (\<phi> n t - complex_of_real (1 + - t\<^sup>2 / 2 / real n) ^ n) \<le> real n * cmod (\<psi> (real n) t - complex_of_real (1 + - t\<^sup>2 / 2 / real n))
[PROOF STEP]
by (auto intro!: norm_power_diff \<mu>.cmod_char_le_1 abs_leI
               simp del: of_real_diff simp: of_real_diff[symmetric] divide_le_eq \<phi>_eq \<psi>_def)
[PROOF STATE]
proof (state)
this:
cmod (\<phi> n t - complex_of_real (1 + - t\<^sup>2 / 2 / real n) ^ n) \<le> real n * cmod (\<psi> (real n) t - complex_of_real (1 + - t\<^sup>2 / 2 / real n))

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (\<phi> n t - complex_of_real (1 + - t\<^sup>2 / 2 / real n) ^ n) \<le> real n * cmod (\<psi> (real n) t - complex_of_real (1 + - t\<^sup>2 / 2 / real n))

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
have "\<dots> \<le> n * (?t\<^sup>2 / 6 * (LINT x|\<mu>. min (6 * x\<^sup>2) (\<bar>?t\<bar> * \<bar>x\<bar> ^ 3)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n * cmod (\<psi> (real n) t - complex_of_real (1 + - t\<^sup>2 / 2 / real n)) \<le> real n * ((t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 / 6 * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3)))
[PROOF STEP]
by (rule mult_left_mono [OF **], simp)
[PROOF STATE]
proof (state)
this:
real n * cmod (\<psi> (real n) t - complex_of_real (1 + - t\<^sup>2 / 2 / real n)) \<le> real n * ((t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 / 6 * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3)))

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real n * cmod (\<psi> (real n) t - complex_of_real (1 + - t\<^sup>2 / 2 / real n)) \<le> real n * ((t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 / 6 * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3)))

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
have "\<dots> = (t\<^sup>2 / (6 * \<sigma>\<^sup>2) * (LINT x|\<mu>. min (6 * x\<^sup>2) (\<bar>?t\<bar> * \<bar>x\<bar> ^ 3)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n * ((t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 / 6 * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))) = t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))
[PROOF STEP]
using \<sigma>_pos
[PROOF STATE]
proof (prove)
using this:
0 < \<sigma>

goal (1 subgoal):
 1. real n * ((t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 / 6 * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))) = t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))
[PROOF STEP]
by (simp add: field_simps min_absorb2)
[PROOF STATE]
proof (state)
this:
real n * ((t / sqrt (\<sigma>\<^sup>2 * real n))\<^sup>2 / 6 * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))) = t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))

goal (1 subgoal):
 1. \<And>x. ?c \<le> x \<Longrightarrow> cmod (\<phi> x t - complex_of_real ((1 + - t\<^sup>2 / 2 / real x) ^ x)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (\<phi> n t - complex_of_real (1 + - t\<^sup>2 / 2 / real n) ^ n) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))
[PROOF STEP]
show "norm (\<phi> n t - (1 + (-(t^2) / 2) / n)^n) \<le>
        (t\<^sup>2 / (6 * \<sigma>\<^sup>2) * (LINT x|\<mu>. min (6 * x\<^sup>2) (\<bar>?t\<bar> * \<bar>x\<bar> ^ 3)))"
[PROOF STATE]
proof (prove)
using this:
cmod (\<phi> n t - complex_of_real (1 + - t\<^sup>2 / 2 / real n) ^ n) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))

goal (1 subgoal):
 1. cmod (\<phi> n t - complex_of_real ((1 + - t\<^sup>2 / 2 / real n) ^ n)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cmod (\<phi> n t - complex_of_real ((1 + - t\<^sup>2 / 2 / real n) ^ n)) \<le> t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. cmod (\<phi> n ?t12 - complex_of_real ((1 + - ?t12\<^sup>2 / 2 / real n) ^ n)) \<le> ?t12\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>x. min (6 * x\<^sup>2) (\<bar>?t12 / sqrt (\<sigma>\<^sup>2 * real n)\<bar> * \<bar>x\<bar> ^ 3))

goal (1 subgoal):
 1. weak_conv_m (\<lambda>n. distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) std_normal_distribution
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. weak_conv_m (\<lambda>n. distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) std_normal_distribution
[PROOF STEP]
proof (rule levy_continuity)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>n. real_distribution (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2)))
 2. real_distribution std_normal_distribution
 3. \<And>t. (\<lambda>n. char (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) t) \<longlonglongrightarrow> char std_normal_distribution t
[PROOF STEP]
fix t
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>n. real_distribution (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2)))
 2. real_distribution std_normal_distribution
 3. \<And>t. (\<lambda>n. char (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) t) \<longlonglongrightarrow> char std_normal_distribution t
[PROOF STEP]
let ?t = "\<lambda>n. t / sqrt (\<sigma>\<^sup>2 * n)"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>n. real_distribution (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2)))
 2. real_distribution std_normal_distribution
 3. \<And>t. (\<lambda>n. char (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) t) \<longlonglongrightarrow> char std_normal_distribution t
[PROOF STEP]
have "\<And>x. (\<lambda>n. min (6 * x\<^sup>2) (\<bar>t\<bar> * \<bar>x\<bar> ^ 3 / \<bar>sqrt (\<sigma>\<^sup>2 * real n)\<bar>)) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (\<lambda>n. min (6 * x\<^sup>2) (\<bar>t\<bar> * \<bar>x\<bar> ^ 3 / \<bar>sqrt (\<sigma>\<^sup>2 * real n)\<bar>)) \<longlonglongrightarrow> 0
[PROOF STEP]
using \<sigma>_pos
[PROOF STATE]
proof (prove)
using this:
0 < \<sigma>

goal (1 subgoal):
 1. \<And>x. (\<lambda>n. min (6 * x\<^sup>2) (\<bar>t\<bar> * \<bar>x\<bar> ^ 3 / \<bar>sqrt (\<sigma>\<^sup>2 * real n)\<bar>)) \<longlonglongrightarrow> 0
[PROOF STEP]
by (auto simp: real_sqrt_mult min_absorb2
               intro!: tendsto_min[THEN tendsto_eq_rhs] sqrt_at_top[THEN filterlim_compose]
                       filterlim_tendsto_pos_mult_at_top filterlim_at_top_imp_at_infinity
                       tendsto_divide_0 filterlim_real_sequentially)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. min (6 * ?x12\<^sup>2) (\<bar>t\<bar> * \<bar>?x12\<bar> ^ 3 / \<bar>sqrt (\<sigma>\<^sup>2 * real n)\<bar>)) \<longlonglongrightarrow> 0

goal (3 subgoals):
 1. \<And>n. real_distribution (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2)))
 2. real_distribution std_normal_distribution
 3. \<And>t. (\<lambda>n. char (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) t) \<longlonglongrightarrow> char std_normal_distribution t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. min (6 * ?x12\<^sup>2) (\<bar>t\<bar> * \<bar>?x12\<bar> ^ 3 / \<bar>sqrt (\<sigma>\<^sup>2 * real n)\<bar>)) \<longlonglongrightarrow> 0
[PROOF STEP]
have "(\<lambda>n. LINT x|\<mu>. min (6 * x\<^sup>2) (\<bar>?t n\<bar> * \<bar>x\<bar> ^ 3)) \<longlonglongrightarrow> (LINT x|\<mu>. 0)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. min (6 * ?x12\<^sup>2) (\<bar>t\<bar> * \<bar>?x12\<bar> ^ 3 / \<bar>sqrt (\<sigma>\<^sup>2 * real n)\<bar>)) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>x. \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))) \<longlonglongrightarrow> \<mu>.expectation (\<lambda>x. 0)
[PROOF STEP]
by (intro integral_dominated_convergence [where w = "\<lambda>x. 6 * x^2"]) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))) \<longlonglongrightarrow> \<mu>.expectation (\<lambda>x. 0)

goal (3 subgoals):
 1. \<And>n. real_distribution (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2)))
 2. real_distribution std_normal_distribution
 3. \<And>t. (\<lambda>n. char (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) t) \<longlonglongrightarrow> char std_normal_distribution t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))) \<longlonglongrightarrow> \<mu>.expectation (\<lambda>x. 0)
[PROOF STEP]
have *: "(\<lambda>n. t\<^sup>2 / (6 * \<sigma>\<^sup>2) * (LINT x|\<mu>. min (6 * x\<^sup>2) (\<bar>?t n\<bar> * \<bar>x\<bar> ^ 3))) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))) \<longlonglongrightarrow> \<mu>.expectation (\<lambda>x. 0)

goal (1 subgoal):
 1. (\<lambda>x. t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))) \<longlonglongrightarrow> 0
[PROOF STEP]
by (simp only: integral_zero tendsto_mult_right_zero)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. t\<^sup>2 / (6 * \<sigma>\<^sup>2) * \<mu>.expectation (\<lambda>xa. min (6 * xa\<^sup>2) (\<bar>t / sqrt (\<sigma>\<^sup>2 * real x)\<bar> * \<bar>xa\<bar> ^ 3))) \<longlonglongrightarrow> 0

goal (3 subgoals):
 1. \<And>n. real_distribution (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2)))
 2. real_distribution std_normal_distribution
 3. \<And>t. (\<lambda>n. char (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) t) \<longlonglongrightarrow> char std_normal_distribution t
[PROOF STEP]
have "(\<lambda>n. complex_of_real ((1 + (-(t^2) / 2) / n)^n)) \<longlonglongrightarrow> complex_of_real (exp (-(t^2) / 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. complex_of_real ((1 + - t\<^sup>2 / 2 / real n) ^ n)) \<longlonglongrightarrow> complex_of_real (exp (- t\<^sup>2 / 2))
[PROOF STEP]
by (rule isCont_tendsto_compose [OF _ tendsto_exp_limit_sequentially]) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. complex_of_real ((1 + - t\<^sup>2 / 2 / real n) ^ n)) \<longlonglongrightarrow> complex_of_real (exp (- t\<^sup>2 / 2))

goal (3 subgoals):
 1. \<And>n. real_distribution (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2)))
 2. real_distribution std_normal_distribution
 3. \<And>t. (\<lambda>n. char (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) t) \<longlonglongrightarrow> char std_normal_distribution t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. complex_of_real ((1 + - t\<^sup>2 / 2 / real n) ^ n)) \<longlonglongrightarrow> complex_of_real (exp (- t\<^sup>2 / 2))
[PROOF STEP]
have "(\<lambda>n. \<phi> n t) \<longlonglongrightarrow> complex_of_real (exp (-(t^2) / 2))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. complex_of_real ((1 + - t\<^sup>2 / 2 / real n) ^ n)) \<longlonglongrightarrow> complex_of_real (exp (- t\<^sup>2 / 2))

goal (1 subgoal):
 1. (\<lambda>n. \<phi> n t) \<longlonglongrightarrow> complex_of_real (exp (- t\<^sup>2 / 2))
[PROOF STEP]
by (rule Lim_transform) (rule Lim_null_comparison [OF main *])
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<phi> n t) \<longlonglongrightarrow> complex_of_real (exp (- t\<^sup>2 / 2))

goal (3 subgoals):
 1. \<And>n. real_distribution (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2)))
 2. real_distribution std_normal_distribution
 3. \<And>t. (\<lambda>n. char (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) t) \<longlonglongrightarrow> char std_normal_distribution t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<phi> n t) \<longlonglongrightarrow> complex_of_real (exp (- t\<^sup>2 / 2))
[PROOF STEP]
show "(\<lambda>n. char (distr M borel (?S' n)) t) \<longlonglongrightarrow> char std_normal_distribution t"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<phi> n t) \<longlonglongrightarrow> complex_of_real (exp (- t\<^sup>2 / 2))

goal (1 subgoal):
 1. (\<lambda>n. char (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) t) \<longlonglongrightarrow> char std_normal_distribution t
[PROOF STEP]
by (simp add: \<phi>_def char_std_normal_distribution)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. char (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) t) \<longlonglongrightarrow> char std_normal_distribution t

goal (2 subgoals):
 1. \<And>n. real_distribution (distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2)))
 2. real_distribution std_normal_distribution
[PROOF STEP]
qed (auto intro!: real_dist_normal_dist simp: S_def)
[PROOF STATE]
proof (state)
this:
weak_conv_m (\<lambda>n. distr M borel (\<lambda>x. S n x / sqrt (real n * \<sigma>\<^sup>2))) std_normal_distribution

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma MOST_finite_Ball_distrib: "finite A \<Longrightarrow> (MOST y. \<forall>x\<in>A. P x y) \<longleftrightarrow> (\<forall>x\<in>A. MOST y. P x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> (\<forall>\<^sub>\<infinity>y. \<forall>x\<in>A. P x y) = (\<forall>x\<in>A. \<forall>\<^sub>\<infinity>y. P x y)
[PROOF STEP]
by (fact eventually_ball_finite_distrib)


[STATEMENT]
lemma sum_list_replicate [simp]: "sum_list (replicate n x) = n * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (replicate n x) = n * x
[PROOF STEP]
by (induction n) auto


[STATEMENT]
lemma wf_eq_defl: "(\<forall>y. d y \<le> d (x \<cdot> y) \<longrightarrow> d y = 0) \<longleftrightarrow> (\<forall>y. y \<le> x \<cdot> y \<longrightarrow> y = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>y. d y \<le> d (x \<cdot> y) \<longrightarrow> d y = (0::'a)) = (\<forall>y. y \<le> x \<cdot> y \<longrightarrow> y = (0::'a))
[PROOF STEP]
apply standard
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>y. d y \<le> d (x \<cdot> y) \<longrightarrow> d y = (0::'a) \<Longrightarrow> \<forall>y. y \<le> x \<cdot> y \<longrightarrow> y = (0::'a)
 2. \<forall>y. y \<le> x \<cdot> y \<longrightarrow> y = (0::'a) \<Longrightarrow> \<forall>y. d y \<le> d (x \<cdot> y) \<longrightarrow> d y = (0::'a)
[PROOF STEP]
apply (metis local.d_add_ax local.d_rest_ax local.less_eq_def local.s_prod_annil)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y. y \<le> x \<cdot> y \<longrightarrow> y = (0::'a) \<Longrightarrow> \<forall>y. d y \<le> d (x \<cdot> y) \<longrightarrow> d y = (0::'a)
[PROOF STEP]
by (metis local.c2_d local.c4 local.d_def local.mult_commute local.mult_onel local.p_rpd_annir local.s_prod_isor)


[STATEMENT]
lemma  trace_0: "trace (mat 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (mat (0::'a)) = (0::'a)
[PROOF STEP]
by (simp add: trace_def mat_def)


[STATEMENT]
lemma sinh_complex_eq_iff:
  "sinh (z :: complex) = sinh w \<longleftrightarrow>
      (\<exists>n\<in>\<int>. z = w - 2 * \<i> * of_real n * of_real pi \<or>
              z = -(2 * complex_of_real n + 1) * \<i> * complex_of_real pi - w)" (is "_ = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sinh z = sinh w) = (\<exists>n\<in>\<int>. z = w - 2 * \<i> * complex_of_real n * complex_of_real pi \<or> z = - (2 * complex_of_real n + 1) * \<i> * complex_of_real pi - w)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (sinh z = sinh w) = (\<exists>n\<in>\<int>. z = w - 2 * \<i> * complex_of_real n * complex_of_real pi \<or> z = - (2 * complex_of_real n + 1) * \<i> * complex_of_real pi - w)
[PROOF STEP]
have "sinh z = sinh w \<longleftrightarrow> sin (\<i> * z) = sin (\<i> * w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sinh z = sinh w) = (sin (\<i> * z) = sin (\<i> * w))
[PROOF STEP]
by (simp add: sinh_conv_sin)
[PROOF STATE]
proof (state)
this:
(sinh z = sinh w) = (sin (\<i> * z) = sin (\<i> * w))

goal (1 subgoal):
 1. (sinh z = sinh w) = (\<exists>n\<in>\<int>. z = w - 2 * \<i> * complex_of_real n * complex_of_real pi \<or> z = - (2 * complex_of_real n + 1) * \<i> * complex_of_real pi - w)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(sinh z = sinh w) = (sin (\<i> * z) = sin (\<i> * w))

goal (1 subgoal):
 1. (sinh z = sinh w) = (\<exists>n\<in>\<int>. z = w - 2 * \<i> * complex_of_real n * complex_of_real pi \<or> z = - (2 * complex_of_real n + 1) * \<i> * complex_of_real pi - w)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sin (\<i> * z) = sin (\<i> * w)) = (\<exists>n\<in>\<int>. z = w - 2 * \<i> * complex_of_real n * complex_of_real pi \<or> z = - (2 * complex_of_real n + 1) * \<i> * complex_of_real pi - w)
[PROOF STEP]
by (subst complex_sin_eq) (force simp: field_simps complex_eq_iff)
[PROOF STATE]
proof (state)
this:
(sin (\<i> * z) = sin (\<i> * w)) = (\<exists>n\<in>\<int>. z = w - 2 * \<i> * complex_of_real n * complex_of_real pi \<or> z = - (2 * complex_of_real n + 1) * \<i> * complex_of_real pi - w)

goal (1 subgoal):
 1. (sinh z = sinh w) = (\<exists>n\<in>\<int>. z = w - 2 * \<i> * complex_of_real n * complex_of_real pi \<or> z = - (2 * complex_of_real n + 1) * \<i> * complex_of_real pi - w)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(sinh z = sinh w) = (\<exists>n\<in>\<int>. z = w - 2 * \<i> * complex_of_real n * complex_of_real pi \<or> z = - (2 * complex_of_real n + 1) * \<i> * complex_of_real pi - w)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(sinh z = sinh w) = (\<exists>n\<in>\<int>. z = w - 2 * \<i> * complex_of_real n * complex_of_real pi \<or> z = - (2 * complex_of_real n + 1) * \<i> * complex_of_real pi - w)

goal (1 subgoal):
 1. (sinh z = sinh w) = (\<exists>n\<in>\<int>. z = w - 2 * \<i> * complex_of_real n * complex_of_real pi \<or> z = - (2 * complex_of_real n + 1) * \<i> * complex_of_real pi - w)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(sinh z = sinh w) = (\<exists>n\<in>\<int>. z = w - 2 * \<i> * complex_of_real n * complex_of_real pi \<or> z = - (2 * complex_of_real n + 1) * \<i> * complex_of_real pi - w)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem integral_Markov_inequality'_measure:
  assumes [measurable]: "set_integrable M A u" and "A \<in> sets M"
     and "AE x in M. x \<in> A \<longrightarrow> 0 \<le> u x" "0 < (c::real)"
  shows "measure M {x\<in>A. u x \<ge> c} \<le> (\<integral>x\<in>A. u x \<partial>M) / c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M {x \<in> A. c \<le> u x} \<le> set_lebesgue_integral M A u / c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sigma_Algebra.measure M {x \<in> A. c \<le> u x} \<le> set_lebesgue_integral M A u / c
[PROOF STEP]
have nonneg: "set_lebesgue_integral M A u \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> set_lebesgue_integral M A u
[PROOF STEP]
unfolding set_lebesgue_integral_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> LINT x|M. indicat_real A x *\<^sub>R u x
[PROOF STEP]
by (intro Bochner_Integration.integral_nonneg_AE eventually_mono[OF assms(3)])
       (auto simp: mult_ac)
[PROOF STATE]
proof (state)
this:
0 \<le> set_lebesgue_integral M A u

goal (1 subgoal):
 1. Sigma_Algebra.measure M {x \<in> A. c \<le> u x} \<le> set_lebesgue_integral M A u / c
[PROOF STEP]
have le: "emeasure M {x\<in>A. u x \<ge> c} \<le> ennreal ((1/c) * (\<integral>x\<in>A. u x \<partial>M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M {x \<in> A. c \<le> u x} \<le> ennreal (1 / c * set_lebesgue_integral M A u)
[PROOF STEP]
by (rule integral_Markov_inequality') (use assms in auto)
[PROOF STATE]
proof (state)
this:
emeasure M {x \<in> A. c \<le> u x} \<le> ennreal (1 / c * set_lebesgue_integral M A u)

goal (1 subgoal):
 1. Sigma_Algebra.measure M {x \<in> A. c \<le> u x} \<le> set_lebesgue_integral M A u / c
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure M {x \<in> A. c \<le> u x} \<le> ennreal (1 / c * set_lebesgue_integral M A u)

goal (1 subgoal):
 1. Sigma_Algebra.measure M {x \<in> A. c \<le> u x} \<le> set_lebesgue_integral M A u / c
[PROOF STEP]
have "\<dots> < top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (1 / c * set_lebesgue_integral M A u) < top
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ennreal (1 / c * set_lebesgue_integral M A u) < top

goal (1 subgoal):
 1. Sigma_Algebra.measure M {x \<in> A. c \<le> u x} \<le> set_lebesgue_integral M A u / c
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure M {x \<in> A. c \<le> u x} < top
[PROOF STEP]
have "ennreal (measure M {x\<in>A. u x \<ge> c}) = emeasure M {x\<in>A. u x \<ge> c}"
[PROOF STATE]
proof (prove)
using this:
emeasure M {x \<in> A. c \<le> u x} < top

goal (1 subgoal):
 1. ennreal (Sigma_Algebra.measure M {x \<in> A. c \<le> u x}) = emeasure M {x \<in> A. c \<le> u x}
[PROOF STEP]
by (intro emeasure_eq_ennreal_measure [symmetric]) auto
[PROOF STATE]
proof (state)
this:
ennreal (Sigma_Algebra.measure M {x \<in> A. c \<le> u x}) = emeasure M {x \<in> A. c \<le> u x}

goal (1 subgoal):
 1. Sigma_Algebra.measure M {x \<in> A. c \<le> u x} \<le> set_lebesgue_integral M A u / c
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (Sigma_Algebra.measure M {x \<in> A. c \<le> u x}) = emeasure M {x \<in> A. c \<le> u x}

goal (1 subgoal):
 1. Sigma_Algebra.measure M {x \<in> A. c \<le> u x} \<le> set_lebesgue_integral M A u / c
[PROOF STEP]
note le
[PROOF STATE]
proof (state)
this:
emeasure M {x \<in> A. c \<le> u x} \<le> ennreal (1 / c * set_lebesgue_integral M A u)

goal (1 subgoal):
 1. Sigma_Algebra.measure M {x \<in> A. c \<le> u x} \<le> set_lebesgue_integral M A u / c
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ennreal (Sigma_Algebra.measure M {x \<in> A. c \<le> u x}) \<le> ennreal (1 / c * set_lebesgue_integral M A u)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ennreal (Sigma_Algebra.measure M {x \<in> A. c \<le> u x}) \<le> ennreal (1 / c * set_lebesgue_integral M A u)

goal (1 subgoal):
 1. Sigma_Algebra.measure M {x \<in> A. c \<le> u x} \<le> set_lebesgue_integral M A u / c
[PROOF STEP]
using nonneg
[PROOF STATE]
proof (prove)
using this:
ennreal (Sigma_Algebra.measure M {x \<in> A. c \<le> u x}) \<le> ennreal (1 / c * set_lebesgue_integral M A u)
0 \<le> set_lebesgue_integral M A u

goal (1 subgoal):
 1. Sigma_Algebra.measure M {x \<in> A. c \<le> u x} \<le> set_lebesgue_integral M A u / c
[PROOF STEP]
by (subst (asm) ennreal_le_iff)
       (auto intro!: divide_nonneg_pos Bochner_Integration.integral_nonneg_AE assms)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M {x \<in> A. c \<le> u x} \<le> set_lebesgue_integral M A u / c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ceiling_less_cancel: "\<lceil>x\<rceil> < \<lceil>y\<rceil> \<Longrightarrow> x < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>x\<rceil> < \<lceil>y\<rceil> \<Longrightarrow> x < y
[PROOF STEP]
by (auto simp add: not_le [symmetric] ceiling_mono)


[STATEMENT]
lemma compactin_Times:
   "compactin (prod_topology X Y) (S \<times> T) \<longleftrightarrow> S = {} \<or> T = {} \<or> compactin X S \<and> compactin Y T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compactin (prod_topology X Y) (S \<times> T) = (S = {} \<or> T = {} \<or> compactin X S \<and> compactin Y T)
[PROOF STEP]
by (auto simp: compactin_subspace subtopology_Times compact_space_prod_topology)


[STATEMENT]
lemma MPoly_monomial_power:
  \<open>n > 0 \<Longrightarrow> MPoly (monomial 1 x') ^ (n) =  MPoly (monomial (1) (((\<lambda>x. x + x') ^^ (n - 1)) x'))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> MPoly (monomial (1::'a) x') ^ n = MPoly (monomial (1::'a) (((\<lambda>x. x + x') ^^ (n - 1)) x'))
[PROOF STEP]
using MPoly_monomial_power'[of _ \<open>n-1\<close>]
[PROOF STATE]
proof (prove)
using this:
MPoly (monomial (1::?'a) ?x') ^ (n - 1 + 1) = MPoly (monomial (1::?'a) (((\<lambda>x. x + ?x') ^^ (n - 1)) ?x'))

goal (1 subgoal):
 1. 0 < n \<Longrightarrow> MPoly (monomial (1::'a) x') ^ n = MPoly (monomial (1::'a) (((\<lambda>x. x + x') ^^ (n - 1)) x'))
[PROOF STEP]
by auto


[STATEMENT]
lemma finite_lessThan_enat_iff:
  "finite {..<m :: enat} \<longleftrightarrow> m \<noteq> \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {..<m} = (m \<noteq> \<infinity>)
[PROOF STEP]
by(cases m)(auto intro: finite_lessThan_enatI simp add: infinite_lessThan_infty)


[STATEMENT]
lemma distinct_sorted_merge[simp]:
  "\<lbrakk> distinct xs; distinct ys; sorted xs; sorted ys \<rbrakk>
     \<Longrightarrow> distinct (merge xs ys) \<and> sorted (merge xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xs; distinct ys; sorted xs; sorted ys\<rbrakk> \<Longrightarrow> distinct (merge xs ys) \<and> sorted (merge xs ys)
[PROOF STEP]
by (induct xs ys rule: merge.induct) (auto)


[STATEMENT]
lemma inversion_id_iff_on_unit_circle:
  shows "inversion a = a \<longleftrightarrow> on_circline unit_circle a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inversion a = a) = on_circline unit_circle a
[PROOF STEP]
using inversion_id_iff[of a] inf_or_of_complex[of a]
[PROOF STATE]
proof (prove)
using this:
(a = inversion a) = (a \<noteq> \<infinity>\<^sub>h \<and> to_complex a * cnj (to_complex a) = 1)
a = \<infinity>\<^sub>h \<or> (\<exists>x. a = of_complex x)

goal (1 subgoal):
 1. (inversion a = a) = on_circline unit_circle a
[PROOF STEP]
by auto


[STATEMENT]
lemma multiplicity_prod_prime_powers_nat':
  "finite S \<Longrightarrow> \<forall>p\<in>S. prime p \<Longrightarrow> prime p \<Longrightarrow>
     multiplicity p (\<Prod>S :: nat) = (if p \<in> S then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite S; \<forall>p\<in>S. prime p; prime p\<rbrakk> \<Longrightarrow> multiplicity p (\<Prod>S) = (if p \<in> S then 1 else 0)
[PROOF STEP]
using multiplicity_prod_prime_powers[of S p "\<lambda>_. 1"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite S; \<And>x. x \<in> S \<Longrightarrow> prime x; prime p\<rbrakk> \<Longrightarrow> multiplicity p (\<Prod>p\<in>S. p ^ 1) = (if p \<in> S then 1 else 0)

goal (1 subgoal):
 1. \<lbrakk>finite S; \<forall>p\<in>S. prime p; prime p\<rbrakk> \<Longrightarrow> multiplicity p (\<Prod>S) = (if p \<in> S then 1 else 0)
[PROOF STEP]
by simp


[STATEMENT]
lemma float_sign_le: "(-1::real)^(sign a) = 1 \<or> (-1::real)^(sign a) = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ sign a = 1 \<or> (- 1) ^ sign a = - 1
[PROOF STEP]
by (metis neg_one_even_power neg_one_odd_power)


[STATEMENT]
lemma hom_frag_minus:
  assumes "h \<in> hom (free_Abelian_group S) (free_Abelian_group T)" "Poly_Mapping.keys a \<subseteq> S"
  shows "h (-a) = - (h a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h (- a) = - h a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. h (- a) = - h a
[PROOF STEP]
have "Poly_Mapping.keys (h a) \<subseteq> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Poly_Mapping.keys (h a) \<subseteq> T
[PROOF STEP]
by (meson assms carrier_free_Abelian_group_iff hom_in_carrier)
[PROOF STATE]
proof (state)
this:
Poly_Mapping.keys (h a) \<subseteq> T

goal (1 subgoal):
 1. h (- a) = - h a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Poly_Mapping.keys (h a) \<subseteq> T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Poly_Mapping.keys (h a) \<subseteq> T

goal (1 subgoal):
 1. h (- a) = - h a
[PROOF STEP]
by (metis (no_types) assms carrier_free_Abelian_group_iff group_free_Abelian_group group_hom.hom_inv group_hom_axioms_def group_hom_def inv_free_Abelian_group)
[PROOF STATE]
proof (state)
this:
h (- a) = - h a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma univalent_right_unique[simp]:
  shows "right_unique (\<lambda> x y. (x,y) \<in> R) = univalent R"
        "univalent {(x,y).r x y} = right_unique r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. right_unique (\<lambda>x y. (x, y) \<in> R) = univalent R &&& univalent {(x, y). r x y} = right_unique r
[PROOF STEP]
unfolding univalent_def right_unique_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y z. (x, y) \<in> R \<longrightarrow> (x, z) \<in> R \<longrightarrow> y = z) = (\<forall>x y z. (x, y) \<in> R \<and> (x, z) \<in> R \<longrightarrow> z = y) &&& (\<forall>x y z. (x, y) \<in> {(x, y). r x y} \<and> (x, z) \<in> {(x, y). r x y} \<longrightarrow> z = y) = (\<forall>x y z. r x y \<longrightarrow> r x z \<longrightarrow> y = z)
[PROOF STEP]
by auto


[STATEMENT]
lemma (in prob_space) indep_sets_finite_index_sets:
  "indep_sets F I \<longleftrightarrow> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> indep_sets F J)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_sets F I = (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> indep_sets F J)
[PROOF STEP]
proof (intro iffI allI impI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>J. \<lbrakk>indep_sets F I; J \<subseteq> I; J \<noteq> {}; finite J\<rbrakk> \<Longrightarrow> indep_sets F J
 2. \<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> indep_sets F J \<Longrightarrow> indep_sets F I
[PROOF STEP]
assume *: "\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> indep_sets F J"
[PROOF STATE]
proof (state)
this:
\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> indep_sets F J

goal (2 subgoals):
 1. \<And>J. \<lbrakk>indep_sets F I; J \<subseteq> I; J \<noteq> {}; finite J\<rbrakk> \<Longrightarrow> indep_sets F J
 2. \<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> indep_sets F J \<Longrightarrow> indep_sets F I
[PROOF STEP]
show "indep_sets F I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_sets F I
[PROOF STEP]
unfolding indep_sets_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i\<in>I. F i \<subseteq> events) \<and> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> (\<forall>A\<in>Pi J F. prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))))
[PROOF STEP]
proof (intro conjI ballI allI impI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> F i \<subseteq> events
 2. \<And>J A. \<lbrakk>J \<subseteq> I; J \<noteq> {}; finite J; A \<in> Pi J F\<rbrakk> \<Longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> F i \<subseteq> events
 2. \<And>J A. \<lbrakk>J \<subseteq> I; J \<noteq> {}; finite J; A \<in> Pi J F\<rbrakk> \<Longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
assume "i \<in> I"
[PROOF STATE]
proof (state)
this:
i \<in> I

goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> F i \<subseteq> events
 2. \<And>J A. \<lbrakk>J \<subseteq> I; J \<noteq> {}; finite J; A \<in> Pi J F\<rbrakk> \<Longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
with *[THEN spec, of "{i}"]
[PROOF STATE]
proof (chain)
picking this:
{i} \<subseteq> I \<longrightarrow> {i} \<noteq> {} \<longrightarrow> finite {i} \<longrightarrow> indep_sets F {i}
i \<in> I
[PROOF STEP]
show "F i \<subseteq> events"
[PROOF STATE]
proof (prove)
using this:
{i} \<subseteq> I \<longrightarrow> {i} \<noteq> {} \<longrightarrow> finite {i} \<longrightarrow> indep_sets F {i}
i \<in> I

goal (1 subgoal):
 1. F i \<subseteq> events
[PROOF STEP]
by (auto simp: indep_sets_def)
[PROOF STATE]
proof (state)
this:
F i \<subseteq> events

goal (1 subgoal):
 1. \<And>J A. \<lbrakk>J \<subseteq> I; J \<noteq> {}; finite J; A \<in> Pi J F\<rbrakk> \<Longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
qed (insert *, auto simp: indep_sets_def)
[PROOF STATE]
proof (state)
this:
indep_sets F I

goal (1 subgoal):
 1. \<And>J. \<lbrakk>indep_sets F I; J \<subseteq> I; J \<noteq> {}; finite J\<rbrakk> \<Longrightarrow> indep_sets F J
[PROOF STEP]
qed (auto simp: indep_sets_def)


[STATEMENT]
lemma strict_prefix_map_inj:
  "\<lbrakk> inj_on f (set xs \<union> set ys); strict_prefix (map f xs) (map f ys) \<rbrakk> \<Longrightarrow>
   strict_prefix xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f (set xs \<union> set ys); strict_prefix (map f xs) (map f ys)\<rbrakk> \<Longrightarrow> strict_prefix xs ys
[PROOF STEP]
apply (induct xs arbitrary:ys)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>ys. \<lbrakk>inj_on f (set [] \<union> set ys); strict_prefix (map f []) (map f ys)\<rbrakk> \<Longrightarrow> strict_prefix [] ys
 2. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>inj_on f (set xs \<union> set ys); strict_prefix (map f xs) (map f ys)\<rbrakk> \<Longrightarrow> strict_prefix xs ys; inj_on f (set (a # xs) \<union> set ys); strict_prefix (map f (a # xs)) (map f ys)\<rbrakk> \<Longrightarrow> strict_prefix (a # xs) ys
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>ys. \<lbrakk>inj_on f (set ys); strict_prefix [] (map f ys)\<rbrakk> \<Longrightarrow> strict_prefix [] ys
 2. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>inj_on f (set xs \<union> set ys); strict_prefix (map f xs) (map f ys)\<rbrakk> \<Longrightarrow> strict_prefix xs ys; strict_prefix (f a # map f xs) (map f ys); inj_on f (set xs \<union> set ys); f a \<notin> f ` (set xs \<union> set ys - {a})\<rbrakk> \<Longrightarrow> strict_prefix (a # xs) ys
[PROOF STEP]
apply (simp flip: prefix_bot.bot_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>inj_on f (set xs \<union> set ys); strict_prefix (map f xs) (map f ys)\<rbrakk> \<Longrightarrow> strict_prefix xs ys; strict_prefix (f a # map f xs) (map f ys); inj_on f (set xs \<union> set ys); f a \<notin> f ` (set xs \<union> set ys - {a})\<rbrakk> \<Longrightarrow> strict_prefix (a # xs) ys
[PROOF STEP]
apply (erule strict_prefix_Cons_elim)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs ys ys'. \<lbrakk>\<And>ys. \<lbrakk>inj_on f (set xs \<union> set ys); strict_prefix (map f xs) (map f ys)\<rbrakk> \<Longrightarrow> strict_prefix xs ys; inj_on f (set xs \<union> set ys); f a \<notin> f ` (set xs \<union> set ys - {a}); map f ys = f a # ys'; strict_prefix (map f xs) ys'\<rbrakk> \<Longrightarrow> strict_prefix (a # xs) ys
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs z zs. \<lbrakk>\<And>ys. \<lbrakk>inj_on f (set xs \<union> set ys); strict_prefix (map f xs) (map f ys)\<rbrakk> \<Longrightarrow> strict_prefix xs ys; f a \<notin> f ` (insert z (set xs \<union> set zs) - {a}); strict_prefix (map f xs) (map f zs); f z = f a; inj_on f (set xs \<union> set zs); f a \<notin> f ` (set xs \<union> set zs - {z})\<rbrakk> \<Longrightarrow> a = z
[PROOF STEP]
apply (metis image_eqI insert_Diff_single insert_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma irreflexive_cong:
  "(\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> r a b \<longleftrightarrow> r' a b) \<Longrightarrow> irreflexive A r \<longleftrightarrow> irreflexive A r'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>a \<in> A; b \<in> A\<rbrakk> \<Longrightarrow> r a b = r' a b) \<Longrightarrow> irreflexive A r = irreflexive A r'
[PROOF STEP]
by (simp add: irreflexive_def)


[STATEMENT]
lemma ln_diff_le_inverse:
  assumes "x \<ge> (1::real)"
  shows   "ln (x + 1) - ln x < 1 / x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (x + 1) - ln x < 1 / x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln (x + 1) - ln x < 1 / x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
1 \<le> x
[PROOF STEP]
have "\<exists>z>x. z < x + 1 \<and> ln (x + 1) - ln x = (x + 1 - x) * inverse z"
[PROOF STATE]
proof (prove)
using this:
1 \<le> x

goal (1 subgoal):
 1. \<exists>z>x. z < x + 1 \<and> ln (x + 1) - ln x = (x + 1 - x) * inverse z
[PROOF STEP]
by (intro MVT2) (auto intro!: derivative_eq_intros simp: field_simps)
[PROOF STATE]
proof (state)
this:
\<exists>z>x. z < x + 1 \<and> ln (x + 1) - ln x = (x + 1 - x) * inverse z

goal (1 subgoal):
 1. ln (x + 1) - ln x < 1 / x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>z>x. z < x + 1 \<and> ln (x + 1) - ln x = (x + 1 - x) * inverse z
[PROOF STEP]
obtain z where z: "z > x" "z < x + 1" "ln (x + 1) - ln x = inverse z"
[PROOF STATE]
proof (prove)
using this:
\<exists>z>x. z < x + 1 \<and> ln (x + 1) - ln x = (x + 1 - x) * inverse z

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>x < z; z < x + 1; ln (x + 1) - ln x = inverse z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x < z
z < x + 1
ln (x + 1) - ln x = inverse z

goal (1 subgoal):
 1. ln (x + 1) - ln x < 1 / x
[PROOF STEP]
have "ln (x + 1) - ln x = inverse z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (x + 1) - ln x = inverse z
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
ln (x + 1) - ln x = inverse z

goal (1 subgoal):
 1. ln (x + 1) - ln x < 1 / x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (x + 1) - ln x = inverse z

goal (1 subgoal):
 1. ln (x + 1) - ln x < 1 / x
[PROOF STEP]
from z(1,2) assms
[PROOF STATE]
proof (chain)
picking this:
x < z
z < x + 1
1 \<le> x
[PROOF STEP]
have "\<dots> < 1 / x"
[PROOF STATE]
proof (prove)
using this:
x < z
z < x + 1
1 \<le> x

goal (1 subgoal):
 1. inverse z < 1 / x
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
inverse z < 1 / x

goal (1 subgoal):
 1. ln (x + 1) - ln x < 1 / x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ln (x + 1) - ln x < 1 / x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ln (x + 1) - ln x < 1 / x

goal (1 subgoal):
 1. ln (x + 1) - ln x < 1 / x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ln (x + 1) - ln x < 1 / x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lebesgue_integral_count_space_finite_support:
  assumes f: "finite {a\<in>A. f a \<noteq> 0}"
  shows "(\<integral>x. f x \<partial>count_space A) = (\<Sum>a | a \<in> A \<and> f a \<noteq> 0. f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L (count_space A) f = (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). f a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral\<^sup>L (count_space A) f = (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). f a)
[PROOF STEP]
have eq: "\<And>x. x \<in> A \<Longrightarrow> (\<Sum>a | x = a \<and> a \<in> A \<and> f a \<noteq> 0. f a) = (\<Sum>x\<in>{x}. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> (\<Sum>a | x = a \<and> a \<in> A \<and> f a \<noteq> (0::'b). f a) = sum f {x}
[PROOF STEP]
by (intro sum.mono_neutral_cong_left) auto
[PROOF STATE]
proof (state)
this:
?x \<in> A \<Longrightarrow> (\<Sum>a | ?x = a \<and> a \<in> A \<and> f a \<noteq> (0::'b). f a) = sum f {?x}

goal (1 subgoal):
 1. integral\<^sup>L (count_space A) f = (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). f a)
[PROOF STEP]
have "(\<integral>x. f x \<partial>count_space A) = (\<integral>x. (\<Sum>a | a \<in> A \<and> f a \<noteq> 0. indicator {a} x *\<^sub>R f a) \<partial>count_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L (count_space A) f = LINT x|count_space A. (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). indicat_real {a} x *\<^sub>R f a)
[PROOF STEP]
by (intro integral_cong refl) (simp add: f eq)
[PROOF STATE]
proof (state)
this:
integral\<^sup>L (count_space A) f = LINT x|count_space A. (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). indicat_real {a} x *\<^sub>R f a)

goal (1 subgoal):
 1. integral\<^sup>L (count_space A) f = (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). f a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>L (count_space A) f = LINT x|count_space A. (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). indicat_real {a} x *\<^sub>R f a)

goal (1 subgoal):
 1. integral\<^sup>L (count_space A) f = (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). f a)
[PROOF STEP]
have "\<dots> = (\<Sum>a | a \<in> A \<and> f a \<noteq> 0. measure (count_space A) {a} *\<^sub>R f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|count_space A. (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). indicat_real {a} x *\<^sub>R f a) = (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). Sigma_Algebra.measure (count_space A) {a} *\<^sub>R f a)
[PROOF STEP]
by (subst integral_sum) (auto intro!: sum.cong)
[PROOF STATE]
proof (state)
this:
LINT x|count_space A. (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). indicat_real {a} x *\<^sub>R f a) = (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). Sigma_Algebra.measure (count_space A) {a} *\<^sub>R f a)

goal (1 subgoal):
 1. integral\<^sup>L (count_space A) f = (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). f a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>L (count_space A) f = (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). Sigma_Algebra.measure (count_space A) {a} *\<^sub>R f a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>L (count_space A) f = (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). Sigma_Algebra.measure (count_space A) {a} *\<^sub>R f a)

goal (1 subgoal):
 1. integral\<^sup>L (count_space A) f = (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). f a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integral\<^sup>L (count_space A) f = (\<Sum>a | a \<in> A \<and> f a \<noteq> (0::'b). f a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homologous_rel_trans:
  assumes "homologous_rel p X S b c" "homologous_rel p X S a b"
  shows "homologous_rel p X S a c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homologous_rel p X S a c
[PROOF STEP]
using homologous_rel_def
[PROOF STATE]
proof (prove)
using this:
homologous_rel ?p ?X ?S \<equiv> \<lambda>a b. singular_relboundary ?p ?X ?S (a - b)

goal (1 subgoal):
 1. homologous_rel p X S a c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>p X S. homologous_rel p X S \<equiv> \<lambda>a b. singular_relboundary p X S (a - b)) \<Longrightarrow> homologous_rel p X S a c
[PROOF STEP]
have "singular_relboundary p X S (b - c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. singular_relboundary p X S (b - c)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
homologous_rel p X S b c
homologous_rel p X S a b

goal (1 subgoal):
 1. singular_relboundary p X S (b - c)
[PROOF STEP]
unfolding homologous_rel_def
[PROOF STATE]
proof (prove)
using this:
singular_relboundary p X S (b - c)
singular_relboundary p X S (a - b)

goal (1 subgoal):
 1. singular_relboundary p X S (b - c)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
singular_relboundary p X S (b - c)

goal (1 subgoal):
 1. (\<And>p X S. homologous_rel p X S \<equiv> \<lambda>a b. singular_relboundary p X S (a - b)) \<Longrightarrow> homologous_rel p X S a c
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
singular_relboundary p X S (b - c)

goal (1 subgoal):
 1. (\<And>p X S. homologous_rel p X S \<equiv> \<lambda>a b. singular_relboundary p X S (a - b)) \<Longrightarrow> homologous_rel p X S a c
[PROOF STEP]
have "singular_relboundary p X S (b - a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. singular_relboundary p X S (b - a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
homologous_rel p X S b c
homologous_rel p X S a b

goal (1 subgoal):
 1. singular_relboundary p X S (b - a)
[PROOF STEP]
by (meson homologous_rel_def homologous_rel_sym)
[PROOF STATE]
proof (state)
this:
singular_relboundary p X S (b - a)

goal (1 subgoal):
 1. (\<And>p X S. homologous_rel p X S \<equiv> \<lambda>a b. singular_relboundary p X S (a - b)) \<Longrightarrow> homologous_rel p X S a c
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
singular_relboundary p X S (b - c)
singular_relboundary p X S (b - a)
[PROOF STEP]
have "singular_relboundary p X S (c - a)"
[PROOF STATE]
proof (prove)
using this:
singular_relboundary p X S (b - c)
singular_relboundary p X S (b - a)

goal (1 subgoal):
 1. singular_relboundary p X S (c - a)
[PROOF STEP]
using singular_relboundary_diff
[PROOF STATE]
proof (prove)
using this:
singular_relboundary p X S (b - c)
singular_relboundary p X S (b - a)
\<lbrakk>singular_relboundary ?p ?X ?S ?a; singular_relboundary ?p ?X ?S ?b\<rbrakk> \<Longrightarrow> singular_relboundary ?p ?X ?S (?a - ?b)

goal (1 subgoal):
 1. singular_relboundary p X S (c - a)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
singular_relboundary p X S (c - a)

goal (1 subgoal):
 1. (\<And>p X S. homologous_rel p X S \<equiv> \<lambda>a b. singular_relboundary p X S (a - b)) \<Longrightarrow> homologous_rel p X S a c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
singular_relboundary p X S (c - a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
singular_relboundary p X S (c - a)

goal (1 subgoal):
 1. homologous_rel p X S a c
[PROOF STEP]
by (meson homologous_rel_def homologous_rel_sym)
[PROOF STATE]
proof (state)
this:
homologous_rel p X S a c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma find_None_iff: "List.find P xs = None \<longleftrightarrow> \<not> (\<exists>x. x \<in> set xs \<and> P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (find P xs = None) = (\<nexists>x. x \<in> set xs \<and> P x)
[PROOF STEP]
proof (induction xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (find P [] = None) = (\<nexists>x. x \<in> set [] \<and> P x)
 2. \<And>a xs. (find P xs = None) = (\<nexists>x. x \<in> set xs \<and> P x) \<Longrightarrow> (find P (a # xs) = None) = (\<nexists>x. x \<in> set (a # xs) \<and> P x)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (find P [] = None) = (\<nexists>x. x \<in> set [] \<and> P x)
 2. \<And>a xs. (find P xs = None) = (\<nexists>x. x \<in> set xs \<and> P x) \<Longrightarrow> (find P (a # xs) = None) = (\<nexists>x. x \<in> set (a # xs) \<and> P x)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (find P [] = None) = (\<nexists>x. x \<in> set [] \<and> P x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(find P [] = None) = (\<nexists>x. x \<in> set [] \<and> P x)

goal (1 subgoal):
 1. \<And>a xs. (find P xs = None) = (\<nexists>x. x \<in> set xs \<and> P x) \<Longrightarrow> (find P (a # xs) = None) = (\<nexists>x. x \<in> set (a # xs) \<and> P x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. (find P xs = None) = (\<nexists>x. x \<in> set xs \<and> P x) \<Longrightarrow> (find P (a # xs) = None) = (\<nexists>x. x \<in> set (a # xs) \<and> P x)
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
(find P xs = None) = (\<nexists>x. x \<in> set xs \<and> P x)

goal (1 subgoal):
 1. \<And>a xs. (find P xs = None) = (\<nexists>x. x \<in> set xs \<and> P x) \<Longrightarrow> (find P (a # xs) = None) = (\<nexists>x. x \<in> set (a # xs) \<and> P x)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
(find P xs = None) = (\<nexists>x. x \<in> set xs \<and> P x)

goal (1 subgoal):
 1. (find P (x # xs) = None) = (\<nexists>xa. xa \<in> set (x # xs) \<and> P xa)
[PROOF STEP]
by (fastforce split: if_splits)
[PROOF STATE]
proof (state)
this:
(find P (x # xs) = None) = (\<nexists>xa. xa \<in> set (x # xs) \<and> P xa)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in ceuclidean_space) cinner_not_same_CBasis: "u \<in> CBasis \<Longrightarrow> v \<in> CBasis \<Longrightarrow> u \<noteq> v \<Longrightarrow> cinner u v = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<in> CBasis; v \<in> CBasis; u \<noteq> v\<rbrakk> \<Longrightarrow> u \<bullet>\<^sub>C v = 0
[PROOF STEP]
by (simp add: cinner_CBasis)


[STATEMENT]
lemma integral_change_of_variables_linear:
  fixes f :: "real^'m::{finite,wellorder} \<Rightarrow> real^'n" and g :: "real^'m::_ \<Rightarrow> real^'m::_"
  assumes "linear g"
      and "f absolutely_integrable_on (g ` S) \<or> (f \<circ> g) absolutely_integrable_on S"
    shows "integral (g ` S) f = \<bar>det (matrix g)\<bar> *\<^sub>R integral S (f \<circ> g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral (g ` S) f = \<bar>det (matrix g)\<bar> *\<^sub>R integral S (f \<circ> g)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral (g ` S) f = \<bar>det (matrix g)\<bar> *\<^sub>R integral S (f \<circ> g)
[PROOF STEP]
have "((\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S) \<or> (f absolutely_integrable_on g ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<or> f absolutely_integrable_on g ` S
[PROOF STEP]
using absolutely_integrable_on_linear_image assms
[PROOF STATE]
proof (prove)
using this:
linear ?g \<Longrightarrow> (?f absolutely_integrable_on ?g ` ?S) = (?f \<circ> ?g absolutely_integrable_on ?S \<or> det (matrix ?g) = 0)
linear g
f absolutely_integrable_on g ` S \<or> f \<circ> g absolutely_integrable_on S

goal (1 subgoal):
 1. (\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<or> f absolutely_integrable_on g ` S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<or> f absolutely_integrable_on g ` S

goal (1 subgoal):
 1. integral (g ` S) f = \<bar>det (matrix g)\<bar> *\<^sub>R integral S (f \<circ> g)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<or> f absolutely_integrable_on g ` S

goal (1 subgoal):
 1. integral (g ` S) f = \<bar>det (matrix g)\<bar> *\<^sub>R integral S (f \<circ> g)
[PROOF STEP]
have ?thesis if "((\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S)" "(f absolutely_integrable_on g ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral (g ` S) f = \<bar>det (matrix g)\<bar> *\<^sub>R integral S (f \<circ> g)
[PROOF STEP]
using has_absolute_integral_change_of_variables_linear [OF \<open>linear g\<close>] that
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R ?f (g x)) absolutely_integrable_on ?S \<and> integral ?S (\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R ?f (g x)) = ?b) = (?f absolutely_integrable_on g ` ?S \<and> integral (g ` ?S) ?f = ?b)
(\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S
f absolutely_integrable_on g ` S

goal (1 subgoal):
 1. integral (g ` S) f = \<bar>det (matrix g)\<bar> *\<^sub>R integral S (f \<circ> g)
[PROOF STEP]
by (auto simp: o_def)
[PROOF STATE]
proof (state)
this:
\<lbrakk>(\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S; f absolutely_integrable_on g ` S\<rbrakk> \<Longrightarrow> integral (g ` S) f = \<bar>det (matrix g)\<bar> *\<^sub>R integral S (f \<circ> g)

goal (1 subgoal):
 1. integral (g ` S) f = \<bar>det (matrix g)\<bar> *\<^sub>R integral S (f \<circ> g)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<or> f absolutely_integrable_on g ` S
\<lbrakk>(\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S; f absolutely_integrable_on g ` S\<rbrakk> \<Longrightarrow> integral (g ` S) f = \<bar>det (matrix g)\<bar> *\<^sub>R integral S (f \<circ> g)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<or> f absolutely_integrable_on g ` S
\<lbrakk>(\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S; f absolutely_integrable_on g ` S\<rbrakk> \<Longrightarrow> integral (g ` S) f = \<bar>det (matrix g)\<bar> *\<^sub>R integral S (f \<circ> g)

goal (1 subgoal):
 1. integral (g ` S) f = \<bar>det (matrix g)\<bar> *\<^sub>R integral S (f \<circ> g)
[PROOF STEP]
using absolutely_integrable_change_of_variables_linear [OF \<open>linear g\<close>]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<or> f absolutely_integrable_on g ` S
\<lbrakk>(\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S; f absolutely_integrable_on g ` S\<rbrakk> \<Longrightarrow> integral (g ` S) f = \<bar>det (matrix g)\<bar> *\<^sub>R integral S (f \<circ> g)
((\<lambda>x. \<bar>det (matrix g)\<bar> *\<^sub>R ?f (g x)) absolutely_integrable_on ?S) = (?f absolutely_integrable_on g ` ?S)

goal (1 subgoal):
 1. integral (g ` S) f = \<bar>det (matrix g)\<bar> *\<^sub>R integral S (f \<circ> g)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
integral (g ` S) f = \<bar>det (matrix g)\<bar> *\<^sub>R integral S (f \<circ> g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tuple_decode_encode:
  assumes "length xs > 0"
  shows "tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < length xs

goal (1 subgoal):
 1. tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
proof (induction "length xs - 1" arbitrary: xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. \<lbrakk>0 = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
 2. \<And>x xs. \<lbrakk>\<And>xs. \<lbrakk>x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs; Suc x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 = length xs - 1
0 < length xs

goal (2 subgoals):
 1. \<And>xs. \<lbrakk>0 = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
 2. \<And>x xs. \<lbrakk>\<And>xs. \<lbrakk>x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs; Suc x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 = length xs - 1
0 < length xs

goal (2 subgoals):
 1. \<And>xs. \<lbrakk>0 = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
 2. \<And>x xs. \<lbrakk>\<And>xs. \<lbrakk>x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs; Suc x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
0 = length xs - 1
0 < length xs
[PROOF STEP]
have "length xs = 1"
[PROOF STATE]
proof (prove)
using this:
0 = length xs - 1
0 < length xs

goal (1 subgoal):
 1. length xs = 1
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
length xs = 1

goal (2 subgoals):
 1. \<And>xs. \<lbrakk>0 = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
 2. \<And>x xs. \<lbrakk>\<And>xs. \<lbrakk>x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs; Suc x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 = length xs - 1
0 < length xs
length xs = 1
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 = length xs - 1
0 < length xs
length xs = 1

goal (1 subgoal):
 1. tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
by (metis One_nat_def length_0_conv length_Suc_conv tuple_decode.simps(1)
      tuple_encode.simps(2))
[PROOF STATE]
proof (state)
this:
tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. \<lbrakk>x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs; Suc x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. \<lbrakk>x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs; Suc x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>n = length ?xs - 1; 0 < length ?xs\<rbrakk> \<Longrightarrow> tuple_decode (length ?xs - 1) (tuple_encode (length ?xs - 1) ?xs) = ?xs
Suc n = length xs - 1
0 < length xs

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. \<lbrakk>x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs; Suc x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
let ?t = "tl xs"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. \<lbrakk>x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs; Suc x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
let ?i = "tuple_encode (Suc n) xs"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. \<lbrakk>x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs; Suc x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
have "length ?t > 0" and "length ?t - 1 = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < length (tl xs) &&& length (tl xs) - 1 = n
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n = length ?xs - 1; 0 < length ?xs\<rbrakk> \<Longrightarrow> tuple_decode (length ?xs - 1) (tuple_encode (length ?xs - 1) ?xs) = ?xs
Suc n = length xs - 1
0 < length xs

goal (1 subgoal):
 1. 0 < length (tl xs) &&& length (tl xs) - 1 = n
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 < length (tl xs)
length (tl xs) - 1 = n

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. \<lbrakk>x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs; Suc x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < length (tl xs)
length (tl xs) - 1 = n
[PROOF STEP]
have "tuple_decode n (tuple_encode n ?t) = ?t"
[PROOF STATE]
proof (prove)
using this:
0 < length (tl xs)
length (tl xs) - 1 = n

goal (1 subgoal):
 1. tuple_decode n (tuple_encode n (tl xs)) = tl xs
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
0 < length (tl xs)
length (tl xs) - 1 = n
\<lbrakk>n = length ?xs - 1; 0 < length ?xs\<rbrakk> \<Longrightarrow> tuple_decode (length ?xs - 1) (tuple_encode (length ?xs - 1) ?xs) = ?xs
Suc n = length xs - 1
0 < length xs

goal (1 subgoal):
 1. tuple_decode n (tuple_encode n (tl xs)) = tl xs
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
tuple_decode n (tuple_encode n (tl xs)) = tl xs

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. \<lbrakk>x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs; Suc x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
tuple_decode n (tuple_encode n (tl xs)) = tl xs

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. \<lbrakk>x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs; Suc x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
have "?i = prod_encode (hd xs, tuple_encode n ?t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tuple_encode (Suc n) xs = prod_encode (hd xs, tuple_encode n (tl xs))
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n = length ?xs - 1; 0 < length ?xs\<rbrakk> \<Longrightarrow> tuple_decode (length ?xs - 1) (tuple_encode (length ?xs - 1) ?xs) = ?xs
Suc n = length xs - 1
0 < length xs

goal (1 subgoal):
 1. tuple_encode (Suc n) xs = prod_encode (hd xs, tuple_encode n (tl xs))
[PROOF STEP]
by (metis hd_Cons_tl length_greater_0_conv tuple_encode.simps(3))
[PROOF STATE]
proof (state)
this:
tuple_encode (Suc n) xs = prod_encode (hd xs, tuple_encode n (tl xs))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. \<lbrakk>x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs; Suc x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
tuple_encode (Suc n) xs = prod_encode (hd xs, tuple_encode n (tl xs))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. \<lbrakk>x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs; Suc x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
have "tuple_decode (Suc n) ?i = pdec1 ?i # tuple_decode n (pdec2 ?i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tuple_decode (Suc n) (tuple_encode (Suc n) xs) = pdec1 (tuple_encode (Suc n) xs) # tuple_decode n (pdec2 (tuple_encode (Suc n) xs))
[PROOF STEP]
using tuple_decode.simps(2)
[PROOF STATE]
proof (prove)
using this:
tuple_decode (Suc ?n) ?i = pdec1 ?i # tuple_decode ?n (pdec2 ?i)

goal (1 subgoal):
 1. tuple_decode (Suc n) (tuple_encode (Suc n) xs) = pdec1 (tuple_encode (Suc n) xs) # tuple_decode n (pdec2 (tuple_encode (Suc n) xs))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
tuple_decode (Suc n) (tuple_encode (Suc n) xs) = pdec1 (tuple_encode (Suc n) xs) # tuple_decode n (pdec2 (tuple_encode (Suc n) xs))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. \<lbrakk>x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs; Suc x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
tuple_decode n (tuple_encode n (tl xs)) = tl xs
tuple_encode (Suc n) xs = prod_encode (hd xs, tuple_encode n (tl xs))
tuple_decode (Suc n) (tuple_encode (Suc n) xs) = pdec1 (tuple_encode (Suc n) xs) # tuple_decode n (pdec2 (tuple_encode (Suc n) xs))
[PROOF STEP]
have "tuple_decode (Suc n) ?i = xs"
[PROOF STATE]
proof (prove)
using this:
tuple_decode n (tuple_encode n (tl xs)) = tl xs
tuple_encode (Suc n) xs = prod_encode (hd xs, tuple_encode n (tl xs))
tuple_decode (Suc n) (tuple_encode (Suc n) xs) = pdec1 (tuple_encode (Suc n) xs) # tuple_decode n (pdec2 (tuple_encode (Suc n) xs))

goal (1 subgoal):
 1. tuple_decode (Suc n) (tuple_encode (Suc n) xs) = xs
[PROOF STEP]
using Suc.prems
[PROOF STATE]
proof (prove)
using this:
tuple_decode n (tuple_encode n (tl xs)) = tl xs
tuple_encode (Suc n) xs = prod_encode (hd xs, tuple_encode n (tl xs))
tuple_decode (Suc n) (tuple_encode (Suc n) xs) = pdec1 (tuple_encode (Suc n) xs) # tuple_decode n (pdec2 (tuple_encode (Suc n) xs))
0 < length xs

goal (1 subgoal):
 1. tuple_decode (Suc n) (tuple_encode (Suc n) xs) = xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
tuple_decode (Suc n) (tuple_encode (Suc n) xs) = xs

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<And>xs. \<lbrakk>x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs; Suc x = length xs - 1; 0 < length xs\<rbrakk> \<Longrightarrow> tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
tuple_decode (Suc n) (tuple_encode (Suc n) xs) = xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
tuple_decode (Suc n) (tuple_encode (Suc n) xs) = xs

goal (1 subgoal):
 1. tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs
[PROOF STEP]
by (simp add: Suc.hyps(2))
[PROOF STATE]
proof (state)
this:
tuple_decode (length xs - 1) (tuple_encode (length xs - 1) xs) = xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma euclid_ext2_code[code]:
 "euclid_ext2 a b = (let ((p,q),d) = euclid_ext a b in (p,q, - b div d, a div d, d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. euclid_ext2 a b = (let ((p, q), d) = euclid_ext_aux (1::'a) (0::'a) (0::'a) (1::'a) a b in (p, q, - b div d, a div d, d))
[PROOF STEP]
unfolding euclid_ext2_def split_beta Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fst (bezout_coefficients a b), snd (bezout_coefficients a b), - b div gcd a b, a div gcd a b, gcd a b) = (fst (fst (euclid_ext_aux (1::'a) (0::'a) (0::'a) (1::'a) a b)), snd (fst (euclid_ext_aux (1::'a) (0::'a) (0::'a) (1::'a) a b)), - b div snd (euclid_ext_aux (1::'a) (0::'a) (0::'a) (1::'a) a b), a div snd (euclid_ext_aux (1::'a) (0::'a) (0::'a) (1::'a) a b), snd (euclid_ext_aux (1::'a) (0::'a) (0::'a) (1::'a) a b))
[PROOF STEP]
by auto


[STATEMENT]
lemma times2_conv_add: "(j::nat) + j = 2*j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j + j = 2 * j
[PROOF STEP]
by (induct j) auto


[STATEMENT]
lemma has_derivative_divide[simp, derivative_intros]:
  fixes f :: "_ \<Rightarrow> 'a::real_normed_div_algebra"
  assumes f: "(f has_derivative f') (at x within S)"
    and g: "(g has_derivative g') (at x within S)"
  assumes x: "g x \<noteq> 0"
  shows "((\<lambda>x. f x / g x) has_derivative
                (\<lambda>h. - f x * (inverse (g x) * g' h * inverse (g x)) + f' h / g x)) (at x within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x / g x) has_derivative (\<lambda>h. - f x * (inverse (g x) * g' h * inverse (g x)) + f' h / g x)) (at x within S)
[PROOF STEP]
using has_derivative_mult[OF f has_derivative_inverse[OF x g]]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. f x * inverse (g x)) has_derivative (\<lambda>h. f x * - (inverse (g x) * g' h * inverse (g x)) + f' h * inverse (g x))) (at x within S)

goal (1 subgoal):
 1. ((\<lambda>x. f x / g x) has_derivative (\<lambda>h. - f x * (inverse (g x) * g' h * inverse (g x)) + f' h / g x)) (at x within S)
[PROOF STEP]
by (simp add: field_simps)


[STATEMENT]
lemma "nat 4 = Suc (Suc (Suc (Suc 0)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat 4 = Suc (Suc (Suc (Suc 0)))
[PROOF STEP]
by normalization


[STATEMENT]
lemma tmf_c_correct:
  fixes A::"float interval list" and I::"float interval" and f::floatarith and a::"real list"
  assumes "a all_in A"
  assumes "tmf_c prec A f i = Some I"
  shows "interpret_floatarith (deriv_rec f i) a / fact i \<in>\<^sub>r I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interpret_floatarith (deriv_rec f i) a / fact i \<in>\<^sub>r I
[PROOF STEP]
using compute_bound_fa_correct[OF assms(2)[unfolded tmf_c.simps], where i="a"] assms(1)
[PROOF STATE]
proof (prove)
using this:
a all_in A \<Longrightarrow> interpret_floatarith (Mult (deriv_rec f i) (Inverse (Num (fact i)))) a \<in>\<^sub>r I
a all_in A

goal (1 subgoal):
 1. interpret_floatarith (deriv_rec f i) a / fact i \<in>\<^sub>r I
[PROOF STEP]
by (simp add: divide_real_def fact_real_float_equiv)


[STATEMENT]
lemma inj_on_image_mem_iff: "
  \<lbrakk> inj_on f A; B \<subseteq> A; a \<in> A \<rbrakk> \<Longrightarrow> (f a \<in> f ` B) = (a \<in> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f A; B \<subseteq> A; a \<in> A\<rbrakk> \<Longrightarrow> (f a \<in> f ` B) = (a \<in> B)
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>A. \<forall>y\<in>A. f x = f y \<longrightarrow> x = y; B \<subseteq> A; a \<in> A\<rbrakk> \<Longrightarrow> (f a \<in> f ` B) = (a \<in> B)
[PROOF STEP]
by blast


[STATEMENT]
lemma distinct_map_snd_fst_eqD:
  "distinct (map snd xs) \<Longrightarrow> (i, a) \<in> set xs \<Longrightarrow> (j, a) \<in> set xs \<Longrightarrow> i = j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct (map snd xs); (i, a) \<in> set xs; (j, a) \<in> set xs\<rbrakk> \<Longrightarrow> i = j
[PROOF STEP]
by (metis Pair_inject inj_on_contraD snd_conv distinct_map)


[STATEMENT]
lemma Mp_ident_iff: "Mp f = f \<longleftrightarrow> (\<forall> n. coeff f n \<in> {0 ..< m})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Mp f = f) = (\<forall>n. coeff f n \<in> {0..<m})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (Mp f = f) = (\<forall>n. coeff f n \<in> {0..<m})
[PROOF STEP]
have m0: "m > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m
[PROOF STEP]
using m1
[PROOF STATE]
proof (prove)
using this:
1 < m

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

goal (1 subgoal):
 1. (Mp f = f) = (\<forall>n. coeff f n \<in> {0..<m})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Mp f = f) = (\<forall>n. coeff f n \<in> {0..<m})
[PROOF STEP]
unfolding poly_eq_iff Mp_coeff M_def mod_ident_iff[OF m0]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>n. coeff f n \<in> {0..<m}) = (\<forall>n. coeff f n \<in> {0..<m})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(Mp f = f) = (\<forall>n. coeff f n \<in> {0..<m})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Limsup_ereal_mult_right:
  assumes "F \<noteq> bot" "(c::real) \<ge> 0"
  shows   "Limsup F (\<lambda>n. f n * ereal c) = Limsup F f * ereal c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Limsup F (\<lambda>n. f n * ereal c) = Limsup F f * ereal c
[PROOF STEP]
proof (rule Limsup_compose_continuous_mono)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. continuous_on UNIV (\<lambda>a. a * ereal c)
 2. mono (\<lambda>a. a * ereal c)
 3. F \<noteq> bot
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
F \<noteq> bot
0 \<le> c
[PROOF STEP]
show "continuous_on UNIV (\<lambda>a. a * ereal c)"
[PROOF STATE]
proof (prove)
using this:
F \<noteq> bot
0 \<le> c

goal (1 subgoal):
 1. continuous_on UNIV (\<lambda>a. a * ereal c)
[PROOF STEP]
using tendsto_cmult_ereal[of "ereal c" "\<lambda>x. x" ]
[PROOF STATE]
proof (prove)
using this:
F \<noteq> bot
0 \<le> c
\<lbrakk>\<bar>ereal c\<bar> \<noteq> \<infinity>; ((\<lambda>x. x) \<longlongrightarrow> ?x) ?F\<rbrakk> \<Longrightarrow> ((*) (ereal c) \<longlongrightarrow> ereal c * ?x) ?F

goal (1 subgoal):
 1. continuous_on UNIV (\<lambda>a. a * ereal c)
[PROOF STEP]
by (force simp: continuous_on_def mult_ac)
[PROOF STATE]
proof (state)
this:
continuous_on UNIV (\<lambda>a. a * ereal c)

goal (2 subgoals):
 1. mono (\<lambda>a. a * ereal c)
 2. F \<noteq> bot
[PROOF STEP]
qed (insert assms, auto simp: mono_def ereal_mult_right_mono)


[STATEMENT]
lemma sum_interval_distl:
  fixes f :: "nat \<Rightarrow> 'a::dioid_one_zero"
  assumes "m \<le> n"
  shows "x \<cdot> (\<Sum>i=m..n. f(i)) = (\<Sum>i=m..n. (x \<cdot> f(i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<cdot> sum f {m..n} = (\<Sum>i = m..n. x \<cdot> f i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<cdot> sum f {m..n} = (\<Sum>i = m..n. x \<cdot> f i)
[PROOF STEP]
have "x \<cdot> (\<Sum>i=m..n. f(i)) = x \<cdot> \<Sum>(f ` {m..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<cdot> sum f {m..n} = x \<cdot> \<Sum> (f ` {m..n})
[PROOF STEP]
by (metis finite_atLeastAtMost sum_image)
[PROOF STATE]
proof (state)
this:
x \<cdot> sum f {m..n} = x \<cdot> \<Sum> (f ` {m..n})

goal (1 subgoal):
 1. x \<cdot> sum f {m..n} = (\<Sum>i = m..n. x \<cdot> f i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<cdot> sum f {m..n} = x \<cdot> \<Sum> (f ` {m..n})

goal (1 subgoal):
 1. x \<cdot> sum f {m..n} = (\<Sum>i = m..n. x \<cdot> f i)
[PROOF STEP]
have "... = \<Sum>{x \<cdot> y |y. y \<in> f ` {m..n}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<cdot> \<Sum> (f ` {m..n}) = \<Sum> {x \<cdot> y |y. y \<in> f ` {m..n}}
[PROOF STEP]
by (metis finite_atLeastAtMost fset_to_im image_image sum_fun_distl)
[PROOF STATE]
proof (state)
this:
x \<cdot> \<Sum> (f ` {m..n}) = \<Sum> {x \<cdot> y |y. y \<in> f ` {m..n}}

goal (1 subgoal):
 1. x \<cdot> sum f {m..n} = (\<Sum>i = m..n. x \<cdot> f i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<cdot> \<Sum> (f ` {m..n}) = \<Sum> {x \<cdot> y |y. y \<in> f ` {m..n}}

goal (1 subgoal):
 1. x \<cdot> sum f {m..n} = (\<Sum>i = m..n. x \<cdot> f i)
[PROOF STEP]
have "... = \<Sum>((\<lambda>i. x \<cdot> f i) ` {m..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> {x \<cdot> y |y. y \<in> f ` {m..n}} = \<Sum> ((\<lambda>i. x \<cdot> f i) ` {m..n})
[PROOF STEP]
by (metis fset_to_im image_image)
[PROOF STATE]
proof (state)
this:
\<Sum> {x \<cdot> y |y. y \<in> f ` {m..n}} = \<Sum> ((\<lambda>i. x \<cdot> f i) ` {m..n})

goal (1 subgoal):
 1. x \<cdot> sum f {m..n} = (\<Sum>i = m..n. x \<cdot> f i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Sum> {x \<cdot> y |y. y \<in> f ` {m..n}} = \<Sum> ((\<lambda>i. x \<cdot> f i) ` {m..n})

goal (1 subgoal):
 1. x \<cdot> sum f {m..n} = (\<Sum>i = m..n. x \<cdot> f i)
[PROOF STEP]
have "... = (\<Sum>i=m..n. (x \<cdot> f(i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> ((\<lambda>i. x \<cdot> f i) ` {m..n}) = (\<Sum>i = m..n. x \<cdot> f i)
[PROOF STEP]
by (metis finite_atLeastAtMost sum_image)
[PROOF STATE]
proof (state)
this:
\<Sum> ((\<lambda>i. x \<cdot> f i) ` {m..n}) = (\<Sum>i = m..n. x \<cdot> f i)

goal (1 subgoal):
 1. x \<cdot> sum f {m..n} = (\<Sum>i = m..n. x \<cdot> f i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x \<cdot> sum f {m..n} = (\<Sum>i = m..n. x \<cdot> f i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<cdot> sum f {m..n} = (\<Sum>i = m..n. x \<cdot> f i)

goal (1 subgoal):
 1. x \<cdot> sum f {m..n} = (\<Sum>i = m..n. x \<cdot> f i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x \<cdot> sum f {m..n} = (\<Sum>i = m..n. x \<cdot> f i)

goal:
No subgoals!
[PROOF STEP]
qed