[STATEMENT]
lemma simple_function_partition:
  assumes f: "simple_function M f" and g: "simple_function M g"
  assumes sub: "\<And>x y. x \<in> space M \<Longrightarrow> y \<in> space M \<Longrightarrow> g x = g y \<Longrightarrow> f x = f y"
  assumes v: "\<And>x. x \<in> space M \<Longrightarrow> f x = v (g x)"
  shows "integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x\<in>space M. g x = y})"
    (is "_ = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
from f g
[PROOF STATE]
proof (chain)
picking this:
simple_function M f
simple_function M g
[PROOF STEP]
have [simp]: "finite (f`space M)" "finite (g`space M)"
[PROOF STATE]
proof (prove)
using this:
simple_function M f
simple_function M g

goal (1 subgoal):
 1. finite (f ` space M) &&& finite (g ` space M)
[PROOF STEP]
by (auto simp: simple_function_def)
[PROOF STATE]
proof (state)
this:
finite (f ` space M)
finite (g ` space M)

goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
from f g
[PROOF STATE]
proof (chain)
picking this:
simple_function M f
simple_function M g
[PROOF STEP]
have [measurable]: "f \<in> measurable M (count_space UNIV)" "g \<in> measurable M (count_space UNIV)"
[PROOF STATE]
proof (prove)
using this:
simple_function M f
simple_function M g

goal (1 subgoal):
 1. f \<in> M \<rightarrow>\<^sub>M count_space UNIV &&& g \<in> M \<rightarrow>\<^sub>M count_space UNIV
[PROOF STEP]
by (auto intro: measurable_simple_function)
[PROOF STATE]
proof (state)
this:
f \<in> M \<rightarrow>\<^sub>M count_space UNIV
g \<in> M \<rightarrow>\<^sub>M count_space UNIV

goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
f \<in> M \<rightarrow>\<^sub>M count_space UNIV
g \<in> M \<rightarrow>\<^sub>M count_space UNIV

goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
assume "y \<in> space M"
[PROOF STATE]
proof (state)
this:
y \<in> space M

goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> space M
[PROOF STEP]
have "f ` space M \<inter> {i. \<exists>x\<in>space M. i = f x \<and> g y = g x} = {v (g y)}"
[PROOF STATE]
proof (prove)
using this:
y \<in> space M

goal (1 subgoal):
 1. f ` space M \<inter> {i. \<exists>x\<in>space M. i = f x \<and> g y = g x} = {v (g y)}
[PROOF STEP]
by (auto cong: sub simp: v[symmetric])
[PROOF STATE]
proof (state)
this:
f ` space M \<inter> {i. \<exists>x\<in>space M. i = f x \<and> g y = g x} = {v (g y)}

goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?y2 \<in> space M \<Longrightarrow> f ` space M \<inter> {i. \<exists>x\<in>space M. i = f x \<and> g ?y2 = g x} = {v (g ?y2)}

goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
note eq = this
[PROOF STATE]
proof (state)
this:
?y2 \<in> space M \<Longrightarrow> f ` space M \<inter> {i. \<exists>x\<in>space M. i = f x \<and> g ?y2 = g x} = {v (g ?y2)}

goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
have "integral\<^sup>S M f =
    (\<Sum>y\<in>f`space M. y * (\<Sum>z\<in>g`space M.
      if \<exists>x\<in>space M. y = f x \<and> z = g x then emeasure M {x\<in>space M. g x = z} else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>f ` space M. y * (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. y = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0))
[PROOF STEP]
unfolding simple_integral_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>f ` space M. x * emeasure M (f -` {x} \<inter> space M)) = (\<Sum>y\<in>f ` space M. y * (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. y = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0))
[PROOF STEP]
proof (safe intro!: sum.cong ennreal_mult_left_cong)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>f xa \<noteq> 0; xa \<in> space M\<rbrakk> \<Longrightarrow> emeasure M (f -` {f xa} \<inter> space M) = (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. f xa = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0)
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>f xa \<noteq> 0; xa \<in> space M\<rbrakk> \<Longrightarrow> emeasure M (f -` {f xa} \<inter> space M) = (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. f xa = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0)
[PROOF STEP]
assume y: "y \<in> space M" "f y \<noteq> 0"
[PROOF STATE]
proof (state)
this:
y \<in> space M
f y \<noteq> 0

goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>f xa \<noteq> 0; xa \<in> space M\<rbrakk> \<Longrightarrow> emeasure M (f -` {f xa} \<inter> space M) = (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. f xa = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0)
[PROOF STEP]
have [simp]: "g ` space M \<inter> {z. \<exists>x\<in>space M. f y = f x \<and> z = g x} =
        {z. \<exists>x\<in>space M. f y = f x \<and> z = g x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g ` space M \<inter> {z. \<exists>x\<in>space M. f y = f x \<and> z = g x} = {z. \<exists>x\<in>space M. f y = f x \<and> z = g x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g ` space M \<inter> {z. \<exists>x\<in>space M. f y = f x \<and> z = g x} = {z. \<exists>x\<in>space M. f y = f x \<and> z = g x}

goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>f xa \<noteq> 0; xa \<in> space M\<rbrakk> \<Longrightarrow> emeasure M (f -` {f xa} \<inter> space M) = (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. f xa = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0)
[PROOF STEP]
have eq:"(\<Union>i\<in>{z. \<exists>x\<in>space M. f y = f x \<and> z = g x}. {x \<in> space M. g x = i}) =
        f -` {f y} \<inter> space M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>i\<in>{z. \<exists>x\<in>space M. f y = f x \<and> z = g x}. {x \<in> space M. g x = i}) = f -` {f y} \<inter> space M
[PROOF STEP]
by (auto simp: eq_commute cong: sub rev_conj_cong)
[PROOF STATE]
proof (state)
this:
(\<Union>i\<in>{z. \<exists>x\<in>space M. f y = f x \<and> z = g x}. {x \<in> space M. g x = i}) = f -` {f y} \<inter> space M

goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>f xa \<noteq> 0; xa \<in> space M\<rbrakk> \<Longrightarrow> emeasure M (f -` {f xa} \<inter> space M) = (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. f xa = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0)
[PROOF STEP]
have "finite (g`space M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (g ` space M)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (g ` space M)

goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>f xa \<noteq> 0; xa \<in> space M\<rbrakk> \<Longrightarrow> emeasure M (f -` {f xa} \<inter> space M) = (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. f xa = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (g ` space M)
[PROOF STEP]
have "finite {z. \<exists>x\<in>space M. f y = f x \<and> z = g x}"
[PROOF STATE]
proof (prove)
using this:
finite (g ` space M)

goal (1 subgoal):
 1. finite {z. \<exists>x\<in>space M. f y = f x \<and> z = g x}
[PROOF STEP]
by (rule rev_finite_subset) auto
[PROOF STATE]
proof (state)
this:
finite {z. \<exists>x\<in>space M. f y = f x \<and> z = g x}

goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>f xa \<noteq> 0; xa \<in> space M\<rbrakk> \<Longrightarrow> emeasure M (f -` {f xa} \<inter> space M) = (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. f xa = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite {z. \<exists>x\<in>space M. f y = f x \<and> z = g x}
[PROOF STEP]
show "emeasure M (f -` {f y} \<inter> space M) =
      (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. f y = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0)"
[PROOF STATE]
proof (prove)
using this:
finite {z. \<exists>x\<in>space M. f y = f x \<and> z = g x}

goal (1 subgoal):
 1. emeasure M (f -` {f y} \<inter> space M) = (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. f y = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0)
[PROOF STEP]
apply (simp add: sum.If_cases)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {z. \<exists>x\<in>space M. f y = f x \<and> z = g x} \<Longrightarrow> emeasure M (f -` {f y} \<inter> space M) = (\<Sum>z | \<exists>x\<in>space M. f y = f x \<and> z = g x. emeasure M {x \<in> space M. g x = z})
[PROOF STEP]
apply (subst sum_emeasure)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. finite {z. \<exists>x\<in>space M. f y = f x \<and> z = g x} \<Longrightarrow> (\<lambda>z. {x \<in> space M. g x = z}) ` {z. \<exists>x\<in>space M. f y = f x \<and> z = g x} \<subseteq> sets M
 2. finite {z. \<exists>x\<in>space M. f y = f x \<and> z = g x} \<Longrightarrow> disjoint_family_on (\<lambda>z. {x \<in> space M. g x = z}) {z. \<exists>x\<in>space M. f y = f x \<and> z = g x}
 3. finite {z. \<exists>x\<in>space M. f y = f x \<and> z = g x} \<Longrightarrow> finite {z. \<exists>x\<in>space M. f y = f x \<and> z = g x}
 4. finite {z. \<exists>x\<in>space M. f y = f x \<and> z = g x} \<Longrightarrow> emeasure M (f -` {f y} \<inter> space M) = emeasure M (\<Union>i\<in>{z. \<exists>x\<in>space M. f y = f x \<and> z = g x}. {x \<in> space M. g x = i})
[PROOF STEP]
apply (auto simp: disjoint_family_on_def eq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
emeasure M (f -` {f y} \<inter> space M) = (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. f y = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
integral\<^sup>S M f = (\<Sum>y\<in>f ` space M. y * (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. y = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0))

goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>S M f = (\<Sum>y\<in>f ` space M. y * (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. y = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0))

goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
have "\<dots> = (\<Sum>y\<in>f`space M. (\<Sum>z\<in>g`space M.
      if \<exists>x\<in>space M. y = f x \<and> z = g x then y * emeasure M {x\<in>space M. g x = z} else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>y\<in>f ` space M. y * (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. y = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0)) = (\<Sum>y\<in>f ` space M. \<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. y = f x \<and> z = g x then y * emeasure M {x \<in> space M. g x = z} else 0)
[PROOF STEP]
by (auto intro!: sum.cong simp: sum_distrib_left)
[PROOF STATE]
proof (state)
this:
(\<Sum>y\<in>f ` space M. y * (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. y = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0)) = (\<Sum>y\<in>f ` space M. \<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. y = f x \<and> z = g x then y * emeasure M {x \<in> space M. g x = z} else 0)

goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>y\<in>f ` space M. y * (\<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. y = f x \<and> z = g x then emeasure M {x \<in> space M. g x = z} else 0)) = (\<Sum>y\<in>f ` space M. \<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. y = f x \<and> z = g x then y * emeasure M {x \<in> space M. g x = z} else 0)

goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
have "\<dots> = ?r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>y\<in>f ` space M. \<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. y = f x \<and> z = g x then y * emeasure M {x \<in> space M. g x = z} else 0) = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
by (subst sum.swap)
       (auto intro!: sum.cong simp: sum.If_cases scaleR_sum_right[symmetric] eq)
[PROOF STATE]
proof (state)
this:
(\<Sum>y\<in>f ` space M. \<Sum>z\<in>g ` space M. if \<exists>x\<in>space M. y = f x \<and> z = g x then y * emeasure M {x \<in> space M. g x = z} else 0) = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})

goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
show "integral\<^sup>S M f = ?r"
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})

goal (1 subgoal):
 1. integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
integral\<^sup>S M f = (\<Sum>y\<in>g ` space M. v y * emeasure M {x \<in> space M. g x = y})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subfrmlsn_sf_subset:
  "\<psi> \<in> subfrmlsn \<phi> \<Longrightarrow> sf \<psi> \<subseteq> sf \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<psi> \<in> subfrmlsn \<phi> \<Longrightarrow> sf \<psi> \<subseteq> sf \<phi>
[PROOF STEP]
by (induction \<phi>) auto


[STATEMENT]
lemma "rec_nat zero suc (Suc x) = suc x (rec_nat zero suc x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_nat zero suc (Suc x) = suc x (rec_nat zero suc x)
[PROOF STEP]
nitpick [expect = none]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_nat zero suc (Suc x) = suc x (rec_nat zero suc x)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma SN_rel_alt_s_empty : "SN_rel_alt R {} = SN R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SN_rel_alt R {} = SN R
[PROOF STEP]
unfolding SN_rel_defs SN_defs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>f. (\<forall>i. (f i, f (Suc i)) \<in> R \<union> {}) \<and> f 0 \<in> UNIV \<longrightarrow> \<not> (\<exists>\<^sub>\<infinity>j. (f j, f (Suc j)) \<in> R)) = (\<nexists>f. f 0 \<in> UNIV \<and> (\<forall>i. (f i, f (Suc i)) \<in> R))
[PROOF STEP]
by auto


[STATEMENT]
lemma (in Ring) sum_mult_mem1:"\<lbrakk>A \<subseteq> carrier R; B \<subseteq> carrier R;
        x \<in> sum_mult R A B\<rbrakk>  \<Longrightarrow>
        \<exists>n. \<exists>f\<in>{j. j \<le> (n::nat)} \<rightarrow> set_mult R A B. nsum R f n = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> carrier R; B \<subseteq> carrier R; x \<in> sum_mult R A B\<rbrakk> \<Longrightarrow> \<exists>n. \<exists>f\<in>{j. j \<le> n} \<rightarrow> set_mult R A B. \<Sigma>\<^sub>e R f n = x
[PROOF STEP]
by (simp add:sum_mult_def)


[STATEMENT]
lemma Nset_pre_un:"(0::nat) < k \<Longrightarrow> {j. j \<le> k} = {j. j \<le> (k - Suc 0)} \<union> {k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> {j. j \<le> k} = {j. j \<le> k - Suc 0} \<union> {k}
[PROOF STEP]
apply (insert Nset_un [of "k - Suc 0"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; {j. j \<le> Suc (k - Suc 0)} = {j. j \<le> k - Suc 0} \<union> {Suc (k - Suc 0)}\<rbrakk> \<Longrightarrow> {j. j \<le> k} = {j. j \<le> k - Suc 0} \<union> {k}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Amicable_Example_Descartes:
  shows "9363584 Amic 9437056"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 9363584 Amic 9437056
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 9363584 Amic 9437056
[PROOF STEP]
have a: "(7::nat)>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < 7
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < 7

goal (1 subgoal):
 1. 9363584 Amic 9437056
[PROOF STEP]
have b: "prime (191::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime 191
[PROOF STEP]
by (pratt (code))
[PROOF STATE]
proof (state)
this:
prime 191

goal (1 subgoal):
 1. 9363584 Amic 9437056
[PROOF STEP]
have c: "((3::nat)* (2^(7-1))-1) =191"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 * 2 ^ (7 - 1) - 1 = 191
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
3 * 2 ^ (7 - 1) - 1 = 191

goal (1 subgoal):
 1. 9363584 Amic 9437056
[PROOF STEP]
have d: "prime((3::nat)* (2^(7-1))-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime (3 * 2 ^ (7 - 1) - 1)
[PROOF STEP]
using b c
[PROOF STATE]
proof (prove)
using this:
prime 191
3 * 2 ^ (7 - 1) - 1 = 191

goal (1 subgoal):
 1. prime (3 * 2 ^ (7 - 1) - 1)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
prime (3 * 2 ^ (7 - 1) - 1)

goal (1 subgoal):
 1. 9363584 Amic 9437056
[PROOF STEP]
have e: "prime (383::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime 383
[PROOF STEP]
by (pratt (code))
[PROOF STATE]
proof (state)
this:
prime 383

goal (1 subgoal):
 1. 9363584 Amic 9437056
[PROOF STEP]
have f: "(3::nat)*(2^7)-1 = 383"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 * 2 ^ 7 - 1 = 383
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
3 * 2 ^ 7 - 1 = 383

goal (1 subgoal):
 1. 9363584 Amic 9437056
[PROOF STEP]
have g: "prime ((3::nat)*(2^7)-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime (3 * 2 ^ 7 - 1)
[PROOF STEP]
using e f
[PROOF STATE]
proof (prove)
using this:
prime 383
3 * 2 ^ 7 - 1 = 383

goal (1 subgoal):
 1. prime (3 * 2 ^ 7 - 1)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
prime (3 * 2 ^ 7 - 1)

goal (1 subgoal):
 1. 9363584 Amic 9437056
[PROOF STEP]
have h: "prime (73727::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime 73727
[PROOF STEP]
by (pratt (code))
[PROOF STATE]
proof (state)
this:
prime 73727

goal (1 subgoal):
 1. 9363584 Amic 9437056
[PROOF STEP]
have i: "(9::nat)*(2^(2*7-1))-1 = 73727"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 9 * 2 ^ (2 * 7 - 1) - 1 = 73727
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
9 * 2 ^ (2 * 7 - 1) - 1 = 73727

goal (1 subgoal):
 1. 9363584 Amic 9437056
[PROOF STEP]
have j: "prime ((9::nat)*(2^(2*7-1))-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime (9 * 2 ^ (2 * 7 - 1) - 1)
[PROOF STEP]
using i h
[PROOF STATE]
proof (prove)
using this:
9 * 2 ^ (2 * 7 - 1) - 1 = 73727
prime 73727

goal (1 subgoal):
 1. prime (9 * 2 ^ (2 * 7 - 1) - 1)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
prime (9 * 2 ^ (2 * 7 - 1) - 1)

goal (1 subgoal):
 1. 9363584 Amic 9437056
[PROOF STEP]
have k: "((2^7)*(3*(2^(7-1))-1)*(3*(2^7)-1))Amic((2^7)*(9*(2^(2*7-1))-1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 ^ 7 * (3 * 2 ^ (7 - 1) - 1) * (3 * 2 ^ 7 - 1)) Amic (2 ^ 7 * (9 * 2 ^ (2 * 7 - 1) - 1))
[PROOF STEP]
using  Thabit_ibn_Qurra_Rule_Amicable a d g j
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 < ?k; prime ?p; prime ?q; prime ?r; ?p = 2 ^ (?k - 1) * 3 - 1; ?q = 2 ^ ?k * 3 - 1; ?r = 2 ^ (2 * ?k - 1) * 9 - 1\<rbrakk> \<Longrightarrow> (2 ^ ?k * ?p * ?q) Amic (2 ^ ?k * ?r)
1 < 7
prime (3 * 2 ^ (7 - 1) - 1)
prime (3 * 2 ^ 7 - 1)
prime (9 * 2 ^ (2 * 7 - 1) - 1)

goal (1 subgoal):
 1. (2 ^ 7 * (3 * 2 ^ (7 - 1) - 1) * (3 * 2 ^ 7 - 1)) Amic (2 ^ 7 * (9 * 2 ^ (2 * 7 - 1) - 1))
[PROOF STEP]
by (metis mult.commute)
[PROOF STATE]
proof (state)
this:
(2 ^ 7 * (3 * 2 ^ (7 - 1) - 1) * (3 * 2 ^ 7 - 1)) Amic (2 ^ 7 * (9 * 2 ^ (2 * 7 - 1) - 1))

goal (1 subgoal):
 1. 9363584 Amic 9437056
[PROOF STEP]
have l: "((2::nat)^7)* 191* 383 = 9363584"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ 7 * 191 * 383 = 9363584
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ 7 * 191 * 383 = 9363584

goal (1 subgoal):
 1. 9363584 Amic 9437056
[PROOF STEP]
have m: "(((2::nat)^7)* 73727) = 9437056"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ 7 * 73727 = 9437056
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ 7 * 73727 = 9437056

goal (1 subgoal):
 1. 9363584 Amic 9437056
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 9363584 Amic 9437056
[PROOF STEP]
using a k l
[PROOF STATE]
proof (prove)
using this:
1 < 7
(2 ^ 7 * (3 * 2 ^ (7 - 1) - 1) * (3 * 2 ^ 7 - 1)) Amic (2 ^ 7 * (9 * 2 ^ (2 * 7 - 1) - 1))
2 ^ 7 * 191 * 383 = 9363584

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem regular_singstr: "regular {[a]}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. regular {[a]}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. regular {[a]}
[PROOF STEP]
let ?N = "\<lparr>states = {0,1}, init = {0}, final = {1},
             nxt = \<lambda>q x. if q=0 \<and> x=a then {1} else {},
             eps = {}\<rparr>"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. regular {[a]}
[PROOF STEP]
interpret N: nfa ?N
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nfa \<lparr>nfa.states = {0, 1}, init = {0}, final = {1}, nxt = \<lambda>q x. if q = 0 \<and> x = a then {1} else {}, eps = {}\<rparr>
[PROOF STEP]
by (auto simp: nfa_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. regular {[a]}
[PROOF STEP]
have [intro]: "\<And>u. 1 \<in> N.nextl {1} u \<Longrightarrow> u = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u. 1 \<in> N.nextl {1} u \<Longrightarrow> u = []
[PROOF STEP]
by (rule list.exhaust) auto
[PROOF STATE]
proof (state)
this:
1 \<in> N.nextl {1} ?u \<Longrightarrow> ?u = []

goal (1 subgoal):
 1. regular {[a]}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
1 \<in> N.nextl {1} ?u \<Longrightarrow> ?u = []

goal (1 subgoal):
 1. regular {[a]}
[PROOF STEP]
fix u
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. regular {[a]}
[PROOF STEP]
have "\<lbrakk>1 \<in> nfa.nextl ?N {0} u\<rbrakk> \<Longrightarrow> u = [a]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<in> N.nextl {0} u \<Longrightarrow> u = [a]
[PROOF STEP]
by (cases u) (auto split: if_split_asm)
[PROOF STATE]
proof (state)
this:
1 \<in> N.nextl {0} u \<Longrightarrow> u = [a]

goal (1 subgoal):
 1. regular {[a]}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
1 \<in> N.nextl {0} ?u2 \<Longrightarrow> ?u2 = [a]

goal (1 subgoal):
 1. regular {[a]}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<in> N.nextl {0} ?u2 \<Longrightarrow> ?u2 = [a]
[PROOF STEP]
have "N.language = {[a]}"
[PROOF STATE]
proof (prove)
using this:
1 \<in> N.nextl {0} ?u2 \<Longrightarrow> ?u2 = [a]

goal (1 subgoal):
 1. N.language = {[a]}
[PROOF STEP]
by (auto simp: N.language_def split: if_split_asm)
[PROOF STATE]
proof (state)
this:
N.language = {[a]}

goal (1 subgoal):
 1. regular {[a]}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
N.language = {[a]}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
N.language = {[a]}

goal (1 subgoal):
 1. regular {[a]}
[PROOF STEP]
by (metis N.imp_regular)
[PROOF STATE]
proof (state)
this:
regular {[a]}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma totient_naive:
  "totient_naive k acc n = card {x \<in> {0<..k}. coprime x n} + acc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient_naive k acc n = card {x \<in> {0<..k}. coprime x n} + acc
[PROOF STEP]
proof (induction k arbitrary: acc)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>acc. totient_naive 0 acc n = card {x \<in> {0<..0}. coprime x n} + acc
 2. \<And>k acc. (\<And>acc. totient_naive k acc n = card {x \<in> {0<..k}. coprime x n} + acc) \<Longrightarrow> totient_naive (Suc k) acc n = card {x \<in> {0<..Suc k}. coprime x n} + acc
[PROOF STEP]
case (Suc k acc)
[PROOF STATE]
proof (state)
this:
totient_naive k ?acc n = card {x \<in> {0<..k}. coprime x n} + ?acc

goal (2 subgoals):
 1. \<And>acc. totient_naive 0 acc n = card {x \<in> {0<..0}. coprime x n} + acc
 2. \<And>k acc. (\<And>acc. totient_naive k acc n = card {x \<in> {0<..k}. coprime x n} + acc) \<Longrightarrow> totient_naive (Suc k) acc n = card {x \<in> {0<..Suc k}. coprime x n} + acc
[PROOF STEP]
have "totient_naive (Suc k) acc n =
          (if coprime (Suc k) n then 1 else 0) + card {x \<in> {0<..k}. coprime x n} + acc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient_naive (Suc k) acc n = (if coprime (Suc k) n then 1 else 0) + card {x \<in> {0<..k}. coprime x n} + acc
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
totient_naive k ?acc n = card {x \<in> {0<..k}. coprime x n} + ?acc

goal (1 subgoal):
 1. totient_naive (Suc k) acc n = (if coprime (Suc k) n then 1 else 0) + card {x \<in> {0<..k}. coprime x n} + acc
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
totient_naive (Suc k) acc n = (if coprime (Suc k) n then 1 else 0) + card {x \<in> {0<..k}. coprime x n} + acc

goal (2 subgoals):
 1. \<And>acc. totient_naive 0 acc n = card {x \<in> {0<..0}. coprime x n} + acc
 2. \<And>k acc. (\<And>acc. totient_naive k acc n = card {x \<in> {0<..k}. coprime x n} + acc) \<Longrightarrow> totient_naive (Suc k) acc n = card {x \<in> {0<..Suc k}. coprime x n} + acc
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
totient_naive (Suc k) acc n = (if coprime (Suc k) n then 1 else 0) + card {x \<in> {0<..k}. coprime x n} + acc

goal (2 subgoals):
 1. \<And>acc. totient_naive 0 acc n = card {x \<in> {0<..0}. coprime x n} + acc
 2. \<And>k acc. (\<And>acc. totient_naive k acc n = card {x \<in> {0<..k}. coprime x n} + acc) \<Longrightarrow> totient_naive (Suc k) acc n = card {x \<in> {0<..Suc k}. coprime x n} + acc
[PROOF STEP]
have "(if coprime (Suc k) n then 1 else 0) =
               card (if coprime (Suc k) n then {Suc k} else {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if coprime (Suc k) n then 1 else 0) = card (if coprime (Suc k) n then {Suc k} else {})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if coprime (Suc k) n then 1 else 0) = card (if coprime (Suc k) n then {Suc k} else {})

goal (2 subgoals):
 1. \<And>acc. totient_naive 0 acc n = card {x \<in> {0<..0}. coprime x n} + acc
 2. \<And>k acc. (\<And>acc. totient_naive k acc n = card {x \<in> {0<..k}. coprime x n} + acc) \<Longrightarrow> totient_naive (Suc k) acc n = card {x \<in> {0<..Suc k}. coprime x n} + acc
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(if coprime (Suc k) n then 1 else 0) = card (if coprime (Suc k) n then {Suc k} else {})

goal (2 subgoals):
 1. \<And>acc. totient_naive 0 acc n = card {x \<in> {0<..0}. coprime x n} + acc
 2. \<And>k acc. (\<And>acc. totient_naive k acc n = card {x \<in> {0<..k}. coprime x n} + acc) \<Longrightarrow> totient_naive (Suc k) acc n = card {x \<in> {0<..Suc k}. coprime x n} + acc
[PROOF STEP]
have "\<dots> + card {x \<in> {0<..k}. coprime x n} =
               card ((if coprime (Suc k) n then {Suc k} else {}) \<union> {x \<in> {0<..k}. coprime x n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (if coprime (Suc k) n then {Suc k} else {}) + card {x \<in> {0<..k}. coprime x n} = card ((if coprime (Suc k) n then {Suc k} else {}) \<union> {x \<in> {0<..k}. coprime x n})
[PROOF STEP]
by (intro card_Un_disjoint [symmetric]) auto
[PROOF STATE]
proof (state)
this:
card (if coprime (Suc k) n then {Suc k} else {}) + card {x \<in> {0<..k}. coprime x n} = card ((if coprime (Suc k) n then {Suc k} else {}) \<union> {x \<in> {0<..k}. coprime x n})

goal (2 subgoals):
 1. \<And>acc. totient_naive 0 acc n = card {x \<in> {0<..0}. coprime x n} + acc
 2. \<And>k acc. (\<And>acc. totient_naive k acc n = card {x \<in> {0<..k}. coprime x n} + acc) \<Longrightarrow> totient_naive (Suc k) acc n = card {x \<in> {0<..Suc k}. coprime x n} + acc
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (if coprime (Suc k) n then {Suc k} else {}) + card {x \<in> {0<..k}. coprime x n} = card ((if coprime (Suc k) n then {Suc k} else {}) \<union> {x \<in> {0<..k}. coprime x n})

goal (2 subgoals):
 1. \<And>acc. totient_naive 0 acc n = card {x \<in> {0<..0}. coprime x n} + acc
 2. \<And>k acc. (\<And>acc. totient_naive k acc n = card {x \<in> {0<..k}. coprime x n} + acc) \<Longrightarrow> totient_naive (Suc k) acc n = card {x \<in> {0<..Suc k}. coprime x n} + acc
[PROOF STEP]
have "((if coprime (Suc k) n then {Suc k} else {}) \<union> {x \<in> {0<..k}. coprime x n}) =
               {x \<in> {0<..Suc k}. coprime x n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if coprime (Suc k) n then {Suc k} else {}) \<union> {x \<in> {0<..k}. coprime x n} = {x \<in> {0<..Suc k}. coprime x n}
[PROOF STEP]
by (auto elim: le_SucE)
[PROOF STATE]
proof (state)
this:
(if coprime (Suc k) n then {Suc k} else {}) \<union> {x \<in> {0<..k}. coprime x n} = {x \<in> {0<..Suc k}. coprime x n}

goal (2 subgoals):
 1. \<And>acc. totient_naive 0 acc n = card {x \<in> {0<..0}. coprime x n} + acc
 2. \<And>k acc. (\<And>acc. totient_naive k acc n = card {x \<in> {0<..k}. coprime x n} + acc) \<Longrightarrow> totient_naive (Suc k) acc n = card {x \<in> {0<..Suc k}. coprime x n} + acc
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
totient_naive (Suc k) acc n = card {x \<in> {0<..Suc k}. coprime x n} + acc
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
totient_naive (Suc k) acc n = card {x \<in> {0<..Suc k}. coprime x n} + acc

goal (1 subgoal):
 1. totient_naive (Suc k) acc n = card {x \<in> {0<..Suc k}. coprime x n} + acc
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
totient_naive (Suc k) acc n = card {x \<in> {0<..Suc k}. coprime x n} + acc

goal (1 subgoal):
 1. \<And>acc. totient_naive 0 acc n = card {x \<in> {0<..0}. coprime x n} + acc
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma hyp_divide_eq_eq [divide_simps]:
  fixes a b c :: "('a :: {inverse, comm_ring_1, division_ring}) hyperdual"
  shows "b / c = a \<longleftrightarrow> (if Base c \<noteq> 0 then b = a * c else a = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b / c = a) = (if Base c \<noteq> (0::'a) then b = a * c else a = 0)
[PROOF STEP]
by (metis hyp_divide_inverse hyp_denominator_eliminate mult_not_zero zero_base_zero_inverse)


[STATEMENT]
lemma int_of_integer_shift: "int_of_integer (drop_bit k n) = (int_of_integer n) div (2 ^ k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int_of_integer (drop_bit k n) = int_of_integer n div 2 ^ k
[PROOF STEP]
by transfer (simp add: int_of_integer_pow shiftr_integer_conv_div_pow2)


[STATEMENT]
lemma vproduct_vsingleton_iff:
  "f \<in>\<^sub>\<circ> (\<Prod>\<^sub>\<circ>i\<in>\<^sub>\<circ>set{c}. A i) \<longleftrightarrow> f\<lparr>c\<rparr> \<in>\<^sub>\<circ> A c \<and> f = set {\<langle>c, f\<lparr>c\<rparr>\<rangle>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in>\<^sub>\<circ> vproduct (set {c}) A) = (f\<lparr>c\<rparr> \<in>\<^sub>\<circ> A c \<and> f = set {\<langle>c, f\<lparr>c\<rparr>\<rangle>})
[PROOF STEP]
by (rule iffI) (auto simp: vproduct_vsingletonD intro!: vproduct_vsingletonI)


[STATEMENT]
lemma simplicial_complex_implies_true:
  assumes "\<sigma> \<in> simplicial_complex_induced_by_monotone_boolean_function n f"
  shows "f (bool_vec_from_simplice \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (bool_vec_from_simplice \<sigma>)
[PROOF STEP]
unfolding bool_vec_from_simplice_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (vec n (\<lambda>i. i \<notin> \<sigma>))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<sigma> \<in> simplicial_complex_induced_by_monotone_boolean_function n f

goal (1 subgoal):
 1. f (vec n (\<lambda>i. i \<notin> \<sigma>))
[PROOF STEP]
unfolding simplicial_complex_induced_by_monotone_boolean_function_def
[PROOF STATE]
proof (prove)
using this:
\<sigma> \<in> {y. \<exists>x. dim_vec x = n \<and> f x \<and> ceros_of_boolean_input x = y}

goal (1 subgoal):
 1. f (vec n (\<lambda>i. i \<notin> \<sigma>))
[PROOF STEP]
unfolding ceros_of_boolean_input_def
[PROOF STATE]
proof (prove)
using this:
\<sigma> \<in> {y. \<exists>x. dim_vec x = n \<and> f x \<and> {xa. xa < dim_vec x \<and> x $ xa = False} = y}

goal (1 subgoal):
 1. f (vec n (\<lambda>i. i \<notin> \<sigma>))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>n = dim_vec x; f x; \<sigma> = {xa. xa < dim_vec x \<and> \<not> x $ xa}\<rbrakk> \<Longrightarrow> f (vec (dim_vec x) (\<lambda>i. i < dim_vec x \<longrightarrow> x $ i))
[PROOF STEP]
by (smt (verit, best) dim_vec eq_vecI index_vec)


[STATEMENT]
lemma acc_le_prodI [intro!]:
  "\<lbrakk> acc r\<^sub>A; acc r\<^sub>B \<rbrakk> \<Longrightarrow> acc(Product.le r\<^sub>A r\<^sub>B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>acc r\<^sub>A; acc r\<^sub>B\<rbrakk> \<Longrightarrow> acc (Product.le r\<^sub>A r\<^sub>B)
[PROOF STEP]
apply (unfold acc_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf {(y, x). x \<sqsubset>\<^bsub>r\<^sub>A\<^esub> y}; wf {(y, x). x \<sqsubset>\<^bsub>r\<^sub>B\<^esub> y}\<rbrakk> \<Longrightarrow> wf {(y, x). x \<sqsubset>\<^bsub>Product.le r\<^sub>A r\<^sub>B\<^esub> y}
[PROOF STEP]
apply (rule wf_subset)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>wf {(y, x). x \<sqsubset>\<^bsub>r\<^sub>A\<^esub> y}; wf {(y, x). x \<sqsubset>\<^bsub>r\<^sub>B\<^esub> y}\<rbrakk> \<Longrightarrow> wf ?r
 2. \<lbrakk>wf {(y, x). x \<sqsubset>\<^bsub>r\<^sub>A\<^esub> y}; wf {(y, x). x \<sqsubset>\<^bsub>r\<^sub>B\<^esub> y}\<rbrakk> \<Longrightarrow> {(y, x). x \<sqsubset>\<^bsub>Product.le r\<^sub>A r\<^sub>B\<^esub> y} \<subseteq> ?r
[PROOF STEP]
apply (erule wf_lex_prod)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. wf {(y, x). x \<sqsubset>\<^bsub>r\<^sub>B\<^esub> y} \<Longrightarrow> wf ?rb3
 2. \<lbrakk>wf {(y, x). x \<sqsubset>\<^bsub>r\<^sub>A\<^esub> y}; wf {(y, x). x \<sqsubset>\<^bsub>r\<^sub>B\<^esub> y}\<rbrakk> \<Longrightarrow> {(y, x). x \<sqsubset>\<^bsub>Product.le r\<^sub>A r\<^sub>B\<^esub> y} \<subseteq> {(y, x). x \<sqsubset>\<^bsub>r\<^sub>A\<^esub> y} <*lex*> ?rb3
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf {(y, x). x \<sqsubset>\<^bsub>r\<^sub>A\<^esub> y}; wf {(y, x). x \<sqsubset>\<^bsub>r\<^sub>B\<^esub> y}\<rbrakk> \<Longrightarrow> {(y, x). x \<sqsubset>\<^bsub>Product.le r\<^sub>A r\<^sub>B\<^esub> y} \<subseteq> {(y, x). x \<sqsubset>\<^bsub>r\<^sub>A\<^esub> y} <*lex*> {(y, x). x \<sqsubset>\<^bsub>r\<^sub>B\<^esub> y}
[PROOF STEP]
apply (auto simp add: lesssub_def less_prod_Pair_conv lex_prod_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in Module) invmfun_r_inv:"\<lbrakk>R module N; bijec\<^bsub>M,N\<^esub> f; n \<in> carrier N\<rbrakk> \<Longrightarrow>
                           f ((invmfun R M N f) n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; bijec\<^bsub>M,N\<^esub> f; n \<in> carrier N\<rbrakk> \<Longrightarrow> f (invmfun R M N f n) = n
[PROOF STEP]
apply (frule minjec_inj[of N f])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>R module N; bijec\<^bsub>M,N\<^esub> f; n \<in> carrier N\<rbrakk> \<Longrightarrow> injec\<^bsub>M,N\<^esub> f
 2. \<lbrakk>R module N; bijec\<^bsub>M,N\<^esub> f; n \<in> carrier N; inj_on f (carrier M)\<rbrakk> \<Longrightarrow> f (invmfun R M N f n) = n
[PROOF STEP]
apply (simp add:bijec_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; bijec\<^bsub>M,N\<^esub> f; n \<in> carrier N; inj_on f (carrier M)\<rbrakk> \<Longrightarrow> f (invmfun R M N f n) = n
[PROOF STEP]
apply (unfold bijec_def, frule conjunct2, fold bijec_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; bijec\<^bsub>M,N\<^esub> f; n \<in> carrier N; inj_on f (carrier M); surjec\<^bsub>M,N\<^esub> f\<rbrakk> \<Longrightarrow> f (invmfun R M N f n) = n
[PROOF STEP]
apply (simp add:surjec_def, erule conjE, simp add:surj_to_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; bijec\<^bsub>M,N\<^esub> f; n \<in> carrier N; inj_on f (carrier M); f \<in> aHom M N; f ` carrier M = carrier N\<rbrakk> \<Longrightarrow> f (invmfun R M N f n) = n
[PROOF STEP]
apply (frule sym, thin_tac "f ` carrier M = carrier N", simp,
        thin_tac "carrier N = f ` carrier M")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; bijec\<^bsub>M,N\<^esub> f; n \<in> f ` carrier M; inj_on f (carrier M); f \<in> aHom M N\<rbrakk> \<Longrightarrow> f (invmfun R M N f n) = n
[PROOF STEP]
apply (simp add:image_def, erule bexE, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>R module N; bijec\<^bsub>M,N\<^esub> f; inj_on f (carrier M); f \<in> aHom M N; x \<in> carrier M; n = f x\<rbrakk> \<Longrightarrow> f (invmfun R M N f (f x)) = f x
[PROOF STEP]
apply (simp add:invmfun_l_inv)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nempty_dom: "\<lbrakk>e\<noteq>Map.empty; !!m. m\<in>dom e \<Longrightarrow> P \<rbrakk> \<Longrightarrow> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>e \<noteq> Map.empty; \<And>m. m \<in> dom e \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P
[PROOF STEP]
by (subgoal_tac "dom e \<noteq> {}") (blast, auto)


[STATEMENT]
lemma ln_inj_iff [simp]: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> ln x = ln y \<longleftrightarrow> x = y"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; 0 < y\<rbrakk> \<Longrightarrow> (ln x = ln y) = (x = y)
[PROOF STEP]
by (simp add: order_eq_iff)


[STATEMENT]
lemma Ball_set_table: "(\<forall>(x,y)\<in>set l. P x y) ==> (\<forall>x. \<forall>y. map_of l x = Some y --> P x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>(x, y)\<in>set l. P x y \<Longrightarrow> \<forall>x y. map_of l x = Some y \<longrightarrow> P x y
[PROOF STEP]
by (induct l) auto


[STATEMENT]
lemma empty_set_less_iff [iff]: "{} \<sqsubset> A \<longleftrightarrow> A \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({} \<sqsubset> A) = (A \<noteq> {})
[PROOF STEP]
by(simp add: set_less_def)


[STATEMENT]
lemma exactly_length:
  assumes "exactly x s = Inr (y, r)"
  shows "length s \<ge> length x + length r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length x + length r \<le> length s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length x + length r \<le> length s
[PROOF STEP]
from exactly_result [OF assms]
[PROOF STATE]
proof (chain)
picking this:
\<exists>w. s = x @ w @ r \<and> y = x
[PROOF STEP]
obtain w where "s = x @ w @ r"
[PROOF STATE]
proof (prove)
using this:
\<exists>w. s = x @ w @ r \<and> y = x

goal (1 subgoal):
 1. (\<And>w. s = x @ w @ r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s = x @ w @ r

goal (1 subgoal):
 1. length x + length r \<le> length s
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
s = x @ w @ r

goal (1 subgoal):
 1. length x + length r \<le> length s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length x + length r \<le> length s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matching_sel_alt:
  "matching_sel f
    = (\<forall>x y. (\<exists>e \<in> arcs G. (tail G e) = x \<and> (head G e) = y \<and> f x y = sel e)
          \<or> ((\<nexists>e. e \<in> arcs G \<and> (tail G e) = x \<and> (head G e) = y) \<and> f x y = 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matching_sel f = (\<forall>x y. (\<exists>e\<in>arcs G. tail G e = x \<and> head G e = y \<and> f x y = sel e) \<or> (\<nexists>e. e \<in> arcs G \<and> tail G e = x \<and> head G e = y) \<and> f x y = 1)
[PROOF STEP]
using matching_sel_alt_aux1 matching_sel_alt_aux2
[PROOF STATE]
proof (prove)
using this:
matching_sel ?f \<Longrightarrow> \<forall>x y. (\<exists>e\<in>arcs G. tail G e = x \<and> head G e = y \<and> ?f x y = sel e) \<or> (\<nexists>e. e \<in> arcs G \<and> tail G e = x \<and> head G e = y) \<and> ?f x y = 1
\<forall>x y. (\<exists>e\<in>arcs G. tail G e = x \<and> head G e = y \<and> ?f x y = sel e) \<or> (\<nexists>e. e \<in> arcs G \<and> tail G e = x \<and> head G e = y) \<and> ?f x y = 1 \<Longrightarrow> matching_sel ?f

goal (1 subgoal):
 1. matching_sel f = (\<forall>x y. (\<exists>e\<in>arcs G. tail G e = x \<and> head G e = y \<and> f x y = sel e) \<or> (\<nexists>e. e \<in> arcs G \<and> tail G e = x \<and> head G e = y) \<and> f x y = 1)
[PROOF STEP]
by blast


[STATEMENT]
lemma poincare_collinear_doubleton [simp]:
  assumes "u \<in> unit_disc" "v \<in> unit_disc"
  shows "poincare_collinear {u, v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_collinear {u, v}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc

goal (1 subgoal):
 1. poincare_collinear {u, v}
[PROOF STEP]
using ex_poincare_line_one_point[of u]
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc
\<exists>l. is_poincare_line l \<and> u \<in> circline_set l

goal (1 subgoal):
 1. poincare_collinear {u, v}
[PROOF STEP]
using ex_poincare_line_two_points[of u v]
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc
\<exists>l. is_poincare_line l \<and> u \<in> circline_set l
u \<noteq> v \<Longrightarrow> \<exists>l. is_poincare_line l \<and> u \<in> circline_set l \<and> v \<in> circline_set l

goal (1 subgoal):
 1. poincare_collinear {u, v}
[PROOF STEP]
by (cases "u = v") (simp_all add: poincare_collinear_def)


[STATEMENT]
lemma cosh_eq_iff:
  fixes x y::real
  assumes "x \<ge> 0" "y \<ge> 0"
  shows "cosh x = cosh y \<longleftrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cosh x = cosh y) = (x = y)
[PROOF STEP]
by (simp add: assms(1) assms(2))


[STATEMENT]
lemma "((P --> (Q | (Q-->R))) --> R) --> R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((P \<longrightarrow> Q \<or> (Q \<longrightarrow> R)) \<longrightarrow> R) \<longrightarrow> R
[PROOF STEP]
by iprover


[STATEMENT]
lemma (in CRR_market_viable) put_effect_compute:
shows "(\<Sum> w\<in> range (pseudo_proj_True matur). (prod (prob_component pr w) {0..<matur}) *
      (discounted_value r (\<lambda>m. (put_option matur K)) matur w)) =
      (\<Sum> y\<in> (gener_bool_list matur). lprob_comp pr y * (det_discount r matur) *
      (max (K - (lgeom_proc u d init (take matur y))) 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>w\<in>range (pseudo_proj_True matur). prod (prob_component pr w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w) = (\<Sum>y\<in>gener_bool_list matur. lprob_comp pr y * det_discount r matur * max (K - lgeom_proc u d init (take matur y)) 0)
[PROOF STEP]
proof (rule pseudo_range_stake)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>w. prod (prob_component pr w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w = lprob_comp pr (stake matur w) * det_discount r matur * max (K - lgeom_proc u d init (take matur (stake matur w))) 0
[PROOF STEP]
fix w
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>w. prod (prob_component pr w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w = lprob_comp pr (stake matur w) * det_discount r matur * max (K - lgeom_proc u d init (take matur (stake matur w))) 0
[PROOF STEP]
have "prod (prob_component pr w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w =
    lprob_comp pr (stake matur w) * discounted_value r (\<lambda>m. put_option matur K) matur w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod (prob_component pr w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w = lprob_comp pr (stake matur w) * discounted_value r (\<lambda>m. put_option matur K) matur w
[PROOF STEP]
using lprob_comp_stake
[PROOF STATE]
proof (prove)
using this:
prod (prob_component ?pr ?w) {0..<?matur} = lprob_comp ?pr (stake ?matur ?w)

goal (1 subgoal):
 1. prod (prob_component pr w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w = lprob_comp pr (stake matur w) * discounted_value r (\<lambda>m. put_option matur K) matur w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prod (prob_component pr w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w = lprob_comp pr (stake matur w) * discounted_value r (\<lambda>m. put_option matur K) matur w

goal (1 subgoal):
 1. \<And>w. prod (prob_component pr w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w = lprob_comp pr (stake matur w) * det_discount r matur * max (K - lgeom_proc u d init (take matur (stake matur w))) 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod (prob_component pr w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w = lprob_comp pr (stake matur w) * discounted_value r (\<lambda>m. put_option matur K) matur w

goal (1 subgoal):
 1. \<And>w. prod (prob_component pr w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w = lprob_comp pr (stake matur w) * det_discount r matur * max (K - lgeom_proc u d init (take matur (stake matur w))) 0
[PROOF STEP]
have "... = lprob_comp pr (stake matur w) *
    (det_discount r matur) * (max (K - (lgeom_proc u d init (take matur (stake matur w)))) 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lprob_comp pr (stake matur w) * discounted_value r (\<lambda>m. put_option matur K) matur w = lprob_comp pr (stake matur w) * det_discount r matur * max (K - lgeom_proc u d init (take matur (stake matur w))) 0
[PROOF STEP]
using disc_put_option_lgeom[of matur K]
[PROOF STATE]
proof (prove)
using this:
discounted_value r (\<lambda>m. put_option matur K) matur ?w = det_discount r matur * max (K - lgeom_proc u d init (stake matur ?w)) 0

goal (1 subgoal):
 1. lprob_comp pr (stake matur w) * discounted_value r (\<lambda>m. put_option matur K) matur w = lprob_comp pr (stake matur w) * det_discount r matur * max (K - lgeom_proc u d init (take matur (stake matur w))) 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lprob_comp pr (stake matur w) * discounted_value r (\<lambda>m. put_option matur K) matur w = lprob_comp pr (stake matur w) * det_discount r matur * max (K - lgeom_proc u d init (take matur (stake matur w))) 0

goal (1 subgoal):
 1. \<And>w. prod (prob_component pr w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w = lprob_comp pr (stake matur w) * det_discount r matur * max (K - lgeom_proc u d init (take matur (stake matur w))) 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prod (prob_component pr w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w = lprob_comp pr (stake matur w) * det_discount r matur * max (K - lgeom_proc u d init (take matur (stake matur w))) 0
[PROOF STEP]
show "prod (prob_component pr w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w =
    lprob_comp pr (stake matur w) *
    (det_discount r matur) * (max (K - (lgeom_proc u d init (take matur (stake matur w)))) 0)"
[PROOF STATE]
proof (prove)
using this:
prod (prob_component pr w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w = lprob_comp pr (stake matur w) * det_discount r matur * max (K - lgeom_proc u d init (take matur (stake matur w))) 0

goal (1 subgoal):
 1. prod (prob_component pr w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w = lprob_comp pr (stake matur w) * det_discount r matur * max (K - lgeom_proc u d init (take matur (stake matur w))) 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
prod (prob_component pr w) {0..<matur} * discounted_value r (\<lambda>m. put_option matur K) matur w = lprob_comp pr (stake matur w) * det_discount r matur * max (K - lgeom_proc u d init (take matur (stake matur w))) 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma equal_3: "equal_3 x y = (real_of_3 x = real_of_3 y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. equal_3 x y = (real_of_3 x = real_of_3 y)
[PROOF STEP]
by (transfer, auto)


[STATEMENT]
theorem stern_brocot_rationals:
  "\<lbrakk> m > 0; n > 0 \<rbrakk> \<Longrightarrow>
  root (traverse_tree (mk_path m n) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int m) (int n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; 0 < n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path m n) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int m) (int n)
[PROOF STEP]
proof(induction m n rule: mk_path_induct)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>m n. \<lbrakk>m = n; 0 < Suc m; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))
 2. \<And>m n. \<lbrakk>m < n; \<lbrakk>0 < Suc m; 0 < n - m\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (n - m)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (n - m)); 0 < Suc m; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))
 3. \<And>m n. \<lbrakk>n < m; \<lbrakk>0 < m - n; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (m - n) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (m - n)) (int (Suc n)); 0 < Suc m; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))
 4. \<And>uu_. \<lbrakk>0 < 0; 0 < uu_\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path 0 uu_) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int 0) (int uu_)
 5. \<And>uv_. \<lbrakk>0 < uv_; 0 < 0\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path uv_ 0) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int uv_) (int 0)
[PROOF STEP]
case (less m n)
[PROOF STATE]
proof (state)
this:
m < n
\<lbrakk>0 < Suc m; 0 < n - m\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (n - m)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (n - m))
0 < Suc m
0 < Suc n

goal (5 subgoals):
 1. \<And>m n. \<lbrakk>m = n; 0 < Suc m; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))
 2. \<And>m n. \<lbrakk>m < n; \<lbrakk>0 < Suc m; 0 < n - m\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (n - m)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (n - m)); 0 < Suc m; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))
 3. \<And>m n. \<lbrakk>n < m; \<lbrakk>0 < m - n; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (m - n) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (m - n)) (int (Suc n)); 0 < Suc m; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))
 4. \<And>uu_. \<lbrakk>0 < 0; 0 < uu_\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path 0 uu_) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int 0) (int uu_)
 5. \<And>uv_. \<lbrakk>0 < uv_; 0 < 0\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path uv_ 0) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int uv_) (int 0)
[PROOF STEP]
with stern_brocot_denominator_non_zero[where path="mk_path (Suc m) (n - m)"]
[PROOF STATE]
proof (chain)
picking this:
case root (traverse_tree (mk_path (Suc m) (n - m)) stern_brocot_recurse) of (m, n) \<Rightarrow> 0 < m \<and> 0 < n
m < n
\<lbrakk>0 < Suc m; 0 < n - m\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (n - m)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (n - m))
0 < Suc m
0 < Suc n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
case root (traverse_tree (mk_path (Suc m) (n - m)) stern_brocot_recurse) of (m, n) \<Rightarrow> 0 < m \<and> 0 < n
m < n
\<lbrakk>0 < Suc m; 0 < n - m\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (n - m)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (n - m))
0 < Suc m
0 < Suc n

goal (1 subgoal):
 1. root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))
[PROOF STEP]
by (simp add: eq_rat field_simps of_nat_diff split: prod.split_asm)
[PROOF STATE]
proof (state)
this:
root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))

goal (4 subgoals):
 1. \<And>m n. \<lbrakk>m = n; 0 < Suc m; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))
 2. \<And>m n. \<lbrakk>n < m; \<lbrakk>0 < m - n; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (m - n) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (m - n)) (int (Suc n)); 0 < Suc m; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))
 3. \<And>uu_. \<lbrakk>0 < 0; 0 < uu_\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path 0 uu_) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int 0) (int uu_)
 4. \<And>uv_. \<lbrakk>0 < uv_; 0 < 0\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path uv_ 0) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int uv_) (int 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>m n. \<lbrakk>m = n; 0 < Suc m; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))
 2. \<And>m n. \<lbrakk>n < m; \<lbrakk>0 < m - n; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (m - n) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (m - n)) (int (Suc n)); 0 < Suc m; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))
 3. \<And>uu_. \<lbrakk>0 < 0; 0 < uu_\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path 0 uu_) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int 0) (int uu_)
 4. \<And>uv_. \<lbrakk>0 < uv_; 0 < 0\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path uv_ 0) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int uv_) (int 0)
[PROOF STEP]
case (greater m n)
[PROOF STATE]
proof (state)
this:
n < m
\<lbrakk>0 < m - n; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (m - n) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (m - n)) (int (Suc n))
0 < Suc m
0 < Suc n

goal (4 subgoals):
 1. \<And>m n. \<lbrakk>m = n; 0 < Suc m; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))
 2. \<And>m n. \<lbrakk>n < m; \<lbrakk>0 < m - n; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (m - n) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (m - n)) (int (Suc n)); 0 < Suc m; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))
 3. \<And>uu_. \<lbrakk>0 < 0; 0 < uu_\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path 0 uu_) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int 0) (int uu_)
 4. \<And>uv_. \<lbrakk>0 < uv_; 0 < 0\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path uv_ 0) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int uv_) (int 0)
[PROOF STEP]
with stern_brocot_denominator_non_zero[where path="mk_path (m - n) (Suc n)"]
[PROOF STATE]
proof (chain)
picking this:
case root (traverse_tree (mk_path (m - n) (Suc n)) stern_brocot_recurse) of (m, n) \<Rightarrow> 0 < m \<and> 0 < n
n < m
\<lbrakk>0 < m - n; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (m - n) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (m - n)) (int (Suc n))
0 < Suc m
0 < Suc n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
case root (traverse_tree (mk_path (m - n) (Suc n)) stern_brocot_recurse) of (m, n) \<Rightarrow> 0 < m \<and> 0 < n
n < m
\<lbrakk>0 < m - n; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (m - n) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (m - n)) (int (Suc n))
0 < Suc m
0 < Suc n

goal (1 subgoal):
 1. root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))
[PROOF STEP]
by (simp add: eq_rat field_simps of_nat_diff split: prod.split_asm)
[PROOF STATE]
proof (state)
this:
root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))

goal (3 subgoals):
 1. \<And>m n. \<lbrakk>m = n; 0 < Suc m; 0 < Suc n\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path (Suc m) (Suc n)) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int (Suc m)) (int (Suc n))
 2. \<And>uu_. \<lbrakk>0 < 0; 0 < uu_\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path 0 uu_) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int 0) (int uu_)
 3. \<And>uv_. \<lbrakk>0 < uv_; 0 < 0\<rbrakk> \<Longrightarrow> root (traverse_tree (mk_path uv_ 0) (pure rat_of \<diamondop> stern_brocot_recurse)) = Fract (int uv_) (int 0)
[PROOF STEP]
qed (simp_all add: eq_rat)


[STATEMENT]
lemma subst_cls_empty_iff[simp]: "C \<cdot> \<eta> = {#} \<longleftrightarrow> C = {#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (C \<cdot> \<eta> = {#}) = (C = {#})
[PROOF STEP]
unfolding subst_cls_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({#A \<cdot>l \<eta>. A \<in># C#} = {#}) = (C = {#})
[PROOF STEP]
by auto


[STATEMENT]
lemma arccos_lbound_abs [simp]:
  "\<bar>y\<bar> \<le> 1 \<Longrightarrow> 0 \<le> arccos y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>y\<bar> \<le> 1 \<Longrightarrow> 0 \<le> arccos y
[PROOF STEP]
by (simp add: arccos_lbound)


[STATEMENT]
lemma continuous_on_power' [continuous_intros]:
  fixes f :: "_ \<Rightarrow> 'b::topological_monoid_mult"
  shows "continuous_on A f \<Longrightarrow> continuous_on A g \<Longrightarrow> continuous_on A (\<lambda>x. f x ^ g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on A f; continuous_on A g\<rbrakk> \<Longrightarrow> continuous_on A (\<lambda>x. f x ^ g x)
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>A. (f \<longlongrightarrow> f x) (at x within A); \<forall>x\<in>A. (g \<longlongrightarrow> g x) (at x within A)\<rbrakk> \<Longrightarrow> \<forall>x\<in>A. ((\<lambda>x. f x ^ g x) \<longlongrightarrow> f x ^ g x) (at x within A)
[PROOF STEP]
by (auto intro: tendsto_power_strong)


[STATEMENT]
lemma erf_remainder_integral_conv_Suc:
  assumes "x > 0"
  shows   "erf_remainder_integral n x = exp (-x\<^sup>2) / (2*x^(2*n+1)) -
             real (2*n+1) / 2 * erf_remainder_integral (Suc n) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. erf_remainder_integral n x = exp (- x\<^sup>2) / (2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. erf_remainder_integral n x = exp (- x\<^sup>2) / (2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
[PROOF STEP]
let ?A = "\<lambda>m. {x..x + real m}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. erf_remainder_integral n x = exp (- x\<^sup>2) / (2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
[PROOF STEP]
let ?J = "\<lambda>m n. integral {x..x+real m} (\<lambda>t. exp(-t\<^sup>2) / t ^ (2*n))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. erf_remainder_integral n x = exp (- x\<^sup>2) / (2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
[PROOF STEP]
define I where
    "I = (\<lambda>m. exp (- (x + real m)\<^sup>2) / (- 2 * (x + real m) ^ (2 * n + 1)) -
              exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - real (2*n+1)/2 * ?J m (Suc n))"
[PROOF STATE]
proof (state)
this:
I = (\<lambda>m. exp (- (x + real m)\<^sup>2) / (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * Suc n)))

goal (1 subgoal):
 1. erf_remainder_integral n x = exp (- x\<^sup>2) / (2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
[PROOF STEP]
have I_eq: "I = (\<lambda>m. integral (?A m) (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I = (\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n)))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. I m = integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))
[PROOF STEP]
fix m :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. I m = integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))
[PROOF STEP]
have "((\<lambda>t. (-2*t*exp (-(t^2))) * inverse (-2*t^(2*n+1))) has_integral I m) (?A m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. - 2 * t * exp (- t\<^sup>2) * inverse (- 2 * t ^ (2 * n + 1))) has_integral I m) {x..x + real m}
[PROOF STEP]
proof (rule integration_by_parts[OF bounded_bilinear_mult])
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. x \<le> x + real m
 2. continuous_on {x..x + real m} ?f
 3. continuous_on {x..x + real m} (\<lambda>x. inverse (- 2 * x ^ (2 * n + 1)))
 4. \<And>t. t \<in> {x..x + real m} \<Longrightarrow> (?f has_vector_derivative - 2 * t * exp (- t\<^sup>2)) (at t)
 5. \<And>t. t \<in> {x..x + real m} \<Longrightarrow> ((\<lambda>x. inverse (- 2 * x ^ (2 * n + 1))) has_vector_derivative ?g' t) (at t)
 6. ((\<lambda>t. ?f t * ?g' t) has_integral ?f (x + real m) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - ?f x * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}
[PROOF STEP]
fix t
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. x \<le> x + real m
 2. continuous_on {x..x + real m} ?f
 3. continuous_on {x..x + real m} (\<lambda>x. inverse (- 2 * x ^ (2 * n + 1)))
 4. \<And>t. t \<in> {x..x + real m} \<Longrightarrow> (?f has_vector_derivative - 2 * t * exp (- t\<^sup>2)) (at t)
 5. \<And>t. t \<in> {x..x + real m} \<Longrightarrow> ((\<lambda>x. inverse (- 2 * x ^ (2 * n + 1))) has_vector_derivative ?g' t) (at t)
 6. ((\<lambda>t. ?f t * ?g' t) has_integral ?f (x + real m) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - ?f x * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}
[PROOF STEP]
assume t: "t \<in> ?A m"
[PROOF STATE]
proof (state)
this:
t \<in> {x..x + real m}

goal (6 subgoals):
 1. x \<le> x + real m
 2. continuous_on {x..x + real m} ?f
 3. continuous_on {x..x + real m} (\<lambda>x. inverse (- 2 * x ^ (2 * n + 1)))
 4. \<And>t. t \<in> {x..x + real m} \<Longrightarrow> (?f has_vector_derivative - 2 * t * exp (- t\<^sup>2)) (at t)
 5. \<And>t. t \<in> {x..x + real m} \<Longrightarrow> ((\<lambda>x. inverse (- 2 * x ^ (2 * n + 1))) has_vector_derivative ?g' t) (at t)
 6. ((\<lambda>t. ?f t * ?g' t) has_integral ?f (x + real m) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - ?f x * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 < x
t \<in> {x..x + real m}
[PROOF STEP]
show "((\<lambda>t. exp (-(t^2))) has_vector_derivative -2*t*exp (-(t^2))) (at t)"
[PROOF STATE]
proof (prove)
using this:
0 < x
t \<in> {x..x + real m}

goal (1 subgoal):
 1. ((\<lambda>t. exp (- t\<^sup>2)) has_vector_derivative - 2 * t * exp (- t\<^sup>2)) (at t)
[PROOF STEP]
by (auto simp: has_real_derivative_iff_has_vector_derivative [symmetric]
                       field_simps intro!: derivative_eq_intros)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. exp (- t\<^sup>2)) has_vector_derivative - 2 * t * exp (- t\<^sup>2)) (at t)

goal (5 subgoals):
 1. x \<le> x + real m
 2. continuous_on {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))
 3. continuous_on {x..x + real m} (\<lambda>x. inverse (- 2 * x ^ (2 * n + 1)))
 4. \<And>t. t \<in> {x..x + real m} \<Longrightarrow> ((\<lambda>x. inverse (- 2 * x ^ (2 * n + 1))) has_vector_derivative ?g' t) (at t)
 5. ((\<lambda>t. exp (- t\<^sup>2) * ?g' t) has_integral exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}
[PROOF STEP]
from assms t
[PROOF STATE]
proof (chain)
picking this:
0 < x
t \<in> {x..x + real m}
[PROOF STEP]
have "((\<lambda>t. -(1/2) * t powr (-2*n-1)) has_field_derivative
                           (2*n+1)/2 * t powr (-2*n-2)) (at t)"
[PROOF STATE]
proof (prove)
using this:
0 < x
t \<in> {x..x + real m}

goal (1 subgoal):
 1. ((\<lambda>t. - (1 / 2) * t powr real_of_int (- 2 * int n - 1)) has_real_derivative real (2 * n + 1) / 2 * t powr real_of_int (- 2 * int n - 2)) (at t)
[PROOF STEP]
by (auto intro!: derivative_eq_intros simp: field_simps powr_numeral power2_eq_square
                         powr_minus powr_divide [symmetric] powr_add)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. - (1 / 2) * t powr real_of_int (- 2 * int n - 1)) has_real_derivative real (2 * n + 1) / 2 * t powr real_of_int (- 2 * int n - 2)) (at t)

goal (5 subgoals):
 1. x \<le> x + real m
 2. continuous_on {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))
 3. continuous_on {x..x + real m} (\<lambda>x. inverse (- 2 * x ^ (2 * n + 1)))
 4. \<And>t. t \<in> {x..x + real m} \<Longrightarrow> ((\<lambda>x. inverse (- 2 * x ^ (2 * n + 1))) has_vector_derivative ?g' t) (at t)
 5. ((\<lambda>t. exp (- t\<^sup>2) * ?g' t) has_integral exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>t. - (1 / 2) * t powr real_of_int (- 2 * int n - 1)) has_real_derivative real (2 * n + 1) / 2 * t powr real_of_int (- 2 * int n - 2)) (at t)

goal (5 subgoals):
 1. x \<le> x + real m
 2. continuous_on {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))
 3. continuous_on {x..x + real m} (\<lambda>x. inverse (- 2 * x ^ (2 * n + 1)))
 4. \<And>t. t \<in> {x..x + real m} \<Longrightarrow> ((\<lambda>x. inverse (- 2 * x ^ (2 * n + 1))) has_vector_derivative ?g' t) (at t)
 5. ((\<lambda>t. exp (- t\<^sup>2) * ?g' t) has_integral exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}
[PROOF STEP]
have "?this \<longleftrightarrow> ((\<lambda>t. inverse (-2*t^(2*n+1))) has_field_derivative
                              (2*n+1)/2 / t ^ (2*Suc n)) (at t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. - (1 / 2) * t powr real_of_int (- 2 * int n - 1)) has_real_derivative real (2 * n + 1) / 2 * t powr real_of_int (- 2 * int n - 2)) (at t) = ((\<lambda>t. inverse (- 2 * t ^ (2 * n + 1))) has_real_derivative real (2 * n + 1) / 2 / t ^ (2 * Suc n)) (at t)
[PROOF STEP]
using t
[PROOF STATE]
proof (prove)
using this:
t \<in> {x..x + real m}

goal (1 subgoal):
 1. ((\<lambda>t. - (1 / 2) * t powr real_of_int (- 2 * int n - 1)) has_real_derivative real (2 * n + 1) / 2 * t powr real_of_int (- 2 * int n - 2)) (at t) = ((\<lambda>t. inverse (- 2 * t ^ (2 * n + 1))) has_real_derivative real (2 * n + 1) / 2 / t ^ (2 * Suc n)) (at t)
[PROOF STEP]
using eventually_nhds_in_open[of "{0<..}" t] assms
[PROOF STATE]
proof (prove)
using this:
t \<in> {x..x + real m}
\<lbrakk>open {0<..}; t \<in> {0<..}\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F y in nhds t. y \<in> {0<..}
0 < x

goal (1 subgoal):
 1. ((\<lambda>t. - (1 / 2) * t powr real_of_int (- 2 * int n - 1)) has_real_derivative real (2 * n + 1) / 2 * t powr real_of_int (- 2 * int n - 2)) (at t) = ((\<lambda>t. inverse (- 2 * t ^ (2 * n + 1))) has_real_derivative real (2 * n + 1) / 2 / t ^ (2 * Suc n)) (at t)
[PROOF STEP]
by (intro DERIV_cong_ev refl)
           (auto elim!: eventually_mono simp: powr_minus field_simps powr_diff
                        powr_realpow power2_eq_square intro!: real_powr_eq_powerI)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. - (1 / 2) * t powr real_of_int (- 2 * int n - 1)) has_real_derivative real (2 * n + 1) / 2 * t powr real_of_int (- 2 * int n - 2)) (at t) = ((\<lambda>t. inverse (- 2 * t ^ (2 * n + 1))) has_real_derivative real (2 * n + 1) / 2 / t ^ (2 * Suc n)) (at t)

goal (5 subgoals):
 1. x \<le> x + real m
 2. continuous_on {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))
 3. continuous_on {x..x + real m} (\<lambda>x. inverse (- 2 * x ^ (2 * n + 1)))
 4. \<And>t. t \<in> {x..x + real m} \<Longrightarrow> ((\<lambda>x. inverse (- 2 * x ^ (2 * n + 1))) has_vector_derivative ?g' t) (at t)
 5. ((\<lambda>t. exp (- t\<^sup>2) * ?g' t) has_integral exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>t. inverse (- 2 * t ^ (2 * n + 1))) has_real_derivative real (2 * n + 1) / 2 / t ^ (2 * Suc n)) (at t)
[PROOF STEP]
show "((\<lambda>t. inverse (-2*t^(2*n+1))) has_vector_derivative
                              (2*n+1)/2 / t ^ (2*Suc n)) (at t)"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>t. inverse (- 2 * t ^ (2 * n + 1))) has_real_derivative real (2 * n + 1) / 2 / t ^ (2 * Suc n)) (at t)

goal (1 subgoal):
 1. ((\<lambda>t. inverse (- 2 * t ^ (2 * n + 1))) has_vector_derivative real (2 * n + 1) / 2 / t ^ (2 * Suc n)) (at t)
[PROOF STEP]
by (simp add: has_real_derivative_iff_has_vector_derivative)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. inverse (- 2 * t ^ (2 * n + 1))) has_vector_derivative real (2 * n + 1) / 2 / t ^ (2 * Suc n)) (at t)

goal (4 subgoals):
 1. x \<le> x + real m
 2. continuous_on {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))
 3. continuous_on {x..x + real m} (\<lambda>x. inverse (- 2 * x ^ (2 * n + 1)))
 4. ((\<lambda>t. exp (- t\<^sup>2) * (real (2 * n + 1) / 2 / t ^ (2 * Suc n))) has_integral exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. x \<le> x + real m
 2. continuous_on {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))
 3. continuous_on {x..x + real m} (\<lambda>x. inverse (- 2 * x ^ (2 * n + 1)))
 4. ((\<lambda>t. exp (- t\<^sup>2) * (real (2 * n + 1) / 2 / t ^ (2 * Suc n))) has_integral exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}
[PROOF STEP]
have "((\<lambda>t. real (2*n+1)/2 * (exp (- t\<^sup>2) / t ^ (2 * Suc n))) has_integral
             real (2*n+1)/2 * ?J m (Suc n)) (?A m)" (is "(?f has_integral ?a) _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. real (2 * n + 1) / 2 * (exp (- t\<^sup>2) / t ^ (2 * Suc n))) has_integral real (2 * n + 1) / 2 * integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * Suc n))) {x..x + real m}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. ((\<lambda>t. real (2 * n + 1) / 2 * (exp (- t\<^sup>2) / t ^ (2 * Suc n))) has_integral real (2 * n + 1) / 2 * integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * Suc n))) {x..x + real m}
[PROOF STEP]
by (intro has_integral_mult_right integrable_integral integrable_continuous_real)
           (auto intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. real (2 * n + 1) / 2 * (exp (- t\<^sup>2) / t ^ (2 * Suc n))) has_integral real (2 * n + 1) / 2 * integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * Suc n))) {x..x + real m}

goal (4 subgoals):
 1. x \<le> x + real m
 2. continuous_on {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))
 3. continuous_on {x..x + real m} (\<lambda>x. inverse (- 2 * x ^ (2 * n + 1)))
 4. ((\<lambda>t. exp (- t\<^sup>2) * (real (2 * n + 1) / 2 / t ^ (2 * Suc n))) has_integral exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>t. real (2 * n + 1) / 2 * (exp (- t\<^sup>2) / t ^ (2 * Suc n))) has_integral real (2 * n + 1) / 2 * integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * Suc n))) {x..x + real m}

goal (4 subgoals):
 1. x \<le> x + real m
 2. continuous_on {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))
 3. continuous_on {x..x + real m} (\<lambda>x. inverse (- 2 * x ^ (2 * n + 1)))
 4. ((\<lambda>t. exp (- t\<^sup>2) * (real (2 * n + 1) / 2 / t ^ (2 * Suc n))) has_integral exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}
[PROOF STEP]
have "?f = (\<lambda>t. exp (- t\<^sup>2) * (real (2 * n + 1) / 2 / t ^ (2 * Suc n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>t. real (2 * n + 1) / 2 * (exp (- t\<^sup>2) / t ^ (2 * Suc n))) = (\<lambda>t. exp (- t\<^sup>2) * (real (2 * n + 1) / 2 / t ^ (2 * Suc n)))
[PROOF STEP]
by (simp add: fun_eq_iff field_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>t. real (2 * n + 1) / 2 * (exp (- t\<^sup>2) / t ^ (2 * Suc n))) = (\<lambda>t. exp (- t\<^sup>2) * (real (2 * n + 1) / 2 / t ^ (2 * Suc n)))

goal (4 subgoals):
 1. x \<le> x + real m
 2. continuous_on {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))
 3. continuous_on {x..x + real m} (\<lambda>x. inverse (- 2 * x ^ (2 * n + 1)))
 4. ((\<lambda>t. exp (- t\<^sup>2) * (real (2 * n + 1) / 2 / t ^ (2 * Suc n))) has_integral exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>t. real (2 * n + 1) / 2 * (exp (- t\<^sup>2) / t ^ (2 * Suc n))) = (\<lambda>t. exp (- t\<^sup>2) * (real (2 * n + 1) / 2 / t ^ (2 * Suc n)))

goal (4 subgoals):
 1. x \<le> x + real m
 2. continuous_on {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))
 3. continuous_on {x..x + real m} (\<lambda>x. inverse (- 2 * x ^ (2 * n + 1)))
 4. ((\<lambda>t. exp (- t\<^sup>2) * (real (2 * n + 1) / 2 / t ^ (2 * Suc n))) has_integral exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}
[PROOF STEP]
have "?a = exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) -
                          exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (2 * n + 1) / 2 * integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * Suc n)) = exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. real (2 * n + 1) / 2 * integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * Suc n)) = exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m
[PROOF STEP]
by (simp add: I_def algebra_simps inverse_eq_divide)
[PROOF STATE]
proof (state)
this:
real (2 * n + 1) / 2 * integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * Suc n)) = exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m

goal (4 subgoals):
 1. x \<le> x + real m
 2. continuous_on {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))
 3. continuous_on {x..x + real m} (\<lambda>x. inverse (- 2 * x ^ (2 * n + 1)))
 4. ((\<lambda>t. exp (- t\<^sup>2) * (real (2 * n + 1) / 2 / t ^ (2 * Suc n))) has_integral exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>t. exp (- t\<^sup>2) * (real (2 * n + 1) / 2 / t ^ (2 * Suc n))) has_integral exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}
[PROOF STEP]
show "((\<lambda>t. exp (- t\<^sup>2) * (real (2 * n + 1) / 2 / t ^ (2 * Suc n))) has_integral \<dots>)
                      {x..x + real m}"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>t. exp (- t\<^sup>2) * (real (2 * n + 1) / 2 / t ^ (2 * Suc n))) has_integral exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}

goal (1 subgoal):
 1. ((\<lambda>t. exp (- t\<^sup>2) * (real (2 * n + 1) / 2 / t ^ (2 * Suc n))) has_integral exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>t. exp (- t\<^sup>2) * (real (2 * n + 1) / 2 / t ^ (2 * Suc n))) has_integral exp (- (x + real m)\<^sup>2) * inverse (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - I m) {x..x + real m}

goal (3 subgoals):
 1. x \<le> x + real m
 2. continuous_on {x..x + real m} (\<lambda>t. exp (- t\<^sup>2))
 3. continuous_on {x..x + real m} (\<lambda>x. inverse (- 2 * x ^ (2 * n + 1)))
[PROOF STEP]
qed (insert assms, auto intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. - 2 * t * exp (- t\<^sup>2) * inverse (- 2 * t ^ (2 * n + 1))) has_integral I m) {x..x + real m}

goal (1 subgoal):
 1. \<And>m. I m = integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))
[PROOF STEP]
hence "I m = integral {x..x + real m} (\<lambda>t. - 2*t*exp (- t\<^sup>2) * inverse (-2*t^(2 * n + 1)))"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>t. - 2 * t * exp (- t\<^sup>2) * inverse (- 2 * t ^ (2 * n + 1))) has_integral I m) {x..x + real m}

goal (1 subgoal):
 1. I m = integral {x..x + real m} (\<lambda>t. - 2 * t * exp (- t\<^sup>2) * inverse (- 2 * t ^ (2 * n + 1)))
[PROOF STEP]
by (simp add: has_integral_iff)
[PROOF STATE]
proof (state)
this:
I m = integral {x..x + real m} (\<lambda>t. - 2 * t * exp (- t\<^sup>2) * inverse (- 2 * t ^ (2 * n + 1)))

goal (1 subgoal):
 1. \<And>m. I m = integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
I m = integral {x..x + real m} (\<lambda>t. - 2 * t * exp (- t\<^sup>2) * inverse (- 2 * t ^ (2 * n + 1)))

goal (1 subgoal):
 1. \<And>m. I m = integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))
[PROOF STEP]
have "\<dots> = integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2*n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {x..x + real m} (\<lambda>t. - 2 * t * exp (- t\<^sup>2) * inverse (- 2 * t ^ (2 * n + 1))) = integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. integral {x..x + real m} (\<lambda>t. - 2 * t * exp (- t\<^sup>2) * inverse (- 2 * t ^ (2 * n + 1))) = integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))
[PROOF STEP]
by (intro integral_cong) (simp_all add: field_simps)
[PROOF STATE]
proof (state)
this:
integral {x..x + real m} (\<lambda>t. - 2 * t * exp (- t\<^sup>2) * inverse (- 2 * t ^ (2 * n + 1))) = integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))

goal (1 subgoal):
 1. \<And>m. I m = integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
I m = integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))
[PROOF STEP]
show "I m = \<dots>"
[PROOF STATE]
proof (prove)
using this:
I m = integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))

goal (1 subgoal):
 1. I m = integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
I m = integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
I = (\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n)))

goal (1 subgoal):
 1. erf_remainder_integral n x = exp (- x\<^sup>2) / (2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
[PROOF STEP]
have "filterlim (\<lambda>m. (-exp (- (x + real m)\<^sup>2)) / (2 * (x + real m) ^ (2 * n + 1)))
          (nhds 0) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. - exp (- (x + real m)\<^sup>2) / (2 * (x + real m) ^ (2 * n + 1))) \<longlonglongrightarrow> 0
[PROOF STEP]
by (rule real_tendsto_divide_at_top filterlim_real_sequentially tendsto_minus
             filterlim_compose[OF exp_at_bot] filterlim_compose[OF filterlim_uminus_at_bot_at_top]
             filterlim_pow_at_top filterlim_tendsto_add_at_top tendsto_const filterlim_ident
             filterlim_tendsto_pos_mult_at_top | simp)+
[PROOF STATE]
proof (state)
this:
(\<lambda>m. - exp (- (x + real m)\<^sup>2) / (2 * (x + real m) ^ (2 * n + 1))) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. erf_remainder_integral n x = exp (- x\<^sup>2) / (2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
[PROOF STEP]
hence *: "filterlim (\<lambda>m. (exp (- (x + real m)\<^sup>2)) / (-2 * (x + real m) ^ (2 * n + 1)))
              (nhds 0) at_top"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>m. - exp (- (x + real m)\<^sup>2) / (2 * (x + real m) ^ (2 * n + 1))) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>m. exp (- (x + real m)\<^sup>2) / (- 2 * (x + real m) ^ (2 * n + 1))) \<longlonglongrightarrow> 0
[PROOF STEP]
by (simp add: add_ac)
[PROOF STATE]
proof (state)
this:
(\<lambda>m. exp (- (x + real m)\<^sup>2) / (- 2 * (x + real m) ^ (2 * n + 1))) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. erf_remainder_integral n x = exp (- x\<^sup>2) / (2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
[PROOF STEP]
have "I \<longlonglongrightarrow> 0 - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) -
                  real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<longlonglongrightarrow> 0 - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
[PROOF STEP]
unfolding I_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. exp (- (x + real m)\<^sup>2) / (- 2 * (x + real m) ^ (2 * n + 1)) - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * Suc n))) \<longlonglongrightarrow> 0 - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
[PROOF STEP]
by (intro tendsto_diff * tendsto_const tendsto_mult LIMSEQ_erf_remainder_integral assms)
[PROOF STATE]
proof (state)
this:
I \<longlonglongrightarrow> 0 - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x

goal (1 subgoal):
 1. erf_remainder_integral n x = exp (- x\<^sup>2) / (2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
I \<longlonglongrightarrow> 0 - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x

goal (1 subgoal):
 1. erf_remainder_integral n x = exp (- x\<^sup>2) / (2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
[PROOF STEP]
from LIMSEQ_erf_remainder_integral[OF assms, of n] I_eq
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))) \<longlonglongrightarrow> erf_remainder_integral n x
I = (\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n)))
[PROOF STEP]
have "I \<longlonglongrightarrow> erf_remainder_integral n x"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n))) \<longlonglongrightarrow> erf_remainder_integral n x
I = (\<lambda>m. integral {x..x + real m} (\<lambda>t. exp (- t\<^sup>2) / t ^ (2 * n)))

goal (1 subgoal):
 1. I \<longlonglongrightarrow> erf_remainder_integral n x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
I \<longlonglongrightarrow> erf_remainder_integral n x

goal (1 subgoal):
 1. erf_remainder_integral n x = exp (- x\<^sup>2) / (2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
I \<longlonglongrightarrow> 0 - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
I \<longlonglongrightarrow> erf_remainder_integral n x
[PROOF STEP]
have "0 - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 *
                     erf_remainder_integral (Suc n) x = erf_remainder_integral n x"
[PROOF STATE]
proof (prove)
using this:
I \<longlonglongrightarrow> 0 - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
I \<longlonglongrightarrow> erf_remainder_integral n x

goal (1 subgoal):
 1. 0 - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x = erf_remainder_integral n x
[PROOF STEP]
by (rule LIMSEQ_unique)
[PROOF STATE]
proof (state)
this:
0 - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x = erf_remainder_integral n x

goal (1 subgoal):
 1. erf_remainder_integral n x = exp (- x\<^sup>2) / (2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 - exp (- x\<^sup>2) * inverse (- 2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x = erf_remainder_integral n x

goal (1 subgoal):
 1. erf_remainder_integral n x = exp (- x\<^sup>2) / (2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
erf_remainder_integral n x = exp (- x\<^sup>2) / (2 * x ^ (2 * n + 1)) - real (2 * n + 1) / 2 * erf_remainder_integral (Suc n) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma minimise_language:
  assumes "observable M"
shows "L (minimise M) = L M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (minimise M) = L M
[PROOF STEP]
using language_equivalence_classes_retain_language_and_induce_minimality(1)[OF minimise_props(5,2,1)[OF assms]  assms]
[PROOF STATE]
proof (prove)
using this:
L M = L (minimise M)

goal (1 subgoal):
 1. L (minimise M) = L M
[PROOF STEP]
by blast


[STATEMENT]
theorem g_step_is_pr: "g_step \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g_step \<in> PrimRec2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. g_step \<in> PrimRec2
[PROOF STEP]
from g_comp_is_pr g_pair_is_pr g_rec_is_pr mod_is_pr c_assoc_have_key_is_pr c_assoc_value_is_pr c_cons_is_pr
[PROOF STATE]
proof (chain)
picking this:
g_comp \<in> PrimRec2
g_pair \<in> PrimRec2
g_rec \<in> PrimRec2
(mod) \<in> PrimRec2
c_assoc_have_key \<in> PrimRec2
c_assoc_value \<in> PrimRec2
c_cons \<in> PrimRec2
[PROOF STEP]
have
    "(\<lambda> ls key. g_step ls key) \<in> PrimRec2"
[PROOF STATE]
proof (prove)
using this:
g_comp \<in> PrimRec2
g_pair \<in> PrimRec2
g_rec \<in> PrimRec2
(mod) \<in> PrimRec2
c_assoc_have_key \<in> PrimRec2
c_assoc_value \<in> PrimRec2
c_cons \<in> PrimRec2

goal (1 subgoal):
 1. g_step \<in> PrimRec2
[PROOF STEP]
unfolding g_step_def Let_def
[PROOF STATE]
proof (prove)
using this:
g_comp \<in> PrimRec2
g_pair \<in> PrimRec2
g_rec \<in> PrimRec2
(mod) \<in> PrimRec2
c_assoc_have_key \<in> PrimRec2
c_assoc_value \<in> PrimRec2
c_cons \<in> PrimRec2

goal (1 subgoal):
 1. (\<lambda>ls key. if c_fst (c_fst key) mod 7 = 0 then c_cons (c_pair key 0) ls else if c_fst (c_fst key) mod 7 = 1 then c_cons (c_pair key (Suc (c_snd key))) ls else if c_fst (c_fst key) mod 7 = 2 then c_cons (c_pair key (c_fst (c_snd key))) ls else if c_fst (c_fst key) mod 7 = 3 then c_cons (c_pair key (c_snd (c_snd key))) ls else if c_fst (c_fst key) mod 7 = 4 then g_comp ls key else if c_fst (c_fst key) mod 7 = 5 then g_pair ls key else if c_fst (c_fst key) mod 7 = 6 then g_rec ls key else ls) \<in> PrimRec2
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
g_step \<in> PrimRec2

goal (1 subgoal):
 1. g_step \<in> PrimRec2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
g_step \<in> PrimRec2

goal (1 subgoal):
 1. g_step \<in> PrimRec2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g_step \<in> PrimRec2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linorder_set_list_bij :
  assumes "\<And> x . x \<in> xs \<Longrightarrow> finite x"
  shows "bij_betw sorted_list_of_set xs (sorted_list_of_set ` xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw sorted_list_of_set xs (sorted_list_of_set ` xs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bij_betw sorted_list_of_set xs (sorted_list_of_set ` xs)
[PROOF STEP]
have "\<And> x . x \<in> xs \<Longrightarrow> set (sorted_list_of_set x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> xs \<Longrightarrow> set (sorted_list_of_set x) = x
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
?x \<in> xs \<Longrightarrow> set (sorted_list_of_set ?x) = ?x

goal (1 subgoal):
 1. bij_betw sorted_list_of_set xs (sorted_list_of_set ` xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> xs \<Longrightarrow> set (sorted_list_of_set ?x) = ?x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?x \<in> xs \<Longrightarrow> set (sorted_list_of_set ?x) = ?x

goal (1 subgoal):
 1. bij_betw sorted_list_of_set xs (sorted_list_of_set ` xs)
[PROOF STEP]
unfolding bij_betw_def inj_on_def
[PROOF STATE]
proof (prove)
using this:
?x \<in> xs \<Longrightarrow> set (sorted_list_of_set ?x) = ?x

goal (1 subgoal):
 1. (\<forall>x\<in>xs. \<forall>y\<in>xs. sorted_list_of_set x = sorted_list_of_set y \<longrightarrow> x = y) \<and> sorted_list_of_set ` xs = sorted_list_of_set ` xs
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
bij_betw sorted_list_of_set xs (sorted_list_of_set ` xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma snd_set_prevs:
  "snd ` (set_prevs base tail n) = (\<lambda>as. foldr f as base) ` { as. subseq_of_length n tail as }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd ` set_prevs base tail n = (\<lambda>as. foldr f as base) ` {as. subseq_of_length n tail as}
[PROOF STEP]
by (subst subseqs_of_length_of_indices, auto simp: set_prevs_def image_Collect)


[STATEMENT]
lemma paths_le_split_via_eq: "paths_le (Suc k) P = paths_le k P \<union> paths_eq (Suc k) P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. paths_le (Suc k) P = paths_le k P \<union> paths_eq (Suc k) P
[PROOF STEP]
by (auto simp add: paths_le_def paths_eq_def)


[STATEMENT]
lemma fps_shift_fps_shift_reorder:
  "fps_shift m (fps_shift n f) = fps_shift n (fps_shift m f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_shift m (fps_shift n f) = fps_shift n (fps_shift m f)
[PROOF STEP]
using fps_shift_fps_shift[of m n f] fps_shift_fps_shift[of n m f]
[PROOF STATE]
proof (prove)
using this:
fps_shift (m + n) f = fps_shift m (fps_shift n f)
fps_shift (n + m) f = fps_shift n (fps_shift m f)

goal (1 subgoal):
 1. fps_shift m (fps_shift n f) = fps_shift n (fps_shift m f)
[PROOF STEP]
by (simp add: add.commute)


[STATEMENT]
lemma f_compose_smooth_on: "k-smooth_on S (\<lambda>x. f (g x))"
  if "k-smooth_on S g" "open S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k-smooth_on S (\<lambda>x. f (g x))
[PROOF STEP]
using smooth_on_compose[OF f_smooth_on that open_UNIV subset_UNIV]
[PROOF STATE]
proof (prove)
using this:
k-smooth_on S (f \<circ> g)

goal (1 subgoal):
 1. k-smooth_on S (\<lambda>x. f (g x))
[PROOF STEP]
by (auto simp: o_def)


[STATEMENT]
lemma infinite_hatoms: "infinite (UNIV :: ('t atom) set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite UNIV
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite UNIV
[PROOF STEP]
let ?diago = "\<lambda>n. (string_of_nat n,[])"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite UNIV
[PROOF STEP]
let ?undiago = "\<lambda>a. nat_of_string (fst a)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite UNIV
[PROOF STEP]
have "\<forall>n. ?undiago (?diago n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. nat_of_string (fst (string_of_nat n, [])) = n
[PROOF STEP]
using nat_of_string_string_of_nat
[PROOF STATE]
proof (prove)
using this:
nat_of_string (string_of_nat ?n) = ?n

goal (1 subgoal):
 1. \<forall>n. nat_of_string (fst (string_of_nat n, [])) = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>n. nat_of_string (fst (string_of_nat n, [])) = n

goal (1 subgoal):
 1. infinite UNIV
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>n. nat_of_string (fst (string_of_nat n, [])) = n

goal (1 subgoal):
 1. infinite UNIV
[PROOF STEP]
have "\<forall>n. ?diago n \<in> UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. (string_of_nat n, []) \<in> UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>n. (string_of_nat n, []) \<in> UNIV

goal (1 subgoal):
 1. infinite UNIV
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>n. nat_of_string (fst (string_of_nat n, [])) = n
\<forall>n. (string_of_nat n, []) \<in> UNIV
[PROOF STEP]
show "infinite (UNIV :: ('t atom) set)"
[PROOF STATE]
proof (prove)
using this:
\<forall>n. nat_of_string (fst (string_of_nat n, [])) = n
\<forall>n. (string_of_nat n, []) \<in> UNIV

goal (1 subgoal):
 1. infinite UNIV
[PROOF STEP]
using infinity[of ?undiago ?diago UNIV]
[PROOF STATE]
proof (prove)
using this:
\<forall>n. nat_of_string (fst (string_of_nat n, [])) = n
\<forall>n. (string_of_nat n, []) \<in> UNIV
\<lbrakk>\<forall>n. nat_of_string (fst (string_of_nat n, [])) = n; \<forall>n. (string_of_nat n, []) \<in> UNIV\<rbrakk> \<Longrightarrow> infinite UNIV

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

goal:
No subgoals!
[PROOF STEP]
qed