[STATEMENT]
theorem birkhoff_sum_small_asymp_neg_nonergodic:
  assumes [measurable]: "integrable M f" and "e > (0::real)"
  shows "AE x in M. infinite {n. birkhoff_sum f n x \<in> {n * real_cond_exp M Invariants f x - e .. n * real_cond_exp M Invariants f x}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
define g where "g = (\<lambda>x. real_cond_exp M Invariants f x - f x)"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>x. real_cond_exp M Invariants f x - f x)

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
have g_meas [measurable]: "integrable M g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M g
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>x. real_cond_exp M Invariants f x - f x)
[PROOF STEP]
using real_cond_exp_int(1)[OF assms(1)] assms(1)
[PROOF STATE]
proof (prove)
using this:
integrable M (real_cond_exp M Invariants f)
integrable M f

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

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
have "AE x in M. real_cond_exp M Invariants (real_cond_exp M Invariants f) x = real_cond_exp M Invariants f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. real_cond_exp M Invariants (real_cond_exp M Invariants f) x = real_cond_exp M Invariants f x
[PROOF STEP]
by (rule real_cond_exp_F_meas, auto simp add: real_cond_exp_int(1)[OF assms(1)])
[PROOF STATE]
proof (state)
this:
AE x in M. real_cond_exp M Invariants (real_cond_exp M Invariants f) x = real_cond_exp M Invariants f x

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
AE x in M. real_cond_exp M Invariants (real_cond_exp M Invariants f) x = real_cond_exp M Invariants f x
[PROOF STEP]
have *: "AE x in M. real_cond_exp M Invariants g x = 0"
[PROOF STATE]
proof (prove)
using this:
AE x in M. real_cond_exp M Invariants (real_cond_exp M Invariants f) x = real_cond_exp M Invariants f x

goal (1 subgoal):
 1. AE x in M. real_cond_exp M Invariants g x = 0
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
using this:
AE x in M. real_cond_exp M Invariants (real_cond_exp M Invariants f) x = real_cond_exp M Invariants f x

goal (1 subgoal):
 1. AE x in M. real_cond_exp M Invariants (\<lambda>x. real_cond_exp M Invariants f x - f x) x = 0
