[STATEMENT]
lemma setprod_one [simp]:
  fixes n::nat
  shows "(\<Prod>i < n. Suc 0) = Suc 0"
    "(\<Prod>i \<le> n. Suc 0) = Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i<n. Suc 0) = Suc 0 &&& (\<Prod>i\<le>n. Suc 0) = Suc 0
[PROOF STEP]
by (induct n) (simp_all)


[STATEMENT]
lemma nat_pow_eq [simp]: "x [^]\<^bsub>G\<^esub> (k :: nat) = (x ^ k) mod n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x [^]\<^bsub>G\<^esub> k = x ^ k mod n
[PROOF STEP]
using n_gt_1
[PROOF STATE]
proof (prove)
using this:
1 < n

goal (1 subgoal):
 1. x [^]\<^bsub>G\<^esub> k = x ^ k mod n
[PROOF STEP]
by (induction k) (simp_all add: mod_mult_left_eq mod_mult_right_eq mult_ac)


[STATEMENT]
lemma metric_isCont_LIM_compose2:
  fixes f :: "'a :: metric_space \<Rightarrow> _"
  assumes f [unfolded isCont_def]: "isCont f a"
    and g: "g \<midarrow>f a\<rightarrow> l"
    and inj: "\<exists>d>0. \<forall>x. x \<noteq> a \<and> dist x a < d \<longrightarrow> f x \<noteq> f a"
  shows "(\<lambda>x. g (f x)) \<midarrow>a\<rightarrow> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. g (f x)) \<midarrow>a\<rightarrow> l
[PROOF STEP]
by (rule metric_LIM_compose2 [OF f g inj])


[STATEMENT]
lemma boundedByUN: "boundedBy N (UN x:A. B x) = (!x:A. boundedBy N (B x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. boundedBy N (\<Union> (B ` A)) = (\<forall>x\<in>A. boundedBy N (B x))
[PROOF STEP]
by(simp add: boundedBy_def)


[STATEMENT]
lemma ncols_transpose[simp]: "ncols (transpose_matrix A) = nrows A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ncols (transpose_matrix A) = nrows A
[PROOF STEP]
by (simp add: nrows_def ncols_def nonzero_positions_def transpose_matrix_def image_def)


[STATEMENT]
lemma SUP_emeasure_incseq:
  assumes A: "range A \<subseteq> sets M" "incseq A"
  shows "(SUP n. emeasure M (A n)) = emeasure M (\<Union>i. A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP n. emeasure M (A n)) = emeasure M (\<Union> (range A))
[PROOF STEP]
using LIMSEQ_SUP[OF incseq_emeasure, OF A] Lim_emeasure_incseq[OF A]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. emeasure M (A i)) \<longlonglongrightarrow> (SUP i. emeasure M (A i))
(\<lambda>i. emeasure M (A i)) \<longlonglongrightarrow> emeasure M (\<Union> (range A))

goal (1 subgoal):
 1. (SUP n. emeasure M (A n)) = emeasure M (\<Union> (range A))
[PROOF STEP]
by (simp add: LIMSEQ_unique)


[STATEMENT]
lemma R1_R2_commute: "(R1 o R2) = (R2 o R1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R1 \<circ> R2 = R2 \<circ> R1
[PROOF STEP]
by (auto simp: rp_defs design_defs fun_eq_iff prefix_def)


[STATEMENT]
lemma card_doubleton_eq_2_iff[simp]: "card {a,b} = 2 \<longleftrightarrow> a\<noteq>b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (card {a, b} = 2) = (a \<noteq> b)
[PROOF STEP]
by auto


[STATEMENT]
lemma "(a::int) ^ 3 + b ^ 3 = (a + b) * (a ^ 2 - a * b + b ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a ^ 3 + b ^ 3 = (a + b) * (a\<^sup>2 - a * b + b\<^sup>2)
[PROOF STEP]
by ring


[STATEMENT]
lemma prime_sum_upto_altdef3:
  "prime_sum_upto f x = (\<Sum>p\<leftarrow>primes_upto (nat \<lfloor>x\<rfloor>). f p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_sum_upto f x = sum_list (map f (primes_upto (nat \<lfloor>x\<rfloor>)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prime_sum_upto f x = sum_list (map f (primes_upto (nat \<lfloor>x\<rfloor>)))
[PROOF STEP]
have "(\<Sum>p\<leftarrow>primes_upto (nat \<lfloor>x\<rfloor>). f p) = (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>x\<rfloor>. f p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map f (primes_upto (nat \<lfloor>x\<rfloor>))) = (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>x\<rfloor>. f p)
[PROOF STEP]
by (subst sum_list_distinct_conv_sum_set) (auto simp: set_primes_upto conj_commute)
[PROOF STATE]
proof (state)
this:
sum_list (map f (primes_upto (nat \<lfloor>x\<rfloor>))) = (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>x\<rfloor>. f p)

goal (1 subgoal):
 1. prime_sum_upto f x = sum_list (map f (primes_upto (nat \<lfloor>x\<rfloor>)))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
sum_list (map f (primes_upto (nat \<lfloor>x\<rfloor>))) = (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>x\<rfloor>. f p)

goal (1 subgoal):
 1. prime_sum_upto f x = sum_list (map f (primes_upto (nat \<lfloor>x\<rfloor>)))
