[STATEMENT]
lemma has_derivative_hyperdual_iff:
  fixes f :: "('a :: real_normed_vector) \<Rightarrow> ('b :: {real_normed_algebra_1, real_inner}) hyperdual"
  shows "(f has_derivative Df) F \<longleftrightarrow>
    ((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F \<and>
    ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F \<and>
    ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F \<and>
    ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_derivative Df) F = (((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F \<and> ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F \<and> ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F \<and> ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F)
[PROOF STEP]
proof safe
  \<comment> \<open>Left to Right\<close>
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. (f has_derivative Df) F \<Longrightarrow> ((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F
 2. (f has_derivative Df) F \<Longrightarrow> ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F
 3. (f has_derivative Df) F \<Longrightarrow> ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F
 4. (f has_derivative Df) F \<Longrightarrow> ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F
 5. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
assume assm: "(f has_derivative Df) F"
[PROOF STATE]
proof (state)
this:
(f has_derivative Df) F

goal (5 subgoals):
 1. (f has_derivative Df) F \<Longrightarrow> ((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F
 2. (f has_derivative Df) F \<Longrightarrow> ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F
 3. (f has_derivative Df) F \<Longrightarrow> ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F
 4. (f has_derivative Df) F \<Longrightarrow> ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F
 5. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
show "((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F
[PROOF STEP]
using assm has_derivative_Base
[PROOF STATE]
proof (prove)
using this:
(f has_derivative Df) F
(?g has_derivative ?g') ?F \<Longrightarrow> ((\<lambda>x. Base (?g x)) has_derivative (\<lambda>x. Base (?g' x))) ?F

goal (1 subgoal):
 1. ((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F

goal (4 subgoals):
 1. (f has_derivative Df) F \<Longrightarrow> ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F
 2. (f has_derivative Df) F \<Longrightarrow> ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F
 3. (f has_derivative Df) F \<Longrightarrow> ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F
 4. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
show "((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F
[PROOF STEP]
using assm has_derivative_Eps1
[PROOF STATE]
proof (prove)
using this:
(f has_derivative Df) F
(?g has_derivative ?g') ?F \<Longrightarrow> ((\<lambda>x. Eps1 (?g x)) has_derivative (\<lambda>x. Eps1 (?g' x))) ?F

goal (1 subgoal):
 1. ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F

goal (3 subgoals):
 1. (f has_derivative Df) F \<Longrightarrow> ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F
 2. (f has_derivative Df) F \<Longrightarrow> ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F
 3. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
show "((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F
[PROOF STEP]
using assm has_derivative_Eps2
[PROOF STATE]
proof (prove)
using this:
(f has_derivative Df) F
(?g has_derivative ?g') ?F \<Longrightarrow> ((\<lambda>x. Eps2 (?g x)) has_derivative (\<lambda>x. Eps2 (?g' x))) ?F

goal (1 subgoal):
 1. ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F

goal (2 subgoals):
 1. (f has_derivative Df) F \<Longrightarrow> ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F
 2. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
show "((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F
[PROOF STEP]
using assm has_derivative_Eps12
[PROOF STATE]
proof (prove)
using this:
(f has_derivative Df) F
(?g has_derivative ?g') ?F \<Longrightarrow> ((\<lambda>x. Eps12 (?g x)) has_derivative (\<lambda>x. Eps12 (?g' x))) ?F

goal (1 subgoal):
 1. ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F

goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
next
  \<comment> \<open>Right to Left\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
assume assm:
    "((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F"
    "((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F"
    "((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F"
    "((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F"

  \<comment> \<open>First prove the limit from component function limits\<close>
[PROOF STATE]
proof (state)
this:
((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F
((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F
((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F
((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F

goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
have "((\<lambda>y. Base (((f y - f (Lim F (\<lambda>x. x))) - Df (y - Lim F (\<lambda>x. x))) /\<^sub>R norm (y - Lim F (\<lambda>x. x)))) \<longlongrightarrow> Base 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>y. Base ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F
[PROOF STEP]
using assm has_derivative_def[of "(\<lambda>x. Base (f x))" "(\<lambda>x. Base (Df x))" F]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F
((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F
((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F
((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F
((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F = (bounded_linear (\<lambda>x. Base (Df x)) \<and> ((\<lambda>y. (Base (f y) - Base (f (netlimit F)) - Base (Df (y - netlimit F))) /\<^sub>R norm (y - netlimit F)) \<longlongrightarrow> (0::'b)) F)

goal (1 subgoal):
 1. ((\<lambda>y. Base ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>y. Base ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F

goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
((\<lambda>y. Base ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F

goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
have "((\<lambda>y. Eps1 (((f y - f (Lim F (\<lambda>x. x))) - Df (y - Lim F (\<lambda>x. x))) /\<^sub>R norm (y - Lim F (\<lambda>x. x)))) \<longlongrightarrow> Base 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>y. Eps1 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F
[PROOF STEP]
using assm has_derivative_def[of "(\<lambda>x. Eps1 (f x))" "(\<lambda>x. Eps1 (Df x))" F]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F
((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F
((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F
((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F
((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F = (bounded_linear (\<lambda>x. Eps1 (Df x)) \<and> ((\<lambda>y. (Eps1 (f y) - Eps1 (f (netlimit F)) - Eps1 (Df (y - netlimit F))) /\<^sub>R norm (y - netlimit F)) \<longlongrightarrow> (0::'b)) F)

goal (1 subgoal):
 1. ((\<lambda>y. Eps1 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>y. Eps1 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F

goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
((\<lambda>y. Eps1 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F

goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
have "((\<lambda>y. Eps2 (((f y - f (Lim F (\<lambda>x. x))) - Df (y - Lim F (\<lambda>x. x))) /\<^sub>R norm (y - Lim F (\<lambda>x. x)))) \<longlongrightarrow> Base 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>y. Eps2 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F
[PROOF STEP]
using assm has_derivative_def[of "(\<lambda>x. Eps2 (f x))" "(\<lambda>x. Eps2 (Df x))" F]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F
((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F
((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F
((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F
((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F = (bounded_linear (\<lambda>x. Eps2 (Df x)) \<and> ((\<lambda>y. (Eps2 (f y) - Eps2 (f (netlimit F)) - Eps2 (Df (y - netlimit F))) /\<^sub>R norm (y - netlimit F)) \<longlongrightarrow> (0::'b)) F)

goal (1 subgoal):
 1. ((\<lambda>y. Eps2 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>y. Eps2 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F

goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
((\<lambda>y. Eps2 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F

goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
have "((\<lambda>y. Eps12 (((f y - f (Lim F (\<lambda>x. x))) - Df (y - Lim F (\<lambda>x. x))) /\<^sub>R norm (y - Lim F (\<lambda>x. x)))) \<longlongrightarrow> Base 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>y. Eps12 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F
[PROOF STEP]
using assm has_derivative_def[of "(\<lambda>x. Eps12 (f x))" "(\<lambda>x. Eps12 (Df x))" F]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F
((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F
((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F
((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F
((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F = (bounded_linear (\<lambda>x. Eps12 (Df x)) \<and> ((\<lambda>y. (Eps12 (f y) - Eps12 (f (netlimit F)) - Eps12 (Df (y - netlimit F))) /\<^sub>R norm (y - netlimit F)) \<longlongrightarrow> (0::'b)) F)

goal (1 subgoal):
 1. ((\<lambda>y. Eps12 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>y. Eps12 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F

goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>y. Base ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F
((\<lambda>y. Eps1 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F
((\<lambda>y. Eps2 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F
((\<lambda>y. Eps12 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F
[PROOF STEP]
have "((\<lambda>y. ((f y - f (Lim F (\<lambda>x. x))) - Df (y - Lim F (\<lambda>x. x))) /\<^sub>R norm (y - Lim F (\<lambda>x. x))) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>y. Base ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F
((\<lambda>y. Eps1 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F
((\<lambda>y. Eps2 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F
((\<lambda>y. Eps12 ((f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F))) \<longlongrightarrow> Base 0) F

goal (1 subgoal):
 1. ((\<lambda>y. (f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F)) \<longlongrightarrow> 0) F
[PROOF STEP]
by (simp add: tendsto_hyperdual_iff)

  \<comment> \<open>Next prove bounded linearity of the composed derivative by proving each of that class'
      assumptions from bounded linearity of the component derivatives\<close>
[PROOF STATE]
proof (state)
this:
((\<lambda>y. (f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F)) \<longlongrightarrow> 0) F

goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
((\<lambda>y. (f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F)) \<longlongrightarrow> 0) F

goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
have "bounded_linear Df"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_linear Df
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>b1 b2. Df (b1 + b2) = Df b1 + Df b2
 2. \<And>r b. Df (r *\<^sub>R b) = r *\<^sub>R Df b
 3. \<exists>K. \<forall>x. norm (Df x) \<le> norm x * K
[PROOF STEP]
have bl:
      "bounded_linear (\<lambda>x. Base (Df x))"
      "bounded_linear (\<lambda>x. Eps1 (Df x))"
      "bounded_linear (\<lambda>x. Eps2 (Df x))"
      "bounded_linear (\<lambda>x. Eps12 (Df x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (bounded_linear (\<lambda>x. Base (Df x)) &&& bounded_linear (\<lambda>x. Eps1 (Df x))) &&& bounded_linear (\<lambda>x. Eps2 (Df x)) &&& bounded_linear (\<lambda>x. Eps12 (Df x))
[PROOF STEP]
using assm has_derivative_def
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F
((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F
((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F
((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F
(?f has_derivative ?f') ?F = (bounded_linear ?f' \<and> ((\<lambda>y. (?f y - ?f (netlimit ?F) - ?f' (y - netlimit ?F)) /\<^sub>R norm (y - netlimit ?F)) \<longlongrightarrow> (0::?'b)) ?F)

goal (1 subgoal):
 1. (bounded_linear (\<lambda>x. Base (Df x)) &&& bounded_linear (\<lambda>x. Eps1 (Df x))) &&& bounded_linear (\<lambda>x. Eps2 (Df x)) &&& bounded_linear (\<lambda>x. Eps12 (Df x))
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
bounded_linear (\<lambda>x. Base (Df x))
bounded_linear (\<lambda>x. Eps1 (Df x))
bounded_linear (\<lambda>x. Eps2 (Df x))
bounded_linear (\<lambda>x. Eps12 (Df x))

goal (3 subgoals):
 1. \<And>b1 b2. Df (b1 + b2) = Df b1 + Df b2
 2. \<And>r b. Df (r *\<^sub>R b) = r *\<^sub>R Df b
 3. \<exists>K. \<forall>x. norm (Df x) \<le> norm x * K
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bounded_linear (\<lambda>x. Base (Df x))
bounded_linear (\<lambda>x. Eps1 (Df x))
bounded_linear (\<lambda>x. Eps2 (Df x))
bounded_linear (\<lambda>x. Eps12 (Df x))
[PROOF STEP]
have "linear (\<lambda>x. Base (Df x))"
     and "linear (\<lambda>x. Eps1 (Df x))"
     and "linear (\<lambda>x. Eps2 (Df x))"
     and "linear (\<lambda>x. Eps12 (Df x))"
[PROOF STATE]
proof (prove)
using this:
bounded_linear (\<lambda>x. Base (Df x))
bounded_linear (\<lambda>x. Eps1 (Df x))
bounded_linear (\<lambda>x. Eps2 (Df x))
bounded_linear (\<lambda>x. Eps12 (Df x))

goal (1 subgoal):
 1. (linear (\<lambda>x. Base (Df x)) &&& linear (\<lambda>x. Eps1 (Df x))) &&& linear (\<lambda>x. Eps2 (Df x)) &&& linear (\<lambda>x. Eps12 (Df x))
[PROOF STEP]
using bounded_linear.linear
[PROOF STATE]
proof (prove)
using this:
bounded_linear (\<lambda>x. Base (Df x))
bounded_linear (\<lambda>x. Eps1 (Df x))
bounded_linear (\<lambda>x. Eps2 (Df x))
bounded_linear (\<lambda>x. Eps12 (Df x))
bounded_linear ?f \<Longrightarrow> linear ?f

goal (1 subgoal):
 1. (linear (\<lambda>x. Base (Df x)) &&& linear (\<lambda>x. Eps1 (Df x))) &&& linear (\<lambda>x. Eps2 (Df x)) &&& linear (\<lambda>x. Eps12 (Df x))
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
linear (\<lambda>x. Base (Df x))
linear (\<lambda>x. Eps1 (Df x))
linear (\<lambda>x. Eps2 (Df x))
linear (\<lambda>x. Eps12 (Df x))

goal (3 subgoals):
 1. \<And>b1 b2. Df (b1 + b2) = Df b1 + Df b2
 2. \<And>r b. Df (r *\<^sub>R b) = r *\<^sub>R Df b
 3. \<exists>K. \<forall>x. norm (Df x) \<le> norm x * K
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
linear (\<lambda>x. Base (Df x))
linear (\<lambda>x. Eps1 (Df x))
linear (\<lambda>x. Eps2 (Df x))
linear (\<lambda>x. Eps12 (Df x))
[PROOF STEP]
show "\<And>x y. Df (x + y) = Df x + Df y"
          and "\<And>x y. Df (x *\<^sub>R y) = x *\<^sub>R Df y"
[PROOF STATE]
proof (prove)
using this:
linear (\<lambda>x. Base (Df x))
linear (\<lambda>x. Eps1 (Df x))
linear (\<lambda>x. Eps2 (Df x))
linear (\<lambda>x. Eps12 (Df x))

goal (1 subgoal):
 1. (\<And>x y. Df (x + y) = Df x + Df y) &&& (\<And>x y. Df (x *\<^sub>R y) = x *\<^sub>R Df y)
[PROOF STEP]
using plus_hyperdual.code scaleR_hyperdual.code
[PROOF STATE]
proof (prove)
using this:
linear (\<lambda>x. Base (Df x))
linear (\<lambda>x. Eps1 (Df x))
linear (\<lambda>x. Eps2 (Df x))
linear (\<lambda>x. Eps12 (Df x))
?x + ?y = Hyperdual (Base ?x + Base ?y) (Eps1 ?x + Eps1 ?y) (Eps2 ?x + Eps2 ?y) (Eps12 ?x + Eps12 ?y)
?f *\<^sub>R ?x = Hyperdual (?f *\<^sub>R Base ?x) (?f *\<^sub>R Eps1 ?x) (?f *\<^sub>R Eps2 ?x) (?f *\<^sub>R Eps12 ?x)

goal (1 subgoal):
 1. (\<And>x y. Df (x + y) = Df x + Df y) &&& (\<And>x y. Df (x *\<^sub>R y) = x *\<^sub>R Df y)
[PROOF STEP]
by (simp_all add: linear_iff)
[PROOF STATE]
proof (state)
this:
Df (?x + ?y) = Df ?x + Df ?y
Df (?x *\<^sub>R ?y) = ?x *\<^sub>R Df ?y

goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (Df x) \<le> norm x * K
[PROOF STEP]
show "\<exists>K. \<forall>x. norm (Df x) \<le> norm x * K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (Df x) \<le> norm x * K
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (Df x) \<le> norm x * K
[PROOF STEP]
obtain k_re k_eps1 k_eps2 k_eps12
       where "\<forall>x. (norm (Base (Df x)))^2 \<le> (norm x * k_re)^2"
         and "\<forall>x. (norm (Eps1 (Df x)))^2 \<le> (norm x * k_eps1)^2"
         and "\<forall>x. (norm (Eps2 (Df x)))^2 \<le> (norm x * k_eps2)^2"
         and "\<forall>x. (norm (Eps12 (Df x)))^2 \<le> (norm x * k_eps12)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k_re k_eps1 k_eps2 k_eps12. \<lbrakk>\<forall>x. (norm (Base (Df x)))\<^sup>2 \<le> (norm x * k_re)\<^sup>2; \<forall>x. (norm (Eps1 (Df x)))\<^sup>2 \<le> (norm x * k_eps1)\<^sup>2; \<forall>x. (norm (Eps2 (Df x)))\<^sup>2 \<le> (norm x * k_eps2)\<^sup>2; \<forall>x. (norm (Eps12 (Df x)))\<^sup>2 \<le> (norm x * k_eps12)\<^sup>2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using bl bounded_linear.bounded norm_ge_zero power_mono
[PROOF STATE]
proof (prove)
using this:
bounded_linear (\<lambda>x. Base (Df x))
bounded_linear (\<lambda>x. Eps1 (Df x))
bounded_linear (\<lambda>x. Eps2 (Df x))
bounded_linear (\<lambda>x. Eps12 (Df x))
bounded_linear ?f \<Longrightarrow> \<exists>K. \<forall>x. norm (?f x) \<le> norm x * K
0 \<le> norm ?x
\<lbrakk>?a \<le> ?b; (0::?'a) \<le> ?a\<rbrakk> \<Longrightarrow> ?a ^ ?n \<le> ?b ^ ?n

goal (1 subgoal):
 1. (\<And>k_re k_eps1 k_eps2 k_eps12. \<lbrakk>\<forall>x. (norm (Base (Df x)))\<^sup>2 \<le> (norm x * k_re)\<^sup>2; \<forall>x. (norm (Eps1 (Df x)))\<^sup>2 \<le> (norm x * k_eps1)\<^sup>2; \<forall>x. (norm (Eps2 (Df x)))\<^sup>2 \<le> (norm x * k_eps2)\<^sup>2; \<forall>x. (norm (Eps12 (Df x)))\<^sup>2 \<le> (norm x * k_eps12)\<^sup>2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<forall>x. (norm (Base (Df x)))\<^sup>2 \<le> (norm x * k_re)\<^sup>2
\<forall>x. (norm (Eps1 (Df x)))\<^sup>2 \<le> (norm x * k_eps1)\<^sup>2
\<forall>x. (norm (Eps2 (Df x)))\<^sup>2 \<le> (norm x * k_eps2)\<^sup>2
\<forall>x. (norm (Eps12 (Df x)))\<^sup>2 \<le> (norm x * k_eps12)\<^sup>2

goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (Df x) \<le> norm x * K
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>x. (norm (Base (Df x)))\<^sup>2 \<le> (norm x * k_re)\<^sup>2
\<forall>x. (norm (Eps1 (Df x)))\<^sup>2 \<le> (norm x * k_eps1)\<^sup>2
\<forall>x. (norm (Eps2 (Df x)))\<^sup>2 \<le> (norm x * k_eps2)\<^sup>2
\<forall>x. (norm (Eps12 (Df x)))\<^sup>2 \<le> (norm x * k_eps12)\<^sup>2

goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (Df x) \<le> norm x * K
[PROOF STEP]
have "\<forall>x. (norm (Df x))^2 = (norm (Base (Df x)))^2 + (norm (Eps1 (Df x)))^2 + (norm (Eps2 (Df x)))^2 + (norm (Eps12 (Df x)))^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. (norm (Df x))\<^sup>2 = (norm (Base (Df x)))\<^sup>2 + (norm (Eps1 (Df x)))\<^sup>2 + (norm (Eps2 (Df x)))\<^sup>2 + (norm (Eps12 (Df x)))\<^sup>2
[PROOF STEP]
using inner_hyperdual_def power2_norm_eq_inner
[PROOF STATE]
proof (prove)
using this:
?x \<bullet> ?y = Base ?x \<bullet> Base ?y + Eps1 ?x \<bullet> Eps1 ?y + Eps2 ?x \<bullet> Eps2 ?y + Eps12 ?x \<bullet> Eps12 ?y
(norm ?x)\<^sup>2 = ?x \<bullet> ?x

goal (1 subgoal):
 1. \<forall>x. (norm (Df x))\<^sup>2 = (norm (Base (Df x)))\<^sup>2 + (norm (Eps1 (Df x)))\<^sup>2 + (norm (Eps2 (Df x)))\<^sup>2 + (norm (Eps12 (Df x)))\<^sup>2
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<forall>x. (norm (Df x))\<^sup>2 = (norm (Base (Df x)))\<^sup>2 + (norm (Eps1 (Df x)))\<^sup>2 + (norm (Eps2 (Df x)))\<^sup>2 + (norm (Eps12 (Df x)))\<^sup>2

goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (Df x) \<le> norm x * K
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. (norm (Base (Df x)))\<^sup>2 \<le> (norm x * k_re)\<^sup>2
\<forall>x. (norm (Eps1 (Df x)))\<^sup>2 \<le> (norm x * k_eps1)\<^sup>2
\<forall>x. (norm (Eps2 (Df x)))\<^sup>2 \<le> (norm x * k_eps2)\<^sup>2
\<forall>x. (norm (Eps12 (Df x)))\<^sup>2 \<le> (norm x * k_eps12)\<^sup>2
\<forall>x. (norm (Df x))\<^sup>2 = (norm (Base (Df x)))\<^sup>2 + (norm (Eps1 (Df x)))\<^sup>2 + (norm (Eps2 (Df x)))\<^sup>2 + (norm (Eps12 (Df x)))\<^sup>2
[PROOF STEP]
have "\<forall>x. (norm (Df x))^2 \<le> (norm x * k_re)^2 + (norm x * k_eps1)^2 + (norm x * k_eps2)^2 + (norm x * k_eps12)^2"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. (norm (Base (Df x)))\<^sup>2 \<le> (norm x * k_re)\<^sup>2
\<forall>x. (norm (Eps1 (Df x)))\<^sup>2 \<le> (norm x * k_eps1)\<^sup>2
\<forall>x. (norm (Eps2 (Df x)))\<^sup>2 \<le> (norm x * k_eps2)\<^sup>2
\<forall>x. (norm (Eps12 (Df x)))\<^sup>2 \<le> (norm x * k_eps12)\<^sup>2
\<forall>x. (norm (Df x))\<^sup>2 = (norm (Base (Df x)))\<^sup>2 + (norm (Eps1 (Df x)))\<^sup>2 + (norm (Eps2 (Df x)))\<^sup>2 + (norm (Eps12 (Df x)))\<^sup>2

goal (1 subgoal):
 1. \<forall>x. (norm (Df x))\<^sup>2 \<le> (norm x * k_re)\<^sup>2 + (norm x * k_eps1)\<^sup>2 + (norm x * k_eps2)\<^sup>2 + (norm x * k_eps12)\<^sup>2
[PROOF STEP]
by smt
[PROOF STATE]
proof (state)
this:
\<forall>x. (norm (Df x))\<^sup>2 \<le> (norm x * k_re)\<^sup>2 + (norm x * k_eps1)\<^sup>2 + (norm x * k_eps2)\<^sup>2 + (norm x * k_eps12)\<^sup>2

goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (Df x) \<le> norm x * K
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. (norm (Df x))\<^sup>2 \<le> (norm x * k_re)\<^sup>2 + (norm x * k_eps1)\<^sup>2 + (norm x * k_eps2)\<^sup>2 + (norm x * k_eps12)\<^sup>2
[PROOF STEP]
have "\<forall>x. (norm (Df x))^2 \<le> (norm x)^2 * (k_re^2 + k_eps1^2 + k_eps2^2 + k_eps12^2)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. (norm (Df x))\<^sup>2 \<le> (norm x * k_re)\<^sup>2 + (norm x * k_eps1)\<^sup>2 + (norm x * k_eps2)\<^sup>2 + (norm x * k_eps12)\<^sup>2

goal (1 subgoal):
 1. \<forall>x. (norm (Df x))\<^sup>2 \<le> (norm x)\<^sup>2 * (k_re\<^sup>2 + k_eps1\<^sup>2 + k_eps2\<^sup>2 + k_eps12\<^sup>2)
[PROOF STEP]
by (simp add: distrib_left power_mult_distrib)
[PROOF STATE]
proof (state)
this:
\<forall>x. (norm (Df x))\<^sup>2 \<le> (norm x)\<^sup>2 * (k_re\<^sup>2 + k_eps1\<^sup>2 + k_eps2\<^sup>2 + k_eps12\<^sup>2)

goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (Df x) \<le> norm x * K
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. (norm (Df x))\<^sup>2 \<le> (norm x)\<^sup>2 * (k_re\<^sup>2 + k_eps1\<^sup>2 + k_eps2\<^sup>2 + k_eps12\<^sup>2)
[PROOF STEP]
have final: "\<forall>x. norm (Df x) \<le> norm x * sqrt(k_re^2 + k_eps1^2 + k_eps2^2 + k_eps12^2)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. (norm (Df x))\<^sup>2 \<le> (norm x)\<^sup>2 * (k_re\<^sup>2 + k_eps1\<^sup>2 + k_eps2\<^sup>2 + k_eps12\<^sup>2)

goal (1 subgoal):
 1. \<forall>x. norm (Df x) \<le> norm x * sqrt (k_re\<^sup>2 + k_eps1\<^sup>2 + k_eps2\<^sup>2 + k_eps12\<^sup>2)
[PROOF STEP]
using real_le_rsqrt real_sqrt_mult real_sqrt_pow2
[PROOF STATE]
proof (prove)
using this:
\<forall>x. (norm (Df x))\<^sup>2 \<le> (norm x)\<^sup>2 * (k_re\<^sup>2 + k_eps1\<^sup>2 + k_eps2\<^sup>2 + k_eps12\<^sup>2)
?x\<^sup>2 \<le> ?y \<Longrightarrow> ?x \<le> sqrt ?y
sqrt (?x * ?y) = sqrt ?x * sqrt ?y
0 \<le> ?x \<Longrightarrow> (sqrt ?x)\<^sup>2 = ?x

goal (1 subgoal):
 1. \<forall>x. norm (Df x) \<le> norm x * sqrt (k_re\<^sup>2 + k_eps1\<^sup>2 + k_eps2\<^sup>2 + k_eps12\<^sup>2)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<forall>x. norm (Df x) \<le> norm x * sqrt (k_re\<^sup>2 + k_eps1\<^sup>2 + k_eps2\<^sup>2 + k_eps12\<^sup>2)

goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (Df x) \<le> norm x * K
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. norm (Df x) \<le> norm x * sqrt (k_re\<^sup>2 + k_eps1\<^sup>2 + k_eps2\<^sup>2 + k_eps12\<^sup>2)
[PROOF STEP]
show "\<exists>K. \<forall>x. norm (Df x) \<le> norm x * K"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. norm (Df x) \<le> norm x * sqrt (k_re\<^sup>2 + k_eps1\<^sup>2 + k_eps2\<^sup>2 + k_eps12\<^sup>2)

goal (1 subgoal):
 1. \<exists>K. \<forall>x. norm (Df x) \<le> norm x * K
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>K. \<forall>x. norm (Df x) \<le> norm x * K

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>K. \<forall>x. norm (Df x) \<le> norm x * K

goal:
No subgoals!
[PROOF STEP]
qed
  \<comment> \<open>Finally put the two together to finish the proof\<close>
[PROOF STATE]
proof (state)
this:
bounded_linear Df

goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. Base (f x)) has_derivative (\<lambda>x. Base (Df x))) F; ((\<lambda>x. Eps1 (f x)) has_derivative (\<lambda>x. Eps1 (Df x))) F; ((\<lambda>x. Eps2 (f x)) has_derivative (\<lambda>x. Eps2 (Df x))) F; ((\<lambda>x. Eps12 (f x)) has_derivative (\<lambda>x. Eps12 (Df x))) F\<rbrakk> \<Longrightarrow> (f has_derivative Df) F
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>y. (f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F)) \<longlongrightarrow> 0) F
bounded_linear Df
[PROOF STEP]
show "(f has_derivative Df) F"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>y. (f y - f (netlimit F) - Df (y - netlimit F)) /\<^sub>R norm (y - netlimit F)) \<longlongrightarrow> 0) F
bounded_linear Df

goal (1 subgoal):
 1. (f has_derivative Df) F
[PROOF STEP]
by (simp add: has_derivative_def)
[PROOF STATE]
proof (state)
this:
(f has_derivative Df) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma on_equator_meridian_is_K2_centre:
  assumes "proj2_incident a equator" and "proj2_incident a meridian"
  shows "a = K2_centre"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = K2_centre
[PROOF STEP]
using assms and K2_centre_on_equator_meridian and equator_meridian_distinct
    and proj2_incident_unique
[PROOF STATE]
proof (prove)
using this:
proj2_incident a equator
proj2_incident a meridian
proj2_incident K2_centre equator
proj2_incident K2_centre meridian
equator \<noteq> meridian
\<lbrakk>proj2_incident ?p ?l; proj2_incident ?q ?l; proj2_incident ?p ?m; proj2_incident ?q ?m\<rbrakk> \<Longrightarrow> ?p = ?q \<or> ?l = ?m

goal (1 subgoal):
 1. a = K2_centre
[PROOF STEP]
by auto


[STATEMENT]
lemma filtermap_nhds_times: "c \<noteq> 0 \<Longrightarrow> filtermap (times c) (nhds a) = nhds (c * a)"
  for a c :: "'a::real_normed_field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> (0::'a) \<Longrightarrow> filtermap ((*) c) (nhds a) = nhds (c * a)
[PROOF STEP]
by (rule filtermap_fun_inverse[where g="\<lambda>x. inverse c * x"])
    (auto intro!: tendsto_eq_intros filterlim_ident)


[STATEMENT]
lemma prod_mset_multiset_prime_factorization_nat [simp]:
  "(x::nat) \<noteq> 0 \<Longrightarrow> prod_mset (prime_factorization x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> \<Prod>\<^sub># (prime_factorization x) = x
[PROOF STEP]
by simp


[STATEMENT]
lemma cSup_mem_eq:
  "c \<in> X \<Longrightarrow> \<forall>x \<in> X. x \<le> c \<Longrightarrow> Sup X = c" for c::"'a::conditionally_complete_lattice"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c \<in> X; \<forall>x\<in>X. x \<le> c\<rbrakk> \<Longrightarrow> Sup X = c
[PROOF STEP]
by (rule cSup_eq, auto)


[STATEMENT]
lemma pmf_Pn:
  assumes "x \<in> set_pmf (Xn p S0 n)"
  shows "pmf (Pn p S0 n) (x,a) = pmf (Y_cond_X p S0 n x) a * pmf (Xn p S0 n) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (Pn p S0 n) (x, a) = pmf (Y_cond_X p S0 n x) a * pmf (Xn p S0 n) x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pmf (Pn p S0 n) (x, a) = pmf (Y_cond_X p S0 n x) a * pmf (Xn p S0 n) x
[PROOF STEP]
have aux: "set_pmf (Pn p S0 n) \<inter> {(s, a). s = x} \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_pmf (Pn p S0 n) \<inter> {(s, a). s = x} \<noteq> {}
[PROOF STEP]
using Xn_def assms
[PROOF STATE]
proof (prove)
using this:
Xn ?p ?S0.0 ?n = map_pmf fst (Pn ?p ?S0.0 ?n)
x \<in> set_pmf (Xn p S0 n)

goal (1 subgoal):
 1. set_pmf (Pn p S0 n) \<inter> {(s, a). s = x} \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set_pmf (Pn p S0 n) \<inter> {(s, a). s = x} \<noteq> {}

goal (1 subgoal):
 1. pmf (Pn p S0 n) (x, a) = pmf (Y_cond_X p S0 n x) a * pmf (Xn p S0 n) x
[PROOF STEP]
have aux': "({(s, a). s = x} \<inter> snd -` {a}) = {(x, a)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(s, a). s = x} \<inter> snd -` {a} = {(x, a)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{(s, a). s = x} \<inter> snd -` {a} = {(x, a)}

goal (1 subgoal):
 1. pmf (Pn p S0 n) (x, a) = pmf (Y_cond_X p S0 n x) a * pmf (Xn p S0 n) x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (Pn p S0 n) (x, a) = pmf (Y_cond_X p S0 n x) a * pmf (Xn p S0 n) x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> set_pmf (Xn p S0 n)

goal (1 subgoal):
 1. pmf (Pn p S0 n) (x, a) = pmf (Y_cond_X p S0 n x) a * pmf (Xn p S0 n) x
[PROOF STEP]
unfolding Y_cond_X_def cond_pmf.rep_eq[OF aux] pmf_map
[PROOF STATE]
proof (prove)
using this:
x \<in> set_pmf (Xn p S0 n)

goal (1 subgoal):
 1. pmf (Pn p S0 n) (x, a) = Sigma_Algebra.measure (uniform_measure (measure_pmf (Pn p S0 n)) {(s, a). s = x}) (snd -` {a}) * pmf (Xn p S0 n) x
[PROOF STEP]
by (auto simp: pmf_eq_0_set_pmf measure_pmf.emeasure_eq_measure aux' measure_pmf_single)
[PROOF STATE]
proof (state)
this:
pmf (Pn p S0 n) (x, a) = pmf (Y_cond_X p S0 n x) a * pmf (Xn p S0 n) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Lim_emeasure_decseq:
  assumes A: "range A \<subseteq> sets M" "decseq A" and fin: "\<And>i. emeasure M (A i) \<noteq> \<infinity>"
  shows "(\<lambda>i. emeasure M (A i)) \<longlonglongrightarrow> emeasure M (\<Inter>i. A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. emeasure M (A i)) \<longlonglongrightarrow> emeasure M (\<Inter> (range A))
[PROOF STEP]
using LIMSEQ_INF[OF decseq_emeasure, OF A]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. emeasure M (A i)) \<longlonglongrightarrow> (INF i. emeasure M (A i))

goal (1 subgoal):
 1. (\<lambda>i. emeasure M (A i)) \<longlonglongrightarrow> emeasure M (\<Inter> (range A))
[PROOF STEP]
using INF_emeasure_decseq[OF A fin]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. emeasure M (A i)) \<longlonglongrightarrow> (INF i. emeasure M (A i))
(INF n. emeasure M (A n)) = emeasure M (\<Inter> (range A))

goal (1 subgoal):
 1. (\<lambda>i. emeasure M (A i)) \<longlonglongrightarrow> emeasure M (\<Inter> (range A))
[PROOF STEP]
by simp


[STATEMENT]
lemma nontriv_solution_power_nat [intro]:
  assumes "nontriv_solution (z :: nat \<times> nat)" "n > 0"
  shows   "nontriv_solution (pell_power z n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nontriv_solution (pell_power z n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nontriv_solution (pell_power z n)
[PROOF STEP]
have "nontriv_solution (pell_power z n) \<or> n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nontriv_solution (pell_power z n) \<or> n = 0
[PROOF STEP]
by (induction n)
       (insert assms(1), auto intro: nontriv_solution_pell_nat_mul1 simp: pell_power_Suc)
[PROOF STATE]
proof (state)
this:
nontriv_solution (pell_power z n) \<or> n = 0

goal (1 subgoal):
 1. nontriv_solution (pell_power z n)
[PROOF STEP]
with assms(2)
[PROOF STATE]
proof (chain)
picking this:
0 < n
nontriv_solution (pell_power z n) \<or> n = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < n
nontriv_solution (pell_power z n) \<or> n = 0

goal (1 subgoal):
 1. nontriv_solution (pell_power z n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nontriv_solution (pell_power z n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem log_convex_Gamma_real: "convex_on {0<..} (ln \<circ> Gamma :: real \<Rightarrow> real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_on {0<..} (ln \<circ> Gamma)
[PROOF STEP]
by (rule convex_on_realI[of _ _ Digamma])
     (auto intro!: derivative_eq_intros Polygamma_real_mono Gamma_real_pos
           simp: o_def Gamma_eq_zero_iff elim!: nonpos_Ints_cases')


[STATEMENT]
lemma nat_diff_right_cancel_le2: "\<lbrakk> m - k \<le> n - (k::nat); k \<le> n \<rbrakk> \<Longrightarrow> m \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m - k \<le> n - k; k \<le> n\<rbrakk> \<Longrightarrow> m \<le> n
[PROOF STEP]
by simp


[STATEMENT]
lemma NSDERIV_NSLIM_iff2: "(NSDERIV f x :> D) \<longleftrightarrow> (\<lambda>z. (f z - f x) / (z - x)) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NSDERIV f x :> D = (\<lambda>z. (f z - f x) / (z - x)) \<midarrow>x\<rightarrow>\<^sub>N\<^sub>S D
[PROOF STEP]
by (simp add: NSDERIV_NSLIM_iff DERIV_LIM_iff LIM_NSLIM_iff [symmetric])


[STATEMENT]
lemma floor_le_numeral [simp]: "\<lfloor>x\<rfloor> \<le> numeral v \<longleftrightarrow> x < numeral v + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lfloor>x\<rfloor> \<le> numeral v) = (x < numeral v + (1::'a))
[PROOF STEP]
by (simp add: floor_le_iff)


[STATEMENT]
lemma poly_function_tuple_comp_mult:
  assumes "is_function_tuple R n fs"
  assumes "k \<le>length fs"
  assumes "p \<in> carrier (coord_ring R k)"
  assumes "Q \<in> carrier (coord_ring R k)"
  assumes "x \<in> carrier (R\<^bsup>n\<^esup>)"
  shows "poly_function_tuple_comp R n fs (p \<otimes>\<^bsub>R[\<X>\<^bsub>n\<^esub>]\<^esub> Q) x =
          (poly_function_tuple_comp R n fs p x) \<otimes> (poly_function_tuple_comp R n fs Q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_function_tuple_comp R n fs (p \<otimes>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) x = poly_function_tuple_comp R n fs p x \<otimes> poly_function_tuple_comp R n fs Q x
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_function_tuple_comp R n fs (p \<otimes>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) x = poly_function_tuple_comp R n fs p x \<otimes> poly_function_tuple_comp R n fs Q x
[PROOF STEP]
have 0: "p \<in> carrier (coord_ring R (length fs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])
[PROOF STEP]
using assms poly_ring_car_mono[of k "length fs"]
[PROOF STATE]
proof (prove)
using this:
is_function_tuple R n fs
k \<le> length fs
p \<in> carrier (R [\<X>\<^bsub>k\<^esub>])
Q \<in> carrier (R [\<X>\<^bsub>k\<^esub>])
x \<in> carrier (R\<^bsup>n\<^esup>)
k \<le> length fs \<Longrightarrow> carrier (R [\<X>\<^bsub>k\<^esub>]) \<subseteq> carrier (R [\<X>\<^bsub>length fs\<^esub>])

goal (1 subgoal):
 1. p \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
p \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])

goal (1 subgoal):
 1. poly_function_tuple_comp R n fs (p \<otimes>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) x = poly_function_tuple_comp R n fs p x \<otimes> poly_function_tuple_comp R n fs Q x
[PROOF STEP]
have 1: "Q \<in> carrier (coord_ring R (length fs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])
[PROOF STEP]
using assms poly_ring_car_mono[of k "length fs"]
[PROOF STATE]
proof (prove)
using this:
is_function_tuple R n fs
k \<le> length fs
p \<in> carrier (R [\<X>\<^bsub>k\<^esub>])
Q \<in> carrier (R [\<X>\<^bsub>k\<^esub>])
x \<in> carrier (R\<^bsup>n\<^esup>)
k \<le> length fs \<Longrightarrow> carrier (R [\<X>\<^bsub>k\<^esub>]) \<subseteq> carrier (R [\<X>\<^bsub>length fs\<^esub>])

goal (1 subgoal):
 1. Q \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Q \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])

goal (1 subgoal):
 1. poly_function_tuple_comp R n fs (p \<otimes>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) x = poly_function_tuple_comp R n fs p x \<otimes> poly_function_tuple_comp R n fs Q x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_function_tuple_comp R n fs (p \<otimes>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) x = poly_function_tuple_comp R n fs p x \<otimes> poly_function_tuple_comp R n fs Q x
[PROOF STEP]
using assms  0 1
        poly_function_tuple_comp_eq
        function_tuple_eval_closed[of R n fs x]
        eval_at_point_mult[of "function_tuple_eval R n fs x" "length fs" p Q]
[PROOF STATE]
proof (prove)
using this:
is_function_tuple R n fs
k \<le> length fs
p \<in> carrier (R [\<X>\<^bsub>k\<^esub>])
Q \<in> carrier (R [\<X>\<^bsub>k\<^esub>])
x \<in> carrier (R\<^bsup>n\<^esup>)
p \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])
Q \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])
\<lbrakk>is_function_tuple R ?n ?fs; ?f \<in> carrier (R [\<X>\<^bsub>length ?fs\<^esub>]); ?a \<in> carrier (R\<^bsup>?n\<^esup>)\<rbrakk> \<Longrightarrow> poly_function_tuple_comp R ?n ?fs ?f ?a = eval_at_point R (function_tuple_eval R ?n ?fs ?a) ?f
\<lbrakk>is_function_tuple R n fs; x \<in> carrier (R\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> function_tuple_eval R n fs x \<in> carrier (R\<^bsup>length fs\<^esup>)
\<lbrakk>function_tuple_eval R n fs x \<in> carrier (R\<^bsup>length fs\<^esup>); p \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>]); Q \<in> carrier (R [\<X>\<^bsub>length fs\<^esub>])\<rbrakk> \<Longrightarrow> eval_at_point R (function_tuple_eval R n fs x) (p \<otimes>\<^bsub>R [\<X>\<^bsub>length fs\<^esub>]\<^esub> Q) = eval_at_point R (function_tuple_eval R n fs x) p \<otimes> eval_at_point R (function_tuple_eval R n fs x) Q

goal (1 subgoal):
 1. poly_function_tuple_comp R n fs (p \<otimes>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) x = poly_function_tuple_comp R n fs p x \<otimes> poly_function_tuple_comp R n fs Q x
[PROOF STEP]
unfolding coord_ring_def
[PROOF STATE]
proof (prove)
using this:
is_function_tuple R n fs
k \<le> length fs
p \<in> carrier (Pring R {..<k})
Q \<in> carrier (Pring R {..<k})
x \<in> carrier (R\<^bsup>n\<^esup>)
p \<in> carrier (Pring R {..<length fs})
Q \<in> carrier (Pring R {..<length fs})
\<lbrakk>is_function_tuple R ?n ?fs; ?f \<in> carrier (Pring R {..<length ?fs}); ?a \<in> carrier (R\<^bsup>?n\<^esup>)\<rbrakk> \<Longrightarrow> poly_function_tuple_comp R ?n ?fs ?f ?a = eval_at_point R (function_tuple_eval R ?n ?fs ?a) ?f
\<lbrakk>is_function_tuple R n fs; x \<in> carrier (R\<^bsup>n\<^esup>)\<rbrakk> \<Longrightarrow> function_tuple_eval R n fs x \<in> carrier (R\<^bsup>length fs\<^esup>)
\<lbrakk>function_tuple_eval R n fs x \<in> carrier (R\<^bsup>length fs\<^esup>); p \<in> carrier (Pring R {..<length fs}); Q \<in> carrier (Pring R {..<length fs})\<rbrakk> \<Longrightarrow> eval_at_point R (function_tuple_eval R n fs x) (p \<otimes>\<^bsub>Pring R {..<length fs}\<^esub> Q) = eval_at_point R (function_tuple_eval R n fs x) p \<otimes> eval_at_point R (function_tuple_eval R n fs x) Q

goal (1 subgoal):
 1. poly_function_tuple_comp R n fs (p \<otimes>\<^bsub>Pring R {..<n}\<^esub> Q) x = poly_function_tuple_comp R n fs p x \<otimes> poly_function_tuple_comp R n fs Q x
[PROOF STEP]
by (metis MP.m_closed R.Pring_mult_eq coord_ring_def)
[PROOF STATE]
proof (state)
this:
poly_function_tuple_comp R n fs (p \<otimes>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> Q) x = poly_function_tuple_comp R n fs p x \<otimes> poly_function_tuple_comp R n fs Q x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_2_atLeast0 [simp]: "{0..<2::nat} = {0,1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<2} = {0, 1}
[PROOF STEP]
by auto


[STATEMENT]
lemma  gen_subalgebra_sigma_sets:
  assumes "G \<subseteq> sets M"
  and "sigma_algebra (space M) G"
  shows "sets (gen_subalgebra M G) = G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (gen_subalgebra M G) = G
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
G \<subseteq> sets M
sigma_algebra (space M) G

goal (1 subgoal):
 1. sets (gen_subalgebra M G) = G
[PROOF STEP]
by (simp add: gen_subalgebra_def sigma_algebra.sets_measure_of_eq)


[STATEMENT]
lemma openin_open_eq: "open s \<Longrightarrow> (openin (top_of_set s) t \<longleftrightarrow> open t \<and> t \<subseteq> s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open s \<Longrightarrow> openin (top_of_set s) t = (open t \<and> t \<subseteq> s)
[PROOF STEP]
using open_subset openin_open_trans openin_subset
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?S \<subseteq> ?T; open ?S\<rbrakk> \<Longrightarrow> openin (top_of_set ?T) ?S
\<lbrakk>openin (top_of_set ?T) ?S; open ?T\<rbrakk> \<Longrightarrow> open ?S
openin ?U ?S \<Longrightarrow> ?S \<subseteq> topspace ?U

goal (1 subgoal):
 1. open s \<Longrightarrow> openin (top_of_set s) t = (open t \<and> t \<subseteq> s)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma sol_bres: "(x \<rightarrow> (x \<cdot> y) = y) = (\<exists>z. y = x \<rightarrow> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<rightarrow> x \<cdot> y = y) = (\<exists>z. y = x \<rightarrow> z)
[PROOF STEP]
by (metis bres_canc1 bres_canc2 bres_iso order.eq_iff)


[STATEMENT]
lemma "(\<forall>A. 0 \<in> A \<and> (\<forall>x \<in> A. Suc x \<in> A) \<longrightarrow> n \<in> A) \<and>
  P 0 \<and> (\<forall>x. P x \<longrightarrow> P (Suc x)) \<longrightarrow> P n"
  \<comment> \<open>Example 11: needs a hint.\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>A. 0 \<in> A \<and> (\<forall>x\<in>A. Suc x \<in> A) \<longrightarrow> n \<in> A) \<and> P 0 \<and> (\<forall>x. P x \<longrightarrow> P (Suc x)) \<longrightarrow> P n
[PROOF STEP]
by(metis nat.induct)


[STATEMENT]
lemma (in prob_space) joint_distribution_Times_le_snd:
  "random_variable MX X \<Longrightarrow> random_variable MY Y \<Longrightarrow> A \<in> sets MX \<Longrightarrow> B \<in> sets MY
    \<Longrightarrow> emeasure (distr M (MX \<Otimes>\<^sub>M MY) (\<lambda>x. (X x, Y x))) (A \<times> B) \<le> emeasure (distr M MY Y) B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>random_variable MX X; random_variable MY Y; A \<in> sets MX; B \<in> sets MY\<rbrakk> \<Longrightarrow> emeasure (distr M (MX \<Otimes>\<^sub>M MY) (\<lambda>x. (X x, Y x))) (A \<times> B) \<le> emeasure (distr M MY Y) B
[PROOF STEP]
by (auto simp: emeasure_distr measurable_pair_iff comp_def intro!: emeasure_mono measurable_sets)


[STATEMENT]
lemma vifunion_vsingleton_eq_vrange: "(\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. set {f i}) = \<R>\<^sub>\<circ> (\<lambda>a\<in>\<^sub>\<circ>I. f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union>\<^sub>\<circ> ((\<lambda>a\<in>\<^sub>\<circ>I. set {f a}) `\<^sub>\<circ> I) = \<R>\<^sub>\<circ> (VLambda I f)
[PROOF STEP]
by force


[STATEMENT]
lemma eint_minus_le:
  assumes "(b::eint) < c"
  shows "c - b > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < c - b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
b < c

goal (1 subgoal):
 1. 0 < c - b
[PROOF STEP]
apply(induction b, induction c)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>int inta. \<lbrakk>eint inta < eint int; b < eint int\<rbrakk> \<Longrightarrow> 0 < eint int - eint inta
 2. \<And>int. \<lbrakk>eint int < \<infinity>; b < \<infinity>\<rbrakk> \<Longrightarrow> 0 < \<infinity> - eint int
 3. \<infinity> < c \<Longrightarrow> 0 < c - \<infinity>
[PROOF STEP]
by (auto simp add: zero_eint_def)


[STATEMENT]
lemma abs_round_up_le: "\<bar>f - (round_up e f)\<bar> \<le> 2 powr -e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>f - round_up e f\<bar> \<le> 2 powr - real_of_int e
[PROOF STEP]
using round_up_correct[of e f]
[PROOF STATE]
proof (prove)
using this:
round_up e f - f \<in> {0..2 powr - real_of_int e}

goal (1 subgoal):
 1. \<bar>f - round_up e f\<bar> \<le> 2 powr - real_of_int e
[PROOF STEP]
by simp


[STATEMENT]
lemma prod_PInf:
  fixes f :: "'a \<Rightarrow> ereal"
  assumes "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i"
  shows "(\<Prod>i\<in>I. f i) = \<infinity> \<longleftrightarrow> finite I \<and> (\<exists>i\<in>I. f i = \<infinity>) \<and> (\<forall>i\<in>I. f i \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (prod f I = \<infinity>) = (finite I \<and> (\<exists>i\<in>I. f i = \<infinity>) \<and> (\<forall>i\<in>I. f i \<noteq> 0))
[PROOF STEP]
proof (cases "finite I")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite I \<Longrightarrow> (prod f I = \<infinity>) = (finite I \<and> (\<exists>i\<in>I. f i = \<infinity>) \<and> (\<forall>i\<in>I. f i \<noteq> 0))
 2. infinite I \<Longrightarrow> (prod f I = \<infinity>) = (finite I \<and> (\<exists>i\<in>I. f i = \<infinity>) \<and> (\<forall>i\<in>I. f i \<noteq> 0))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite I

goal (2 subgoals):
 1. finite I \<Longrightarrow> (prod f I = \<infinity>) = (finite I \<and> (\<exists>i\<in>I. f i = \<infinity>) \<and> (\<forall>i\<in>I. f i \<noteq> 0))
 2. infinite I \<Longrightarrow> (prod f I = \<infinity>) = (finite I \<and> (\<exists>i\<in>I. f i = \<infinity>) \<and> (\<forall>i\<in>I. f i \<noteq> 0))
[PROOF STEP]
from this assms
[PROOF STATE]
proof (chain)
picking this:
finite I
?i \<in> I \<Longrightarrow> 0 \<le> f ?i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite I
?i \<in> I \<Longrightarrow> 0 \<le> f ?i

goal (1 subgoal):
 1. (prod f I = \<infinity>) = (finite I \<and> (\<exists>i\<in>I. f i = \<infinity>) \<and> (\<forall>i\<in>I. f i \<noteq> 0))
[PROOF STEP]
proof (induct I)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f {} = \<infinity>) = (finite {} \<and> (\<exists>i\<in>{}. f i = \<infinity>) \<and> (\<forall>i\<in>{}. f i \<noteq> 0))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f F = \<infinity>) = (finite F \<and> (\<exists>i\<in>F. f i = \<infinity>) \<and> (\<forall>i\<in>F. f i \<noteq> 0)); \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> f i\<rbrakk> \<Longrightarrow> (prod f (insert x F) = \<infinity>) = (finite (insert x F) \<and> (\<exists>i\<in>insert x F. f i = \<infinity>) \<and> (\<forall>i\<in>insert x F. f i \<noteq> 0))
[PROOF STEP]
case (insert i I)
[PROOF STATE]
proof (state)
this:
finite I
i \<notin> I
(\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f I = \<infinity>) = (finite I \<and> (\<exists>i\<in>I. f i = \<infinity>) \<and> (\<forall>i\<in>I. f i \<noteq> 0))
?i \<in> insert i I \<Longrightarrow> 0 \<le> f ?i

goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f {} = \<infinity>) = (finite {} \<and> (\<exists>i\<in>{}. f i = \<infinity>) \<and> (\<forall>i\<in>{}. f i \<noteq> 0))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f F = \<infinity>) = (finite F \<and> (\<exists>i\<in>F. f i = \<infinity>) \<and> (\<forall>i\<in>F. f i \<noteq> 0)); \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> f i\<rbrakk> \<Longrightarrow> (prod f (insert x F) = \<infinity>) = (finite (insert x F) \<and> (\<exists>i\<in>insert x F. f i = \<infinity>) \<and> (\<forall>i\<in>insert x F. f i \<noteq> 0))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite I
i \<notin> I
(\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f I = \<infinity>) = (finite I \<and> (\<exists>i\<in>I. f i = \<infinity>) \<and> (\<forall>i\<in>I. f i \<noteq> 0))
?i \<in> insert i I \<Longrightarrow> 0 \<le> f ?i
[PROOF STEP]
have pos: "0 \<le> f i" "0 \<le> prod f I"
[PROOF STATE]
proof (prove)
using this:
finite I
i \<notin> I
(\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f I = \<infinity>) = (finite I \<and> (\<exists>i\<in>I. f i = \<infinity>) \<and> (\<forall>i\<in>I. f i \<noteq> 0))
?i \<in> insert i I \<Longrightarrow> 0 \<le> f ?i

goal (1 subgoal):
 1. 0 \<le> f i &&& 0 \<le> prod f I
[PROOF STEP]
by (auto intro!: prod_ereal_pos)
[PROOF STATE]
proof (state)
this:
0 \<le> f i
0 \<le> prod f I

goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f {} = \<infinity>) = (finite {} \<and> (\<exists>i\<in>{}. f i = \<infinity>) \<and> (\<forall>i\<in>{}. f i \<noteq> 0))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f F = \<infinity>) = (finite F \<and> (\<exists>i\<in>F. f i = \<infinity>) \<and> (\<forall>i\<in>F. f i \<noteq> 0)); \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> f i\<rbrakk> \<Longrightarrow> (prod f (insert x F) = \<infinity>) = (finite (insert x F) \<and> (\<exists>i\<in>insert x F. f i = \<infinity>) \<and> (\<forall>i\<in>insert x F. f i \<noteq> 0))
[PROOF STEP]
from insert
[PROOF STATE]
proof (chain)
picking this:
finite I
i \<notin> I
(\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f I = \<infinity>) = (finite I \<and> (\<exists>i\<in>I. f i = \<infinity>) \<and> (\<forall>i\<in>I. f i \<noteq> 0))
?i \<in> insert i I \<Longrightarrow> 0 \<le> f ?i
[PROOF STEP]
have "(\<Prod>j\<in>insert i I. f j) = \<infinity> \<longleftrightarrow> prod f I * f i = \<infinity>"
[PROOF STATE]
proof (prove)
using this:
finite I
i \<notin> I
(\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f I = \<infinity>) = (finite I \<and> (\<exists>i\<in>I. f i = \<infinity>) \<and> (\<forall>i\<in>I. f i \<noteq> 0))
?i \<in> insert i I \<Longrightarrow> 0 \<le> f ?i

goal (1 subgoal):
 1. (prod f (insert i I) = \<infinity>) = (prod f I * f i = \<infinity>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(prod f (insert i I) = \<infinity>) = (prod f I * f i = \<infinity>)

goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f {} = \<infinity>) = (finite {} \<and> (\<exists>i\<in>{}. f i = \<infinity>) \<and> (\<forall>i\<in>{}. f i \<noteq> 0))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f F = \<infinity>) = (finite F \<and> (\<exists>i\<in>F. f i = \<infinity>) \<and> (\<forall>i\<in>F. f i \<noteq> 0)); \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> f i\<rbrakk> \<Longrightarrow> (prod f (insert x F) = \<infinity>) = (finite (insert x F) \<and> (\<exists>i\<in>insert x F. f i = \<infinity>) \<and> (\<forall>i\<in>insert x F. f i \<noteq> 0))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(prod f (insert i I) = \<infinity>) = (prod f I * f i = \<infinity>)

goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f {} = \<infinity>) = (finite {} \<and> (\<exists>i\<in>{}. f i = \<infinity>) \<and> (\<forall>i\<in>{}. f i \<noteq> 0))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f F = \<infinity>) = (finite F \<and> (\<exists>i\<in>F. f i = \<infinity>) \<and> (\<forall>i\<in>F. f i \<noteq> 0)); \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> f i\<rbrakk> \<Longrightarrow> (prod f (insert x F) = \<infinity>) = (finite (insert x F) \<and> (\<exists>i\<in>insert x F. f i = \<infinity>) \<and> (\<forall>i\<in>insert x F. f i \<noteq> 0))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (prod f I = \<infinity> \<or> f i = \<infinity>) \<and> f i \<noteq> 0 \<and> prod f I \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (prod f I * f i = \<infinity>) = ((prod f I = \<infinity> \<or> f i = \<infinity>) \<and> f i \<noteq> 0 \<and> prod f I \<noteq> 0)
[PROOF STEP]
using prod_ereal_pos[of I f] pos
[PROOF STATE]
proof (prove)
using this:
(\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> 0 \<le> prod f I
0 \<le> f i
0 \<le> prod f I

goal (1 subgoal):
 1. (prod f I * f i = \<infinity>) = ((prod f I = \<infinity> \<or> f i = \<infinity>) \<and> f i \<noteq> 0 \<and> prod f I \<noteq> 0)
[PROOF STEP]
by (cases rule: ereal2_cases[of "f i" "prod f I"]) auto
[PROOF STATE]
proof (state)
this:
(prod f I * f i = \<infinity>) = ((prod f I = \<infinity> \<or> f i = \<infinity>) \<and> f i \<noteq> 0 \<and> prod f I \<noteq> 0)

goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f {} = \<infinity>) = (finite {} \<and> (\<exists>i\<in>{}. f i = \<infinity>) \<and> (\<forall>i\<in>{}. f i \<noteq> 0))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f F = \<infinity>) = (finite F \<and> (\<exists>i\<in>F. f i = \<infinity>) \<and> (\<forall>i\<in>F. f i \<noteq> 0)); \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> f i\<rbrakk> \<Longrightarrow> (prod f (insert x F) = \<infinity>) = (finite (insert x F) \<and> (\<exists>i\<in>insert x F. f i = \<infinity>) \<and> (\<forall>i\<in>insert x F. f i \<noteq> 0))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(prod f I * f i = \<infinity>) = ((prod f I = \<infinity> \<or> f i = \<infinity>) \<and> f i \<noteq> 0 \<and> prod f I \<noteq> 0)

goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f {} = \<infinity>) = (finite {} \<and> (\<exists>i\<in>{}. f i = \<infinity>) \<and> (\<forall>i\<in>{}. f i \<noteq> 0))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f F = \<infinity>) = (finite F \<and> (\<exists>i\<in>F. f i = \<infinity>) \<and> (\<forall>i\<in>F. f i \<noteq> 0)); \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> f i\<rbrakk> \<Longrightarrow> (prod f (insert x F) = \<infinity>) = (finite (insert x F) \<and> (\<exists>i\<in>insert x F. f i = \<infinity>) \<and> (\<forall>i\<in>insert x F. f i \<noteq> 0))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> finite (insert i I) \<and> (\<exists>j\<in>insert i I. f j = \<infinity>) \<and> (\<forall>j\<in>insert i I. f j \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((prod f I = \<infinity> \<or> f i = \<infinity>) \<and> f i \<noteq> 0 \<and> prod f I \<noteq> 0) = (finite (insert i I) \<and> (\<exists>j\<in>insert i I. f j = \<infinity>) \<and> (\<forall>j\<in>insert i I. f j \<noteq> 0))
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
finite I
i \<notin> I
(\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f I = \<infinity>) = (finite I \<and> (\<exists>i\<in>I. f i = \<infinity>) \<and> (\<forall>i\<in>I. f i \<noteq> 0))
?i \<in> insert i I \<Longrightarrow> 0 \<le> f ?i

goal (1 subgoal):
 1. ((prod f I = \<infinity> \<or> f i = \<infinity>) \<and> f i \<noteq> 0 \<and> prod f I \<noteq> 0) = (finite (insert i I) \<and> (\<exists>j\<in>insert i I. f j = \<infinity>) \<and> (\<forall>j\<in>insert i I. f j \<noteq> 0))
[PROOF STEP]
by (auto simp: prod_ereal_0)
[PROOF STATE]
proof (state)
this:
((prod f I = \<infinity> \<or> f i = \<infinity>) \<and> f i \<noteq> 0 \<and> prod f I \<noteq> 0) = (finite (insert i I) \<and> (\<exists>j\<in>insert i I. f j = \<infinity>) \<and> (\<forall>j\<in>insert i I. f j \<noteq> 0))

goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f {} = \<infinity>) = (finite {} \<and> (\<exists>i\<in>{}. f i = \<infinity>) \<and> (\<forall>i\<in>{}. f i \<noteq> 0))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f F = \<infinity>) = (finite F \<and> (\<exists>i\<in>F. f i = \<infinity>) \<and> (\<forall>i\<in>F. f i \<noteq> 0)); \<And>i. i \<in> insert x F \<Longrightarrow> 0 \<le> f i\<rbrakk> \<Longrightarrow> (prod f (insert x F) = \<infinity>) = (finite (insert x F) \<and> (\<exists>i\<in>insert x F. f i = \<infinity>) \<and> (\<forall>i\<in>insert x F. f i \<noteq> 0))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(prod f (insert i I) = \<infinity>) = (finite (insert i I) \<and> (\<exists>j\<in>insert i I. f j = \<infinity>) \<and> (\<forall>j\<in>insert i I. f j \<noteq> 0))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(prod f (insert i I) = \<infinity>) = (finite (insert i I) \<and> (\<exists>j\<in>insert i I. f j = \<infinity>) \<and> (\<forall>j\<in>insert i I. f j \<noteq> 0))

goal (1 subgoal):
 1. (prod f (insert i I) = \<infinity>) = (finite (insert i I) \<and> (\<exists>i\<in>insert i I. f i = \<infinity>) \<and> (\<forall>i\<in>insert i I. f i \<noteq> 0))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(prod f (insert i I) = \<infinity>) = (finite (insert i I) \<and> (\<exists>i\<in>insert i I. f i = \<infinity>) \<and> (\<forall>i\<in>insert i I. f i \<noteq> 0))

goal (1 subgoal):
 1. (\<And>i. i \<in> {} \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (prod f {} = \<infinity>) = (finite {} \<and> (\<exists>i\<in>{}. f i = \<infinity>) \<and> (\<forall>i\<in>{}. f i \<noteq> 0))
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
(prod f I = \<infinity>) = (finite I \<and> (\<exists>i\<in>I. f i = \<infinity>) \<and> (\<forall>i\<in>I. f i \<noteq> 0))

goal (1 subgoal):
 1. infinite I \<Longrightarrow> (prod f I = \<infinity>) = (finite I \<and> (\<exists>i\<in>I. f i = \<infinity>) \<and> (\<forall>i\<in>I. f i \<noteq> 0))
[PROOF STEP]
qed auto


[STATEMENT]
lemma less_ceiling_iff: "z < \<lceil>x\<rceil> \<longleftrightarrow> of_int z < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z < \<lceil>x\<rceil>) = (of_int z < x)
[PROOF STEP]
by (simp add: not_le [symmetric] ceiling_le_iff)


[STATEMENT]
lemma ordermap_eq_iff [simp]:
  "\<lbrakk>x \<in> A; y \<in> A; wf r; total_on A r; small A\<rbrakk> \<Longrightarrow> ordermap A r x = ordermap A r y \<longleftrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> A; y \<in> A; wf r; total_on A r; small A\<rbrakk> \<Longrightarrow> (ordermap A r x = ordermap A r y) = (x = y)
[PROOF STEP]
by (metis bij_betw_iff_bijections ordermap_bij)


[STATEMENT]
lemma ordinal_exp_0 [simp]: "x ** 0 = (1::ordinal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ** 0 = 1
[PROOF STEP]
by (simp add: exp_ordinal_def)


[STATEMENT]
lemma convergent_prod_inverse_iff [simp]: "convergent_prod (\<lambda>n. inverse (f n)) \<longleftrightarrow> convergent_prod f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent_prod (\<lambda>n. inverse (f n)) = convergent_prod f
[PROOF STEP]
by (auto dest: convergent_prod_inverse)


[STATEMENT]
lemma at_conj_distr:"\<Turnstile>(\<^bold>@c ( \<phi> \<^bold>\<and> \<psi>)) \<^bold>\<leftrightarrow> ((\<^bold>@c \<phi>) \<^bold>\<and> (\<^bold>@c \<psi>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>ts v. (\<forall>v'. v = c > v' \<longrightarrow> \<phi> ts v' \<and> \<psi> ts v') = ((\<forall>v'. v = c > v' \<longrightarrow> \<phi> ts v') \<and> (\<forall>v'. v = c > v' \<longrightarrow> \<psi> ts v'))
[PROOF STEP]
using switch_unique
[PROOF STATE]
proof (prove)
using this:
?v = ?c > ?u \<and> ?v = ?c > ?w \<longrightarrow> ?u = ?w

goal (1 subgoal):
 1. \<forall>ts v. (\<forall>v'. v = c > v' \<longrightarrow> \<phi> ts v' \<and> \<psi> ts v') = ((\<forall>v'. v = c > v' \<longrightarrow> \<phi> ts v') \<and> (\<forall>v'. v = c > v' \<longrightarrow> \<psi> ts v'))
[PROOF STEP]
by blast


[STATEMENT]
lemma ccSUP_inf:
  "countable B \<Longrightarrow> inf (SUP b\<in>B. f b) a = (SUP b\<in>B. inf (f b) a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable B \<Longrightarrow> inf (Sup (f ` B)) a = (SUP b\<in>B. inf (f b) a)
[PROOF STEP]
by (simp add: inf_ccSUP inf_commute)


[STATEMENT]
lemma recurrent_subset_meas [measurable]:
  assumes [measurable]: "A \<in> sets M"
  shows "recurrent_subset A \<in> sets M"
        "recurrent_subset_infty A \<in> sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. recurrent_subset A \<in> sets M &&& recurrent_subset_infty A \<in> sets M
[PROOF STEP]
unfolding recurrent_subset_def recurrent_subset_infty_def'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>n\<in>{1..}. A \<inter> (T ^^ n) -` A) \<in> sets M &&& (\<Inter>m. \<Union>n\<in>{m..}. A \<inter> (T ^^ n) -` A) \<in> sets M
[PROOF STEP]
by measurable


[STATEMENT]
lemma map_poly_R_hom_commute:
  "poly (map_poly R\<^sub>1 p) (R\<^sub>2 x) = R\<^sub>2 (poly (map_poly hom p) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (map_poly R\<^sub>1 p) (R\<^sub>2 x) = R\<^sub>2 (poly (map_poly hom p) x)
[PROOF STEP]
apply (induct p)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. poly (map_poly R\<^sub>1 0) (R\<^sub>2 x) = R\<^sub>2 (poly (map_poly hom 0) x)
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; poly (map_poly R\<^sub>1 p) (R\<^sub>2 x) = R\<^sub>2 (poly (map_poly hom p) x)\<rbrakk> \<Longrightarrow> poly (map_poly R\<^sub>1 (pCons a p)) (R\<^sub>2 x) = R\<^sub>2 (poly (map_poly hom (pCons a p)) x)
[PROOF STEP]
using r2.hom_add r2.hom_mult R_hom
[PROOF STATE]
proof (prove)
using this:
R\<^sub>2 (?x + ?y) = R\<^sub>2 ?x + R\<^sub>2 ?y
R\<^sub>2 (?x * ?y) = R\<^sub>2 ?x * R\<^sub>2 ?y
R\<^sub>1 ?x = R\<^sub>2 (hom ?x)

goal (2 subgoals):
 1. poly (map_poly R\<^sub>1 0) (R\<^sub>2 x) = R\<^sub>2 (poly (map_poly hom 0) x)
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; poly (map_poly R\<^sub>1 p) (R\<^sub>2 x) = R\<^sub>2 (poly (map_poly hom p) x)\<rbrakk> \<Longrightarrow> poly (map_poly R\<^sub>1 (pCons a p)) (R\<^sub>2 x) = R\<^sub>2 (poly (map_poly hom (pCons a p)) x)
[PROOF STEP]
by auto


[STATEMENT]
lemma graph_union_edges[simp]:
"edges (graph_union G\<^sub>1 G\<^sub>2) = edges G\<^sub>1 \<union> edges G\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. edges (graph_union G\<^sub>1 G\<^sub>2) = edges G\<^sub>1 \<union> edges G\<^sub>2
[PROOF STEP]
unfolding graph_union_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. edges (LG (edges G\<^sub>1 \<union> edges G\<^sub>2) (vertices G\<^sub>1 \<union> vertices G\<^sub>2)) = edges G\<^sub>1 \<union> edges G\<^sub>2
[PROOF STEP]
by auto


[STATEMENT]
lemma lfp_exp_unitary:
  "(\<And>P. unitary P \<Longrightarrow> unitary (t P)) \<Longrightarrow> unitary (lfp_exp t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P. unitary P \<Longrightarrow> unitary (t P)) \<Longrightarrow> unitary (lfp_exp t)
[PROOF STEP]
proof(intro unitaryI[OF lfp_exp_sound lfp_exp_bound], simp_all)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>P. unitary P \<Longrightarrow> unitary (t P)) \<Longrightarrow> t ?R2 \<tturnstile> ?R2
 2. (\<And>P. unitary P \<Longrightarrow> unitary (t P)) \<Longrightarrow> sound ?R2
[PROOF STEP]
assume IH: "\<And>P. unitary P \<Longrightarrow> unitary (t P)"
[PROOF STATE]
proof (state)
this:
unitary ?P \<Longrightarrow> unitary (t ?P)

goal (2 subgoals):
 1. (\<And>P. unitary P \<Longrightarrow> unitary (t P)) \<Longrightarrow> t ?R2 \<tturnstile> ?R2
 2. (\<And>P. unitary P \<Longrightarrow> unitary (t P)) \<Longrightarrow> sound ?R2
[PROOF STEP]
have "unitary (\<lambda>s. 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary (\<lambda>s. 1)
[PROOF STEP]
by(auto)
[PROOF STATE]
proof (state)
this:
unitary (\<lambda>s. 1)

goal (2 subgoals):
 1. (\<And>P. unitary P \<Longrightarrow> unitary (t P)) \<Longrightarrow> t ?R2 \<tturnstile> ?R2
 2. (\<And>P. unitary P \<Longrightarrow> unitary (t P)) \<Longrightarrow> sound ?R2
[PROOF STEP]
with IH
[PROOF STATE]
proof (chain)
picking this:
unitary ?P \<Longrightarrow> unitary (t ?P)
unitary (\<lambda>s. 1)
[PROOF STEP]
have "unitary (t (\<lambda>s. 1))"
[PROOF STATE]
proof (prove)
using this:
unitary ?P \<Longrightarrow> unitary (t ?P)
unitary (\<lambda>s. 1)

goal (1 subgoal):
 1. unitary (t (\<lambda>s. 1))
[PROOF STEP]
by(auto)
[PROOF STATE]
proof (state)
this:
unitary (t (\<lambda>s. 1))

goal (2 subgoals):
 1. (\<And>P. unitary P \<Longrightarrow> unitary (t P)) \<Longrightarrow> t ?R2 \<tturnstile> ?R2
 2. (\<And>P. unitary P \<Longrightarrow> unitary (t P)) \<Longrightarrow> sound ?R2
[PROOF STEP]
thus "t (\<lambda>s. 1) \<tturnstile> \<lambda>s. 1"
[PROOF STATE]
proof (prove)
using this:
unitary (t (\<lambda>s. 1))

goal (1 subgoal):
 1. t (\<lambda>s. 1) \<tturnstile> \<lambda>s. 1
[PROOF STEP]
by(auto)
[PROOF STATE]
proof (state)
this:
t (\<lambda>s. 1) \<tturnstile> \<lambda>s. 1

goal (1 subgoal):
 1. (\<And>P. unitary P \<Longrightarrow> unitary (t P)) \<Longrightarrow> sound (\<lambda>s. 1)
[PROOF STEP]
show "sound (\<lambda>s. 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sound (\<lambda>s. 1)
[PROOF STEP]
by(auto)
[PROOF STATE]
proof (state)
this:
sound (\<lambda>s. 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_sel_revorder_eq_inorder_y: "list_sel f xs (revorder r) = list_sel f xs (inorder r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_sel f xs (revorder r) = list_sel f xs (inorder r)
[PROOF STEP]
unfolding revorder_eq_rev_inorder
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_sel f xs (rev (inorder r)) = list_sel f xs (inorder r)
[PROOF STEP]
using mset_y_eq_list_sel_eq mset_rev
[PROOF STATE]
proof (prove)
using this:
mset ?y = mset ?y' \<Longrightarrow> list_sel ?f ?x ?y = list_sel ?f ?x ?y'
mset (rev ?xs) = mset ?xs

goal (1 subgoal):
 1. list_sel f xs (rev (inorder r)) = list_sel f xs (inorder r)
[PROOF STEP]
by blast


[STATEMENT]
lemma Suc_pred_image[simp]: "0 \<notin> P \<Longrightarrow> (\<lambda>x. Suc (x - Suc 0)) ` P = P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<notin> P \<Longrightarrow> (\<lambda>x. Suc (x - Suc 0)) ` P = P
[PROOF STEP]
unfolding image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<notin> P \<Longrightarrow> {y. \<exists>x\<in>P. y = Suc (x - Suc 0)} = P
[PROOF STEP]
by safe (metis Suc_pred neq0_conv)+


[STATEMENT]
lemma lin_dep_cols_imp_det_0:
  assumes A: "A \<in> carrier_mat n n" and ld: "lin_dep (set (cols A))"
  shows "det A = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (0::'a)
[PROOF STEP]
have col_rw: "(cols (mat_of_cols n (cols A))) = cols A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cols (mat_of_cols n (cols A)) = cols A
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n

goal (1 subgoal):
 1. cols (mat_of_cols n (cols A)) = cols A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cols (mat_of_cols n (cols A)) = cols A

goal (1 subgoal):
 1. det A = (0::'a)
[PROOF STEP]
have m: "mat_of_cols n (cols A) = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cols n (cols A) = A
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n

goal (1 subgoal):
 1. mat_of_cols n (cols A) = A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat_of_cols n (cols A) = A

goal (1 subgoal):
 1. det A = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = (0::'a)
[PROOF STEP]
by (rule A lin_dep_cols_imp_det_0'[of "cols A", unfolded col_rw, unfolded m, OF _ A ld])
     (metis A cols_dim carrier_matD(1) subsetCE carrier_vecD)
[PROOF STATE]
proof (state)
this:
det A = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lc_row_to_poly_pivot_fun:
  assumes "card S = dim_col (A::'b::semiring_1 mat)" and "pivot_fun A f (dim_col A)"
    and "i < dim_row A" and "f i < dim_col A"
  shows "lc ((mat_to_polys (pps_to_list S) A) ! i) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lc (mat_to_polys (pps_to_list S) A ! i) = (1::'b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lc (mat_to_polys (pps_to_list S) A ! i) = (1::'b)
[PROOF STEP]
let ?ts = "pps_to_list S"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lc (mat_to_polys (pps_to_list S) A ! i) = (1::'b)
[PROOF STEP]
have len_ts: "length ?ts = dim_col A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (pps_to_list S) = dim_col A
[PROOF STEP]
by (simp only: length_pps_to_list assms(1))
[PROOF STATE]
proof (state)
this:
length (pps_to_list S) = dim_col A

goal (1 subgoal):
 1. lc (mat_to_polys (pps_to_list S) A ! i) = (1::'b)
[PROOF STEP]
have "lookup (row_to_poly ?ts (row A i)) (?ts ! f i) = (row A i) $ (f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (row_to_poly (pps_to_list S) (row A i)) (pps_to_list S ! f i) = row A i $ f i
[PROOF STEP]
by (rule lookup_row_to_poly, fact distinct_pps_to_list, simp_all add: len_ts assms(4))
[PROOF STATE]
proof (state)
this:
lookup (row_to_poly (pps_to_list S) (row A i)) (pps_to_list S ! f i) = row A i $ f i

goal (1 subgoal):
 1. lc (mat_to_polys (pps_to_list S) A ! i) = (1::'b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lookup (row_to_poly (pps_to_list S) (row A i)) (pps_to_list S ! f i) = row A i $ f i

goal (1 subgoal):
 1. lc (mat_to_polys (pps_to_list S) A ! i) = (1::'b)
[PROOF STEP]
have "... = A $$ (i, f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row A i $ f i = A $$ (i, f i)
[PROOF STEP]
using assms(3) assms(4)
[PROOF STATE]
proof (prove)
using this:
i < dim_row A
f i < dim_col A

goal (1 subgoal):
 1. row A i $ f i = A $$ (i, f i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
row A i $ f i = A $$ (i, f i)

goal (1 subgoal):
 1. lc (mat_to_polys (pps_to_list S) A ! i) = (1::'b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lookup (row_to_poly (pps_to_list S) (row A i)) (pps_to_list S ! f i) = A $$ (i, f i)
[PROOF STEP]
have eq: "lookup (row_to_poly ?ts (row A i)) (?ts ! f i) = A $$ (i, f i)"
[PROOF STATE]
proof (prove)
using this:
lookup (row_to_poly (pps_to_list S) (row A i)) (pps_to_list S ! f i) = A $$ (i, f i)

goal (1 subgoal):
 1. lookup (row_to_poly (pps_to_list S) (row A i)) (pps_to_list S ! f i) = A $$ (i, f i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
lookup (row_to_poly (pps_to_list S) (row A i)) (pps_to_list S ! f i) = A $$ (i, f i)

goal (1 subgoal):
 1. lc (mat_to_polys (pps_to_list S) A ! i) = (1::'b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lc (mat_to_polys (pps_to_list S) A ! i) = (1::'b)
[PROOF STEP]
by (simp only: lc_def lt_row_to_poly_pivot_fun[OF assms], simp only: mat_to_polys_nth[OF assms(3)] eq,
        rule pivot_funD, rule refl, fact+)
[PROOF STATE]
proof (state)
this:
lc (mat_to_polys (pps_to_list S) A ! i) = (1::'b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_Lambert_W_1:
  assumes "(f \<longlongrightarrow> L) F" "eventually (\<lambda>x. f x \<ge> -exp (-1)) F"
  shows   "((\<lambda>x. Lambert_W (f x)) \<longlongrightarrow> Lambert_W L) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. Lambert_W (f x)) \<longlongrightarrow> Lambert_W L) F
[PROOF STEP]
proof (cases "F = bot")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. F = bot \<Longrightarrow> ((\<lambda>x. Lambert_W (f x)) \<longlongrightarrow> Lambert_W L) F
 2. F \<noteq> bot \<Longrightarrow> ((\<lambda>x. Lambert_W (f x)) \<longlongrightarrow> Lambert_W L) F
[PROOF STEP]
case [simp]: False
[PROOF STATE]
proof (state)
this:
F \<noteq> bot

goal (2 subgoals):
 1. F = bot \<Longrightarrow> ((\<lambda>x. Lambert_W (f x)) \<longlongrightarrow> Lambert_W L) F
 2. F \<noteq> bot \<Longrightarrow> ((\<lambda>x. Lambert_W (f x)) \<longlongrightarrow> Lambert_W L) F
[PROOF STEP]
from tendsto_lowerbound[OF assms]
[PROOF STATE]
proof (chain)
picking this:
F \<noteq> bot \<Longrightarrow> - exp (- 1) \<le> L
[PROOF STEP]
have "L \<ge> -exp (-1)"
[PROOF STATE]
proof (prove)
using this:
F \<noteq> bot \<Longrightarrow> - exp (- 1) \<le> L

goal (1 subgoal):
 1. - exp (- 1) \<le> L
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- exp (- 1) \<le> L

goal (2 subgoals):
 1. F = bot \<Longrightarrow> ((\<lambda>x. Lambert_W (f x)) \<longlongrightarrow> Lambert_W L) F
 2. F \<noteq> bot \<Longrightarrow> ((\<lambda>x. Lambert_W (f x)) \<longlongrightarrow> Lambert_W L) F
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
- exp (- 1) \<le> L

goal (1 subgoal):
 1. ((\<lambda>x. Lambert_W (f x)) \<longlongrightarrow> Lambert_W L) F
[PROOF STEP]
using continuous_on_tendsto_compose[OF continuous_on_Lambert_W assms(1)] assms(2)
[PROOF STATE]
proof (prove)
using this:
- exp (- 1) \<le> L
\<lbrakk>L \<in> {- exp (- 1)..}; \<forall>\<^sub>F x in F. f x \<in> {- exp (- 1)..}\<rbrakk> \<Longrightarrow> ((\<lambda>x. Lambert_W (f x)) \<longlongrightarrow> Lambert_W L) F
\<forall>\<^sub>F x in F. - exp (- 1) \<le> f x

goal (1 subgoal):
 1. ((\<lambda>x. Lambert_W (f x)) \<longlongrightarrow> Lambert_W L) F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. Lambert_W (f x)) \<longlongrightarrow> Lambert_W L) F

goal (1 subgoal):
 1. F = bot \<Longrightarrow> ((\<lambda>x. Lambert_W (f x)) \<longlongrightarrow> Lambert_W L) F
[PROOF STEP]
qed auto


[STATEMENT]
lemma monotoneE: "\<lbrakk>monotone f A r; x \<in> A; y \<in> A; (x, y) \<in> r\<rbrakk> \<Longrightarrow> (f x, f y) \<in> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Tarski.monotone f A r; x \<in> A; y \<in> A; (x, y) \<in> r\<rbrakk> \<Longrightarrow> (f x, f y) \<in> r
[PROOF STEP]
by (simp add: monotone_def)


[STATEMENT]
lemma Ramsey_eq:
  "Ramsey \<F> r \<longleftrightarrow> (\<forall>f \<in> \<F> \<rightarrow> {..<r}.
                       \<forall>M. infinite M \<longrightarrow>
                           (\<exists>N i. N \<subseteq> M \<and> infinite N \<and> i<r \<and> \<F> \<inter> Pow N \<subseteq> f -` {i}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ramsey \<F> r = (\<forall>f\<in>\<F> \<rightarrow> {..<r}. \<forall>M. infinite M \<longrightarrow> (\<exists>N i. N \<subseteq> M \<and> infinite N \<and> i < r \<and> \<F> \<inter> Pow N \<subseteq> f -` {i}))
[PROOF STEP]
unfolding Ramsey_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>f\<in>\<F> \<rightarrow> {..<r}. \<forall>M. infinite M \<longrightarrow> (\<exists>N i. N \<subseteq> M \<and> infinite N \<and> i < r \<and> (\<forall>j<r. j \<noteq> i \<longrightarrow> f -` {j} \<inter> \<F> \<inter> Pow N = {}))) = (\<forall>f\<in>\<F> \<rightarrow> {..<r}. \<forall>M. infinite M \<longrightarrow> (\<exists>N i. N \<subseteq> M \<and> infinite N \<and> i < r \<and> \<F> \<inter> Pow N \<subseteq> f -` {i}))
[PROOF STEP]
by (intro ball_cong all_cong ex_cong1 conj_cong refl) blast


[STATEMENT]
lemma monotone_map_prod [simp]:
  "monotone (rel_prod orda ordb) (rel_prod ordc ordd) (map_prod f g) \<longleftrightarrow>
   monotone orda ordc f \<and> monotone ordb ordd g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monotone (rel_prod orda ordb) (rel_prod ordc ordd) (map_prod f g) = (monotone orda ordc f \<and> monotone ordb ordd g)
[PROOF STEP]
by(auto simp add: monotone_def)


[STATEMENT]
lemma min_product_set_code[code]:
  "\<Otimes>\<^sub>m (set xs) = fold min_product (remdups xs) {{||}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Otimes>\<^sub>m (set xs) = fold (\<otimes>\<^sub>m) (remdups xs) {{||}}
[PROOF STEP]
by (simp add: min_product_set_def min_product_set_thms.fold_set_fold_remdups)


[STATEMENT]
lemma halt_lemma2'':
  "\<lbrakk>P (f n); \<not> P (f (0::nat))\<rbrakk> \<Longrightarrow>
         \<exists> n. (P (f n) \<and> (\<forall> i < n. \<not> P (f i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P (f n); \<not> P (f 0)\<rbrakk> \<Longrightarrow> \<exists>n. P (f n) \<and> (\<forall>i<n. \<not> P (f i))
[PROOF STEP]
apply(induct n rule: nat_less_induct, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma continuous_on_diff_ennreal:
  "continuous_on A f \<Longrightarrow> continuous_on A g \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> f x \<noteq> top) \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> g x \<noteq> top) \<Longrightarrow> continuous_on A (\<lambda>z. f z - g z::ennreal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on A f; continuous_on A g; \<And>x. x \<in> A \<Longrightarrow> f x \<noteq> top; \<And>x. x \<in> A \<Longrightarrow> g x \<noteq> top\<rbrakk> \<Longrightarrow> continuous_on A (\<lambda>z. f z - g z)
[PROOF STEP]
including ennreal.lifting
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on A f; continuous_on A g; \<And>x. x \<in> A \<Longrightarrow> f x \<noteq> top; \<And>x. x \<in> A \<Longrightarrow> g x \<noteq> top\<rbrakk> \<Longrightarrow> continuous_on A (\<lambda>z. f z - g z)
[PROOF STEP]
proof (transfer fixing: A, simp add: top_ereal_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f g. \<lbrakk>\<forall>x. 0 \<le> f x; continuous_on A f; \<forall>x. 0 \<le> g x; continuous_on A g; \<And>x. x \<in> A \<Longrightarrow> f x \<noteq> \<infinity>; \<And>x. x \<in> A \<Longrightarrow> g x \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> continuous_on A (\<lambda>z. max 0 (f z - g z))
[PROOF STEP]
fix f g :: "'a \<Rightarrow> ereal"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f g. \<lbrakk>\<forall>x. 0 \<le> f x; continuous_on A f; \<forall>x. 0 \<le> g x; continuous_on A g; \<And>x. x \<in> A \<Longrightarrow> f x \<noteq> \<infinity>; \<And>x. x \<in> A \<Longrightarrow> g x \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> continuous_on A (\<lambda>z. max 0 (f z - g z))
[PROOF STEP]
assume "\<forall>x. 0 \<le> f x" "\<forall>x. 0 \<le> g x" "continuous_on A f" "continuous_on A g"
[PROOF STATE]
proof (state)
this:
\<forall>x. 0 \<le> f x
\<forall>x. 0 \<le> g x
continuous_on A f
continuous_on A g

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>\<forall>x. 0 \<le> f x; continuous_on A f; \<forall>x. 0 \<le> g x; continuous_on A g; \<And>x. x \<in> A \<Longrightarrow> f x \<noteq> \<infinity>; \<And>x. x \<in> A \<Longrightarrow> g x \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> continuous_on A (\<lambda>z. max 0 (f z - g z))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>x. 0 \<le> f x
\<forall>x. 0 \<le> g x
continuous_on A f
continuous_on A g

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>\<forall>x. 0 \<le> f x; continuous_on A f; \<forall>x. 0 \<le> g x; continuous_on A g; \<And>x. x \<in> A \<Longrightarrow> f x \<noteq> \<infinity>; \<And>x. x \<in> A \<Longrightarrow> g x \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> continuous_on A (\<lambda>z. max 0 (f z - g z))
[PROOF STEP]
assume "f x \<noteq> \<infinity>" "g x \<noteq> \<infinity>" if "x \<in> A" for x
[PROOF STATE]
proof (state)
this:
?x \<in> A \<Longrightarrow> f ?x \<noteq> \<infinity>
?x \<in> A \<Longrightarrow> g ?x \<noteq> \<infinity>

goal (1 subgoal):
 1. \<And>f g. \<lbrakk>\<forall>x. 0 \<le> f x; continuous_on A f; \<forall>x. 0 \<le> g x; continuous_on A g; \<And>x. x \<in> A \<Longrightarrow> f x \<noteq> \<infinity>; \<And>x. x \<in> A \<Longrightarrow> g x \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> continuous_on A (\<lambda>z. max 0 (f z - g z))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. 0 \<le> f x
\<forall>x. 0 \<le> g x
continuous_on A f
continuous_on A g
?x \<in> A \<Longrightarrow> f ?x \<noteq> \<infinity>
?x \<in> A \<Longrightarrow> g ?x \<noteq> \<infinity>
[PROOF STEP]
show "continuous_on A (\<lambda>z. max 0 (f z - g z))"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. 0 \<le> f x
\<forall>x. 0 \<le> g x
continuous_on A f
continuous_on A g
?x \<in> A \<Longrightarrow> f ?x \<noteq> \<infinity>
?x \<in> A \<Longrightarrow> g ?x \<noteq> \<infinity>

goal (1 subgoal):
 1. continuous_on A (\<lambda>z. max 0 (f z - g z))
[PROOF STEP]
by (intro continuous_on_max continuous_on_const continuous_on_diff_ereal) auto
[PROOF STATE]
proof (state)
this:
continuous_on A (\<lambda>z. max 0 (f z - g z))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lm027:
  assumes "(\<Union> P1) \<inter> (\<Union> P2) = {}"
          "is_non_overlapping P1"
          "is_non_overlapping P2"
  shows "is_non_overlapping (P1 \<union> P2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_non_overlapping (P1 \<union> P2)
[PROOF STEP]
unfolding is_non_overlapping_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>X\<in>P1 \<union> P2. \<forall>Y\<in>P1 \<union> P2. (X \<inter> Y \<noteq> {}) = (X = Y)
[PROOF STEP]
using assms lm025 lm026
[PROOF STATE]
proof (prove)
using this:
\<Union> P1 \<inter> \<Union> P2 = {}
is_non_overlapping P1
is_non_overlapping P2
\<lbrakk>\<Union> ?P1.0 \<inter> \<Union> ?P2.0 = {}; is_non_overlapping ?P1.0; is_non_overlapping ?P2.0; ?X \<in> ?P1.0 \<union> ?P2.0; ?Y \<in> ?P1.0 \<union> ?P2.0; ?X \<inter> ?Y \<noteq> {}\<rbrakk> \<Longrightarrow> ?X = ?Y
\<lbrakk>\<Union> ?P1.0 \<inter> \<Union> ?P2.0 = {}; is_non_overlapping ?P1.0; is_non_overlapping ?P2.0; ?X \<in> ?P1.0 \<union> ?P2.0; ?Y \<in> ?P1.0 \<union> ?P2.0; ?X = ?Y\<rbrakk> \<Longrightarrow> ?X \<inter> ?Y \<noteq> {}

goal (1 subgoal):
 1. \<forall>X\<in>P1 \<union> P2. \<forall>Y\<in>P1 \<union> P2. (X \<inter> Y \<noteq> {}) = (X = Y)
[PROOF STEP]
by metis


[STATEMENT]
lemma alg_dvd_mult2 [simp]:
  fixes a b c :: "'a :: field_char_0"
  shows "a alg_dvd b \<Longrightarrow> algebraic_int c \<Longrightarrow> a alg_dvd (b * c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a alg_dvd b; algebraic_int c\<rbrakk> \<Longrightarrow> a alg_dvd b * c
[PROOF STEP]
using alg_dvd_mult[of a b c]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>a alg_dvd b; algebraic_int c\<rbrakk> \<Longrightarrow> a alg_dvd c * b

goal (1 subgoal):
 1. \<lbrakk>a alg_dvd b; algebraic_int c\<rbrakk> \<Longrightarrow> a alg_dvd b * c
[PROOF STEP]
by (simp add: mult.commute)


[STATEMENT]
lemma NSLIMSEQ_norm: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> (\<lambda>n. norm (X n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S norm a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> (\<lambda>n. norm (X n)) \<longlonglongrightarrow>\<^sub>N\<^sub>S norm a
[PROOF STEP]
by (simp add: NSLIMSEQ_def starfun_hnorm [symmetric] approx_hnorm)


[STATEMENT]
lemma residue_holo:
  assumes "open s" "z \<in> s" and f_holo: "f holomorphic_on s"
  shows "residue f z = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue f z = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. residue f z = 0
[PROOF STEP]
define c where "c \<equiv> 2 * pi * \<i>"
[PROOF STATE]
proof (state)
this:
c \<equiv> complex_of_real (2 * pi) * \<i>

goal (1 subgoal):
 1. residue f z = 0
[PROOF STEP]
obtain e where "e>0" and e_cball:"cball z e \<subseteq> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; cball z e \<subseteq> s\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>open s\<close> \<open>z\<in>s\<close>
[PROOF STATE]
proof (prove)
using this:
open s
z \<in> s

goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; cball z e \<subseteq> s\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using open_contains_cball_eq
[PROOF STATE]
proof (prove)
using this:
open s
z \<in> s
open ?S \<Longrightarrow> \<forall>x. (x \<in> ?S) = (\<exists>e>0. cball x e \<subseteq> ?S)

goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; cball z e \<subseteq> s\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 < e
cball z e \<subseteq> s

goal (1 subgoal):
 1. residue f z = 0
[PROOF STEP]
have "(f has_contour_integral c*residue f z) (circlepath z e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_contour_integral c * residue f z) (circlepath z e)
[PROOF STEP]
using f_holo
[PROOF STATE]
proof (prove)
using this:
f holomorphic_on s

goal (1 subgoal):
 1. (f has_contour_integral c * residue f z) (circlepath z e)
[PROOF STEP]
by (auto intro: base_residue[OF \<open>open s\<close> \<open>z\<in>s\<close> \<open>e>0\<close> _ e_cball,folded c_def])
[PROOF STATE]
proof (state)
this:
(f has_contour_integral c * residue f z) (circlepath z e)

goal (1 subgoal):
 1. residue f z = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(f has_contour_integral c * residue f z) (circlepath z e)

goal (1 subgoal):
 1. residue f z = 0
[PROOF STEP]
have "(f has_contour_integral 0) (circlepath z e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_contour_integral 0) (circlepath z e)
[PROOF STEP]
using f_holo e_cball \<open>e>0\<close>
[PROOF STATE]
proof (prove)
using this:
f holomorphic_on s
cball z e \<subseteq> s
0 < e

goal (1 subgoal):
 1. (f has_contour_integral 0) (circlepath z e)
[PROOF STEP]
by (auto intro: Cauchy_theorem_convex_simple[of _ "cball z e"])
[PROOF STATE]
proof (state)
this:
(f has_contour_integral 0) (circlepath z e)

goal (1 subgoal):
 1. residue f z = 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(f has_contour_integral c * residue f z) (circlepath z e)
(f has_contour_integral 0) (circlepath z e)
[PROOF STEP]
have "c*residue f z =0"
[PROOF STATE]
proof (prove)
using this:
(f has_contour_integral c * residue f z) (circlepath z e)
(f has_contour_integral 0) (circlepath z e)

goal (1 subgoal):
 1. c * residue f z = 0
[PROOF STEP]
using has_contour_integral_unique
[PROOF STATE]
proof (prove)
using this:
(f has_contour_integral c * residue f z) (circlepath z e)
(f has_contour_integral 0) (circlepath z e)
\<lbrakk>(?f has_contour_integral ?i) ?g; (?f has_contour_integral ?j) ?g\<rbrakk> \<Longrightarrow> ?i = ?j

goal (1 subgoal):
 1. c * residue f z = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
c * residue f z = 0

goal (1 subgoal):
 1. residue f z = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
c * residue f z = 0

goal (1 subgoal):
 1. residue f z = 0
[PROOF STEP]
unfolding c_def
[PROOF STATE]
proof (prove)
using this:
complex_of_real (2 * pi) * \<i> * residue f z = 0

goal (1 subgoal):
 1. residue f z = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
residue f z = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_integral_subset_component_le:
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
  assumes k: "k \<in> Basis"
    and as: "S \<subseteq> T" "(f has_integral i) S" "(f has_integral j) T" "\<And>x. x\<in>T \<Longrightarrow> 0 \<le> f(x)\<bullet>k"
  shows "i\<bullet>k \<le> j\<bullet>k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<bullet> k \<le> j \<bullet> k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i \<bullet> k \<le> j \<bullet> k
[PROOF STEP]
have \<section>: "((\<lambda>x. if x \<in> S then f x else 0) has_integral i) UNIV"
          "((\<lambda>x. if x \<in> T then f x else 0) has_integral j) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. if x \<in> S then f x else (0::'m)) has_integral i) UNIV &&& ((\<lambda>x. if x \<in> T then f x else (0::'m)) has_integral j) UNIV
[PROOF STEP]
by (simp_all add: assms)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. if x \<in> S then f x else (0::'m)) has_integral i) UNIV
((\<lambda>x. if x \<in> T then f x else (0::'m)) has_integral j) UNIV

goal (1 subgoal):
 1. i \<bullet> k \<le> j \<bullet> k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<bullet> k \<le> j \<bullet> k
[PROOF STEP]
using as
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> T
(f has_integral i) S
(f has_integral j) T
?x \<in> T \<Longrightarrow> 0 \<le> f ?x \<bullet> k

goal (1 subgoal):
 1. i \<bullet> k \<le> j \<bullet> k
[PROOF STEP]
by (force intro!: has_integral_component_le[OF k \<section>])
[PROOF STATE]
proof (state)
this:
i \<bullet> k \<le> j \<bullet> k

goal:
No subgoals!
[PROOF STEP]
qed