[PROOF STEP]
using real_cond_exp_diff[OF real_cond_exp_int(1)[OF assms(1)] assms(1)]
[PROOF STATE]
proof (prove)
using this:
AE x in M. real_cond_exp M Invariants (real_cond_exp M Invariants f) x = real_cond_exp M Invariants f x
AE x in M. real_cond_exp M Invariants (\<lambda>x. real_cond_exp M Invariants f x - f x) x = real_cond_exp M Invariants (real_cond_exp M Invariants f) x - real_cond_exp M Invariants f x

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

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
have "AE x in M. infinite {n. birkhoff_sum g n x \<in> {0..e}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum g n x \<in> {0..e}}
[PROOF STEP]
by (rule birkhoff_sum_small_asymp_lemma, auto simp add: \<open>e>0\<close> * g_meas)
[PROOF STATE]
proof (state)
this:
AE x in M. infinite {n. birkhoff_sum g n x \<in> {0..e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
AE x in M. infinite {n. birkhoff_sum g n x \<in> {0..e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
AE x in M. infinite {n. birkhoff_sum g n x \<in> {0..e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
assume "x \<in> space M" "infinite {n. birkhoff_sum g n x \<in> {0..e}}"
[PROOF STATE]
proof (state)
this:
x \<in> space M
infinite {n. birkhoff_sum g n x \<in> {0..e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
x \<in> space M
infinite {n. birkhoff_sum g n x \<in> {0..e}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
assume H: "birkhoff_sum g n x \<in> {0..e}"
[PROOF STATE]
proof (state)
this:
birkhoff_sum g n x \<in> {0..e}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
have "birkhoff_sum g n x = birkhoff_sum (real_cond_exp M Invariants f) n x - birkhoff_sum f n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. birkhoff_sum g n x = birkhoff_sum (real_cond_exp M Invariants f) n x - birkhoff_sum f n x
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. birkhoff_sum (\<lambda>x. real_cond_exp M Invariants f x - f x) n x = birkhoff_sum (real_cond_exp M Invariants f) n x - birkhoff_sum f n x
[PROOF STEP]
using birkhoff_sum_diff
[PROOF STATE]
proof (prove)
using this:
birkhoff_sum (\<lambda>x. ?f x - ?g x) ?n ?x = birkhoff_sum ?f ?n ?x - birkhoff_sum ?g ?n ?x

goal (1 subgoal):
 1. birkhoff_sum (\<lambda>x. real_cond_exp M Invariants f x - f x) n x = birkhoff_sum (real_cond_exp M Invariants f) n x - birkhoff_sum f n x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
birkhoff_sum g n x = birkhoff_sum (real_cond_exp M Invariants f) n x - birkhoff_sum f n x

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
birkhoff_sum g n x = birkhoff_sum (real_cond_exp M Invariants f) n x - birkhoff_sum f n x

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
have "... = n * real_cond_exp M Invariants f x - birkhoff_sum f n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. birkhoff_sum (real_cond_exp M Invariants f) n x - birkhoff_sum f n x = real n * real_cond_exp M Invariants f x - birkhoff_sum f n x
[PROOF STEP]
using birkhoff_sum_of_invariants \<open>x \<in> space M\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f \<in> borel_measurable Invariants; ?x \<in> space M\<rbrakk> \<Longrightarrow> birkhoff_sum ?f ?n ?x = real ?n * ?f ?x
x \<in> space M

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

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
birkhoff_sum g n x = real n * real_cond_exp M Invariants f x - birkhoff_sum f n x
[PROOF STEP]
have "birkhoff_sum f n x \<in> {n * real_cond_exp M Invariants f x - e .. n * real_cond_exp M Invariants f x}"
[PROOF STATE]
proof (prove)
using this:
birkhoff_sum g n x = real n * real_cond_exp M Invariants f x - birkhoff_sum f n x

goal (1 subgoal):
 1. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}
[PROOF STEP]
using H
[PROOF STATE]
proof (prove)
using this:
birkhoff_sum g n x = real n * real_cond_exp M Invariants f x - birkhoff_sum f n x
birkhoff_sum g n x \<in> {0..e}

goal (1 subgoal):
 1. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
birkhoff_sum g ?n5 x \<in> {0..e} \<Longrightarrow> birkhoff_sum f ?n5 x \<in> {real ?n5 * real_cond_exp M Invariants f x - e..real ?n5 * real_cond_exp M Invariants f x}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
birkhoff_sum g ?n5 x \<in> {0..e} \<Longrightarrow> birkhoff_sum f ?n5 x \<in> {real ?n5 * real_cond_exp M Invariants f x - e..real ?n5 * real_cond_exp M Invariants f x}
[PROOF STEP]
have "{n. birkhoff_sum g n x \<in> {0..e}} \<subseteq> {n. birkhoff_sum f n x \<in> {n * real_cond_exp M Invariants f x - e .. n * real_cond_exp M Invariants f x}}"
[PROOF STATE]
proof (prove)
using this:
birkhoff_sum g ?n5 x \<in> {0..e} \<Longrightarrow> birkhoff_sum f ?n5 x \<in> {real ?n5 * real_cond_exp M Invariants f x - e..real ?n5 * real_cond_exp M Invariants f x}

goal (1 subgoal):
 1. {n. birkhoff_sum g n x \<in> {0..e}} \<subseteq> {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{n. birkhoff_sum g n x \<in> {0..e}} \<subseteq> {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{n. birkhoff_sum g n x \<in> {0..e}} \<subseteq> {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
have "infinite {n. birkhoff_sum f n x \<in> {n * real_cond_exp M Invariants f x - e .. n * real_cond_exp M Invariants f x}}"
[PROOF STATE]
proof (prove)
using this:
{n. birkhoff_sum g n x \<in> {0..e}} \<subseteq> {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}

goal (1 subgoal):
 1. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
using \<open>infinite {n. birkhoff_sum g n x \<in> {0..e}}\<close> finite_subset
[PROOF STATE]
proof (prove)
using this:
{n. birkhoff_sum g n x \<in> {0..e}} \<subseteq> {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
infinite {n. birkhoff_sum g n x \<in> {0..e}}
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x5 \<in> space M; infinite {n. birkhoff_sum g n ?x5 \<in> {0..e}}\<rbrakk> \<Longrightarrow> infinite {n. birkhoff_sum f n ?x5 \<in> {real n * real_cond_exp M Invariants f ?x5 - e..real n * real_cond_exp M Invariants f ?x5}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
AE x in M. infinite {n. birkhoff_sum g n x \<in> {0..e}}
\<lbrakk>?x5 \<in> space M; infinite {n. birkhoff_sum g n ?x5 \<in> {0..e}}\<rbrakk> \<Longrightarrow> infinite {n. birkhoff_sum f n ?x5 \<in> {real n * real_cond_exp M Invariants f ?x5 - e..real n * real_cond_exp M Invariants f ?x5}}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
AE x in M. infinite {n. birkhoff_sum g n x \<in> {0..e}}
\<lbrakk>?x5 \<in> space M; infinite {n. birkhoff_sum g n ?x5 \<in> {0..e}}\<rbrakk> \<Longrightarrow> infinite {n. birkhoff_sum f n ?x5 \<in> {real n * real_cond_exp M Invariants f ?x5 - e..real n * real_cond_exp M Invariants f ?x5}}

goal (1 subgoal):
 1. AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in M. infinite {n. birkhoff_sum f n x \<in> {real n * real_cond_exp M Invariants f x - e..real n * real_cond_exp M Invariants f x}}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bin_lcp_bin_lcs [reversal_rule]:  "bin_lcp (rev x) (rev y) = rev (bin_lcs x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_lcp (rev x) (rev y) = rev (bin_lcs x y)
[PROOF STEP]
unfolding bin_lcp_def bin_lcs_def rev_append[symmetric] lcs_lcp
           lcs_sym[of "x \<cdot> y"]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rev (y \<cdot> x \<and>\<^sub>s x \<cdot> y ) = rev (y \<cdot> x \<and>\<^sub>s x \<cdot> y )
[PROOF STEP]
..


[STATEMENT]
lemma suntil_cong:
  "alw P \<omega> \<Longrightarrow> (\<And>\<omega>. P \<omega> \<Longrightarrow> Q1 \<omega> \<longleftrightarrow> Q2 \<omega>) \<Longrightarrow> (\<And>\<omega>. P \<omega> \<Longrightarrow> R1 \<omega> \<longleftrightarrow> R2 \<omega>) \<Longrightarrow>
    (Q1 suntil R1) \<omega> \<longleftrightarrow> (Q2 suntil R2) \<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>alw P \<omega>; \<And>\<omega>. P \<omega> \<Longrightarrow> Q1 \<omega> = Q2 \<omega>; \<And>\<omega>. P \<omega> \<Longrightarrow> R1 \<omega> = R2 \<omega>\<rbrakk> \<Longrightarrow> (Q1 suntil R1) \<omega> = (Q2 suntil R2) \<omega>
[PROOF STEP]
using suntil_mono[of P Q1 Q2 R1 R2 \<omega>] suntil_mono[of P Q2 Q1 R2 R1 \<omega>]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>\<omega>. \<lbrakk>P \<omega>; Q1 \<omega>\<rbrakk> \<Longrightarrow> Q2 \<omega>; \<And>\<omega>. \<lbrakk>P \<omega>; R1 \<omega>\<rbrakk> \<Longrightarrow> R2 \<omega>; (Q1 suntil R1) \<omega>; alw P \<omega>\<rbrakk> \<Longrightarrow> (Q2 suntil R2) \<omega>
\<lbrakk>\<And>\<omega>. \<lbrakk>P \<omega>; Q2 \<omega>\<rbrakk> \<Longrightarrow> Q1 \<omega>; \<And>\<omega>. \<lbrakk>P \<omega>; R2 \<omega>\<rbrakk> \<Longrightarrow> R1 \<omega>; (Q2 suntil R2) \<omega>; alw P \<omega>\<rbrakk> \<Longrightarrow> (Q1 suntil R1) \<omega>

goal (1 subgoal):
 1. \<lbrakk>alw P \<omega>; \<And>\<omega>. P \<omega> \<Longrightarrow> Q1 \<omega> = Q2 \<omega>; \<And>\<omega>. P \<omega> \<Longrightarrow> R1 \<omega> = R2 \<omega>\<rbrakk> \<Longrightarrow> (Q1 suntil R1) \<omega> = (Q2 suntil R2) \<omega>
[PROOF STEP]
by auto


[STATEMENT]
lemma Jacobi_0_eq_0: "\<not>is_unit n \<Longrightarrow> Jacobi 0 n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> is_unit n \<Longrightarrow> Jacobi 0 n = 0
[PROOF STEP]
by (cases "prime_factorization n = {#}")
     (auto simp: Jacobi_def prime_factorization_empty_iff image_iff intro: Nat.gr0I)


[STATEMENT]
lemma conga_obtuse__obtuse:
  assumes "Obtuse A B C" and
    "A B C CongA D E F"
  shows "Obtuse D E F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Obtuse D E F
[PROOF STEP]
using assms(1) assms(2) conga__lea lea_obtuse_obtuse
[PROOF STATE]
proof (prove)
using this:
Obtuse A B C
A B C CongA D E F
?A ?B ?C CongA ?D ?E ?F \<Longrightarrow> ?A ?B ?C LeA ?D ?E ?F
\<lbrakk>Obtuse ?D ?E ?F; ?D ?E ?F LeA ?A ?B ?C\<rbrakk> \<Longrightarrow> Obtuse ?A ?B ?C

goal (1 subgoal):
 1. Obtuse D E F
[PROOF STEP]
by blast


[STATEMENT]
lemma reduced_row_echelon_form_upt_k_Gauss_Jordan_column_k:
  fixes A::"'a::{field}^'columns::{mod_type}^'rows::{mod_type}" and k::nat
  defines ia:"ia\<equiv>(if \<forall>m. is_zero_row_upt_k m k A then 0 else to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1)"
  defines B:"B\<equiv>(snd (Gauss_Jordan_column_k (ia,A) k))"
  assumes rref: "reduced_row_echelon_form_upt_k A k"
  shows "reduced_row_echelon_form_upt_k B (Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reduced_row_echelon_form_upt_k B (Suc k)
[PROOF STEP]
proof (rule reduced_row_echelon_form_upt_k_intro, auto)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>i j. \<lbrakk>is_zero_row_upt_k i (Suc k) B; i < j\<rbrakk> \<Longrightarrow> is_zero_row_upt_k j (Suc k) B
 2. \<And>i. \<not> is_zero_row_upt_k i (Suc k) B \<Longrightarrow> B $ i $ (LEAST k. B $ i $ k \<noteq> (0::'a)) = (1::'a)
 3. \<And>i. \<lbrakk>i < i + (1::'rows); \<not> is_zero_row_upt_k i (Suc k) B; \<not> is_zero_row_upt_k (i + (1::'rows)) (Suc k) B\<rbrakk> \<Longrightarrow> (LEAST n. B $ i $ n \<noteq> (0::'a)) < (LEAST n. B $ (i + (1::'rows)) $ n \<noteq> (0::'a))
 4. \<And>i j. \<lbrakk>\<not> is_zero_row_upt_k i (Suc k) B; i \<noteq> j\<rbrakk> \<Longrightarrow> B $ j $ (LEAST n. B $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
show "\<And>i j. is_zero_row_upt_k i (Suc k) B \<Longrightarrow> i < j \<Longrightarrow> is_zero_row_upt_k j (Suc k) B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>is_zero_row_upt_k i (Suc k) B; i < j\<rbrakk> \<Longrightarrow> is_zero_row_upt_k j (Suc k) B
[PROOF STEP]
using condition_1 assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>reduced_row_echelon_form_upt_k ?A ?k; is_zero_row_upt_k ?i (Suc ?k) (snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m ?k ?A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n ?k ?A) + 1, ?A) ?k)); ?i < ?j\<rbrakk> \<Longrightarrow> is_zero_row_upt_k ?j (Suc ?k) (snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m ?k ?A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n ?k ?A) + 1, ?A) ?k))
ia \<equiv> if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1
B \<equiv> snd (Gauss_Jordan_column_k (ia, A) k)
reduced_row_echelon_form_upt_k A k

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>is_zero_row_upt_k i (Suc k) B; i < j\<rbrakk> \<Longrightarrow> is_zero_row_upt_k j (Suc k) B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>is_zero_row_upt_k ?i (Suc k) B; ?i < ?j\<rbrakk> \<Longrightarrow> is_zero_row_upt_k ?j (Suc k) B

goal (3 subgoals):
 1. \<And>i. \<not> is_zero_row_upt_k i (Suc k) B \<Longrightarrow> B $ i $ (LEAST k. B $ i $ k \<noteq> (0::'a)) = (1::'a)
 2. \<And>i. \<lbrakk>i < i + (1::'rows); \<not> is_zero_row_upt_k i (Suc k) B; \<not> is_zero_row_upt_k (i + (1::'rows)) (Suc k) B\<rbrakk> \<Longrightarrow> (LEAST n. B $ i $ n \<noteq> (0::'a)) < (LEAST n. B $ (i + (1::'rows)) $ n \<noteq> (0::'a))
 3. \<And>i j. \<lbrakk>\<not> is_zero_row_upt_k i (Suc k) B; i \<noteq> j\<rbrakk> \<Longrightarrow> B $ j $ (LEAST n. B $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
show "\<And>i. \<not> is_zero_row_upt_k i (Suc k) B \<Longrightarrow> B $ i $ (LEAST k. B $ i $ k \<noteq> 0) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<not> is_zero_row_upt_k i (Suc k) B \<Longrightarrow> B $ i $ (LEAST k. B $ i $ k \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
using condition_2 assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>reduced_row_echelon_form_upt_k ?A ?k; \<not> is_zero_row_upt_k ?i (Suc ?k) (snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m ?k ?A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n ?k ?A) + 1, ?A) ?k))\<rbrakk> \<Longrightarrow> snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m ?k ?A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n ?k ?A) + 1, ?A) ?k) $ ?i $ (LEAST k. snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m ?k ?A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n ?k ?A) + 1, ?A) ?k) $ ?i $ k \<noteq> (0::?'a)) = (1::?'a)
ia \<equiv> if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1
B \<equiv> snd (Gauss_Jordan_column_k (ia, A) k)
reduced_row_echelon_form_upt_k A k

goal (1 subgoal):
 1. \<And>i. \<not> is_zero_row_upt_k i (Suc k) B \<Longrightarrow> B $ i $ (LEAST k. B $ i $ k \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<not> is_zero_row_upt_k ?i (Suc k) B \<Longrightarrow> B $ ?i $ (LEAST k. B $ ?i $ k \<noteq> (0::'a)) = (1::'a)

goal (2 subgoals):
 1. \<And>i. \<lbrakk>i < i + (1::'rows); \<not> is_zero_row_upt_k i (Suc k) B; \<not> is_zero_row_upt_k (i + (1::'rows)) (Suc k) B\<rbrakk> \<Longrightarrow> (LEAST n. B $ i $ n \<noteq> (0::'a)) < (LEAST n. B $ (i + (1::'rows)) $ n \<noteq> (0::'a))
 2. \<And>i j. \<lbrakk>\<not> is_zero_row_upt_k i (Suc k) B; i \<noteq> j\<rbrakk> \<Longrightarrow> B $ j $ (LEAST n. B $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
show "\<And>i. i < i + 1 \<Longrightarrow> \<not> is_zero_row_upt_k i (Suc k) B \<Longrightarrow> \<not> is_zero_row_upt_k (i + 1) (Suc k) B \<Longrightarrow> (LEAST n. B $ i $ n \<noteq> 0) < (LEAST n. B $ (i + 1) $ n \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>i < i + (1::'rows); \<not> is_zero_row_upt_k i (Suc k) B; \<not> is_zero_row_upt_k (i + (1::'rows)) (Suc k) B\<rbrakk> \<Longrightarrow> (LEAST n. B $ i $ n \<noteq> (0::'a)) < (LEAST n. B $ (i + (1::'rows)) $ n \<noteq> (0::'a))
[PROOF STEP]
using condition_3 assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>reduced_row_echelon_form_upt_k ?A ?k; ?i < ?i + (1::?'rows); \<not> is_zero_row_upt_k ?i (Suc ?k) (snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m ?k ?A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n ?k ?A) + 1, ?A) ?k)); \<not> is_zero_row_upt_k (?i + (1::?'rows)) (Suc ?k) (snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m ?k ?A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n ?k ?A) + 1, ?A) ?k))\<rbrakk> \<Longrightarrow> (LEAST n. snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m ?k ?A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n ?k ?A) + 1, ?A) ?k) $ ?i $ n \<noteq> (0::?'a)) < (LEAST n. snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m ?k ?A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n ?k ?A) + 1, ?A) ?k) $ (?i + (1::?'rows)) $ n \<noteq> (0::?'a))
ia \<equiv> if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1
B \<equiv> snd (Gauss_Jordan_column_k (ia, A) k)
reduced_row_echelon_form_upt_k A k

goal (1 subgoal):
 1. \<And>i. \<lbrakk>i < i + (1::'rows); \<not> is_zero_row_upt_k i (Suc k) B; \<not> is_zero_row_upt_k (i + (1::'rows)) (Suc k) B\<rbrakk> \<Longrightarrow> (LEAST n. B $ i $ n \<noteq> (0::'a)) < (LEAST n. B $ (i + (1::'rows)) $ n \<noteq> (0::'a))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i < ?i + (1::'rows); \<not> is_zero_row_upt_k ?i (Suc k) B; \<not> is_zero_row_upt_k (?i + (1::'rows)) (Suc k) B\<rbrakk> \<Longrightarrow> (LEAST n. B $ ?i $ n \<noteq> (0::'a)) < (LEAST n. B $ (?i + (1::'rows)) $ n \<noteq> (0::'a))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>\<not> is_zero_row_upt_k i (Suc k) B; i \<noteq> j\<rbrakk> \<Longrightarrow> B $ j $ (LEAST n. B $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
show "\<And>i j. \<not> is_zero_row_upt_k i (Suc k) B \<Longrightarrow> i \<noteq> j \<Longrightarrow> B $ j $ (LEAST n. B $ i $ n \<noteq> 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>\<not> is_zero_row_upt_k i (Suc k) B; i \<noteq> j\<rbrakk> \<Longrightarrow> B $ j $ (LEAST n. B $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
using condition_4 assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>reduced_row_echelon_form_upt_k ?A ?k; \<not> is_zero_row_upt_k ?i (Suc ?k) (snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m ?k ?A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n ?k ?A) + 1, ?A) ?k)); ?i \<noteq> ?j\<rbrakk> \<Longrightarrow> snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m ?k ?A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n ?k ?A) + 1, ?A) ?k) $ ?j $ (LEAST n. snd (Gauss_Jordan_column_k (if \<forall>m. is_zero_row_upt_k m ?k ?A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n ?k ?A) + 1, ?A) ?k) $ ?i $ n \<noteq> (0::?'a)) = (0::?'a)
ia \<equiv> if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1
B \<equiv> snd (Gauss_Jordan_column_k (ia, A) k)
reduced_row_echelon_form_upt_k A k

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>\<not> is_zero_row_upt_k i (Suc k) B; i \<noteq> j\<rbrakk> \<Longrightarrow> B $ j $ (LEAST n. B $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<not> is_zero_row_upt_k ?i (Suc k) B; ?i \<noteq> ?j\<rbrakk> \<Longrightarrow> B $ ?j $ (LEAST n. B $ ?i $ n \<noteq> (0::'a)) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subgraph_verts_finite : "\<lbrakk> finite (uverts G); subgraph G' G \<rbrakk> \<Longrightarrow> finite (uverts G')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite (uverts G); subgraph G' G\<rbrakk> \<Longrightarrow> finite (uverts G')
[PROOF STEP]
using rev_finite_subset subgraph_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> finite ?A
subgraph ?G' ?G \<equiv> uverts ?G' \<subseteq> uverts ?G \<and> uedges ?G' \<subseteq> uedges ?G

goal (1 subgoal):
 1. \<lbrakk>finite (uverts G); subgraph G' G\<rbrakk> \<Longrightarrow> finite (uverts G')
[PROOF STEP]
by auto


[STATEMENT]
lemma rightUniquePair:
  assumes "runiq f"
  assumes "(x,y)\<in>f"
  shows "y=f,,x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y = f ,, x
[PROOF STEP]
using assms runiq_wrt_eval_rel subset_singletonD Image_singleton_iff equals0D singletonE
[PROOF STATE]
proof (prove)
using this:
runiq f
(x, y) \<in> f
runiq ?R = (\<forall>x. ?R `` {x} \<subseteq> {?R ,, x})
?A \<subseteq> {?x} \<Longrightarrow> ?A = {} \<or> ?A = {?x}
(?b \<in> ?r `` {?a}) = ((?a, ?b) \<in> ?r)
?A = {} \<Longrightarrow> ?a \<notin> ?A
\<lbrakk>?b \<in> {?a}; ?b = ?a \<Longrightarrow> PROP ?W\<rbrakk> \<Longrightarrow> PROP ?W

goal (1 subgoal):
 1. y = f ,, x
[PROOF STEP]
by fast


[STATEMENT]
lemma conjugate_moebius:
  shows "conjugate \<circ> moebius_pt M = moebius_pt (conjugate_moebius M) \<circ> conjugate"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate \<circ> moebius_pt M = moebius_pt (conjugate_moebius M) \<circ> conjugate
[PROOF STEP]
apply (rule ext, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. conjugate (moebius_pt M x) = moebius_pt (conjugate_moebius M) (conjugate x)
[PROOF STEP]
apply (transfer, transfer)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x M. \<lbrakk>x \<noteq> vec_zero; mat_det M \<noteq> 0\<rbrakk> \<Longrightarrow> conjugate_cvec (moebius_pt_cmat_cvec M x) \<approx>\<^sub>v moebius_pt_cmat_cvec (mat_cnj M) (conjugate_cvec x)
[PROOF STEP]
using vec_cnj_mult_mv
[PROOF STATE]
proof (prove)
using this:
vec_cnj (?A *\<^sub>m\<^sub>v ?x) = mat_cnj ?A *\<^sub>m\<^sub>v vec_cnj ?x

goal (1 subgoal):
 1. \<And>x M. \<lbrakk>x \<noteq> vec_zero; mat_det M \<noteq> 0\<rbrakk> \<Longrightarrow> conjugate_cvec (moebius_pt_cmat_cvec M x) \<approx>\<^sub>v moebius_pt_cmat_cvec (mat_cnj M) (conjugate_cvec x)
[PROOF STEP]
by auto


[STATEMENT]
lemma fds_ind_nth_power: "k > 0 \<Longrightarrow> fds_ind (is_nth_power k) = fds_scale k fds_zeta"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> fds_ind (is_nth_power k) = fds_scale k fds_zeta
[PROOF STEP]
by (rule fds_eqI) (auto simp: ind_def fds_nth_scale elim!: is_nth_powerE)


[STATEMENT]
lemma ereal_INF_multc: "0 < c \<Longrightarrow> (INF i\<in>I. f i * c) = (INF i\<in>I. f i) * ereal c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < c \<Longrightarrow> (\<Sqinter>i\<in>I. f i * ereal c) = \<Sqinter> (f ` I) * ereal c
[PROOF STEP]
using ereal_INF_cmult[of c f I]
[PROOF STATE]
proof (prove)
using this:
0 < c \<Longrightarrow> (\<Sqinter>i\<in>I. ereal c * f i) = ereal c * \<Sqinter> (f ` I)

goal (1 subgoal):
 1. 0 < c \<Longrightarrow> (\<Sqinter>i\<in>I. f i * ereal c) = \<Sqinter> (f ` I) * ereal c
[PROOF STEP]
by(simp add: mult.commute)


[STATEMENT]
lemma lesseq_lesseq_r: "lesseq_r a b = (a \<le> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lesseq_r a b = (a \<le> b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lesseq_r a b = (a \<le> b)
[PROOF STEP]
interpret A: right_complemented_monoid_algebra lesseq_r less_r 1 "(*)" inf_rr "(r\<rightarrow>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.right_complemented_monoid_algebra lesseq_r less_r (1::'a) (*) inf_rr (r\<rightarrow>)
[PROOF STEP]
by (rule right_complemented_monoid_algebra)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lesseq_r a b = (a \<le> b)
[PROOF STEP]
show "lesseq_r a b = (a \<le> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lesseq_r a b = (a \<le> b)
[PROOF STEP]
apply (subst  le_iff_inf)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lesseq_r a b = (a \<sqinter> b = a)
[PROOF STEP]
apply (subst A.dual_algebra.inf.absorb_iff1 [of a b])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inf_rr a b = a) = (a \<sqinter> b = a)
[PROOF STEP]
apply (unfold inf_rr_inf [THEN sym])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inf_rr a b = a) = (inf_rr a b = a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lesseq_r a b = (a \<le> b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma line_integral_distrib:
  assumes "line_integral_exists f basis g1"
    "line_integral_exists f basis g2"
    "valid_path g1" "valid_path g2"
  shows "line_integral f basis (g1 +++ g2) = line_integral f basis g1 + line_integral f basis g2"
    "line_integral_exists f basis (g1 +++ g2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral f basis (g1 +++ g2) = line_integral f basis g1 + line_integral f basis g2 &&& line_integral_exists f basis (g1 +++ g2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. line_integral f basis (g1 +++ g2) = line_integral f basis g1 + line_integral f basis g2
 2. line_integral_exists f basis (g1 +++ g2)
[PROOF STEP]
obtain s1 s2
    where s1: "finite s1" "\<forall>x\<in>{0..1} - s1. g1 differentiable at x"
      and s2: "finite s2" "\<forall>x\<in>{0..1} - s2. g2 differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s1 s2. \<lbrakk>finite s1; \<forall>x\<in>{0..1} - s1. g1 differentiable at x; finite s2; \<forall>x\<in>{0..1} - s2. g2 differentiable at x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
line_integral_exists f basis g1
line_integral_exists f basis g2
valid_path g1
valid_path g2

goal (1 subgoal):
 1. (\<And>s1 s2. \<lbrakk>finite s1; \<forall>x\<in>{0..1} - s1. g1 differentiable at x; finite s2; \<forall>x\<in>{0..1} - s2. g2 differentiable at x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: valid_path_def piecewise_C1_differentiable_on_def C1_differentiable_on_eq)
[PROOF STATE]
proof (state)
this:
finite s1
\<forall>x\<in>{0..1} - s1. g1 differentiable at x
finite s2
\<forall>x\<in>{0..1} - s2. g2 differentiable at x

goal (2 subgoals):
 1. line_integral f basis (g1 +++ g2) = line_integral f basis g1 + line_integral f basis g2
 2. line_integral_exists f basis (g1 +++ g2)
[PROOF STEP]
obtain i1 i2
    where 1: "((\<lambda>x. \<Sum>b\<in>basis. f (g1 x) \<bullet> b * (vector_derivative g1 (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1}"
      and 2: "((\<lambda>x. \<Sum>b\<in>basis. f (g2 x) \<bullet> b * (vector_derivative g2 (at x within {0..1}) \<bullet> b)) has_integral i2) {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i1 i2. \<lbrakk>((\<lambda>x. \<Sum>b\<in>basis. f (g1 x) \<bullet> b * (vector_derivative g1 (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1}; ((\<lambda>x. \<Sum>b\<in>basis. f (g2 x) \<bullet> b * (vector_derivative g2 (at x within {0..1}) \<bullet> b)) has_integral i2) {0..1}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
line_integral_exists f basis g1
line_integral_exists f basis g2
valid_path g1
valid_path g2

goal (1 subgoal):
 1. (\<And>i1 i2. \<lbrakk>((\<lambda>x. \<Sum>b\<in>basis. f (g1 x) \<bullet> b * (vector_derivative g1 (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1}; ((\<lambda>x. \<Sum>b\<in>basis. f (g2 x) \<bullet> b * (vector_derivative g2 (at x within {0..1}) \<bullet> b)) has_integral i2) {0..1}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: line_integral_exists_def)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Sum>b\<in>basis. f (g1 x) \<bullet> b * (vector_derivative g1 (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1}
((\<lambda>x. \<Sum>b\<in>basis. f (g2 x) \<bullet> b * (vector_derivative g2 (at x within {0..1}) \<bullet> b)) has_integral i2) {0..1}

goal (2 subgoals):
 1. line_integral f basis (g1 +++ g2) = line_integral f basis g1 + line_integral f basis g2
 2. line_integral_exists f basis (g1 +++ g2)
[PROOF STEP]
have i1: "((\<lambda>x. 2 * (\<Sum>b\<in>basis. f (g1 (2 * x)) \<bullet> b * (vector_derivative g1 (at (2 * x) within {0..1}) \<bullet> b))) has_integral i1) {0..1/2}"
   and i2: "((\<lambda>x. 2 * (\<Sum>b\<in>basis. f (g2 (2 * x - 1)) \<bullet> b * (vector_derivative g2 (at ((2 * x) - 1) within {0..1}) \<bullet> b))) has_integral i2) {1/2..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. 2 * (\<Sum>b\<in>basis. f (g1 (2 * x)) \<bullet> b * (vector_derivative g1 (at (2 * x) within {0..1}) \<bullet> b))) has_integral i1) {0..1 / 2} &&& ((\<lambda>x. 2 * (\<Sum>b\<in>basis. f (g2 (2 * x - 1)) \<bullet> b * (vector_derivative g2 (at (2 * x - 1) within {0..1}) \<bullet> b))) has_integral i2) {1 / 2..1}
[PROOF STEP]
using has_integral_affinity01 [OF 1, where m= 2 and c=0, THEN has_integral_cmul [where c=2]]
      has_integral_affinity01 [OF 2, where m= 2 and c="-1", THEN has_integral_cmul [where c=2]]
[PROOF STATE]
proof (prove)
using this:
2 \<noteq> 0 \<Longrightarrow> ((\<lambda>x. 2 *\<^sub>R (\<Sum>b\<in>basis. f (g1 (2 * x + 0)) \<bullet> b * (vector_derivative g1 (at (2 * x + 0) within {0..1}) \<bullet> b))) has_integral 2 *\<^sub>R (1 / \<bar>2\<bar>) *\<^sub>R i1) ((\<lambda>x. x / 2 - 0 / 2) ` {0..1})
2 \<noteq> 0 \<Longrightarrow> ((\<lambda>x. 2 *\<^sub>R (\<Sum>b\<in>basis. f (g2 (2 * x + - 1)) \<bullet> b * (vector_derivative g2 (at (2 * x + - 1) within {0..1}) \<bullet> b))) has_integral 2 *\<^sub>R (1 / \<bar>2\<bar>) *\<^sub>R i2) ((\<lambda>x. x / 2 - - 1 / 2) ` {0..1})

goal (1 subgoal):
 1. ((\<lambda>x. 2 * (\<Sum>b\<in>basis. f (g1 (2 * x)) \<bullet> b * (vector_derivative g1 (at (2 * x) within {0..1}) \<bullet> b))) has_integral i1) {0..1 / 2} &&& ((\<lambda>x. 2 * (\<Sum>b\<in>basis. f (g2 (2 * x - 1)) \<bullet> b * (vector_derivative g2 (at (2 * x - 1) within {0..1}) \<bullet> b))) has_integral i2) {1 / 2..1}
[PROOF STEP]
by (simp_all only: image_affinity_atLeastAtMost_div_diff, simp_all add: scaleR_conv_of_real mult_ac)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. 2 * (\<Sum>b\<in>basis. f (g1 (2 * x)) \<bullet> b * (vector_derivative g1 (at (2 * x) within {0..1}) \<bullet> b))) has_integral i1) {0..1 / 2}
((\<lambda>x. 2 * (\<Sum>b\<in>basis. f (g2 (2 * x - 1)) \<bullet> b * (vector_derivative g2 (at (2 * x - 1) within {0..1}) \<bullet> b))) has_integral i2) {1 / 2..1}

goal (2 subgoals):
 1. line_integral f basis (g1 +++ g2) = line_integral f basis g1 + line_integral f basis g2
 2. line_integral_exists f basis (g1 +++ g2)
[PROOF STEP]
have g1: "\<lbrakk>0 \<le> z; z*2 < 1; z*2 \<notin> s1\<rbrakk> \<Longrightarrow>
            vector_derivative (\<lambda>x. if x*2 \<le> 1 then g1 (2*x) else g2 (2*x - 1)) (at z within {0..1}) =
            2 *\<^sub>R vector_derivative g1 (at (z*2) within {0..1})" for z
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2) within {0..1})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2) within {0..1})
[PROOF STEP]
have i:"\<lbrakk>0 \<le> z; z*2 < 1; z*2 \<notin> s1\<rbrakk> \<Longrightarrow>
              vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2))" for z
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2))
[PROOF STEP]
have g1_at_z:"\<lbrakk>0 \<le> z; z*2 < 1; z*2 \<notin> s1\<rbrakk> \<Longrightarrow>
                         ((\<lambda>x. if x*2 \<le> 1 then g1 (2*x) else g2 (2*x - 1)) has_vector_derivative
                         2 *\<^sub>R vector_derivative g1 (at (z*2))) (at z)" for z
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> ((\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) has_vector_derivative 2 *\<^sub>R vector_derivative g1 (at (z * 2))) (at z)
[PROOF STEP]
apply (rule has_vector_derivative_transform_at [of "\<bar>z - 1/2\<bar>" _ "(\<lambda>x. g1(2*x))"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> 0 < \<bar>z - 1 / 2\<bar>
 2. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> \<forall>x'. dist x' z < \<bar>z - 1 / 2\<bar> \<longrightarrow> g1 (2 * x') = (if x' * 2 \<le> 1 then g1 (2 * x') else g2 (2 * x' - 1))
 3. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> ((\<lambda>x. g1 (2 * x)) has_vector_derivative 2 *\<^sub>R vector_derivative g1 (at (z * 2))) (at z)
[PROOF STEP]
apply (simp_all add: dist_real_def abs_if split: if_split_asm)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> ((\<lambda>x. g1 (2 * x)) has_vector_derivative 2 *\<^sub>R vector_derivative g1 (at (z * 2))) (at z)
[PROOF STEP]
apply (rule vector_diff_chain_at [of "\<lambda>x. 2*x" 2 _ g1, simplified o_def])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> ((*) 2 has_vector_derivative 2) (at z)
 2. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> (g1 has_vector_derivative vector_derivative g1 (at (z * 2))) (at (2 * z))
[PROOF STEP]
apply (simp add: has_vector_derivative_def has_derivative_def bounded_linear_mult_left)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> (g1 has_vector_derivative vector_derivative g1 (at (z * 2))) (at (2 * z))
[PROOF STEP]
using s1
[PROOF STATE]
proof (prove)
using this:
finite s1
\<forall>x\<in>{0..1} - s1. g1 differentiable at x

goal (1 subgoal):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> (g1 has_vector_derivative vector_derivative g1 (at (z * 2))) (at (2 * z))
[PROOF STEP]
apply (auto simp: algebra_simps vector_derivative_works)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 \<le> ?z; ?z * 2 < 1; ?z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> ((\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) has_vector_derivative 2 *\<^sub>R vector_derivative g1 (at (?z * 2))) (at ?z)

goal (1 subgoal):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2))
[PROOF STEP]
assume ass: "0 \<le> z" "z*2 < 1" "z*2 \<notin> s1"
[PROOF STATE]
proof (state)
this:
0 \<le> z
z * 2 < 1
z * 2 \<notin> s1