[PROOF STEP]
by (simp add: prime_sum_upto_altdef2)
[PROOF STATE]
proof (state)
this:
prime_sum_upto f x = sum_list (map f (primes_upto (nat \<lfloor>x\<rfloor>)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_mergesort_by_rel [simp]: "set (mergesort_by_rel R xs) = set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (mergesort_by_rel R xs) = set xs
[PROOF STEP]
unfolding set_mset_comp_mset [symmetric] o_apply
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_mset (mset (mergesort_by_rel R xs)) = set_mset (mset xs)
[PROOF STEP]
by simp


[STATEMENT]
lemma eventually_at_right_to_0:
  "eventually P (at_right a) \<longleftrightarrow> eventually (\<lambda>x. P (x + a)) (at_right 0)"
  for a :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (at_right a) = (\<forall>\<^sub>F x in at_right 0. P (x + a))
[PROOF STEP]
unfolding at_right_to_0[of a]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (filtermap (\<lambda>x. x + a) (at_right 0)) = (\<forall>\<^sub>F x in at_right 0. P (x + a))
[PROOF STEP]
by (simp add: eventually_filtermap)


[STATEMENT]
lemma prob_degree_lt_1:
   "prob {\<omega>. degree \<omega> < 1} \<le> 1/real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {\<omega>. degree \<omega> < 1} \<le> 1 / real p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prob {\<omega>. degree \<omega> < 1} \<le> 1 / real p
[PROOF STEP]
have "space \<inter> {\<omega>. length \<omega> \<le> Suc 0} = bounded_degree_polynomials (mod_ring p) 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.space \<inter> {\<omega>. length \<omega> \<le> Suc 0} = bounded_degree_polynomials (Field.mod_ring p) 1
[PROOF STEP]
by (auto simp:set_eq_iff bounded_degree_polynomials_def space_def)
[PROOF STATE]
proof (state)
this:
local.space \<inter> {\<omega>. length \<omega> \<le> Suc 0} = bounded_degree_polynomials (Field.mod_ring p) 1

goal (1 subgoal):
 1. prob {\<omega>. degree \<omega> < 1} \<le> 1 / real p
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
local.space \<inter> {\<omega>. length \<omega> \<le> Suc 0} = bounded_degree_polynomials (Field.mod_ring p) 1

goal (1 subgoal):
 1. prob {\<omega>. degree \<omega> < 1} \<le> 1 / real p
[PROOF STEP]
have "field_size = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. field_size = p
[PROOF STEP]
by (simp add:mod_ring_def)
[PROOF STATE]
proof (state)
this:
field_size = p

goal (1 subgoal):
 1. prob {\<omega>. degree \<omega> < 1} \<le> 1 / real p
[PROOF STEP]
hence "real (card (bounded_degree_polynomials (mod_ring p) (Suc 0))) / real (card space) = 1 / real p"
[PROOF STATE]
proof (prove)
using this:
field_size = p

goal (1 subgoal):
 1. real (card (bounded_degree_polynomials (Field.mod_ring p) (Suc 0))) / real (card local.space) = 1 / real p
[PROOF STEP]
by (simp add:space_def bounded_degree_polynomials_card power2_eq_square)
[PROOF STATE]
proof (state)
this:
real (card (bounded_degree_polynomials (Field.mod_ring p) (Suc 0))) / real (card local.space) = 1 / real p

goal (1 subgoal):
 1. prob {\<omega>. degree \<omega> < 1} \<le> 1 / real p
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
local.space \<inter> {\<omega>. length \<omega> \<le> Suc 0} = bounded_degree_polynomials (Field.mod_ring p) 1
real (card (bounded_degree_polynomials (Field.mod_ring p) (Suc 0))) / real (card local.space) = 1 / real p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
local.space \<inter> {\<omega>. length \<omega> \<le> Suc 0} = bounded_degree_polynomials (Field.mod_ring p) 1
real (card (bounded_degree_polynomials (Field.mod_ring p) (Suc 0))) / real (card local.space) = 1 / real p

goal (1 subgoal):
 1. prob {\<omega>. degree \<omega> < 1} \<le> 1 / real p
[PROOF STEP]
by (simp add:M_def measure_pmf_of_set)
[PROOF STATE]
proof (state)
this:
prob {\<omega>. degree \<omega> < 1} \<le> 1 / real p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma one_less_inverse_iff: "1 < inverse x \<longleftrightarrow> 0 < x \<and> x < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((1::'a) < inverse x) = ((0::'a) < x \<and> x < (1::'a))
[PROOF STEP]
using less_trans[of 1 x 0 for x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(1::'a) < ?xa3; ?xa3 < (0::'a)\<rbrakk> \<Longrightarrow> (1::'a) < (0::'a)

goal (1 subgoal):
 1. ((1::'a) < inverse x) = ((0::'a) < x \<and> x < (1::'a))
[PROOF STEP]
by (metis local.dual_order.strict_trans local.inverse_1 local.inverse_less_imp_less local.inverse_positive_iff_positive local.one_less_inverse local.zero_less_one)


[STATEMENT]
lemma grid_stepsize_sum:
  shows "(\<Sum>i\<in>{0..<n}. stepsize i) = t n - t 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum stepsize {0..<n} = t n - t 0
[PROOF STEP]
by (induct n) (simp_all add: stepsize_def)


[STATEMENT]
lemma infinite_atLeast_int: "infinite {(n::int)..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite {n..}
[PROOF STEP]
apply (rule_tac f="\<lambda>x. nat (x - n)" in inj_on_infinite_image_iff[THEN iffD1, rule_format])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inj_on (\<lambda>x. nat (x - n)) {n..}
 2. infinite ((\<lambda>x. nat (x - n)) ` {n..})
[PROOF STEP]
apply (fastforce simp: inj_on_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite ((\<lambda>x. nat (x - n)) ` {n..})
[PROOF STEP]
apply (rule_tac t="((\<lambda>x. nat (x - n)) ` {n..})" and s="{0..}" in subst)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {0..} = (\<lambda>x. nat (x - n)) ` {n..}
 2. infinite {0..}
[PROOF STEP]
apply (simp add: set_eq_iff image_iff Bex_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>x. \<exists>xa\<ge>n. x = nat (xa - n)
 2. infinite {0..}
[PROOF STEP]
apply (clarify, rename_tac n1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n1. \<exists>x\<ge>n. n1 = nat (x - n)
 2. infinite {0..}
[PROOF STEP]
apply (rule_tac x="n + int n1" in exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n1. n \<le> n + int n1 \<and> n1 = nat (n + int n1 - n)
 2. infinite {0..}
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sup_continuous_add[order_continuous_intros]:
  fixes f g :: "'a::complete_lattice \<Rightarrow> ereal"
  assumes nn: "\<And>x. 0 \<le> f x" "\<And>x. 0 \<le> g x" and cont: "sup_continuous f" "sup_continuous g"
  shows "sup_continuous (\<lambda>x. f x + g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sup_continuous (\<lambda>x. f x + g x)
[PROOF STEP]
unfolding sup_continuous_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>M. incseq M \<longrightarrow> f (Sup (range M)) + g (Sup (range M)) = (SUP i. f (M i) + g (M i))
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>M. incseq M \<Longrightarrow> f (Sup (range M)) + g (Sup (range M)) = (SUP i. f (M i) + g (M i))
[PROOF STEP]
fix M :: "nat \<Rightarrow> 'a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>M. incseq M \<Longrightarrow> f (Sup (range M)) + g (Sup (range M)) = (SUP i. f (M i) + g (M i))
[PROOF STEP]
assume "incseq M"
[PROOF STATE]
proof (state)
this:
incseq M

goal (1 subgoal):
 1. \<And>M. incseq M \<Longrightarrow> f (Sup (range M)) + g (Sup (range M)) = (SUP i. f (M i) + g (M i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
incseq M
[PROOF STEP]
show "f (SUP i. M i) + g (SUP i. M i) = (SUP i. f (M i) + g (M i))"
[PROOF STATE]
proof (prove)
using this:
incseq M

goal (1 subgoal):
 1. f (Sup (range M)) + g (Sup (range M)) = (SUP i. f (M i) + g (M i))
[PROOF STEP]
using SUP_ereal_add_pos[of "\<lambda>i. f (M i)" "\<lambda>i. g (M i)"] nn
      cont[THEN sup_continuous_mono] cont[THEN sup_continuousD]
[PROOF STATE]
proof (prove)
using this:
incseq M
\<lbrakk>incseq (\<lambda>i. f (M i)); incseq (\<lambda>i. g (M i)); \<And>i. 0 \<le> f (M i); \<And>i. 0 \<le> g (M i)\<rbrakk> \<Longrightarrow> (SUP i. f (M i) + g (M i)) = (SUP i. f (M i)) + (SUP i. g (M i))
0 \<le> f ?x
0 \<le> g ?x
mono f
mono g
incseq ?M \<Longrightarrow> f (Sup (range ?M)) = (SUP i. f (?M i))
incseq ?M \<Longrightarrow> g (Sup (range ?M)) = (SUP i. g (?M i))

goal (1 subgoal):
 1. f (Sup (range M)) + g (Sup (range M)) = (SUP i. f (M i) + g (M i))
[PROOF STEP]
by (auto simp: mono_def)
[PROOF STATE]
proof (state)
this:
f (Sup (range M)) + g (Sup (range M)) = (SUP i. f (M i) + g (M i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Qp_isosceles:
  assumes "x \<in> carrier Q\<^sub>p"
  assumes "c \<in> carrier Q\<^sub>p"
  assumes "d \<in> carrier Q\<^sub>p"
  assumes "val (x \<ominus> c) \<ge> v"
  assumes "val (d \<ominus> c) \<ge> v"
  shows "val (x \<ominus> d) \<ge> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<le> val (x \<ominus> d)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v \<le> val (x \<ominus> d)
[PROOF STEP]
have "val (x \<ominus> d) \<ge> min (val (x \<ominus> c)) (val (d \<ominus> c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (val (x \<ominus> c)) (val (d \<ominus> c)) \<le> val (x \<ominus> d)
[PROOF STEP]
using assms Qp_diff_diff[of x c d]
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier Q\<^sub>p
c \<in> carrier Q\<^sub>p
d \<in> carrier Q\<^sub>p
v \<le> val (x \<ominus> c)
v \<le> val (d \<ominus> c)
\<lbrakk>x \<in> carrier Q\<^sub>p; c \<in> carrier Q\<^sub>p; d \<in> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> x \<ominus> c \<ominus> (d \<ominus> c) = x \<ominus> d

goal (1 subgoal):
 1. min (val (x \<ominus> c)) (val (d \<ominus> c)) \<le> val (x \<ominus> d)
[PROOF STEP]
by (metis Qp.domain_axioms cring.cring_simprules(4) domain.axioms(1) val_ultrametric')
[PROOF STATE]
proof (state)
this:
min (val (x \<ominus> c)) (val (d \<ominus> c)) \<le> val (x \<ominus> d)

goal (1 subgoal):
 1. v \<le> val (x \<ominus> d)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
min (val (x \<ominus> c)) (val (d \<ominus> c)) \<le> val (x \<ominus> d)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
min (val (x \<ominus> c)) (val (d \<ominus> c)) \<le> val (x \<ominus> d)

goal (1 subgoal):
 1. v \<le> val (x \<ominus> d)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
min (val (x \<ominus> c)) (val (d \<ominus> c)) \<le> val (x \<ominus> d)
x \<in> carrier Q\<^sub>p
c \<in> carrier Q\<^sub>p
d \<in> carrier Q\<^sub>p
v \<le> val (x \<ominus> c)
v \<le> val (d \<ominus> c)

goal (1 subgoal):
 1. v \<le> val (x \<ominus> d)
[PROOF STEP]
by (meson dual_order.trans min_le_iff_disj)
[PROOF STATE]
proof (state)
this:
v \<le> val (x \<ominus> d)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma complex_Taylor:
  assumes S: "convex S"
      and f: "\<And>i x. x \<in> S \<Longrightarrow> i \<le> n \<Longrightarrow> (f i has_field_derivative f (Suc i) x) (at x within S)"
      and B: "\<And>x. x \<in> S \<Longrightarrow> cmod (f (Suc n) x) \<le> B"
      and w: "w \<in> S"
      and z: "z \<in> S"
    shows "cmod(f 0 z - (\<Sum>i\<le>n. f i w * (z-w) ^ i / (fact i)))
          \<le> B * cmod(z - w)^(Suc n) / fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (f 0 z - (\<Sum>i\<le>n. f i w * (z - w) ^ i / fact i)) \<le> B * cmod (z - w) ^ Suc n / fact n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
convex S
\<lbrakk>?x \<in> S; ?i \<le> n\<rbrakk> \<Longrightarrow> (f ?i has_field_derivative f (Suc ?i) ?x) (at ?x within S)
?x \<in> S \<Longrightarrow> cmod (f (Suc n) ?x) \<le> B
w \<in> S
z \<in> S

goal (1 subgoal):
 1. cmod (f 0 z - (\<Sum>i\<le>n. f i w * (z - w) ^ i / fact i)) \<le> B * cmod (z - w) ^ Suc n / fact n
[PROOF STEP]
by (rule field_Taylor)


[STATEMENT]
lemma parabolic_imp_not_elliptic_loxodromic:
  assumes "parabolic_isometry f"
  shows "\<not>elliptic_isometry f"
        "\<not>loxodromic_isometry f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> elliptic_isometry f &&& \<not> loxodromic_isometry f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
parabolic_isometry f

goal (1 subgoal):
 1. \<not> elliptic_isometry f &&& \<not> loxodromic_isometry f
[PROOF STEP]
unfolding parabolic_isometry_def loxodromic_isometry_def
[PROOF STATE]
proof (prove)
using this:
isometry f \<and> \<not> elliptic_isometry f \<and> stable_translation_length f = 0

goal (1 subgoal):
 1. \<not> elliptic_isometry f &&& \<not> (isometry f \<and> \<not> elliptic_isometry f \<and> stable_translation_length f \<noteq> 0)
[PROOF STEP]
by auto


[STATEMENT]
lemma Sources_2DSources:
  assumes "DSources i S = {C1, C2}"
  shows    "Sources i S = {C1, C2} \<union> Sources i C1  \<union> Sources i C2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sources i S = {C1, C2} \<union> Sources i C1 \<union> Sources i C2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sources i S = {C1, C2} \<union> Sources i C1 \<union> Sources i C2
[PROOF STEP]
have sDef:  "(Sources i S) = (DSources i S) \<union> (\<Union> Z \<in> (DSources i S). (Sources i Z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sources i S = DSources i S \<union> \<Union> (Sources i ` DSources i S)
[PROOF STEP]
by (rule SourcesDef)
[PROOF STATE]
proof (state)
this:
Sources i S = DSources i S \<union> \<Union> (Sources i ` DSources i S)

goal (1 subgoal):
 1. Sources i S = {C1, C2} \<union> Sources i C1 \<union> Sources i C2
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
DSources i S = {C1, C2}
[PROOF STEP]
have "(\<Union> Z \<in> (DSources i S). (Sources i Z)) = Sources i C1  \<union> Sources i C2"
[PROOF STATE]
proof (prove)
using this:
DSources i S = {C1, C2}

goal (1 subgoal):
 1. \<Union> (Sources i ` DSources i S) = Sources i C1 \<union> Sources i C2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Union> (Sources i ` DSources i S) = Sources i C1 \<union> Sources i C2

goal (1 subgoal):
 1. Sources i S = {C1, C2} \<union> Sources i C1 \<union> Sources i C2
[PROOF STEP]
with sDef and assms
[PROOF STATE]
proof (chain)
picking this:
Sources i S = DSources i S \<union> \<Union> (Sources i ` DSources i S)
DSources i S = {C1, C2}
\<Union> (Sources i ` DSources i S) = Sources i C1 \<union> Sources i C2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sources i S = DSources i S \<union> \<Union> (Sources i ` DSources i S)
DSources i S = {C1, C2}
\<Union> (Sources i ` DSources i S) = Sources i C1 \<union> Sources i C2

goal (1 subgoal):
 1. Sources i S = {C1, C2} \<union> Sources i C1 \<union> Sources i C2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Sources i S = {C1, C2} \<union> Sources i C1 \<union> Sources i C2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ld_le_2ld:
  assumes "x \<ge> 0" "y \<ge> 0" shows "log 2 (1+x+y) \<le> 1 + log 2 (1+x) + log 2 (1+y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log 2 (1 + x + y) \<le> 1 + log 2 (1 + x) + log 2 (1 + y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. log 2 (1 + x + y) \<le> 1 + log 2 (1 + x) + log 2 (1 + y)
[PROOF STEP]
have 1: "1+x+y \<le> (x+1)*(y+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + x + y \<le> (x + 1) * (y + 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
0 \<le> y

goal (1 subgoal):
 1. 1 + x + y \<le> (x + 1) * (y + 1)
[PROOF STEP]
by(simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
1 + x + y \<le> (x + 1) * (y + 1)

goal (1 subgoal):
 1. log 2 (1 + x + y) \<le> 1 + log 2 (1 + x) + log 2 (1 + y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log 2 (1 + x + y) \<le> 1 + log 2 (1 + x) + log 2 (1 + y)
[PROOF STEP]
apply(rule powr_le_cancel_iff[of 2, THEN iffD1])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 1 < 2
 2. 2 powr log 2 (1 + x + y) \<le> 2 powr (1 + log 2 (1 + x) + log 2 (1 + y))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr log 2 (1 + x + y) \<le> 2 powr (1 + log 2 (1 + x) + log 2 (1 + y))
[PROOF STEP]
using assms 1
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
0 \<le> y
1 + x + y \<le> (x + 1) * (y + 1)

goal (1 subgoal):
 1. 2 powr log 2 (1 + x + y) \<le> 2 powr (1 + log 2 (1 + x) + log 2 (1 + y))
[PROOF STEP]
by(simp add: powr_add algebra_simps)
[PROOF STATE]
proof (state)
this:
log 2 (1 + x + y) \<le> 1 + log 2 (1 + x) + log 2 (1 + y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bin_coeff_diophantine:
  shows "c = a choose b \<longleftrightarrow> (\<exists>u.(u = 2^(Suc a) \<and> c = nth_digit ((u+1)^a) b u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c = a choose b) = (\<exists>u. u = 2 ^ Suc a \<and> c = nth_digit ((u + 1) ^ a) b u)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (c = a choose b) = (\<exists>u. u = 2 ^ Suc a \<and> c = nth_digit ((u + 1) ^ a) b u)
[PROOF STEP]
have "(u + 1)^a = (\<Sum>k\<le>a. (a choose k) * u ^ k)" for u
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u + 1) ^ a = (\<Sum>k\<le>a. (a choose k) * u ^ k)
[PROOF STEP]
using binomial[of u 1 a]
[PROOF STATE]
proof (prove)
using this:
(u + 1) ^ a = (\<Sum>k\<le>a. of_nat (a choose k) * u ^ k * 1 ^ (a - k))

goal (1 subgoal):
 1. (u + 1) ^ a = (\<Sum>k\<le>a. (a choose k) * u ^ k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(?u + 1) ^ a = (\<Sum>k\<le>a. (a choose k) * ?u ^ k)

goal (1 subgoal):
 1. (c = a choose b) = (\<exists>u. u = 2 ^ Suc a \<and> c = nth_digit ((u + 1) ^ a) b u)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(?u + 1) ^ a = (\<Sum>k\<le>a. (a choose k) * ?u ^ k)

goal (1 subgoal):
 1. (c = a choose b) = (\<exists>u. u = 2 ^ Suc a \<and> c = nth_digit ((u + 1) ^ a) b u)
[PROOF STEP]
have "a choose k < 2 ^ Suc a" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a choose k < 2 ^ Suc a
[PROOF STEP]
using binomial_le_pow2[of a k]
[PROOF STATE]
proof (prove)
using this:
a choose k \<le> 2 ^ a

goal (1 subgoal):
 1. a choose k < 2 ^ Suc a
[PROOF STEP]
by (simp add: le_less_trans)
[PROOF STATE]
proof (state)
this:
a choose ?k < 2 ^ Suc a

goal (1 subgoal):
 1. (c = a choose b) = (\<exists>u. u = 2 ^ Suc a \<and> c = nth_digit ((u + 1) ^ a) b u)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(?u + 1) ^ a = (\<Sum>k\<le>a. (a choose k) * ?u ^ k)
a choose ?k < 2 ^ Suc a
[PROOF STEP]
have "nth_digit (((2 ^ Suc a) + 1)^a) b (2 ^ Suc a) = a choose b"
[PROOF STATE]
proof (prove)
using this:
(?u + 1) ^ a = (\<Sum>k\<le>a. (a choose k) * ?u ^ k)
a choose ?k < 2 ^ Suc a

goal (1 subgoal):
 1. nth_digit ((2 ^ Suc a + 1) ^ a) b (2 ^ Suc a) = a choose b
[PROOF STEP]
using nth_digit_gen_power_series[of "\<lambda>k.(a choose k)" a a b]
[PROOF STATE]
proof (prove)
using this:
(?u + 1) ^ a = (\<Sum>k\<le>a. (a choose k) * ?u ^ k)
a choose ?k < 2 ^ Suc a
\<forall>k. a choose k < 2 ^ Suc a \<Longrightarrow> nth_digit (\<Sum>k = 0..a. (a choose k) * (2 ^ Suc a) ^ k) b (2 ^ Suc a) = (if b \<le> a then a choose b else 0)

goal (1 subgoal):
 1. nth_digit ((2 ^ Suc a + 1) ^ a) b (2 ^ Suc a) = a choose b
[PROOF STEP]
by (simp add: atLeast0AtMost)
[PROOF STATE]
proof (state)
this:
nth_digit ((2 ^ Suc a + 1) ^ a) b (2 ^ Suc a) = a choose b

goal (1 subgoal):
 1. (c = a choose b) = (\<exists>u. u = 2 ^ Suc a \<and> c = nth_digit ((u + 1) ^ a) b u)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nth_digit ((2 ^ Suc a + 1) ^ a) b (2 ^ Suc a) = a choose b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
nth_digit ((2 ^ Suc a + 1) ^ a) b (2 ^ Suc a) = a choose b

goal (1 subgoal):
 1. (c = a choose b) = (\<exists>u. u = 2 ^ Suc a \<and> c = nth_digit ((u + 1) ^ a) b u)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(c = a choose b) = (\<exists>u. u = 2 ^ Suc a \<and> c = nth_digit ((u + 1) ^ a) b u)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nth_map_rev_upt:
  assumes i: "i < m-n"
  shows "(map f [m>..n]) ! i = f (m - 1 - i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map f [m>..n] ! i = f (m - 1 - i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. map f [m>..n] ! i = f (m - 1 - i)
[PROOF STEP]
have "(map f [m>..n]) ! i = f ([m>..n] ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map f [m>..n] ! i = f ([m>..n] ! i)
[PROOF STEP]
by (rule nth_map, auto simp add: i)
[PROOF STATE]
proof (state)
this:
map f [m>..n] ! i = f ([m>..n] ! i)

goal (1 subgoal):
 1. map f [m>..n] ! i = f (m - 1 - i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map f [m>..n] ! i = f ([m>..n] ! i)

goal (1 subgoal):
 1. map f [m>..n] ! i = f (m - 1 - i)
[PROOF STEP]
have "... = f (m - 1 - i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ([m>..n] ! i) = f (m - 1 - i)
[PROOF STEP]
proof (rule arg_cong[of _ _ f], rule nth_rev_upt)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n + i < m
[PROOF STEP]
show "n + i < m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n + i < m
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
i < m - n

goal (1 subgoal):
 1. n + i < m
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
n + i < m

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f ([m>..n] ! i) = f (m - 1 - i)

goal (1 subgoal):
 1. map f [m>..n] ! i = f (m - 1 - i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
map f [m>..n] ! i = f (m - 1 - i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
map f [m>..n] ! i = f (m - 1 - i)

goal (1 subgoal):
 1. map f [m>..n] ! i = f (m - 1 - i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
map f [m>..n] ! i = f (m - 1 - i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma image_closure_subset:
  assumes contf: "continuous_on (closure S) f"
    and "closed T"
    and "(f ` S) \<subseteq> T"
  shows "f ` (closure S) \<subseteq> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` closure S \<subseteq> T
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f ` closure S \<subseteq> T
[PROOF STEP]
have "S \<subseteq> {x \<in> closure S. f x \<in> T}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> {x \<in> closure S. f x \<in> T}
[PROOF STEP]
using assms(3) closure_subset
[PROOF STATE]
proof (prove)
using this:
f ` S \<subseteq> T
?S \<subseteq> closure ?S

goal (1 subgoal):
 1. S \<subseteq> {x \<in> closure S. f x \<in> T}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<subseteq> {x \<in> closure S. f x \<in> T}

goal (1 subgoal):
 1. f ` closure S \<subseteq> T
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
S \<subseteq> {x \<in> closure S. f x \<in> T}

goal (1 subgoal):
 1. f ` closure S \<subseteq> T
[PROOF STEP]
have "closed (closure S \<inter> f -` T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed (closure S \<inter> f -` T)
[PROOF STEP]
using continuous_closed_preimage[OF contf] \<open>closed T\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>closed (closure S); closed ?T\<rbrakk> \<Longrightarrow> closed (closure S \<inter> f -` ?T)
closed T

goal (1 subgoal):
 1. closed (closure S \<inter> f -` T)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
closed (closure S \<inter> f -` T)

goal (1 subgoal):
 1. f ` closure S \<subseteq> T
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> {x \<in> closure S. f x \<in> T}
closed (closure S \<inter> f -` T)
[PROOF STEP]
have "closure S = (closure S \<inter> f -` T)"
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> {x \<in> closure S. f x \<in> T}
closed (closure S \<inter> f -` T)

goal (1 subgoal):
 1. closure S = closure S \<inter> f -` T
[PROOF STEP]
using closure_minimal[of S "(closure S \<inter> f -` T)"]
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> {x \<in> closure S. f x \<in> T}
closed (closure S \<inter> f -` T)
\<lbrakk>S \<subseteq> closure S \<inter> f -` T; closed (closure S \<inter> f -` T)\<rbrakk> \<Longrightarrow> closure S \<subseteq> closure S \<inter> f -` T

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

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

goal (1 subgoal):
 1. f ` closure S \<subseteq> T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f ` closure S \<subseteq> T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_join_alt:
  "card cf f (Join l r) = list_sel f (revorder l) (revorder r) * card cf f l * card cf f r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. JoinTree.card cf f (Join l r) = list_sel f (revorder l) (revorder r) * JoinTree.card cf f l * JoinTree.card cf f r
[PROOF STEP]
unfolding list_sel_revorder_eq_inorder
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. JoinTree.card cf f (Join l r) = list_sel f (inorder l) (inorder r) * JoinTree.card cf f l * JoinTree.card cf f r
[PROOF STEP]
by simp


[STATEMENT]
lemma [code abstract]: "Rep_FingerTree (tailR t) =
    (if (FingerTreeStruc.isEmpty (Rep_FingerTree t)) then Empty
    else FingerTreeStruc.tailR (Rep_FingerTree t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_FingerTree (tailR t) = (if FingerTreeStruc.isEmpty (Rep_FingerTree t) then Empty else FingerTreeStruc.tailR (Rep_FingerTree t))
[PROOF STEP]
apply (simp add: tailR_def FingerTreeStruc.tailR_correct FingerTreeStruc.isEmpty_def empty_rep)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_FingerTree t = Empty \<longrightarrow> Rep_FingerTree local.empty = Empty
[PROOF STEP]
apply (simp add: empty_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma card_le_one_alt: "finite X \<Longrightarrow> card X \<le> 1 \<longleftrightarrow> X = {} \<or> (\<exists>x. X = {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite X \<Longrightarrow> (card X \<le> 1) = (X = {} \<or> (\<exists>x. X = {x}))
[PROOF STEP]
by (induct rule: finite_induct) auto


[STATEMENT]
lemma Carmichael_prime:
  assumes "prime p"
  shows   "Carmichael p = p - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Carmichael p = p - 1
[PROOF STEP]
proof (cases "even p")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. even p \<Longrightarrow> Carmichael p = p - 1
 2. odd p \<Longrightarrow> Carmichael p = p - 1
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
even p

goal (2 subgoals):
 1. even p \<Longrightarrow> Carmichael p = p - 1
 2. odd p \<Longrightarrow> Carmichael p = p - 1
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
prime p
even p
[PROOF STEP]
have "p = 2"
[PROOF STATE]
proof (prove)
using this:
prime p
even p

goal (1 subgoal):
 1. p = 2
[PROOF STEP]
using primes_dvd_imp_eq two_is_prime_nat
[PROOF STATE]
proof (prove)
using this:
prime p
even p
\<lbrakk>prime ?p; prime ?q; ?p dvd ?q\<rbrakk> \<Longrightarrow> ?p = ?q
prime 2

goal (1 subgoal):
 1. p = 2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
p = 2

goal (2 subgoals):
 1. even p \<Longrightarrow> Carmichael p = p - 1
 2. odd p \<Longrightarrow> Carmichael p = p - 1
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
p = 2

goal (1 subgoal):
 1. Carmichael p = p - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Carmichael p = p - 1

goal (1 subgoal):
 1. odd p \<Longrightarrow> Carmichael p = p - 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. odd p \<Longrightarrow> Carmichael p = p - 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
odd p

goal (1 subgoal):
 1. odd p \<Longrightarrow> Carmichael p = p - 1
[PROOF STEP]
with Carmichael_odd_prime_power[of p 1] assms
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>prime p; odd p; 0 < 1\<rbrakk> \<Longrightarrow> Carmichael (p ^ 1) = p ^ (1 - 1) * (p - 1)
prime p
odd p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>prime p; odd p; 0 < 1\<rbrakk> \<Longrightarrow> Carmichael (p ^ 1) = p ^ (1 - 1) * (p - 1)
prime p
odd p

goal (1 subgoal):
 1. Carmichael p = p - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Carmichael p = p - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma icard_cartesian_product: "icard (A \<times> B) = icard A * icard B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. icard (A \<times> B) = icard A * icard B
[PROOF STEP]
apply (case_tac "A = {} \<or> B = {}", fastforce)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (A = {} \<or> B = {}) \<Longrightarrow> icard (A \<times> B) = icard A * icard B
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; B \<noteq> {}\<rbrakk> \<Longrightarrow> icard (A \<times> B) = icard A * icard B
[PROOF STEP]
apply (case_tac "finite A \<and> finite B")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>A \<noteq> {}; B \<noteq> {}; finite A \<and> finite B\<rbrakk> \<Longrightarrow> icard (A \<times> B) = icard A * icard B
 2. \<lbrakk>A \<noteq> {}; B \<noteq> {}; \<not> (finite A \<and> finite B)\<rbrakk> \<Longrightarrow> icard (A \<times> B) = icard A * icard B
[PROOF STEP]
apply (simp add: icard_finite)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; B \<noteq> {}; \<not> (finite A \<and> finite B)\<rbrakk> \<Longrightarrow> icard (A \<times> B) = icard A * icard B
[PROOF STEP]
apply (simp only: de_Morgan_conj, erule disjE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>A \<noteq> {}; B \<noteq> {}; infinite A\<rbrakk> \<Longrightarrow> icard (A \<times> B) = icard A * icard B
 2. \<lbrakk>A \<noteq> {}; B \<noteq> {}; infinite B\<rbrakk> \<Longrightarrow> icard (A \<times> B) = icard A * icard B
[PROOF STEP]
apply (simp_all add:
  icard_not_empty_iff[symmetric]
  cartesian_product_infiniteL_imp_infinite cartesian_product_infiniteR_imp_infinite)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem sigma_algebra_empty: "{} \<in> \<sigma>_algebra A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {} \<in> \<sigma>_algebra A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {} \<in> \<sigma>_algebra A
[PROOF STEP]
have "UNIV \<in> \<sigma>_algebra A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV \<in> \<sigma>_algebra A
[PROOF STEP]
by (rule \<sigma>_algebra.UNIV)
[PROOF STATE]
proof (state)
this:
UNIV \<in> \<sigma>_algebra A

goal (1 subgoal):
 1. {} \<in> \<sigma>_algebra A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
UNIV \<in> \<sigma>_algebra A
[PROOF STEP]
have "-UNIV \<in> \<sigma>_algebra A"
[PROOF STATE]
proof (prove)
using this:
UNIV \<in> \<sigma>_algebra A

goal (1 subgoal):
 1. - UNIV \<in> \<sigma>_algebra A
[PROOF STEP]
by (rule \<sigma>_algebra.complement)
[PROOF STATE]
proof (state)
this:
- UNIV \<in> \<sigma>_algebra A

goal (1 subgoal):
 1. {} \<in> \<sigma>_algebra A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- UNIV \<in> \<sigma>_algebra A

goal (1 subgoal):
 1. {} \<in> \<sigma>_algebra A
[PROOF STEP]
have "-UNIV = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - UNIV = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- UNIV = {}

goal (1 subgoal):
 1. {} \<in> \<sigma>_algebra A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
{} \<in> \<sigma>_algebra A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{} \<in> \<sigma>_algebra A

goal (1 subgoal):
 1. {} \<in> \<sigma>_algebra A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
{} \<in> \<sigma>_algebra A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_le_less_imp_less:
  assumes "a \<le> b" and "c < d" and "0 < a" and "0 \<le> c"
  shows "a * c < b * d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * c < b * d
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<le> b
c < d
(0::'a) < a
(0::'a) \<le> c

goal (1 subgoal):
 1. a * c < b * d
[PROOF STEP]
apply (subgoal_tac "a * c \<le> b * c")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a \<le> b; c < d; (0::'a) < a; (0::'a) \<le> c; a * c \<le> b * c\<rbrakk> \<Longrightarrow> a * c < b * d
 2. \<lbrakk>a \<le> b; c < d; (0::'a) < a; (0::'a) \<le> c\<rbrakk> \<Longrightarrow> a * c \<le> b * c
[PROOF STEP]
apply (erule le_less_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a \<le> b; c < d; (0::'a) < a; (0::'a) \<le> c\<rbrakk> \<Longrightarrow> b * c < b * d
 2. \<lbrakk>a \<le> b; c < d; (0::'a) < a; (0::'a) \<le> c\<rbrakk> \<Longrightarrow> a * c \<le> b * c
[PROOF STEP]
apply (erule mult_strict_left_mono)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a \<le> b; (0::'a) < a; (0::'a) \<le> c\<rbrakk> \<Longrightarrow> (0::'a) < b
 2. \<lbrakk>a \<le> b; c < d; (0::'a) < a; (0::'a) \<le> c\<rbrakk> \<Longrightarrow> a * c \<le> b * c
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> b; c < d; (0::'a) < a; (0::'a) \<le> c\<rbrakk> \<Longrightarrow> a * c \<le> b * c
[PROOF STEP]
apply (erule mult_right_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c < d; (0::'a) < a; (0::'a) \<le> c\<rbrakk> \<Longrightarrow> (0::'a) \<le> c
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma rank_dim_range:
  fixes A :: "real^'n^'m"
  shows "rank A = dim(range (\<lambda>x. A *v x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = dim (range ((*v) A))
[PROOF STEP]
unfolding column_rank_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim (columns A) = dim (range ((*v) A))
[PROOF STEP]
proof (rule span_eq_dim)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. span (columns A) = span (range ((*v) A))
[PROOF STEP]
have "span (columns A) \<subseteq> span (range ((*v) A))" (is "?l \<subseteq> ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span (columns A) \<subseteq> span (range ((*v) A))
[PROOF STEP]
by (simp add: columns_image_basis image_subsetI span_mono)
[PROOF STATE]
proof (state)
this:
span (columns A) \<subseteq> span (range ((*v) A))

goal (1 subgoal):
 1. span (columns A) = span (range ((*v) A))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
span (columns A) \<subseteq> span (range ((*v) A))
[PROOF STEP]
show "?l = ?r"
[PROOF STATE]
proof (prove)
using this:
span (columns A) \<subseteq> span (range ((*v) A))

goal (1 subgoal):
 1. span (columns A) = span (range ((*v) A))
[PROOF STEP]
by (metis (no_types, lifting) image_subset_iff matrix_vector_mult_in_columnspace
        span_eq span_span)
[PROOF STATE]
proof (state)
this:
span (columns A) = span (range ((*v) A))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma openin_Int_closure_of_subset:
  assumes "openin X S"
  shows "S \<inter> X closure_of T \<subseteq> X closure_of (S \<inter> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<inter> X closure_of T \<subseteq> X closure_of (S \<inter> T)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<inter> X closure_of T \<subseteq> X closure_of (S \<inter> T)
[PROOF STEP]
have "S \<inter> X derived_set_of T = S \<inter> X derived_set_of (S \<inter> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<inter> X derived_set_of T = S \<inter> X derived_set_of (S \<inter> T)
[PROOF STEP]
by (meson assms openin_Int_derived_set_of_eq)
[PROOF STATE]
proof (state)
this:
S \<inter> X derived_set_of T = S \<inter> X derived_set_of (S \<inter> T)

goal (1 subgoal):
 1. S \<inter> X closure_of T \<subseteq> X closure_of (S \<inter> T)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
S \<inter> X derived_set_of T = S \<inter> X derived_set_of (S \<inter> T)

goal (1 subgoal):
 1. S \<inter> X closure_of T \<subseteq> X closure_of (S \<inter> T)
[PROOF STEP]
have "S \<inter> (S \<inter> T) = S \<inter> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<inter> (S \<inter> T) = S \<inter> T
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
S \<inter> (S \<inter> T) = S \<inter> T

goal (1 subgoal):
 1. S \<inter> X closure_of T \<subseteq> X closure_of (S \<inter> T)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
S \<inter> X derived_set_of T = S \<inter> X derived_set_of (S \<inter> T)
S \<inter> (S \<inter> T) = S \<inter> T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<inter> X derived_set_of T = S \<inter> X derived_set_of (S \<inter> T)
S \<inter> (S \<inter> T) = S \<inter> T

goal (1 subgoal):
 1. S \<inter> X closure_of T \<subseteq> X closure_of (S \<inter> T)
[PROOF STEP]
by (metis closure_of_alt inf.cobounded2 inf_left_commute inf_sup_distrib1)
[PROOF STATE]
proof (state)
this:
S \<inter> X closure_of T \<subseteq> X closure_of (S \<inter> T)

goal:
No subgoals!
[PROOF STEP]
qed


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

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

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

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

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

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma equiv_trans_sym:
  "\<lbrakk> equiv V R; (a,b)\<in>R; (c,b)\<in>R \<rbrakk> \<Longrightarrow> (a,c)\<in>R"
  "\<lbrakk> equiv V R; (a,b)\<in>R; (a,c)\<in>R \<rbrakk> \<Longrightarrow> (b,c)\<in>R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>equiv V R; (a, b) \<in> R; (c, b) \<in> R\<rbrakk> \<Longrightarrow> (a, c) \<in> R) &&& (\<lbrakk>equiv V R; (a, b) \<in> R; (a, c) \<in> R\<rbrakk> \<Longrightarrow> (b, c) \<in> R)
[PROOF STEP]
apply (metis equiv_sym equiv_trans)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma measure_UNION':
  "finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> F i \<in> fmeasurable M) \<Longrightarrow> pairwise (\<lambda>i j. disjnt (F i) (F j)) I \<Longrightarrow>
    measure M (\<Union>i\<in>I. F i) = (\<Sum>i\<in>I. measure M (F i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; \<And>i. i \<in> I \<Longrightarrow> F i \<in> fmeasurable M; pairwise (\<lambda>i j. disjnt (F i) (F j)) I\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (\<Union> (F ` I)) = (\<Sum>i\<in>I. Sigma_Algebra.measure M (F i))
[PROOF STEP]
by (intro measure_UNION_AE) (auto simp: disjnt_def elim!: pairwise_mono intro!: always_eventually)


[STATEMENT]
lemma convergent_diff:
  fixes X Y :: "nat \<Rightarrow> 'a::topological_group_add"
  assumes "convergent (\<lambda>n. X n)"
  assumes "convergent (\<lambda>n. Y n)"
  shows "convergent (\<lambda>n. X n - Y n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>n. X n - Y n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
convergent X
convergent Y

goal (1 subgoal):
 1. convergent (\<lambda>n. X n - Y n)
[PROOF STEP]
unfolding convergent_def
[PROOF STATE]
proof (prove)
using this:
\<exists>L. X \<longlonglongrightarrow> L
\<exists>L. Y \<longlonglongrightarrow> L

goal (1 subgoal):
 1. \<exists>L. (\<lambda>n. X n - Y n) \<longlonglongrightarrow> L
[PROOF STEP]
by (blast intro: tendsto_diff)


[STATEMENT]
lemma interior_of_union_eq_empty:
   "closedin X S
        \<Longrightarrow> (X interior_of (S \<union> T) = {} \<longleftrightarrow>
             X interior_of S = {} \<and> X interior_of T = {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin X S \<Longrightarrow> (X interior_of (S \<union> T) = {}) = (X interior_of S = {} \<and> X interior_of T = {})
[PROOF STEP]
by (metis interior_of_closedin_union_empty_interior_of le_sup_iff subset_empty union_interior_of_subset)


[STATEMENT]
lemma norm_sq_mtx_def3: "\<parallel>A\<parallel> = (SUP x. (\<parallel>A *\<^sub>V x\<parallel>) / (\<parallel>x\<parallel>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>A\<parallel> = (SUP x. \<parallel>A *\<^sub>V x\<parallel> / \<parallel>x\<parallel>)
[PROOF STEP]
unfolding norm_sq_mtx_def onorm_def sq_mtx_vec_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP x. \<parallel>to_vec A *v x\<parallel> / \<parallel>x\<parallel>) = (SUP x. \<parallel>map_fun to_vec id (*v) A x\<parallel> / \<parallel>x\<parallel>)
[PROOF STEP]
by simp


[STATEMENT]
lemma horner_sum_eq_sum_funpow:
  \<open>horner_sum f a xs = (\<Sum>n = 0..<length xs. ((*) a ^^ n) (f (xs ! n)))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. horner_sum f a xs = (\<Sum>n = 0..<length xs. ((*) a ^^ n) (f (xs ! n)))
[PROOF STEP]
proof (induction xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. horner_sum f a [] = (\<Sum>n = 0..<length []. ((*) a ^^ n) (f ([] ! n)))
 2. \<And>aa xs. horner_sum f a xs = (\<Sum>n = 0..<length xs. ((*) a ^^ n) (f (xs ! n))) \<Longrightarrow> horner_sum f a (aa # xs) = (\<Sum>n = 0..<length (aa # xs). ((*) a ^^ n) (f ((aa # xs) ! n)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. horner_sum f a [] = (\<Sum>n = 0..<length []. ((*) a ^^ n) (f ([] ! n)))
 2. \<And>aa xs. horner_sum f a xs = (\<Sum>n = 0..<length xs. ((*) a ^^ n) (f (xs ! n))) \<Longrightarrow> horner_sum f a (aa # xs) = (\<Sum>n = 0..<length (aa # xs). ((*) a ^^ n) (f ((aa # xs) ! n)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. horner_sum f a [] = (\<Sum>n = 0..<length []. ((*) a ^^ n) (f ([] ! n)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
horner_sum f a [] = (\<Sum>n = 0..<length []. ((*) a ^^ n) (f ([] ! n)))

goal (1 subgoal):
 1. \<And>aa xs. horner_sum f a xs = (\<Sum>n = 0..<length xs. ((*) a ^^ n) (f (xs ! n))) \<Longrightarrow> horner_sum f a (aa # xs) = (\<Sum>n = 0..<length (aa # xs). ((*) a ^^ n) (f ((aa # xs) ! n)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa xs. horner_sum f a xs = (\<Sum>n = 0..<length xs. ((*) a ^^ n) (f (xs ! n))) \<Longrightarrow> horner_sum f a (aa # xs) = (\<Sum>n = 0..<length (aa # xs). ((*) a ^^ n) (f ((aa # xs) ! n)))
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
horner_sum f a xs = (\<Sum>n = 0..<length xs. ((*) a ^^ n) (f (xs ! n)))

goal (1 subgoal):
 1. \<And>aa xs. horner_sum f a xs = (\<Sum>n = 0..<length xs. ((*) a ^^ n) (f (xs ! n))) \<Longrightarrow> horner_sum f a (aa # xs) = (\<Sum>n = 0..<length (aa # xs). ((*) a ^^ n) (f ((aa # xs) ! n)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
horner_sum f a xs = (\<Sum>n = 0..<length xs. ((*) a ^^ n) (f (xs ! n)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
horner_sum f a xs = (\<Sum>n = 0..<length xs. ((*) a ^^ n) (f (xs ! n)))

goal (1 subgoal):
 1. horner_sum f a (x # xs) = (\<Sum>n = 0..<length (x # xs). ((*) a ^^ n) (f ((x # xs) ! n)))
[PROOF STEP]
by (simp add: sum.atLeast0_lessThan_Suc_shift sum_distrib_left del: sum.op_ivl_Suc)
[PROOF STATE]
proof (state)
this:
horner_sum f a (x # xs) = (\<Sum>n = 0..<length (x # xs). ((*) a ^^ n) (f ((x # xs) ! n)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma power2_norm_eq_inner: "(norm x)\<^sup>2 = inner x x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm x)\<^sup>2 = inner x x
[PROOF STEP]
by (simp add: norm_eq_sqrt_inner)


[STATEMENT]
lemma lm025:
  assumes "inj_on f X"
  shows "inj_on (image f) (Pow X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on ((`) f) (Pow X)
[PROOF STEP]
using assms inj_on_image_eq_iff inj_onI PowD
[PROOF STATE]
proof (prove)
using this:
inj_on f X
\<lbrakk>inj_on ?f ?C; ?A \<subseteq> ?C; ?B \<subseteq> ?C\<rbrakk> \<Longrightarrow> (?f ` ?A = ?f ` ?B) = (?A = ?B)
(\<And>x y. \<lbrakk>x \<in> ?A; y \<in> ?A; ?f x = ?f y\<rbrakk> \<Longrightarrow> x = y) \<Longrightarrow> inj_on ?f ?A
?A \<in> Pow ?B \<Longrightarrow> ?A \<subseteq> ?B

goal (1 subgoal):
 1. inj_on ((`) f) (Pow X)
[PROOF STEP]
by (metis (mono_tags, lifting))


[STATEMENT]
lemma ugraph_max_edges :
  assumes "uwellformed G" and "card (uverts G) = n" and "finite (uverts G)"
  shows "card (uedges G) \<le> n * (n-1)/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (uedges G)) \<le> real n * (real n - 1) / 2
[PROOF STEP]
using assms wellformed_all_edges [OF assms(1)] card_all_edges [OF assms(3)] Binomial.choose_two [of "card(uverts G)"]
[PROOF STATE]
proof (prove)
using this:
uwellformed G
card (uverts G) = n
finite (uverts G)
uedges G \<subseteq> all_edges (uverts G)
card (all_edges (uverts G)) = card (uverts G) choose 2
card (uverts G) choose 2 = card (uverts G) * (card (uverts G) - 1) div 2

goal (1 subgoal):
 1. real (card (uedges G)) \<le> real n * (real n - 1) / 2
[PROOF STEP]
by (smt (verit, del_insts) all_edges_finite card_mono dbl_simps(3) dbl_simps(5) div_times_less_eq_dividend le_divide_eq_numeral1(1) le_square nat_mult_1_right numerals(1) of_nat_1 of_nat_diff of_nat_mono of_nat_mult of_nat_numeral right_diff_distrib')


[STATEMENT]
lemma eval_mod_exp [simp]:
  "mod_exp_nat b' 0 m' = 1 mod m'"
  "mod_exp_nat b' 1 m' = b' mod m'"
  "mod_exp_nat b' (Suc 0) m' = b' mod m'"
  "mod_exp_nat b' e' 0 = b' ^ e'"
  "mod_exp_nat b' e' 1 = 0"
  "mod_exp_nat b' e' (Suc 0) = 0"
  "mod_exp_nat 0 1 m' = 0"
  "mod_exp_nat 0 (Suc 0) m' = 0"
  "mod_exp_nat 0 (numeral e) m' = 0"
  "mod_exp_nat 1 e' m' = 1 mod m'"
  "mod_exp_nat (Suc 0) e' m' = 1 mod m'"
  "mod_exp_nat (numeral b) (numeral e) (numeral m) =
     mod_exp_nat_aux (numeral m) 1 (numeral b) (numeral e) mod numeral m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((mod_exp_nat b' 0 m' = 1 mod m' &&& mod_exp_nat b' 1 m' = b' mod m' &&& mod_exp_nat b' (Suc 0) m' = b' mod m') &&& mod_exp_nat b' e' 0 = b' ^ e' &&& mod_exp_nat b' e' 1 = 0 &&& mod_exp_nat b' e' (Suc 0) = 0) &&& (mod_exp_nat 0 1 m' = 0 &&& mod_exp_nat 0 (Suc 0) m' = 0 &&& mod_exp_nat 0 (numeral e) m' = 0) &&& mod_exp_nat 1 e' m' = 1 mod m' &&& mod_exp_nat (Suc 0) e' m' = 1 mod m' &&& mod_exp_nat (numeral b) (numeral e) (numeral m) = mod_exp_nat_aux (numeral m) 1 (numeral b) (numeral e) mod numeral m
[PROOF STEP]
by (simp_all add: mod_exp_nat_def mod_exp_nat_aux_correct)


[STATEMENT]
lemma dist_fs_triangle_infinite2:
  shows "1 / sqrt(1 + (cmod a)\<^sup>2) \<le> cmod (a - c) / (sqrt (1+(cmod a)\<^sup>2) * sqrt (1+(cmod c)\<^sup>2)) + 1 / sqrt(1 + (cmod c)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / sqrt (1 + (cmod a)\<^sup>2) \<le> cmod (a - c) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2)) + 1 / sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
using dist_fs_triangle_infinite1[of a c]
[PROOF STATE]
proof (prove)
using this:
1 / sqrt (1 + (cmod a)\<^sup>2) \<le> 1 / sqrt (1 + (cmod c)\<^sup>2) + cmod (a - c) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2))

goal (1 subgoal):
 1. 1 / sqrt (1 + (cmod a)\<^sup>2) \<le> cmod (a - c) / (sqrt (1 + (cmod a)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2)) + 1 / sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
by simp


[STATEMENT]
lemma bst_of_list_append:
  "bst_of_list (xs @ ys) = fold Tree_Set.insert ys (bst_of_list xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bst_of_list (xs @ ys) = fold Tree_Set.insert ys (bst_of_list xs)
[PROOF STEP]
proof (induction ys arbitrary: xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. bst_of_list (xs @ []) = fold Tree_Set.insert [] (bst_of_list xs)
 2. \<And>a ys xs. (\<And>xs. bst_of_list (xs @ ys) = fold Tree_Set.insert ys (bst_of_list xs)) \<Longrightarrow> bst_of_list (xs @ a # ys) = fold Tree_Set.insert (a # ys) (bst_of_list xs)
[PROOF STEP]
case (Cons y ys)
[PROOF STATE]
proof (state)
this:
bst_of_list (?xs @ ys) = fold Tree_Set.insert ys (bst_of_list ?xs)

goal (2 subgoals):
 1. \<And>xs. bst_of_list (xs @ []) = fold Tree_Set.insert [] (bst_of_list xs)
 2. \<And>a ys xs. (\<And>xs. bst_of_list (xs @ ys) = fold Tree_Set.insert ys (bst_of_list xs)) \<Longrightarrow> bst_of_list (xs @ a # ys) = fold Tree_Set.insert (a # ys) (bst_of_list xs)
[PROOF STEP]
have "bst_of_list (xs @ (y # ys)) = bst_of_list ((xs @ [y]) @ ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bst_of_list (xs @ y # ys) = bst_of_list ((xs @ [y]) @ ys)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bst_of_list (xs @ y # ys) = bst_of_list ((xs @ [y]) @ ys)

goal (2 subgoals):
 1. \<And>xs. bst_of_list (xs @ []) = fold Tree_Set.insert [] (bst_of_list xs)
 2. \<And>a ys xs. (\<And>xs. bst_of_list (xs @ ys) = fold Tree_Set.insert ys (bst_of_list xs)) \<Longrightarrow> bst_of_list (xs @ a # ys) = fold Tree_Set.insert (a # ys) (bst_of_list xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bst_of_list (xs @ y # ys) = bst_of_list ((xs @ [y]) @ ys)

goal (2 subgoals):
 1. \<And>xs. bst_of_list (xs @ []) = fold Tree_Set.insert [] (bst_of_list xs)
 2. \<And>a ys xs. (\<And>xs. bst_of_list (xs @ ys) = fold Tree_Set.insert ys (bst_of_list xs)) \<Longrightarrow> bst_of_list (xs @ a # ys) = fold Tree_Set.insert (a # ys) (bst_of_list xs)
[PROOF STEP]
have "\<dots> = fold Tree_Set.insert ys (bst_of_list (xs @ [y]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bst_of_list ((xs @ [y]) @ ys) = fold Tree_Set.insert ys (bst_of_list (xs @ [y]))
[PROOF STEP]
by (rule Cons.IH)
[PROOF STATE]
proof (state)
this:
bst_of_list ((xs @ [y]) @ ys) = fold Tree_Set.insert ys (bst_of_list (xs @ [y]))

goal (2 subgoals):
 1. \<And>xs. bst_of_list (xs @ []) = fold Tree_Set.insert [] (bst_of_list xs)
 2. \<And>a ys xs. (\<And>xs. bst_of_list (xs @ ys) = fold Tree_Set.insert ys (bst_of_list xs)) \<Longrightarrow> bst_of_list (xs @ a # ys) = fold Tree_Set.insert (a # ys) (bst_of_list xs)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
bst_of_list (xs @ y # ys) = fold Tree_Set.insert ys (bst_of_list (xs @ [y]))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
bst_of_list (xs @ y # ys) = fold Tree_Set.insert ys (bst_of_list (xs @ [y]))

goal (1 subgoal):
 1. bst_of_list (xs @ y # ys) = fold Tree_Set.insert (y # ys) (bst_of_list xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bst_of_list (xs @ y # ys) = fold Tree_Set.insert (y # ys) (bst_of_list xs)

goal (1 subgoal):
 1. \<And>xs. bst_of_list (xs @ []) = fold Tree_Set.insert [] (bst_of_list xs)
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma cong_solve_coprime_poly:
assumes coprime_an:"coprime (a::'b::{field_gcd} poly) n"
shows "\<exists>x. [a * x = 1] (mod n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. [a * x = 1] (mod n)
[PROOF STEP]
proof (cases "a = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = 0 \<Longrightarrow> \<exists>x. [a * x = 1] (mod n)
 2. a \<noteq> 0 \<Longrightarrow> \<exists>x. [a * x = 1] (mod n)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = 0

goal (2 subgoals):
 1. a = 0 \<Longrightarrow> \<exists>x. [a * x = 1] (mod n)
 2. a \<noteq> 0 \<Longrightarrow> \<exists>x. [a * x = 1] (mod n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. [a * x = 1] (mod n)
[PROOF STEP]
unfolding cong_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. a * x mod n = 1 mod n
[PROOF STEP]
using True coprime_an
[PROOF STATE]
proof (prove)
using this:
a = 0
coprime a n

goal (1 subgoal):
 1. \<exists>x. a * x mod n = 1 mod n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>x. [a * x = 1] (mod n)

goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> \<exists>x. [a * x = 1] (mod n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> \<exists>x. [a * x = 1] (mod n)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> 0

goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> \<exists>x. [a * x = 1] (mod n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. [a * x = 1] (mod n)
[PROOF STEP]
using coprime_an cong_solve_poly[OF False, of n]
[PROOF STATE]
proof (prove)
using this:
coprime a n
\<exists>x. [a * x = gcd a n] (mod n)

goal (1 subgoal):
 1. \<exists>x. [a * x = 1] (mod n)
[PROOF STEP]
unfolding cong_def
[PROOF STATE]
proof (prove)
using this:
coprime a n
\<exists>x. a * x mod n = gcd a n mod n

goal (1 subgoal):
 1. \<exists>x. a * x mod n = 1 mod n
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
\<exists>x. [a * x = 1] (mod n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lemma_NBseq_def2: "(\<exists>K > 0. \<forall>n. norm (X n) \<le> K) = (\<exists>N. \<forall>n. norm (X n) < real(Suc N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>K>0. \<forall>n. norm (X n) \<le> K) = (\<exists>N. \<forall>n. norm (X n) < real (Suc N))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<exists>K>0. \<forall>n. norm (X n) \<le> K) = (\<exists>N. \<forall>n. norm (X n) < real (Suc N))
[PROOF STEP]
have *: "\<And>N. \<forall>n. norm (X n) \<le> 1 + real N \<Longrightarrow>
         \<exists>N. \<forall>n. norm (X n) < 1 + real N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>N. \<forall>n. norm (X n) \<le> 1 + real N \<Longrightarrow> \<exists>N. \<forall>n. norm (X n) < 1 + real N
[PROOF STEP]
by (metis add.commute le_less_trans less_add_one of_nat_Suc)
[PROOF STATE]
proof (state)
this:
\<forall>n. norm (X n) \<le> 1 + real ?N \<Longrightarrow> \<exists>N. \<forall>n. norm (X n) < 1 + real N

goal (1 subgoal):
 1. (\<exists>K>0. \<forall>n. norm (X n) \<le> K) = (\<exists>N. \<forall>n. norm (X n) < real (Suc N))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>n. norm (X n) \<le> 1 + real ?N \<Longrightarrow> \<exists>N. \<forall>n. norm (X n) < 1 + real N
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>n. norm (X n) \<le> 1 + real ?N \<Longrightarrow> \<exists>N. \<forall>n. norm (X n) < 1 + real N

goal (1 subgoal):
 1. (\<exists>K>0. \<forall>n. norm (X n) \<le> K) = (\<exists>N. \<forall>n. norm (X n) < real (Suc N))
[PROOF STEP]
unfolding lemma_NBseq_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n. norm (X n) \<le> 1 + real ?N \<Longrightarrow> \<exists>N. \<forall>n. norm (X n) < 1 + real N

goal (1 subgoal):
 1. (\<exists>N. \<forall>n. norm (X n) \<le> real (Suc N)) = (\<exists>N. \<forall>n. norm (X n) < real (Suc N))
[PROOF STEP]
by (metis less_le_not_le not_less_iff_gr_or_eq of_nat_Suc)
[PROOF STATE]
proof (state)
this:
(\<exists>K>0. \<forall>n. norm (X n) \<le> K) = (\<exists>N. \<forall>n. norm (X n) < real (Suc N))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scalar_product: fixes v :: "'a :: semiring_1 ^ 'n :: mod_type"
  shows "scalar_prod (from_hma\<^sub>v v) (from_hma\<^sub>v w) = scalar_product v w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mod_Type_Connect.from_hma\<^sub>v v \<bullet> Mod_Type_Connect.from_hma\<^sub>v w = scalar_product v w
[PROOF STEP]
unfolding scalar_product_def scalar_prod_def from_hma\<^sub>v_def dim_vec
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<CARD('n). Matrix.vec CARD('n) (\<lambda>i. v $h mod_type_class.from_nat i) $v i * Matrix.vec CARD('n) (\<lambda>i. w $h mod_type_class.from_nat i) $v i) = (\<Sum>i\<in>UNIV. v $h i * w $h i)
[PROOF STEP]
by (simp add: sum.reindex[OF inj_to_nat, unfolded range_to_nat])


[STATEMENT]
lemma tendsto_sandwich':
  fixes l f u :: "'a \<Rightarrow> 'b :: order_topology"
  shows "eventually (\<lambda>x. l x \<le> f x) F \<Longrightarrow> eventually (\<lambda>x. f x \<le> u x) F \<Longrightarrow>
           (l \<longlongrightarrow> L1) F \<Longrightarrow> (u \<longlongrightarrow> L2) F \<Longrightarrow> L1 = L2 \<Longrightarrow> (f \<longlongrightarrow> L1) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>\<^sub>F x in F. l x \<le> f x; \<forall>\<^sub>F x in F. f x \<le> u x; (l \<longlongrightarrow> L1) F; (u \<longlongrightarrow> L2) F; L1 = L2\<rbrakk> \<Longrightarrow> (f \<longlongrightarrow> L1) F
[PROOF STEP]
using tendsto_sandwich[of l f F u L1]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>\<^sub>F n in F. l n \<le> f n; \<forall>\<^sub>F n in F. f n \<le> u n; (l \<longlongrightarrow> L1) F; (u \<longlongrightarrow> L1) F\<rbrakk> \<Longrightarrow> (f \<longlongrightarrow> L1) F

goal (1 subgoal):
 1. \<lbrakk>\<forall>\<^sub>F x in F. l x \<le> f x; \<forall>\<^sub>F x in F. f x \<le> u x; (l \<longlongrightarrow> L1) F; (u \<longlongrightarrow> L2) F; L1 = L2\<rbrakk> \<Longrightarrow> (f \<longlongrightarrow> L1) F
[PROOF STEP]
by simp


[STATEMENT]
lemma card_farey_fractions_asymptotics:
  "(\<lambda>N. real (card (farey_fractions N)) - 3 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>N. real (card (farey_fractions N)) - 3 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>N. real (card (farey_fractions N)) - 3 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))
[PROOF STEP]
have "(\<lambda>N. sum_upto (\<lambda>n. real (totient n)) (real N) - 3 / pi\<^sup>2 * (real N)\<^sup>2)
            \<in> O(\<lambda>N. real N * ln (real N))" (is "?f \<in> _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>N. sum_upto (\<lambda>n. real (totient n)) (real N) - 3 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))
[PROOF STEP]
using summatory_totient_asymptotics filterlim_real_sequentially
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. sum_upto (\<lambda>n. real (totient n)) x - 3 / pi\<^sup>2 * x\<^sup>2) \<in> O(\<lambda>x. x * ln x)
filterlim real at_top sequentially

goal (1 subgoal):
 1. (\<lambda>N. sum_upto (\<lambda>n. real (totient n)) (real N) - 3 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))
[PROOF STEP]
by (rule landau_o.big.compose)
[PROOF STATE]
proof (state)
this:
(\<lambda>N. sum_upto (\<lambda>n. real (totient n)) (real N) - 3 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))

goal (1 subgoal):
 1. (\<lambda>N. real (card (farey_fractions N)) - 3 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>N. sum_upto (\<lambda>n. real (totient n)) (real N) - 3 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))

goal (1 subgoal):
 1. (\<lambda>N. real (card (farey_fractions N)) - 3 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))
[PROOF STEP]
have "?f = (\<lambda>N. real (card (farey_fractions N)) - 3 / pi\<^sup>2 * (real N)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>N. sum_upto (\<lambda>n. real (totient n)) (real N) - 3 / pi\<^sup>2 * (real N)\<^sup>2) = (\<lambda>N. real (card (farey_fractions N)) - 3 / pi\<^sup>2 * (real N)\<^sup>2)
[PROOF STEP]
by (intro ext) (simp add: sum_upto_altdef card_farey_fractions)
[PROOF STATE]
proof (state)
this:
(\<lambda>N. sum_upto (\<lambda>n. real (totient n)) (real N) - 3 / pi\<^sup>2 * (real N)\<^sup>2) = (\<lambda>N. real (card (farey_fractions N)) - 3 / pi\<^sup>2 * (real N)\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>N. real (card (farey_fractions N)) - 3 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>N. real (card (farey_fractions N)) - 3 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>N. real (card (farey_fractions N)) - 3 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))

goal (1 subgoal):
 1. (\<lambda>N. real (card (farey_fractions N)) - 3 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>N. real (card (farey_fractions N)) - 3 / pi\<^sup>2 * (real N)\<^sup>2) \<in> O(\<lambda>N. real N * ln (real N))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mono_funpow: "mono (f::'a::order \<Rightarrow> 'a) \<Longrightarrow> mono (f^^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f \<Longrightarrow> mono (f ^^ i)
[PROOF STEP]
apply (induct i)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. mono f \<Longrightarrow> mono (f ^^ 0)
 2. \<And>i. \<lbrakk>mono f \<Longrightarrow> mono (f ^^ i); mono f\<rbrakk> \<Longrightarrow> mono (f ^^ Suc i)
[PROOF STEP]
apply (auto intro!: monoI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i x y. \<lbrakk>mono (f ^^ i); mono f; x \<le> y\<rbrakk> \<Longrightarrow> f ((f ^^ i) x) \<le> f ((f ^^ i) y)
[PROOF STEP]
apply (auto dest: monoD)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma p1mod22k: "(2 * b + 1) mod (2 * 2 ^ n) = 2 * (b mod 2 ^ n) + 1"
  for b :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 * b + 1) mod (2 * 2 ^ n) = 2 * (b mod 2 ^ n) + 1
[PROOF STEP]
by (simp add: p1mod22k' add.commute)


[STATEMENT]
lemma lagrange_basis_poly_1:
  "poly (lagrange_basis_poly (map fst xs_ys) x) x = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (lagrange_basis_poly (map fst xs_ys) x) x = (1::'a)
[PROOF STEP]
unfolding lagrange_basis_poly_def Let_def poly_prod_list
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<leftarrow>map (\<lambda>xi. smult (inverse (x - xi)) [:- xi, 1::'a:]) (filter (\<lambda>xa. xa \<noteq> x) (map fst xs_ys)). poly p x) = (1::'a)
[PROOF STEP]
by (rule prod_list_neutral, auto)
  (metis field_class.field_inverse mult.commute right_diff_distrib right_minus_eq)


[STATEMENT]
lemma card_orbit_eq_funpow_dist1:
  assumes "x \<in> orbit f x" shows "card (orbit f x) = funpow_dist1 f x x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (orbit f x) = funpow_dist1 f x x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (orbit f x) = funpow_dist1 f x x
[PROOF STEP]
have "card (orbit f x) = card ((\<lambda>n. (f ^^ n) x) ` {0..<funpow_dist1 f x x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (orbit f x) = card ((\<lambda>n. (f ^^ n) x) ` {0..<funpow_dist1 f x x})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> orbit f x

goal (1 subgoal):
 1. card (orbit f x) = card ((\<lambda>n. (f ^^ n) x) ` {0..<funpow_dist1 f x x})
[PROOF STEP]
by (simp only: orbit_conv_funpow_dist1[symmetric])
[PROOF STATE]
proof (state)
this:
card (orbit f x) = card ((\<lambda>n. (f ^^ n) x) ` {0..<funpow_dist1 f x x})

goal (1 subgoal):
 1. card (orbit f x) = funpow_dist1 f x x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (orbit f x) = card ((\<lambda>n. (f ^^ n) x) ` {0..<funpow_dist1 f x x})

goal (1 subgoal):
 1. card (orbit f x) = funpow_dist1 f x x
[PROOF STEP]
have "\<dots> = card {0..<funpow_dist1 f x x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<lambda>n. (f ^^ n) x) ` {0..<funpow_dist1 f x x}) = card {0..<funpow_dist1 f x x}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> orbit f x

goal (1 subgoal):
 1. card ((\<lambda>n. (f ^^ n) x) ` {0..<funpow_dist1 f x x}) = card {0..<funpow_dist1 f x x}
[PROOF STEP]
by (intro card_image inj_on_funpow_dist1)
[PROOF STATE]
proof (state)
this:
card ((\<lambda>n. (f ^^ n) x) ` {0..<funpow_dist1 f x x}) = card {0..<funpow_dist1 f x x}

goal (1 subgoal):
 1. card (orbit f x) = funpow_dist1 f x x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (orbit f x) = card {0..<funpow_dist1 f x x}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (orbit f x) = card {0..<funpow_dist1 f x x}

goal (1 subgoal):
 1. card (orbit f x) = funpow_dist1 f x x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (orbit f x) = funpow_dist1 f x x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nth_elem_insert_Min:
  assumes "card S > 0"
  assumes "a < Min S"
  shows "nth_elem (insert a S) (Suc i) = nth_elem S i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_elem (insert a S) (Suc i) = nth_elem S i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < card S
a < Min S

goal (1 subgoal):
 1. nth_elem (insert a S) (Suc i) = nth_elem S i
[PROOF STEP]
by (metis Min_gr_iff card_0_eq card_ge_0_finite neq0_conv nth_Cons_Suc nth_elem.elims set_to_list_insert_Min)


[STATEMENT]
lemma arctan_inverse:
  assumes "0 < x"
    shows "arctan(inverse x) = pi/2 - arctan x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan (inverse x) = pi / 2 - arctan x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arctan (inverse x) = pi / 2 - arctan x
[PROOF STEP]
have "arctan(inverse x) = arctan(inverse(tan(arctan x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan (inverse x) = arctan (inverse (tan (arctan x)))
[PROOF STEP]
by (simp add: arctan)
[PROOF STATE]
proof (state)
this:
arctan (inverse x) = arctan (inverse (tan (arctan x)))

goal (1 subgoal):
 1. arctan (inverse x) = pi / 2 - arctan x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
arctan (inverse x) = arctan (inverse (tan (arctan x)))

goal (1 subgoal):
 1. arctan (inverse x) = pi / 2 - arctan x
[PROOF STEP]
have "\<dots> = arctan (tan (pi / 2 - arctan x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan (inverse (tan (arctan x))) = arctan (tan (pi / 2 - arctan x))
[PROOF STEP]
by (simp add: tan_cot)
[PROOF STATE]
proof (state)
this:
arctan (inverse (tan (arctan x))) = arctan (tan (pi / 2 - arctan x))

goal (1 subgoal):
 1. arctan (inverse x) = pi / 2 - arctan x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
arctan (inverse (tan (arctan x))) = arctan (tan (pi / 2 - arctan x))

goal (1 subgoal):
 1. arctan (inverse x) = pi / 2 - arctan x
[PROOF STEP]
have "\<dots> = pi/2 - arctan x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan (tan (pi / 2 - arctan x)) = pi / 2 - arctan x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arctan (tan (pi / 2 - arctan x)) = pi / 2 - arctan x
[PROOF STEP]
have "0 < pi - arctan x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < pi - arctan x
[PROOF STEP]
using arctan_ubound [of x] pi_gt_zero
[PROOF STATE]
proof (prove)
using this:
arctan x < pi / 2
0 < pi

goal (1 subgoal):
 1. 0 < pi - arctan x
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
0 < pi - arctan x

goal (1 subgoal):
 1. arctan (tan (pi / 2 - arctan x)) = pi / 2 - arctan x
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 < x
0 < pi - arctan x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < x
0 < pi - arctan x

goal (1 subgoal):
 1. arctan (tan (pi / 2 - arctan x)) = pi / 2 - arctan x
[PROOF STEP]
by (simp add: Transcendental.arctan_tan)
[PROOF STATE]
proof (state)
this:
arctan (tan (pi / 2 - arctan x)) = pi / 2 - arctan x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
arctan (tan (pi / 2 - arctan x)) = pi / 2 - arctan x

goal (1 subgoal):
 1. arctan (inverse x) = pi / 2 - arctan x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
arctan (inverse x) = pi / 2 - arctan x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
arctan (inverse x) = pi / 2 - arctan x

goal (1 subgoal):
 1. arctan (inverse x) = pi / 2 - arctan x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
arctan (inverse x) = pi / 2 - arctan x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_series: "(\<lambda>n. ((-1)^n / fact (2*n+1)) *\<^sub>R z^(2*n+1)) sums sin z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. ((- 1) ^ n / fact (2 * n + 1)) *\<^sub>R z ^ (2 * n + 1)) sums sin z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. ((- 1) ^ n / fact (2 * n + 1)) *\<^sub>R z ^ (2 * n + 1)) sums sin z
[PROOF STEP]
from sin_converges[of z]
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. sin_coeff n *\<^sub>R z ^ n) sums sin z
[PROOF STEP]
have "(\<lambda>n. sin_coeff n *\<^sub>R z^n) sums sin z"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. sin_coeff n *\<^sub>R z ^ n) sums sin z

goal (1 subgoal):
 1. (\<lambda>n. sin_coeff n *\<^sub>R z ^ n) sums sin z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. sin_coeff n *\<^sub>R z ^ n) sums sin z

goal (1 subgoal):
 1. (\<lambda>n. ((- 1) ^ n / fact (2 * n + 1)) *\<^sub>R z ^ (2 * n + 1)) sums sin z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. sin_coeff n *\<^sub>R z ^ n) sums sin z

goal (1 subgoal):
 1. (\<lambda>n. ((- 1) ^ n / fact (2 * n + 1)) *\<^sub>R z ^ (2 * n + 1)) sums sin z
[PROOF STEP]
have "(\<lambda>n. sin_coeff n *\<^sub>R z^n) sums sin z \<longleftrightarrow>
                 (\<lambda>n. ((-1)^n / fact (2*n+1)) *\<^sub>R z^(2*n+1)) sums sin z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. sin_coeff n *\<^sub>R z ^ n) sums sin z = (\<lambda>n. ((- 1) ^ n / fact (2 * n + 1)) *\<^sub>R z ^ (2 * n + 1)) sums sin z
[PROOF STEP]
by (subst sums_mono_reindex[of "\<lambda>n. 2*n+1", symmetric])
       (auto simp: sin_coeff_def strict_mono_def ac_simps elim!: oddE)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. sin_coeff n *\<^sub>R z ^ n) sums sin z = (\<lambda>n. ((- 1) ^ n / fact (2 * n + 1)) *\<^sub>R z ^ (2 * n + 1)) sums sin z

goal (1 subgoal):
 1. (\<lambda>n. ((- 1) ^ n / fact (2 * n + 1)) *\<^sub>R z ^ (2 * n + 1)) sums sin z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. ((- 1) ^ n / fact (2 * n + 1)) *\<^sub>R z ^ (2 * n + 1)) sums sin z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ((- 1) ^ n / fact (2 * n + 1)) *\<^sub>R z ^ (2 * n + 1)) sums sin z

goal (1 subgoal):
 1. (\<lambda>n. ((- 1) ^ n / fact (2 * n + 1)) *\<^sub>R z ^ (2 * n + 1)) sums sin z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ((- 1) ^ n / fact (2 * n + 1)) *\<^sub>R z ^ (2 * n + 1)) sums sin z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_average_minus_second [simp]: "(b + a) / 2 - a = (b - a) / 2"
  for a b :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b + a) / 2 - a = (b - a) / 2
[PROOF STEP]
by simp


[STATEMENT]
lemma nn_transfer_operator_intTn_g:
  assumes "f \<in> borel_measurable M" "g \<in> borel_measurable M"
  shows "(\<integral>\<^sup>+ x. f x * (nn_transfer_operator^^n) g x \<partial>M) = (\<integral>\<^sup>+ x. f ((T^^n) x) * g x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M
[PROOF STEP]
have "\<And>f g. f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<integral>\<^sup>+ x. f x * (nn_transfer_operator^^n) g x \<partial>M) = (\<integral>\<^sup>+ x. f ((T^^n) x) * g x \<partial>M)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ 0) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ 0) x) * g x \<partial>M
 2. \<And>n f g. \<lbrakk>\<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M; f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ Suc n) x) * g x \<partial>M
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?f3 \<in> borel_measurable M; ?g3 \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ?f3 x * (nn_transfer_operator ^^ n) ?g3 x \<partial>M = \<integral>\<^sup>+ x. ?f3 ((T ^^ n) x) * ?g3 x \<partial>M
f \<in> borel_measurable M
g \<in> borel_measurable M

goal (2 subgoals):
 1. \<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ 0) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ 0) x) * g x \<partial>M
 2. \<And>n f g. \<lbrakk>\<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M; f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ Suc n) x) * g x \<partial>M
[PROOF STEP]
have [measurable]: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> borel_measurable M &&& g \<in> borel_measurable M
[PROOF STEP]
by fact+
[PROOF STATE]
proof (state)
this:
f \<in> borel_measurable M
g \<in> borel_measurable M

goal (2 subgoals):
 1. \<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ 0) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ 0) x) * g x \<partial>M
 2. \<And>n f g. \<lbrakk>\<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M; f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ Suc n) x) * g x \<partial>M
[PROOF STEP]
have "(\<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M) = (\<integral>\<^sup>+ x. f x * (nn_transfer_operator ((nn_transfer_operator^^n) g)) x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f x * nn_transfer_operator ((nn_transfer_operator ^^ n) g) x \<partial>M
[PROOF STEP]
apply (rule nn_integral_cong)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> space M \<Longrightarrow> f x * (nn_transfer_operator ^^ Suc n) g x = f x * nn_transfer_operator ((nn_transfer_operator ^^ n) g) x
[PROOF STEP]
using funpow.simps(2)
[PROOF STATE]
proof (prove)
using this:
?f ^^ Suc ?n = ?f \<circ> ?f ^^ ?n

goal (1 subgoal):
 1. \<And>x. x \<in> space M \<Longrightarrow> f x * (nn_transfer_operator ^^ Suc n) g x = f x * nn_transfer_operator ((nn_transfer_operator ^^ n) g) x
[PROOF STEP]
unfolding comp_def
[PROOF STATE]
proof (prove)
using this:
?f ^^ Suc ?n = (\<lambda>x. ?f ((?f ^^ ?n) x))

goal (1 subgoal):
 1. \<And>x. x \<in> space M \<Longrightarrow> f x * (nn_transfer_operator ^^ Suc n) g x = f x * nn_transfer_operator ((nn_transfer_operator ^^ n) g) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f x * nn_transfer_operator ((nn_transfer_operator ^^ n) g) x \<partial>M

goal (2 subgoals):
 1. \<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ 0) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ 0) x) * g x \<partial>M
 2. \<And>n f g. \<lbrakk>\<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M; f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ Suc n) x) * g x \<partial>M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f x * nn_transfer_operator ((nn_transfer_operator ^^ n) g) x \<partial>M