goal (1 subgoal):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> z
z * 2 < 1
z * 2 \<notin> s1
[PROOF STEP]
have z_ge: "z\<le> 1"
[PROOF STATE]
proof (prove)
using this:
0 \<le> z
z * 2 < 1
z * 2 \<notin> s1

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

goal (1 subgoal):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2))
[PROOF STEP]
show "vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2))
[PROOF STEP]
using Derivative.vector_derivative_at_within_ivl[OF g1_at_z[OF ass] ass(1) z_ge]
[PROOF STATE]
proof (prove)
using this:
0 < 1 \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2))

goal (1 subgoal):
 1. vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 \<le> ?z; ?z * 2 < 1; ?z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at ?z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (?z * 2))

goal (1 subgoal):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2) within {0..1})
[PROOF STEP]
assume ass: "0 \<le> z" "z*2 < 1" "z*2 \<notin> s1"
[PROOF STATE]
proof (state)
this:
0 \<le> z
z * 2 < 1
z * 2 \<notin> s1

goal (1 subgoal):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2) within {0..1})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> z
z * 2 < 1
z * 2 \<notin> s1
[PROOF STEP]
have "(g1 has_vector_derivative ((vector_derivative g1 (at (z*2))))) (at (z*2))"
[PROOF STATE]
proof (prove)
using this:
0 \<le> z
z * 2 < 1
z * 2 \<notin> s1