goal (2 subgoals):
 1. \<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ 0) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ 0) x) * g x \<partial>M
 2. \<And>n f g. \<lbrakk>\<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M; f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ Suc n) x) * g x \<partial>M
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. f (T x) * (nn_transfer_operator^^n) g x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * nn_transfer_operator ((nn_transfer_operator ^^ n) g) x \<partial>M = \<integral>\<^sup>+ x. f (T x) * (nn_transfer_operator ^^ n) g x \<partial>M
[PROOF STEP]
by (rule nn_transfer_operator_intg, auto)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * nn_transfer_operator ((nn_transfer_operator ^^ n) g) x \<partial>M = \<integral>\<^sup>+ x. f (T x) * (nn_transfer_operator ^^ n) g x \<partial>M

goal (2 subgoals):
 1. \<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ 0) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ 0) x) * g x \<partial>M
 2. \<And>n f g. \<lbrakk>\<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M; f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ Suc n) x) * g x \<partial>M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * nn_transfer_operator ((nn_transfer_operator ^^ n) g) x \<partial>M = \<integral>\<^sup>+ x. f (T x) * (nn_transfer_operator ^^ n) g x \<partial>M

goal (2 subgoals):
 1. \<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ 0) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ 0) x) * g x \<partial>M
 2. \<And>n f g. \<lbrakk>\<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M; f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ Suc n) x) * g x \<partial>M
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. (\<lambda>x. f (T x)) ((T^^n) x) * g x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f (T x) * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f (T ((T ^^ n) x)) * g x \<partial>M
[PROOF STEP]
by (rule Suc.IH, auto)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f (T x) * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f (T ((T ^^ n) x)) * g x \<partial>M