goal (1 subgoal):
 1. (g1 has_vector_derivative vector_derivative g1 (at (z * 2))) (at (z * 2))
[PROOF STEP]
using s1
[PROOF STATE]
proof (prove)
using this:
0 \<le> z
z * 2 < 1
z * 2 \<notin> s1
finite s1
\<forall>x\<in>{0..1} - s1. g1 differentiable at x

goal (1 subgoal):
 1. (g1 has_vector_derivative vector_derivative g1 (at (z * 2))) (at (z * 2))
[PROOF STEP]
by (auto simp: algebra_simps vector_derivative_works)
[PROOF STATE]
proof (state)
this:
(g1 has_vector_derivative vector_derivative g1 (at (z * 2))) (at (z * 2))

goal (1 subgoal):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2) within {0..1})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(g1 has_vector_derivative vector_derivative g1 (at (z * 2))) (at (z * 2))
[PROOF STEP]
have ii: "(vector_derivative g1 (at (z*2) within {0..1})) = (vector_derivative g1 (at (z*2)))"
[PROOF STATE]
proof (prove)
using this:
(g1 has_vector_derivative vector_derivative g1 (at (z * 2))) (at (z * 2))

goal (1 subgoal):
 1. vector_derivative g1 (at (z * 2) within {0..1}) = vector_derivative g1 (at (z * 2))
[PROOF STEP]
using Derivative.vector_derivative_at_within_ivl ass
[PROOF STATE]
proof (prove)
using this:
(g1 has_vector_derivative vector_derivative g1 (at (z * 2))) (at (z * 2))
\<lbrakk>(?f has_vector_derivative ?f') (at ?x); ?a \<le> ?x; ?x \<le> ?b; ?a < ?b\<rbrakk> \<Longrightarrow> vector_derivative ?f (at ?x within {?a..?b}) = ?f'
0 \<le> z
z * 2 < 1
z * 2 \<notin> s1

goal (1 subgoal):
 1. vector_derivative g1 (at (z * 2) within {0..1}) = vector_derivative g1 (at (z * 2))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
vector_derivative g1 (at (z * 2) within {0..1}) = vector_derivative g1 (at (z * 2))

goal (1 subgoal):
 1. \<lbrakk>0 \<le> z; z * 2 < 1; z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2) within {0..1})
[PROOF STEP]
show "vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2) within {0..1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2) within {0..1})
[PROOF STEP]
using i[OF ass] ii
[PROOF STATE]
proof (prove)
using this:
vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2))
vector_derivative g1 (at (z * 2) within {0..1}) = vector_derivative g1 (at (z * 2))

goal (1 subgoal):
 1. vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2) within {0..1})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (z * 2) within {0..1})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 \<le> ?z; ?z * 2 < 1; ?z * 2 \<notin> s1\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at ?z within {0..1}) = 2 *\<^sub>R vector_derivative g1 (at (?z * 2) within {0..1})