goal (2 subgoals):
 1. \<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ 0) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ 0) x) * g x \<partial>M
 2. \<And>n f g. \<lbrakk>\<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M; f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ Suc n) x) * g x \<partial>M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f (T x) * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f (T ((T ^^ n) x)) * g x \<partial>M

goal (2 subgoals):
 1. \<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ 0) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ 0) x) * g x \<partial>M
 2. \<And>n f g. \<lbrakk>\<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M; f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ Suc n) x) * g x \<partial>M
[PROOF STEP]
have "... = (\<integral>\<^sup>+ x. f ((T^^(Suc n)) x) * g x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f (T ((T ^^ n) x)) * g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ Suc n) x) * g x \<partial>M
[PROOF STEP]
apply (rule nn_integral_cong)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> space M \<Longrightarrow> f (T ((T ^^ n) x)) * g x = f ((T ^^ Suc n) x) * g x
[PROOF STEP]
using funpow.simps(2)
[PROOF STATE]
proof (prove)
using this:
?f ^^ Suc ?n = ?f \<circ> ?f ^^ ?n

goal (1 subgoal):
 1. \<And>x. x \<in> space M \<Longrightarrow> f (T ((T ^^ n) x)) * g x = f ((T ^^ Suc n) x) * g x
[PROOF STEP]
unfolding comp_def
[PROOF STATE]
proof (prove)
using this:
?f ^^ Suc ?n = (\<lambda>x. ?f ((?f ^^ ?n) x))

goal (1 subgoal):
 1. \<And>x. x \<in> space M \<Longrightarrow> f (T ((T ^^ n) x)) * g x = f ((T ^^ Suc n) x) * g x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f (T ((T ^^ n) x)) * g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ Suc n) x) * g x \<partial>M

goal (2 subgoals):
 1. \<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ 0) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ 0) x) * g x \<partial>M
 2. \<And>n f g. \<lbrakk>\<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M; f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ Suc n) x) * g x \<partial>M
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ Suc n) x) * g x \<partial>M
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ Suc n) x) * g x \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ Suc n) x) * g x \<partial>M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ Suc n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ Suc n) x) * g x \<partial>M

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>f \<in> borel_measurable M; g \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ 0) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ 0) x) * g x \<partial>M
[PROOF STEP]
qed (simp)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?f3 \<in> borel_measurable M; ?g3 \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ?f3 x * (nn_transfer_operator ^^ ?n4) ?g3 x \<partial>M = \<integral>\<^sup>+ x. ?f3 ((T ^^ ?n4) x) * ?g3 x \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?f3 \<in> borel_measurable M; ?g3 \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ?f3 x * (nn_transfer_operator ^^ ?n4) ?g3 x \<partial>M = \<integral>\<^sup>+ x. ?f3 ((T ^^ ?n4) x) * ?g3 x \<partial>M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f3 \<in> borel_measurable M; ?g3 \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ?f3 x * (nn_transfer_operator ^^ ?n4) ?g3 x \<partial>M = \<integral>\<^sup>+ x. ?f3 ((T ^^ ?n4) x) * ?g3 x \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f3 \<in> borel_measurable M; ?g3 \<in> borel_measurable M\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ x. ?f3 x * (nn_transfer_operator ^^ ?n4) ?g3 x \<partial>M = \<integral>\<^sup>+ x. ?f3 ((T ^^ ?n4) x) * ?g3 x \<partial>M
f \<in> borel_measurable M
g \<in> borel_measurable M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * (nn_transfer_operator ^^ n) g x \<partial>M = \<integral>\<^sup>+ x. f ((T ^^ n) x) * g x \<partial>M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_prod [simp]: "CARD('a \<times> 'b) = CARD('a) * CARD('b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('a \<times> 'b) = CARD('a) * CARD('b)
[PROOF STEP]
unfolding UNIV_Times_UNIV [symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (UNIV \<times> UNIV) = CARD('a) * CARD('b)
[PROOF STEP]
by (simp only: card_cartesian_product)


[STATEMENT]
theorem inorder_insert:
  "\<lbrakk> avl t;  sorted(inorder t) \<rbrakk> \<Longrightarrow> inorder(insert x t) = ins_list x (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>avl t; Sorted_Less.sorted (Tree2.inorder t)\<rbrakk> \<Longrightarrow> Tree2.inorder (AVL_Bal_Set.insert x t) = ins_list x (Tree2.inorder t)
[PROOF STEP]
apply(induction t)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>avl \<langle>\<rangle>; Sorted_Less.sorted (Tree2.inorder \<langle>\<rangle>)\<rbrakk> \<Longrightarrow> Tree2.inorder (AVL_Bal_Set.insert x \<langle>\<rangle>) = ins_list x (Tree2.inorder \<langle>\<rangle>)
 2. \<And>t1 x2 t2. \<lbrakk>\<lbrakk>avl t1; Sorted_Less.sorted (Tree2.inorder t1)\<rbrakk> \<Longrightarrow> Tree2.inorder (AVL_Bal_Set.insert x t1) = ins_list x (Tree2.inorder t1); \<lbrakk>avl t2; Sorted_Less.sorted (Tree2.inorder t2)\<rbrakk> \<Longrightarrow> Tree2.inorder (AVL_Bal_Set.insert x t2) = ins_list x (Tree2.inorder t2); avl \<langle>t1, x2, t2\<rangle>; Sorted_Less.sorted (Tree2.inorder \<langle>t1, x2, t2\<rangle>)\<rbrakk> \<Longrightarrow> Tree2.inorder (AVL_Bal_Set.insert x \<langle>t1, x2, t2\<rangle>) = ins_list x (Tree2.inorder \<langle>t1, x2, t2\<rangle>)
[PROOF STEP]
apply (auto simp: ins_list_simps split!: splits)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma INF_Lim:
  fixes X :: "nat \<Rightarrow> 'a::{complete_linorder,linorder_topology}"
  assumes dec: "decseq X"
    and l: "X \<longlonglongrightarrow> l"
  shows "(INF n. X n) = l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf (range X) = l
[PROOF STEP]
using LIMSEQ_INF[OF dec] tendsto_unique[OF trivial_limit_sequentially l]
[PROOF STATE]
proof (prove)
using this:
X \<longlonglongrightarrow> Inf (range X)
X \<longlonglongrightarrow> ?b \<Longrightarrow> l = ?b

goal (1 subgoal):
 1. Inf (range X) = l
[PROOF STEP]
by simp


[STATEMENT]
lemma measure_pmf_prob_product:
  assumes "countable A" "countable B"
  shows "measure_pmf.prob (pair_pmf M N) (A \<times> B) = measure_pmf.prob M A * measure_pmf.prob N B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (pair_pmf M N) (A \<times> B) = measure_pmf.prob M A * measure_pmf.prob N B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. measure_pmf.prob (pair_pmf M N) (A \<times> B) = measure_pmf.prob M A * measure_pmf.prob N B
[PROOF STEP]
have "measure_pmf.prob (pair_pmf M N) (A \<times> B) = (\<Sum>\<^sub>a(a, b)\<in>A \<times> B. pmf M a * pmf N b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (pair_pmf M N) (A \<times> B) = (\<Sum>\<^sub>a(a, b)\<in>A \<times> B. pmf M a * pmf N b)
[PROOF STEP]
by (auto intro!: infsetsum_cong simp add: measure_pmf_conv_infsetsum pmf_pair)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (pair_pmf M N) (A \<times> B) = (\<Sum>\<^sub>a(a, b)\<in>A \<times> B. pmf M a * pmf N b)

goal (1 subgoal):
 1. measure_pmf.prob (pair_pmf M N) (A \<times> B) = measure_pmf.prob M A * measure_pmf.prob N B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (pair_pmf M N) (A \<times> B) = (\<Sum>\<^sub>a(a, b)\<in>A \<times> B. pmf M a * pmf N b)

goal (1 subgoal):
 1. measure_pmf.prob (pair_pmf M N) (A \<times> B) = measure_pmf.prob M A * measure_pmf.prob N B
[PROOF STEP]
have "\<dots> = measure_pmf.prob M A * measure_pmf.prob N B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>a(a, b)\<in>A \<times> B. pmf M a * pmf N b) = measure_pmf.prob M A * measure_pmf.prob N B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
countable A
countable B

goal (1 subgoal):
 1. (\<Sum>\<^sub>a(a, b)\<in>A \<times> B. pmf M a * pmf N b) = measure_pmf.prob M A * measure_pmf.prob N B
[PROOF STEP]
by (subst infsetsum_product) (auto simp add: measure_pmf_conv_infsetsum)
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>a(a, b)\<in>A \<times> B. pmf M a * pmf N b) = measure_pmf.prob M A * measure_pmf.prob N B