goal (2 subgoals):
 1. line_integral f basis (g1 +++ g2) = line_integral f basis g1 + line_integral f basis g2
 2. line_integral_exists f basis (g1 +++ g2)
[PROOF STEP]
have g2: "\<lbrakk>1 < z*2; z \<le> 1; z*2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow>
            vector_derivative (\<lambda>x. if x*2 \<le> 1 then g1 (2*x) else g2 (2*x - 1)) (at z within {0..1}) =
            2 *\<^sub>R vector_derivative g2 (at (z*2 - 1) within {0..1})" for z
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1) within {0..1})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1) within {0..1})
[PROOF STEP]
have i:"\<lbrakk>1 < z*2; z \<le> 1; z*2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow>
              vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1})
                   = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1))" for z
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1))
[PROOF STEP]
have g2_at_z:"\<lbrakk>1 < z*2; z \<le> 1; z*2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow>
                      ((\<lambda>x. if x*2 \<le> 1 then g1 (2*x) else g2 (2*x - 1)) has_vector_derivative 2 *\<^sub>R vector_derivative g2 (at (z*2 - 1))) (at z)" for z
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> ((\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) has_vector_derivative 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1))) (at z)
[PROOF STEP]
apply (rule has_vector_derivative_transform_at [of "\<bar>z - 1/2\<bar>" _ "(\<lambda>x. g2 (2*x - 1))"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> 0 < \<bar>z - 1 / 2\<bar>
 2. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> \<forall>x'. dist x' z < \<bar>z - 1 / 2\<bar> \<longrightarrow> g2 (2 * x' - 1) = (if x' * 2 \<le> 1 then g1 (2 * x') else g2 (2 * x' - 1))
 3. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> ((\<lambda>x. g2 (2 * x - 1)) has_vector_derivative 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1))) (at z)
[PROOF STEP]
apply (simp_all add: dist_real_def abs_if split: if_split_asm)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> ((\<lambda>x. g2 (2 * x - 1)) has_vector_derivative 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1))) (at z)
[PROOF STEP]
apply (rule vector_diff_chain_at [of "\<lambda>x. 2*x - 1" 2 _ g2, simplified o_def])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> ((\<lambda>x. 2 * x - 1) has_vector_derivative 2) (at z)
 2. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> (g2 has_vector_derivative vector_derivative g2 (at (z * 2 - 1))) (at (2 * z - 1))
[PROOF STEP]
apply (simp add: has_vector_derivative_def has_derivative_def bounded_linear_mult_left)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> (g2 has_vector_derivative vector_derivative g2 (at (z * 2 - 1))) (at (2 * z - 1))
[PROOF STEP]
using s2
[PROOF STATE]
proof (prove)
using this:
finite s2
\<forall>x\<in>{0..1} - s2. g2 differentiable at x

goal (1 subgoal):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> (g2 has_vector_derivative vector_derivative g2 (at (z * 2 - 1))) (at (2 * z - 1))
[PROOF STEP]
apply (auto simp: algebra_simps vector_derivative_works)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<lbrakk>1 < ?z * 2; ?z \<le> 1; ?z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> ((\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) has_vector_derivative 2 *\<^sub>R vector_derivative g2 (at (?z * 2 - 1))) (at ?z)

goal (1 subgoal):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1))
[PROOF STEP]
assume ass: "1 < z*2" "z \<le> 1" "z*2 - 1 \<notin> s2"
[PROOF STATE]
proof (state)
this:
1 < z * 2
z \<le> 1
z * 2 - 1 \<notin> s2

goal (1 subgoal):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 < z * 2
z \<le> 1
z * 2 - 1 \<notin> s2
[PROOF STEP]
have z_le: "z\<le> 1"
[PROOF STATE]
proof (prove)
using this:
1 < z * 2
z \<le> 1
z * 2 - 1 \<notin> s2

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

goal (1 subgoal):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1))
[PROOF STEP]
have z_ge: "0 \<le> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> z
[PROOF STEP]
using ass
[PROOF STATE]
proof (prove)
using this:
1 < z * 2
z \<le> 1
z * 2 - 1 \<notin> s2

goal (1 subgoal):
 1. 0 \<le> z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> z

goal (1 subgoal):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1))
[PROOF STEP]
show "vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1})
                                = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1))
[PROOF STEP]
using Derivative.vector_derivative_at_within_ivl[OF g2_at_z[OF ass] z_ge z_le]
[PROOF STATE]
proof (prove)
using this:
0 < 1 \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1))

goal (1 subgoal):
 1. vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>1 < ?z * 2; ?z \<le> 1; ?z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at ?z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (?z * 2 - 1))

goal (1 subgoal):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1) within {0..1})
[PROOF STEP]
assume ass: "1 < z*2" "z \<le> 1" "z*2 - 1 \<notin> s2"
[PROOF STATE]
proof (state)
this:
1 < z * 2
z \<le> 1
z * 2 - 1 \<notin> s2

goal (1 subgoal):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1) within {0..1})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 < z * 2
z \<le> 1
z * 2 - 1 \<notin> s2
[PROOF STEP]
have "(g2 has_vector_derivative ((vector_derivative g2 (at (z*2 - 1))))) (at (z*2 - 1))"
[PROOF STATE]
proof (prove)
using this:
1 < z * 2
z \<le> 1
z * 2 - 1 \<notin> s2

goal (1 subgoal):
 1. (g2 has_vector_derivative vector_derivative g2 (at (z * 2 - 1))) (at (z * 2 - 1))
[PROOF STEP]
using s2
[PROOF STATE]
proof (prove)
using this:
1 < z * 2
z \<le> 1
z * 2 - 1 \<notin> s2
finite s2
\<forall>x\<in>{0..1} - s2. g2 differentiable at x

goal (1 subgoal):
 1. (g2 has_vector_derivative vector_derivative g2 (at (z * 2 - 1))) (at (z * 2 - 1))
[PROOF STEP]
by (auto simp: algebra_simps vector_derivative_works)
[PROOF STATE]
proof (state)
this:
(g2 has_vector_derivative vector_derivative g2 (at (z * 2 - 1))) (at (z * 2 - 1))

goal (1 subgoal):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1) within {0..1})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(g2 has_vector_derivative vector_derivative g2 (at (z * 2 - 1))) (at (z * 2 - 1))
[PROOF STEP]
have ii: "(vector_derivative g2 (at (z*2 - 1) within {0..1})) = (vector_derivative g2 (at (z*2 - 1)))"
[PROOF STATE]
proof (prove)
using this:
(g2 has_vector_derivative vector_derivative g2 (at (z * 2 - 1))) (at (z * 2 - 1))

goal (1 subgoal):
 1. vector_derivative g2 (at (z * 2 - 1) within {0..1}) = vector_derivative g2 (at (z * 2 - 1))
[PROOF STEP]
using Derivative.vector_derivative_at_within_ivl ass
[PROOF STATE]
proof (prove)
using this:
(g2 has_vector_derivative vector_derivative g2 (at (z * 2 - 1))) (at (z * 2 - 1))
\<lbrakk>(?f has_vector_derivative ?f') (at ?x); ?a \<le> ?x; ?x \<le> ?b; ?a < ?b\<rbrakk> \<Longrightarrow> vector_derivative ?f (at ?x within {?a..?b}) = ?f'
1 < z * 2
z \<le> 1
z * 2 - 1 \<notin> s2

goal (1 subgoal):
 1. vector_derivative g2 (at (z * 2 - 1) within {0..1}) = vector_derivative g2 (at (z * 2 - 1))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
vector_derivative g2 (at (z * 2 - 1) within {0..1}) = vector_derivative g2 (at (z * 2 - 1))

goal (1 subgoal):
 1. \<lbrakk>1 < z * 2; z \<le> 1; z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1) within {0..1})
[PROOF STEP]
show "vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1) within {0..1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1) within {0..1})
[PROOF STEP]
using i[OF ass] ii
[PROOF STATE]
proof (prove)
using this:
vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1))
vector_derivative g2 (at (z * 2 - 1) within {0..1}) = vector_derivative g2 (at (z * 2 - 1))

goal (1 subgoal):
 1. vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1) within {0..1})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (z * 2 - 1) within {0..1})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>1 < ?z * 2; ?z \<le> 1; ?z * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. if x * 2 \<le> 1 then g1 (2 * x) else g2 (2 * x - 1)) (at ?z within {0..1}) = 2 *\<^sub>R vector_derivative g2 (at (?z * 2 - 1) within {0..1})

goal (2 subgoals):
 1. line_integral f basis (g1 +++ g2) = line_integral f basis g1 + line_integral f basis g2
 2. line_integral_exists f basis (g1 +++ g2)
[PROOF STEP]
have lem1: "((\<lambda>x. \<Sum>b\<in>basis. f ((g1+++g2) x) \<bullet> b * (vector_derivative (g1+++g2) (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1/2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1 / 2}
[PROOF STEP]
apply (rule has_integral_spike_finite [OF _ _ i1, of "insert (1/2) ((*)2 -` s1)"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite (insert (1 / 2) ((*) 2 -` s1))
 2. \<And>x. x \<in> {0..1 / 2} - insert (1 / 2) ((*) 2 -` s1) \<Longrightarrow> (\<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) = 2 * (\<Sum>b\<in>basis. f (g1 (2 * x)) \<bullet> b * (vector_derivative g1 (at (2 * x) within {0..1}) \<bullet> b))
[PROOF STEP]
using s1
[PROOF STATE]
proof (prove)
using this:
finite s1
\<forall>x\<in>{0..1} - s1. g1 differentiable at x

goal (2 subgoals):
 1. finite (insert (1 / 2) ((*) 2 -` s1))
 2. \<And>x. x \<in> {0..1 / 2} - insert (1 / 2) ((*) 2 -` s1) \<Longrightarrow> (\<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) = 2 * (\<Sum>b\<in>basis. f (g1 (2 * x)) \<bullet> b * (vector_derivative g1 (at (2 * x) within {0..1}) \<bullet> b))
[PROOF STEP]
apply (force intro: finite_vimageI [where h = "(*)2"] inj_onI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..1 / 2} - insert (1 / 2) ((*) 2 -` s1) \<Longrightarrow> (\<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) = 2 * (\<Sum>b\<in>basis. f (g1 (2 * x)) \<bullet> b * (vector_derivative g1 (at (2 * x) within {0..1}) \<bullet> b))
[PROOF STEP]
apply (clarsimp simp add: joinpaths_def scaleR_conv_of_real mult_ac g1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>0 \<le> x; x * 2 \<le> 1; x * 2 \<noteq> 1; x * 2 \<notin> s1\<rbrakk> \<Longrightarrow> (\<Sum>b\<in>basis. 2 * (f (g1 (x * 2)) \<bullet> b * (vector_derivative g1 (at (x * 2) within {0..1}) \<bullet> b))) = 2 * (\<Sum>b\<in>basis. f (g1 (x * 2)) \<bullet> b * (vector_derivative g1 (at (x * 2) within {0..1}) \<bullet> b))
[PROOF STEP]
by (simp add: sum_distrib_left)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1 / 2}

goal (2 subgoals):
 1. line_integral f basis (g1 +++ g2) = line_integral f basis g1 + line_integral f basis g2
 2. line_integral_exists f basis (g1 +++ g2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1 / 2}

goal (2 subgoals):
 1. line_integral f basis (g1 +++ g2) = line_integral f basis g1 + line_integral f basis g2
 2. line_integral_exists f basis (g1 +++ g2)
[PROOF STEP]
have lem2: "((\<lambda>x. \<Sum>b\<in>basis. f ((g1+++g2) x) \<bullet> b * (vector_derivative (g1+++g2) (at x within {0..1}) \<bullet> b)) has_integral i2) {1/2..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i2) {1 / 2..1}
[PROOF STEP]
apply (rule has_integral_spike_finite [OF _ _ i2, of "insert (1/2) ((\<lambda>x. 2*x-1) -` s2)"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite (insert (1 / 2) ((\<lambda>x. 2 * x - 1) -` s2))
 2. \<And>x. x \<in> {1 / 2..1} - insert (1 / 2) ((\<lambda>x. 2 * x - 1) -` s2) \<Longrightarrow> (\<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) = 2 * (\<Sum>b\<in>basis. f (g2 (2 * x - 1)) \<bullet> b * (vector_derivative g2 (at (2 * x - 1) within {0..1}) \<bullet> b))
[PROOF STEP]
using s2
[PROOF STATE]
proof (prove)
using this:
finite s2
\<forall>x\<in>{0..1} - s2. g2 differentiable at x

goal (2 subgoals):
 1. finite (insert (1 / 2) ((\<lambda>x. 2 * x - 1) -` s2))
 2. \<And>x. x \<in> {1 / 2..1} - insert (1 / 2) ((\<lambda>x. 2 * x - 1) -` s2) \<Longrightarrow> (\<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) = 2 * (\<Sum>b\<in>basis. f (g2 (2 * x - 1)) \<bullet> b * (vector_derivative g2 (at (2 * x - 1) within {0..1}) \<bullet> b))
[PROOF STEP]
apply (force intro: finite_vimageI [where h = "\<lambda>x. 2*x-1"] inj_onI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {1 / 2..1} - insert (1 / 2) ((\<lambda>x. 2 * x - 1) -` s2) \<Longrightarrow> (\<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) = 2 * (\<Sum>b\<in>basis. f (g2 (2 * x - 1)) \<bullet> b * (vector_derivative g2 (at (2 * x - 1) within {0..1}) \<bullet> b))
[PROOF STEP]
apply (clarsimp simp add: joinpaths_def scaleR_conv_of_real mult_ac g2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>1 \<le> x * 2; x \<le> 1; x * 2 \<noteq> 1; x * 2 - 1 \<notin> s2\<rbrakk> \<Longrightarrow> (\<Sum>b\<in>basis. 2 * (f (g2 (x * 2 - 1)) \<bullet> b * (vector_derivative g2 (at (x * 2 - 1) within {0..1}) \<bullet> b))) = 2 * (\<Sum>b\<in>basis. f (g2 (x * 2 - 1)) \<bullet> b * (vector_derivative g2 (at (x * 2 - 1) within {0..1}) \<bullet> b))
[PROOF STEP]
by (simp add: sum_distrib_left)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i2) {1 / 2..1}

goal (2 subgoals):
 1. line_integral f basis (g1 +++ g2) = line_integral f basis g1 + line_integral f basis g2
 2. line_integral_exists f basis (g1 +++ g2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1 / 2}
((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i2) {1 / 2..1}
[PROOF STEP]
show "line_integral f basis (g1 +++ g2) = line_integral f basis g1 + line_integral f basis g2"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1 / 2}
((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i2) {1 / 2..1}

goal (1 subgoal):
 1. line_integral f basis (g1 +++ g2) = line_integral f basis g1 + line_integral f basis g2
[PROOF STEP]
apply (simp add: line_integral_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1 / 2}; ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i2) {1 / 2..1}\<rbrakk> \<Longrightarrow> integral {0..1} (\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) = integral {0..1} (\<lambda>x. \<Sum>b\<in>basis. f (g1 x) \<bullet> b * (vector_derivative g1 (at x within {0..1}) \<bullet> b)) + integral {0..1} (\<lambda>x. \<Sum>b\<in>basis. f (g2 x) \<bullet> b * (vector_derivative g2 (at x within {0..1}) \<bullet> b))
[PROOF STEP]
apply (rule integral_unique [OF has_integral_combine [where c = "1/2"]])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1 / 2}; ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i2) {1 / 2..1}\<rbrakk> \<Longrightarrow> 0 \<le> 1 / 2
 2. \<lbrakk>((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1 / 2}; ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i2) {1 / 2..1}\<rbrakk> \<Longrightarrow> 1 / 2 \<le> 1
 3. \<lbrakk>((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1 / 2}; ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i2) {1 / 2..1}\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral integral {0..1} (\<lambda>x. \<Sum>b\<in>basis. f (g1 x) \<bullet> b * (vector_derivative g1 (at x within {0..1}) \<bullet> b))) {0..1 / 2}
 4. \<lbrakk>((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1 / 2}; ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i2) {1 / 2..1}\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral integral {0..1} (\<lambda>x. \<Sum>b\<in>basis. f (g2 x) \<bullet> b * (vector_derivative g2 (at x within {0..1}) \<bullet> b))) {1 / 2..1}