goal (1 subgoal):
 1. measure_pmf.prob (pair_pmf M N) (A \<times> B) = measure_pmf.prob M A * measure_pmf.prob N B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
measure_pmf.prob (pair_pmf M N) (A \<times> B) = measure_pmf.prob M A * measure_pmf.prob N B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
measure_pmf.prob (pair_pmf M N) (A \<times> B) = measure_pmf.prob M A * measure_pmf.prob N B

goal (1 subgoal):
 1. measure_pmf.prob (pair_pmf M N) (A \<times> B) = measure_pmf.prob M A * measure_pmf.prob N B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (pair_pmf M N) (A \<times> B) = measure_pmf.prob M A * measure_pmf.prob N B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sqrt_add_le_add_sqrt:
  assumes "0 \<le> x" "0 \<le> y"
  shows "sqrt (x + y) \<le> sqrt x + sqrt y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (x + y) \<le> sqrt x + sqrt y
[PROOF STEP]
by (rule power2_le_imp_le) (simp_all add: power2_sum assms)


[STATEMENT]
lemma continuous_powr:
  assumes "continuous F f"
    and "continuous F g"
    and "f (Lim F (\<lambda>x. x)) \<noteq> 0"
  shows "continuous F (\<lambda>x. (f x) powr (g x :: real))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous F (\<lambda>x. f x powr g x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous F f
continuous F g
f (Lim F (\<lambda>x. x)) \<noteq> 0

goal (1 subgoal):
 1. continuous F (\<lambda>x. f x powr g x)
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F
(g \<longlongrightarrow> g (Lim F (\<lambda>x. x))) F
f (Lim F (\<lambda>x. x)) \<noteq> 0

goal (1 subgoal):
 1. ((\<lambda>x. f x powr g x) \<longlongrightarrow> f (Lim F (\<lambda>x. x)) powr g (Lim F (\<lambda>x. x))) F
[PROOF STEP]
by (rule tendsto_powr)


[STATEMENT]
lemma real_sqrt_sum_squares_mult_ge_zero [simp]: "0 \<le> sqrt ((x\<^sup>2 + y\<^sup>2) * (xa\<^sup>2 + ya\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> sqrt ((x\<^sup>2 + y\<^sup>2) * (xa\<^sup>2 + ya\<^sup>2))
[PROOF STEP]
by (metis real_sqrt_ge_0_iff split_mult_pos_le sum_power2_ge_zero)