[PROOF STEP]
using 1 2 integral_unique
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. \<Sum>b\<in>basis. f (g1 x) \<bullet> b * (vector_derivative g1 (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1}
((\<lambda>x. \<Sum>b\<in>basis. f (g2 x) \<bullet> b * (vector_derivative g2 (at x within {0..1}) \<bullet> b)) has_integral i2) {0..1}
(?f has_integral ?y) ?k \<Longrightarrow> integral ?k ?f = ?y

goal (4 subgoals):
 1. \<lbrakk>((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1 / 2}; ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i2) {1 / 2..1}\<rbrakk> \<Longrightarrow> 0 \<le> 1 / 2
 2. \<lbrakk>((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1 / 2}; ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i2) {1 / 2..1}\<rbrakk> \<Longrightarrow> 1 / 2 \<le> 1
 3. \<lbrakk>((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1 / 2}; ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i2) {1 / 2..1}\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral integral {0..1} (\<lambda>x. \<Sum>b\<in>basis. f (g1 x) \<bullet> b * (vector_derivative g1 (at x within {0..1}) \<bullet> b))) {0..1 / 2}
 4. \<lbrakk>((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1 / 2}; ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i2) {1 / 2..1}\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral integral {0..1} (\<lambda>x. \<Sum>b\<in>basis. f (g2 x) \<bullet> b * (vector_derivative g2 (at x within {0..1}) \<bullet> b))) {1 / 2..1}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
line_integral f basis (g1 +++ g2) = line_integral f basis g1 + line_integral f basis g2

goal (1 subgoal):
 1. line_integral_exists f basis (g1 +++ g2)
[PROOF STEP]
show "line_integral_exists f basis (g1 +++ g2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line_integral_exists f basis (g1 +++ g2)
[PROOF STEP]
proof (simp add: line_integral_exists_def integrable_on_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>y. ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral y) {0..1}
[PROOF STEP]
have "(1::real) \<le> 1 * 2 \<and> (0::real) \<le> 1 / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> 1 * 2 \<and> 0 \<le> 1 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 \<le> 1 * 2 \<and> 0 \<le> 1 / 2

goal (1 subgoal):
 1. \<exists>y. ((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral y) {0..1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> 1 * 2 \<and> 0 \<le> 1 / 2
[PROOF STEP]
show "\<exists>r. ((\<lambda>r. \<Sum>a\<in>basis. f ((g1 +++ g2) r) \<bullet> a * (vector_derivative (g1 +++ g2) (at r within {0..1}) \<bullet> a)) has_integral r) {0..1}"
[PROOF STATE]
proof (prove)
using this:
1 \<le> 1 * 2 \<and> 0 \<le> 1 / 2

goal (1 subgoal):
 1. \<exists>r. ((\<lambda>r. \<Sum>a\<in>basis. f ((g1 +++ g2) r) \<bullet> a * (vector_derivative (g1 +++ g2) (at r within {0..1}) \<bullet> a)) has_integral r) {0..1}
[PROOF STEP]
using has_integral_combine [where c = "1/2"] 1 2 divide_le_eq_numeral1(1) lem1 lem2
[PROOF STATE]
proof (prove)
using this:
1 \<le> 1 * 2 \<and> 0 \<le> 1 / 2
\<lbrakk>?a \<le> 1 / 2; 1 / 2 \<le> ?b; (?f has_integral ?i) {?a..1 / 2}; (?f has_integral ?j) {1 / 2..?b}\<rbrakk> \<Longrightarrow> (?f has_integral ?i + ?j) {?a..?b}
((\<lambda>x. \<Sum>b\<in>basis. f (g1 x) \<bullet> b * (vector_derivative g1 (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1}
((\<lambda>x. \<Sum>b\<in>basis. f (g2 x) \<bullet> b * (vector_derivative g2 (at x within {0..1}) \<bullet> b)) has_integral i2) {0..1}
(?b / numeral ?w \<le> ?a) = (?b \<le> ?a * numeral ?w)
((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i1) {0..1 / 2}
((\<lambda>x. \<Sum>b\<in>basis. f ((g1 +++ g2) x) \<bullet> b * (vector_derivative (g1 +++ g2) (at x within {0..1}) \<bullet> b)) has_integral i2) {1 / 2..1}

goal (1 subgoal):
 1. \<exists>r. ((\<lambda>r. \<Sum>a\<in>basis. f ((g1 +++ g2) r) \<bullet> a * (vector_derivative (g1 +++ g2) (at r within {0..1}) \<bullet> a)) has_integral r) {0..1}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>r. ((\<lambda>r. \<Sum>a\<in>basis. f ((g1 +++ g2) r) \<bullet> a * (vector_derivative (g1 +++ g2) (at r within {0..1}) \<bullet> a)) has_integral r) {0..1}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
line_integral_exists f basis (g1 +++ g2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma measure_pmf_of_set:
  assumes "A \<noteq> {}" and "finite A"
  shows   "measure_pmf (pmf_of_set A) = uniform_measure (count_space UNIV) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf (pmf_of_set A) = uniform_measure (count_space UNIV) A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}
finite A

goal (1 subgoal):
 1. measure_pmf (pmf_of_set A) = uniform_measure (count_space UNIV) A
[PROOF STEP]
by (intro measure_eqI)
     (auto simp: emeasure_pmf_of_set divide_ennreal [symmetric] card_gt_0_iff
                  ennreal_of_nat_eq_real_of_nat)